diff --git a/app/models/order.rb b/app/models/order.rb index 26451207..00ecd4ca 100755 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -41,14 +41,14 @@ class Order < ApplicationRecord :booking_status => "assign" }) end #end extra time - + if self.table_id.to_i > 0 table = DiningFacility.find(self.table_id) table.update_attributes(status:"occupied") # table.status = "occupied" # table.save end - + else booking = Booking.find(self.booking_id) #add extra time @@ -56,7 +56,7 @@ class Order < ApplicationRecord if !booking.checkout_at.nil? new_time = booking.checkout_at + self.extra_time.to_i booking.update_attributes(checkout_at: new_time) - end + end end #end extra time end @@ -74,7 +74,7 @@ class Order < ApplicationRecord #Send order to queue one it done! # if self.source != "quick_service" # process_order_queue - # end + # end #send order to broadcast job # send_order_broadcast(booking) @@ -138,7 +138,7 @@ class Order < ApplicationRecord ordered_list.each do |item| menu_item = MenuItem.search_by_item_code(item[:item_instance_code]) - + # For Product while item code not in menu item if menu_item.nil? menu_item = Product.search_by_product_code(item[:item_instance_code]) @@ -148,7 +148,7 @@ class Order < ApplicationRecord # Rails.logger.debug menu_item set_order_items = Array.new ##If menu Item set item - must add child items to order as well, where price is only take from menu_item - if (menu_item[:type] == "SetMenuItem") + if (menu_item[:type] == "SetMenuItem") if (item.include? 'sub_items') || (item.include? :sub_items) item[:sub_items].each do |si| # Retrive instance's Price @@ -286,7 +286,7 @@ class Order < ApplicationRecord # Counter number of quantityf end - + #Process order items and send to order queue def self.pay_process_order_queue(id,table_id) # if ENV["SERVER_MODE"] != 'cloud' @@ -294,7 +294,7 @@ class Order < ApplicationRecord if !sidekiq.nil? OrderQueueProcessorJob.perform_later(id, table_id) else - order = Order.find(id) + order = Order.find(id) if order oqs = OrderQueueStation.new oqs.process_order(order, table_id) @@ -314,11 +314,11 @@ class Order < ApplicationRecord # OrderBroadcastJob.perform_later(table,type) if ENV["SERVER_MODE"] == 'cloud' from = request.subdomain + "." + request.domain - else + else from = "" end ActionCable.server.broadcast "order_channel",table: table,type:type,from:from - + end end @@ -434,7 +434,7 @@ class Order < ApplicationRecord if from.present? && to.present? order = Order.where("DATE_FORMAT(date,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(date,'%d-%m-%Y') <= ?", from,to) query = order.where(keyword) - else + else where("order_id LIKE ? OR status LIKE ? OR order_type LIKE ? OR source='#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%") end end @@ -442,12 +442,12 @@ class Order < ApplicationRecord def self.send_customer_view(booking) @status = "" @data_array = Array.new - if(!booking.sale_id.nil?) + if(!booking.sale_id.nil?) sale = Sale.find(booking.sale_id) if sale.sale_status != "completed" && sale.sale_status != 'void' @data_array.push(sale) @status = "sale" - @data_obj = sale + @data_obj = sale end else @@ -474,7 +474,7 @@ class Order < ApplicationRecord end if ENV["SERVER_MODE"] == 'cloud' from = request.subdomain + "." + request.domain - else + else from = "" end ActionCable.server.broadcast "second_display_channel",data: @data_array,status:@status,from:from @@ -484,11 +484,11 @@ class Order < ApplicationRecord def self.process_order_queue(order_id,table_id,source) print_status = nil cup_status = nil - + #Send to background job for processing - order = Order.find(order_id) + order = Order.find(order_id) sidekiq = Lookup.find_by_lookup_type("sidekiq") - + if ENV["SERVER_MODE"] != 'cloud' cup_status = `#{"sudo service cups status"}` print_status = check_cup_status(cup_status) @@ -526,7 +526,7 @@ class Order < ApplicationRecord else if ENV["SERVER_MODE"] != 'cloud' - msg = ' Print Error ! Please contact to service' + msg = ' Print Error ! Please contact to service' ActionCable.server.broadcast "call_waiter_channel",table: msg,time:'print_error' end if !sidekiq.nil? diff --git a/app/views/api/shifts/create.json.jbuilder b/app/views/api/shifts/create.json.jbuilder index c5b02c92..fd15892a 100644 --- a/app/views/api/shifts/create.json.jbuilder +++ b/app/views/api/shifts/create.json.jbuilder @@ -29,4 +29,4 @@ if @status == true else json.status false json.error_message @error_message -end \ No newline at end of file +end diff --git a/app/views/crm/customers/index.html.erb b/app/views/crm/customers/index.html.erb index 55295c9e..d379b12b 100644 --- a/app/views/crm/customers/index.html.erb +++ b/app/views/crm/customers/index.html.erb @@ -62,7 +62,7 @@ <%end %> - +