Merge branch 'split_bill' of bitbucket.org:code2lab/sxrestaurant into quick_service
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
<a href="javascript:void(0);" class="bars"></a>
|
||||
<a class="navbar-brand" href="<%=dashboard_path%>" style="margin-left: 20px;">
|
||||
<% else %>
|
||||
<a class="navbar-brand m-0" href="<%=dashboard_path%>">
|
||||
<a class="navbar-brand m-0" href="<%= origami_dashboard_path%>">
|
||||
<%end%>
|
||||
<img src="<%= asset_path('SX-Logo-small.png') %>" width="40" height="40" alt="Logo" />
|
||||
<span class="navbar-brand-txt">SX Restaurant</span>
|
||||
|
||||
@@ -118,13 +118,45 @@ $(document).ready(function(){
|
||||
data: params,
|
||||
success: function(result){
|
||||
// alert("Updated!");
|
||||
window.location.href = '/oqs';
|
||||
<% if !@link_type.nil? %>
|
||||
<% if @link_type == 'oqs' %>
|
||||
window.location.href = '/oqs';
|
||||
<% else %>
|
||||
<% if !@dining_type.nil? %>
|
||||
<% if @dining_type == 'Table' %>
|
||||
window.location.href = '/origami/table/'+<%=@link_type%>;
|
||||
<% else %>
|
||||
window.location.href = '/origami/room/'+<%=@link_type%>;
|
||||
<% end %>
|
||||
<% else %>
|
||||
window.location.href = '/origami/table/'+<%=@link_type%>;
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
window.location.href = '/oqs';
|
||||
<% end %>
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#back').on('click', function () {
|
||||
<% if !@link_type.nil? %>
|
||||
<% if @link_type == 'oqs' %>
|
||||
window.location.href = '/oqs';
|
||||
<% else %>
|
||||
<% if !@dining_type.nil? %>
|
||||
<% if @dining_type == 'Table' %>
|
||||
window.location.href = '/origami/table/'+<%=@link_type%>;
|
||||
<% else %>
|
||||
window.location.href = '/origami/room/'+<%=@link_type%>;
|
||||
<% end %>
|
||||
<% else %>
|
||||
window.location.href = '/origami/table/'+<%=@link_type%>;
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
window.location.href = '/oqs';
|
||||
<% end %>
|
||||
})
|
||||
|
||||
// number key pad
|
||||
|
||||
@@ -14,55 +14,7 @@
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<!-- Widgets -->
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
|
||||
<div class="info-box bg-cyan hover-expand-effect">
|
||||
<div class="icon">
|
||||
<i class="material-icons">help</i>
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="text"><%= t :sale_count %></div>
|
||||
<div class="number count-to" data-from="0" data-to="<%= @total_count%>" data-speed="1000" data-fresh-interval="20"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
|
||||
<div class="info-box bg-pink hover-expand-effect">
|
||||
<div class="icon">
|
||||
<i class="material-icons">attach_money</i>
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="text"><%= t :total_sale %></div>
|
||||
<div class="number count-to" data-from="0" data-to="<%= @total_sale%>" data-speed="15" data-fresh-interval="20"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
|
||||
<div class="info-box bg-light-green hover-expand-effect">
|
||||
<div class="icon">
|
||||
<i class="material-icons">person_add</i>
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="text"><%= t :total_credit %></div>
|
||||
<div class="number count-to" data-from="0" data-to="<%= @total_credit%>" data-speed="1000" data-fresh-interval="20"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
|
||||
<div class="info-box bg-orange hover-expand-effect">
|
||||
<div class="icon">
|
||||
<i class="material-icons">credit_card</i>
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="text"><%= t :total_card %></div>
|
||||
<div class="number count-to" data-from="0" data-to="<%= @total_card%>" data-speed="1000" data-fresh-interval="20"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- #END# Widgets -->
|
||||
<!-- Widgets -->
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12 qs_view">
|
||||
@@ -83,6 +35,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- #END# Widgets -->
|
||||
<% if !@current_user.nil? && @current_user.role != 'waiter' %>
|
||||
<!-- CPU Usage -->
|
||||
<div class="row clearfix">
|
||||
|
||||
@@ -230,6 +183,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
@@ -288,19 +288,39 @@
|
||||
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 %>
|
||||
<% if !order_item.set_menu_items.nil?
|
||||
order_item.set_menu_items.each do |item_instance| %>
|
||||
<br><span class="font-13"><%= item_instance %></span>
|
||||
<% end
|
||||
end %>
|
||||
</td>
|
||||
<td class='item-attr'><%= order_item.qty %></td>
|
||||
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
|
||||
</tr>
|
||||
<% if !@assigned_order_items.nil? %>
|
||||
<% @assigned_order_items.each do |assigned_order_item| %>
|
||||
<% if assigned_order_item.include? (order_item.order_items_id) %>
|
||||
<tr class="edit_order" data-id='<%= assigned_order_item[order_item.order_items_id] %>'>
|
||||
<td><%= count %></td>
|
||||
<td class='item-name'>
|
||||
<%= order_item.item_name %>
|
||||
<% if !order_item.set_menu_items.nil?
|
||||
order_item.set_menu_items.each do |item_instance| %>
|
||||
<br><span class="font-13"><%= item_instance %></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 %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<tr>
|
||||
<td><%= count %></td>
|
||||
<td class='item-name'>
|
||||
<%= order_item.item_name %>
|
||||
<% if !order_item.set_menu_items.nil?
|
||||
order_item.set_menu_items.each do |item_instance| %>
|
||||
<br><span class="font-13"><%= item_instance %></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 %>
|
||||
<%
|
||||
|
||||
# end
|
||||
@@ -427,7 +447,6 @@
|
||||
<%= t("views.btn.back") %>
|
||||
</button>
|
||||
<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' %>
|
||||
@@ -447,13 +466,23 @@
|
||||
<!-- <button type="button" class="btn btn-block bg-blue waves-effect" disabled> Void</button> -->
|
||||
<% end %>
|
||||
<% if @status_sale == 'sale' %>
|
||||
<% 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>
|
||||
<% 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" id="void" class="btn btn-block bg-blue waves-effect" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> active="true"> Void</button>
|
||||
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
|
||||
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
|
||||
<% end %>
|
||||
<% 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 ENV["SERVER_MODE"] == "cloud" %>
|
||||
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
||||
@@ -465,13 +494,8 @@
|
||||
<%end%>
|
||||
<% end %>
|
||||
<button type="button" id="pay" class="btn btn-block bg-blue waves-effect">Pay</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 %>
|
||||
|
||||
<% end %>
|
||||
<% end %>
|
||||
<!-- Cashier Buttons -->
|
||||
|
||||
<!-- <button type="button" id="re-print" class="btn btn-block bg-blue waves-effect" >Re.Print</button> -->
|
||||
@@ -509,7 +533,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -898,4 +921,13 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/*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;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -125,7 +125,13 @@
|
||||
<% if !@individual_total[0].nil? %>
|
||||
<tr>
|
||||
<td class="charges-name">
|
||||
<strong>Individual amount for <%= @individual_total[0]['total_customer'] %> persons</strong>
|
||||
<strong>Split Bill for <%= @individual_total[0]['total_customer'] %> persons</strong>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name">
|
||||
<strong>Amount Due (per person)</strong>
|
||||
</td>
|
||||
<td class="item-attr"><strong><span><%= number_with_precision(@individual_total[0]['per_person_amount'], precision: precision.to_i )%></span></strong></td>
|
||||
</tr>
|
||||
@@ -445,7 +451,7 @@ console.log("fffffffffffff")
|
||||
swal ( "Oops" , "Please select an table!" , "warning" );
|
||||
}
|
||||
}else{
|
||||
swal("Opps","You are not authorized for Discount","warning")
|
||||
swal("Oops","You are not authorized for Discount","warning")
|
||||
}
|
||||
return false;
|
||||
});
|
||||
@@ -461,7 +467,7 @@ console.log("fffffffffffff")
|
||||
}
|
||||
|
||||
}else{
|
||||
swal("Opps","You are not authorized for void","warning")
|
||||
swal("Oops","You are not authorized for void","warning")
|
||||
}
|
||||
});
|
||||
|
||||
@@ -548,23 +554,23 @@ console.log("fffffffffffff")
|
||||
$('#pay').click(function() {
|
||||
sub_total = $('#sub-total').text();
|
||||
if (payment_type == 'MPU' && $('.mpu').text() == 0 && sub_total != 0.0) {
|
||||
swal("Opps","Please Pay with MPU Payment","warning");
|
||||
swal("Oops","Please Pay with MPU Payment","warning");
|
||||
}else if(payment_type == "Redeem" && $('#ppamount').text()==0 && sub_total != 0.0){
|
||||
swal("Opps","Please Pay with Redeem Payment","warning");
|
||||
swal("Oops","Please Pay with Redeem Payment","warning");
|
||||
}else if(payment_type == "VISA" && $('#visacount').text()==0 && sub_total != 0.0){
|
||||
swal("Opps","Please Pay with Visa Payment","warning");
|
||||
swal("Oops","Please Pay with Visa Payment","warning");
|
||||
|
||||
}else if(payment_type == "JCB" && $('#jcbcount').text()==0 && sub_total != 0.0){
|
||||
swal("Opps","Please Pay with jcb Payment","warning");
|
||||
swal("Oops","Please Pay with jcb Payment","warning");
|
||||
}
|
||||
else if(payment_type == "Master" && $('#mastercount').text()==0 && sub_total != 0.0){
|
||||
swal("Opps","Please Pay with Master Payment","warning");
|
||||
swal("Oops","Please Pay with Master Payment","warning");
|
||||
}
|
||||
else if(payment_type == "UNIONPAY" && $('#unionpaycount').text()==0 && sub_total != 0.0){
|
||||
swal("Opps","Please Pay with UNIONPAY Payment","warning");
|
||||
swal("Oops","Please Pay with UNIONPAY Payment","warning");
|
||||
}
|
||||
else if(payment_type == "Credit" && $('#credit').text()==0 && sub_total != 0.0){
|
||||
swal("Opps","Please Pay with Credit Payment","warning");
|
||||
swal("Oops","Please Pay with Credit Payment","warning");
|
||||
}else{
|
||||
|
||||
$( "#loading_wrapper").show();
|
||||
@@ -664,7 +670,7 @@ console.log("fffffffffffff")
|
||||
})
|
||||
});
|
||||
}else{
|
||||
swal("Opps","You are not authorized for void","warning")
|
||||
swal("Oops","You are not authorized for void","warning")
|
||||
}
|
||||
|
||||
});
|
||||
@@ -722,7 +728,7 @@ console.log("fffffffffffff")
|
||||
}
|
||||
});
|
||||
}else{
|
||||
swal("Opps","You are not authorized for foc","warning")
|
||||
swal("Oops","You are not authorized for foc","warning")
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -420,6 +420,7 @@
|
||||
<% if @status_sale == 'sale' %>
|
||||
<!-- <button type="button" class="btn bg-blue btn-block" disabled>Add Order</button> -->
|
||||
<button type="button" id="customer" class="btn bg-blue btn-block" >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" id="void" class="btn btn-block bg-blue waves-effect" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> active="true"> Void</button>
|
||||
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
|
||||
@@ -427,6 +428,13 @@
|
||||
|
||||
<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>
|
||||
<% end %>
|
||||
<% 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 ENV["SERVER_MODE"] == "cloud" %>
|
||||
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
||||
@@ -437,14 +445,11 @@
|
||||
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
||||
<%end%>
|
||||
<%end%>
|
||||
<% 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="pay" class="btn bg-blue btn-block">Pay</button>
|
||||
<% end %>
|
||||
<!-- <button type="button" id="void" class="btn bg-blue btn-block" > Void </button> -->
|
||||
<% end %>
|
||||
<% if current_login_employee.role != "waiter" %>
|
||||
<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>
|
||||
@@ -475,7 +480,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- Cashier Buttons -->
|
||||
|
||||
<% end %>
|
||||
<!-- <button type="button" id="re-print" class="btn bg-blue btn-block" >Re.Print</button> -->
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<!-- Column Two -->
|
||||
<div class="col-lg-10 col-md-10 col-sm-10">
|
||||
<div class="col-lg-11 col-md-11 col-sm-11">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div><strong id="order-title">INVOICE DETAILS </strong></div>
|
||||
@@ -63,7 +63,8 @@
|
||||
<span id="<%= sale_item.id %>_qtyErr" style="color:red;"></span>
|
||||
</td>
|
||||
<td class="p-1" width="10%">
|
||||
<input id="<%= sale_item.id %>_price" data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.unit_price %>" class="form-control"/>
|
||||
<input id="<%= sale_item.id %>_price" data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.unit_price %>" class="form-control" onkeypress="return isNumberKey(event);"/>
|
||||
<span id="<%= sale_item.id %>_priceErr" style="color:red;"></span>
|
||||
</td>
|
||||
<!-- <td class='' width="17%">
|
||||
<input id="<%= sale_item.id %>_price" data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control"/>
|
||||
@@ -168,8 +169,40 @@ var cashier_type = "<%= @cashier_type %>";
|
||||
var qty = $('#' + sale_item_id + "_qty").val();
|
||||
var price = $('#' + sale_item_id + "_price").val();
|
||||
console.log(qty + "|" + price);
|
||||
if(qty > 0){
|
||||
var qty_status = true;
|
||||
var price_status = true;
|
||||
if((qty > 0) && (price > 0)){
|
||||
qty_status = true;
|
||||
price_status = true;
|
||||
$('#' + sale_item_id + "_qtyErr").html("");
|
||||
$('#' + sale_item_id + "_priceErr").html("");
|
||||
}else if((qty > 0) && (price <= 0 || price == '')){
|
||||
price_status = false;
|
||||
$('#' + sale_item_id + "_qtyErr").html("");
|
||||
if(price == ''){
|
||||
$('#' + sale_item_id + "_priceErr").html("can't be blank");
|
||||
}else{
|
||||
$('#' + sale_item_id + "_price").val("");
|
||||
$('#' + sale_item_id + "_priceErr").html("Price must be greater than 0");
|
||||
}
|
||||
}else if((qty <= 0 || qty == '') && (price > 0)){
|
||||
qty_status = false;
|
||||
if(qty == ''){
|
||||
$('#' + sale_item_id + "_qtyErr").html("can't be blank");
|
||||
}else{
|
||||
$('#' + sale_item_id + "_qty").val("");
|
||||
$('#' + sale_item_id + "_qtyErr").html("Quantity must be greater than 0");
|
||||
}
|
||||
|
||||
$('#' + sale_item_id + "_priceErr").html("");
|
||||
}else{
|
||||
qty_status = false;
|
||||
price_status = false;
|
||||
$('#' + sale_item_id + "_qtyErr").html("can't be blank");
|
||||
$('#' + sale_item_id + "_priceErr").html("can't be blank");
|
||||
}
|
||||
|
||||
if(qty_status && price_status){
|
||||
var ajax_url = "/origami/item_edit";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
@@ -184,10 +217,7 @@ var cashier_type = "<%= @cashier_type %>";
|
||||
});
|
||||
}
|
||||
});
|
||||
}else{
|
||||
$('#' + sale_item_id + "_qtyErr").html("can't be blank");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('.void').on('click', function () {
|
||||
@@ -334,4 +364,8 @@ var cashier_type = "<%= @cashier_type %>";
|
||||
$("#"+sale_item_id+"_qty").val('1');
|
||||
}
|
||||
}
|
||||
|
||||
function checkPrice(obj_value,sale_item_id) {
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -65,6 +65,8 @@
|
||||
<td style="width:60%; text-align:left">
|
||||
<span id="item-order-id" class="hidden"><%=odr_item['order_id'] %></span>
|
||||
<span id="item-account-type" class="hidden"><%=odr_item['account_id'] %></span>
|
||||
<span id="item-code" class="hidden"><%=odr_item['item_code'] %></span>
|
||||
<span id="item-instance-code" class="hidden"><%=odr_item['item_instance_code'] %></span>
|
||||
<span id="item-name-price">
|
||||
<%=odr_item['item_name'] %>
|
||||
<% if !odr_item['set_menu_items'].nil?
|
||||
@@ -132,6 +134,8 @@
|
||||
<td style="width:60%; text-align:left">
|
||||
<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-code" class="hidden"><%=order_item[order.order_id.to_s]['item_code'] %></span>
|
||||
<span id="item-instance-code" class="hidden"><%=order_item[order.order_id.to_s]['item-instance-code'] %></span>
|
||||
<span id="item-name-price">
|
||||
<%=order_item[order.order_id.to_s]['item_name'] %>
|
||||
<% if !order_item[order.order_id.to_s]['set_menu_items'].nil?
|
||||
@@ -194,7 +198,9 @@
|
||||
<th>#</th>
|
||||
<th>Receipt No.</th>
|
||||
<th>Total</th>
|
||||
<% if !@current_user.nil? && @current_user.role == 'cashier' %>
|
||||
<th>Action</th>
|
||||
<% end %>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @sale_data.each_with_index do |sale_data, sale_index| %>
|
||||
@@ -207,9 +213,12 @@
|
||||
<td><input type="radio" name="rdn_receipt" id="rdn_receipt" value="<%= sale_data.sale_id %>" <%= checked %>></td>
|
||||
<td><span id="receipt_no"><%= sale_data.receipt_no %></span></td>
|
||||
<td><span id="grand_total"><%= sale_data.grand_total %></span></td>
|
||||
|
||||
<% if !@current_user.nil? && @current_user.role == 'cashier' %>
|
||||
<td>
|
||||
<button type="button" class="btn btn-block waves-effect btn-primary btn_pay" id=<%= sale_data.sale_id %> >Pay</button>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -228,7 +237,9 @@
|
||||
<!-- Action Panel -->
|
||||
<div>
|
||||
<button type="button" class="btn bg-default btn-block waves-effect" id="back" ><i class="material-icons">reply</i> Back </button>
|
||||
<button id="equal_split" class="btn btn-block waves-effect bg-blue">= Split</button>
|
||||
<% if !@current_user.nil? && @current_user.role == 'cashier' %>
|
||||
<button id="equal_split" class="btn btn-block waves-effect bg-blue">= Split</button>
|
||||
<% end %>
|
||||
<% if !@orders.empty? %>
|
||||
<button id="order_split" class="btn btn-block waves-effect bg-blue">By Order</button>
|
||||
<button id="order_item_split" class="btn btn-block waves-effect bg-blue">By Order Item</button>
|
||||
@@ -689,6 +700,8 @@ function get_selected_order_items(){
|
||||
var order_item = {};
|
||||
order_item.id = $(this).attr('id').substr(0,16);
|
||||
order_item.order_id = $(this).find('#item-order-id').text().trim();
|
||||
order_item.item_code = $(this).find('#item-code').text().trim();
|
||||
order_item.item_instance_code = $(this).find('#item-instance-code').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();
|
||||
|
||||
@@ -1,11 +1,26 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<% if !@print_settings.nil? %>
|
||||
<% if @print_settings.precision.to_i > 0
|
||||
precision = @print_settings.precision
|
||||
else
|
||||
precision = 0
|
||||
end
|
||||
#check delimiter
|
||||
if @print_settings.delimiter
|
||||
delimiter = ","
|
||||
else
|
||||
delimiter = ""
|
||||
end
|
||||
%>
|
||||
<% end %>
|
||||
|
||||
<div class="col-lg-4 col-md-6 col-sm-6">
|
||||
<!-- <div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;"> -->
|
||||
<% @sale_array.each do |sale| %>
|
||||
<div class="card tables" data-id="<%= sale.id %>">
|
||||
<div class="card tables receipt_block" data-id="<%= sale.id %>">
|
||||
<% if sale.id == @sale.id %>
|
||||
<div class="card-block" style="background-color:#6080f0;">
|
||||
<div class="card-block selected-item">
|
||||
<%= sale.receipt_no %>
|
||||
</div>
|
||||
<% else %>
|
||||
@@ -15,7 +30,7 @@
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-7 col-md-5 col-sm-5">
|
||||
<div class="card" >
|
||||
@@ -74,7 +89,7 @@
|
||||
<td><%= count %></td>
|
||||
<td class='item-name'><%= sale_item.product_name %></td>
|
||||
<td class='item-attr'><%= sale_item.qty %></td>
|
||||
<td class='item-attr'><%= sale_item.price %></td>
|
||||
<td class='item-attr'><%= number_with_precision(sale_item.price, precision: precision.to_i ) %></td>
|
||||
</tr>
|
||||
<%
|
||||
# end
|
||||
@@ -93,7 +108,7 @@
|
||||
<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>
|
||||
<td class='item-attr'><%= number_with_precision(order_item.qty*order_item.price, precision: precision.to_i ) %></td>
|
||||
</tr>
|
||||
<%
|
||||
end
|
||||
@@ -109,7 +124,7 @@
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||
<td class="item-attr"><strong id="order-sub-total"><span id="sub_total"><%= number_with_precision(sub_total, precision: precision.to_i ) %></span></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<%if @sale.discount_type == 'member_discount'%>
|
||||
@@ -117,19 +132,19 @@
|
||||
<%else%>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%end%>
|
||||
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
|
||||
<td class="item-attr"><strong id="order-discount">(<%= number_with_precision(@sale.total_discount, precision: precision.to_i ) rescue 0%>)</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Tax:</strong></td>
|
||||
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
|
||||
<td class="item-attr"><strong id="order-Tax"><%= number_with_precision(@sale.total_tax, precision: precision.to_i ) rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
||||
<td class="item-attr"><strong id="order-round-adj"><%= @sale.rounding_adjustment rescue 0%></strong></td>
|
||||
<td class="item-attr"><strong id="order-round-adj"><%= number_with_precision(@sale.rounding_adjustment, precision: precision.to_i ) rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>
|
||||
<td class="item-attr"><strong id="order-grand-total"><span id="grand_total"><%= number_with_precision(@sale.grand_total, precision: precision.to_i ) rescue 0%></span></strong></td>
|
||||
</tr>
|
||||
<tr class="rebate_amount"></tr>
|
||||
</table>
|
||||
@@ -142,7 +157,8 @@
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button id="back" type="button" class="btn btn-block btn-lg bg-default"> <i class="material-icons">reply</i> <%= t("views.btn.back") %>
|
||||
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
|
||||
<button type="button" id="void" class="btn bg-danger btn-block" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> active="true" > Void </button>
|
||||
<button type="button" class="btn bg-deep-purple btn-block" id="foc" active="<%= can? :foc, :payment %>"> FOC </button>
|
||||
<button type="button" id="void" class="btn bg-danger btn-block" active="<%= can? :overall_void, :void %>" > Void </button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -200,13 +216,45 @@ $('#void').on('click',function () {
|
||||
type: 'POST',
|
||||
url: ajax_url,
|
||||
success: function () {
|
||||
window.location.href = '/origami/';
|
||||
window.location.href = '/origami';
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}else{
|
||||
swal("Opps","You are not authorized for void","warning")
|
||||
swal("Opps","You are not authorized for void","warning");
|
||||
}
|
||||
});
|
||||
|
||||
$('#foc').click(function() {
|
||||
var cash = $('#grand_total').text();
|
||||
var sub_total = $('#sub_total').text();
|
||||
var sale_id = '';
|
||||
if($('.receipt_block > div').hasClass('selected-item')){
|
||||
sale_id = $('.receipt_block > div.selected-item').parent().attr('data-id');
|
||||
}
|
||||
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total };
|
||||
// console.log(sale_id);
|
||||
if(sale_id != ''){
|
||||
if ($(this).attr('active')=== "true") {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<%= origami_payment_foc_path %>",
|
||||
data: params,
|
||||
success:function(result){
|
||||
if (cash >= 0) {
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: 'Thank You !',
|
||||
}, function () {
|
||||
window.location.href = '/origami';
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
swal("Oops","You are not authorized for foc","warning")
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user