diff --git a/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js b/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js index b3ab3cb77..b6d7564ab 100644 --- a/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js +++ b/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js @@ -388,7 +388,25 @@ var PMSCalendarController = AbstractController.extend({ } }); this._multi_calendar.on_calendar('hcalOnSplitReservation', function(ev){ - self.model.split_reservation(ev.detail.obj_id, ev.detail.nights); + var qdict = {}; + var dialog = new Dialog(self, { + title: _t("Confirm Split Reservation"), + buttons: [ + { + text: _t("Yes, split it"), + classes: 'btn-primary', + close: true, + click: function () { + self.model.split_reservation(ev.detail.obj_id, ev.detail.nights); + } + }, + { + text: _t("No"), + close: true + } + ], + $content: QWeb.render('HotelCalendar.ConfirmSplitOperation', qdict) + }).open(); }); this._multi_calendar.on_calendar('hcalOnClickReservation', function(ev){ //var res_id = ev.detail.reservationObj.getUserData('folio_id'); @@ -401,7 +419,25 @@ var PMSCalendarController = AbstractController.extend({ }); }); this._multi_calendar.on_calendar('hcalOnUnifyReservations', function(ev){ - self.model.unify_reservations(_.map(ev.detail.toUnify, 'id')); + var qdict = {}; + var dialog = new Dialog(self, { + title: _t("Confirm Unify Reservations"), + buttons: [ + { + text: _t("Yes, unify it"), + classes: 'btn-primary', + close: true, + click: function () { + self.model.unify_reservations(_.map(ev.detail.toUnify, 'id')); + } + }, + { + text: _t("No"), + close: true + } + ], + $content: QWeb.render('HotelCalendar.ConfirmUnifyOperation', qdict) + }).open(); }); this._multi_calendar.on_calendar('hcalOnSwapReservations', function(ev){ var qdict = {}; diff --git a/hotel_calendar/static/src/lib/hcalendar/js/hcalendar.js b/hotel_calendar/static/src/lib/hcalendar/js/hcalendar.js index 624a4f840..f6937f8fe 100644 --- a/hotel_calendar/static/src/lib/hcalendar/js/hcalendar.js +++ b/hotel_calendar/static/src/lib/hcalendar/js/hcalendar.js @@ -180,6 +180,9 @@ HotelCalendar.prototype = { for (var reserv of this._reservations) { reserv._html.classList.add('hcal-reservation-to-divide'); } + } else if (this._selectionMode === HotelCalendar.ACTION.UNIFY) { + this.reservationAction.action = HotelCalendar.ACTION.UNIFY; + this.reservationAction.toUnify = []; } else { for (var reserv of this._reservations) { reserv._html.classList.remove('hcal-reservation-to-divide'); @@ -189,13 +192,9 @@ HotelCalendar.prototype = { this._divideDivs[1].remove(); this._divideDivs = false; } - this._reset_action_reservation(); - } - if (this._selectionMode === HotelCalendar.ACTION.UNIFY) { - this.reservationAction.action = HotelCalendar.ACTION.UNIFY; - this.reservationAction.toUnify = []; - } else { + + this._dispatchUnifyReservations(); this._reset_action_reservation(); this._updateHighlightUnifyReservations(); } @@ -1894,7 +1893,7 @@ HotelCalendar.prototype = { }, _dispatchUnifyReservations: function() { - if (this.reservationAction.toUnify.length > 0) { + if (this.reservationAction.hasOwnProperty('toUnify') && this.reservationAction.toUnify.length > 1) { this._dispatchEvent( 'hcalOnUnifyReservations', { diff --git a/hotel_calendar/static/src/xml/hotel_calendar_templates.xml b/hotel_calendar/static/src/xml/hotel_calendar_templates.xml index 149e8d92a..3a25797bf 100644 --- a/hotel_calendar/static/src/xml/hotel_calendar_templates.xml +++ b/hotel_calendar/static/src/xml/hotel_calendar_templates.xml @@ -68,6 +68,22 @@ + +
+

The following changes will be made...

+ Split Reservation
+

Are you sure you want to make this changes?

+
+
+ + +
+

The following changes will be made...

+ Unify Reservations
+

Are you sure you want to make this changes?

+
+
+

WuBook: 1544109684