Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -168,9 +168,8 @@
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<!-- OQS Buttons -->
|
||||
<a href="<%= dashboard_path %>" class="btn btn-sm btn-block btn-default waves-effect" role="button" aria-haspopup="true"><i class="material-icons">reply</i> Back </a>
|
||||
<button type="button" title="Print Order Item" id="print_order_item" class="btn bg-blue btn-block btn-lg waves-effect">Print</a>
|
||||
<button type="button" class="btn bg-blue btn-block btn-lg waves-effect" id="print_order_summary">Print <br/>Order<br/>Summary</button>
|
||||
<!-- <button type="button" class="" id="print_order_summary">Print <br/>Order<br/>Summary</button> -->
|
||||
<!-- <button type="button" title="Print Order Item" id="print_order_item" class="btn bg-blue btn-block btn-lg waves-effect">Print</a>
|
||||
<button type="button" class="btn bg-blue btn-block btn-lg waves-effect" id="print_order_summary">Print <br/>Order<br/>Summary</button> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@
|
||||
<div id="save_order_id" data-order="">
|
||||
<% end %>
|
||||
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
|
||||
<% if @booking.checkout_by.nil? && !@booking.reserved_by.nil? && %>
|
||||
<% if @booking.checkout_by.nil? && !@booking.reserved_by.nil? %>
|
||||
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
||||
<% else %>
|
||||
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
||||
@@ -152,7 +152,7 @@
|
||||
<% else %>
|
||||
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title">
|
||||
<div class="row p-l-5 p-r-5">
|
||||
@@ -395,12 +395,16 @@
|
||||
|
||||
<button type="button" id="commissions" class="btn btn-block bg-blue waves-effect">Commissions</button>
|
||||
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
|
||||
|
||||
<%if @membership.discount && @obj_sale.customer.membership_id %>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#paymentModal">First Bill</button>
|
||||
<%else%>
|
||||
<!-- 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>
|
||||
<%end%>
|
||||
<% 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>
|
||||
<button type="button" id="void" class="btn btn-block bg-blue waves-effect" active="<%= can? :overall_void, :void %>"> Void</button>
|
||||
<% end %>
|
||||
@@ -410,6 +414,7 @@
|
||||
<% else %>
|
||||
<button type="button" id="check_in" class="btn btn-block bg-blue waves-effect"><%= t("views.btn.check_in") %></button>
|
||||
<% end %>
|
||||
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
|
||||
<span class="hidden" id="member_discount"><%= @membership.discount%></span>
|
||||
<span class="hidden" id="membership_id"><%= @obj_sale.customer.membership_id rescue 0%></span>
|
||||
<div class="modal fade" id="paymentModal" tabindex="-1" role="dialog">
|
||||
@@ -449,11 +454,14 @@
|
||||
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
}
|
||||
|
||||
// console.log(checkReceiptNoInFirstBillData(receipt_no));
|
||||
if(checkReceiptNoInFirstBillData(receipt_no,"")){
|
||||
$("#pay").show();
|
||||
}else{
|
||||
$("#pay").hide();
|
||||
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
|
||||
if(checkReceiptNoInFirstBillData(receipt_no,"")){
|
||||
$("#pay").show();
|
||||
}else{
|
||||
$("#pay").hide();
|
||||
}
|
||||
}
|
||||
/* end check first bill or not*/
|
||||
|
||||
@@ -524,12 +532,12 @@
|
||||
|
||||
});
|
||||
|
||||
$('#re-print').click(function () {
|
||||
var sale_id = $('#sale_id').val();
|
||||
window.location.href = '/origami/' + sale_id + "/reprint"
|
||||
// $('#re-print').click(function () {
|
||||
// var sale_id = $('#sale_id').val();
|
||||
// window.location.href = '/origami/' + sale_id + "/reprint"
|
||||
|
||||
return false;
|
||||
});
|
||||
// return false;
|
||||
// });
|
||||
|
||||
// Add Other Charges
|
||||
$('#other-charges').click(function () {
|
||||
@@ -590,13 +598,19 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(".choose_payment").on('click', function () {
|
||||
$( "#loading_wrapper").show();
|
||||
|
||||
var sale_id = $('#sale_id').val();
|
||||
type = $('.payment_method').val();
|
||||
if (type != "Credit") {
|
||||
calculate_member_discount(sale_id,type);
|
||||
if(parseInt(jQuery.inArray("Credit", type)) == -1){
|
||||
if (parseInt(jQuery.inArray("MPU", type)) > 0 || parseInt(jQuery.inArray("VISA", type)) > 0 || parseInt(jQuery.inArray("JCB", type)) > 0 || parseInt(jQuery.inArray("Master", type)) > 0 || parseInt(jQuery.inArray("UNIONPAY", type)) > 0 || parseInt(jQuery.inArray("Redeem", type)) > 0) {
|
||||
calculate_member_discount(sale_id,"Card");
|
||||
|
||||
}else{
|
||||
calculate_member_discount(sale_id,"Cash");
|
||||
}
|
||||
}
|
||||
var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
|
||||
$.ajax({
|
||||
@@ -607,11 +621,11 @@
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
if((receipt_no!=undefined) && (receipt_no!=""))
|
||||
createReceiptNoInFirstBillData(receipt_no,type);
|
||||
|
||||
location.reload();
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function calculate_member_discount(sale_id,type) {
|
||||
var sub_total = $('#sub-total').text();
|
||||
if (type == "Cash") {
|
||||
@@ -630,17 +644,6 @@
|
||||
|
||||
}
|
||||
|
||||
// $('#pay').on('click', function () {
|
||||
// var sale_id = $('#sale_id').val();
|
||||
// var url = '/origami/sale/' + sale_id + "/rounding_adj";
|
||||
// $.ajax({
|
||||
// type: "POST",
|
||||
// url: '/origami/sale/' + sale_id + "/rounding_adj",
|
||||
// success: function (result) {
|
||||
// window.location.href = '/origami/sale/' + sale_id + "/payment";
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
$('#pay').on('click', function () {
|
||||
var sale_id = $('#sale_id').val();
|
||||
window.location.href = '/origami/sale/' + sale_id + "/payment";
|
||||
|
||||
@@ -15,84 +15,152 @@
|
||||
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
<div id="custom-slimscroll">
|
||||
<div class="tab-content" style="">
|
||||
<!--- Panel 1 - Table Orders -->
|
||||
<div class="tab-pane active" id="tables" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px;" >
|
||||
<div id="custom-slimscroll">
|
||||
<div class="tab-content" style="">
|
||||
<!--- Panel 1 - Table Orders -->
|
||||
<div class="tab-pane active" id="tables" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px;" >
|
||||
<% @tables.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<% if table.get_booking.nil? %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<div class="card tables red text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
<% else %>
|
||||
<div class="card tables orange text-white" data-id="<%= table.id %>">
|
||||
<% end %>
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<div class="card tables blue text-white" data-id="<%= table.id %>">
|
||||
<% else %>
|
||||
<div class="card tables orange text-white" data-id="<%= table.id %>">
|
||||
<% end %>
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="card tables green text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="card tables green text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
|
||||
<!--- Panel 2 - Room Orders -->
|
||||
<div class="tab-pane" id="rooms" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;" >
|
||||
<% @rooms.each do |room| %>
|
||||
<% if room.status == 'occupied' %>
|
||||
<div class="card rooms red text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
|
||||
<div class="card-block">
|
||||
<%= room.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="card rooms green text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
|
||||
<div class="card-block">
|
||||
<%= room.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Panel 2 - Room Orders -->
|
||||
<div class="tab-pane" id="rooms" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;" >
|
||||
<% @rooms.each do |room| %>
|
||||
<% if room.status == 'occupied' %>
|
||||
<div class="card rooms red text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
|
||||
<div class="card-block">
|
||||
<%= room.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="card rooms green text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
|
||||
<div class="card-block">
|
||||
<%= room.name %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<!--- Panel 3 - s -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Panel 3 - s -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- tabs - End -->
|
||||
</div>
|
||||
<!-- tabs - End -->
|
||||
</div>
|
||||
<!-- Column One -->
|
||||
|
||||
<!-- Column Two -->
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<div class="card" >
|
||||
<div class="card-header">
|
||||
<div><strong id="order-title"> MOVE --> <span style='color:red'> ' <%= @dining.name %> ' </span> to <span style='color:blue' id="moved"> </span></strong></div>
|
||||
<div class="card-header">
|
||||
<div><strong id="order-title"> MOVE --> <span style='color:red'> ' <%= @dining.name %> ' </span> to <span style='color:blue' id="moved"> </span></strong></div>
|
||||
<input type='hidden' id="change_table_value" value="" />
|
||||
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
||||
<% if !@obj_order.nil? %>
|
||||
<div id="save_order_id" data-order="<%= @obj_order.order_id %>">
|
||||
<% else %>
|
||||
<div id="save_order_id" data-order="">
|
||||
<% end %>
|
||||
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
|
||||
<% if @booking.checkout_by.nil? && !@booking.reserved_by.nil? %>
|
||||
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
||||
<% else %>
|
||||
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
||||
<% end %>
|
||||
</div>
|
||||
<% elsif @status_sale == 'sale' %>
|
||||
<div><strong id="order-title">INVOICE DETAILS </strong> | Table <%= @dining.name rescue "" %>
|
||||
<% if !@booking.reserved_by.nil? && %>
|
||||
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
||||
<% else %>
|
||||
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p class="m-l-10"> Receipt No: <span id="receipt_no">
|
||||
<% if @status_sale == 'sale' %>
|
||||
<%= @sale_array[0].receipt_no rescue '' %>
|
||||
<% end %>
|
||||
</span></p>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||
<p class="m-r-10">Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-title row customer_detail hide">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p>Customer : <span id="customer_name"></span></p>
|
||||
</div>
|
||||
<% else %>
|
||||
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title">
|
||||
<div class="row p-l-5 p-r-5">
|
||||
<% if (!@sale_array.empty?) && (!@date.nil?) %>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
Receipt No: <span id="receipt_no">
|
||||
<% if @status_sale == 'sale' %>
|
||||
<%= @sale_array[0].receipt_no rescue '' %>
|
||||
<% end %>
|
||||
</span>
|
||||
<br>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y-%I:%M %p") rescue '-' %></span>
|
||||
<br>
|
||||
</div>
|
||||
<% elsif !@date.nil? %>
|
||||
<div class="col-lg-7 col-md-7 col-sm-7">
|
||||
Order No: <span id="order_no">
|
||||
<% if @status_order == 'order' %>
|
||||
<%= @obj_order.order_id rescue '' %>
|
||||
|
||||
</div>
|
||||
<div id="order-detail-slimscroll" data-height="130">
|
||||
<% end %>
|
||||
</span>
|
||||
<br>
|
||||
</div>
|
||||
<div class="col-lg-5 col-md-5 col-sm-5 text-right">
|
||||
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y") rescue '-' %></span>
|
||||
<br>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row p-l-5 p-r-5">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
|
||||
<% if @status_sale == 'sale' %>
|
||||
<p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p>
|
||||
Customer : <%= @sale_array[0].customer.name rescue '' %>
|
||||
<% elsif @status_order == 'order'
|
||||
%>
|
||||
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
|
||||
Customer : <%= @customer.name rescue "" %>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="order-detail-slimscroll" data-height="130">
|
||||
<div class="card-text" style="" >
|
||||
<table class="table table-striped" id="order-items-table">
|
||||
<thead>
|
||||
@@ -100,56 +168,53 @@
|
||||
<th>#</th>
|
||||
<th class="item-name">Items</th>
|
||||
<th class="item-attr">QTY</th>
|
||||
<th class="item-attr">Price</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
count = 0
|
||||
sub_total = 0
|
||||
if @status_sale == "sale"
|
||||
puts @sale_array[0]
|
||||
@sale_array[0].sale_items.each do |sale_item|
|
||||
count += 1
|
||||
sub_total = sub_total + sale_item.price
|
||||
%>
|
||||
<input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>">
|
||||
<% unless sale_item.price <= 0 %>
|
||||
<tr>
|
||||
<td><%= count %></td>
|
||||
<td class='item-name'><%= sale_item.product_name %></td>
|
||||
<td class='item-attr'><%= sale_item.qty %></td>
|
||||
<td class='item-attr'><%= sale_item.price %></td>
|
||||
</tr>
|
||||
<%
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if @status_order == 'order' && @status_sale != 'sale'
|
||||
unless @order_items.nil?
|
||||
count = 0
|
||||
@order_items.each do |order_item |
|
||||
puts @order_items.size
|
||||
puts "view"
|
||||
<th class="item-attr">Price</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
count = 0
|
||||
sub_total = 0
|
||||
if @status_sale == "sale"
|
||||
@sale_array[0].sale_items.each do |sale_item|
|
||||
count += 1
|
||||
sub_total = sub_total + order_item.price
|
||||
|
||||
unless order_item.price <= 0 %>
|
||||
sub_total = sub_total + sale_item.price
|
||||
%>
|
||||
<input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>">
|
||||
<% unless sale_item.price <= 0 %>
|
||||
<tr>
|
||||
<td><%= count %></td>
|
||||
<td class='item-name'><%= order_item.item_name %></td>
|
||||
<td class='item-attr'><%= order_item.qty %></td>
|
||||
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
|
||||
<td class='item-name'><%= sale_item.product_name %></td>
|
||||
<td class='item-attr'><%= sale_item.qty %></td>
|
||||
<td class='item-attr'><%= sale_item.price %></td>
|
||||
</tr>
|
||||
<%
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if @status_order == 'order' && @status_sale != 'sale'
|
||||
unless @order_items.nil? || @order_items.empty?
|
||||
count = 0
|
||||
@order_items.each do |order_item |
|
||||
count += 1
|
||||
sub_total = sub_total + (order_item.price * order_item.qty)
|
||||
|
||||
#unless order_item.price <= 0 %>
|
||||
<tr>
|
||||
<td><%= count %></td>
|
||||
<td class='item-name'><%= order_item.item_name %></td>
|
||||
<td class='item-attr'><%= order_item.qty %></td>
|
||||
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
|
||||
</tr>
|
||||
<%
|
||||
#end
|
||||
end
|
||||
end
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
end
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
@@ -212,10 +277,10 @@ end
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$(".tables").on('click', function(){
|
||||
$(document).ready(function(){
|
||||
$(".tables").on('click', function(){
|
||||
$('.tables').removeClass('selected-item');
|
||||
$(this).addClass('selected-item');
|
||||
$(this).addClass('selected-item');
|
||||
var dining_name = $(this).attr("data-name");
|
||||
var dining_id = $(this).attr("data-id");
|
||||
var change_from = "<%= @dining.id %>";
|
||||
@@ -227,69 +292,69 @@ $(document).ready(function(){
|
||||
typeAnimated: true,
|
||||
btnClass: 'btn-danger',
|
||||
});*/
|
||||
swal({
|
||||
title: "Alert!!",
|
||||
text: 'Please Select Another Table !',
|
||||
type: 'warning',
|
||||
});
|
||||
}else{
|
||||
$('#moved').text(" ' " + dining_name + " ' ")
|
||||
$('#change_table_value').val(dining_id);
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
$(".rooms").on('click', function(){
|
||||
$('.rooms').removeClass('selected-item');
|
||||
$(this).addClass('selected-item');
|
||||
var dining_name = $(this).attr("data-name");
|
||||
var dining_id = $(this).attr("data-id");
|
||||
var change_from = "<%= @dining.id %>";
|
||||
if (dining_id == change_from) {
|
||||
swal({
|
||||
title: "Alert!!",
|
||||
text: 'Please Select Another Table !',
|
||||
type: 'warning',
|
||||
});
|
||||
title: "Alert!!",
|
||||
text: 'Please Select Another Table !',
|
||||
type: 'warning',
|
||||
});
|
||||
}else{
|
||||
$('#moved').text(" ' " + dining_name + " ' ")
|
||||
$('#change_table_value').val(dining_id);
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
$(".rooms").on('click', function(){
|
||||
$('.rooms').removeClass('selected-item');
|
||||
$(this).addClass('selected-item');
|
||||
var dining_name = $(this).attr("data-name");
|
||||
var dining_id = $(this).attr("data-id");
|
||||
var change_from = "<%= @dining.id %>";
|
||||
if (dining_id == change_from) {
|
||||
swal({
|
||||
title: "Alert!!",
|
||||
text: 'Please Select Another Table !',
|
||||
type: 'warning',
|
||||
});
|
||||
}else{
|
||||
$('#moved').text(dining_name)
|
||||
$('#change_table_value').val(dining_id);
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
$('#move_table').on('click',function(){
|
||||
change_to = $('#change_table_value').val();
|
||||
change_from = "<%= @dining.id %>";
|
||||
if (change_to == ""){
|
||||
swal({
|
||||
title: "Alert!!",
|
||||
text: 'Please Select Table !',
|
||||
type: 'warning',
|
||||
});
|
||||
}else{
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_moving_path %>",
|
||||
data: "change_from="+ change_from + "&change_to=" + change_to,
|
||||
success:function(result){
|
||||
|
||||
swal({
|
||||
$('#move_table').on('click',function(){
|
||||
change_to = $('#change_table_value').val();
|
||||
change_from = "<%= @dining.id %>";
|
||||
if (change_to == ""){
|
||||
swal({
|
||||
title: "Alert!!",
|
||||
text: 'Please Select Table !',
|
||||
type: 'warning',
|
||||
});
|
||||
}else{
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_moving_path %>",
|
||||
data: "change_from="+ change_from + "&change_to=" + change_to,
|
||||
success:function(result){
|
||||
|
||||
swal({
|
||||
title: "Information!",
|
||||
text: 'Moving Success',
|
||||
type: 'success',
|
||||
}, function (){
|
||||
}, function (){
|
||||
if (result.get_type == 'Table'){
|
||||
window.location.href = '/origami/table/' + change_to;
|
||||
}else{
|
||||
window.location.href = '/origami/room/' + change_to;
|
||||
}
|
||||
}else{
|
||||
window.location.href = '/origami/room/' + change_to;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
$('#back').on('click',function(){
|
||||
window.location.href = '/origami/table/'+ "<%= @dining.id %>";
|
||||
})
|
||||
});
|
||||
$('#back').on('click',function(){
|
||||
window.location.href = '/origami/table/'+ "<%= @dining.id %>";
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -26,20 +26,22 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
|
||||
<script type="text/javascript">
|
||||
/* start check first bill or not*/
|
||||
var receipt_no = "";
|
||||
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
}
|
||||
|
||||
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment");
|
||||
if(payment_type) {
|
||||
$(".others-payment").hide();
|
||||
$(payment_type).each(function(i){
|
||||
$("."+payment_type[i]).show();
|
||||
});
|
||||
}
|
||||
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
|
||||
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment");
|
||||
if(payment_type) {
|
||||
$(".others-payment").hide();
|
||||
$(payment_type).each(function(i){
|
||||
$("."+payment_type[i]).show();
|
||||
});
|
||||
}
|
||||
}
|
||||
/* end check first bill or not*/
|
||||
|
||||
$('.others-payment').on('click',function(){
|
||||
|
||||
@@ -298,32 +298,37 @@
|
||||
<button type="button" class="btn bg-red btn-block" id="void" active="<%= can? :overall_void, :void %>"> Void </button>
|
||||
<!-- Waiter Buttons -->
|
||||
</div>
|
||||
|
||||
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
/* start check first bill or not*/
|
||||
var receipt_no = "";
|
||||
var member_id = $('#membership_id').text();
|
||||
var member_discount = $('#member_discount').text();
|
||||
var receipt_no = "";
|
||||
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
}
|
||||
|
||||
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment")
|
||||
// console.log(jQuery.inArray("Credit", payment_type))
|
||||
// console.log(payment_type)
|
||||
if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){
|
||||
$("#credit_payment").hide();
|
||||
} else{
|
||||
$("#credit_payment").show();
|
||||
}
|
||||
console.log(payment_type)
|
||||
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
|
||||
if (member_id && member_discount) {
|
||||
if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){
|
||||
$("#credit_payment").hide();
|
||||
} else{
|
||||
$("#credit_payment").show();
|
||||
}
|
||||
|
||||
if(parseInt(jQuery.inArray("MPU", payment_type)) > 0 || parseInt(jQuery.inArray("VISA", payment_type)) > 0 || parseInt(jQuery.inArray("JCB", payment_type)) > 0 || parseInt(jQuery.inArray("Master", payment_type)) > 0 || parseInt(jQuery.inArray("UNIONPAY", payment_type)) > 0 || parseInt(jQuery.inArray("Redeem", payment_type)) > 0){
|
||||
$("#card_payment").show();
|
||||
} else{
|
||||
$("#card_payment").hide();
|
||||
}
|
||||
if(parseInt(jQuery.inArray("MPU", payment_type)) > 0 || parseInt(jQuery.inArray("VISA", payment_type)) > 0 || parseInt(jQuery.inArray("JCB", payment_type)) > 0 || parseInt(jQuery.inArray("Master", payment_type)) > 0 || parseInt(jQuery.inArray("UNIONPAY", payment_type)) > 0 || parseInt(jQuery.inArray("Redeem", payment_type)) > 0){
|
||||
$("#card_payment").show();
|
||||
} else{
|
||||
$("#card_payment").hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
/* end check first bill or not*/
|
||||
|
||||
var dining_id = "<%= @sale_data.bookings[0].dining_facility_id %>";
|
||||
|
||||
@@ -374,16 +374,14 @@
|
||||
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
|
||||
<!-- <button type="button" class="btn bg-blue btn-block" id='move' disabled="">Move</button> -->
|
||||
<!-- <button type="button" id="request_bills" class="btn bg-blue btn-block" disabled> Req.Bill</button> -->
|
||||
<%if @membership.discount && @obj_sale.customer.membership_id %>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#paymentModal">First Bill</button>
|
||||
<%else%>
|
||||
<!-- 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>
|
||||
<%end%>
|
||||
<% end %>
|
||||
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
|
||||
<button type="button" id="void" class="btn bg-blue btn-block" > Void </button>
|
||||
<% end %>
|
||||
|
||||
|
||||
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
|
||||
<span class="hidden" id="member_discount"><%= @membership.discount%></span>
|
||||
<span class="hidden" id="membership_id"><%= @obj_sale.customer.membership_id rescue 0%></span>
|
||||
<div class="modal fade" id="paymentModal" tabindex="-1" role="dialog">
|
||||
@@ -455,10 +453,12 @@ $(document).ready(function(){
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
}
|
||||
// console.log(checkReceiptNoInFirstBillData(receipt_no));
|
||||
if(checkReceiptNoInFirstBillData(receipt_no,"")){
|
||||
$("#pay").show();
|
||||
}else{
|
||||
$("#pay").hide();
|
||||
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
|
||||
if(checkReceiptNoInFirstBillData(receipt_no,"")){
|
||||
$("#pay").show();
|
||||
}else{
|
||||
$("#pay").hide();
|
||||
}
|
||||
}
|
||||
/* end check first bill or not*/
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@
|
||||
<% if @sale.sale_status != 'void' %>
|
||||
<button type="button" id="void" class="btn bg-danger btn-block">VOID</button>
|
||||
<% end %>
|
||||
<button type="button" id="re-print" class="btn bg-blue btn-block">Re.Print</button>
|
||||
<!-- <button type="button" id="re-print" class="btn bg-blue btn-block">Re.Print</button> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -271,10 +271,10 @@ $('#back').on('click',function(){
|
||||
});
|
||||
});
|
||||
|
||||
$('#re-print').click(function() {
|
||||
var sale_id = $('#sale_id').val();
|
||||
window.location.href = '/origami/'+ sale_id + "/reprint"
|
||||
// $('#re-print').click(function() {
|
||||
// var sale_id = $('#sale_id').val();
|
||||
// window.location.href = '/origami/'+ sale_id + "/reprint"
|
||||
|
||||
return false;
|
||||
});
|
||||
// return false;
|
||||
// });
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user