order item split bill process

This commit is contained in:
phyusin
2018-02-06 09:46:30 +06:30
parent 3dc6f42bd5
commit 991bc48505
10 changed files with 309 additions and 505 deletions

View File

@@ -672,7 +672,9 @@
// Bill Request
$('#request_bills').click(function () {
swal({
var lookup_split_bill = '<%= @spit_bill %>';
if(lookup_split_bill == '1'){
swal({
title: "Alert",
text: "Do you want to Split bill?",
type: "warning",
@@ -680,30 +682,37 @@
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, split it!",
closeOnConfirm: false
}, function (isConfirm) {
if (isConfirm) {
var dining_id = "<%= @dining.id %>";
window.location.href = '/origami/table/' + dining_id + "/split_bills";
}else{
var order_id = $('#save_order_id').attr('data-order');
var ajax_url = "/origami/" + order_id + "/request_bills";
$.ajax({
type: "GET",
url: ajax_url,
// data: 'order_id='+ order_id,
success: function (result) {
if (!result.status) {
swal("Information!", result.error_message);
}
else {
location.reload();
}
}
});
}
});
}, function (isConfirm) {
if (isConfirm) {
var dining_id = "<%= @dining.id %>";
window.location.href = '/origami/table/' + dining_id + "/split_bills";
}else{
requestBillProcess();
}
});
}else{
requestBillProcess();
}
});
function requestBillProcess(){
var order_id = $('#save_order_id').attr('data-order');
var ajax_url = "/origami/" + order_id + "/request_bills";
$.ajax({
type: "GET",
url: ajax_url,
// data: 'order_id='+ order_id,
success: function (result) {
if (!result.status) {
swal("Information!", result.error_message);
}
else {
location.reload();
}
}
});
}
$('#move').on('click', function () {
var dining_id = "<%= @dining.id %>";
window.location.href = '/origami/table/' + dining_id + "/movetable";