mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[WIP] show channel availability in calendar management
This commit is contained in:
@@ -217,6 +217,7 @@ HotelCalendarManagement.prototype = {
|
|||||||
row = table.insertRow();
|
row = table.insertRow();
|
||||||
row.setAttribute('name', 'avail');
|
row.setAttribute('name', 'avail');
|
||||||
row.style.display = 'none';
|
row.style.display = 'none';
|
||||||
|
|
||||||
cell = row.insertCell();
|
cell = row.insertCell();
|
||||||
cell.setAttribute('colspan', '2');
|
cell.setAttribute('colspan', '2');
|
||||||
telm = document.createElement("input");
|
telm = document.createElement("input");
|
||||||
@@ -229,8 +230,9 @@ HotelCalendarManagement.prototype = {
|
|||||||
telm.classList.add('hcal-management-input');
|
telm.classList.add('hcal-management-input');
|
||||||
telm.addEventListener('change', function(ev){ $this.onInputChange(ev, this); }, false);
|
telm.addEventListener('change', function(ev){ $this.onInputChange(ev, this); }, false);
|
||||||
cell.appendChild(telm);
|
cell.appendChild(telm);
|
||||||
|
|
||||||
cell = row.insertCell();
|
cell = row.insertCell();
|
||||||
cell.setAttribute('colspan', '2');
|
cell.setAttribute('colspan', '1');
|
||||||
telm = document.createElement("input");
|
telm = document.createElement("input");
|
||||||
telm.setAttribute('id', this._sanitizeId(`MAX_AVAIL_${roomId}_${dateShortStr}`));
|
telm.setAttribute('id', this._sanitizeId(`MAX_AVAIL_${roomId}_${dateShortStr}`));
|
||||||
telm.setAttribute('name', 'max_avail');
|
telm.setAttribute('name', 'max_avail');
|
||||||
@@ -242,6 +244,21 @@ HotelCalendarManagement.prototype = {
|
|||||||
telm.addEventListener('change', function(ev){ $this.onInputChange(ev, this); }, false);
|
telm.addEventListener('change', function(ev){ $this.onInputChange(ev, this); }, false);
|
||||||
cell.appendChild(telm);
|
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 = table.insertRow();
|
||||||
row.setAttribute('name', 'rest_a');
|
row.setAttribute('name', 'rest_a');
|
||||||
cell = row.insertCell();
|
cell = row.insertCell();
|
||||||
@@ -725,6 +742,7 @@ HotelCalendarManagement.prototype = {
|
|||||||
var inputIds = [
|
var inputIds = [
|
||||||
`QUOTA_${room_typeId}_${dd.format(HotelCalendarManagement._DATE_FORMAT_SHORT)}`, avail.quota,
|
`QUOTA_${room_typeId}_${dd.format(HotelCalendarManagement._DATE_FORMAT_SHORT)}`, avail.quota,
|
||||||
`MAX_AVAIL_${room_typeId}_${dd.format(HotelCalendarManagement._DATE_FORMAT_SHORT)}`, avail.max_avail,
|
`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
|
`NO_OTA_${room_typeId}_${dd.format(HotelCalendarManagement._DATE_FORMAT_SHORT)}`, avail.no_ota
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ class HotelCalendarManagement(models.TransientModel):
|
|||||||
'no_ota': avail and avail.no_ota or False,
|
'no_ota': avail and avail.no_ota or False,
|
||||||
'quota': avail and avail.quota or -1,
|
'quota': avail and avail.quota or -1,
|
||||||
'max_avail': avail and avail.max_avail 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
|
@api.model
|
||||||
|
|||||||
Reference in New Issue
Block a user