fix foodcourt sales transaction

This commit is contained in:
Thein Lin Kyaw
2023-08-24 10:40:31 +06:30
parent 5503852217
commit a97b6bff3f
22 changed files with 361 additions and 453 deletions

View File

@@ -63,7 +63,8 @@ function member_card(cardNo) {
var params = {'order_source': type, 'order_type': "dine_in",
'customer_id': customer_id, 'guest_info': "",
'table_id': table_id,
'order_items': order_items,'sale_id': sale_id,'create_type': "create_pay" };
'order_items': order_items, 'sale_id': sale_id, 'create_type': "create_pay" };
if (booking_id.length > 0) {
params.booking_id = booking_id;
}
@@ -72,20 +73,17 @@ function member_card(cardNo) {
url: ajax_url,
data: params,
dataType: "json",
success:function(result){
if (result.data == 'OK'){
request_bill(g_membership_id, g_customer_id, g_customer_name);
}else{
if (result.data["sale_id"]){
update_sale(g_membership_id, g_customer_id, g_customer_name,result.data["sale_id"]);
}
success:function(result) {
if (result.sale_id) {
sale_id = result.sale_id;
window.location.href = '/foodcourt/sale/'+sale_id+'/food_court/payment/';
}
}
});
}else if($('.btn').is('#pay')){
update_sale(g_membership_id, g_customer_id, g_customer_name,$('#sale_id').text());
}
else{
} else if($('.btn').is('#pay')){
sale_id = $('#sale_id').text();
window.location.href = '/foodcourt/sale/'+sale_id+'/food_court/payment/';
} else {
request_bill(g_membership_id, g_customer_id, g_customer_name);
}
}
@@ -93,18 +91,20 @@ function member_card(cardNo) {
});
}
}
function request_bill(membership_id,customer_id,customer_name){
if (window.location.pathname.includes('foodcourt')) {
order_id = $('#order_id').val() || $('#save_order_id').val()
data = { 'customer_id': customer_id }
$.ajax({
type: "GET",
url: "/foodcourt/food_court/"+order_id+"/request_bill" ,
data: {},
data: data,
dataType: "json",
success: function(data) {
if(data.status == true)
{
update_sale(membership_id, customer_id, customer_name, data.sale_id);
window.location.href = '/foodcourt/sale/'+data.sale_id+'/food_court/payment/';
}else{
swal("Alert!", "Error!", "error");
location.reload();
@@ -113,6 +113,7 @@ function request_bill(membership_id,customer_id,customer_name){
});
}
}
function update_sale(membership_id, customer_id, customer_name, sale_id) {
$("#oqs_loading_wrapper").css("display", "none");
var customer="";