[WIP] Manage click and dblclick on Calendar

This commit is contained in:
Pablo
2018-12-24 14:28:35 +01:00
parent 4f0980e41c
commit fbe4ff1d01
2 changed files with 28 additions and 5 deletions

View File

@@ -374,12 +374,13 @@ var PMSCalendarController = AbstractController.extend({
this._multi_calendar.on_calendar('hcalOnSavePricelist', function(ev){
self.savePricelist(ev.detail.calendar_obj, ev.detail.pricelist_id, ev.detail.pricelist);
});
this._multi_calendar.on_calendar('hcalOnMouseEnterReservation', function(ev){
this._multi_calendar.on_calendar('hcalOnClickReservation', function(ev){
console.log('hcalOnClickReservation');
if (ev.detail.reservationObj) {
var tp = self._multi_calendar._reserv_tooltips[ev.detail.reservationObj.id];
var qdict = self._generate_reservation_tooltip_dict(tp);
$(ev.detail.reservationDiv).tooltip('destroy').tooltip({
trigger: 'manual',
trigger: 'click',
animation: false,
html: true,
placement: 'bottom',
@@ -408,8 +409,9 @@ var PMSCalendarController = AbstractController.extend({
$content: QWeb.render('HotelCalendar.ConfirmSplitOperation', qdict)
}).open();
});
this._multi_calendar.on_calendar('hcalOnClickReservation', function(ev){
this._multi_calendar.on_calendar('hcalOnDblClickReservation', function(ev){
//var res_id = ev.detail.reservationObj.getUserData('folio_id');
console.log('hcalOnDblClickReservation');
$(ev.detail.reservationDiv).tooltip('hide');
self.do_action({
type: 'ir.actions.act_window',
@@ -682,7 +684,6 @@ var PMSCalendarController = AbstractController.extend({
},
_generate_reservation_tooltip_dict: function(tp) {
console.log(tp);
return {
'folio_name': tp['folio_name'],
'name': tp['name'],

View File

@@ -2067,6 +2067,25 @@ HotelCalendar.prototype = {
};
rdiv.addEventListener('mousedown', _funcEvent, false);
rdiv.addEventListener('touchstart', _funcEvent, false);
rdiv.addEventListener('click', function(ev){
$this._dispatchEvent(
'hcalOnClickReservation',
{
'event': ev,
'reservationDiv': this,
'reservationObj': $this.getReservation(this.dataset.hcalReservationObjId)
});
}, false);
rdiv.addEventListener('dblclick', function(ev){
$this._dispatchEvent(
'hcalOnDblClickReservation',
{
'event': ev,
'reservationDiv': this,
'reservationObj': $this.getReservation(this.dataset.hcalReservationObjId)
});
}, false);
/*
rdiv.addEventListener('mouseenter', function(ev){
$this._dispatchEvent(
'hcalOnMouseEnterReservation',
@@ -2076,6 +2095,7 @@ HotelCalendar.prototype = {
'reservationObj': $this.getReservation(this.dataset.hcalReservationObjId)
});
}, false);
*/
rdiv.addEventListener('mouseleave', function(ev){
$this._dispatchEvent(
'hcalOnMouseLeaveReservation',
@@ -2704,13 +2724,15 @@ HotelCalendar.prototype = {
}
reservDiv.classList.remove('hcal-reservation-invalid');
} else {
/*
this._dispatchEvent(
'hcalOnClickReservation',
'hcalOnDblClickReservation',
{
'event': ev,
'reservationDiv': reservDiv,
'reservationObj': reserv
});
*/
}
this._reset_action_reservation();