show card balance when insufficient error occurred

This commit is contained in:
yarzar_code
2020-08-13 14:09:05 +06:30
parent 975d0f3ecd
commit e19bff005e
4 changed files with 50 additions and 62 deletions

View File

@@ -30,6 +30,11 @@ function member_card(cardNo) {
success: function(data) {
if (data[0].customer_id == false) {
swal("Alert!", data[0].message, "error");
if ($("#order-items-table tr").length > 1){
$("#create_pay_order").prop("disabled", false);
$("#create_order").prop("disabled", false);
}
$("#oqs_loading_wrapper").hide();
}else{
g_customer_id = data[0].customer_id;
g_customer_name = data[0].name;
@@ -115,40 +120,22 @@ function update_sale(membership_id, customer_id, customer_name, sale_id) {
if(customer_name != ""){
customer = '(' + customer_name + ')';
}
swal({
title: "Confirmation !",
text: 'Are you sure to assign this customer' + customer + '!',
showCancelButton: true,
confirmButtonColor: "green",
confirmButtonText: "Yes!",
cancelButtonClass: 'btn btn-danger customer_assign_cancel',
closeOnConfirm: true,
}, function (inputValue) {
if (inputValue===false) {
if ($("#order-items-table tr").length > 1){
$("#create_pay_order").prop("disabled", false);
$("#create_order").prop("disabled", false);
$("#oqs_loading_wrapper").show();
$.ajax({
type: "POST",
url: "/foodcourt/"+sale_id+"/"+cashier_type+"/customers/update_sale" ,
data: {customer_id:customer_id,sale_id:sale_id},
dataType: "json",
success: function(data) {
if(data.status == true)
{
//change customer detail
$("#customer_name").html(customer_name);
$("#membership_id").html(membership_id);
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
}
} else {
$("#oqs_loading_wrapper").show();
$.ajax({
type: "POST",
url: "/foodcourt/"+sale_id+"/"+cashier_type+"/customers/update_sale" ,
data: {customer_id:customer_id,sale_id:sale_id},
dataType: "json",
success: function(data) {
if(data.status == true)
{
//change customer detail
$("#customer_name").html(customer_name);
$("#membership_id").html(membership_id);
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
}
}
});
}
});
}