[IMP] Calendar Performance

This commit is contained in:
Alexandre Díaz
2019-01-13 02:10:33 +01:00
parent 03457f2228
commit 279675e2ae
10 changed files with 181 additions and 178 deletions

View File

@@ -82,7 +82,7 @@ function HotelCalendar(/*String*/querySelector, /*Dictionary*/options, /*List*/p
this._reservationsMap = {}; // Store Reservations Mapped by Room for Search Purposes
this._modeSwap = HotelCalendar.MODE.NONE; // Store Swap Mode
this._selectionMode = HotelCalendar.MODE.NONE;
this._endDate = this.options.startDate.clone().add(this.options.days, 'd'); // Store End Calendar Day
this._endDate = this.options.startDate.clone().add(this.options.days+1, 'd'); // Store End Calendar Day
this._tableCreated = false; // Store Flag to Know Calendar Creation
this._cellSelection = {start:false, end:false, current:false}; // Store Info About Selected Cells
this._lazyModeReservationsSelection = false; // Store Info About Timer for Selection Action
@@ -152,7 +152,7 @@ HotelCalendar.prototype = {
this.options.orig_days = days;
this.options.days = this.parseDays(days) + 1;
}
this._endDate = this.options.startDate.clone().add(this.options.days, 'd');
this._endDate = this.options.startDate.clone().add(this.options.days+1, 'd');
/*this.e.dispatchEvent(new CustomEvent(
'hcOnChangeDate',
@@ -865,7 +865,7 @@ HotelCalendar.prototype = {
if (!day) { return false; }
var num_rooms = this._roomCapacityTotal;
num_rooms -= _.reduce(this.getReservationsByDay(day, true), function(memo, r){ return memo + (r.room && r.room.shared)?r.getTotalPersons(false):1; }, 0);
num_rooms -= _.reduce(this.getReservationsByDay(day, true), function(memo, r){ return memo + ((r.room && r.room.shared)?r.getTotalPersons(false):1); }, 0);
return num_rooms;
},
@@ -2382,6 +2382,10 @@ HotelCalendar.prototype = {
return true;
},
getDates: function() {
return [this.options.startDate.clone(), this._endDate.clone()];
},
//==== EVENT FUNCTIONS
_onInputChange: function(/*EventObject*/ev, /*HTMLObject*/elm) {
//var parentCell = this.edtable.querySelector(`#${elm.dataset.hcalParentCell}`);