add order button disable enable

This commit is contained in:
yarzar_code
2020-08-10 17:35:48 +06:30
parent 0c4a2e1761
commit d6f6e51e6f
3 changed files with 63 additions and 43 deletions

View File

@@ -1085,6 +1085,8 @@ $(function() {
// Create Order
$("#create_order").on('click', function(e){
$(this).prop("disabled", true);
$("#create_pay_order").prop("disabled", true);
e.preventDefault();
name_list = ''
count = 0;
@@ -1113,17 +1115,17 @@ $(function() {
}, function (isConfirm) {
if (isConfirm) {
create_order($(this))
}else{
$("#create_order").prop("disabled", false);
$("#create_pay_order").prop("disabled", false);
}
});
} else {
create_order($(this))
}
});
function create_order(data) {
data.attr('disabled', 'disabled');
$("#oqs_loading_wrapper").show();
var cashier_type = $("#link_type").val();
localStorage.setItem('cashier_type',cashier_type);
@@ -1165,38 +1167,46 @@ $(function() {
url: ajax_url,
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{
if(table_type == "Table"){
window.location.href = "/origami/table/" + table_id;
}
else {
window.location.href = "/origami/room/" + table_id;
}
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{
if(table_type == "Table"){
window.location.href = "/origami/table/" + table_id;
}
if ($('#server_mode').val() != "cloud" && second_display_lookup == 2){
customer_display_view(null,"reload");
else {
window.location.href = "/origami/room/" + table_id;
}
}
}
if ($('#server_mode').val() != "cloud" && second_display_lookup == 2){
customer_display_view(null,"reload");
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
$("#oqs_loading_wrapper").hide();
$("#create_order").prop("disabled", false);
$("#create_pay_order").prop("disabled", false);
swal("Error", "Status: " + textStatus, "error");
}
});
}
// Pay Discount for Payment
$("#create_pay_order").on('click', function(e){
$(this).prop("disabled", true);
$("#create_order").prop("disabled", true);
$("#sxModal").show();
$("#sxModal").attr('data-for', 'member');
$(this).attr('disabled', 'disabled');
e.preventDefault();
getCardNo();
});
$("#sxModal .btn_cancel").on('click',function(){
if($("#order-items-table tr").length > 1){
$( "#create_pay_order" ).prop( "disabled", false );
if ($("#order-items-table tr").length > 1){
$("#create_pay_order").prop("disabled", false);
$("#create_order").prop("disabled", false);
}
$("#sxModal").hide();
});