merge with master
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
<%end%>
|
||||
</ul>
|
||||
</li>
|
||||
<div id="menu-slimscroll" data-height="0">
|
||||
<ul class="nav nav-tabs flex-column category_list" role="tablist" id="ul-navbar">
|
||||
<li class="nav-item product" data-ref="<%= origami_get_all_product_path %>">
|
||||
<a class="nav-link" data-toggle="tab" href="" role="tab">Products</a>
|
||||
@@ -80,14 +81,15 @@
|
||||
<% end %>
|
||||
<%end %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="col-md-7 col-lg-7 col-sm-7 m-t-10" >
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<div id="custom-slimscroll">
|
||||
<div class="card-block" style="">
|
||||
<div class="card-text" id="custom-slimscroll">
|
||||
<div class="card-columns custom-card-columns menu_items_list" style="column-gap: 0.5rem;">
|
||||
<!-- append data -->
|
||||
<% @menu.each do |menu| %>
|
||||
@@ -199,7 +201,7 @@
|
||||
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-text" id="order-detail-slimscroll" data-height="180">
|
||||
<div class="card-text" id="order-detail-slimscroll" data-height="140">
|
||||
<table class="table table-striped summary-items" id="order-items-table" >
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -375,7 +377,7 @@
|
||||
<div class="modal-body">
|
||||
<div class="row set-item">
|
||||
<div class="col-md-4">
|
||||
<p style="text-align: center;"> <%= image_tag "logo.png" ,width: '', height: '', :id => 'logo' %></p>
|
||||
<p class="set_default_option" style="text-align: center;"> <%= image_tag "logo.png" ,width: '', height: '', :id => 'logo' %></p>
|
||||
<!-- <div class="form-group">
|
||||
<label class="col-md-6" style="margin-top:5px">Quantity</label>
|
||||
<input type="number" name="qty" class="form-control col-md-5 input-number change_qty" id="set_change_qty" value="" min="1" max="100">
|
||||
@@ -482,6 +484,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<style type="text/css">
|
||||
.fadeInRight{
|
||||
-webkit-animation-duration: 350ms !important;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
jQuery(function(){
|
||||
id = "<%=@menu[0].id%>";
|
||||
|
||||
5
app/views/origami/alipay/create.json.jbuilder
Executable file
5
app/views/origami/alipay/create.json.jbuilder
Executable file
@@ -0,0 +1,5 @@
|
||||
if(@status)
|
||||
json.status @status
|
||||
else
|
||||
json.status false
|
||||
end
|
||||
258
app/views/origami/alipay/index.html.erb
Executable file
258
app/views/origami/alipay/index.html.erb
Executable file
@@ -0,0 +1,258 @@
|
||||
<div class="container-fluid">
|
||||
<div id="loading_wrapper" style="display:none;">
|
||||
<div id="loading"></div>
|
||||
</div>
|
||||
<!-- <div class="page-header">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="<%=origami_root_path %>"><%= t :home %></a></li>
|
||||
<li class="breadcrumb-item"><a href="/origami/sale/<%=@sale_id %>/payment"><%= t("views.btn.payment") %></a></li>
|
||||
<li class="breadcrumb-item active"><%= t("views.btn.alipay") %></li>
|
||||
<span class="float-right">
|
||||
<%= link_to t('.back',:default => t("views.btn.back")),'/origami/sale/'+@sale_id+'/payment/others_payment'%>
|
||||
</span>
|
||||
</ol>
|
||||
</div> -->
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<span class="hidden" id="membership_id"><%= @membership_id%></span>
|
||||
<span class="hidden" id="member_discount"><%= @member_discount%></span>
|
||||
<span class="hidden" id="sub-total"><%= @sub_total%></span>
|
||||
<div class="card" style="margin-top:10px;padding:20px;">
|
||||
<div class="card-block">
|
||||
<div class="rebate-form">
|
||||
<% if @bank_integration == '1' %>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label for="com_port_name">Select Device</label>
|
||||
<select id="com_port_name" name="com_port_name" class="form-control select col-lg-7 col-md-7 col-sm-7">
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label>You can pay up to </label>
|
||||
<%@can_alipay = @can_alipay +@rounding_adj%>
|
||||
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%= @can_alipay %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<% if @alipaycount != 0 %>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label>Recent Alipay paid amount </label>
|
||||
<input type="text" name="" id="" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@alipaycount %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label>Reference Number</label>
|
||||
<input type="text" name="reference_no" id="reference_no" class="form-control col-lg-7 col-md-7 col-sm-7" value="" data-value="<%=@sale_id %>" data-member-value="">
|
||||
<br><span id="reference_no_Err" style="color:red;"></span>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label>Amount</label>
|
||||
<div id="amount" class="form-control col-lg-7 col-md-7 col-sm-7">0.0</div>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6 col-md-6 col-sm-6" style="margin-top:;">
|
||||
<div class=" m-t-10 p-l-20">
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<div class="row bottom">
|
||||
<div class="col-md-4 cashier_number border-left" data-value="1" data-type="num">1</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="2" data-type="num">2</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="3" data-type="num">3</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="col-md-4 cashier_number border-left" data-value="4" data-type="num">4</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="5" data-type="num">5</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="6" data-type="num">6</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="col-md-4 cashier_number border-left" data-value="7" data-type="num">7</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="8" data-type="num">8</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="9" data-type="num">9</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="col-md-4 cashier_number border-left" data-value="0" data-type="num">0</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="." data-type="num">.</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="00" data-type="num">00</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="col-md-4 cashier_number border-left green" data-type="nett" >Nett</div>
|
||||
<div class="col-md-4 cashier_number red border-left" data-type="del">Del</div>
|
||||
<div class="col-md-4 cashier_number orange border-left" data-type="clr">Clr</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<div class="row bottom m-l-5">
|
||||
<div class="cashier_number long border-left" data-value="1000" data-type="add">1000</div>
|
||||
<div class="cashier_number long left" data-value="3000" data-type="add">3000</div>
|
||||
</div>
|
||||
<div class="row bottom m-l-5">
|
||||
<div class="cashier_number long border-left" data-value="5000" data-type="add">5000</div>
|
||||
<div class="cashier_number long left" data-value="10000" data-type="add">10000</div>
|
||||
</div>
|
||||
<div class="row bottom m-l-5">
|
||||
<div class="pay purple left" id="alipay_pay">Pay</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-1 col-lg-1 col-sm-1">
|
||||
<button type="button" class="btn bg-default btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment/others_payment';"><i class="material-icons m-t--5">reply</i> Back </button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
$(document).ready(function() {
|
||||
var sale_id = "<%= @sale_id %>";
|
||||
var bank_integration = "<%= @bank_integration %>";
|
||||
|
||||
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
|
||||
else {
|
||||
$('#validamount').attr("value",parseFloat("<%= @can_alipay %>") - parseFloat(localStorage.getItem("cash")));
|
||||
}
|
||||
|
||||
if(bank_integration == '1'){
|
||||
if(typeof code2lab != 'undefined'){
|
||||
code2lab.getCommPorts(); //get comportlists from jade
|
||||
}else{
|
||||
swal({
|
||||
title: 'Oops',
|
||||
text: 'Alipay is not available in here!',
|
||||
type: 'error',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+ "/payment/others_payment";
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', '.cashier_number', function(event){
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
if(event.handled !== true) {
|
||||
var original_value;
|
||||
original_value = $('#amount').text();
|
||||
|
||||
var input_value = $(this).attr("data-value");
|
||||
|
||||
var input_type = $(this).attr("data-type");
|
||||
switch (input_type) {
|
||||
case 'num':
|
||||
if (original_value == "0.0"){
|
||||
$('#amount').text(input_value);
|
||||
}else{
|
||||
$('#amount').append(input_value);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
var input_value = $(this).attr("data-value");
|
||||
amount = parseInt(input_value) + parseInt(original_value);
|
||||
$('#amount').html(amount);
|
||||
|
||||
break;
|
||||
case 'clr':
|
||||
$('#amount').html("0.0");
|
||||
break;
|
||||
case 'del' :
|
||||
var cash=$('#amount').text();
|
||||
$('#amount').text(cash.substr(0,cash.length-1));
|
||||
break;
|
||||
case 'nett':
|
||||
var remain_amount = $('#validamount').val();
|
||||
$('#amount').text(remain_amount);
|
||||
break;
|
||||
|
||||
}
|
||||
event.handled = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('#alipay_pay').on('click',function(){
|
||||
var amount = $('#amount').text();
|
||||
var reference_no = $('#reference_no').val();
|
||||
var sale_id = "<%= @sale_id %>";
|
||||
var receipt_no = "<%= @receipt_no %>";
|
||||
var bank_integration = "<%= @bank_integration %>";
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
$("#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'){
|
||||
pay_withBank("SALE", "alipay", amount, sale_id, receipt_no,cashier_type);
|
||||
}else{
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_payment_alipay_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" );
|
||||
}else{
|
||||
swal ( "Oops" , "Enter Amount!" , "error" );
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$("#reference_no_Err").html("can't be blank");
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
</div>
|
||||
<% end %>
|
||||
<button id="member_acc_no" class="btn btn-success btn-sm"><span class="fa fa-credit-card"></span> Member Card</button> -->
|
||||
<% path ="/origami/#{@sale_id}/customers" %>
|
||||
<% path ="/origami/#{@sale_id}/#{@cashier_type}/customers/#{@page}" %>
|
||||
<%= form_tag path, :id => "filter_form", :method => :get do %>
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-12">
|
||||
@@ -263,6 +263,9 @@
|
||||
|
||||
<div id="sxModal">
|
||||
<div id="sxModal-Content"><h3>Card Tap</h3></div>
|
||||
<div class="m-r-20" align="right">
|
||||
<button type="button" class="btn btn-lg btn-link bg-red waves-effect btn_cancel">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
@@ -475,11 +478,11 @@
|
||||
if(booking_id!= "" && page == "pending"){
|
||||
window.location.href = '/origami/'+cashier_type+'/pending_order/'+booking_id;
|
||||
}else{
|
||||
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/customers/payment/';
|
||||
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||
}
|
||||
}else{
|
||||
if(page == "payment"){
|
||||
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/customers/payment/';
|
||||
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||
}else{
|
||||
if (type=="Table") {
|
||||
window.location.href = '/origami/table/'+id
|
||||
@@ -519,7 +522,11 @@
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
$("#sxModal .btn_cancel").on('click',function(){
|
||||
$("#sxModal").hide();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<div class="icon" >
|
||||
<i class="material-icons">arrow_forward</i>
|
||||
</div>
|
||||
<div class="text font-20 m-l-5" style="line-height: 80px;">Quick Service</div>
|
||||
<div class="text font-20 m-l-5" style="line-height: 80px;"><%= t :quick_service %></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12 cashier_view">
|
||||
@@ -30,7 +30,7 @@
|
||||
<div class="icon" >
|
||||
<i class="material-icons">arrow_forward</i>
|
||||
</div>
|
||||
<div class="text font-20 m-l-5" style="line-height: 80px;">Cashier</div>
|
||||
<div class="text font-20 m-l-5" style="line-height: 80px;"><%= t :dine_in_order %></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -41,65 +41,69 @@
|
||||
|
||||
<% if !@summ_sale.nil? %>
|
||||
|
||||
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
|
||||
<div class="card">
|
||||
<div class="body">
|
||||
<h6><%= t :sale %></h6>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.receipt") %> : </td>
|
||||
<td align="right"><%= @summ_sale.total_receipt %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t :sale %> : </td>
|
||||
<td align="right"><%= number_with_precision( @summ_sale.total_amount, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.discount") %> : </td>
|
||||
<td align="right"><%= number_with_precision( @summ_sale.total_discount, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.tax") %> : </td>
|
||||
<td align="right"><%= number_with_precision( @summ_sale.total_tax , precision: precision.to_i ,delimiter: delimiter)%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.grand_total") %> : </td>
|
||||
<td align="right"><%= number_with_precision( @summ_sale.grand_total , precision: precision.to_i ,delimiter: delimiter)%></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="table">
|
||||
<% if !(@total_payment_methods.nil?) %>
|
||||
<% @total_payment_methods.each do |payment| %>
|
||||
<% if !@sale_data[0].empty? %>
|
||||
<% if payment.payment_method != 'mpu' && payment.payment_method != 'visa' && payment.payment_method != 'master' && payment.payment_method != 'jcb' %>
|
||||
<tr>
|
||||
<td><%= payment.payment_method.to_s.capitalize %> Sale : </td>
|
||||
<td align="right">
|
||||
<% @sale_data.each do |data| %>
|
||||
<% pay_mth = payment.payment_method %>
|
||||
<%= data[""+pay_mth+""] %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
|
||||
<div class="card">
|
||||
<div class="body">
|
||||
<h6><%= t :sale %></h6>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.receipt") %> : </td>
|
||||
<td align="right"><%= @summ_sale.total_receipt %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.sale") %> <%= t :revenue %> : </td>
|
||||
<td align="right"><%= number_with_precision( @summ_sale.total_amount, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.discount") %> : </td>
|
||||
<td align="right"><%= number_with_precision( @summ_sale.total_discount, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.tax") %> : </td>
|
||||
<td align="right"><%= number_with_precision( @summ_sale.total_tax , precision: precision.to_i ,delimiter: delimiter)%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.total") %> <%= t :sale %> : </td>
|
||||
<td align="right"><%= number_with_precision( @summ_sale.grand_total , precision: precision.to_i ,delimiter: delimiter)%></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="table">
|
||||
<% if !(@total_payment_methods.nil?) %>
|
||||
<% @total_payment_methods.each do |payment| %>
|
||||
<% if !@sale_data[0].empty? %>
|
||||
<% if payment.payment_method != 'mpu' && payment.payment_method != 'visa' && payment.payment_method != 'master' && payment.payment_method != 'jcb' %>
|
||||
<tr>
|
||||
<% if payment.payment_method == 'paypar' %>
|
||||
<td>Redeem Sale : </td>
|
||||
<% else %>
|
||||
<td><%= payment.payment_method.to_s.capitalize %> Sale : </td>
|
||||
<% end %>
|
||||
<td align="right">
|
||||
<% @sale_data.each do |data| %>
|
||||
<% pay_mth = payment.payment_method %>
|
||||
<%= data[""+pay_mth+""] %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% total_card = @sale_data.select { |hash| hash["card"]!=nil }.first %>
|
||||
<% if !total_card.nil? %>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.card_sale") %> : </td>
|
||||
<td align="right">
|
||||
<%= total_card["card"].to_f %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% total_card = @sale_data.select { |hash| hash["card"]!=nil }.first %>
|
||||
<% if !total_card.nil? %>
|
||||
<tr>
|
||||
<td><%= t("views.right_panel.detail.other_payment") %> : </td>
|
||||
<td align="right">
|
||||
<%= total_card["card"].to_f %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
</table>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
|
||||
<div class="card">
|
||||
@@ -185,15 +189,24 @@
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<button type="button" data-href="<%=origami_second_display_index_path%>" target="_blank" id="second_view" class="btn action-btn bg-blue waves-effect second_view hidden" style="height: 45px">Customer View</button>
|
||||
<script>
|
||||
|
||||
|
||||
|
||||
$(".cashier_view").on('click', function() {
|
||||
window.location.href = '/origami';
|
||||
});
|
||||
|
||||
$(".qs_view").on('click', function() {
|
||||
window.location.href = '/origami/quick_service';
|
||||
document.getElementById('second_view').click();
|
||||
window.location.href = '/origami/quick_service';
|
||||
|
||||
});
|
||||
|
||||
$("#second_view").on('click', function () {
|
||||
var url = $(this).attr("data-href");
|
||||
window.open(url,'_blank');
|
||||
});
|
||||
|
||||
</script>
|
||||
@@ -414,7 +414,7 @@ var cashier_type = "<%= @cashier_type %>";
|
||||
var sub_total = $('#order-sub-total').text();
|
||||
var ajax_url = "/origami/" + sale_id + "/discount";
|
||||
|
||||
var params = { 'sale_id': sale_id, 'sub_total': sub_total, 'discount_items': discount_items, 'overall_discount': overall_discount };
|
||||
var params = { 'cashier_type' : cashier_type,'sale_id': sale_id, 'sub_total': sub_total, 'discount_items': discount_items, 'overall_discount': overall_discount };
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
@@ -465,7 +465,7 @@ var cashier_type = "<%= @cashier_type %>";
|
||||
}
|
||||
}
|
||||
|
||||
var params = { 'sale_id': sale_id, 'discount_items': JSON.stringify(discount_items) };
|
||||
var params = { 'cashier_type': cashier_type,'sale_id': sale_id, 'discount_items': JSON.stringify(discount_items) };
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/origami/" + sale_id + "/remove_discount_items",
|
||||
@@ -496,7 +496,7 @@ var cashier_type = "<%= @cashier_type %>";
|
||||
var sale_id = $('#sale-id').text();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/origami/" + sale_id + "/remove_all_discount",
|
||||
url: "/origami/" + sale_id + "/" + cashier_type + "/remove_all_discount",
|
||||
success: function(result){
|
||||
swal({
|
||||
title: "Information!",
|
||||
@@ -532,7 +532,7 @@ var cashier_type = "<%= @cashier_type %>";
|
||||
|
||||
// var params = {'sale_id':sale_id, 'sub_total':sub_total, 'account_types':account_types };
|
||||
|
||||
var params = {'sale_id':sale_id, 'sub_total':sub_total };
|
||||
var params = {'cashier_type': cashier_type,'sale_id':sale_id, 'sub_total':sub_total };
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
|
||||
@@ -241,7 +241,7 @@ $('#cash_out').on('click',function(){
|
||||
|
||||
$('#close_cashier').on('click',function(e){
|
||||
e.preventDefault(); // Prevent the href from redirecting directly
|
||||
var linkURL = '/origami/shift/close';
|
||||
var linkURL = '/origami/shift/cashier/close';
|
||||
warnBeforeRedirect(linkURL);
|
||||
})
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@
|
||||
<div class="tab-pane dining" id="orders" role="tabpanel">
|
||||
<div class="card-columns">
|
||||
<% @orders.each do |order| %>
|
||||
<div class="card orders red text-white" data-id="<%= order.order_id %>">
|
||||
<div class="card orders <%=(order.status=="new") ? 'blue' : 'red'%> text-white" data-id="<%= order.order_id %>">
|
||||
<div class="card-block">
|
||||
<%
|
||||
order_status = ""
|
||||
@@ -292,9 +292,26 @@
|
||||
<td><%= count %></td>
|
||||
<td class='item-name'>
|
||||
<%= order_item.item_name %>
|
||||
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
|
||||
<% JSON.parse(order_item.options).each do |option| %>
|
||||
<br><span class="font-13">
|
||||
<%= option %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if !order_item.set_menu_items.nil?
|
||||
order_item.set_menu_items.each do |item_instance| %>
|
||||
<br><span class="font-13"><%= item_instance %></span>
|
||||
JSON.parse(order_item.set_menu_items).each do |item_instance| %>
|
||||
<br><span class="font-13">
|
||||
<%= item_instance["item_instance_name"] %>
|
||||
<% if !item_instance["options"].nil? && !item_instance["options"].empty? %>
|
||||
<% (item_instance["options"]).each do |set_item_option| %>
|
||||
<br><span class="font-13">
|
||||
<%= set_item_option %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end
|
||||
end %>
|
||||
</td>
|
||||
@@ -371,9 +388,26 @@
|
||||
<td><%= count %>
|
||||
<td class='item-name'>
|
||||
<%= order_item.item_name %>
|
||||
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
|
||||
<% JSON.parse(order_item.options).each do |option| %>
|
||||
<br><span class="font-13">
|
||||
<%= option %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if !order_item.set_menu_items.nil?
|
||||
order_item.set_menu_items.each do |item_instance| %>
|
||||
<br><span class="font-13"><%= item_instance %></span>
|
||||
JSON.parse(order_item.set_menu_items).each do |item_instance| %>
|
||||
<br><span class="font-13">
|
||||
<%= item_instance["item_instance_name"] %>
|
||||
<% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %>
|
||||
<% (item_instance["options"]).each do |set_item_option| %>
|
||||
<br><span class="font-13">
|
||||
<%= set_item_option %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end
|
||||
end %>
|
||||
</td>
|
||||
@@ -424,7 +458,7 @@
|
||||
<i class="material-icons">reply</i>
|
||||
<%= t("views.btn.back") %>
|
||||
</button>
|
||||
<a href="<%=origami_second_display_index_path%>" target="_blank" id="second_view" class="btn action-btn bg-blue waves-effect" style="height: 45px">Customer View</a>
|
||||
<!-- <a href="<%=origami_second_display_index_path%>" target="_blank" id="second_view" class="btn action-btn bg-blue waves-effect" style="height: 45px">Customer View</a> -->
|
||||
<button type="button" id="add_order" class="btn btn-block bg-blue waves-effect"><%= t("views.btn.add") %> <%= t("views.right_panel.detail.order") %></button>
|
||||
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
|
||||
<% if @dining.status != "available" %>
|
||||
@@ -454,6 +488,11 @@
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button>
|
||||
<% end %>
|
||||
|
||||
<% if current_login_employee.role != "waiter" %>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#waste_spoileModal" > Waste & Spoile</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>
|
||||
|
||||
@@ -464,15 +503,13 @@
|
||||
<% 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>
|
||||
<% else %>
|
||||
|
||||
<%if @membership.discount && @obj_sale.customer.membership_id %>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#paymentModal">First Bill</button>
|
||||
<%else%>
|
||||
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
||||
<%end%>
|
||||
<% end %>
|
||||
|
||||
<button type="button" id="pay" class="btn btn-block bg-blue waves-effect">Pay</button>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -488,30 +525,31 @@
|
||||
<span class="hidden" id="member_discount"><%= @membership.discount%></span>
|
||||
<span class="hidden" id="membership_id"><%= @obj_sale.customer.membership_id rescue 0%></span>
|
||||
<div class="modal fade" id="paymentModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="paymentModalLabel">Choose Payment</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<select class="form-control show-tick payment_method" multiple="true" id="payment_method" >
|
||||
<option value="Cash">Cash</option>
|
||||
<option value="Credit">Credit</option>
|
||||
<% @payment_methods.each do |pay| %>
|
||||
<option value="<%= pay.payment_method %>">
|
||||
<%= pay.payment_method %>
|
||||
</option>
|
||||
<%end %>
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="paymentModalLabel">Choose Payment Method</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<!-- <select class="form-control show-tick payment_method" multiple="true" id="payment_method" > -->
|
||||
<!-- <option value="Cash">Cash</option> -->
|
||||
<button class='btn waves-effect payment_btn green' data-type='Credit' data-value='Credit'>Credit</button>
|
||||
<% @payment_methods.each do |pay| %>
|
||||
<!-- <option value="<%= pay.payment_method %>">
|
||||
<%= pay.payment_method %>
|
||||
</option> -->
|
||||
<button class='btn btn-lg waves-effect payment_btn green' data-type='<%= pay.payment_method %>' data-value='<%= pay.payment_method %>'><%= pay.payment_method %></button>
|
||||
<%end %>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<div class="modal-footer p-r-30">
|
||||
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
<!-- </select> -->
|
||||
</div>
|
||||
<div class="modal-footer p-r-30">
|
||||
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
|
||||
<button type="button" class="btn btn-link bg-blue waves-effect choose_payment">SAVE</button>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="btn btn-link bg-blue waves-effect choose_payment">SAVE</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -540,6 +578,30 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="waste_spoileModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="waste_spoileModalLabel">Are you sure Waste or Spoile ?</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row p-r-20">
|
||||
<div class="col-md-3">
|
||||
<button type="button" class="btn btn-lg bg-red waves-effect " data-status="waste" value="waste" id="btn_waste" onclick="waste_and_spoilage('waste')"><strong>Waste</strong></button>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<button type="button" class="btn btn-lg bg-red waves-effect " data-status="spoile" value="spoile" id="btn_spoile" onclick="waste_and_spoilage('spoile')"><strong>Spoile</strong></button>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<button type="button" class="btn btn-lg bg-blue waves-effect" data-dismiss="modal"><strong>CLOSE</strong></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer ">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var cashier_type = "cashier";
|
||||
$(document).ready(function () {
|
||||
@@ -681,6 +743,7 @@
|
||||
$("#first_bill").on('click', function () {
|
||||
var sale_id = $('#sale_id').val();
|
||||
var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
|
||||
var server_mode =
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
@@ -689,18 +752,41 @@
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
if((receipt_no!=undefined) && (receipt_no!=""))
|
||||
createReceiptNoInFirstBillData(receipt_no,"");
|
||||
|
||||
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
|
||||
// console.log(result);
|
||||
// code2lab.printBill(result.filepath, result.printer_model, result.printer_url);
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// click select option icon for add
|
||||
$(document).on('click', '.payment_btn', function(event){
|
||||
active = $(this).hasClass('selected-payment');
|
||||
value = $(this).data('value');
|
||||
type = $(this).data('type');
|
||||
group = $(this).data('group');
|
||||
payments = $(".payment_btn");
|
||||
|
||||
if (active) {
|
||||
$(this).removeClass('selected-payment');
|
||||
}else{
|
||||
$(this).addClass('selected-payment');
|
||||
}
|
||||
}); //End selecct attribute buttom
|
||||
|
||||
$(".choose_payment").on('click', function () {
|
||||
$( "#loading_wrapper").show();
|
||||
alert(parseInt(jQuery.inArray("PAYMAL", type)));
|
||||
|
||||
var sale_id = $('#sale_id').val();
|
||||
type = $('.payment_method').val();
|
||||
// type = $('.payment_method').val();
|
||||
type = get_selected_attributes('selected-payment');
|
||||
if(parseInt(jQuery.inArray("Credit", type)) == -1){
|
||||
if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1 || parseInt(jQuery.inArray("PAYMAL",type))!= -1) {
|
||||
calculate_member_discount(sale_id,"Card");
|
||||
@@ -718,7 +804,11 @@
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
if((receipt_no!=undefined) && (receipt_no!=""))
|
||||
createReceiptNoInFirstBillData(receipt_no,type);
|
||||
location.reload();
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -768,7 +858,7 @@
|
||||
//split bill process
|
||||
$('#split_bills').click(function(){
|
||||
var dining_id = "<%= @dining.id %>";
|
||||
window.location.href = '/origami/table/' + dining_id + "/split_bills";
|
||||
window.location.href = '/origami/table/' + dining_id + "/" + cashier_type +"/split_bills";
|
||||
});
|
||||
|
||||
$('#move').on('click', function () {
|
||||
@@ -872,15 +962,19 @@
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||
var ajax_url = "/origami/sale/" + sale_id + '/void';
|
||||
var ajax_url = "/origami/sale/" + sale_id + '/cashier/void';
|
||||
var remark = $("#remark").val();
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ajax_url,
|
||||
data: "remark="+ remark + "&sale_id=" + sale_id,
|
||||
success: function () {
|
||||
window.location.href = '/origami/';
|
||||
success: function (result) {
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
window.location.href = '/origami/';
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -938,4 +1032,46 @@
|
||||
window.location.href = '/oqs/'+ assigned_order_item_id + "/edit/"+dining_id;
|
||||
}
|
||||
});
|
||||
|
||||
// Get Selected Class
|
||||
function get_selected_attributes(selected_class) {
|
||||
var item_row = $('.'+selected_class);
|
||||
var attribute_arr = [];
|
||||
$(item_row).each(function(i){
|
||||
value = $(item_row[i]).attr('data-value');
|
||||
str = value;
|
||||
attribute_arr.push(str);
|
||||
});
|
||||
return attribute_arr;
|
||||
}
|
||||
|
||||
function waste_and_spoilage(remark) {
|
||||
swal({
|
||||
title: "Alert",
|
||||
text: "Are you sure want to " + remark +" ?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Yes, " +remark+ " it!",
|
||||
closeOnConfirm: false
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||
var url = "/origami/sale/" + sale_id + '/cashier/waste_and_spoilage';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: url,
|
||||
data: "remark="+ remark + "&sale_id=" + sale_id,
|
||||
success: function (result) {
|
||||
console.log(result)
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
window.location.href = '/origami/';
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
</span>
|
||||
</ol>
|
||||
</div> -->
|
||||
<h5>JCB Payment</h5>
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-5 col-sm-3">
|
||||
<span class="hidden" id="membership_id"><%= @membership_id%></span>
|
||||
@@ -51,7 +50,8 @@
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label>Reference Number</label>
|
||||
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" value="" data-value="<%=@sale_id %>" data-member-value="">
|
||||
<input type="text" name="reference_no" id="reference_no" class="form-control col-lg-7 col-md-7 col-sm-7" value="" data-value="<%=@sale_id %>" data-member-value="">
|
||||
<br><span id="reference_no_Err" style="color:red;"></span>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
@@ -194,53 +194,60 @@ $(document).on('click', '.cashier_number', function(event){
|
||||
|
||||
$('#jcb_pay').on('click',function(){
|
||||
var amount = $('#amount').text();
|
||||
var reference_no = $('#reference_no').val();
|
||||
var sale_id = "<%= @sale_id %>";
|
||||
var receipt_no = "<%= @receipt_no %>";
|
||||
var bank_integration = "<%= @bank_integration %>";
|
||||
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'){
|
||||
pay_withBank("SALE", "jcb", amount, sale_id, receipt_no,cashier_type);
|
||||
$("#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", "jcb", amount, sale_id, receipt_no);
|
||||
}else{
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_payment_jcb_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{
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_payment_jcb_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";
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
if (amount>0) {
|
||||
swal ( "Oops" , "Paid Amount is over!" , "error" );
|
||||
}else{
|
||||
swal ( "Oops" , "Enter Amount!" , "error" );
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if (amount>0) {
|
||||
swal ( "Oops" , "Paid Amount is over!" , "error" );
|
||||
}else{
|
||||
swal ( "Oops" , "Enter Amount!" , "error" );
|
||||
}
|
||||
$("#reference_no_Err").html("can't be blank");
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
5
app/views/origami/junction_pay/create.json.jbuilder
Executable file
5
app/views/origami/junction_pay/create.json.jbuilder
Executable file
@@ -0,0 +1,5 @@
|
||||
if(@status)
|
||||
json.status @status
|
||||
else
|
||||
json.status false
|
||||
end
|
||||
300
app/views/origami/junction_pay/index.html.erb
Executable file
300
app/views/origami/junction_pay/index.html.erb
Executable file
@@ -0,0 +1,300 @@
|
||||
<div class="container-fluid">
|
||||
<div id="loading_wrapper" style="display:none;">
|
||||
<div id="loading"></div>
|
||||
</div>
|
||||
<!-- <div class="page-header">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="<%=origami_root_path %>"><%= t :home %></a></li>
|
||||
<li class="breadcrumb-item"><a href="/origami/sale/<%=@sale_id %>/payment"><%= t("views.btn.payment") %></a></li>
|
||||
<li class="breadcrumb-item active"><%= t("views.btn.jcb") %></li>
|
||||
<span class="float-right">
|
||||
<%= link_to t('.back',:default => t("views.btn.back")),'/origami/sale/'+@sale_id+'/payment/others_payment'%>
|
||||
</span>
|
||||
</ol>
|
||||
</div> -->
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-5 col-sm-3">
|
||||
<span class="hidden" id="membership_id"><%= @membership_id%></span>
|
||||
<span class="hidden" id="member_discount"><%= @member_discount%></span>
|
||||
<span class="hidden" id="sub-total"><%= @sub_total%></span>
|
||||
<div class="card m-l-10 m-t-10" style="padding:0px 20px;">
|
||||
<div class="rebate-form">
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label for="com_port_name">Select Device</label>
|
||||
<select id="com_port_name" name="com_port_name" class="form-control select col-lg-7 col-md-7 col-sm-7">
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label>You can pay up to </label>
|
||||
<%@can_junction_pay = @can_junction_pay +@rounding_adj%>
|
||||
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@can_junction_pay %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<% if @jcbcount != 0 %>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label>Recent junction pay paid amount </label>
|
||||
<input type="text" name="" id="" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@junction_pay_count %>" data-member-value="">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label>Reference Number</label>
|
||||
<input type="text" name="reference_no" id="reference_no" class="form-control col-lg-7 col-md-7 col-sm-7" value="" data-value="<%=@sale_id %>" data-member-value="">
|
||||
<br><span id="reference_no_Err" style="color:red;"></span>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label>Amount</label>
|
||||
<div id="amount" class="form-control col-lg-7 col-md-7 col-sm-7">0.0</div>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<div class="m-t-10 p-l-20">
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<div class="row bottom">
|
||||
<div class="col-md-4 cashier_number border-left" data-value="1" data-type="num">1</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="2" data-type="num">2</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="3" data-type="num">3</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="col-md-4 cashier_number border-left" data-value="4" data-type="num">4</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="5" data-type="num">5</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="6" data-type="num">6</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="col-md-4 cashier_number border-left" data-value="7" data-type="num">7</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="8" data-type="num">8</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="9" data-type="num">9</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="col-md-4 cashier_number border-left" data-value="0" data-type="num">0</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="." data-type="num">.</div>
|
||||
<div class="col-md-4 cashier_number border-left" data-value="00" data-type="num">00</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="col-md-4 cashier_number green border-left" data-type="nett" >Nett</div>
|
||||
<div class="col-md-4 cashier_number red border-left" data-type="del">Del</div>
|
||||
<div class="col-md-4 cashier_number orange border-left" data-type="clr">Clr</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<div class="row bottom m-l-5">
|
||||
<div class="cashier_number long border-left" data-value="1000" data-type="add">1000</div>
|
||||
<div class="cashier_number long left" data-value="3000" data-type="add">3000</div>
|
||||
</div>
|
||||
<div class="row bottom m-l-5">
|
||||
<div class="cashier_number long border-left" data-value="5000" data-type="add">5000</div>
|
||||
<div class="cashier_number long left" data-value="10000" data-type="add">10000</div>
|
||||
</div>
|
||||
<div class="row bottom m-l-5">
|
||||
<div class="pay purple left" id="junction_pay">Pay</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn btn-default btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment/others_payment';"> <i class="material-icons m-t--5">reply</i>Back </button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
$(document).ready(function() {
|
||||
var sale_id = "<%= @sale_id %>";
|
||||
var bank_integration = "<%= @bank_integration %>";
|
||||
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
|
||||
else {
|
||||
$('#validamount').attr("value",parseFloat("<%= @can_junction_pay %>") - parseFloat(localStorage.getItem("cash")));
|
||||
}
|
||||
|
||||
code2lab.getCommPorts(); //get comportlists from jade
|
||||
});
|
||||
|
||||
// number key pad
|
||||
$(document).on('click', '.cashier_number', function(event){
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
if(event.handled !== true) {
|
||||
var original_value;
|
||||
original_value = $('#amount').text();
|
||||
|
||||
var input_value = $(this).attr("data-value");
|
||||
|
||||
var input_type = $(this).attr("data-type");
|
||||
switch (input_type) {
|
||||
case 'num':
|
||||
if (original_value == "0.0"){
|
||||
$('#amount').text(input_value);
|
||||
}else{
|
||||
$('#amount').append(input_value);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
var input_value = $(this).attr("data-value");
|
||||
amount = parseInt(input_value) + parseInt(original_value);
|
||||
$('#amount').html(amount);
|
||||
|
||||
break;
|
||||
case 'clr':
|
||||
$('#amount').html("0.0");
|
||||
break;
|
||||
case 'del' :
|
||||
var cash=$('#amount').text();
|
||||
$('#amount').text(cash.substr(0,cash.length-1));
|
||||
break;
|
||||
case 'nett':
|
||||
var remain_amount = $('#validamount').val();
|
||||
$('#amount').text(remain_amount);
|
||||
break;
|
||||
|
||||
}
|
||||
event.handled = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('#junction_pay').on('click',function(){
|
||||
var amount = $('#amount').text();
|
||||
var reference_no = $('#reference_no').val();
|
||||
var sale_id = "<%= @sale_id %>";
|
||||
var receipt_no = "<%= @receipt_no %>";
|
||||
var cashier_id = "<%= @cashier_id %>";
|
||||
$("#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
|
||||
$("#loading_wrapper").show();
|
||||
var com_port = '/dev/' + $("#com_port_name").val();
|
||||
var is_rebate=false;
|
||||
//alert(cashier_id + amount + com_port);
|
||||
code2lab.reqJunctionPay(true, cashier_id, parseFloat(amount), receipt_no, com_port);
|
||||
resJunctionPayUpdate = function(totalBillAmount , finalBillAmt,giftCardAmount, voucherAmount,voucherNumber,receiptNumber){
|
||||
$("#loading_wrapper").hide();
|
||||
|
||||
var voucher_no = voucherNumber;
|
||||
if (voucher_no == ''){
|
||||
voucher_no = reference_no;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<%= origami_payment_junctionpay_path %>",
|
||||
data: "gift_amount="+ giftCardAmount + "&voucher_amount=" + voucherAmount +
|
||||
"&voucher_no=" + voucher_no + "&sale_id="+ sale_id,
|
||||
success:function(result){
|
||||
if(result){
|
||||
var desc = 'Payment Successfully';
|
||||
// is_rebate get from resJunctionPay and if member
|
||||
if(is_rebate){ desc = desc + ". And You get Rebate!"}
|
||||
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: desc,
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+"/payment";
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
resJunctionPay = function(memberno,transactionNo,finalBillingAmt){
|
||||
if(memberno != ''){ is_rebate = true; }
|
||||
};
|
||||
|
||||
|
||||
// $("#loading_wrapper").hide();
|
||||
// $.ajax({type: "POST",
|
||||
// url: "/origami/payment/"+payment_type,
|
||||
// data: "amount="+ finalBillingAmt + "&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";
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
|
||||
// var resError = function(message){
|
||||
// console.log(message);
|
||||
// $("#loading_wrapper").hide();
|
||||
// swal ( "Oops" , message , "error" );
|
||||
// };
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// var resJunctionPayUpdate = function(totalBillAmount , finalBillAmt,giftCardAmount,voucherAmount, voucherNumber,receiptNumber){
|
||||
// $("#loading_wrapper").hide();
|
||||
// // alert(voucherNumber + ' ' + totalBillAmount + ' ' + receiptNumber + ' ' + giftCardAmount);
|
||||
// $.ajax({
|
||||
// type: "POST",
|
||||
// url: "<%= origami_payment_junctionpay_path %>",
|
||||
// data: "amount="+ totalBillAmount + "&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";
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// };
|
||||
</script>
|
||||
@@ -12,7 +12,6 @@
|
||||
</span>
|
||||
</ol>
|
||||
</div> -->
|
||||
<h5>Master Payment</h5>
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-5 col-sm-3">
|
||||
<span class="hidden" id="membership_id"><%= @membership_id%></span>
|
||||
@@ -52,7 +51,8 @@
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label>Reference Number</label>
|
||||
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" value="" data-value="<%=@sale_id %>" data-member-value="">
|
||||
<input type="text" name="reference_no" id="reference_no" class="form-control col-lg-7 col-md-7 col-sm-7" value="" data-value="<%=@sale_id %>" data-member-value="">
|
||||
<br><span id="reference_no_Err" style="color:red;"></span>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
@@ -192,10 +192,14 @@
|
||||
});
|
||||
$('#master_pay').on('click',function(){
|
||||
var amount = $('#amount').text();
|
||||
var reference_no = $('#reference_no').val();
|
||||
var sale_id = "<%= @sale_id %>";
|
||||
var receipt_no = "<%= @receipt_no %>";
|
||||
var bank_integration = "<%= @bank_integration %>";
|
||||
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
|
||||
$("#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();
|
||||
@@ -214,31 +218,34 @@
|
||||
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,
|
||||
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";
|
||||
});
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_payment_master_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" );
|
||||
}else{
|
||||
swal ( "Oops" , "Enter Amount!" , "error" );
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if (amount>0) {
|
||||
swal ( "Oops" , "Paid Amount is over!" , "error" );
|
||||
}else{
|
||||
swal ( "Oops" , "Enter Amount!" , "error" );
|
||||
}
|
||||
$("#reference_no_Err").html("can't be blank");
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
</span>
|
||||
</ol>
|
||||
</div> -->
|
||||
<h5>MPU Payment</h5>
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<span class="hidden" id="membership_id"><%= @membership_id%></span>
|
||||
@@ -52,7 +51,8 @@
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label>Reference Number</label>
|
||||
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" value="" data-value="<%=@sale_id %>" data-member-value="">
|
||||
<input type="text" name="reference_no" id="reference_no" class="form-control col-lg-7 col-md-7 col-sm-7" value="" data-value="<%=@sale_id %>" data-member-value="">
|
||||
<br><span id="reference_no_Err" style="color:red;"></span>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
@@ -197,26 +197,29 @@
|
||||
|
||||
$('#mpu_pay').on('click',function(){
|
||||
var amount = $('#amount').text();
|
||||
var reference_no = $('#reference_no').val();
|
||||
var sale_id = "<%= @sale_id %>";
|
||||
var receipt_no = "<%= @receipt_no %>";
|
||||
var bank_integration = "<%= @bank_integration %>";
|
||||
var cashier_type = "<%= @cashier_type %>";
|
||||
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
|
||||
$("#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'){
|
||||
pay_withBank("SALE", "mpu", amount, sale_id, receipt_no,cashier_type);
|
||||
}else{
|
||||
@@ -241,12 +244,15 @@
|
||||
}
|
||||
|
||||
}else{
|
||||
if (amount>0) {
|
||||
swal ( "Oops" , "Paid Amount is over!" , "error" );
|
||||
}else{
|
||||
swal ( "Oops" , "Enter Amount!" , "error" );
|
||||
}
|
||||
}
|
||||
})
|
||||
if (amount>0) {
|
||||
swal ( "Oops" , "Paid Amount is over!" , "error" );
|
||||
}else{
|
||||
swal ( "Oops" , "Enter Amount!" , "error" );
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$("#reference_no_Err").html("can't be blank");
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@
|
||||
<div class="tab-pane active" id="orders" role="tabpanel" style="">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @orders.each do |order| %>
|
||||
<div class="card orders red text-white" data-id = "<%= order.order_id %>">
|
||||
<div class="card orders <%=(order.status=="new") ? 'blue' : 'red'%> text-white" data-id = "<%= order.order_id %>">
|
||||
<div class="card-block">
|
||||
<%
|
||||
order_status = ""
|
||||
|
||||
@@ -308,7 +308,7 @@ var cashier_type = "<%= @cashier_type %>";
|
||||
var other_charges_items = JSON.stringify(get_other_item_rows());
|
||||
var ajax_url = "/origami/" + sale_id + "/other_charges";
|
||||
|
||||
var params = { 'sale_id': sale_id, 'sub_total': sub_total, 'other_charges_items': other_charges_items };
|
||||
var params = { 'cashier_type' : cashier_type,'sale_id': sale_id, 'sub_total': sub_total, 'other_charges_items': other_charges_items };
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
|
||||
@@ -100,10 +100,10 @@
|
||||
<td class="charges-name"><strong>Tax
|
||||
(<% @i = 0
|
||||
@account_arr.each do |ct| %>
|
||||
<%=ct.name%>
|
||||
<% if @account_arr.count != @i+1%>
|
||||
+ <% @i =+1 %>
|
||||
<%end%>
|
||||
<%=ct.name%>
|
||||
<% if @account_arr.count != @i+1%>
|
||||
+ <% @i =+1 %>
|
||||
<%end%>
|
||||
<%end %>)
|
||||
</strong></td>
|
||||
<td class="item-attr"><strong><span><%= number_with_precision(@sale_data.total_tax, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%></span></strong></td>
|
||||
@@ -182,91 +182,109 @@
|
||||
<div class="card-title m-l-5 m-r-5">
|
||||
<!-- mpu -->
|
||||
<% if @other != 0.0 %>
|
||||
<div class="row payment others-color">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">MPU</div>
|
||||
<div class="col-md-4 mpu is_card" id="others"><%= number_with_precision(@other, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<div class="row payment others-color">
|
||||
<% else %>
|
||||
<div class="row hidden">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">MPU</div>
|
||||
<div class="col-md-4" id="others"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<div class="row hidden">
|
||||
<% end %>
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">MPU</div>
|
||||
<% if @other != 0.0 %>
|
||||
<div class="col-md-4 mpu is_card" id="others"><%= number_with_precision(@other, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<% else %>
|
||||
<div class="col-md-4" id="others"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<!-- paypar -->
|
||||
<% if @ppamount != 0.0 %>
|
||||
<div class="row payment others-color">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">Redeem</div>
|
||||
<div class="col-md-4" id="ppamount"><%= number_with_precision(@ppamount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row hidden">
|
||||
<% end %>
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">Redeem</div>
|
||||
<% if @ppamount != 0.0 %>
|
||||
<div class="col-md-4" id="ppamount"><%= number_with_precision(@ppamount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<% else %>
|
||||
<div class="col-md-4" id="ppamount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<!-- Visa -->
|
||||
<% if @visacount != 0.0 %>
|
||||
<div class="row payment others-color">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">VISA</div>
|
||||
<div class="col-md-4 visa is_card" id="visacount"><%= number_with_precision(@visacount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row hidden">
|
||||
<% end %>
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">VISA</div>
|
||||
<div class="col-md-4" id="visacount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<% if @visacount != 0.0 %>
|
||||
<div class="col-md-4 visa is_card" id="visacount"><%= number_with_precision(@visacount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<% else %>
|
||||
<div class="col-md-4" id="visacount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<!-- JCB -->
|
||||
<% if @jcbcount != 0.0 %>
|
||||
<div class="row payment others-color">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">JCB</div>
|
||||
<div class="col-md-4 jcb is_card" id="jcbcount"><%= number_with_precision(@jcbcount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row hidden">
|
||||
<% end %>
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">JCB</div>
|
||||
<div class="col-md-4" id="jcbcount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<% if @jcbcount != 0.0 %>
|
||||
<div class="col-md-4 jcb is_card" id="jcbcount"><%= number_with_precision(@jcbcount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<% else %>
|
||||
<div class="col-md-4" id="jcbcount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<!-- Master -->
|
||||
<% if @mastercount != 0.0 %>
|
||||
<div class="row payment others-color">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">MASTER</div>
|
||||
<div class="col-md-4 master is_card" id="mastercount"><%= number_with_precision(@mastercount, precision: precision.to_i) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row hidden">
|
||||
<% end %>
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">MASTER</div>
|
||||
<div class="col-md-4" id="mastercount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<% if @mastercount != 0.0 %>
|
||||
<div class="col-md-4 master is_card" id="mastercount"><%= number_with_precision(@mastercount, precision: precision.to_i) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<% else %>
|
||||
<div class="col-md-4" id="mastercount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<!-- <br> -->
|
||||
|
||||
<!-- UNIONPAY -->
|
||||
<% if @unionpaycount != 0.0 %>
|
||||
<div class="row payment others-color">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">UNIONPAY</div>
|
||||
<div class="col-md-4 master is_card" id="unionpaycount"><%= number_with_precision(@unionpaycount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row hidden">
|
||||
<% end %>
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">UNIONPAY</div>
|
||||
<div class="col-md-4" id="unionpaycount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<% if @unionpaycount != 0.0 %>
|
||||
<div class="col-md-4 master is_card" id="unionpaycount"><%= number_with_precision(@unionpaycount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<% else %>
|
||||
<div class="col-md-4" id="unionpaycount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<!-- Alipay -->
|
||||
<% if @alipaycount != 0.0 %>
|
||||
<div class="row payment others-color">
|
||||
<% else %>
|
||||
<div class="row hidden">
|
||||
<% end %>
|
||||
<!-- PAYMAL -->
|
||||
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">Alipay</div>
|
||||
<% if @alipaycount != 0.0 %>
|
||||
<div class="col-md-4 alipay is_card" id="alipaycount"><%= number_with_precision(@alipaycount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<% else %>
|
||||
<div class="col-md-4" id="alipaycount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="row payment <%= @paymalcount!=0.0 ? 'payment others-color' : 'hidden'%>">
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">PAYMAL</div>
|
||||
@@ -276,6 +294,23 @@
|
||||
<div class="col-md-4" id="paymalcount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<!-- Junction Pay -->
|
||||
<% if @junctionpaycount != 0.0 %>
|
||||
<div class="row payment others-color">
|
||||
<% else %>
|
||||
<div class="row hidden">
|
||||
<% end %>
|
||||
<!-- PAYMAL -->
|
||||
<div class="col-md-5"></div>
|
||||
<div class="col-md-3">JUNCTION PAY</div>
|
||||
<% if @junctionpaycount != 0.0 %>
|
||||
<div class="col-md-4 master is_card" id="junctionpaycount"><%= number_with_precision(@junctionpaycount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<% else %>
|
||||
<div class="col-md-4" id="junctionpaycount"><%= number_with_precision(0, precision: precision.to_i ) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="row m-l-5 m-r-5">
|
||||
<div class="col-md-8"><strong>Balance</strong></div>
|
||||
<div class="col-md-4"><strong><span id='balance'><%= number_with_precision(@sale_data.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></span></strong></div>
|
||||
@@ -402,24 +437,26 @@
|
||||
<div class="modal-dialog modal-md" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="pdfModalLabel"></h4>
|
||||
<h4 class="modal-title">
|
||||
<span id="pdfModalLabel"></span>
|
||||
<span id="changed_amount" class="p-l-120"></span>
|
||||
</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>
|
||||
<iframe id="receipt_pdf" src="" class="pdf-iframe" scrolling="no"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer ">
|
||||
<div class="row p-r-20">
|
||||
<% if ENV["SERVER_MODE"] != 'cloud' %>
|
||||
<div class="col-md-5">
|
||||
<div class="row m-b-10 m-r-30">
|
||||
|
||||
<div class="col-md-5 m-r-20">
|
||||
<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>
|
||||
@@ -435,27 +472,40 @@
|
||||
<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>
|
||||
<h1 class="modal-title" id="is_memberModalLabel">Are you Member?</h1>
|
||||
</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">
|
||||
<input type="hidden" name="paypar_account_no" id="paypar_account_no" />
|
||||
<input type="hidden" name="qr_code" id="qr_code" />
|
||||
<div class="row text-center m-t-20">
|
||||
<% if !@customer_lists.nil? %>
|
||||
<% @customer_lists.each do |cus| %>
|
||||
<% if cus.customer_id != @customer.id %>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
|
||||
<button type="button" class="btn btn-lg btn-link bg-primary waves-effect btn_customer_assign" data-id='<%= cus.customer_id %>'><%= cus.name %></button>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="row text-center m-t-20">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
|
||||
<button type="button" class="btn btn-lg btn-link bg-primary waves-effect btn_member">Card Member</button>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
|
||||
<button type="button" class="btn btn-lg btn-link bg-primary waves-effect btn_qr_code">QR Code</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row clearfix"></div>
|
||||
<div class="row text-center m-t-20">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
|
||||
<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">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
|
||||
<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>
|
||||
@@ -464,7 +514,12 @@
|
||||
</div>
|
||||
|
||||
<div id="sxModal">
|
||||
<div id="sxModal-Content"><h3>Card Tap</h3></div>
|
||||
<div id="sxModal-Content">
|
||||
<h3>Card Tap</h3>
|
||||
</div>
|
||||
<div class="m-r-20" align="right">
|
||||
<button type="button" class="btn btn-lg btn-link bg-red waves-effect btn_cancel">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
@@ -473,10 +528,10 @@ 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')){
|
||||
if((cashier_type=='quick_service') && (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*/
|
||||
@@ -490,8 +545,7 @@ var customer_name = "<%= @customer.name %>";
|
||||
payment_type = '';
|
||||
|
||||
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
|
||||
console.log("ssssssssssss")
|
||||
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment")
|
||||
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment");
|
||||
if (member_id && member_discount) {
|
||||
if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){
|
||||
$("#credit_payment").hide();
|
||||
@@ -499,7 +553,7 @@ var customer_name = "<%= @customer.name %>";
|
||||
$("#credit_payment").show();
|
||||
}
|
||||
|
||||
if(parseInt(jQuery.inArray("MPU", payment_type)) !=-1 || parseInt(jQuery.inArray("VISA", payment_type)) !=-1 || parseInt(jQuery.inArray("JCB", payment_type)) !=-1 || parseInt(jQuery.inArray("Master", payment_type)) !=-1 || parseInt(jQuery.inArray("UNIONPAY", payment_type)) !=-1 || parseInt(jQuery.inArray("Redeem", payment_type)) !=-1, parseInt(jQuery.inArray("PAYMAL", payment_type)) !=-1){
|
||||
if(parseInt(jQuery.inArray("MPU", payment_type)) !=-1 || parseInt(jQuery.inArray("VISA", payment_type)) !=-1 || parseInt(jQuery.inArray("JCB", payment_type)) !=-1 || parseInt(jQuery.inArray("Master", payment_type)) !=-1 || parseInt(jQuery.inArray("UNIONPAY", payment_type)) !=-1 || parseInt(jQuery.inArray("Redeem", payment_type)) !=-1, parseInt(jQuery.inArray("PAYMAL", payment_type)) !=-1 || parseInt(jQuery.inArray("JUNCTIONPAY", payment_type)) !=-1 || parseInt(jQuery.inArray("Alipay", payment_type)) !=-1){
|
||||
$("#card_payment").show();
|
||||
} else{
|
||||
$("#card_payment").hide();
|
||||
@@ -562,6 +616,12 @@ var customer_name = "<%= @customer.name %>";
|
||||
else if(payment_type == "UNIONPAY" && $('#unionpaycount').text()==0 && sub_total != 0.0){
|
||||
swal("Oops","Please Pay with UNIONPAY Payment","warning");
|
||||
}
|
||||
else if(payment_type == "Alipay" && $('#alipaycount').text()==0 && sub_total != 0.0){
|
||||
swal("Oops","Please Pay with Alipay Payment","warning");
|
||||
}
|
||||
else if(payment_type == "JUNCTIONPAY" && $('#junctionpaycount').text()==0 && sub_total != 0.0){
|
||||
swal("Oops","Please Pay with JUNCTIONPAY Payment","warning");
|
||||
}
|
||||
else if(payment_type == "Credit" && $('#credit').text()==0 && sub_total != 0.0){
|
||||
swal("Oops","Please Pay with Credit Payment","warning");
|
||||
}else if(payment_type == "PAYMAL" && $('#paymalcount').text()==0 && sub_total != 0.0){
|
||||
@@ -611,9 +671,9 @@ var customer_name = "<%= @customer.name %>";
|
||||
$("#sale_receipt_no").val(result.receipt_no);
|
||||
$("#filename").val(result.filename);
|
||||
$("#printer_name").val(result.printer_name);
|
||||
$("#receipt_pdf").attr("src", result.filename);
|
||||
$("#receipt_pdf").attr("src", result.filename.substring(6));
|
||||
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
|
||||
$("#pdfModalLabel").text("Payment Successful!");
|
||||
$("#pdfModalLabel").text("Sale Completed");
|
||||
$("#changed_amount").text("");
|
||||
if($('#balance').text() < 0){
|
||||
<% if precision.to_i > 0 %>
|
||||
@@ -622,7 +682,7 @@ var customer_name = "<%= @customer.name %>";
|
||||
$("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)));
|
||||
<% end %>
|
||||
}
|
||||
customer_display_view(null,"reload");
|
||||
|
||||
//PDF lightbox data
|
||||
// if($('#balance').text() < 0){
|
||||
// swal({
|
||||
@@ -693,13 +753,17 @@ var customer_name = "<%= @customer.name %>";
|
||||
if (isConfirm) {
|
||||
var sale_id = $('#sale_id').text();
|
||||
var remark = $("#remark").val();
|
||||
var ajax_url = "/origami/sale/" + sale_id + '/void';
|
||||
var ajax_url = "/origami/sale/" + sale_id +'/'+cashier_type+ '/void';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ajax_url,
|
||||
data: "remark="+ remark + "&sale_id=" + sale_id,
|
||||
success: function () {
|
||||
success: function (result) {result
|
||||
customer_display_view(null,"reload");
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
if (cashier_type=="cashier") {
|
||||
window.location.href = '/origami';
|
||||
}else{
|
||||
@@ -840,7 +904,9 @@ var customer_name = "<%= @customer.name %>";
|
||||
var master1 = $('#mastercount').text();
|
||||
var unionpay1 = $('#unionpaycount').text();
|
||||
var paymal1 = $('#paymalcount').text();
|
||||
var othertotal = parseFloat(credit1) + parseFloat(card1) + parseFloat(paypar1) + parseFloat(visa1) + parseFloat(jcb1) + parseFloat(master1) + parseFloat(unionpay1) + parseFloat(visa1) + parseFloat(paymal1);
|
||||
var alipay1 = $('#alipaycount').text();
|
||||
var junctionpay1 = $('#junctionpaycount').text();
|
||||
var othertotal = parseFloat(credit1) + parseFloat(card1) + parseFloat(paypar1) + parseFloat(visa1) + parseFloat(jcb1) + parseFloat(master1) + parseFloat(unionpay1) + parseFloat(alipay1) + parseFloat(junctionpay1) + parseFloat(paymal1);
|
||||
var total = $('#amount_due').text();
|
||||
var amt = 0;
|
||||
<% if precision.to_i > 0 %>;
|
||||
@@ -869,8 +935,10 @@ var customer_name = "<%= @customer.name %>";
|
||||
var master = $('#mastercount').text();
|
||||
var unionpay = $('#unionpaycount').text();
|
||||
var paymal = $('#paymalcount').text();
|
||||
var alipay = $('#alipaycount').text();
|
||||
var junctionpay = $('#junctionpaycount').text();
|
||||
var amount_due = $('#amount_due').text();
|
||||
var total = parseFloat(cash) + parseFloat(credit) + parseFloat(card) + parseFloat(paypar) + parseFloat(visa) + parseFloat(jcb) + parseFloat(master) + parseFloat(unionpay) + parseFloat(paymal)
|
||||
var total = parseFloat(cash) + parseFloat(credit) + parseFloat(card) + parseFloat(paypar) + parseFloat(visa) + parseFloat(jcb) + parseFloat(master) + parseFloat(unionpay) + parseFloat(alipay) + parseFloat(junctionpay) + parseFloat(paymal);
|
||||
var result = parseFloat(amount_due) - parseFloat(total);
|
||||
<% if precision.to_i > 0 %>
|
||||
$('#balance').text(parseFloat(result).toFixed(<%= precision %>));
|
||||
@@ -901,7 +969,7 @@ var customer_name = "<%= @customer.name %>";
|
||||
if (isConfirm) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<%= origami_payment_foc_path %>",
|
||||
url: "/origami/payment/"+cashier_type+"/foc",
|
||||
data: params,
|
||||
success:function(result){
|
||||
customer_display_view(null,"reload");
|
||||
@@ -910,6 +978,10 @@ var customer_name = "<%= @customer.name %>";
|
||||
title: "Information!",
|
||||
text: 'Thank You !',
|
||||
}, function () {
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
if (cashier_type=="cashier") {
|
||||
window.location.href = '/origami';
|
||||
}else{
|
||||
@@ -929,14 +1001,15 @@ var customer_name = "<%= @customer.name %>";
|
||||
|
||||
function customer_display_view(data,status) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '../../../customer_view',
|
||||
data: {"data":data,"status":status},
|
||||
dataType: "json",
|
||||
success:function(result){
|
||||
}
|
||||
});
|
||||
}
|
||||
type: "POST",
|
||||
url: '../../../customer_view',
|
||||
data: {"data":data,"status":status},
|
||||
dataType: "json",
|
||||
success:function(result){
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function calculate_member_discount(sale_id) {
|
||||
var sub_total = $('#sub-total').text();
|
||||
var member_id = $('#membership_id').text();
|
||||
@@ -984,10 +1057,15 @@ var customer_name = "<%= @customer.name %>";
|
||||
data: params,
|
||||
success:function(result){
|
||||
console.log(result);
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
if (cashier_type=="cashier") {
|
||||
window.location.href = '/origami';
|
||||
}else{
|
||||
window.location.href = '/origami/quick_service';
|
||||
customer_display_view(null,"reload");
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1112,4 +1190,15 @@ var customer_name = "<%= @customer.name %>";
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$("#sxModal .btn_cancel").on('click',function(){
|
||||
$("#sxModal").hide();
|
||||
});
|
||||
|
||||
$(".btn_customer_assign").on('click', function(){
|
||||
var customer_id = $(this).attr('data-id');
|
||||
var customer_name = $(this).text();
|
||||
var sale_id = $("#sale_id").text() || 0;
|
||||
update_sale("", customer_id, customer_name, sale_id);
|
||||
});
|
||||
</script>
|
||||
@@ -34,7 +34,9 @@
|
||||
<i class="material-icons">reply</i>
|
||||
<%= t("views.btn.back") %>
|
||||
</button>
|
||||
|
||||
<% if current_user.role != "waiter" %>
|
||||
<button id="close_cashier" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.close_cashier") %></button>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -51,4 +53,22 @@
|
||||
$('#back').on('click', function () {
|
||||
window.location.href = '/origami/quick_service';
|
||||
})
|
||||
|
||||
$('#close_cashier').on('click',function(e){
|
||||
e.preventDefault(); // Prevent the href from redirecting directly
|
||||
var linkURL = '/origami/shift/quick_service/close';
|
||||
warnBeforeRedirect(linkURL);
|
||||
});
|
||||
|
||||
function warnBeforeRedirect(linkURL) {
|
||||
swal({
|
||||
title: "Alert!",
|
||||
text: "Are you sure you want to close cashier?",
|
||||
type: "warning",
|
||||
showCancelButton: true
|
||||
}, function() {
|
||||
// Redirect the user
|
||||
window.location.href = linkURL;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<strong id="order-title"> PENDING ORDER </strong>
|
||||
@@ -97,13 +97,15 @@
|
||||
<% end%>
|
||||
<% else%>
|
||||
<% sub_total = 0
|
||||
total = 0
|
||||
@order_items.each do |order_item|
|
||||
sub_total = sub_total + order_item.price %>
|
||||
total = order_item.qty * order_item.price
|
||||
sub_total = sub_total + total %>
|
||||
<input type="hidden" id="sale_id" value="<%= @bookings.booking_id %>">
|
||||
<tr>
|
||||
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
|
||||
<td class='item-name'><%= order_item.item_name %></td>
|
||||
<td class='item-attr'><%= order_item.qty %></td>
|
||||
<td class='item-attr'><%= order_item.price %></td>
|
||||
<td class='item-attr'><%= total %></td>
|
||||
</tr>
|
||||
<% end%>
|
||||
<% end%>
|
||||
@@ -148,7 +150,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
|
||||
<% if current_user.role != "waiter" || @status != "sale"%>
|
||||
<button type="button" id="addorder" class="btn bg-blue btn-block">Add Order</button>
|
||||
@@ -167,6 +169,9 @@
|
||||
<% if @status != "sale"%>
|
||||
<button type="button" id="request_bills" class="btn btn-block bg-blue waves-effect">Req.Bill</button>
|
||||
<%end%>
|
||||
<% if current_user.role != "waiter" %>
|
||||
<button id="close_cashier" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.close_cashier") %></button>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -207,7 +212,7 @@ $(document).ready(function(){
|
||||
swal("Information!", result.error_message);
|
||||
}
|
||||
else {
|
||||
location.reload();
|
||||
window.location.href = '/origami/quick_service/pending_order';
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -268,5 +273,31 @@ $(document).ready(function(){
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#close_cashier').on('click',function(e){
|
||||
e.preventDefault(); // Prevent the href from redirecting directly
|
||||
var linkURL = '/origami/shift/quick_service/close';
|
||||
warnBeforeRedirect(linkURL);
|
||||
});
|
||||
|
||||
function warnBeforeRedirect(linkURL) {
|
||||
swal({
|
||||
title: "Alert!",
|
||||
text: "Are you sure you want to close cashier?",
|
||||
type: "warning",
|
||||
showCancelButton: true
|
||||
}, function() {
|
||||
// Redirect the user
|
||||
window.location.href = linkURL;
|
||||
});
|
||||
}
|
||||
|
||||
/*edit order in oqs*/
|
||||
$('.edit_order').on('click',function(){
|
||||
var assigned_order_item_id = $(this).attr('data-id');
|
||||
if((assigned_order_item_id!=undefined) && (assigned_order_item_id!='')){
|
||||
window.location.href = '/oqs/'+ assigned_order_item_id + "/edit/pending";
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
</span>
|
||||
</ol>
|
||||
</div> -->
|
||||
<h5>Reedem Payment</h5>
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<div class="card m-l-10 m-t-10" style="padding:0px 20px;">
|
||||
|
||||
@@ -277,9 +277,26 @@
|
||||
<td><%= count %></td>
|
||||
<td class='item-name'>
|
||||
<%= order_item.item_name %>
|
||||
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
|
||||
<% JSON.parse(order_item.options).each do |option| %>
|
||||
<br><span class="font-13">
|
||||
<%= option %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if !order_item.set_menu_items.nil?
|
||||
order_item.set_menu_items.each do |item_instance| %>
|
||||
<br><span class="font-13"><%= item_instance %></span>
|
||||
JSON.parse(order_item.set_menu_items).each do |item_instance| %>
|
||||
<br><span class="font-13">
|
||||
<%= item_instance["item_instance_name"] %>
|
||||
<% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %>
|
||||
<% (item_instance["options"]).each do |set_item_option| %>
|
||||
<br><span class="font-13">
|
||||
<%= set_item_option %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end
|
||||
end %>
|
||||
</td>
|
||||
@@ -345,9 +362,26 @@
|
||||
<td><%= count %>
|
||||
<td class='item-name'>
|
||||
<%= order_item.item_name %>
|
||||
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
|
||||
<% JSON.parse(order_item.options).each do |option| %>
|
||||
<br><span class="font-13">
|
||||
<%= option %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if !order_item.set_menu_items.nil?
|
||||
order_item.set_menu_items.each do |item_instance| %>
|
||||
<br><span class="font-13"><%= item_instance %></span>
|
||||
JSON.parse(order_item.set_menu_items).each do |item_instance| %>
|
||||
<br><span class="font-13">
|
||||
<%= item_instance["item_instance_name"] %>
|
||||
<% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %>
|
||||
<% (item_instance["options"]).each do |set_item_option| %>
|
||||
<br><span class="font-13">
|
||||
<%= set_item_option %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end
|
||||
end %>
|
||||
</td>
|
||||
@@ -416,10 +450,11 @@
|
||||
<!-- <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>
|
||||
<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>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#waste_spoileModal" > Waste & Spoile</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>
|
||||
@@ -431,15 +466,15 @@
|
||||
<% end %>
|
||||
<% if current_login_employee.role != "waiter" %>
|
||||
<!-- first bill not used in cloud -->
|
||||
<% if ENV["SERVER_MODE"] == "cloud" %>
|
||||
<!--<% if ENV["SERVER_MODE"] == "cloud" %>
|
||||
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
||||
<% else %>
|
||||
<% else %>-->
|
||||
<%if @membership.discount && @obj_sale.customer.membership_id %>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#paymentModal">First Bill</button>
|
||||
<%else%>
|
||||
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
||||
<%end%>
|
||||
<%end%>
|
||||
<!-- <%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> -->
|
||||
@@ -455,16 +490,13 @@
|
||||
<h4 class="modal-title" id="paymentModalLabel">Choose Payment</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<select class="form-control show-tick payment_method" multiple="true" id="payment_method" >
|
||||
<option value="Cash">Cash</option>
|
||||
<option value="Credit">Credit</option>
|
||||
<button class='btn waves-effect payment_btn green' data-type='Credit' data-value='Credit'>Credit</button>
|
||||
<% @payment_methods.each do |pay| %>
|
||||
<option value="<%= pay.payment_method %>">
|
||||
<%= pay.payment_method %>
|
||||
</option>
|
||||
<%end %>
|
||||
|
||||
</select>
|
||||
<!-- <option value="<%= pay.payment_method %>">
|
||||
<%= pay.payment_method %>
|
||||
</option> -->
|
||||
<button class='btn btn-lg waves-effect payment_btn green' data-type='<%= pay.payment_method %>' data-value='<%= pay.payment_method %>'><%= pay.payment_method %></button>
|
||||
<%end %>
|
||||
</div>
|
||||
<div class="modal-footer p-r-30">
|
||||
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
@@ -481,6 +513,32 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="waste_spoileModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="waste_spoileModalLabel">Are you sure Waste or Spoile ?</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row p-r-20">
|
||||
<div class="col-md-3">
|
||||
<button type="button" class="btn btn-lg bg-red waves-effect " data-status="waste" value="waste" id="btn_waste" onclick="waste_and_spoilage('waste')"><strong>Waste</strong></button>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<button type="button" class="btn btn-lg bg-red waves-effect " data-status="spoile" value="spoile" id="btn_spoile" onclick="waste_and_spoilage('spoile')"><strong>Spoile</strong></button>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<button type="button" class="btn btn-lg bg-blue waves-effect" data-dismiss="modal"><strong>CLOSE</strong></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer ">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var cashier_type = "cashier";
|
||||
$(document).ready(function(){
|
||||
@@ -646,6 +704,21 @@ $(document).ready(function(){
|
||||
|
||||
});
|
||||
|
||||
// click select option icon for add
|
||||
$(document).on('click', '.payment_btn', function(event){
|
||||
active = $(this).hasClass('selected-payment');
|
||||
value = $(this).data('value');
|
||||
type = $(this).data('type');
|
||||
group = $(this).data('group');
|
||||
payments = $(".payment_btn");
|
||||
|
||||
if (active) {
|
||||
$(this).removeClass('selected-payment');
|
||||
}else{
|
||||
$(this).addClass('selected-payment');
|
||||
}
|
||||
}); //End selecct attribute buttom
|
||||
|
||||
// Print for first bill
|
||||
$("#first_bill").on('click', function(){
|
||||
var sale_id = $('#sale_id').val();
|
||||
@@ -657,7 +730,10 @@ $("#first_bill").on('click', function(){
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
if((receipt_no!=undefined) && (receipt_no!=""))
|
||||
createReceiptNoInFirstBillData(receipt_no,"");
|
||||
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
@@ -666,7 +742,9 @@ $("#first_bill").on('click', function(){
|
||||
$(".choose_payment").on('click', function () {
|
||||
$( "#loading_wrapper").show();
|
||||
var sale_id = $('#sale_id').val();
|
||||
type = $('.payment_method').val();
|
||||
type = get_selected_attributes('selected-payment');
|
||||
|
||||
// type = $('.payment_method').val();
|
||||
if(parseInt(jQuery.inArray("Credit", type)) == -1){
|
||||
if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1 || parseInt(jQuery.inArray("PAYMAL", type)) != -1) {
|
||||
calculate_member_discount(sale_id,"Card");
|
||||
@@ -684,6 +762,12 @@ $(".choose_payment").on('click', function () {
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
if((receipt_no!=undefined) && (receipt_no!=""))
|
||||
createReceiptNoInFirstBillData(receipt_no,type);
|
||||
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
@@ -741,7 +825,7 @@ $('#request_bills').click(function() {
|
||||
//split bill process
|
||||
$('#split_bills').click(function(){
|
||||
var dining_id = "<%= @room.id %>";
|
||||
window.location.href = '/origami/room/' + dining_id + "/split_bills";
|
||||
window.location.href = '/origami/room/' + dining_id + "/" + cashier_type + "/split_bills";
|
||||
});
|
||||
|
||||
$('#move').on('click',function(){
|
||||
@@ -854,7 +938,7 @@ $('#add_invoice').on('click',function(){
|
||||
var sure = confirm("Are you sure want to Void");
|
||||
if (sure == true) {
|
||||
var sale_id = $('#sale_id').val();
|
||||
var ajax_url = "/origami/sale/" + sale_id + '/void';
|
||||
var ajax_url = "/origami/sale/" + sale_id + '/cashier/void';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ajax_url,
|
||||
@@ -910,4 +994,45 @@ $('#add_invoice').on('click',function(){
|
||||
window.location.href = '/oqs/'+ assigned_order_item_id + "/edit/"+dining_id;
|
||||
}
|
||||
});
|
||||
// Get Selected Class
|
||||
function get_selected_attributes(selected_class) {
|
||||
var item_row = $('.'+selected_class);
|
||||
var attribute_arr = [];
|
||||
$(item_row).each(function(i){
|
||||
value = $(item_row[i]).attr('data-value');
|
||||
str = value;
|
||||
attribute_arr.push(str);
|
||||
});
|
||||
return attribute_arr;
|
||||
}
|
||||
|
||||
function waste_and_spoilage(remark) {
|
||||
swal({
|
||||
title: "Alert",
|
||||
text: "Are you sure want to " + remark +" ?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Yes, " +remark+ " it!",
|
||||
closeOnConfirm: false
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||
var url = "/origami/sale/" + sale_id + '/cashier/waste_and_spoilage';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: url,
|
||||
data: "remark="+ remark + "&sale_id=" + sale_id,
|
||||
success: function (result) {
|
||||
console.log(result)
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
window.location.href = '/origami/';
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -331,7 +331,7 @@ var cashier_type = "<%= @cashier_type %>";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_id=' + sale_id,
|
||||
data: 'sale_id=' + sale_id +'&type='+cashier_type,
|
||||
success: function (result) {
|
||||
location.reload();
|
||||
}
|
||||
@@ -345,7 +345,7 @@ var cashier_type = "<%= @cashier_type %>";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_id=' + sale_id,
|
||||
data: 'sale_id=' + sale_id+'&type='+cashier_type,
|
||||
success: function (result) {
|
||||
if (cashier_type=="quick_service") {
|
||||
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<div class="card-text" >
|
||||
<div id="order-detail-slimscroll" data-height="150">
|
||||
<div id="order-detail-slimscroll" data-height="160">
|
||||
<table class="table table-striped second_display_items" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<div class="container-fluid">
|
||||
<div class="container-fluid" style="margin-top:-65px;">
|
||||
<button type="button" class="hidden" id="s_reload">Reload</button>
|
||||
<div class="slider" id="second_display_slider">
|
||||
<%= render 'slider' %>
|
||||
</div>
|
||||
@@ -7,5 +8,12 @@
|
||||
<%= render 'second_display' %>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$('#s_reload').on('click', function () {
|
||||
window.location.href = '/origami/second_display';
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var cashier_type = '<%= @cashier_type %>';
|
||||
$('#close_cashier').on('click',function(){
|
||||
var amount = $('#closing_balance_amount').val();
|
||||
var shift_id = "<%= @shift.id rescue ""%>"
|
||||
@@ -72,7 +73,11 @@
|
||||
});
|
||||
|
||||
$('#back').on('click',function(){
|
||||
window.location.href = '/origami';
|
||||
if(cashier_type!='quick_service'){
|
||||
window.location.href = '/origami';
|
||||
}else{
|
||||
window.location.href = '/origami/quick_service';
|
||||
}
|
||||
});
|
||||
|
||||
/** start CB Card Settle process **/
|
||||
@@ -90,7 +95,7 @@
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/shift/close';
|
||||
window.location.href = '/origami/shift/'+cashier_type+'/close';
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -115,7 +120,7 @@
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/shift/close';
|
||||
window.location.href = '/origami/shift/'+cashier_type+'/close';
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -179,7 +184,7 @@
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/shift/close';
|
||||
window.location.href = '/origami/shift/'+cashier_type+'/close';
|
||||
});
|
||||
// reqCBBankAlipaySettlement();
|
||||
}
|
||||
|
||||
@@ -53,12 +53,14 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% order_item_count = 0 %>
|
||||
<% if !@order_items.nil? %>
|
||||
<% sub_total = 0 %>
|
||||
<% @order_items.each do |order_item| %>
|
||||
<% if order_item.include? ('all_order') %>
|
||||
<% order_item['all_order'].each do |odr_item| %>
|
||||
<%
|
||||
order_item_count = order_item_count.to_i + 1
|
||||
sub_total += odr_item['qty'].to_f * odr_item['price'].to_f
|
||||
%>
|
||||
<tr class="item-row" id=<%= odr_item['order_items_id'] %> >
|
||||
@@ -331,6 +333,7 @@
|
||||
<script type="text/javascript">
|
||||
var split_sale_id = "";
|
||||
var split_receipt_no = "";
|
||||
var cashier_type = '<%= @cashier_type %>';
|
||||
$(document).ready(function(){
|
||||
$('#back').on('click',function(){
|
||||
backToOrigami();
|
||||
@@ -385,10 +388,9 @@
|
||||
|
||||
//order_item_split
|
||||
$('#order_item_split').on('click',function () {
|
||||
var cnt_order_item = "<%= @order_items.count %>";
|
||||
var cnt_order_item = "<%= order_item_count %>";
|
||||
var order_items = get_selected_order_items();// Selected Order Items
|
||||
|
||||
var cnt_items = parseInt(cnt_order_item - 1) - parseInt(order_items.length);
|
||||
var cnt_items = parseInt(cnt_order_item) - parseInt(order_items.length);
|
||||
if (order_items.length > 0){
|
||||
// if(cnt_items > 0){
|
||||
swal({
|
||||
@@ -423,6 +425,7 @@
|
||||
$.each(orders, function(key,value){
|
||||
if($("a[href$='#"+value.order_id+"']").parent().hasClass('selected-split-item')){
|
||||
$("a[href$='#"+value.order_id+"']").parent().removeClass('selected-split-item');
|
||||
$(".item-row").removeClass('selected-split-item');
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -621,22 +624,42 @@ function orderItemSplitBillProcess(cnt_items){
|
||||
if(cnt_items == 0){
|
||||
booking_id = json_booking.booking_id;
|
||||
}
|
||||
console.log(booking_id);
|
||||
|
||||
var order_ids = [];
|
||||
var arr_order_ids = [];
|
||||
if(order_items!=undefined && order_items!=null){
|
||||
$.each(order_items,function(key,value){
|
||||
var orderIds = {};
|
||||
if($.inArray(value.order_id,order_ids) == -1){
|
||||
order_ids.push(value.order_id);
|
||||
orderIds[value.order_id] = 1;
|
||||
arr_order_ids.push(orderIds);
|
||||
}else{
|
||||
if(arr_order_ids != null & arr_order_ids!=""){
|
||||
if(arr_order_ids.length > 0){
|
||||
$.each(arr_order_ids, function(k,val){
|
||||
$.each(val,function(kk,vval){
|
||||
if((val[kk]!= undefined) && (kk == value.order_id)){
|
||||
val[kk] += 1;
|
||||
}
|
||||
});
|
||||
arr_order_ids[k] = val;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// console.log(JSON.stringify(arr_order_ids));
|
||||
|
||||
var ajax_url = "/origami/split_bills";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
dataType: 'JSON',
|
||||
data: {'dining_id' : dining_id, 'type': type, 'customer_id' : customer_id, 'booking_id' : booking_id, 'order_ids' : order_ids, 'order_items' : JSON.stringify(order_items), 'orders' : ''},
|
||||
data: {'cashier_type':cashier_type,'dining_id' : dining_id, 'type': type, 'customer_id' : customer_id, 'booking_id' : booking_id, 'order_ids' : order_ids, 'arr_order_ids': JSON.stringify(arr_order_ids), 'order_items' : JSON.stringify(order_items), 'orders' : ''},
|
||||
success: function (result) {
|
||||
if (!result.status) {
|
||||
swal("Information!", result.error_message);
|
||||
@@ -669,7 +692,7 @@ function orderSplitBillProcess(cnt_orders){
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
dataType: 'JSON',
|
||||
data: {'dining_id' : dining_id, 'type': type, 'customer_id' : customer_id, 'booking_id' : booking_id, 'order_ids' : [], 'order_items' : '', 'orders' : JSON.stringify(orders)},
|
||||
data: {'cashier_type':cashier_type,'dining_id' : dining_id, 'type': type, 'customer_id' : customer_id, 'booking_id' : booking_id, 'order_ids' : [], 'order_items' : '', 'orders' : JSON.stringify(orders), 'arr_order_ids': []},
|
||||
success: function (result) {
|
||||
if (!result.status) {
|
||||
swal("Information!", result.error_message);
|
||||
|
||||
@@ -156,6 +156,15 @@
|
||||
<!-- Column Three -->
|
||||
<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") %>
|
||||
<% if ENV["SERVER_MODE"] == "cloud" %>
|
||||
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
||||
<% else %>
|
||||
<%if @membership.discount && @sale.customer.membership_id %>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#paymentModal">First Bill</button>
|
||||
<%else%>
|
||||
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
||||
<%end%>
|
||||
<% end %>
|
||||
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
|
||||
<button type="button" class="btn bg-deep-purple btn-block" data-toggle="modal" data-target="#focModal" <%= (can? :foc, :payment)? ' ': 'disabled=' %> active="true"> FOC </button>
|
||||
<button type="button" data-toggle="modal" data-target="#voidModal" class="btn bg-danger btn-block" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button>
|
||||
@@ -163,6 +172,38 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- membership paymentmodal -->
|
||||
<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"><%= @sale.customer.membership_id rescue 0%></span>
|
||||
<div class="modal fade" id="paymentModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="paymentModalLabel">Choose Payment</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<select class="form-control show-tick payment_method" multiple="true" id="payment_method" >
|
||||
<option value="Cash">Cash</option>
|
||||
<option value="Credit">Credit</option>
|
||||
<% @payment_methods.each do |pay| %>
|
||||
<option value="<%= pay.payment_method %>">
|
||||
<%= pay.payment_method %>
|
||||
</option>
|
||||
<%end %>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<div class="modal-footer p-r-30">
|
||||
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
|
||||
<button type="button" class="btn btn-link bg-blue waves-effect choose_payment">SAVE</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- membership paymentmodal -->
|
||||
|
||||
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
@@ -212,6 +253,24 @@
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
/* start check first bill or not*/
|
||||
var receipt_no = "";
|
||||
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
}
|
||||
|
||||
discount="<%= @membership.discount%>"
|
||||
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
|
||||
if (discount) {
|
||||
if(checkReceiptNoInFirstBillData(receipt_no,"")){
|
||||
$("#pay").show();
|
||||
}else{
|
||||
$("#pay").hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
/* end check first bill or not*/
|
||||
|
||||
$(".tables").on('click', function(){
|
||||
var dining_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/table/<%= @table.id %>/table_invoice/' + dining_id;
|
||||
@@ -222,6 +281,68 @@ $(document).ready(function(){
|
||||
// window.location.href = '/origami/sale/<%= @sale.id %>/payment';
|
||||
// });
|
||||
|
||||
// Print for first bill
|
||||
$("#first_bill").on('click', function () {
|
||||
var sale_id = '<%= @sale.id %>';
|
||||
var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: ajax_url,
|
||||
success: function (result) {
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
if((receipt_no!=undefined) && (receipt_no!=""))
|
||||
createReceiptNoInFirstBillData(receipt_no,"");
|
||||
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(".choose_payment").on('click', function () {
|
||||
$( "#loading_wrapper").show();
|
||||
|
||||
var sale_id = '<%= @sale.id %>';
|
||||
type = $('.payment_method').val();
|
||||
if(parseInt(jQuery.inArray("Credit", type)) == -1){
|
||||
if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1) {
|
||||
calculate_member_discount(sale_id,"Card");
|
||||
|
||||
}else{
|
||||
calculate_member_discount(sale_id,"Cash");
|
||||
}
|
||||
}
|
||||
var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: ajax_url,
|
||||
success: function (result) {
|
||||
$( "#loading_wrapper" ).hide();
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
if((receipt_no!=undefined) && (receipt_no!=""))
|
||||
createReceiptNoInFirstBillData(receipt_no,type);
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function calculate_member_discount(sale_id,type) {
|
||||
var sub_total = $('#sub-total').text();
|
||||
if (type == "Cash") {
|
||||
is_card = false
|
||||
}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){
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('#pay').on('click',function() {
|
||||
var sale_id = '<%= @sale.id %>';
|
||||
|
||||
@@ -261,7 +382,7 @@ $('#void').on('click',function () {
|
||||
if (isConfirm) {
|
||||
var sale_id = $('#sale_id').val();
|
||||
var remark = $("#remark").val();
|
||||
var ajax_url = "/origami/sale/" + sale_id + '/void';
|
||||
var ajax_url = "/origami/sale/" + sale_id + '/cashier/void';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ajax_url,
|
||||
@@ -291,7 +412,7 @@ $('#foc').click(function() {
|
||||
if ($(this).attr('active')=== "true") {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<%= origami_payment_foc_path %>",
|
||||
url: "/origami/payment/cashier/foc",
|
||||
data: params,
|
||||
success:function(result){
|
||||
if (cash >= 0) {
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
</span>
|
||||
</ol>
|
||||
</div> -->
|
||||
<h5>UNIONPAY Payment</h5>
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<span class="hidden" id="membership_id"><%= @membership_id%></span>
|
||||
@@ -52,7 +51,8 @@
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label>Reference Number</label>
|
||||
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" value="" data-value="<%=@sale_id %>" data-member-value="">
|
||||
<input type="text" name="reference_no" id="reference_no" class="form-control col-lg-7 col-md-7 col-sm-7" value="" data-value="<%=@sale_id %>" data-member-value="">
|
||||
<br><span id="reference_no_Err" style="color:red;"></span>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
@@ -196,10 +196,14 @@
|
||||
});
|
||||
$('#unionpay_pay').on('click',function(){
|
||||
var amount = $('#amount').text();
|
||||
var reference_no = $('#reference_no').val();
|
||||
var sale_id = "<%= @sale_id %>";
|
||||
var receipt_no = "<%= @receipt_no %>";
|
||||
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
|
||||
$(this).off("click");
|
||||
|
||||
$("#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();
|
||||
@@ -219,31 +223,34 @@
|
||||
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,
|
||||
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";
|
||||
});
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_payment_unionpay_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" );
|
||||
}else{
|
||||
swal ( "Oops" , "Enter Amount!" , "error" );
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if (amount>0) {
|
||||
swal ( "Oops" , "Paid Amount is over!" , "error" );
|
||||
}else{
|
||||
swal ( "Oops" , "Enter Amount!" , "error" );
|
||||
}
|
||||
$("#reference_no_Err").html("can't be blank");
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
</span>
|
||||
</ol>
|
||||
</div> -->
|
||||
<h5>VISA Payment</h5>
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<span class="hidden" id="membership_id"><%= @membership_id%></span>
|
||||
@@ -52,7 +51,8 @@
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label>Reference Number</label>
|
||||
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" value="" data-value="<%=@sale_id %>" data-member-value="">
|
||||
<input type="text" name="reference_no" id="reference_no" class="form-control col-lg-7 col-md-7 col-sm-7" value="" data-value="<%=@sale_id %>" data-member-value="">
|
||||
<br><span id="reference_no_Err" style="color:red;"></span>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
@@ -195,11 +195,14 @@
|
||||
});
|
||||
$('#visa_pay').on('click',function(){
|
||||
var amount = $('#amount').text();
|
||||
var reference_no = $('#reference_no').val();
|
||||
var sale_id = "<%= @sale_id %>";
|
||||
var receipt_no = "<%= @receipt_no %>";
|
||||
console.log(amount);
|
||||
console.log($("#validamount").attr("value"));
|
||||
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
|
||||
$("#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();
|
||||
@@ -236,15 +239,18 @@
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment";
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}else{
|
||||
if (amount>0) {
|
||||
swal ( "Oops" , "Paid Amount is over!" , "error" );
|
||||
}else{
|
||||
swal ( "Oops" , "Enter Amount!" , "error" );
|
||||
if (amount>0) {
|
||||
swal ( "Oops" , "Paid Amount is over!" , "error" );
|
||||
}else{
|
||||
swal ( "Oops" , "Enter Amount!" , "error" );
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$("#reference_no_Err").html("can't be blank");
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user