[WIP] show channel availability in calendar management

This commit is contained in:
Pablo
2019-02-21 19:44:09 +01:00
parent f161f5baf1
commit 09e6cda918
2 changed files with 20 additions and 1 deletions

View File

@@ -217,6 +217,7 @@ HotelCalendarManagement.prototype = {
row = table.insertRow();
row.setAttribute('name', 'avail');
row.style.display = 'none';
cell = row.insertCell();
cell.setAttribute('colspan', '2');
telm = document.createElement("input");
@@ -229,8 +230,9 @@ HotelCalendarManagement.prototype = {
telm.classList.add('hcal-management-input');
telm.addEventListener('change', function(ev){ $this.onInputChange(ev, this); }, false);
cell.appendChild(telm);
cell = row.insertCell();
cell.setAttribute('colspan', '2');
cell.setAttribute('colspan', '1');
telm = document.createElement("input");
telm.setAttribute('id', this._sanitizeId(`MAX_AVAIL_${roomId}_${dateShortStr}`));
telm.setAttribute('name', 'max_avail');
@@ -242,6 +244,21 @@ 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(`CHANNEL_AVAIL_${roomId}_${dateShortStr}`));
telm.setAttribute('name', 'channel_avail');
telm.setAttribute('type', 'edit');
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.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();
@@ -725,6 +742,7 @@ HotelCalendarManagement.prototype = {
var inputIds = [
`QUOTA_${room_typeId}_${dd.format(HotelCalendarManagement._DATE_FORMAT_SHORT)}`, avail.quota,
`MAX_AVAIL_${room_typeId}_${dd.format(HotelCalendarManagement._DATE_FORMAT_SHORT)}`, avail.max_avail,
`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
];

View File

@@ -38,6 +38,7 @@ class HotelCalendarManagement(models.TransientModel):
'no_ota': avail and avail.no_ota or False,
'quota': avail and avail.quota or -1,
'max_avail': avail and avail.max_avail or -1,
'channel_avail': avail and avail.channel_bind_ids.channel_avail or room_type.channel_bind_ids.default_availability
}
@api.model