change split bill process
This commit is contained in:
@@ -386,9 +386,9 @@
|
||||
end
|
||||
%>
|
||||
</table>
|
||||
<button class='btn btn-primary' id='add_invoice'> Add to existing invoice</button>
|
||||
<button class='btn btn-primary btn-block waves-effect' id='add_invoice'> Add to existing invoice</button>
|
||||
<% if !@spit_bill.nil? && @spit_bill == '1' %>
|
||||
<button class='btn btn-primary' id='split_bill'> Split Bill</button>
|
||||
<button class='btn btn-primary btn-block waves-effect' id='split_bill'> Split Bill</button>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if @sale_array.size > 1 %>
|
||||
@@ -439,6 +439,11 @@
|
||||
<!-- <button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect" disabled>Charges</button> -->
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" id='move'>Move</button>
|
||||
<button type="button" id="request_bills" class="btn btn-block bg-blue waves-effect">Req.Bill</button>
|
||||
<% if !@split_bill.nil? %>
|
||||
<% if @split_bill == '1' %>
|
||||
<button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<!-- <button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect" disabled>First Bill</button> -->
|
||||
<!-- <button type="button" id="pay" class="btn btn-block bg-blue waves-effect" disabled>Pay</button> -->
|
||||
<!-- <button type="button" class="btn btn-block bg-blue waves-effect" disabled> Void</button> -->
|
||||
@@ -711,30 +716,6 @@
|
||||
|
||||
// Bill Request
|
||||
$('#request_bills').click(function () {
|
||||
var lookup_split_bill = '<%= @spit_bill %>';
|
||||
if(lookup_split_bill == '1'){
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: "Do you want to Split bill?",
|
||||
type: "success",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#009900",
|
||||
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{
|
||||
requestBillProcess();
|
||||
}
|
||||
});
|
||||
}else{
|
||||
requestBillProcess();
|
||||
}
|
||||
});
|
||||
|
||||
function requestBillProcess(){
|
||||
var order_id = $('#save_order_id').attr('data-order');
|
||||
var ajax_url = "/origami/" + order_id + "/request_bills";
|
||||
$.ajax({
|
||||
@@ -749,8 +730,14 @@
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//split bill process
|
||||
$('#split_bills').click(function(){
|
||||
var dining_id = "<%= @dining.id %>";
|
||||
window.location.href = '/origami/table/' + dining_id + "/split_bills";
|
||||
});
|
||||
|
||||
$('#move').on('click', function () {
|
||||
var dining_id = "<%= @dining.id %>";
|
||||
|
||||
@@ -200,7 +200,14 @@
|
||||
%>
|
||||
<% unless sale_item.price <= 0 %>
|
||||
<tr>
|
||||
<td class='item-name'><%= sale_item.item_name %></td>
|
||||
<td class='item-name'>
|
||||
<%= sale_item.item_name %>
|
||||
<% if !sale_item.set_menu_items.nil?
|
||||
sale_item.set_menu_items.each do |item_instance| %>
|
||||
<br><span class="font-13"><%= item_instance %></span>
|
||||
<% end
|
||||
end %>
|
||||
</td>
|
||||
<td class='item-attr'><%= sale_item.qty %></td>
|
||||
<td class='item-attr'><%= sale_item.price %></td>
|
||||
</tr>
|
||||
|
||||
@@ -411,6 +411,11 @@
|
||||
<button type="button" id="customer" class="btn bg-blue btn-block" >Customer</button>
|
||||
<button type="button" class="btn bg-blue btn-block" id='move'>Move</button>
|
||||
<button type="button" id="request_bills" class="btn bg-blue btn-block">Req.Bill</button>
|
||||
<% if !@split_bill.nil? %>
|
||||
<% if @split_bill == '1' %>
|
||||
<button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<!-- <button type="button" id="first_bill" class="btn bg-blue btn-block" disabled>First Bill</button> -->
|
||||
<!-- <button type="button" id="pay" class="btn bg-blue btn-block" disabled>Pay</button> -->
|
||||
<!-- <button type="button" class="btn bg-blue btn-block" disabled=""> Void </button> -->
|
||||
@@ -714,30 +719,6 @@ $('#pay').on('click',function() {
|
||||
});
|
||||
// Bill Request
|
||||
$('#request_bills').click(function() {
|
||||
var lookup_split_bill = '<%= @spit_bill %>';
|
||||
if(lookup_split_bill == '1'){
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: "Do you want to Split bill?",
|
||||
type: "success",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#009900",
|
||||
confirmButtonText: "Yes, split it!",
|
||||
closeOnConfirm: false
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
var dining_id = "<%= @room.id %>";
|
||||
window.location.href = '/origami/room/' + 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({
|
||||
@@ -753,7 +734,13 @@ function requestBillProcess(){
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
//split bill process
|
||||
$('#split_bills').click(function(){
|
||||
var dining_id = "<%= @room.id %>";
|
||||
window.location.href = '/origami/room/' + dining_id + "/split_bills";
|
||||
});
|
||||
|
||||
$('#move').on('click',function(){
|
||||
var dining_id = "<%= @room.id %>"
|
||||
|
||||
@@ -59,32 +59,34 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if !order.order_items.nil? %>
|
||||
<% if !@order_items.nil? %>
|
||||
<% sub_total = 0 %>
|
||||
<% order.order_items.each do |order_item| %>
|
||||
<% @order_items.each do |order_item| %>
|
||||
<% if order_item.include? (order.order_id.to_s) %>
|
||||
<%
|
||||
sub_total += order_item.qty*order_item.price
|
||||
sub_total += order_item[order.order_id.to_s]['qty'].to_f * order_item[order.order_id.to_s]['price'].to_f
|
||||
%>
|
||||
<tr class="item-row" id=<%= order_item.order_items_id %> >
|
||||
<tr class="item-row" id=<%= order_item[order.order_id.to_s]['order_items_id'] %> >
|
||||
<td style="width:60%; text-align:left">
|
||||
<span id="item-order-id" class="hidden"><%=order_item.order_id%></span>
|
||||
<span id="item-account-type" class="hidden"><%=order_item.account_id%></span>
|
||||
<span id="item-order-id" class="hidden"><%=order_item[order.order_id.to_s]['order_id'] %></span>
|
||||
<span id="item-account-type" class="hidden"><%=order_item[order.order_id.to_s]['account_id'] %></span>
|
||||
<span id="item-name-price">
|
||||
<%=order_item.item_name%>
|
||||
<% if !order_item.set_menu_items.nil?
|
||||
order_item.set_menu_items.each do |item_instance| %>
|
||||
<%=order_item[order.order_id.to_s]['item_name'] %>
|
||||
<% if !order_item[order.order_id.to_s]['set_menu_items'].nil?
|
||||
order_item[order.order_id.to_s]['set_menu_items'].each do |item_instance| %>
|
||||
<br><span class="font-13"><%= item_instance %></span>
|
||||
<% end
|
||||
end %>
|
||||
</span>
|
||||
</td>
|
||||
<td style="width:20%; text-align:right">
|
||||
<span id="item-qty"><%=order_item.qty%></span>
|
||||
<span id="item-qty"><%=order_item[order.order_id.to_s]['qty']%></span>
|
||||
</td>
|
||||
<td style="width:20%; text-align:right">
|
||||
<span id="item-total-price"><%=(order_item.qty*order_item.price)%></span>
|
||||
<span id="item-total-price"><%=(order_item[order.order_id.to_s]['qty'].to_f * order_item[order.order_id.to_s]['price'].to_f)%></span>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<%
|
||||
end
|
||||
%>
|
||||
@@ -148,9 +150,9 @@
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<!-- Action Panel -->
|
||||
<div>
|
||||
<button type="button" class="btn bg-default btn-block" id="back" ><i class="material-icons">reply</i> Back </button>
|
||||
<button id="order_split" class="btn btn-primary text-center action-btn" style="width:100%">Orders Split</button>
|
||||
<button id="order_item_split" class="btn btn-primary text-center action-btn">Order Items Split</button>
|
||||
<button type="button" class="btn bg-default btn-block waves-effect" id="back" ><i class="material-icons">reply</i> Back </button>
|
||||
<button id="order_split" class="btn btn-primary text-center action-btn waves-effect">By Order </button>
|
||||
<button id="order_item_split" class="btn btn-primary text-center action-btn waves-effect">By Order Item</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Column Three -->
|
||||
@@ -417,6 +419,7 @@ function get_selected_order_items(){
|
||||
order_item.order_id = $(this).find('#item-order-id').text().trim();
|
||||
order_item.name = $(this).find('#item-name-price').text().split('@')[0];
|
||||
order_item.account_id = $(this).find('#item-account-type').text();
|
||||
order_item.qty = $(this).find('#item-qty').text();
|
||||
order_item.price = $(this).find('#item-total-price').text();
|
||||
order_items.push(order_item);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user