fixed conflict
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-10 col-md-10 col-sm-10">
|
||||
<div class="<%= @webview==true ? 'col-lg-12 col-md-12 col-sm-12' : 'col-lg-10 col-md-10 col-sm-10' %>">
|
||||
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs tab-col-teal" role="tablist">
|
||||
@@ -80,8 +80,12 @@
|
||||
<div class="card-columns">
|
||||
<% @rooms.each do |room| %>
|
||||
<% if room.status == 'occupied' %>
|
||||
<% if room.get_booking.nil? %>
|
||||
<div class="card rooms red text-white" data-id="<%= room.id %>">
|
||||
<div class="card-block">
|
||||
<% else %>
|
||||
<div class="card rooms blue text-white" data-id="<%= room.id %>">
|
||||
<% end %>
|
||||
<div class="card-block">
|
||||
<%= room.name %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -112,11 +116,15 @@
|
||||
</div>
|
||||
<!-- tabs - End -->
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<div class="<%= @webview==true ? 'hidden' : 'col-lg-2 col-md-2 col-sm-2' %>">
|
||||
<!-- <button id="refreshbutton" type="button" class="btn btn-block radius-btn"> Refresh off </button> -->
|
||||
<button type="button" class="btn btn-block btn-default waves-effect" id='back'>
|
||||
<i class="material-icons">reply</i>
|
||||
<%= t("views.btn.back") %>
|
||||
</button>
|
||||
<%if current_login_employee.role == "administrator" || current_login_employee.role == "manager" %>
|
||||
<button id="back" type="button" class="btn btn-block btn-lg bg-default"> <i class="material-icons">reply</i> <%= t("views.btn.back") %>
|
||||
</button>
|
||||
<!-- <button id="back" type="button" class="btn btn-block btn-lg bg-default"> <i class="material-icons">reply</i> <%= t("views.btn.back") %>
|
||||
</button> -->
|
||||
<%end%>
|
||||
<%if current_login_employee.role != "waiter" %>
|
||||
<button id="cash_in" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.cash_in") %> </button>
|
||||
@@ -131,6 +139,10 @@
|
||||
<!-- Column One -->
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
var webview = <%= @webview %>;
|
||||
|
||||
showHideNavbar(webview,"index");
|
||||
|
||||
$(".tables").on('click', function(){
|
||||
var dining_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/table/' + dining_id;
|
||||
@@ -231,10 +243,25 @@ $('#cash_out').on('click',function(){
|
||||
window.location.href = '/origami/cash_outs/new';
|
||||
})
|
||||
|
||||
$('#close_cashier').on('click',function(){
|
||||
window.location.href = '/origami/shift/close';
|
||||
$('#close_cashier').on('click',function(e){
|
||||
e.preventDefault(); // Prevent the href from redirecting directly
|
||||
var linkURL = '/origami/shift/cashier/close';
|
||||
warnBeforeRedirect(linkURL);
|
||||
})
|
||||
|
||||
$('#back').on('click',function(){
|
||||
window.location.href = '/dashboard';
|
||||
window.location.href = '/origami/dashboard';
|
||||
})
|
||||
|
||||
function warnBeforeRedirect(linkURL) {
|
||||
swal({
|
||||
title: "Alert!",
|
||||
text: "Are you sure you want to close cashier?",
|
||||
type: "warning",
|
||||
showCancelButton: true
|
||||
}, function() {
|
||||
// Redirect the user
|
||||
window.location.href = linkURL;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<!--- Panel 1 - Table Orders -->
|
||||
<div class="tab-pane dining active " id="tables" role="tabpanel">
|
||||
<div class="card-columns">
|
||||
<% @tables.each do |table| %>
|
||||
<% @tables.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<% if table.get_booking.nil? %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
@@ -50,6 +50,11 @@
|
||||
<% end %>
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
<!-- <% if !@order_items_count.nil? %>
|
||||
<% if @order_items_count.key?(table.id) %>
|
||||
(Orders : <%= @order_items_count[table.id] %>)
|
||||
<% end %>
|
||||
<% end %> -->
|
||||
<span class="float-right font-12 new_text_<%= table.id %>"> billed</span>
|
||||
<div style="font-size:12px;"></div>
|
||||
</div>
|
||||
@@ -61,7 +66,12 @@
|
||||
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
|
||||
<% end %>
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
<%= table.name %>
|
||||
<!-- <% if !@order_items_count.nil? %>
|
||||
<% if @order_items_count.key?(table.id) %>
|
||||
(Orders : <%= @order_items_count[table.id] %>)
|
||||
<% end %>
|
||||
<% end %> -->
|
||||
<span class="float-right font-12 new_text_<%= table.id %>"> new</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -83,17 +93,31 @@
|
||||
<div class="card-columns">
|
||||
<% @rooms.each do |room| %>
|
||||
<% if room.status == 'occupied' %>
|
||||
|
||||
<% if room.get_booking.nil? %>
|
||||
<div class="card rooms red text-white table_<%= room.id %>" data-id="<%= room.id %>">
|
||||
<div class="card-block">
|
||||
<%= room.name %>
|
||||
<% if room.get_booking.nil? %>
|
||||
<!-- <% if !@order_items_count.nil? %>
|
||||
<% if @order_items_count.key?(room.id) %>
|
||||
(Orders : <%= @order_items_count[room.id] %>)
|
||||
<% end %>
|
||||
<% end %> -->
|
||||
<span class="float-right font-12 new_text_<%= room.id %>"> billed</span>
|
||||
<% else %>
|
||||
<span class="float-right font-12 new_text_<%= room.id %>"> new</span>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="card rooms blue text-white table_<%= room.id %>" data-id="<%= room.id %>">
|
||||
<div class="card-block">
|
||||
<%= room.name %>
|
||||
<!-- <% if !@order_items_count.nil? %>
|
||||
<% if @order_items_count.key?(room.id) %>
|
||||
(Orders : <%= @order_items_count[room.id] %>)
|
||||
<% end %>
|
||||
<% end %> -->
|
||||
<span class="float-right font-12 new_text_<%= room.id %>"> new</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="card rooms green text-white table_<%= room.id %>" data-id="<%= room.id %>">
|
||||
<div class="card-block">
|
||||
@@ -110,9 +134,24 @@
|
||||
<div class="tab-pane dining" id="orders" role="tabpanel">
|
||||
<div class="card-columns">
|
||||
<% @orders.each do |order| %>
|
||||
<div class="card orders red text-white" data-id="<%= order.order_id %>">
|
||||
<div class="card orders <%=(order.status=="new") ? 'blue' : 'red'%> text-white" data-id="<%= order.order_id %>">
|
||||
<div class="card-block">
|
||||
<%= order.order_id %>
|
||||
<%
|
||||
order_status = ""
|
||||
sale_order = SaleOrder.find_by_order_id(order)
|
||||
if sale_order
|
||||
unless sale_order.sale_id.nil?
|
||||
sale = Sale.find(sale_order.sale_id)
|
||||
order_status = sale.sale_status
|
||||
if order_status == 'new'
|
||||
order_status = order.status
|
||||
end
|
||||
end
|
||||
else
|
||||
order_status = order.status
|
||||
end
|
||||
%>
|
||||
<%= order.order_id %> <% if !order_status.empty? %>| <%= order_status %> <% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -135,7 +174,7 @@
|
||||
<div id="save_order_id" data-order="">
|
||||
<% end %>
|
||||
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
|
||||
<% if @booking.checkout_by.nil? && !@booking.reserved_by.nil? && %>
|
||||
<% if @booking.checkout_by.nil? && !@booking.reserved_by.nil? %>
|
||||
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
||||
<% else %>
|
||||
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
||||
@@ -143,17 +182,21 @@
|
||||
</div>
|
||||
<% elsif @status_sale == 'sale' %>
|
||||
<div><strong id="order-title">INVOICE DETAILS </strong> | Table <%= @dining.name rescue "" %>
|
||||
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
||||
<% if !@booking.reserved_by.nil? && %>
|
||||
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
||||
<% else %>
|
||||
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
||||
<% end %>
|
||||
</div>
|
||||
<% else %>
|
||||
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title">
|
||||
<div class="row p-l-5 p-r-5">
|
||||
<% if (!@sale_array.empty?) && (!@date.nil?) %>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<div class="col-lg-8 col-md-8 col-sm-8">
|
||||
Receipt No: <span id="receipt_no">
|
||||
<% if @status_sale == 'sale' %>
|
||||
<%= @sale_array[0].receipt_no rescue '' %>
|
||||
@@ -161,7 +204,7 @@
|
||||
</span>
|
||||
<br>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||
<div class="col-lg-4 col-md-4 col-sm-4 text-right">
|
||||
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y-%I:%M %p") rescue '-' %></span>
|
||||
<br>
|
||||
</div>
|
||||
@@ -233,11 +276,11 @@
|
||||
</tr>
|
||||
|
||||
<%
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
||||
if @status_order == 'order' && @status_sale != 'sale'
|
||||
puts
|
||||
unless @order_items.nil? || @order_items.empty?
|
||||
count = 0
|
||||
@order_items.each do |order_item|
|
||||
@@ -245,12 +288,36 @@
|
||||
sub_total = sub_total + (order_item.price * order_item.qty)
|
||||
|
||||
# unless order_item.price == 0 %>
|
||||
<tr>
|
||||
<td><%= count %></td>
|
||||
<td class='item-name'><%= order_item.item_name %></td>
|
||||
<td class='item-attr'><%= order_item.qty %></td>
|
||||
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
|
||||
</tr>
|
||||
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
|
||||
<td><%= count %></td>
|
||||
<td class='item-name'>
|
||||
<%= order_item.item_name %>
|
||||
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
|
||||
<% JSON.parse(order_item.options).each do |option| %>
|
||||
<br><span class="font-13">
|
||||
<%= option %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if !order_item.set_menu_items.nil? && order_item.set_menu_items != '[]'
|
||||
JSON.parse(order_item.set_menu_items).each do |item_instance| %>
|
||||
<br><span class="font-13">
|
||||
<%= item_instance["item_instance_name"] %>
|
||||
<% if !item_instance["options"].nil? && !item_instance["options"].empty? %>
|
||||
<% (item_instance["options"]).each do |set_item_option| %>
|
||||
<br><span class="font-13">
|
||||
<%= set_item_option %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end
|
||||
end %>
|
||||
</td>
|
||||
<td class='item-attr'><%= order_item.qty %></td>
|
||||
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
|
||||
</tr>
|
||||
<%
|
||||
|
||||
# end
|
||||
@@ -282,10 +349,10 @@
|
||||
<td class="charges-name"><strong>Tax:
|
||||
(<% @i = 0
|
||||
@account_arr.each do |ct| %>
|
||||
<%=ct.name%>
|
||||
<% if @account_arr.count != @i+1%>
|
||||
+ <% @i =+1 %>
|
||||
<%end%>
|
||||
<%=ct.name%>
|
||||
<% if @account_arr.count != @i+1%>
|
||||
+ <% @i =+1 %>
|
||||
<%end%>
|
||||
<%end %>)
|
||||
</strong></td>
|
||||
<td class="item-attr"><strong id="order-Tax"><%= @obj_sale.total_tax rescue 0 %></strong></td>
|
||||
@@ -317,19 +384,42 @@
|
||||
@order_items.each do |order_item|
|
||||
count += 1
|
||||
%>
|
||||
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
|
||||
<td><%= count %>
|
||||
<td class='item-name'>
|
||||
<%= order_item.item_name %>
|
||||
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
|
||||
<% JSON.parse(order_item.options).each do |option| %>
|
||||
<br><span class="font-13">
|
||||
<%= option %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<tr>
|
||||
<td><%= count %>
|
||||
<td class='item-name'><%= order_item.item_name %></td>
|
||||
<td class='item-attr'><%= order_item.qty %></td>
|
||||
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
|
||||
</tr>
|
||||
|
||||
<% if !order_item.set_menu_items.nil?
|
||||
JSON.parse(order_item.set_menu_items).each do |item_instance| %>
|
||||
<br><span class="font-13">
|
||||
<%= item_instance["item_instance_name"] %>
|
||||
<% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %>
|
||||
<% (item_instance["options"]).each do |set_item_option| %>
|
||||
<br><span class="font-13">
|
||||
<%= set_item_option %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end
|
||||
end %>
|
||||
</td>
|
||||
<td class='item-attr'><%= order_item.qty %></td>
|
||||
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
|
||||
</tr>
|
||||
<%
|
||||
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>
|
||||
<% end %>
|
||||
<% if @sale_array.size > 1 %>
|
||||
<br><br>
|
||||
@@ -368,8 +458,8 @@
|
||||
<i class="material-icons">reply</i>
|
||||
<%= t("views.btn.back") %>
|
||||
</button>
|
||||
<!-- <a href="<%=origami_second_display_index_path%>" target="_blank" id="second_view" class="btn action-btn bg-blue waves-effect" style="height: 45px">Customer View</a> -->
|
||||
<button type="button" id="add_order" class="btn btn-block bg-blue waves-effect"><%= t("views.btn.add") %> <%= t("views.right_panel.detail.order") %></button>
|
||||
<% if current_login_employee.role != "waiter" %>
|
||||
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
|
||||
<% if @dining.status != "available" %>
|
||||
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
||||
@@ -379,76 +469,161 @@
|
||||
<!-- <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> -->
|
||||
<% end %>
|
||||
<% if @status_sale == 'sale' %>
|
||||
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect">Customer</button>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' active="<%= can? :edit, :sale_edit %>">Edit</button>
|
||||
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect">Discount</button>
|
||||
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
|
||||
|
||||
<% if current_login_employee.role != "waiter" %>
|
||||
<button type="button" id="commissions" class="btn btn-block bg-blue waves-effect">Commissions</button>
|
||||
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
|
||||
|
||||
<%if @membership.discount && @obj_sale.customer.membership_id %>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#paymentModal">First Bill</button>
|
||||
<%else%>
|
||||
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
||||
<%end%>
|
||||
<% end %>
|
||||
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect">Customer</button>
|
||||
<% if current_login_employee.role != "waiter" %>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button>
|
||||
<% end %>
|
||||
<% if current_login_employee.role != "waiter" %>
|
||||
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
|
||||
<% end %>
|
||||
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</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 %>
|
||||
<% if current_login_employee.role != "waiter" %>
|
||||
<!-- first bill not used in cloud -->
|
||||
|
||||
<%if @membership.discount && @obj_sale.customer.membership_id %>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#paymentModal">First Bill</button>
|
||||
<%else%>
|
||||
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
||||
<%end%>
|
||||
|
||||
<button type="button" id="pay" class="btn btn-block bg-blue waves-effect">Pay</button>
|
||||
<button type="button" id="void" class="btn btn-block bg-blue waves-effect" active="<%= can? :overall_void, :void %>"> Void</button>
|
||||
|
||||
<!--<% if current_login_employee.role != "waiter" %>
|
||||
<button type="button" class="btn action-btn bg-blue waves-effect" data-toggle="modal" data-target="#waste_spoileModal" > Waste & Spoile</button>
|
||||
<% end %>-->
|
||||
<% end %>
|
||||
<% end %>
|
||||
<!-- Cashier Buttons -->
|
||||
|
||||
<!-- <button type="button" id="re-print" class="btn btn-block bg-blue waves-effect" >Re.Print</button> -->
|
||||
<% else %>
|
||||
<button type="button" id="check_in" class="btn btn-block bg-blue waves-effect"><%= t("views.btn.check_in") %></button>
|
||||
<% if !@checkout_time.empty? && !@checkout_alert_time.empty? %>
|
||||
<button type="button" id="check_in" class="btn btn-block bg-blue waves-effect"><%= t("views.btn.check_in") %></button>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
|
||||
<span class="hidden" id="member_discount"><%= @membership.discount%></span>
|
||||
<span class="hidden" id="membership_id"><%= @obj_sale.customer.membership_id rescue 0%></span>
|
||||
<div class="modal fade" id="paymentModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="paymentModalLabel">Choose Payment</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<select class="form-control show-tick payment_method" id="payment_method" >
|
||||
<option value="Cash">Cash</option>
|
||||
<% @payment_methods.each do |pay| %>
|
||||
<option value="<%= pay.payment_method %>">
|
||||
<%= pay.payment_method %>
|
||||
</option>
|
||||
<%end %>
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="paymentModalLabel">Choose Payment Method</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<!-- <select class="form-control show-tick payment_method" multiple="true" id="payment_method" > -->
|
||||
<!-- <option value="Cash">Cash</option> -->
|
||||
<button class='btn waves-effect payment_btn green' data-type='Credit' data-value='Credit'>Credit</button>
|
||||
<% @payment_methods.each do |pay| %>
|
||||
<!-- <option value="<%= pay.payment_method %>">
|
||||
<%= pay.payment_method %>
|
||||
</option> -->
|
||||
<button class='btn btn-lg waves-effect payment_btn green' data-type='<%= pay.payment_method %>' data-value='<%= pay.payment_method %>'><%= pay.payment_method %></button>
|
||||
<%end %>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<div class="modal-footer p-r-30">
|
||||
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
<!-- </select> -->
|
||||
</div>
|
||||
<div class="modal-footer p-r-30">
|
||||
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
|
||||
<button type="button" class="btn btn-link bg-blue waves-effect choose_payment">SAVE</button>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="btn btn-link bg-blue waves-effect choose_payment">SAVE</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="voidModalLabel">Please Enter Reason for Void</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input type="textarea" name="remark" class="form-control col-md-12 remark" id="remark">
|
||||
</div>
|
||||
<div class="modal-footer ">
|
||||
<div class="row p-r-20">
|
||||
<div class="col-md-5">
|
||||
<button type="button" class="btn btn-link bg-red waves-effect " id="void" active="true">VOID</button>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<button type="button" class="btn btn-link bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="waste_spoileModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="waste_spoileModalLabel">Are you sure Waste or Spoile ?</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row p-r-20">
|
||||
<div class="col-md-3">
|
||||
<button type="button" class="btn btn-lg bg-red waves-effect " data-status="waste" value="waste" id="btn_waste" onclick="waste_and_spoilage('waste')"><strong>Waste</strong></button>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<button type="button" class="btn btn-lg bg-red waves-effect " data-status="spoile" value="spoile" id="btn_spoile" onclick="waste_and_spoilage('spoile')"><strong>Spoile</strong></button>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<button type="button" class="btn btn-lg bg-blue waves-effect" data-dismiss="modal"><strong>CLOSE</strong></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer ">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var cashier_type = "cashier";
|
||||
$(document).ready(function () {
|
||||
/* check webview loaded*/
|
||||
var webview = <%= @webview %>;
|
||||
showHideNavbar(webview);
|
||||
/* start check first bill or not*/
|
||||
var receipt_no = "";
|
||||
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
}
|
||||
// console.log(checkReceiptNoInFirstBillData(receipt_no));
|
||||
if(checkReceiptNoInFirstBillData(receipt_no,"")){
|
||||
$("#pay").show();
|
||||
}else{
|
||||
$("#pay").hide();
|
||||
|
||||
discount="<%= @membership.discount%>"
|
||||
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
|
||||
if (discount) {
|
||||
if(checkReceiptNoInFirstBillData(receipt_no,"")){
|
||||
$("#pay").show();
|
||||
}else{
|
||||
$("#pay").hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
/* end check first bill or not*/
|
||||
|
||||
@@ -497,12 +672,12 @@
|
||||
$("#survey").on('click', function () {
|
||||
var sale = $('#sale_id').val();
|
||||
if (sale) {
|
||||
var sale_id = sale
|
||||
var sale_id = sale;
|
||||
} else {
|
||||
var sale_id = "<%= @dining.id %>";
|
||||
}
|
||||
//var table_id = $('.tables').attr("data-id");
|
||||
window.location.href = '/origami/' + sale_id + "/surveys"
|
||||
window.location.href = '/origami/' + sale_id +"/"+cashier_type+ "/surveys"
|
||||
});
|
||||
|
||||
// bind customer to order or sale
|
||||
@@ -515,16 +690,16 @@
|
||||
}
|
||||
var table_id = $('.tables').attr("data-id");
|
||||
|
||||
window.location.href = '/origami/' + sale_id + "/customers"
|
||||
window.location.href = '/origami/' + sale_id+"/"+cashier_type + "/customers/normal";
|
||||
|
||||
});
|
||||
|
||||
$('#re-print').click(function () {
|
||||
var sale_id = $('#sale_id').val();
|
||||
window.location.href = '/origami/' + sale_id + "/reprint"
|
||||
// $('#re-print').click(function () {
|
||||
// var sale_id = $('#sale_id').val();
|
||||
// window.location.href = '/origami/' + sale_id + "/reprint"
|
||||
|
||||
return false;
|
||||
});
|
||||
// return false;
|
||||
// });
|
||||
|
||||
// Add Other Charges
|
||||
$('#other-charges').click(function () {
|
||||
@@ -536,7 +711,7 @@
|
||||
}
|
||||
|
||||
if (sale_id != "") {
|
||||
window.location.href = '/origami/' + sale_id + '/other_charges'
|
||||
window.location.href = '/origami/' + sale_id + "/"+cashier_type+ '/other_charges'
|
||||
}
|
||||
else {
|
||||
swal ( "Oops" , "Please select an table!" , "warning" );
|
||||
@@ -547,6 +722,8 @@
|
||||
|
||||
// Discount for Payment
|
||||
$('#discount').click(function () {
|
||||
|
||||
if ($(this).attr('active')=== "true") {
|
||||
var sale = $('#sale_id').val();
|
||||
if (sale != "") {
|
||||
var sale_id = sale
|
||||
@@ -555,12 +732,14 @@
|
||||
}
|
||||
|
||||
if (sale_id != "") {
|
||||
window.location.href = '/origami/' + sale_id + '/discount'
|
||||
window.location.href = '/origami/' + sale_id+ "/"+cashier_type+'/discount'
|
||||
}
|
||||
else {
|
||||
swal ( "Oops" , "Please select an table!" , "warning" );
|
||||
}
|
||||
|
||||
}else{
|
||||
swal("Opps","You are not authorized for Discount","warning")
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
@@ -568,6 +747,7 @@
|
||||
$("#first_bill").on('click', function () {
|
||||
var sale_id = $('#sale_id').val();
|
||||
var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
|
||||
var server_mode =
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
@@ -576,19 +756,48 @@
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
if((receipt_no!=undefined) && (receipt_no!=""))
|
||||
createReceiptNoInFirstBillData(receipt_no,"");
|
||||
|
||||
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
|
||||
// console.log(result);
|
||||
// code2lab.printBill(result.filepath, result.printer_model, result.printer_url);
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// click select option icon for add
|
||||
$(document).on('click', '.payment_btn', function(event){
|
||||
active = $(this).hasClass('selected-payment');
|
||||
value = $(this).data('value');
|
||||
type = $(this).data('type');
|
||||
group = $(this).data('group');
|
||||
payments = $(".payment_btn");
|
||||
|
||||
if (active) {
|
||||
$(this).removeClass('selected-payment');
|
||||
}else{
|
||||
$(this).addClass('selected-payment');
|
||||
}
|
||||
}); //End selecct attribute buttom
|
||||
|
||||
$(".choose_payment").on('click', function () {
|
||||
$( "#loading_wrapper").show();
|
||||
|
||||
var sale_id = $('#sale_id').val();
|
||||
type = $('.payment_method').val();
|
||||
|
||||
calculate_member_discount(sale_id,type);
|
||||
|
||||
// type = $('.payment_method').val();
|
||||
type = get_selected_attributes('selected-payment');
|
||||
if(parseInt(jQuery.inArray("Credit", type)) == -1){
|
||||
if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1 || parseInt(jQuery.inArray("PAYMAL",type))!= -1) {
|
||||
calculate_member_discount(sale_id,"Card");
|
||||
|
||||
}else{
|
||||
calculate_member_discount(sale_id,"Cash");
|
||||
}
|
||||
}
|
||||
var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
@@ -598,11 +807,15 @@
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
if((receipt_no!=undefined) && (receipt_no!=""))
|
||||
createReceiptNoInFirstBillData(receipt_no,type);
|
||||
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function calculate_member_discount(sale_id,type) {
|
||||
var sub_total = $('#sub-total').text();
|
||||
if (type == "Cash") {
|
||||
@@ -621,42 +834,36 @@
|
||||
|
||||
}
|
||||
|
||||
// $('#pay').on('click', function () {
|
||||
// var sale_id = $('#sale_id').val();
|
||||
// var url = '/origami/sale/' + sale_id + "/rounding_adj";
|
||||
// $.ajax({
|
||||
// type: "POST",
|
||||
// url: '/origami/sale/' + sale_id + "/rounding_adj",
|
||||
// success: function (result) {
|
||||
// window.location.href = '/origami/sale/' + sale_id + "/payment";
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
$('#pay').on('click', function () {
|
||||
var sale_id = $('#sale_id').val();
|
||||
window.location.href = '/origami/sale/' + sale_id + "/payment";
|
||||
window.location.href = '/origami/sale/' + sale_id + "/cashier/payment";
|
||||
});
|
||||
|
||||
// Bill Request
|
||||
$('#request_bills').click(function () {
|
||||
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();
|
||||
}
|
||||
}
|
||||
});
|
||||
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();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//split bill process
|
||||
$('#split_bills').click(function(){
|
||||
var dining_id = "<%= @dining.id %>";
|
||||
window.location.href = '/origami/table/' + dining_id + "/" + cashier_type +"/split_bills";
|
||||
});
|
||||
|
||||
$('#move').on('click', function () {
|
||||
var dining_id = "<%= @dining.id %>";
|
||||
window.location.href = '/origami/table/' + dining_id + "/movetable";
|
||||
@@ -667,8 +874,10 @@
|
||||
})
|
||||
|
||||
$('#add_invoice').on('click', function () {
|
||||
var dining_id = "<%= @dining.id %>"
|
||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||
$("#first_bill").prop('disabled',true);
|
||||
$("#pay").prop('disabled',true);
|
||||
var dining_id = "<%= @dining.id %>";
|
||||
var sale_id = $("#sale_id").val(); //<%= @obj_sale.sale_id rescue "" %>
|
||||
var ajax_url = "/origami/sale/append_order";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
@@ -683,6 +892,8 @@
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
$("#first_bill").removeAttr('disabled');
|
||||
$("#pay").removeAttr('disabled');
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
@@ -727,7 +938,7 @@
|
||||
var dining_id = "<%= @dining.id %>"
|
||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||
if ($(this).attr('active')=== "true") {
|
||||
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/edit";
|
||||
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/"+cashier_type +"/edit";
|
||||
}else{
|
||||
swal("Opps","You are not authorized for void","warning")
|
||||
}
|
||||
@@ -758,12 +969,19 @@
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||
var ajax_url = "/origami/sale/" + sale_id + '/void';
|
||||
var ajax_url = "/origami/sale/" + sale_id + '/cashier/void';
|
||||
var remark = $("#remark").val();
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ajax_url,
|
||||
success: function () {
|
||||
window.location.href = '/origami/';
|
||||
data: "remark="+ remark + "&sale_id=" + sale_id,
|
||||
success: function (result) {
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
window.location.href = '/origami/';
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -794,4 +1012,73 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/* split bill in add to existing invoice*/
|
||||
$('#split_bill').on('click', function(){
|
||||
swal({
|
||||
title: "Alert",
|
||||
text: "Are you sure, you want to split bill?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
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";
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/*edit order in oqs*/
|
||||
$('.edit_order').on('click',function(){
|
||||
var assigned_order_item_id = $(this).attr('data-id');
|
||||
var dining_id = "<%= @dining.id %>";
|
||||
if((assigned_order_item_id!=undefined) && (assigned_order_item_id!='')){
|
||||
window.location.href = '/oqs/'+ assigned_order_item_id + "/edit/"+dining_id;
|
||||
}
|
||||
});
|
||||
|
||||
// Get Selected Class
|
||||
function get_selected_attributes(selected_class) {
|
||||
var item_row = $('.'+selected_class);
|
||||
var attribute_arr = [];
|
||||
$(item_row).each(function(i){
|
||||
value = $(item_row[i]).attr('data-value');
|
||||
str = value;
|
||||
attribute_arr.push(str);
|
||||
});
|
||||
return attribute_arr;
|
||||
}
|
||||
|
||||
function waste_and_spoilage(remark) {
|
||||
swal({
|
||||
title: "Alert",
|
||||
text: "Are you sure want to " + remark +" ?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Yes, " +remark+ " it!",
|
||||
closeOnConfirm: false
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||
var url = "/origami/sale/" + sale_id + '/cashier/waste_and_spoilage';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: url,
|
||||
data: "remark="+ remark + "&sale_id=" + sale_id,
|
||||
success: function (result) {
|
||||
console.log(result)
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
window.location.href = '/origami/';
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user