Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -111,7 +111,8 @@ class Origami::AddordersController < BaseOrigamiController
|
||||
end
|
||||
items_arr.push(items)
|
||||
}
|
||||
|
||||
puts items_arr.to_json
|
||||
puts "sssssssssssssssssssssss"
|
||||
# begin
|
||||
# if params[:order_source] == "quick_service"
|
||||
# customer_id = "CUS-000000000002" # for no customer id from mobile
|
||||
|
||||
@@ -71,35 +71,37 @@ class Origami::MovetableController < BaseOrigamiController
|
||||
|
||||
booking.booking_orders.each do |booking_order|
|
||||
order = Order.find(booking_order.order_id)
|
||||
if order.status == 'new'
|
||||
if order.status == 'new'
|
||||
order.order_items.each do |order_item|
|
||||
order_items.push(order_item)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@get_type = Booking.update_dining_facility(booking_array,change_to,change_from)
|
||||
|
||||
# get printer info
|
||||
@from = (DiningFacility.find(change_from)).name
|
||||
@to = (DiningFacility.find(change_to)).name
|
||||
@type = (DiningFacility.find(change_to)).type
|
||||
@moved_by = @current_user.name
|
||||
@date = DateTime.now
|
||||
@shop = Shop.first
|
||||
unique_code = "MoveTablePdf"
|
||||
pdf_no = PrintSetting.where(:unique_code => unique_code).count
|
||||
#print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
printer_array = []
|
||||
printer_array = PrintSetting.where(:unique_code => unique_code)
|
||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
# get printer info
|
||||
@from = (DiningFacility.find(change_from)).name
|
||||
@to = (DiningFacility.find(change_to)).name
|
||||
@type = (DiningFacility.find(change_to)).type
|
||||
@moved_by = @current_user.name
|
||||
@date = DateTime.now
|
||||
@shop = Shop.first
|
||||
unique_code = "MoveTablePdf"
|
||||
pdf_no = PrintSetting.where(:unique_code => unique_code).count
|
||||
#print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
printer_array = []
|
||||
printer_array = PrintSetting.where(:unique_code => unique_code)
|
||||
|
||||
for i in 0..pdf_no
|
||||
if i != pdf_no
|
||||
print_settings = printer_array[i]
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer.print_move_table(print_settings,@to,@from ,@shop,@date,@type,@moved_by,order_items)
|
||||
for i in 0..pdf_no
|
||||
if i != pdf_no
|
||||
print_settings = printer_array[i]
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer.print_move_table(print_settings,@to,@from ,@shop,@date,@type,@moved_by,order_items)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,12 +1,58 @@
|
||||
class Origami::OrderReservationController < BaseOrigamiController
|
||||
|
||||
def index
|
||||
@webview = check_mobile
|
||||
@shop = Shop::ShopDetail
|
||||
|
||||
@order = OrderReservation.all
|
||||
end
|
||||
|
||||
def update
|
||||
@id = params[:order_id]
|
||||
@status = params[:status]
|
||||
@order_reservation = OrderReservation.find(@id)
|
||||
|
||||
status = true
|
||||
|
||||
if status
|
||||
if @status == "processed"
|
||||
result = OrderReservation.create_doemal_order(@order_reservation,current_user)
|
||||
elsif @status == "delivery"
|
||||
OrderReservation.update_order_reservation(@id, nil, "ready_to_delivery")
|
||||
response = OrderReservation.send_status_to_ordering(@order_reservation.callback_url,@order_reservation.transaction_ref,"ready_to_delivery")
|
||||
result = {:status=> true, :message => "ready for delivery" }
|
||||
elsif @status == "completed"
|
||||
result = OrderReservation.update_doemal_payment(@order_reservation,current_user)
|
||||
else
|
||||
if @status == "cancel"
|
||||
OrderReservation.update_order_reservation(@id, nil, "cancelled")
|
||||
result = {:status=> true, :message => "rejected" }
|
||||
else
|
||||
OrderReservation.update_order_reservation(@id, nil, "accepted")
|
||||
result = {:status=> true, :message => "accepted" }
|
||||
end
|
||||
end
|
||||
render :json => result.to_json
|
||||
else
|
||||
result = {:status=> false, :message => "Order not accepted !" }
|
||||
render :json => result.to_json
|
||||
end
|
||||
end
|
||||
|
||||
def get_order
|
||||
if (params[:id])
|
||||
@order = OrderReservation.find(params[:id])
|
||||
return @order
|
||||
end
|
||||
end
|
||||
|
||||
def send_status
|
||||
if params[:status] == "cancel"
|
||||
status = "rejected"
|
||||
else
|
||||
status = params[:status]
|
||||
end
|
||||
|
||||
response = OrderReservation.send_status_to_ordering(params[:url],params[:ref_no],status)
|
||||
|
||||
render :json => response
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user