[IMP] Confirm split and unify

This commit is contained in:
QS5ELkMu
2018-12-22 17:49:02 +01:00
parent 9461d4b4fa
commit c9cc6935aa
3 changed files with 60 additions and 9 deletions

View File

@@ -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 = {};

View File

@@ -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',
{

View File

@@ -68,6 +68,22 @@
</div>
</t>
<t t-name="HotelCalendar.ConfirmSplitOperation">
<div class="content">
<p>The following changes will be made...</p>
<span><strong>Split Reservation</strong></span><br/>
<p>Are you sure you want to make this changes?</p>
</div>
</t>
<t t-name="HotelCalendar.ConfirmUnifyOperation">
<div class="content">
<p>The following changes will be made...</p>
<span><strong>Unify Reservations</strong></span><br/>
<p>Are you sure you want to make this changes?</p>
</div>
</t>
<t t-name="HotelCalendar.TooltipReservation.Channel.ota">
<p>WuBook: 1544109684</p>