From 39eba19b61830ef7f3d4c44c7a687c5f72f2f301 Mon Sep 17 00:00:00 2001 From: Pablo Date: Fri, 22 Feb 2019 17:17:26 +0100 Subject: [PATCH] [IMP] UI calendar management --- .../lib/hcalendar/js/hcalendar_management.js | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/hotel_calendar/static/src/lib/hcalendar/js/hcalendar_management.js b/hotel_calendar/static/src/lib/hcalendar/js/hcalendar_management.js index aa76910cf..35d28cca1 100644 --- a/hotel_calendar/static/src/lib/hcalendar/js/hcalendar_management.js +++ b/hotel_calendar/static/src/lib/hcalendar/js/hcalendar_management.js @@ -200,6 +200,7 @@ HotelCalendarManagement.prototype = { row = table.insertRow(); row.setAttribute('name', 'price'); + cell = row.insertCell(); cell.setAttribute('colspan', '4'); telm = document.createElement("input"); @@ -219,7 +220,7 @@ HotelCalendarManagement.prototype = { row.style.display = 'none'; cell = row.insertCell(); - cell.setAttribute('colspan', '2'); + cell.setAttribute('colspan', '1'); telm = document.createElement("input"); telm.setAttribute('id', this._sanitizeId(`QUOTA_${roomId}_${dateShortStr}`)); telm.setAttribute('name', 'quota'); @@ -244,6 +245,19 @@ HotelCalendarManagement.prototype = { telm.addEventListener('change', function(ev){ $this.onInputChange(ev, this); }, false); cell.appendChild(telm); + cell = row.insertCell(); + cell.setAttribute('colspan', '1'); + telm = document.createElement("input"); + telm.setAttribute('id', this._sanitizeId(`FREE_ROOMS_${roomId}_${dateShortStr}`)); + telm.setAttribute('name', 'free_rooms'); + telm.setAttribute('type', 'edit'); + telm.setAttribute('title', this._t('Free Rooms')); + telm.setAttribute('readonly', 'readonly'); + telm.setAttribute('disabled', 'disabled'); + telm.style.backgroundColor = 'lightgray'; + telm.dataset.hcalParentCell = parentCell.getAttribute('id'); + cell.appendChild(telm); + cell = row.insertCell(); cell.setAttribute('colspan', '1'); telm = document.createElement("input"); @@ -253,14 +267,14 @@ HotelCalendarManagement.prototype = { telm.setAttribute('title', this._t('Channel Availability')); telm.setAttribute('readonly', 'readonly'); telm.setAttribute('disabled', 'disabled'); - telm.style.backgroundColor = 'lightgray'; - telm.value = telm.dataset.orgValue = 0; + telm.value = telm.dataset.orgValue = room.channel_avail; telm.dataset.hcalParentCell = parentCell.getAttribute('id'); telm.classList.add('hcal-management-input'); cell.appendChild(telm); row = table.insertRow(); row.setAttribute('name', 'rest_a'); + cell = row.insertCell(); telm = document.createElement("input"); telm.setAttribute('id', this._sanitizeId(`MIN_STAY_${roomId}_${dateShortStr}`)); @@ -273,6 +287,7 @@ HotelCalendarManagement.prototype = { telm.classList.add('hcal-border-radius-left'); telm.addEventListener('change', function(ev){ $this.onInputChange(ev, this); }, false); cell.appendChild(telm); + cell = row.insertCell(); telm = document.createElement("input"); telm.setAttribute('id', this._sanitizeId(`MAX_STAY_${roomId}_${dateShortStr}`)); @@ -285,6 +300,7 @@ HotelCalendarManagement.prototype = { telm.classList.add('hcal-border-radius-right'); telm.addEventListener('change', function(ev){ $this.onInputChange(ev, this); }, false); cell.appendChild(telm); + cell = row.insertCell(); telm = document.createElement("input"); telm.setAttribute('id', this._sanitizeId(`MIN_STAY_ARRIVAL_${roomId}_${dateShortStr}`)); @@ -297,6 +313,7 @@ HotelCalendarManagement.prototype = { telm.classList.add('hcal-border-radius-left'); telm.addEventListener('change', function(ev){ $this.onInputChange(ev, this); }, false); cell.appendChild(telm); + cell = row.insertCell(); telm = document.createElement("input"); telm.setAttribute('id', this._sanitizeId(`MAX_STAY_ARRIVAL_${roomId}_${dateShortStr}`)); @@ -339,21 +356,10 @@ HotelCalendarManagement.prototype = { selectOpt.textContent = this._t("C. Arrival"); telm.appendChild(selectOpt); cell.appendChild(telm); - cell = row.insertCell(); - cell.setAttribute('colspan', '1'); - telm = document.createElement("input"); - telm.setAttribute('id', this._sanitizeId(`FREE_ROOMS_${roomId}_${dateShortStr}`)); - telm.setAttribute('name', 'free_rooms'); - telm.setAttribute('type', 'edit'); - telm.setAttribute('title', this._t('Free Rooms')); - telm.setAttribute('readonly', 'readonly'); - telm.setAttribute('disabled', 'disabled'); - telm.style.backgroundColor = 'lightgray'; - telm.dataset.hcalParentCell = parentCell.getAttribute('id'); - cell.appendChild(telm); row = table.insertRow(); row.setAttribute('name', 'rest_c'); + cell = row.insertCell(); cell.style.textAlign = 'center'; cell.setAttribute('colspan', '4'); @@ -745,7 +751,6 @@ HotelCalendarManagement.prototype = { `CHANNEL_AVAIL_${room_typeId}_${dd.format(HotelCalendarManagement._DATE_FORMAT_SHORT)}`, avail.channel_avail, `NO_OTA_${room_typeId}_${dd.format(HotelCalendarManagement._DATE_FORMAT_SHORT)}`, avail.no_ota ]; - for (var i=0; i