Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into sqa-1804-001
This commit is contained in:
@@ -2,37 +2,56 @@
|
||||
$(function() {
|
||||
|
||||
$(".nav-item").on("click", function(){
|
||||
type = $(this).attr("data-type");
|
||||
if (type == "pending") {
|
||||
$('#accepted').text("Accepted");
|
||||
$('#accepted').attr("data-value","accepted");
|
||||
}else if(type == "processing"){
|
||||
$('#accepted').text("SEND TO KITCHEN");
|
||||
$('#accepted').attr("data-value","processed");
|
||||
}else if(type == "delivery"){
|
||||
$('#accepted').text("READY TO DELIVERY");
|
||||
$('#accepted').attr("data-value","delivery");
|
||||
}else if(type == "completed"){
|
||||
$('#accepted').text("PICK-UP");
|
||||
$('#accepted').attr("data-value","completed");
|
||||
}
|
||||
console.log(type)
|
||||
type = $(this).attr("data-type");
|
||||
refreshDetailData();
|
||||
if (type == "pending") {
|
||||
$(".first-1").click();
|
||||
$('#accepted').text("Accepted");
|
||||
$('#accepted').attr("data-value","accepted");
|
||||
}else if(type == "processing"){
|
||||
$(".second-1").click();
|
||||
$('#accepted').text("SEND TO KITCHEN");
|
||||
$('#accepted').attr("data-value","processed");
|
||||
}else if(type == "delivery"){
|
||||
$(".third-1").click();
|
||||
$('#accepted').text("READY TO DELIVERY");
|
||||
$('#accepted').attr("data-value","delivery");
|
||||
}else if(type == "completed"){
|
||||
$(".fourth-1").click();
|
||||
$('#accepted').text("PICK-UP");
|
||||
$('#accepted').attr("data-value","completed");
|
||||
}
|
||||
// console.log(type);
|
||||
});
|
||||
|
||||
jQuery(function(){
|
||||
jQuery('.first-1').click();
|
||||
});
|
||||
|
||||
$(".custom-tr").on("click", function(){
|
||||
$(".custom-tr").removeClass("tr-active");
|
||||
$(this).addClass("tr-active");
|
||||
var order_id = $(this).attr("data-id");
|
||||
var url = "order_reservation/get_order/"+order_id;
|
||||
show_order_detail(url);
|
||||
jQuery('.first-1').click();
|
||||
});
|
||||
|
||||
//show order list
|
||||
function show_order_detail(url){
|
||||
$(".custom-tr").on("click", function(){
|
||||
$(".custom-tr").removeClass("tr-active");
|
||||
$(this).addClass("tr-active");
|
||||
var order_id = $(this).attr("data-id");
|
||||
var sr_no = $(this).attr("data-sr-no");
|
||||
var url = "order_reservation/get_order/"+order_id;
|
||||
show_order_detail(url,sr_no);
|
||||
});
|
||||
|
||||
function refreshDetailData(){
|
||||
$("#sr_number").text("");
|
||||
$("#delivery_info").text("");
|
||||
$("#contact_info").text("");
|
||||
$('.summary-items').html("");
|
||||
$('#sub_total').text("0.00");
|
||||
$('#delivery_fee').text("0.00");
|
||||
$('#total_charges').text("0.00");
|
||||
$('#total_tax').text("0.00");
|
||||
$('#grand_total').text("0.00");
|
||||
}
|
||||
|
||||
//show order list
|
||||
function show_order_detail(url,sr_no){
|
||||
$('.summary-items').html("");
|
||||
//Start Ajax
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
@@ -40,51 +59,70 @@ $(function() {
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
var delivery = data["delivery"]
|
||||
var items = data["order_items"]
|
||||
// console.log(data);
|
||||
var delivery = data["delivery"];
|
||||
var items = data["order_items"];
|
||||
|
||||
var item_list = $('.summary-items');
|
||||
var item_list = $('.summary-items');
|
||||
item_list.empty();
|
||||
|
||||
for(var i in items) {
|
||||
var item_price = 0;
|
||||
if(items[i].price > 0){
|
||||
item_price = items[i].price;
|
||||
}else{
|
||||
item_price = items[i].unit_price;
|
||||
if(items!=undefined && items!=""){
|
||||
if(items.length > 0){
|
||||
for(var i in items) {
|
||||
var item_price = 0;
|
||||
if(items[i].price > 0){
|
||||
item_price = items[i].price;
|
||||
}else{
|
||||
item_price = items[i].unit_price;
|
||||
}
|
||||
var total = items[i].qty * item_price;
|
||||
row = '<tr>'
|
||||
+'<td width ="70%" class="body-td align-left">'+items[i].item_name
|
||||
+' <br><span class="font-13">'+items[i].qty+ '<span class="col-blue"> <b>X</b>'+items[i].unit_price+'</span></span>'
|
||||
+'</td>'
|
||||
+'<td width ="30%" class="body-td align-right">'+ total +'</td>'
|
||||
+'</tr>';
|
||||
$('.summary-items').append(row);
|
||||
}
|
||||
|
||||
$('#sub_total').text(data.total_amount);
|
||||
$('#delivery_fee').text(delivery.delivery_fee);
|
||||
$('#total_charges').text(0);
|
||||
$('#total_tax').text(data.total_tax);
|
||||
$('#grand_total').text(data.grand_total);
|
||||
|
||||
var address = delivery.address +', ' +delivery.township+", (" +delivery.direction_address+")"
|
||||
$('#customer_name').text(data.customer_name);
|
||||
$('#phone').text(data.phone);
|
||||
$('#address').text(address);
|
||||
$('#delivery_to').text(delivery.provider);
|
||||
|
||||
$('#ref_no').text(data.transaction_ref);
|
||||
$('#callback_url').text(data.callback_url);
|
||||
$('#order_id').text(data.order_reservation_id);
|
||||
|
||||
if(delivery.provider == "direct_delivery"){
|
||||
$("#delivery_info").text("(DELIVERY)");
|
||||
}else if(delivery.provider == "self_pick_up"){
|
||||
$("#delivery_info").text("(PICK-UP)");
|
||||
}
|
||||
|
||||
if(data.order_remark!=null && data.order_remark!=""){
|
||||
$("#order_remark").text(data.order_remark);
|
||||
}else if(data.reservation_remark!=null && data.reservation_remark!=""){
|
||||
$("#order_remark").text(data.reservation_remark);
|
||||
}
|
||||
$("#sr_number").text("No."+sr_no);
|
||||
$("#contact_info").text();
|
||||
}
|
||||
var total = items[i].qty * item_price;
|
||||
row = '<tr>'
|
||||
+'<td width ="70%" class="body-td align-left">'+items[i].item_name
|
||||
+' <br><span class="font-13">'+items[i].qty+ '<span class="col-blue"> <b>X</b>'+items[i].unit_price+'</span></span>'
|
||||
+'</td>'
|
||||
+'<td width ="30%" class="body-td align-right">'+ total +'</td>'
|
||||
+'</tr>';
|
||||
$('.summary-items').append(row);
|
||||
}
|
||||
|
||||
$('#sub_total').text(data.total_amount);
|
||||
$('#delivery_fee').text(delivery.delivery_fee);
|
||||
$('#total_charges').text(0);
|
||||
$('#total_tax').text(data.total_tax);
|
||||
$('#grand_total').text(data.grand_total);
|
||||
|
||||
var address = delivery.address +', ' +delivery.township+", (" +delivery.direction_address+")"
|
||||
$('#customer_name').text(data.customer_name);
|
||||
$('#phone').text(data.phone);
|
||||
$('#address').text(address);
|
||||
$('#delivery_to').text(delivery.provider);
|
||||
|
||||
$('#ref_no').text(data.transaction_ref);
|
||||
$('#callback_url').text(data.callback_url);
|
||||
$('#order_id').text(data.order_reservation_id);
|
||||
}
|
||||
});
|
||||
//end Ajax
|
||||
}
|
||||
|
||||
$("#accepted").on("click", function(){
|
||||
var status = $(this).attr("data-value");
|
||||
var status = $(this).attr("data-value");
|
||||
var order_id = $('#order_id').text();
|
||||
var ref_no = $('#ref_no').text();
|
||||
var callback = $('#callback_url').text();
|
||||
@@ -92,7 +130,7 @@ $(function() {
|
||||
});
|
||||
|
||||
$("#cancel").on("click", function(){
|
||||
var status = $(this).attr("data-value");
|
||||
var status = $(this).attr("data-value");
|
||||
var order_id = $('#order_id').text();
|
||||
var callback = $('#callback_url').text();
|
||||
var ref_no = $('#ref_no').text();
|
||||
@@ -119,7 +157,7 @@ $(function() {
|
||||
if (data.status) {
|
||||
swal({
|
||||
title: 'Information',
|
||||
text: "Order has been "+data.status,
|
||||
text: "Order has been "+data.message,
|
||||
type: 'success',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
@@ -134,7 +172,7 @@ $(function() {
|
||||
}else{
|
||||
swal({
|
||||
title: 'Oops',
|
||||
text: data.message.toString(),
|
||||
text: data.message,
|
||||
type: 'error',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
@@ -147,5 +185,5 @@ $(function() {
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
@@ -82,24 +82,26 @@ class Origami::MovetableController < BaseOrigamiController
|
||||
|
||||
@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
|
||||
|
||||
@@ -7,22 +7,29 @@ class Origami::OrderReservationController < BaseOrigamiController
|
||||
def update
|
||||
@id = params[:order_id]
|
||||
@status = params[:status]
|
||||
@order = OrderReservation.find(@id)
|
||||
@order_reservation = OrderReservation.find(@id)
|
||||
|
||||
status = true
|
||||
|
||||
if status
|
||||
if @status == "processed"
|
||||
OrderReservation.create_doemal_order(@order)
|
||||
else
|
||||
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"
|
||||
result = {:status=> true, :message => "cancelled" }
|
||||
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
|
||||
render :json => result.to_json
|
||||
end
|
||||
|
||||
render :json => result.to_json
|
||||
else
|
||||
result = {:status=> false, :message => "Order not accepted !" }
|
||||
render :json => result.to_json
|
||||
@@ -37,34 +44,14 @@ class Origami::OrderReservationController < BaseOrigamiController
|
||||
end
|
||||
|
||||
def send_status
|
||||
base_url = "http://192.168.1.186:3002"
|
||||
post_url = base_url + params[:url]
|
||||
# status = params[:status]
|
||||
if params[:status] == "cancel"
|
||||
status = "rejected"
|
||||
else
|
||||
status = params[:status]
|
||||
end
|
||||
|
||||
begin
|
||||
response = HTTParty.post(post_url,
|
||||
:body => { id: params[:ref_no], status: status}.to_json,
|
||||
:headers => {
|
||||
'Authorization' => 'Token token=3T-tnlYtFJ-5Z1vY6XQqxQ',
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json; version=3'
|
||||
}, :timeout => 10
|
||||
)
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
response = OrderReservation.send_status_to_ordering(params[:url],params[:ref_no],status)
|
||||
|
||||
rescue OpenURI::HTTPError
|
||||
response = { status: false}
|
||||
rescue SocketError
|
||||
response = { status: false}
|
||||
end
|
||||
Rails.logger.debug "Get Doemal Status "
|
||||
Rails.logger.debug response.to_json
|
||||
render :json => response
|
||||
end
|
||||
|
||||
|
||||
@@ -7,13 +7,18 @@ class OrderReservation < ApplicationRecord
|
||||
has_many :order_reservation_items
|
||||
belongs_to :delivery
|
||||
|
||||
SEND_TO_KITCHEN = "send_to_kitchen"
|
||||
READY_TO_DELIVERY = "ready_to_deliver"
|
||||
DELIVERED = "delivered"
|
||||
COMPLETED = "completed"
|
||||
|
||||
def self.addOrderReservationInfo(params)
|
||||
check_order_reservation = OrderReservation.where("transaction_ref = ?",params[:reference])
|
||||
if check_order_reservation.empty?
|
||||
order_reservation = OrderReservation.new
|
||||
order_reservation.order_reservation_type = params[:order_type]
|
||||
order_reservation.customer_id = params[:cus_info]
|
||||
order_reservation.requested_time = Time.parse(params[:requested_time]).utc.strftime("%Y-%m-%d %H:%M:%S")
|
||||
order_reservation.requested_time = DateTime.parse(params[:requested_time]).utc.strftime("%Y-%m-%d %H:%M:%S")
|
||||
order_reservation.callback_url = params[:callback_url]
|
||||
order_reservation.transaction_ref = params[:reference]
|
||||
if params[:order_info]
|
||||
@@ -48,7 +53,7 @@ class OrderReservation < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def self.create_doemal_order(order)
|
||||
def self.create_doemal_order(order,current_user)
|
||||
is_extra_time = false
|
||||
extra_time = ''
|
||||
|
||||
@@ -73,8 +78,8 @@ class OrderReservation < ApplicationRecord
|
||||
@order.guest = ''
|
||||
@order.table_id = nil # this is dining facilities's id
|
||||
@order.new_booking = true
|
||||
@order.waiters = current_login_employee.name
|
||||
@order.employee_name = current_login_employee.name
|
||||
@order.waiters = current_user.name
|
||||
@order.employee_name = current_user.name
|
||||
|
||||
@order.is_extra_time = is_extra_time
|
||||
@order.extra_time = extra_time
|
||||
@@ -84,13 +89,168 @@ class OrderReservation < ApplicationRecord
|
||||
# Order.send_customer_view(@booking)
|
||||
if @status && @booking
|
||||
|
||||
@status, @sale = Sale.request_bill(@order,current_user,current_login_employee)
|
||||
# for second display
|
||||
@status, @sale = Sale.request_bill(@order,current_user,current_user)
|
||||
|
||||
result = {:status=> @status, :data => @sale }
|
||||
render :json => result.to_json
|
||||
#order status send to doemal
|
||||
callback_response = send_status_to_ordering(order.callback_url,order.transaction_ref,SEND_TO_KITCHEN)
|
||||
#order reservation status updated
|
||||
update_order_reservation(order.id, @sale.sale_id, SEND_TO_KITCHEN)
|
||||
|
||||
result = {:status=> @status, :data => @sale, :message => "created" }
|
||||
return result
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def self.update_doemal_payment(order,current_user)
|
||||
if(Sale.exists?(order.sale_id))
|
||||
saleObj = Sale.find(order.sale_id)
|
||||
shop_details = Shop.first
|
||||
# rounding adjustment
|
||||
if shop_details.is_rounding_adj
|
||||
a = saleObj.grand_total % 25 # Modulus
|
||||
b = saleObj.grand_total / 25 # Division
|
||||
#not calculate rounding if modulus is 0 and division is even
|
||||
#calculate rounding if modulus is zero or not zero and division are not even
|
||||
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
|
||||
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
||||
rounding_adj = new_total-saleObj.grand_total
|
||||
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
|
||||
end
|
||||
end
|
||||
#end rounding adjustment
|
||||
|
||||
sale_payment = SalePayment.new
|
||||
sale_payment.process_payment(saleObj, current_user.name, saleObj.grand_total, "cash")
|
||||
|
||||
#order status send to doemal
|
||||
callback_response = send_status_to_ordering(order.callback_url,order.transaction_ref,DELIVERED)
|
||||
#order reservation status updated
|
||||
update_order_reservation(order.id, saleObj.sale_id, DELIVERED)
|
||||
|
||||
result = {:status=> true, :message => DELIVERED }
|
||||
return result
|
||||
# rebate_amount = nil
|
||||
|
||||
# For Cashier by Zone
|
||||
# bookings = Booking.where("sale_id='#{sale_id}'")
|
||||
|
||||
# if bookings[0].dining_facility_id.to_i > 0
|
||||
# table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
# cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||
# cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
||||
# else
|
||||
# shift = ShiftSale.find(saleObj.shift_sale_id)
|
||||
# cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
||||
# end
|
||||
|
||||
# For Print
|
||||
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
# receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
|
||||
# unique_code = "ReceiptBillPdf"
|
||||
# if !receipt_bill_a5_pdf.empty?
|
||||
# receipt_bill_a5_pdf.each do |receipt_bilA5|
|
||||
# if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
|
||||
# if receipt_bilA5[1] == '1'
|
||||
# unique_code = "ReceiptBillA5Pdf"
|
||||
# else
|
||||
# unique_code = "ReceiptBillPdf"
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
# customer= Customer.find(saleObj.customer_id)
|
||||
|
||||
# get member information
|
||||
# rebate = MembershipSetting.find_by_rebate(1)
|
||||
# credit_data = SalePayment.find_by_sale_id_and_payment_method(sale_id,'creditnote')
|
||||
|
||||
# if customer.membership_id != nil && rebate && credit_data.nil?
|
||||
# member_info = Customer.get_member_account(customer)
|
||||
# if member_info["status"] == true
|
||||
# rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
|
||||
# current_balance = SaleAudit.paymal_search(sale_id)
|
||||
# end
|
||||
# end
|
||||
|
||||
#orders print out
|
||||
# if params[:type] == "quick_service"
|
||||
# booking = Booking.find_by_sale_id(sale_id)
|
||||
# if booking.dining_facility_id.to_i>0
|
||||
# table_id = booking.dining_facility_id
|
||||
# else
|
||||
# table_id = 0
|
||||
# end
|
||||
|
||||
# booking.booking_orders.each do |order|
|
||||
# # Order.pay_process_order_queue(order.order_id, table_id)
|
||||
# oqs = OrderQueueStation.new
|
||||
# oqs.pay_process_order_queue(order.order_id, table_id)
|
||||
# end
|
||||
|
||||
# end
|
||||
|
||||
#for card sale data
|
||||
# card_data = Array.new
|
||||
# card_sale_trans_ref_no = Sale.getCardSaleTrans(sale_id)
|
||||
# if !card_sale_trans_ref_no.nil?
|
||||
# card_sale_trans_ref_no.each do |cash_sale_trans|
|
||||
# card_res_date = cash_sale_trans.res_date.strftime("%Y-%m-%d").to_s
|
||||
# card_res_time = cash_sale_trans.res_time.strftime("%H:%M").to_s
|
||||
# card_no = cash_sale_trans.pan.last(4)
|
||||
# card_no = card_no.rjust(19,"**** **** **** ")
|
||||
# card_data.push({'res_date' => card_res_date, 'res_time' => card_res_time, 'batch_no' => cash_sale_trans.batch_no, 'trace' => cash_sale_trans.trace, 'pan' => card_no, 'app' => cash_sale_trans.app, 'tid' => cash_sale_trans.terminal_id, 'app_code' => cash_sale_trans.app_code, 'ref_no' => cash_sale_trans.ref_no, 'mid' => cash_sale_trans.merchant_id})
|
||||
# end
|
||||
# end
|
||||
|
||||
# get printer info
|
||||
# print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
# Calculate Food and Beverage Total
|
||||
# item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
|
||||
# discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
||||
|
||||
# printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
# filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid",current_balance,card_data)
|
||||
|
||||
# render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name})
|
||||
|
||||
#end
|
||||
end
|
||||
end
|
||||
|
||||
def self.send_status_to_ordering(url,ref_no,status)
|
||||
base_url = "http://192.168.1.186:3002"
|
||||
post_url = base_url + url
|
||||
|
||||
begin
|
||||
response = HTTParty.post(post_url,
|
||||
:body => { id: ref_no, status: status}.to_json,
|
||||
:headers => {
|
||||
'Authorization' => 'Token token=3T-tnlYtFJ-5Z1vY6XQqxQ',
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json; version=3'
|
||||
}, :timeout => 10
|
||||
)
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
|
||||
rescue OpenURI::HTTPError
|
||||
response = { status: false}
|
||||
rescue SocketError
|
||||
response = { status: false}
|
||||
end
|
||||
Rails.logger.debug "Get Doemal Status "
|
||||
Rails.logger.debug response.to_json
|
||||
return response
|
||||
end
|
||||
|
||||
def self.update_order_reservation(id, sale_id, status)
|
||||
order_reservation = OrderReservation.find(id)
|
||||
if sale_id.present?
|
||||
order_reservation.sale_id = sale_id
|
||||
end
|
||||
order_reservation.status = status
|
||||
order_reservation.save
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
<div class="col-lg-4 col-md-4 col-sm-4" style="margin:0px 0px 0px -5px !important ">
|
||||
<ul class="nav nav-tabs tab-col-teal" role="tablist">
|
||||
<li class="nav-item active" data-color="#F44336" data-type="pending" style="background-color: #F44336;">
|
||||
<a class="nav-link" data-toggle="tab" href="#pending" role="tab"><p class="num">4</p> <%= t :pending %></a>
|
||||
<a class="nav-link" data-toggle="tab" href="#pending" role="tab"><p class="num">1</p> <%= t :pending %></a>
|
||||
</li>
|
||||
<li class="nav-item" data-color="#673AB7" data-type="processing" style="background-color: #673AB7;">
|
||||
<a class="nav-link" data-toggle="tab" href="#processing" role="tab"><p class="num">4</p> <%= t :process %></a>
|
||||
<a class="nav-link" data-toggle="tab" href="#processing" role="tab"><p class="num">2</p> <%= t :processing %></a>
|
||||
</li>
|
||||
<li class="nav-item" data-color="#009688" data-type="delivery" style="background-color: #009688;">
|
||||
<a class="nav-link" data-toggle="tab" href="#delivery" role="tab"><p class="num">4</p> <%= t :delivery %></a>
|
||||
<a class="nav-link" data-toggle="tab" href="#delivery" role="tab"><p class="num">3</p> <%= t :delivering %></a>
|
||||
</li>
|
||||
<li class="nav-item" data-color="#03A9F4" data-type="completed" style="background-color: #03A9F4;">
|
||||
<a class="nav-link" data-toggle="tab" href="#completed" role="tab"><p class="num">4</p> <%= t :completed %></a>
|
||||
@@ -27,9 +27,9 @@
|
||||
<% i=1
|
||||
@order.each do |order| %>
|
||||
<% if order.status == 'new' %>
|
||||
<tr class="custom-tr first-<%=i%>" style="" data-id="<%=order.order_reservation_id%>">
|
||||
<tr class="custom-tr first-<%=i%>" style="" data-id="<%=order.order_reservation_id%>" data-sr-no="<%= i %>">
|
||||
<td width ="5%" class="align-left">
|
||||
<%=i%>
|
||||
<%=i%>
|
||||
</td>
|
||||
<td width ="30%" class="align-center">
|
||||
<%= order.requested_time.utc.getlocal.strftime("%I:%M %p") %>
|
||||
@@ -38,7 +38,7 @@
|
||||
<%=order.grand_total%>
|
||||
</td>
|
||||
<td width ="30%" class="align-center">
|
||||
<span class="font-10 col-blue"><%=order.status%></span>
|
||||
<span class="font-10 col-blue"><%= order.status %></span>
|
||||
</td>
|
||||
</tr>
|
||||
<%i+=1%>
|
||||
@@ -59,9 +59,9 @@
|
||||
<% i=1
|
||||
@order.each do |order| %>
|
||||
<% if order.status == 'accepted' %>
|
||||
<tr class="custom-tr " style="" data-id="<%=order.order_reservation_id%>">
|
||||
<tr class="custom-tr second-<%=i%>" style="" data-id="<%=order.order_reservation_id%>" data-sr-no="<%= i %>">
|
||||
<td width ="5%" class="align-left">
|
||||
<%=i%>
|
||||
<%=i%>
|
||||
</td>
|
||||
<td width ="30%" class="align-center">
|
||||
<%= order.requested_time.utc.getlocal.strftime("%I:%M %p") %>
|
||||
@@ -89,8 +89,8 @@
|
||||
<tbody>
|
||||
<% i=1
|
||||
@order.each do |order| %>
|
||||
<% if order.status == 'processed' %>
|
||||
<tr class="custom-tr" style="" data-id="<%=order.order_reservation_id%>">
|
||||
<% if order.status == 'send_to_kitchen' %>
|
||||
<tr class="custom-tr third-<%=i%>" style="" data-id="<%=order.order_reservation_id%>" data-sr-no="<%= i %>">
|
||||
<td width ="5%" class="align-left">
|
||||
<%=i%>
|
||||
</td>
|
||||
@@ -113,15 +113,15 @@
|
||||
</div>
|
||||
</div>
|
||||
<!--- Panel 3 - Orders -->
|
||||
<div class="tab-pane dining" id="delivery" role="tabpanel">
|
||||
<div class="tab-pane dining" id="completed" role="tabpanel">
|
||||
<div class="card-block font-13">
|
||||
<div id="menu-slimscroll" data-height="50">
|
||||
<table class="table table-stripe custom-table">
|
||||
<tbody>
|
||||
<% i=1
|
||||
@order.each do |order| %>
|
||||
<% if order.status == 'completed' %>
|
||||
<tr class="custom-tr" style="" data-id="<%=order.order_reservation_id%>">
|
||||
<% if order.status == 'ready_to_delivery' %>
|
||||
<tr class="custom-tr fourth-<%=i%>" style="" data-id="<%=order.order_reservation_id%>" data-sr-no="<%= i %>">
|
||||
<td width ="5%" class="align-left">
|
||||
<%=i%>
|
||||
</td>
|
||||
@@ -153,10 +153,10 @@
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td width ="70%" class="header-td align-left">
|
||||
<b class="col-pink font-16">No.11</b>
|
||||
<span class="font-13">(DELIVERY)</span>
|
||||
<b class="col-pink font-16"><span id="sr_number"></span> </b>
|
||||
<span class="font-13"><span id="delivery_info"></span></span>
|
||||
</td>
|
||||
<td width ="30%" class="header-td font-16 align-right"><b>0065 4321</b></td>
|
||||
<td width ="30%" class="header-td font-16 align-right"><b><span id="contact_info">0065 4321</span></b></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
@@ -214,6 +214,9 @@
|
||||
</td>
|
||||
<td width ="30%" class="footer-td align-right col-blue" id="grand_total">0.00</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" id="order_remark"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width ="50%" class="footer-td align-left col-blue">
|
||||
<button type="button" class="btn btn-lg bg-red waves-effect" id="cancel" data-value="cancel">
|
||||
@@ -287,7 +290,7 @@
|
||||
</div>
|
||||
<p id="ref_no" class="hidden"></p>
|
||||
<p id="callback_url" class="hidden"></p>
|
||||
<p id="order_id" class="hidden"></p>
|
||||
<p id="order_id"></p>
|
||||
<p id="status" class="hidden"></p>
|
||||
<script type="text/javascript">
|
||||
jQuery(function(){
|
||||
|
||||
@@ -437,10 +437,12 @@
|
||||
<div class="row m-b-10 m-r-30">
|
||||
|
||||
<div class="col-md-5 m-r-20">
|
||||
<button type="button" class="btn btn-link bg-red waves-effect print_receipt">Print</button>
|
||||
<% if ENV["SERVER_MODE"] != "cloud" %>
|
||||
<button type="button" class="btn btn-link bg-red waves-effect print_receipt">Print</button>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-5 m-r-20">
|
||||
<button type="button" class="btn btn-link bg-blue waves-effect btn_pdf_close" data-dismiss="modal">CLOSE</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -75,6 +75,10 @@ en:
|
||||
dine_in_cashier: "Dine-in Cashier"
|
||||
quick_service: "Quick Service"
|
||||
order_reservation: "Order & Reservation"
|
||||
pending: "Pending"
|
||||
processing: "Processing"
|
||||
delivering: "Delivering"
|
||||
completed: "Completed"
|
||||
|
||||
views:
|
||||
btn:
|
||||
|
||||
@@ -70,6 +70,10 @@ mm:
|
||||
dine_in_cashier: "Dine-in Cashier"
|
||||
quick_service: "Quick Service"
|
||||
order_reservation: "Order & Reservation"
|
||||
pending: "Pending"
|
||||
processing: "Processing"
|
||||
delivering: "Delivering"
|
||||
completed: "Completed"
|
||||
|
||||
views:
|
||||
btn:
|
||||
|
||||
Reference in New Issue
Block a user