From e044a919892d72c0358a38436753a88115653f22 Mon Sep 17 00:00:00 2001 From: Pablo Date: Mon, 28 Jan 2019 12:35:22 +0100 Subject: [PATCH] [UPD] Prevent create a reservation is there is a popover active --- .../src/js/views/calendar/hotel_calendar_controller.js | 4 ++++ hotel_calendar/static/src/lib/hcalendar/js/hcalendar.js | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) 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 c5a40b90d..d40470f10 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 @@ -699,6 +699,10 @@ var PMSCalendarController = AbstractController.extend({ }).open(); }); + this._multi_calendar.on_calendar('hcalOnKeyPressed', function(ev){ + /* add actions */ + }); + this._multi_calendar.on_calendar('hcalOnDateChanged', function(ev){ var $dateTimePickerBegin = this.renderer.$el.find('#pms-menu #date_begin'); $dateTimePickerBegin.data("ignore_onchange", true); diff --git a/hotel_calendar/static/src/lib/hcalendar/js/hcalendar.js b/hotel_calendar/static/src/lib/hcalendar/js/hcalendar.js index b23c39f3b..a506278d6 100644 --- a/hotel_calendar/static/src/lib/hcalendar/js/hcalendar.js +++ b/hotel_calendar/static/src/lib/hcalendar/js/hcalendar.js @@ -2075,7 +2075,6 @@ HotelCalendar.prototype = { 'reservationObj': $this.getReservation(this.dataset.hcalReservationObjId) }); }, false); - */ rdiv.addEventListener('mouseleave', function(ev){ $this._dispatchEvent( 'hcalOnMouseLeaveReservation', @@ -2085,6 +2084,7 @@ HotelCalendar.prototype = { 'reservationObj': $this.getReservation(this.dataset.hcalReservationObjId) }); }, false); + */ } }, @@ -2487,7 +2487,12 @@ HotelCalendar.prototype = { }; this._splitReservation = false; this._splitDate = false; + } else if ($(".marked-as-having-a-popover").length === 1) { + // TODO: better call _destroy_and_clear_popover_mark defined in hotel_calendar_controller.js + $(".marked-as-having-a-popover").popover('destroy'); + $('.hcal-reservation').removeClass("marked-as-having-a-popover"); } else { + // FIXME: Prevent multiple clicks in a row this._cellSelection.start = this._cellSelection.current = ev.target; this._cellSelection.end = false; this._updateCellSelection();