mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[WIP][MIG][11.0] Hotel Improvements + Hotel Calendar
This commit is contained in:
@@ -60,7 +60,7 @@ return AbstractModel.extend({
|
||||
return this._rpc({
|
||||
model: 'hotel.room.type',
|
||||
method: 'search_read',
|
||||
args: [false, ['cat_id','name']],
|
||||
args: [false, ['id','name']],
|
||||
context: Session.user_context,
|
||||
});
|
||||
},
|
||||
|
||||
@@ -71,7 +71,7 @@ var MPMSCalendarController = AbstractController.extend({
|
||||
self.renderer._days_tooltips = results['events'];
|
||||
var rooms = [];
|
||||
for (var r of results['rooms']) {
|
||||
var nroom = new HVRoom(
|
||||
var nroom = new HRoomType(
|
||||
r[0], // Id
|
||||
r[1], // Name
|
||||
r[2], // Capacity
|
||||
@@ -112,15 +112,15 @@ var MPMSCalendarController = AbstractController.extend({
|
||||
switch (notif[1]['type']) {
|
||||
case 'availability':
|
||||
var avail = notif[1]['availability'];
|
||||
var vroom = Object.keys(avail)[0];
|
||||
var day = Object.keys(avail[vroom])[0];
|
||||
var room_type = Object.keys(avail)[0];
|
||||
var day = Object.keys(avail[room_type])[0];
|
||||
var dt = HotelCalendarManagement.toMoment(day);
|
||||
var availability = {};
|
||||
availability[vroom] = [{
|
||||
availability[room_type] = [{
|
||||
'date': dt.format(ODOO_DATE_MOMENT_FORMAT),
|
||||
'avail': avail[vroom][day][0],
|
||||
'no_ota': avail[vroom][day][1],
|
||||
'id': avail[vroom][day][2]
|
||||
'avail': avail[room_type][day][0],
|
||||
'no_ota': avail[room_type][day][1],
|
||||
'id': avail[room_type][day][2]
|
||||
}];
|
||||
this.renderer._hcalendar.addAvailability(availability);
|
||||
break;
|
||||
@@ -143,22 +143,22 @@ var MPMSCalendarController = AbstractController.extend({
|
||||
this.renderer._hcalendar.addPricelist(pr);
|
||||
break;
|
||||
case 'restriction':
|
||||
// FIXME: Expected one day and one vroom
|
||||
// FIXME: Expected one day and one room_type
|
||||
var restriction = notif[1]['restriction'];
|
||||
var vroom = Object.keys(restriction)[0];
|
||||
var day = Object.keys(restriction[vroom])[0];
|
||||
var room_type = Object.keys(restriction)[0];
|
||||
var day = Object.keys(restriction[room_type])[0];
|
||||
var dt = HotelCalendarManagement.toMoment(day);
|
||||
var rest = {};
|
||||
rest[vroom] = [{
|
||||
rest[room_type] = [{
|
||||
'date': dt.format(ODOO_DATE_MOMENT_FORMAT),
|
||||
'min_stay': restriction[vroom][day][0],
|
||||
'min_stay_arrival': restriction[vroom][day][1],
|
||||
'max_stay': restriction[vroom][day][2],
|
||||
'max_stay_arrival': restriction[vroom][day][3],
|
||||
'closed': restriction[vroom][day][4],
|
||||
'closed_arrival': restriction[vroom][day][5],
|
||||
'closed_departure': restriction[vroom][day][6],
|
||||
'id': restriction[vroom][day][7]
|
||||
'min_stay': restriction[room_type][day][0],
|
||||
'min_stay_arrival': restriction[room_type][day][1],
|
||||
'max_stay': restriction[room_type][day][2],
|
||||
'max_stay_arrival': restriction[room_type][day][3],
|
||||
'closed': restriction[room_type][day][4],
|
||||
'closed_arrival': restriction[room_type][day][5],
|
||||
'closed_departure': restriction[room_type][day][6],
|
||||
'id': restriction[room_type][day][7]
|
||||
}];
|
||||
this.renderer._hcalendar.addRestrictions(rest);
|
||||
break;
|
||||
|
||||
@@ -132,7 +132,7 @@ var HotelCalendarManagementView = AbstractRenderer.extend({
|
||||
this._hcalendar = new HotelCalendarManagement('#hcal_management_widget', options, this.$el[0]);
|
||||
this._assignHCalendarEvents();
|
||||
|
||||
this.$CalendarHeaderDays = this.$el.find("div.table-vroom-data-header");
|
||||
this.$CalendarHeaderDays = this.$el.find("div.table-room_type-data-header");
|
||||
|
||||
// Sticky Header Days
|
||||
this.$ehcal.scroll(this._on_scroll.bind(this));
|
||||
@@ -409,7 +409,7 @@ var HotelCalendarManagementView = AbstractRenderer.extend({
|
||||
self._assign_extra_info();
|
||||
});
|
||||
this._last_dates = params['dates'];
|
||||
this.$CalendarHeaderDays = this.$el.find("div.table-vroom-data-header");
|
||||
this.$CalendarHeaderDays = this.$el.find("div.table-room_type-data-header");
|
||||
this._on_scroll(); // FIXME: Workaround for update sticky header
|
||||
},
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ var HotelCalendarManagementView = View.extend({
|
||||
}
|
||||
});
|
||||
|
||||
this.$CalendarHeaderDays = this.$el.find("div.table-vroom-data-header");
|
||||
this.$CalendarHeaderDays = this.$el.find("div.table-room_type-data-header");
|
||||
|
||||
// Sticky Header Days
|
||||
this.$ehcal.scroll(this._on_scroll.bind(this));
|
||||
@@ -204,7 +204,7 @@ var HotelCalendarManagementView = View.extend({
|
||||
self._days_tooltips = results['events'];
|
||||
var rooms = [];
|
||||
for (var r of results['rooms']) {
|
||||
var nroom = new HVRoom(
|
||||
var nroom = new HRoomType(
|
||||
r[0], // Id
|
||||
r[1], // Name
|
||||
r[2], // Capacity
|
||||
@@ -478,15 +478,15 @@ var HotelCalendarManagementView = View.extend({
|
||||
switch (notif[1]['type']) {
|
||||
case 'availability':
|
||||
var avail = notif[1]['availability'];
|
||||
var vroom = Object.keys(avail)[0];
|
||||
var day = Object.keys(avail[vroom])[0];
|
||||
var room_type = Object.keys(avail)[0];
|
||||
var day = Object.keys(avail[room_type])[0];
|
||||
var dt = HotelCalendarManagement.toMoment(day);
|
||||
var availability = {};
|
||||
availability[vroom] = [{
|
||||
availability[room_type] = [{
|
||||
'date': dt.format(ODOO_DATE_MOMENT_FORMAT),
|
||||
'avail': avail[vroom][day][0],
|
||||
'no_ota': avail[vroom][day][1],
|
||||
'id': avail[vroom][day][2]
|
||||
'avail': avail[room_type][day][0],
|
||||
'no_ota': avail[room_type][day][1],
|
||||
'id': avail[room_type][day][2]
|
||||
}];
|
||||
this._hcalendar.addAvailability(availability);
|
||||
break;
|
||||
@@ -509,22 +509,22 @@ var HotelCalendarManagementView = View.extend({
|
||||
this._hcalendar.addPricelist(pr);
|
||||
break;
|
||||
case 'restriction':
|
||||
// FIXME: Expected one day and one vroom
|
||||
// FIXME: Expected one day and one room_type
|
||||
var restriction = notif[1]['restriction'];
|
||||
var vroom = Object.keys(restriction)[0];
|
||||
var day = Object.keys(restriction[vroom])[0];
|
||||
var room_type = Object.keys(restriction)[0];
|
||||
var day = Object.keys(restriction[room_type])[0];
|
||||
var dt = HotelCalendarManagement.toMoment(day);
|
||||
var rest = {};
|
||||
rest[vroom] = [{
|
||||
rest[room_type] = [{
|
||||
'date': dt.format(ODOO_DATE_MOMENT_FORMAT),
|
||||
'min_stay': restriction[vroom][day][0],
|
||||
'min_stay_arrival': restriction[vroom][day][1],
|
||||
'max_stay': restriction[vroom][day][2],
|
||||
'max_stay_arrival': restriction[vroom][day][3],
|
||||
'closed': restriction[vroom][day][4],
|
||||
'closed_arrival': restriction[vroom][day][5],
|
||||
'closed_departure': restriction[vroom][day][6],
|
||||
'id': restriction[vroom][day][7]
|
||||
'min_stay': restriction[room_type][day][0],
|
||||
'min_stay_arrival': restriction[room_type][day][1],
|
||||
'max_stay': restriction[room_type][day][2],
|
||||
'max_stay_arrival': restriction[room_type][day][3],
|
||||
'closed': restriction[room_type][day][4],
|
||||
'closed_arrival': restriction[room_type][day][5],
|
||||
'closed_departure': restriction[room_type][day][6],
|
||||
'id': restriction[room_type][day][7]
|
||||
}];
|
||||
this._hcalendar.addRestrictions(rest);
|
||||
break;
|
||||
@@ -543,7 +543,7 @@ var HotelCalendarManagementView = View.extend({
|
||||
self._assign_extra_info();
|
||||
});
|
||||
this._last_dates = params['dates'];
|
||||
this.$CalendarHeaderDays = this.$el.find("div.table-vroom-data-header");
|
||||
this.$CalendarHeaderDays = this.$el.find("div.table-room_type-data-header");
|
||||
this._on_scroll(); // FIXME: Workaround for update sticky header
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user