origin pull master

This commit is contained in:
Aung Myo
2017-06-03 13:44:10 +06:30
parent 7529d23147
commit 138850fb24
119 changed files with 2531 additions and 462 deletions

View File

@@ -8,7 +8,6 @@ class Order < ApplicationRecord
#internal references attributes for business logic control
attr_accessor :items, :guest, :table_id, :new_booking, :booking_type, :employee_name, :booking_id
#Main Controller method to create new order - validate all inputs and generate new order
# order_item : {
# order_item_code : "",
@@ -17,6 +16,7 @@ class Order < ApplicationRecord
# option_values : [],
# sub_order_items : [],
# }
def generate
booking = nil
@@ -43,6 +43,9 @@ class Order < ApplicationRecord
#Send order to queue one it done!
process_order_queue
#send order to broadcast job
send_order_broadcast
return true, booking
end
@@ -202,6 +205,13 @@ class Order < ApplicationRecord
OrderQueueProcessorJob.perform_later(self.id)
end
#send order items and send to order queue
def send_order_broadcast
#Send to background job for processing
OrderBroadcastJob.perform_later(self.id)
end
#Origami: Cashier : to view order type Table
def self.get_order_table
order_table = Order.select("orders.id as order_id,sum(order_items.qty*order_items.price) as total_price,
@@ -211,7 +221,7 @@ class Order < ApplicationRecord
left join dining_facilities on dining_facilities.id = bookings.dining_facility_id
left join order_items on order_items.order_id = orders.id")
.where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,"dine_in",true)
.group("orders.id")
.group("orders.id")
end
#Origami: Cashier : to view order type Room
def self.get_order_rooms