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

@@ -563,7 +563,7 @@ $(function() {
$(document).on('click', '.add_icon', function(event){
if (window.location.pathname.includes('out_of_stock') == false) {
if($(this).hasClass('product_item')) {
$('.sx_item_detailModal').modal('hide');
@@ -1168,10 +1168,12 @@ $(function() {
data: params,
dataType: "json",
success: function(result){
if (type == "quick_service" || type=="food_court") {
module_name = window.location.href.includes('foodcourt') ? 'foodcourt' : 'origami'
window.location.href = "/"+module_name+"/"+type;
}else{
booking_id = result.booking_id;
if (type == "quick_service") {
window.location.href = "/origami/quick_service";
} else if (type=="food_court") {
window.location.href = "/foodcourt/app_orders?pending_id=" + booking_id;
} else {
if(table_type == "Table"){
window.location.href = "/origami/table/" + table_id;
}
@@ -1195,7 +1197,7 @@ $(function() {
// Pay Discount for Payment
// $("#create_pay_order").on('click', function(e){
// $(this).prop("disabled", true);
// $("#create_order").prop("disabled", true);
// $("#read_modal").attr('data-for', 'member');
@@ -1716,7 +1718,7 @@ $(function() {
menu_insta = '';
$(instances).each(function(i){
if (!instances[i].out_of_stock) { //instances[i].is_default === true &&
if (!instances[i].out_of_stock) { //instances[i].is_default === true &&
code = instances[i].code;
name = instances[i].name;
price = parseFloat(instances[i].price).toFixed(2);

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="";