route changes

This commit is contained in:
San Wai Lwin
2018-03-13 14:51:07 +06:30
parent 694feb9c06
commit 9228168ebc
49 changed files with 1906 additions and 707 deletions

View File

@@ -23,10 +23,10 @@
<input type="hidden" name="type" id="type" value="">
</div>
<!-- <div class="col-lg-2 col-md-2 col-sm-2 col-xs-12"> -->
<button type="submit" class="btn btn-sm bg-blue waves-effect" style="margin-right: 10px;"><%= t("views.btn.search") %></button>
<button type="submit" class="btn btn-sm bg-blue waves-effect" style="height: 30%;margin-right: 10px;"><%= t("views.btn.search") %></button>
<!-- </div> -->
<button type="button" id="member_acc_no" class="btn bg-green btn-sm waves-effect" style="margin-right: 10px;"><%= t("views.btn.memeber_card") %></button>
<button type="button" id="qr_code" class="btn bg-green btn-sm waves-effect" style="margin-right: 10px;"><%= t("views.btn.qr_code") %></button>
<button type="button" id="member_acc_no" class="btn bg-green btn-sm waves-effect" style="height: 30%;margin-right: 10px;"><%= t("views.btn.memeber_card") %></button>
<button type="button" id="qr_code" class="btn bg-green btn-sm waves-effect" style="height: 30%;margin-right: 10px;"><%= t("views.btn.qr_code") %></button>
</div>
<% end %>
</div>
@@ -145,7 +145,8 @@ $(function() {
$("#qr_code").on('click', function(e){
var code = "";
setTimeout(function(){
var hi=getQRCode();
code=getQRCode();
setQRCode(code);
},100);
});

View File

@@ -228,16 +228,15 @@
<% else %>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<% end %>
<% if !@total_customer.nil? && @total_customer.to_i > 0 %>
<div class="card">
<div class="body">
<h6><%= t :customer %></h6>
<table class="table">
<% if !@total_customer.nil? %>
<tr>
<td><%= t("views.right_panel.detail.total") %> <%= t :customer %> : </td>
<td align="right"><%= @total_customer %></td>
</tr>
<% end %>
<% if !@total_dinein.nil? %>
<tr>
<td><%= t("views.right_panel.detail.dine_in") %> : </td>
@@ -265,6 +264,7 @@
</table>
</div>
</div>
<% end %>
</div>
<% if current_user.role == 'administrator' || current_user.role == 'manager' %>
</div>
@@ -316,9 +316,10 @@
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<% if current_user.role == 'administrator' || current_user.role == 'manager' %>
</div>
<% end %>
<% end %>
</div>
</div>

View File

@@ -16,7 +16,11 @@
<!-- <a href="javascript:void(0);" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse" aria-expanded="false"></a> -->
<%if current_login_employee.role !="waiter" %>
<a href="javascript:void(0);" class="bars"></a>
<a class="navbar-brand" href="<%=dashboard_path%>" style="margin-left: 20px;">
<% if current_login_employee.role != "cashier" %>
<a class="navbar-brand" href="<%=dashboard_path%>" style="margin-left: 20px;">
<% else %>
<a class="navbar-brand" href="<%=origami_dashboard_path%>" style="margin-left: 20px;">
<% end %>
<% else %>
<a class="navbar-brand m-0" href="<%= origami_dashboard_path%>">
<%end%>
@@ -56,13 +60,11 @@
</li>
<% end %>
<li>
<!-- <%if current_login_employee.role !="waiter" %> -->
<!-- <%end%> -->
<!-- <p class="delete waves-effect waves-block p-l-30 m-b-5" data-ref="<%=logout_path%>" data-method="delete">
<i class="material-icons font-10 logout_icon">exit_to_app</i>
<span class="font-18">Logout</span>
</p> -->
<p class="delete waves-effect waves-block p-l-30 m-b-5" data-ref="<%=logout_path%>" data-method="delete">
<p class="delete waves-effect waves-block p-l-30 m-b-5 logout" data-ref="<%= logout_path %>" data-method="delete">
<i class="material-icons font-7 logout_icon">exit_to_app</i>
<span class="font-15">Logout</span>
</p>
@@ -79,9 +81,39 @@
</div>
</div>
</nav>
<script type="text/javascript">
if((document.getElementById("otherPayment")!=undefined) && (document.getElementById("otherPayment")!=null) && (document.getElementById("otherPayment")!="")){
var otherPayment = location.href.split('/')[location.href.split('/').length -1 ];
document.getElementById("otherPayment").innerHTML = otherPayment;
}
$(function(){
$('.delete').click(function(){
var method = $(this).attr('data-method');
var url = $(this).attr('data-ref');
var html_text = $(this).siblings( "#delete_text" ).html();
//var page = url.substring(url.lastIndexOf('/') + 1);
swal({
title: "Confirmation",
text: html_text,
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
html: true
}, function (isConfirm) {
if (isConfirm) {
$.ajax({
type: method,
url: url ,
success: function(data) {
location.href = data.url;
}
});
} else {
swal("Cancelled", "Your imaginary file is safe :)", "error");
}
});
});
});
</script>

204
app/views/oqs/home/index.html.erb Executable file → Normal file
View File

@@ -1,137 +1,115 @@
<!-- Column One -->
<div class="row clearfix">
<div class="col-lg-8 col-md-8 col-sm-8">
<div class="row clearfix" style="margin-top:-50px !important">
<div class="col-lg-11 col-md-11 col-sm-11">
<div class="body p-l-10">
<%= form_tag oqs_root_path, :method => :get do %>
<div class="row clearfix">
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-12">
<input type="text" name="filter" class="form-control" placeholder="Search">
<span class="hidden" id="oqs_active"></span>
<select class="form-control select oqs_click" name="oqs_id" id="oqs_id">
<option value="0" data-id="0">Processed</option>
<% @queue_stations.each do |qsi| %>
<% if qsi.is_active != false %>
<p class="hidden oqs-id"><%= qsi.id %></p>
<option value="<%= qsi.id %>" data-id="<%= qsi.id %>" style="padding:5px 20px !important;"> <%= qsi.station_name %></option>
<% end %>
<% end %>
</select>
</div>
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-12">
<button type="submit" class="btn bg-blue waves-effect waves-effect">Search</button>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12">
<span class="hidden" id="table_id"></span>
<select class="form-control select tables" name="table_id" id="tables">
<option value="">Select Table</option>
<% @tables.each do |table| %>
<option value="<%= table.id %>" data-id="<%= table.id %>"> <%= table.name %></option>
<% end %>
</select>
</div>
<!--
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12">
<span class="hidden" id="room_id"></span>
<select class="form-control select rooms" name="table_id" id="rooms">
<option value="">Select Room</option>
<% @rooms.each do |table| %>
<option value="<%= table.id %>" data-id="<%= table.id %>"> <%= table.name %></option>
<% end %>
</select>
</div> -->
</div>
<% end %>
</div>
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<!-- <li class="nav-item nav-search <%= @filter.to_s.length > 0? " " : "hide"%>">
<a class="nav-link <%= @filter.to_s.length > 0? "active" : " "%>" data-toggle="tab" href="#search" role="tab">Searching .. <span class="badge badge-pill badge-default" id="completed_count"><%= @queue_completed_item.length %></span></a>
</li> -->
<li class="nav-item nav-completed">
<a class="nav-link active" data-toggle="tab" href="#completed" role="tab">Processed
<span class="badge bg-blue-grey" id="completed_count"><%= @queue_completed_item.length %></span></a>
</li>
<% # For Tab Disable for Station is inactive
status=""
i=0
@queue_stations.each do |qsi|
if qsi.is_active == false
status="disabled"
end %>
<li class="nav-item oqs_click" data-id="<%= qsi.id %>">
<p class="hidden oqs-id"><%= qsi.id %></p>
<a class="nav-link" data-id="<%= qsi.id %>" data-toggle="tab" href="" role="tab" <%= status %>>
<%= qsi.station_name %>
<% if @filter.nil? %>
<span class="badge bg-blue-grey oqs_count<%= i%> oqs_count" data-id="<%= qsi.id %>" id="completed_count">
<!-- <span class="badge badge-pill badge-default oqs_count<%= i%> oqs_count" data-id="<%= qsi.id %>"> --> <%= qsi.assigned_order_items.where("delivery_status=0 AND created_at >= '#{Time.now.beginning_of_day.utc}'").count %>
</span>
<%else%>
<span class="label-count badge bg-blue-grey" data-id="<%= qsi.id %>">
<% @count.each do |c|%>
<% if qsi.id == c.station_id %>
<%= c.total %>
<%end %>
<%end %>
</span>
<%end%>
<% if qsi.auto_print %>
<span>(ap)</span>
<% end %>
</a>
</li>
<% i+=1%>
<% end %>
</ul>
<!-- Nav tabs - End -->
<p class="hidden filter"><%= @filter %></p>
<div class="tab-content" id="custom-slimscroll" style="">
<!--- Panel 0 - Completed -->
<p class="hidden filter"><%= @filter %></p>
<div class="card">
<div class="card-block">
<div class="tab-content" id="custom-slimscroll" style="">
<div class="tab-pane in active" id="completed" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;column-count: ;">
<%
@queue_completed_item.each do |qid|
%>
<div class="card queue_station" data-order-no="<%= qid.order_id %>">
<div class="card-block">
<div class="row">
<%if qid.type.present?%>
<span class="col-md-4 order-zone-type font-13"><%= qid.type %>-<%= qid.zone %></span>
<%else%>
<span class="col-md-4 order-zone-type font-13"></span>
<%end%>
<span class="order-zone hidden font-13"><%= qid.zone %></span>
<span class="col-md-8"><small class="float-right font-13"><%= qid.order_id %></small></span>
</div>
<p class="m-b--10">
<span class="order-item font-16">
<%= qid.item_name %>
</span> [x
<span class="order-qty">
<%= qid.qty %>
</span> ]
<% if !qid.set_menu_items.nil? %>
<% qid.set_menu_items.each do |item_instance|%>
<br><span class="font-12">
<%= item_instance %>
</span>
<% end %>
<% end %>
</p>
<br/><p class="card-text item-options"><%= qid.options == "[]"? "" : qid.options %></p>
<div class="row">
<%if qid.type.present?%>
<span class="col-md-4 order-zone-type font-13"><%= qid.type %>-<%= qid.zone %></span>
<%else%>
<span class="col-md-4 order-zone-type font-13"></span>
<%end%>
<span class="card-text">
<span class="text-muted">Order at -
<span class="order-at font-13">
<%= qid.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %>
</span> <br>
Order By - <span class="order-by font-13">
<%= qid.item_order_by %>
</span>
<span class="order-zone hidden font-13"><%= qid.zone %></span>
<span class="col-md-8"><small class="float-right font-13"><%= qid.order_id %></small></span>
</div>
<p class="m-b--10">
<span class="order-item font-16">
<%= qid.item_name %>
</span> [x
<span class="order-qty">
<%= qid.qty %>
</span> ]
<% if !qid.set_menu_items.nil? %>
<% qid.set_menu_items.each do |item_instance|%>
<br><span class="font-12">
<%= item_instance %>
</span>
<% end %>
<% end %>
</p>
<br/><p class="card-text item-options"><%= qid.options == "[]"? "" : qid.options %></p>
<span class="card-text">
<span class="text-muted">Order at -
<span class="order-at font-13">
<%= qid.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %>
</span> <br>
Order By - <span class="order-by font-13">
<%= qid.item_order_by %>
</span>
</span>
</span>
</span>
<p class="hidden order-status">completed</p>
<p class="hidden order-customer"><%= qid.customer_name %></p>
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
</div>
</div>
<%
end
%>
</div>
<% end %>
</div>
</div>
</div>
<!-- End Panel 0 - Completed -->
<!--- Order Items -->
<div class="card-columns oqs_append" id="oqs_container" style="padding-top:10px; column-gap: 1.2rem;">
</div>
<!--- end of Items-->
</div>
</div>
</div>
</div>
<!-- Column Two -->
<div class="col-lg-3 col-md-3 col-sm-3">
<!-- <div class="col-lg-3 col-md-3 col-sm-3">
<div class="card" >
<div class="card-header">
<div><strong id="order-title">ORDER DETAILS</strong></div>
@@ -143,20 +121,18 @@
<tr>
<th style="width:33%; text-align:">Order By</th>
<th style="width:33%; text-align:">Order At</th>
<!-- <th style="width:33%; text-align:">Customer</th> -->
</tr>
</thead>
<tbody>
<tr>
<td id="order-by" style="width:33%; text-align:"></td>
<td id="order-at" style="width:33%; text-align:"></td>
<!-- <td id="order-customer" style="width:33%; text-align:"></td> -->
</tr>
<tr>
</tr> -->
<!-- <tr>
<td><strong class="hidden cus_name">Customer</strong></td>
<td id="order-customer" colspan="2"></td>
</tr>
</tbody>
</tr> -->
<!-- </tbody>
</table>
</div>
<div class="card-text" id="order-detail-slimscroll" style="min-height:; max-height:; overflow:">
@@ -168,17 +144,17 @@
</tr>
</thead>
<tbody>
<!-- Bind With JS -->
</tbody>
</table>
</div>
</div>
</div>
</div>
-->
<!-- Column Three -->
<div class="col-lg-1 col-md-1 col-sm-1">
<!-- OQS Buttons -->
<br>
<a href="<%= dashboard_path %>" class="btn btn-sm btn-block btn-default waves-effect" role="button" aria-haspopup="true"><i class="material-icons">reply</i> Back </a>
<% if ENV["SERVER_MODE"] != "cloud" %>
<button type="button" title="Print Order Item" id="print_order_item" class="btn bg-blue btn-block btn-lg waves-effect">Print</a>

View File

@@ -0,0 +1,196 @@
<!-- Column One -->
<div class="row clearfix">
<div class="col-lg-8 col-md-8 col-sm-8">
<div class="body p-l-10">
<%= form_tag oqs_root_path, :method => :get do %>
<div class="row clearfix">
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-12">
<input type="text" name="filter" class="form-control" placeholder="Search">
</div>
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-12">
<button type="submit" class="btn bg-blue waves-effect waves-effect">Search</button>
</div>
</div>
<% end %>
</div>
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<!-- <li class="nav-item nav-search <%= @filter.to_s.length > 0? " " : "hide"%>">
<a class="nav-link <%= @filter.to_s.length > 0? "active" : " "%>" data-toggle="tab" href="#search" role="tab">Searching .. <span class="badge badge-pill badge-default" id="completed_count"><%= @queue_completed_item.length %></span></a>
</li> -->
<li class="nav-item nav-completed">
<a class="nav-link active" data-toggle="tab" href="#completed" role="tab">Processed
<span class="badge bg-blue-grey" id="completed_count"><%= @queue_completed_item.length %></span></a>
</li>
<% # For Tab Disable for Station is inactive
status=""
i=0
@queue_stations.each do |qsi|
if qsi.is_active == false
status="disabled"
end %>
<li class="nav-item oqs_click" data-id="<%= qsi.id %>">
<p class="hidden oqs-id"><%= qsi.id %></p>
<a class="nav-link" data-id="<%= qsi.id %>" data-toggle="tab" href="" role="tab" <%= status %>>
<%= qsi.station_name %>
<% if @filter.nil? %>
<span class="badge bg-blue-grey oqs_count<%= i%> oqs_count" data-id="<%= qsi.id %>" id="completed_count">
<!-- <span class="badge badge-pill badge-default oqs_count<%= i%> oqs_count" data-id="<%= qsi.id %>"> --> <%= qsi.assigned_order_items.where("delivery_status=0 AND created_at >= '#{Time.now.beginning_of_day.utc}'").count %>
</span>
<%else%>
<span class="label-count badge bg-blue-grey" data-id="<%= qsi.id %>">
<% @count.each do |c|%>
<% if qsi.id == c.station_id %>
<%= c.total %>
<%end %>
<%end %>
</span>
<%end%>
<% if qsi.auto_print %>
<span>(ap)</span>
<% end %>
</a>
</li>
<% i+=1%>
<% end %>
</ul>
<!-- Nav tabs - End -->
<p class="hidden filter"><%= @filter %></p>
<div class="tab-content" id="custom-slimscroll" style="">
<!--- Panel 0 - Completed -->
<div class="tab-pane in active" id="completed" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<%
@queue_completed_item.each do |qid|
%>
<div class="card queue_station" data-order-no="<%= qid.order_id %>">
<div class="card-block">
<div class="row">
<%if qid.type.present?%>
<span class="col-md-4 order-zone-type font-13"><%= qid.type %>-<%= qid.zone %></span>
<%else%>
<span class="col-md-4 order-zone-type font-13"></span>
<%end%>
<span class="order-zone hidden font-13"><%= qid.zone %></span>
<span class="col-md-8"><small class="float-right font-13"><%= qid.order_id %></small></span>
</div>
<p class="m-b--10">
<span class="order-item font-16">
<%= qid.item_name %>
</span> [x
<span class="order-qty">
<%= qid.qty %>
</span> ]
<% if !qid.set_menu_items.nil? %>
<% qid.set_menu_items.each do |item_instance|%>
<br><span class="font-12">
<%= item_instance %>
</span>
<% end %>
<% end %>
</p>
<br/><p class="card-text item-options"><%= qid.options == "[]"? "" : qid.options %></p>
<span class="card-text">
<span class="text-muted">Order at -
<span class="order-at font-13">
<%= qid.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %>
</span> <br>
Order By - <span class="order-by font-13">
<%= qid.item_order_by %>
</span>
</span>
</span>
<p class="hidden order-status">completed</p>
<p class="hidden order-customer"><%= qid.customer_name %></p>
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
</div>
</div>
<%
end
%>
</div>
</div>
<!-- End Panel 0 - Completed -->
<!--- Order Items -->
<div class="card-columns oqs_append" id="oqs_container" style="padding-top:10px; column-gap: 1.2rem;">
</div>
<!--- end of Items-->
</div>
</div>
<!-- Column Two -->
<div class="col-lg-3 col-md-3 col-sm-3">
<div class="card" >
<div class="card-header">
<div><strong id="order-title">ORDER DETAILS</strong></div>
</div>
<div class="card-block">
<div class="card-title">
<table class="">
<thead>
<tr>
<th style="width:33%; text-align:">Order By</th>
<th style="width:33%; text-align:">Order At</th>
<!-- <th style="width:33%; text-align:">Customer</th> -->
</tr>
</thead>
<tbody>
<tr>
<td id="order-by" style="width:33%; text-align:"></td>
<td id="order-at" style="width:33%; text-align:"></td>
<!-- <td id="order-customer" style="width:33%; text-align:"></td> -->
</tr>
<tr>
<td><strong class="hidden cus_name">Customer</strong></td>
<td id="order-customer" colspan="2"></td>
</tr>
</tbody>
</table>
</div>
<div class="card-text" id="order-detail-slimscroll" style="min-height:; max-height:; overflow:">
<table class="table" id="oqs-order-details-table">
<thead>
<tr>
<th style="width:80%; text-align:left">Items</th>
<th style="width:20%; text-align:right">QTY</th>
</tr>
</thead>
<tbody>
<!-- Bind With JS -->
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Column Three -->
<div class="col-lg-1 col-md-1 col-sm-1">
<!-- OQS Buttons -->
<a href="<%= dashboard_path %>" class="btn btn-sm btn-block btn-default waves-effect" role="button" aria-haspopup="true"><i class="material-icons">reply</i> Back </a>
<% if ENV["SERVER_MODE"] != "cloud" %>
<button type="button" title="Print Order Item" id="print_order_item" class="btn bg-blue btn-block btn-lg waves-effect">Print</a>
<button type="button" class="btn bg-blue btn-block btn-lg waves-effect" id="print_order_summary">Print <br/>Order<br/>Summary</button>
<%end%>
</div>
</div>
<script type="text/javascript">
$(document).on('turbolinks:load', function() {
$('#back').on('click', function () {
window.location.href = '/dashboard';
});
});
</script>

View File

@@ -34,12 +34,14 @@
<input type="text" name="filter" style="margin-right:10px" id="search" placeholder="Search" class="form-control input-sm col-md-12">
</div>
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-12">
<button type="submit" class="btn bg-blue waves-effect waves-effect">Search</button>
</div>
<!-- <div class="col-lg-2 col-md-2 col-sm-2 col-xs-12"> -->
<button type="submit" class="btn bg-blue waves-effect waves-effect" style="height: 30%;margin-right: 10px;">Search</button>
<!-- </div> -->
<button type="button" id="member_acc_no" class="btn bg-green btn-sm waves-effect" style="height: 30%;margin-right: 10px;">Member Card</button>
<button type="button" id="qr_code" class="btn bg-green btn-sm waves-effect" style="height: 30%;margin-right: 10px;"><%= t("views.btn.qr_code") %></button>
</div>
<% end %>
</div>
@@ -114,6 +116,8 @@
<span class="patch_method"></span>
<input type="hidden" id="sale_id" name="sale_id" value="<%= @sale_id %>" />
<input type="hidden" id="type" name="type" value="<%= @cashier_type %>" />
<input type="hidden" id="page" name="page" value="<%= @page %>" />
<%if !@dining_facility.nil?%>
<input type="hidden" id="table_id" name="table_id" value="<%= @dining_facility.id %>" />
<input type="hidden" id="type" name="type" value="<%= @dining_facility.type %>" />
@@ -262,7 +266,8 @@
</div>
</div>
<script type="text/javascript">
var cashier_type = "<%= @cashier_type %>";
var cashier_type = "<%= @cashier_type %>";
var page = "<%= @page %>";
$(function() {
/*$('.datepicker').datepicker({
setDate: '12-12-1999',
@@ -295,22 +300,23 @@
getCardNo();
$("#sxModal").hide();
customer_mamber_card_no = $("#search").val();
if(sale_id != 0 && customer_mamber_card_no != 0){
$.ajax({
type: "POST",
url: "get_customer" ,
url: "/origami/"+sale_id+"/get_customer" ,
data: { filter : customer_mamber_card_no ,type :"card"},
dataType: "json",
success: function(data) {
if (data[0].customer_id == false) {
$.alert({
title: 'Alert!',
content: data[0].message,
type: 'red',
typeAnimated: true,
btnClass: 'btn-danger',
});
swal("Alert!", data[0].message, "error");
// $.alert({
// title: 'Alert!',
// content: data[0].message,
// type: 'red',
// typeAnimated: true,
// btnClass: 'btn-danger',
// });
}else{
customer_id = data[0].customer_id;
customer_name = data[0].name;
@@ -339,13 +345,33 @@
}
}
// QR Code Reader
$("#qr_code").on('click', function(e){
var code = "";
setTimeout(function(){
code=getQRCode();
setQRCode(code);
},100);
});
// Read qrcode from java
function getQRCode(){
return code2lab.readQRCode();
}
// get QRCode from Java
function setQRCode(code){
$("#qr_code").text(code);
$("#search").val(code);
}
$(document).on('click',".customer_tr",function(){
// if(this.checked){
$(this).closest('tr').find('.checkbox_check').prop( "checked", true );
var sale_id = $("#sale_id").val() || 0;
var customer_id = $(this).attr('data-ref');
var customer_name = $(this).children("td:nth-child(3)").text();
console.log(sale_id);
if(sale_id != 0){
// var url = "/"+customer_id;
update_sale(customer_id, customer_name,sale_id);
@@ -433,7 +459,7 @@
}, function () {
$.ajax({
type: "POST",
url: "update_sale" ,
url: "/origami/"+sale_id+"/"+cashier_type+"/customers/update_sale" ,
data: {customer_id:customer_id,sale_id:sale_id},
dataType: "json",
success: function(data) {
@@ -441,13 +467,25 @@
{
var id = $("#table_id").val();
var type = $("#type").val();
var booking_id = "";
<% if !@booking_order.nil? %>
booking_id = "<%= @booking_order.booking_id %>";
<% end %>
if (cashier_type == "quick_service") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if (type=="Table") {
window.location.href = '/origami/table/'+id
if(booking_id!= "" && page == "pending"){
window.location.href = '/origami/'+cashier_type+'/pending_order/'+booking_id;
}else{
window.location.href = '/origami/room/'+id
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/customers/payment/';
}
}else{
if(page == "payment"){
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/customers/payment/';
}else{
if (type=="Table") {
window.location.href = '/origami/table/'+id
}else{
window.location.href = '/origami/room/'+id
}
}
}
}else{
@@ -460,17 +498,25 @@
}
$('#back').on('click',function(){
var id = $("#table_id").val()
var type = $("#type").val()
var sale_id = $("#sale_id").val()
var id = $("#table_id").val();
var type = $("#type").val();
var sale_id = $("#sale_id").val();
if (cashier_type == "quick_service") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if (type=="Table") {
window.location.href = '/origami/table/'+id
if(page == "pending"){
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/pending/';
}
else if(page == "payment"){
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if (type=="Table") {
window.location.href = '/origami/table/'+id;
}else{
window.location.href = '/origami/room/'+id
}
window.location.href = '/origami/room/'+id;
}
}
}
})

View File

@@ -50,11 +50,11 @@
<% end %>
<div class="card-block">
<%= table.name %>
<% if !@order_items_count.nil? %>
<!-- <% if !@order_items_count.nil? %>
<% if @order_items_count.key?(table.id) %>
(Orders : <%= @order_items_count[table.id] %>)
<% end %>
<% end %>
<% end %> -->
<span class="float-right font-12 new_text_<%= table.id %>"> billed</span>
<div style="font-size:12px;"></div>
</div>
@@ -67,11 +67,11 @@
<% end %>
<div class="card-block">
<%= table.name %>
<% if !@order_items_count.nil? %>
<!-- <% if !@order_items_count.nil? %>
<% if @order_items_count.key?(table.id) %>
(Orders : <%= @order_items_count[table.id] %>)
<% end %>
<% end %>
<% end %> -->
<span class="float-right font-12 new_text_<%= table.id %>"> new</span>
</div>
</div>
@@ -97,11 +97,11 @@
<div class="card rooms red text-white table_<%= room.id %>" data-id="<%= room.id %>">
<div class="card-block">
<%= room.name %>
<% if !@order_items_count.nil? %>
<!-- <% if !@order_items_count.nil? %>
<% if @order_items_count.key?(room.id) %>
(Orders : <%= @order_items_count[room.id] %>)
<% end %>
<% end %>
<% end %> -->
<span class="float-right font-12 new_text_<%= room.id %>"> billed</span>
</div>
</div>
@@ -109,11 +109,11 @@
<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.nil? %>
<% if @order_items_count.key?(room.id) %>
(Orders : <%= @order_items_count[room.id] %>)
<% end %>
<% end %>
<% end %> -->
<span class="float-right font-12 new_text_<%= room.id %>"> new</span>
</div>
</div>
@@ -196,7 +196,7 @@
<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">
&nbsp; Receipt No: <span id="receipt_no">
<% if @status_sale == 'sale' %>
<%= @sale_array[0].receipt_no rescue '' %>
@@ -204,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>
@@ -425,10 +425,7 @@
<%= 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 == "administrator" || current_login_employee.role == "manager" || current_login_employee.role == "supervisor" || current_login_employee.role == "cashier" || 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>
<% end %>
<% if current_login_employee.role != "waiter" %>
<% if @dining.status != "available" %>
<% if @status_order == 'order' && @status_sale != 'sale' %>
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect" >Customer</button>
@@ -455,10 +452,10 @@
<% 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 %>
<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>
@@ -515,7 +512,6 @@
</div>
</div>
</div>
<% end %>
</div>
</div>
</div>
@@ -544,7 +540,7 @@
</div>
</div>
<script>
cashier_type = "cashier"
var cashier_type = "cashier";
$(document).ready(function () {
/* start check first bill or not*/
var receipt_no = "";
@@ -627,7 +623,7 @@
}
var table_id = $('.tables').attr("data-id");
window.location.href = '/origami/' + sale_id+"/"+cashier_type + "/customers"
window.location.href = '/origami/' + sale_id+"/"+cashier_type + "/customers/normal";
});

View File

@@ -199,25 +199,25 @@
$("#reference_no_Err").html("");
if(reference_no.length > 0){
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
$(this).off("click");
//start member discount 5% by pay card
// var sub_total = $('#sub-total').text();
// var member_id = $('#membership_id').text();
// var member_discount = $('#member_discount').text();
// if (member_id && member_discount) {
// $.ajax({
// type: "POST",
// url: "/origami/" + sale_id + "/member_discount",
// data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
// // success:function(result){
// // }
// });
// }
//end member discount
if(bank_integration == '1'){
$("#reference_no").val("");
pay_withBank("SALE", "master", amount, sale_id, receipt_no);
}else{
$(this).off("click");
//start member discount 5% by pay card
// var sub_total = $('#sub-total').text();
// var member_id = $('#membership_id').text();
// var member_discount = $('#member_discount').text();
// if (member_id && member_discount) {
// $.ajax({
// type: "POST",
// url: "/origami/" + sale_id + "/member_discount",
// data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
// // success:function(result){
// // }
// });
// }
//end member discount
if(bank_integration == '1'){
pay_withBank("SALE", "master", amount, sale_id, receipt_no,cashier_type);
}else{
$.ajax({type: "POST",
url: "<%= origami_payment_master_path %>",
data: "amount="+ amount + "&sale_id="+ sale_id,

View File

@@ -44,11 +44,15 @@
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;" >
<% @rooms.each do |room| %>
<% if room.status == 'occupied' %>
<div class="card rooms red text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<div class="card-block">
<%= room.name %>
</div>
</div>
<% if room.get_booking.nil? %>
<div class="card rooms red text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<% else %>
<div class="card rooms blue text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<% end %>
<div class="card-block">
<%= room.name %>
</div>
</div>
<% else %>
<div class="card rooms green text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<div class="card-block">

View File

@@ -59,18 +59,22 @@
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;" >
<% @rooms.each do |room| %>
<% if room.status == 'occupied' %>
<div class="card rooms red text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<div class="card-block">
<% if room.get_booking.nil? %>
<div class="card rooms red text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<% else %>
<div class="card rooms blue text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<% end %>
<div class="card-block">
<%= room.name %>
</div>
</div>
<% else %>
<div class="card rooms green text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<div class="card-block">
<%= room.name %>
</div>
</div>
<% else %>
<div class="card rooms green text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<div class="card-block">
<%= room.name %>
</div>
</div>
<% end %>
<% end %>
<% end %>
</div>
</div>

View File

@@ -122,10 +122,11 @@
</div>
</div>
<script>
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function() {
var sale_id = "<%= @sale_id %>";
var bank_integration = "<%= @bank_integration %>";
var cashier_type = "<%= @cashier_type %>";
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
else {
$('#validamount').attr("value",parseFloat("<%= @can_mpu %>") - parseFloat(localStorage.getItem("cash")));
@@ -219,36 +220,36 @@
// });
// }
//end member discount
if(bank_integration == '1'){
$("#reference_no").val("");
pay_withBank("SALE", "mpu", amount, sale_id, receipt_no);
}else{
$.ajax({type: "POST",
url: "<%= origami_payment_mpu_path %>",
data: "amount="+ amount + "&sale_id="+ sale_id,
success:function(result){
if(result){
swal({
title: "Information!",
text: "Payment Successfully",
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+ "/payment";
});
}
}
});
}
}else{
if(bank_integration == '1'){
pay_withBank("SALE", "mpu", amount, sale_id, receipt_no,cashier_type);
}else{
$.ajax({type: "POST",
url: "<%= origami_payment_mpu_path %>",
data: "amount="+ amount + "&sale_id="+ sale_id,
success:function(result){
if(result){
swal({
title: "Information!",
text: "Payment Successfully",
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+ "/payment";
});
}
}
});
}
}else{
if (amount>0) {
swal ( "Oops" , "Paid Amount is over!" , "error" );
swal ( "Oops" , "Paid Amount is over!" , "error" );
}else{
swal ( "Oops" , "Enter Amount!" , "error" );
}
}
}
}else{
$("#reference_no_Err").html("can't be blank");
}

View File

@@ -33,7 +33,7 @@
</div>
<div class="row p-l-5 p-r-5">
<div class="col-lg-6 col-md-6 col-sm-6"><strong>Customer :</strong> <%= @sale_data.customer.name%> <span class="hidden" id="membership_id"><%= @sale_data.customer.membership_id%></span>
<div class="col-lg-6 col-md-6 col-sm-6"><strong>Customer :</strong> <span id="customer_name"> <%= @sale_data.customer.name%></span> <span class="hidden" id="membership_id"><%= @sale_data.customer.membership_id%></span>
<span class="hidden" id="member_discount"><%= @member_discount%></span></div>
<div class="col-lg-6 col-md-6 col-sm-6 text-left"><strong>Checkin Time : </strong> <%if !@checkin_time.nil?%><%= @checkin_time.utc.getlocal.strftime("%I:%M %p") %>
<%end%></div>
@@ -384,10 +384,90 @@
</div>
</div>
</div>
</div>
<script>
</div>
<!-- pdf light box -->
<div class="modal fade" id="pdfModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="pdfModalLabel"></h4>
</div>
<div class="modal-body">
<input type="hidden" name="sale_receipt_no" id="sale_receipt_no">
<input type="hidden" name="filename" id="filename">
<input type="hidden" name="printer_name" id="printer_name">
<p id="changed_amount"></p>
<div class="text-center">
<iframe id="receipt_pdf" src="" style="width: 400px; height: 600px;"></iframe>
</div>
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<% if ENV["SERVER_MODE"] != 'cloud' %>
<div class="col-md-5">
<button type="button" class="btn btn-link bg-red waves-effect print_receipt">Print</button>
</div>
<% end %>
<div class="col-md-5">
<button type="button" class="btn btn-link bg-blue waves-effect btn_pdf_close" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- customer light box -->
<div class="modal fade" id="is_memberModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title" id="is_memberModalLabel">Are you Member?</h3>
</div>
<div class="modal-body">
<div class="row text-center">
<input type="hidden" name="paypar_account_no" id="paypar_account_no" />
<input type="hidden" name="qr_code" id="qr_code" />
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<button type="button" class="btn btn-lg btn-link bg-green waves-effect btn_customer_yes">Yes</button>
</div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<button type="button" class="btn btn-lg btn-link bg-red waves-effect" data-dismiss="modal">No</button>
</div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<button type="button" class="btn btn-lg btn-link bg-primary waves-effect btn_member">Member</button>
</div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<button type="button" class="btn btn-lg btn-link bg-primary waves-effect btn_qr_code">QR</button>
</div>
</div>
</div>
<div class="modal-footer"></div>
</div>
</div>
</div>
<div id="sxModal">
<div id="sxModal-Content"><h3>Card Tap</h3></div>
</div>
<script type="text/javascript">
var cashier_type = "<%= @cashier_type %>";
var customer_id = "<%= @customer.id %>";
var customer_name = "<%= @customer.name %>";
$(document).ready(function(){
//start customer modal popup
if((customer_id!=undefined) && (customer_id!=null) && (customer_id!="")){
if((customer_id == 'CUS-000000000001') && (customer_name == 'WALK-IN')){
$("#is_memberModal").modal({show : true, backdrop: false, keyboard : false});
}
}
/* start check first bill or not*/
var member_id = $('#membership_id').text();
var member_discount = $('#member_discount').text();
@@ -402,7 +482,6 @@ var cashier_type = "<%= @cashier_type %>";
console.log("ssssssssssss")
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment")
if (member_id && member_discount) {
console.log("fffffffffffff")
if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){
$("#credit_payment").hide();
} else{
@@ -436,6 +515,188 @@ console.log("fffffffffffff")
$('#cash').text(localStorage.getItem("cash"));
}
update_balance();
// Disable click event cash to prevent
$(".payment .cash-color").off('click');
$('#credit_payment').click(function() {
var sale_id = $('#sale_id').text();
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+"/payment/credit_payment"
return false;
});
$('#card_payment').click(function() {
localStorage.setItem("cash",$('#cash').text() );
var sale_id = $('#sale_id').text();
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment/others_payment"
return false;
});
$('#pay').click(function() {
sub_total = $('#sub-total').text();
if (payment_type == 'MPU' && $('.mpu').text() == 0 && sub_total != 0.0) {
swal("Oops","Please Pay with MPU Payment","warning");
}else if(payment_type == "Redeem" && $('#ppamount').text()==0 && sub_total != 0.0){
swal("Oops","Please Pay with Redeem Payment","warning");
}else if(payment_type == "VISA" && $('#visacount').text()==0 && sub_total != 0.0){
swal("Oops","Please Pay with Visa Payment","warning");
}else if(payment_type == "JCB" && $('#jcbcount').text()==0 && sub_total != 0.0){
swal("Oops","Please Pay with jcb Payment","warning");
}
else if(payment_type == "Master" && $('#mastercount').text()==0 && sub_total != 0.0){
swal("Oops","Please Pay with Master Payment","warning");
}
else if(payment_type == "UNIONPAY" && $('#unionpaycount').text()==0 && sub_total != 0.0){
swal("Oops","Please Pay with UNIONPAY Payment","warning");
}
else if(payment_type == "Credit" && $('#credit').text()==0 && sub_total != 0.0){
swal("Oops","Please Pay with Credit Payment","warning");
}else{
$( "#loading_wrapper").show();
if($('#balance').text() > 0){
swal ( "Oops", "Insufficient Amount!" , "error" );
$("#loading_wrapper").hide();
}else{
$(this).off("click");
var sale_id = $('#sale_id').text();
// var item_row = $('.is_card');
// payment
var cash = $('#cash').text();
var credit = $('#credit').text();
var card = $('#card').text();
if (credit <= 0) {
calculate_member_discount(sale_id);
}
$.ajax({type: "POST",
url: "<%= origami_payment_cash_path %>",
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type,
success:function(result){
/* start delete receipt no in first bill*/
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
var receipt_no = ($("#receipt_no").html()).trim();
deleteReceiptNoInFirstBillData(receipt_no);
}
/* end delete receipt no in first bill*/
localStorage.removeItem("cash");
if (result.status) {
var msg = result.message;
}
else{
var msg = '';
}
$("#loading_wrapper" ).hide();
//PDF lightbox data
$("#sale_receipt_no").val(result.receipt_no);
$("#filename").val(result.filename);
$("#printer_name").val(result.printer_name);
$("#receipt_pdf").attr("src", result.filename);
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
$("#pdfModalLabel").text("Payment Successful!");
$("#changed_amount").text("");
if($('#balance').text() < 0){
<% if precision.to_i > 0 %>
$("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)).toFixed(<%= precision %>));
<% else %>
$("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)));
<% end %>
}
//PDF lightbox data
// if($('#balance').text() < 0){
// swal({
// title: "Payment Successful!",
// text: 'Changed amount ' + $('#balance').text() * (-1),
// html: true,
// closeOnConfirm: false,
// closeOnCancel: false,
// allowOutsideClick: false
// }, function () {
// if (cashier_type=="cashier") {
// window.location.href = '/origami';
// }else{
// window.location.href = '/origami/quick_service';
// }
// });
// }else{
// $('#pay').text("Pay");
// swal({
// title: "Payment Successful!",
// text: 'Thank You !',
// html: true,
// closeOnConfirm: false,
// closeOnCancel: false,
// allowOutsideClick: false
// }, function () {
// if (cashier_type=="cashier") {
// window.location.href = '/origami';
// }else{
// window.location.href = '/origami/quick_service';
// }
// });
// }
}
});
}
}
});
// $('#void').on('click',function () {
// if ($(this).attr('active') === "true") {
// var sale_id = $('#sale_id').text();
// var remark = $("#remark").val();
// var ajax_url = "/origami/sale/" + sale_id + '/void';
// $.ajax({
// type: 'POST',
// url: ajax_url,
// data: "remark="+ remark + "&sale_id=" + sale_id,
// success: function () {
// window.location.href = '/origami/';
// }
// })
// }else{
// swal("Opps","You are not authorized for void","warning")
// }
// });
$('#void').on('click', function () {
if ($(this).attr('active')=== "true") {
swal({
title: "Alert",
text: "Are you sure want to Void?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, void it!",
closeOnConfirm: false
}, function (isConfirm) {
if (isConfirm) {
var sale_id = $('#sale_id').text();
var remark = $("#remark").val();
var ajax_url = "/origami/sale/" + sale_id + '/void';
$.ajax({
type: 'POST',
url: ajax_url,
data: "remark="+ remark + "&sale_id=" + sale_id,
success: function () {
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
}
}
})
}
});
}else{
swal("Oops","You are not authorized for void","warning")
}
});
});
// bind survey to order or sale
@@ -447,7 +708,7 @@ console.log("fffffffffffff")
var sale_id = $('#dining').text();
}
//var table_id = $('.tables').attr("data-id");
window.location.href = '/origami/' + sale_id +"/"+ cashier_type + "/surveys"
window.location.href = '/origami/' + sale_id +"/"+ cashier_type + "/surveys";
});
// bind customer to order or sale
@@ -459,7 +720,7 @@ console.log("fffffffffffff")
var sale_id = $('#save_order_id').attr('data-order');
}
var table_id = $('.tables').attr("data-id");
window.location.href = '/origami/' + sale_id + "/"+cashier_type+"/customers"
window.location.href = '/origami/' + sale_id + "/"+cashier_type+"/customers/payment";
});
// Add Other Charges
@@ -529,6 +790,9 @@ console.log("fffffffffffff")
$('#cash').text(input_value);
update_balance();
}else{
if($('#cash').text() == '0'){
$('#cash').text("");
}
$('#cash').append(input_value);
update_balance();
}
@@ -577,174 +841,6 @@ console.log("fffffffffffff")
}
});
$( document ).ready(function() {
// Disable click event cash to prevent
$(".payment .cash-color").off('click');
$('#credit_payment').click(function() {
var sale_id = $('#sale_id').text();
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+"/payment/credit_payment"
return false;
});
$('#card_payment').click(function() {
localStorage.setItem("cash",$('#cash').text() );
var sale_id = $('#sale_id').text();
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment/others_payment"
return false;
});
$('#pay').click(function() {
sub_total = $('#sub-total').text();
if (payment_type == 'MPU' && $('.mpu').text() == 0 && sub_total != 0.0) {
swal("Oops","Please Pay with MPU Payment","warning");
}else if(payment_type == "Redeem" && $('#ppamount').text()==0 && sub_total != 0.0){
swal("Oops","Please Pay with Redeem Payment","warning");
}else if(payment_type == "VISA" && $('#visacount').text()==0 && sub_total != 0.0){
swal("Oops","Please Pay with Visa Payment","warning");
}else if(payment_type == "JCB" && $('#jcbcount').text()==0 && sub_total != 0.0){
swal("Oops","Please Pay with jcb Payment","warning");
}
else if(payment_type == "Master" && $('#mastercount').text()==0 && sub_total != 0.0){
swal("Oops","Please Pay with Master Payment","warning");
}
else if(payment_type == "UNIONPAY" && $('#unionpaycount').text()==0 && sub_total != 0.0){
swal("Oops","Please Pay with UNIONPAY Payment","warning");
}
else if(payment_type == "Credit" && $('#credit').text()==0 && sub_total != 0.0){
swal("Oops","Please Pay with Credit Payment","warning");
}else{
$( "#loading_wrapper").show();
if($('#balance').text() > 0){
swal ( "Oops", "Insufficient Amount!" , "error" );
$("#loading_wrapper").hide();
}else{
$(this).off("click");
var sale_id = $('#sale_id').text();
// var item_row = $('.is_card');
// payment
var cash = $('#cash').text();
var credit = $('#credit').text();
var card = $('#card').text();
if (credit <= 0) {
calculate_member_discount(sale_id);
}
$.ajax({type: "POST",
url: "<%= origami_payment_cash_path %>",
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type,
async: false,
success:function(result){
/* start delete receipt no in first bill*/
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
var receipt_no = ($("#receipt_no").html()).trim();
deleteReceiptNoInFirstBillData(receipt_no);
}
/* end delete receipt no in first bill*/
localStorage.removeItem("cash");
if (result.status) {
var msg = result.message;
}
else{
var msg = '';
}
$( "#loading_wrapper" ).hide();
if($('#balance').text() < 0){
swal({
title: "Payment Successful!",
text: 'Changed amount ' + $('#balance').text() * (-1),
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
}
});
}else{
$('#pay').text("Pay");
swal({
title: "Payment Successful!",
text: 'Thank You !',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
}
});
}
}
});
}
}
});
// $('#void').on('click',function () {
// if ($(this).attr('active') === "true") {
// var sale_id = $('#sale_id').text();
// var remark = $("#remark").val();
// var ajax_url = "/origami/sale/" + sale_id + '/void';
// $.ajax({
// type: 'POST',
// url: ajax_url,
// data: "remark="+ remark + "&sale_id=" + sale_id,
// success: function () {
// window.location.href = '/origami/';
// }
// })
// }else{
// swal("Opps","You are not authorized for void","warning")
// }
// });
$('#void').on('click', function () {
if ($(this).attr('active')=== "true") {
swal({
title: "Alert",
text: "Are you sure want to Void?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, void it!",
closeOnConfirm: false
}, function (isConfirm) {
if (isConfirm) {
var sale_id = $('#sale_id').text();
var remark = $("#remark").val();
var ajax_url = "/origami/sale/" + sale_id + '/void';
$.ajax({
type: 'POST',
url: ajax_url,
data: "remark="+ remark + "&sale_id=" + sale_id,
success: function () {
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
}
}
})
}
});
}else{
swal("Oops","You are not authorized for void","warning")
}
});
});
function update_balance(){
var cash = $('#cash').text();
var credit = $('#credit').text();
@@ -809,7 +905,7 @@ console.log("fffffffffffff")
}else{
swal("Oops","You are not authorized for foc","warning")
}
});
});
function calculate_member_discount(sale_id) {
var sub_total = $('#sub-total').text();
@@ -823,14 +919,167 @@ console.log("fffffffffffff")
}else{
is_card = true
}
$.ajax({
type: "POST",
url: "/origami/" + sale_id + "/member_discount",
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card },
async: false,
success:function(result){
$.ajax({
type: "POST",
url: "/origami/" + sale_id + "/member_discount",
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card },
async: false,
success:function(result){
}
});
}
}
//print pdf function
$(".print_receipt").on('click',function(){
var sale_id = $('#sale_id').text();
var filename = $("#filename").val();
var printer_name = $("#printer_name").val();
var receipt_no = $("#sale_receipt_no").val();
var params = { 'filename':filename, 'receipt_no':receipt_no, 'printer_name':printer_name };
// swal({
// title: "Alert",
// text: "Are you sure want to print?",
// type: "warning",
// showCancelButton: true,
// confirmButtonColor: "#DD6B55",
// confirmButtonText: "Print",
// closeOnConfirm: false
// }, function (isConfirm) {
// if (isConfirm) {
$.ajax({
type: "POST",
url: "/origami/sale/"+sale_id+"/"+cashier_type+"/payment/print",
data: params,
success:function(result){
console.log(result);
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
}
}
});
// }
// });
});
$(".btn_pdf_close").on('click',function(){
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
}
});
$(".btn_customer_yes").on('click',function(){
var sale_id = $('#sale_id').text();
window.location.href = "/origami/"+sale_id+"/"+cashier_type+"/customers/payment";
});
// Read Card Reader
$(".btn_member").on('click', function(){
var cardNo = "";
var customer_id = '';
var customer_name = '';
var membership_id = '';
var membership_type = '';
var sale_id = $("#sale_id").text() || 0;
var customer_mamber_card_no = 0;
$("#is_memberModal").hide();
$("#sxModal").show();
setTimeout(function(){
getCardNo();
$("#sxModal").hide();
customer_mamber_card_no = $("#paypar_account_no").val();
if(sale_id != 0 && customer_mamber_card_no != 0){
$.ajax({
type: "POST",
url: "/origami/"+sale_id+"/get_customer" ,
data: { filter : customer_mamber_card_no ,type :"card"},
dataType: "json",
success: function(data) {
if (data[0].customer_id == false) {
swal("Alert!", data[0].message, "error");
}else{
customer_id = data[0].customer_id;
customer_name = data[0].name;
membership_id = data[0].membership_id;
membership_type = data[0].membership_type;
update_sale(membership_id, customer_id, customer_name,sale_id);
}
}
});
}
},100);
});
// Read NFC card no from java
function getCardNo(){
code2lab.readNFC();
}
// get CardNo from Java
function setCardNo(cardNo){
if(cardNo.length == 16){
$("#paypar_account_no").val(cardNo);
}
}
// QR Code Reader
$(".btn_qr_code").on('click', function(e){
$("#is_memberModal").hide();
var code = "";
setTimeout(function(){
code=getQRCode();
$("#qr_code").val(code);
},100);
});
// Read qrcode from java
function getQRCode(){
return code2lab.readQRCode();
}
function update_sale(membership_id, customer_id, customer_name, sale_id) {
var customer="";
if(customer_name != ""){
customer = '(' + customer_name + ')';
}
swal({
title: "Confirmation !",
text: 'Are You Sure to assign this customer' + customer + '!',
showCancelButton: true,
confirmButtonColor: "green",
confirmButtonText: "Yes!",
cancelButtonClass: 'btn btn-danger',
closeOnConfirm: false,
}, function () {
$.ajax({
type: "POST",
url: "/origami/"+sale_id+"/"+cashier_type+"/customers/update_sale" ,
data: {customer_id:customer_id,sale_id:sale_id},
dataType: "json",
success: function(data) {
if(data.status == true)
{
//change customer detail
$("#customer_name").html(customer_name);
$("#membership_id").html(membership_id);
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
swal("Alert!", "Record not found!", "error");
location.reload();
}
}
});
});
}
}
</script>

View File

@@ -153,6 +153,14 @@
<% if current_user.role != "waiter" || @status != "sale"%>
<button type="button" id="addorder" class="btn bg-blue btn-block">Add Order</button>
<%end%>
<!-- <% if @status != "order"%>
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
<% end %>
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect" >Customer</button>
<% if @status != "order"%>
<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 current_user.role != "waiter" && @status != "order"%>
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
<%end%>
@@ -163,6 +171,7 @@
</div>
</div>
<script>
var cashier_type = "quick_service";
$(document).ready(function(){
$(".sales").on('click',function(){
var sale_id = $(this).attr("data-id");
@@ -203,5 +212,61 @@ $(document).ready(function(){
}
});
});
// bind survey to order or sale
$("#survey").on('click', function () {
var sale_id = $('#sale_id').val();
window.location.href = '/origami/' + sale_id +"/"+ cashier_type + "/surveys";
});
// bind customer to order or sale
$("#customer").on('click', function () {
var sale = $('#sale_id').val();
if (sale.includes("SAL")) {
var sale_id = sale;
} else {
var sale_id = $('#save_order_id').val();
}
window.location.href = '/origami/' + sale_id + "/"+cashier_type+"/customers/pending";
});
// Add Other Charges
$('#other-charges').click(function () {
var sale = $('#sale_id').val();
if (sale != "") {
var sale_id = sale
} else {
var sale_id = $('#save_order_id').val();
}
if (sale_id != "") {
window.location.href = '/origami/' + sale_id +"/"+cashier_type+ '/other_charges';
}
else {
swal ( "Oops" , "Please select an table!" , "warning" );
}
return false;
});
// Discount for Payment
$('#discount').click(function () {
if ($(this).attr('active')=== "true") {
var sale = $('#sale_id').val();
if (sale != "") {
var sale_id = sale
} else {
var sale_id = $('#save_order_id').val();
}
if (sale_id != "") {
window.location.href = '/origami/' + sale_id + "/"+cashier_type+'/discount';
}
else {
swal ( "Oops" , "Please select an table!" , "warning" );
}
}else{
swal("Oops","You are not authorized for Discount","warning")
}
return false;
});
});
</script>

View File

@@ -50,11 +50,11 @@
<% end %>
<div class="card-block">
<%= table.name %>
<% if !@order_items_count.nil? %>
<!-- <% if !@order_items_count.nil? %>
<% if @order_items_count.key?(table.id) %>
(Orders : <%= @order_items_count[table.id] %>)
<% end %>
<% end %>
<% end %> -->
<span class="pull-right font-12 new_text_<%= table.id %>"> billed</span>
</div>
</div>
@@ -66,11 +66,11 @@
<% end %>
<div class="card-block">
<%= table.name %>
<% if !@order_items_count.nil? %>
<!-- <% if !@order_items_count.nil? %>
<% if @order_items_count.key?(table.id) %>
(Orders : <%= @order_items_count[table.id] %>)
<% end %>
<% end %>
<% end %> -->
<span class="pull-right font-12 new_text_<%= table.id %>"> new</span>
</div>
</div>
@@ -97,11 +97,11 @@
<div class="card rooms red text-white table_<%= room.id %>" data-id="<%= room.id %>">
<div class="card-block">
<%= room.name %>
<% if !@order_items_count.nil? %>
<!-- <% if !@order_items_count.nil? %>
<% if @order_items_count.key?(room.id) %>
(Orders : <%= @order_items_count[room.id] %>)
<% end %>
<% end %>
<% end %> -->
<span class="pull-right font-12 new_text_<%= room.id %>"> billed</span>
<div style="font-size:12px;"></div>
</div>
@@ -110,11 +110,11 @@
<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.nil? %>
<% if @order_items_count.key?(room.id) %>
(Orders : <%= @order_items_count[room.id] %>)
<% end %>
<% end %>
<% end %> -->
<span class="pull-right font-12 new_text_<%= room.id %>"> new</span>
</div>
</div>
@@ -193,12 +193,15 @@
<div class="card-title row p-l-5 p-r-5">
<% if @status_sale == 'sale' %>
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="col-lg-8 col-md-8 col-sm-8">
&nbsp; Receipt No:
<span id="receipt_no">
<%= @obj_sale.receipt_no rescue '' %>
</span>
</div>
<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>
</div>
<% else %>
<div class="col-lg-7 col-md-7 col-sm-7">
&nbsp; Order No:
@@ -206,17 +209,10 @@
<%= @obj_order.order_id rescue '' %>
</span>
</div>
<% end %>
<% if @status_sale == 'sale' %>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span>
</div>
<% else %>
<div class="col-lg-5 col-md-5 col-sm-5 text-right">
<div class="col-lg-5 col-md-5 col-sm-5 text-right">
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y") rescue '-'%></span>
</div>
<% end %>
</div>
<div class="card-title row customer_detail p-l-5 p-r-5" >
<div class="col-lg-6 col-md-6 col-sm-6">
@@ -396,10 +392,7 @@
<!-- Waiter Buttons -->
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i> Back</button>
<button type="button" id="add_order" class="btn btn-block btn- bg-blue waves-effect">Add Order</button>
<% if current_login_employee.role == "administrator" || current_login_employee.role == "manager" || current_login_employee.role == "supervisor" || current_login_employee.role == "cashier" || current_login_employee.role == "waiter" %>
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect">Survey</button>
<% end %>
<% if current_login_employee.role != "waiter" %>
<% if @room.bookings.length >= 1 %>
<% if @status_order == 'order' && @status_sale != 'sale' %>
<!-- <button type="button" class="btn bg-blue btn-block" >Add Order</button> -->
@@ -423,14 +416,14 @@
<!-- <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" 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>
<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>
<% end %>
<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 bg-blue btn-block" >Charges</button>
<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>
@@ -485,11 +478,11 @@
<% end %>
<!-- <button type="button" id="re-print" class="btn bg-blue btn-block" >Re.Print</button> -->
<% end %>
<% end %>
</div>
</div>
</div>
<script>
var cashier_type = "cashier";
$(document).ready(function(){
// $(".tables").on('click', function(){
// var customer_id=$(".customer-id").text();
@@ -585,7 +578,7 @@ $(document).ready(function(){
var sale_id = "<%= @room.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
$("#customer").on('click', function(){
@@ -597,7 +590,7 @@ $(document).ready(function(){
}
var table_id = $('.tables').attr("data-id");
window.location.href = '/origami/'+ sale_id + "/customers"
window.location.href = '/origami/' + sale_id+"/"+cashier_type + "/customers/normal";
});
@@ -620,7 +613,7 @@ $(document).ready(function(){
}
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" );
@@ -642,7 +635,7 @@ $(document).ready(function(){
}
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" );

View File

@@ -200,30 +200,30 @@
var reference_no = $('#reference_no').val();
var sale_id = "<%= @sale_id %>";
var receipt_no = "<%= @receipt_no %>";
$("#reference_no_Err").html("");
if(reference_no.length > 0){
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
$(this).off("click");
//start member discount 5% by pay card
// var sub_total = $('#sub-total').text();
// var member_id = $('#membership_id').text();
// var member_discount = $('#member_discount').text();
// if (member_id && member_discount) {
// $.ajax({
// type: "POST",
// url: "/origami/" + sale_id + "/member_discount",
// data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
// success:function(result){
// }
// });
// }
//end member discount
var bank_integration = "<%= @bank_integration %>";
if(bank_integration == '1'){
$("#reference_no").val("");
pay_withBank("SALE", "unionpay", amount, sale_id, receipt_no);
}
else{
//start member discount 5% by pay card
// var sub_total = $('#sub-total').text();
// var member_id = $('#membership_id').text();
// var member_discount = $('#member_discount').text();
// if (member_id && member_discount) {
// $.ajax({
// type: "POST",
// url: "/origami/" + sale_id + "/member_discount",
// data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
// success:function(result){
// }
// });
// }
//end member discount
var bank_integration = "<%= @bank_integration %>";
if(bank_integration == '1'){
pay_withBank("SALE", "unionpay", amount, sale_id, receipt_no, cashier_type);
}
else{
$.ajax({type: "POST",
url: "<%= origami_payment_unionpay_path %>",
data: "amount="+ amount + "&sale_id="+ sale_id,
@@ -241,7 +241,7 @@
});
}
}
});
});
}
}else{
if (amount>0) {

View File

@@ -201,49 +201,48 @@
console.log(amount);
console.log($("#validamount").attr("value"));
$("#reference_no_Err").html("");
if(reference_no.length > 0){
if(reference_no.length > 0){
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
$(this).off("click");
//start member discount 5% by pay card
// var sub_total = $('#sub-total').text();
// var member_id = $('#membership_id').text();
// var member_discount = $('#member_discount').text();
// if (member_id && member_discount) {
// $.ajax({
// type: "POST",
// url: "/origami/" + sale_id + "/member_discount",
// data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
// success:function(result){
// }
// });
// }
//end member discount
var bank_integration = "<%= @bank_integration %>";
if(bank_integration == '1'){
$("#reference_no").val("");
pay_withBank("SALE", "visa", amount, sale_id, receipt_no);
}
else{
$.ajax({type: "POST",
url: "<%= origami_payment_visa_path %>",
data: "amount="+ amount + "&sale_id="+ sale_id,
success:function(result){
if(result){
swal({
title: "Information!",
text: "Payment Successfully",
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment";
});
}
$(this).off("click");
//start member discount 5% by pay card
// var sub_total = $('#sub-total').text();
// var member_id = $('#membership_id').text();
// var member_discount = $('#member_discount').text();
// if (member_id && member_discount) {
// $.ajax({
// type: "POST",
// url: "/origami/" + sale_id + "/member_discount",
// data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
// success:function(result){
// }
// });
// }
//end member discount
var bank_integration = "<%= @bank_integration %>";
if(bank_integration == '1'){
pay_withBank("SALE", "visa", amount, sale_id, receipt_no,cashier_type);
}
else{
$.ajax({type: "POST",
url: "<%= origami_payment_visa_path %>",
data: "amount="+ amount + "&sale_id="+ sale_id,
success:function(result){
if(result){
swal({
title: "Information!",
text: "Payment Successfully",
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment";
});
}
});
}
}else{
}
});
}
}else{
if (amount>0) {
swal ( "Oops" , "Paid Amount is over!" , "error" );
}else{
@@ -253,5 +252,5 @@
}else{
$("#reference_no_Err").html("can't be blank");
}
})
});
</script>