diff --git a/README.md b/README.md index 0605a14a..dfebed49 100755 --- a/README.md +++ b/README.md @@ -188,6 +188,10 @@ Add Base URL for DOEMAL 1) settings/lookups => { type:order_reservation, name: BaseURL, value:'{doemal url}' } 2) settings/lookups => { type:order_reservation, name: Token, value:'{doemal token}' } +Add Feature for Dine-in Cashier + ** '0' means can not use dine-in cashier and '1' means can use dine-in cashier ** + => settings/lookups => { type:dinein_cashier, name: DineInCashier, value:'{0 or 1}' } + Add Feature for Quick Service ** '0' means can not use quick service and '1' means can use quick service ** => settings/lookups => { type:quick_service, name: QuickService, value:'{0 or 1}' } diff --git a/app/controllers/origami/dashboard_controller.rb b/app/controllers/origami/dashboard_controller.rb index 8bdd5c27..027b89a5 100644 --- a/app/controllers/origami/dashboard_controller.rb +++ b/app/controllers/origami/dashboard_controller.rb @@ -56,6 +56,13 @@ class Origami::DashboardController < BaseOrigamiController # get printer info @print_settings = PrintSetting.get_precision_delimiter() @current_user = current_user + #dine-in cashier + dinein_cashier = Lookup.collection_of('dinein_cashier') + @dinein_cashier = 0 + if !dinein_cashier[0].nil? + @dinein_cashier = dinein_cashier[0][1] + end + #quick service quick_service = Lookup.collection_of('quick_service') @quick_service = 0 diff --git a/app/controllers/origami/order_reservation_controller.rb b/app/controllers/origami/order_reservation_controller.rb index 12a3ee2f..32f0e63d 100644 --- a/app/controllers/origami/order_reservation_controller.rb +++ b/app/controllers/origami/order_reservation_controller.rb @@ -1,7 +1,7 @@ class Origami::OrderReservationController < BaseOrigamiController def index - @order = OrderReservation.latest_order + @order = OrderReservation.latest_order #.active @count_on_order = OrderReservation.get_count_on_order end diff --git a/app/models/order_reservation.rb b/app/models/order_reservation.rb index e5b95f8c..f4f610fc 100644 --- a/app/models/order_reservation.rb +++ b/app/models/order_reservation.rb @@ -7,6 +7,7 @@ class OrderReservation < ApplicationRecord has_many :order_reservation_items has_one :delivery + scope :active, -> { where("created_at BETWEEN '#{DateTime.now.utc.beginning_of_day}' AND '#{DateTime.now.utc.end_of_day}'") } scope :latest_order, -> { order("order_reservation_id desc, created_at desc") } SEND_TO_KITCHEN = "send_to_kitchen" @@ -218,7 +219,7 @@ class OrderReservation < ApplicationRecord def self.check_order_send_to_kitchen today = Time.now.utc - order_reservation = OrderReservation.where("status='accepted' and requested_time > '#{today}'") + order_reservation = OrderReservation.where("status='accepted' and requested_time > '#{today}' and expected_waiting_time < '#{today}'") if order_reservation.length > 0 if ENV["SERVER_MODE"] == 'cloud' ActionCable.server.broadcast "check_order_send_to_kitchen_channel",data: order_reservation @@ -228,7 +229,7 @@ class OrderReservation < ApplicationRecord def self.check_order_ready_to_delivery today = Time.now.utc - order_reservation = OrderReservation.where("status='send_to_kitchen' and requested_time > '#{today}'") + order_reservation = OrderReservation.where("status='send_to_kitchen' and requested_time > '#{today}' and expected_waiting_time < '#{today}'") if order_reservation.length > 0 if ENV["SERVER_MODE"] == 'cloud' ActionCable.server.broadcast "check_order_ready_to_delivery_channel",data: order_reservation diff --git a/app/views/origami/dashboard/index.html.erb b/app/views/origami/dashboard/index.html.erb index b6b36427..bbb19c78 100644 --- a/app/views/origami/dashboard/index.html.erb +++ b/app/views/origami/dashboard/index.html.erb @@ -28,6 +28,7 @@ <% end %> + <% if @dinein_cashier == '1' %>
@@ -36,6 +37,7 @@
<%= t :dine_in_cashier %>
+ <% end %> <% if @order_reservation == '1' %>