sale edit prevent multiple action

This commit is contained in:
Thein Lin Kyaw
2020-08-04 10:43:27 +06:30
parent 05ffd6cbb5
commit ffb8e56031

View File

@@ -88,7 +88,7 @@
</td> -->
<td class="p-1" width="25%">
<button data-id="<%= sale_item.id %>" class='btn btn-lg bg-danger waves-effect cancel'>Cancel
Void/Update
<%= sale_item.status %>
</button>
</td>
<% else %>
@@ -155,7 +155,7 @@
<div class="col-lg-1 col-md-1 col-sm-1">
<!-- Waiter Buttons -->
<button type="button" class="btn btn-block btn-lg bg-default waves-effect" id='back'><i class="material-icons">reply</i>Back</button>
<button type="button" class="btn btn-danger btn- action-btn" id='cancel_all_void'>Cancel All Void</button>
<button type="button" class="btn btn-block btn-lg btn-danger action-btn waves-effect" id='cancel_all_void'>Cancel All</button>
<button type="button" class="btn btn-block btn-lg bg-blue waves-effect" id='apply'>Apply</button>
</div>
</div>
@@ -196,7 +196,7 @@ var access_code = localStorage.getItem("access_code");
$("#action").attr('data-type', $(this).attr('data-type'));
$("#action").attr('data-id', $(this).attr('data-id'));
$("#action").text($(this).attr('data-type'))
})
});
$(".update").on('click', function () {
var sale_item_id = $(this).attr('data-id');
@@ -253,34 +253,8 @@ var access_code = localStorage.getItem("access_code");
}
});
/*$('.void').on('click', function () {
var sale_item_id = $(this).attr('data-id');
var remark = $("#remark").val();
var ajax_url = "/origami/item_void";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id=' + sale_item_id + "&remark=" + remark,
success: function (result) {
location.reload();
}
});
})
$('.foc').on('click', function () {
var sale_item_id = $(this).attr('data-id');
var ajax_url = "/origami/item_foc";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id=' + sale_item_id + "&remark=" + remark,
success: function (result) {
location.reload();
}
});
})*/
$('#action').on('click', function () {
$(this).attr("disabled", true);
var access_code = localStorage.getItem("access_code");
var sale_item_id = $(this).attr('data-id');
var type = $(this).attr('data-type');
@@ -329,6 +303,7 @@ var access_code = localStorage.getItem("access_code");
})
$('#cancel_all_void').on('click', function () {
$(this).attr('disabled', true);
var sale_id = "<%= @saleobj.sale_id %>"
var ajax_url = "/origami/cancel_all_void";
$.ajax({
@@ -342,6 +317,7 @@ var access_code = localStorage.getItem("access_code");
})
$('#apply').on('click', function () {
$(this).attr('disabled', true)
var sale_id = "<%= @saleobj.sale_id %>"
var ajax_url = "/origami/apply_void";
var table_id = '<%= @table_id %>'
@@ -355,7 +331,6 @@ var access_code = localStorage.getItem("access_code");
}else{
window.location.href = '/origami/table/' + table_id;
}
}
});
})
@@ -367,7 +342,6 @@ var access_code = localStorage.getItem("access_code");
$(".cashier_number").on('click', function(event){
if(event.handled !== true) {
var original_value='';
original_value = $('.addfocus').val();