update pay first and print later
This commit is contained in:
@@ -65,10 +65,17 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
end
|
||||
|
||||
def create
|
||||
cash = params[:cash]
|
||||
sale_id = params[:sale_id]
|
||||
cash = params[:cash]
|
||||
sale_id = params[:sale_id]
|
||||
member_info = nil
|
||||
|
||||
if params[:type] == "quick_service"
|
||||
booking = Booking.find_by_sale_id(sale_id)
|
||||
booking.booking_orders.each do |order|
|
||||
Order.pay_process_order_queue(order.order_id,booking.dining_facility_id)
|
||||
end
|
||||
end
|
||||
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
shop_details = Shop::ShopDetail
|
||||
|
||||
@@ -301,8 +301,33 @@ class Order < ApplicationRecord
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
#Process order items and send to order queue
|
||||
def self.pay_process_order_queue(id,table_id)
|
||||
#Send to background job for processing
|
||||
|
||||
cup_status = `#{"sudo service cups status"}`
|
||||
print_status = check_cup_status(cup_status)
|
||||
|
||||
if print_status
|
||||
OrderQueueProcessorJob.perform_later(id, table_id)
|
||||
else
|
||||
cup_start = `#{"sudo service cups start"}`
|
||||
cup_status = `#{"sudo service cups status"}`
|
||||
print_status = check_cup_status(cup_status)
|
||||
|
||||
if print_status
|
||||
OrderQueueProcessorJob.perform_later(id, table_id)
|
||||
else
|
||||
msg = ' Print Error ! Please contact to service'
|
||||
ActionCable.server.broadcast "call_waiter_channel",table: msg,time:'print_error'
|
||||
OrderQueueProcessorJob.perform_later(id, table_id)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def check_cup_status(status)
|
||||
def self.check_cup_status(status)
|
||||
if status.include? "Active: active (running)" || "Active: active (exited)" #"Cup Server is already running"
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -551,7 +551,7 @@ var cashier_type = "<%= @cashier_type %>";
|
||||
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_payment_cash_path %>",
|
||||
data: "cash="+ cash + "&sale_id=" + sale_id,
|
||||
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type,
|
||||
async: false,
|
||||
success:function(result){
|
||||
/* start delete receipt no in first bill*/
|
||||
|
||||
Reference in New Issue
Block a user