add dine-in cashier settings in lookups

This commit is contained in:
phyusin
2018-05-04 14:09:58 +06:30
parent 162327ac4c
commit c6f654808c
5 changed files with 17 additions and 3 deletions

View File

@@ -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