diff --git a/table_reservation_on_website/__manifest__.py b/table_reservation_on_website/__manifest__.py index 16c4bedc2..10b11287a 100644 --- a/table_reservation_on_website/__manifest__.py +++ b/table_reservation_on_website/__manifest__.py @@ -21,7 +21,7 @@ ############################################################################### { 'name': 'Table Reservation On POS And Website', - 'version': '17.0.1.1.3', + 'version': '17.0.1.2.3', 'category': 'eCommerce,Point of Sale', 'summary': 'Reserve tables in POS from website', 'description': """This module enables to reserve tables in POS from website. diff --git a/table_reservation_on_website/controllers/__init__.py b/table_reservation_on_website/controllers/__init__.py index 882148379..367d21491 100644 --- a/table_reservation_on_website/controllers/__init__.py +++ b/table_reservation_on_website/controllers/__init__.py @@ -21,3 +21,4 @@ ############################################################################### from . import table_reservation_on_website_website_sale from . import table_reservation_on_website +from . import pos_config diff --git a/table_reservation_on_website/controllers/pos_config.py b/table_reservation_on_website/controllers/pos_config.py new file mode 100644 index 000000000..4a35f645e --- /dev/null +++ b/table_reservation_on_website/controllers/pos_config.py @@ -0,0 +1,31 @@ +from datetime import datetime + +from odoo import http +from odoo.http import request, _logger + + +class ResConfigSettingsController(http.Controller): + + @http.route('/pos/get_opening_closing_hours', type='json', auth='public', methods=['POST']) + def get_opening_closing_hours(self): + res_config = request.env['res.config.settings'].sudo().search([], limit=1) + # Ensure proper time format + try: + opening_hour = self.float_to_time(float(res_config.pos_opening_hour)) + closing_hour = self.float_to_time(float(res_config.pos_closing_hour)) + except ValueError: + opening_hour = "00:00" + closing_hour = "23:59" + + if res_config: + return { + 'opening_hour': opening_hour, + 'closing_hour': closing_hour + } + return {'error': 'POS configuration not found'} + + def float_to_time(self, hour_float): + """ Convert float hours (e.g., 8.5 → 08:30) to HH:MM format """ + hours = int(hour_float) + minutes = int((hour_float - hours) * 60) + return f"{hours:02d}:{minutes:02d}" diff --git a/table_reservation_on_website/controllers/table_reservation_on_website.py b/table_reservation_on_website/controllers/table_reservation_on_website.py index e58f7e818..effcbab39 100644 --- a/table_reservation_on_website/controllers/table_reservation_on_website.py +++ b/table_reservation_on_website/controllers/table_reservation_on_website.py @@ -30,8 +30,24 @@ class TableReservation(http.Controller): @http.route(['/table_reservation'], type='http', auth='user', website=True) def table_reservation(self): """ For rendering table reservation template """ + pos_config = request.env['res.config.settings'].sudo().search([], + limit=1) + try: + opening_hour = self.float_to_time(float(pos_config.pos_opening_hour)) + closing_hour = self.float_to_time(float(pos_config.pos_closing_hour)) + except ValueError: + opening_hour = "00:00" + closing_hour = "23:59" + return http.request.render( - "table_reservation_on_website.table_reservation", {}) + "table_reservation_on_website.table_reservation", {'opening_hour': opening_hour, + 'closing_hour': closing_hour}) + + def float_to_time(self, hour_float): + """ Convert float hours (e.g., 8.5 → 08:30) to HH:MM format """ + hours = int(hour_float) + minutes = int((hour_float - hours) * 60) + return f"{hours:02d}:{minutes:02d}" @http.route(['/restaurant/floors'], type='http', auth='user', website=True) def restaurant_floors(self, **kwargs): diff --git a/table_reservation_on_website/doc/RELEASE_NOTES.md b/table_reservation_on_website/doc/RELEASE_NOTES.md index 9acd544b8..3db2bea20 100644 --- a/table_reservation_on_website/doc/RELEASE_NOTES.md +++ b/table_reservation_on_website/doc/RELEASE_NOTES.md @@ -19,3 +19,8 @@ #### Version 17.0.1.1.3 ##### BUGFIX - Updated the module work flow. + +#### 18.02.2025 +#### Version 17.0.1.2.3 +##### BUGFIX +- Updated module to set opening and closing hours. diff --git a/table_reservation_on_website/models/pos_config.py b/table_reservation_on_website/models/pos_config.py index 758e845ef..f1925d8de 100644 --- a/table_reservation_on_website/models/pos_config.py +++ b/table_reservation_on_website/models/pos_config.py @@ -19,7 +19,7 @@ # If not, see . # ############################################################################### -from odoo import fields, models +from odoo import api, fields, models class PosConfig(models.Model): @@ -38,7 +38,33 @@ class PosConfig(models.Model): help="Enable to apply charge for reservations.") is_paid = fields.Boolean(string="Is paid reservation", help="To identify if the reservation is already paid") + set_opening_hours = fields.Boolean( + string="Set Opening and Closing Hours", + help="Enable to configure restaurant opening and closing hours.") + opening_hour = fields.Float( + string="Opening Hour", + compute="_compute_opening_hour", + store=True + ) + closing_hour = fields.Float( + string="Closing Hour", + compute="_compute_closing_hour", + store=True + ) + def _compute_opening_hour(self): + """ Fetch opening hour from system parameters """ + for record in self: + record.opening_hour = float( + self.env['ir.config_parameter'].sudo().get_param( + 'table_reservation_on_website.opening_hour', default=0.0)) + + def _compute_closing_hour(self): + """ Fetch closing hour from system parameters """ + for record in self: + record.closing_hour = float( + self.env['ir.config_parameter'].sudo().get_param( + 'table_reservation_on_website.closing_hour', default=23.99)) def _compute_has_lead_time(self): """ To check whether lead time is enabled from settings """ if self.env['ir.config_parameter'].sudo().get_param( @@ -54,3 +80,5 @@ class PosConfig(models.Model): self.has_reservation_charge = True else: self.has_reservation_charge = False + + diff --git a/table_reservation_on_website/models/res_config_settings.py b/table_reservation_on_website/models/res_config_settings.py index fbee5b44a..28f256b83 100644 --- a/table_reservation_on_website/models/res_config_settings.py +++ b/table_reservation_on_website/models/res_config_settings.py @@ -42,6 +42,21 @@ class ResConfigSettings(models.TransientModel): string="Reservation Lead Time", help="The order should be reserved hours" "before the booking start time.") + pos_set_opening_hours = fields.Boolean( + related='pos_config_id.set_opening_hours', + readonly=False, + help="Enable to configure restaurant opening and closing hours." + ) + pos_opening_hour = fields.Float( + related='pos_config_id.opening_hour', + readonly=False, + help="Restaurant opening hour in 24-hour format." + ) + pos_closing_hour = fields.Float( + related='pos_config_id.closing_hour', + readonly=False, + help="Restaurant closing hour in 24-hour format." + ) def set_values(self): """ To set the value for fields in config setting """ @@ -53,6 +68,15 @@ class ResConfigSettings(models.TransientModel): self.env['ir.config_parameter'].sudo().set_param( 'table_reservation_on_website.reservation_lead_time', self.reservation_lead_time) + self.env['ir.config_parameter'].sudo().set_param( + 'table_reservation_on_website.set_opening_hours', + self.pos_set_opening_hours) + self.env['ir.config_parameter'].sudo().set_param( + 'table_reservation_on_website.opening_hour', + self.pos_opening_hour) + self.env['ir.config_parameter'].sudo().set_param( + 'table_reservation_on_website.closing_hour', + self.pos_closing_hour) return res def get_values(self): @@ -69,4 +93,16 @@ class ResConfigSettings(models.TransientModel): res.update( reservation_lead_time=reservation_lead_time if reservation_lead_time else 0.0) + set_opening_hours = self.env['ir.config_parameter'].sudo().get_param( + 'table_reservation_on_website.set_opening_hours') + res.update(pos_set_opening_hours=bool(set_opening_hours)) + opening_hour = self.env['ir.config_parameter'].sudo().get_param( + 'table_reservation_on_website.opening_hour') + res.update( + pos_opening_hour=float(opening_hour) if opening_hour else 0.0) + closing_hour = self.env[ + 'ir.config_parameter'].sudo().get_param( + 'table_reservation_on_website.closing_hour') + res.update( + pos_closing_hour=float(closing_hour) if opening_hour else 0.0) return res diff --git a/table_reservation_on_website/static/description/assets/screenshots/1.png b/table_reservation_on_website/static/description/assets/screenshots/1.png index b403f65a4..8620243d6 100644 Binary files a/table_reservation_on_website/static/description/assets/screenshots/1.png and b/table_reservation_on_website/static/description/assets/screenshots/1.png differ diff --git a/table_reservation_on_website/static/description/assets/screenshots/17.png b/table_reservation_on_website/static/description/assets/screenshots/17.png index f5daf0b74..433e2dc6f 100644 Binary files a/table_reservation_on_website/static/description/assets/screenshots/17.png and b/table_reservation_on_website/static/description/assets/screenshots/17.png differ diff --git a/table_reservation_on_website/static/description/assets/screenshots/22.png b/table_reservation_on_website/static/description/assets/screenshots/22.png new file mode 100644 index 000000000..a2109719f Binary files /dev/null and b/table_reservation_on_website/static/description/assets/screenshots/22.png differ diff --git a/table_reservation_on_website/static/description/assets/screenshots/4.png b/table_reservation_on_website/static/description/assets/screenshots/4.png index 950bca073..88897b0bd 100644 Binary files a/table_reservation_on_website/static/description/assets/screenshots/4.png and b/table_reservation_on_website/static/description/assets/screenshots/4.png differ diff --git a/table_reservation_on_website/static/description/index.html b/table_reservation_on_website/static/description/index.html index 9c49969f6..50960713b 100644 --- a/table_reservation_on_website/static/description/index.html +++ b/table_reservation_on_website/static/description/index.html @@ -5,807 +5,1049 @@ Odoo App 3 Index - - + + - + -
-
-
-
-
- -
-
-
- Community -
+
+
+
+
+
+ +
+
+
+ Community
-
-
-

+
+

- Table Reservation On POS And Website

-

- Reserve POS Tables Through Website And Pos. -

-
- -
+ Table Reservation On POS And Website

+

+ Reserve POS Tables Through Website And Pos. +

+
+
-
-
-

Key Highlights -

-
-
-
-
+
+

+ Key Highlights +

+
+
+
+
-
- -
-
-

Reserve Tables Through Website.

-

Users will be Able to Choose the Tables and Date. -

-
+ +
+
+

+ Reserve Tables Through Website.

+

Users will be + Able to Choose the Tables and Date. +

-
-
+
-
- -
-
-

Reserved Tables will be Displayed in POS.

-

- Tables Reserved will be Displayed with a Reserved - Label in POS, so it Makes Easy to Identify Reserved Tables. -

-
+ +
+
+

+ Reserved Tables will be Displayed in POS.

+

+ Tables Reserved will be Displayed with a + Reserved + Label in POS, so it Makes Easy to Identify + Reserved Tables. +

-
- +
+
+
+
-
- -
-
-

- Reservation Charge.

-

- Enable the Reservation Charge if Payment is needed to Reserve Tables, Otherwise there will be no Payments. +

+ +
+
+

+ Reservation Charge.

+

+ Enable the Reservation Charge if Payment is + needed to Reserve Tables, Otherwise there + will be no Payments.

-
-
-
+
+
-
- -
-
-

- Lead Time.

-

- Enable the Lead Time if the Table should be Reserved a Certain Amount of Time before the Booking Start Time. - You can Edit the Time for Each Reservation Separately from POS. +

+ +
+
+

+ Lead Time.

+

+ Enable the Lead Time if the Table should be + Reserved a Certain Amount of Time before the + Booking Start Time. + You can Edit the Time for Each Reservation + Separately from POS.

-
-
-
+
+
+
+ +
+
+

+ Opening and Closing Hours.

+

+ Enable the Set Opening and Closing Hours + option to define the restaurant's operating + hours. Tables can only be reserved within + these specified hours.

+
+
+
+
+
-
- -
-
- -
-
-

- Add Reservation Amount for POS Tables in Floors.

-

- Go to Configuration -> Floor Plans, Select Floor and Add Reservation Amount for - Tables. -

-
+
+ +
+
+ +
+
+

+ Add Reservation Amount for POS Tables in + Floors.

+

+ Go to Configuration -> Floor Plans, Select + Floor and Add Reservation Amount for + Tables. +

-
-
+
+
-
- -
-
-

- Booking Table from Website.

-

Select Booking Date and Time.

-
+
+ +
+
+

+ Booking Table from Website.

+

Select + Booking Date and Time.

-
-
+
+
-
- -
-
-

- Select Floor.

-
+
+ +
+
+

+ Select Floor.

-
-
+
+
-
- -
-
-

- Table Reservation.

-

Click the Button 'Booking Confirm' After Selecting the Tables. -

-
+
+ +
+
+

+ Table Reservation.

+

Click the + Button 'Booking Confirm' After Selecting the + Tables. +

-
-
+
+
-
- -
-
-

- Table is Reserved.

-
+
+ +
+
+

+ Table is Reserved.

-
-
+
+
-
- -
-
-

- Table Reservation in Backend.

-

- New Reservation will be created in the Backend. Go to Configuration -> Table Reservation. -

-
+
+ +
+
+

+ Table Reservation in Backend.

+

+ New Reservation will be created in the + Backend. Go to Configuration -> Table + Reservation. +

-
-
+
+
-
- -
-
-

- Table Reservation Details.

-

- Order Type should be 'Website' if the Reservation is created from Website and 'POS' if it is created from POS. -

-
+
+ +
+
+

+ Table Reservation Details.

+

+ Order Type should be 'Website' if the + Reservation is created from Website and + 'POS' if it is created from POS. +

-
-
+
+
-
- -
-
-

- Table Booking with Reservation Amount.

-

- If the Reservation Charge is Enabled then Booking Amount will be Displayed. -

-
+
+ +
+
+

+ Table Booking with Reservation Amount.

+

+ If the Reservation Charge is Enabled then + Booking Amount will be Displayed. +

-
-
+
+
-
- -
-
-

- Cart.

-

- Redirect to Cart page while Clicking the Button 'Booking Confirm' and Make the Payment. -

-
+
+ +
+
+

+ Cart.

+

+ Redirect to Cart page while Clicking the + Button 'Booking Confirm' and Make the + Payment. +

-
-
+
+
-
- -
-
-

- Sale Order.

-

- In Sale Order we can see the Table Reservation Details. -

-
+
+ +
+
+

+ Sale Order.

+

+ In Sale Order we can see the Table + Reservation Details. +

-
-
+
+
-
- -
-
-

- Book Table from POS.

-

- Click on 'Book table' to Display the Reservations. -

-
+
+ +
+
+

+ Book Table from POS.

+

+ Click on 'Book table' to Display the + Reservations. +

-
-
+
+
-
- -
-
-

- Reservation Screen in POS.

-

- Displays Current and Upcoming Reservations in POS. You can Create and Edit reservations from here. -

-
+
+ +
+
+

+ Reservation Screen in POS.

+

+ Displays Current and Upcoming Reservations + in POS. You can Create and Edit reservations + from here. +

-
-
+
+
-
- -
-
-

- Create New Reservations.

-

- You can Create New Reservations by Clicking on 'Create' Button and Fill the Details. - Select any Floor to Choose the Available Tables of Corresponding Floor. If Reservation Charge is - not enabled, then you can Confirm your Booking on Clicking 'Confirm' Button. -

-
+
+ +
+
+

+ Create New Reservations.

+

+ You can Create New Reservations by Clicking + on 'Create' Button and Fill the Details. + Select any Floor to Choose the Available + Tables of Corresponding Floor. If + Reservation Charge is + not enabled, then you can Confirm your + Booking on Clicking 'Confirm' Button. +

-
-
+
+
-
- -
-
-

- Charge for Reservations from POS.

-

- If Reservation Charge is enabled, the Amount will be visible, and you need to Pay the Reservation - Amount for Booking by Clicking on 'Pay'. -

-
+
+ +
+
+

+ Charge for Reservations from POS.

+

+ If Reservation Charge is enabled, the Amount + will be visible, and you need to Pay the + Reservation + Amount for Booking by Clicking on 'Pay'. +

-
-
+
+
-
- -
-
-

- Reservation Payment.

-

- Clicking on the Pay Button will create an Order in th POS for the Product 'Table Booking' with a - Unit Price equal to the Reservation Amount of the selected Tables, and you can then make the Payment. -

-
+
+ +
+
+

+ Reservation Payment.

+

+ Clicking on the Pay Button will create an + Order in th POS for the Product 'Table + Booking' with a + Unit Price equal to the Reservation Amount + of the selected Tables, and you can then + make the Payment. +

-
-
+
+
-
- -
-
-

- Edit the Reservations.

-

- You can Edit Reservations by Clicking on 'Edit' Button and Edit the Details. -

-
+
+ +
+
+

+ Edit the Reservations.

+

+ You can Edit Reservations by Clicking on + 'Edit' Button and Edit the Details. +

-
-
+
+
-
- -
-
-

- Cancel the Reservations.

-

- Able to Cancel the Reservations by clicking on 'Cancel' button. -

-
+
+ +
+
+

+ Cancel the Reservations.

+

+ Able to Cancel the Reservations by clicking + on 'Cancel' button. +

-
-
+
+
-
- -
-
-

- Displayed Reserved Label on Tables in POS Floor Screen.

-

- The Label 'Reserved' will be Visible on Tables in POS Floor Screen During the Reservation Period. -

-
+
+ +
+
+

+ Displayed Reserved Label on Tables in POS + Floor Screen.

+

+ The Label 'Reserved' will be Visible on + Tables in POS Floor Screen During the + Reservation Period. +

-
-
-
    -
  • - Community and Enterprise Support. -
  • -
  • - Able to Reserve Tables from Website. -
  • -
  • - Displays Reserved Tables in POS. -
  • -
  • - Creates Sale Order for Reservations. -
  • -
-
-
-
-
-
-
Version - 17.0.1.0.0|Released on:17th May 2024 -
-

- Initial Commit for Table Reservation On POS And Website.

+
+
+
+
    +
  • + Community and + Enterprise Support. +
  • +
  • + Able to Reserve + Tables from Website. +
  • +
  • + Displays + Reserved Tables in POS. +
  • +
  • + Creates Sale + Order for Reservations. +
  • +
+
+
+
+
+
+
Version + 17.0.1.0.0|Released on:17th May 2024
+

+ Initial Commit for Table Reservation On POS And + Website.

-
-
-

Related Products

-
+
+
+
+

+ Related Products

-
- - - - +
+
+ + + + diff --git a/table_reservation_on_website/static/src/app/screens/floor_screen/floor_screen.js b/table_reservation_on_website/static/src/app/screens/floor_screen/floor_screen.js index 03ba78ad4..ee2826161 100644 --- a/table_reservation_on_website/static/src/app/screens/floor_screen/floor_screen.js +++ b/table_reservation_on_website/static/src/app/screens/floor_screen/floor_screen.js @@ -35,10 +35,8 @@ patch(FloorScreen.prototype, { }, async onSelectTable(table, ev) { // if (table['reserved'] == true){ -// console.log("hello welcome", this.env.services.pos) // var data = await this.orm.call('table.reservation', 'add_payment', [table.id, table.floor.id]) // const current_order = this.pos.get_order(); -// console.log("prod", current_order) // if (this.pos.get_order){ // } // this.pos.get_order().add_product(product, { diff --git a/table_reservation_on_website/static/src/app/screens/product_screen/product_screen.js b/table_reservation_on_website/static/src/app/screens/product_screen/product_screen.js index c97e9e08f..1eb2b6c0b 100644 --- a/table_reservation_on_website/static/src/app/screens/product_screen/product_screen.js +++ b/table_reservation_on_website/static/src/app/screens/product_screen/product_screen.js @@ -22,7 +22,6 @@ patch(ProductScreen.prototype, { var product = this.pos.db.product_by_id[productDetails[0].product_id] product['lst_price'] = productDetails[0].rate if (current_order.orderlines.length == 0){ - console.log('prodsss', product['lst_price']) this.pos.get_order().add_product(product, { quantity: 1, }); diff --git a/table_reservation_on_website/static/src/js/reservation.js b/table_reservation_on_website/static/src/js/reservation.js index 34a788e6f..e1642ca1d 100644 --- a/table_reservation_on_website/static/src/js/reservation.js +++ b/table_reservation_on_website/static/src/js/reservation.js @@ -1,5 +1,6 @@ /** @odoo-module */ import publicWidget from "@web/legacy/js/public/public_widget"; +import { jsonrpc } from "@web/core/network/rpc_service"; publicWidget.registry.reservation = publicWidget.Widget.extend({ selector: '.container', @@ -10,6 +11,24 @@ publicWidget.registry.reservation = publicWidget.Widget.extend({ 'click .close_btn_alert_modal': '_onClickCloseBtn', 'click .close_btn_time_alert_modal': '_onClickCloseAlertBtn', }, + async start() { + this.openingHour = null; + this.closingHour = null; + await this._fetchOpeningClosingHours(); + }, + async _fetchOpeningClosingHours() { + try { + const result = await jsonrpc('/pos/get_opening_closing_hours', {}); + if (result && !result.error) { + this.openingHour = result.opening_hour; + this.closingHour = result.closing_hour; + } else { + console.error("Error: ", result.error); + } + } catch (error) { + console.error("Failed to fetch opening and closing hours:", error); + } + }, // To ensure booking date is a valid one. _onChangeDate: function (ev) { var selectedDate = new Date(this.$el.find("#date").val()) @@ -26,45 +45,73 @@ publicWidget.registry.reservation = publicWidget.Widget.extend({ }, // Display a modal if invalid start time and end is chosen. _onChangeTime: function() { - var start_time = this.$el.find("#start_time") - var end_time = this.$el.find("#end_time") - let now = new Date(); - // Get the current time - let currentHours = now.getHours().toString().padStart(2, '0'); - let currentMinutes = now.getMinutes().toString().padStart(2, '0'); - let currentTime = `${currentHours}:${currentMinutes}`; - // Get the current date - const currentDate = new Date(); - const year = currentDate.getFullYear(); - const month = String(currentDate.getMonth() + 1).padStart(2, '0'); // Months are zero-based - const day = String(currentDate.getDate()).padStart(2, '0'); - // Format the date as YYYY-MM-DD - const formattedDate = `${year}-${month}-${day}`; - if (start_time.val() && end_time.val()) { - if (start_time.val() > end_time.val()) { - this.$el.find("#time_alert_modal").show() - start_time.val('') - end_time.val('') - } + var start_time = this.$el.find("#start_time"); + var end_time = this.$el.find("#end_time"); + + let now = new Date(); + let currentHours = now.getHours().toString().padStart(2, '0'); + let currentMinutes = now.getMinutes().toString().padStart(2, '0'); + let currentTime = `${currentHours}:${currentMinutes}`; + + const currentDate = new Date(); + const year = currentDate.getFullYear(); + const month = String(currentDate.getMonth() + 1).padStart(2, '0'); + const day = String(currentDate.getDate()).padStart(2, '0'); + const formattedDate = `${year}-${month}-${day}`; + + if (start_time.val() && end_time.val()) { + if (start_time.val() > end_time.val()) { + this.$el.find("#time_alert_modal").show(); + start_time.val(''); + end_time.val(''); + return; } - if (start_time.val() && end_time.val() && (start_time.val() == end_time.val())) { - this.$el.find("#time_alert_modal").show() - start_time.val('') - end_time.val('') + if (start_time.val() == end_time.val()) { + this.$el.find("#time_alert_modal").show(); + start_time.val(''); + end_time.val(''); + return; } - if (formattedDate == this.$el.find("#date").val()){ - if (start_time.val() && start_time.val() < currentTime) { - this.$el.find("#time_alert_modal").show() - start_time.val('') - end_time.val('') - } - if (end_time.val() && end_time.val() < currentTime) { - this.$el.find("#time_alert_modal").show() - start_time.val('') - end_time.val('') - } + } + + // Ensure opening and closing hours are available + if (!this.openingHour || !this.closingHour) { + console.warn("Opening and closing hours are not set."); + return; + } + + // Validate start and end time against opening and closing time + if (start_time.val() && (start_time.val() < this.openingHour || start_time.val() > this.closingHour)) { + this.$el.find("#time_alert_modal").show(); + start_time.val(''); + end_time.val(''); + return; + } + + if (end_time.val() && (end_time.val() < this.openingHour || end_time.val() > this.closingHour)) { + var e = this.$el.find("#time_alert_modal").show(); + start_time.val(''); + end_time.val(''); + return; + } + + // Ensure the time is not in the past for the current day + if (formattedDate == this.$el.find("#date").val()) { + if (start_time.val() && start_time.val() < currentTime) { + this.$el.find("#time_alert_modal").show(); + start_time.val(''); + end_time.val(''); + return; } - }, + if (end_time.val() && end_time.val() < currentTime) { + this.$el.find("#time_alert_modal").show(); + start_time.val(''); + end_time.val(''); + return; + } + } +}, + // To close the alert modal if invalid booking start and end time is chosen. _onClickCloseAlertBtn: function() { this.$el.find("#time_alert_modal").hide() diff --git a/table_reservation_on_website/views/res_config_settings_views.xml b/table_reservation_on_website/views/res_config_settings_views.xml index 3d876806a..a1874066f 100644 --- a/table_reservation_on_website/views/res_config_settings_views.xml +++ b/table_reservation_on_website/views/res_config_settings_views.xml @@ -41,6 +41,25 @@ +
+
+ +
+
+
+
+ +
+
+ +
+
diff --git a/table_reservation_on_website/views/table_reservation_templates.xml b/table_reservation_on_website/views/table_reservation_templates.xml index f3a0b66e0..b276c835c 100644 --- a/table_reservation_on_website/views/table_reservation_templates.xml +++ b/table_reservation_on_website/views/table_reservation_templates.xml @@ -17,6 +17,9 @@ Table Reservation
+ +

Opening Hours: -

+

+
+ +