equal split and order split in order tab'
This commit is contained in:
@@ -240,7 +240,8 @@
|
||||
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn bg-default btn-block " id='back'><i class="material-icons">reply</i>Back</button>
|
||||
<button type="button" class="btn bg-default btn-block waves-effect" id='back'><i class="material-icons">reply</i>Back</button>
|
||||
<button type="button" class="btn bg-blue btn-block waves-effect" id='by_order'>By Order</button>
|
||||
<% if @sale_status != 'completed' %>
|
||||
<!-- <button type="button" class="btn bg-blue btn-block" id='move'>MOVE</button> -->
|
||||
<% end %>
|
||||
@@ -285,5 +286,59 @@
|
||||
})
|
||||
$('#move').on('click',function(){
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
//order_split
|
||||
$('#by_order').on('click',function () {
|
||||
swal({
|
||||
title: "Alert",
|
||||
text: "Are you sure, you want to Split?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Yes, split it!",
|
||||
closeOnConfirm: false
|
||||
}, function (isConfirm) {
|
||||
if(isConfirm){
|
||||
orderSplitBillProcess();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/* function for order items split bill process */
|
||||
function orderSplitBillProcess(){
|
||||
var booking = JSON.parse('<%= @booking.to_json.html_safe %>');
|
||||
var orders = JSON.parse('<%= @orders.to_json.html_safe %>');
|
||||
var order = JSON.parse('<%= @order.to_json.html_safe %>');
|
||||
var arr_order = [];
|
||||
arr_order.push({id : order.order_id});
|
||||
|
||||
var dining_id = booking[0].dining_facility_id || 0;
|
||||
var type = booking[0].type || '';
|
||||
var customer_id = order.customer_id || '';
|
||||
var booking_id = "";
|
||||
if(orders.length == 1){
|
||||
booking_id = booking[0].booking_id;
|
||||
}
|
||||
|
||||
var ajax_url = "/origami/split_bills";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
dataType: 'JSON',
|
||||
data: {'dining_id' : dining_id, 'type': type, 'customer_id' : customer_id, 'booking_id' : booking_id, 'order_ids' : [], 'order_items' : '', 'orders' : JSON.stringify(arr_order)},
|
||||
success: function (result) {
|
||||
if (!result.status) {
|
||||
swal("Information!", result.error_message);
|
||||
}
|
||||
else{
|
||||
if(type=='Table'){
|
||||
window.location.href = '/origami/table/' + dining_id;
|
||||
}else{
|
||||
window.location.href = '/origami/room/' + dining_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user