check order item split process
This commit is contained in:
@@ -200,7 +200,7 @@
|
||||
<% @sale_data.each_with_index do |sale_data, sale_index| %>
|
||||
<% if sale_data.sale_status != 'completed' && sale_data.sale_status != 'void' %>
|
||||
<% checked = "" %>
|
||||
<% if sale_index == 0 %>
|
||||
<% if sale_index == 1 %>
|
||||
<% checked = "checked" %>
|
||||
<% end %>
|
||||
<tr class="receipt-row" id=<%= sale_data.receipt_no %> data=<%= sale_data.grand_total %> >
|
||||
@@ -250,7 +250,8 @@
|
||||
<div class="form-horizontal">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||
<div class="form-group">
|
||||
<input type="text" id="per_person" name="per_person" class="form-control" onkeypress="return isNumberKey(event);"/>
|
||||
<input type="text" id="per_person" name="per_person" class="form-control" onkeypress="return isNumberKey(event);"/><br>
|
||||
<span id="per_personErr" style="color:red;"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -304,7 +305,7 @@
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn bg-default" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn bg-blue btn_per_person">Split Bill</button>
|
||||
<button type="button" class="btn bg-blue btn_per_person">= Split</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -483,58 +484,68 @@
|
||||
});
|
||||
|
||||
$('.btn_per_person').on('click', function(){
|
||||
$('#equal_split_modal').modal('hide');
|
||||
var person = parseInt($('#per_person').val());
|
||||
if(person > 1){
|
||||
var ajax_url = "/origami/split_bills/surveys";
|
||||
var dining_id = $("#table_id").text();
|
||||
var type = $("#table_type").text();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
dataType: 'JSON',
|
||||
data: {'dining_id':dining_id, 'sale_id':split_sale_id, 'receipt_no':split_receipt_no, 'total_customer': person, 'total_amount':split_total_amount },
|
||||
success: function (result) {
|
||||
console.log(result);
|
||||
if(result.status){
|
||||
var ajax_url = "/origami/sale/" + split_sale_id + "/first_bill";
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: ajax_url,
|
||||
success: function (result) {
|
||||
if((split_receipt_no!=undefined) && (split_receipt_no!=""))
|
||||
createReceiptNoInFirstBillData(split_receipt_no,"");
|
||||
|
||||
location.reload();
|
||||
// if(type=='Table'){
|
||||
// window.location.href = '/origami/table/' + dining_id;
|
||||
// }else{
|
||||
// window.location.href = '/origami/room/' + dining_id;
|
||||
// }
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
var person = $('#per_person').val();
|
||||
|
||||
if((person!=undefined) && (person!="")){
|
||||
$("#per_personErr").html('');
|
||||
$('#equal_split_modal').modal('hide');
|
||||
if(person > 1){
|
||||
var ajax_url = "/origami/split_bills/surveys";
|
||||
var dining_id = $("#table_id").text();
|
||||
var type = $("#table_type").text();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
dataType: 'JSON',
|
||||
data: {'dining_id':dining_id, 'sale_id':split_sale_id, 'receipt_no':split_receipt_no, 'total_customer': person, 'total_amount':split_total_amount },
|
||||
success: function (result) {
|
||||
console.log(result);
|
||||
if(result.status){
|
||||
var ajax_url = "/origami/sale/" + split_sale_id + "/first_bill";
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: ajax_url,
|
||||
success: function (result) {
|
||||
if((split_receipt_no!=undefined) && (split_receipt_no!=""))
|
||||
createReceiptNoInFirstBillData(split_receipt_no,"");
|
||||
|
||||
// location.reload();
|
||||
// if(type=='Table'){
|
||||
// window.location.href = '/origami/table/' + dining_id;
|
||||
// }else{
|
||||
// window.location.href = '/origami/room/' + dining_id;
|
||||
// }
|
||||
|
||||
window.location.href = '/origami/sale/' + split_sale_id + "/payment";
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
var ajax_url = "/origami/sale/" + split_sale_id + "/first_bill";
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: ajax_url,
|
||||
success: function (result) {
|
||||
if((split_receipt_no!=undefined) && (split_receipt_no!=""))
|
||||
createReceiptNoInFirstBillData(split_receipt_no,"");
|
||||
|
||||
// location.reload();
|
||||
// if(type=='Table'){
|
||||
// window.location.href = '/origami/table/' + dining_id;
|
||||
// }else{
|
||||
// window.location.href = '/origami/room/' + dining_id;
|
||||
// }
|
||||
window.location.href = '/origami/sale/' + split_sale_id + "/payment";
|
||||
}
|
||||
});
|
||||
}
|
||||
}else{
|
||||
var ajax_url = "/origami/sale/" + split_sale_id + "/first_bill";
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: ajax_url,
|
||||
success: function (result) {
|
||||
if((split_receipt_no!=undefined) && (split_receipt_no!=""))
|
||||
createReceiptNoInFirstBillData(split_receipt_no,"");
|
||||
|
||||
location.reload();
|
||||
// if(type=='Table'){
|
||||
// window.location.href = '/origami/table/' + dining_id;
|
||||
// }else{
|
||||
// window.location.href = '/origami/room/' + dining_id;
|
||||
// }
|
||||
}
|
||||
});
|
||||
$("#per_personErr").html("can't be blank");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
//equal split process
|
||||
|
||||
Reference in New Issue
Block a user