[IMP] UI calendar management

This commit is contained in:
Pablo
2019-02-22 17:17:26 +01:00
parent 2ae074c16b
commit 39eba19b61

View File

@@ -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<inputIds.length; i+=2) {
var inputId = this._sanitizeId(inputIds[i]);
var input = this.etable.querySelector(`#${inputId}`);
@@ -763,7 +768,8 @@ HotelCalendarManagement.prototype = {
}
else {
input.value = inputIds[i+1];
input.style.backgroundColor = (i == 0 && input.value == 0)?'rgb(255, 174, 174)':'';
input.style.backgroundColor = (input.name === 'channel_avail' && input.value == 0)?'rgb(255, 174, 174)':'';
// input.style.color = (input.name === 'quota' && input.value == 0)?'rgb(255, 174, 174)':'';
}
}
}