add change tax in table/room and check-in for room
This commit is contained in:
@@ -94,7 +94,11 @@
|
||||
<% @rooms.each do |room| %>
|
||||
<% if room.status == 'occupied' %>
|
||||
<% if room.get_booking.nil? %>
|
||||
<% if room.get_checkout_booking.nil? %>
|
||||
<div class="card rooms red text-white table_<%= room.id %>" data-id="<%= room.id %>">
|
||||
<% else %>
|
||||
<div class="card rooms orange text-white table_<%= room.id %>" data-id="<%= room.id %>">
|
||||
<% end %>
|
||||
<div class="card-block">
|
||||
<%= room.name %>
|
||||
<!-- <% if !@order_items_count.nil? %>
|
||||
@@ -106,7 +110,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<% if room.get_checkout_booking.nil? %>
|
||||
<div class="card rooms blue text-white table_<%= room.id %>" data-id="<%= room.id %>">
|
||||
<% else %>
|
||||
<div class="card rooms orange text-white table_<%= room.id %>" data-id="<%= room.id %>">
|
||||
<% end %>
|
||||
<div class="card-block">
|
||||
<%= room.name %>
|
||||
<!-- <% if !@order_items_count.nil? %>
|
||||
@@ -350,15 +358,21 @@
|
||||
</tr>
|
||||
<% if @status_sale == "sale" %>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Tax:
|
||||
(<% @i = 0
|
||||
@account_arr.each do |ct| %>
|
||||
<%=ct.name%>
|
||||
<% if @account_arr.count != @i+1%>
|
||||
<td class="charges-name"><strong>
|
||||
<% if !@sale_taxes.empty? %>
|
||||
Tax:
|
||||
(<% @i = 0
|
||||
@sale_taxes.each do |ct| %>
|
||||
<%=ct.tax_name%>
|
||||
<% if @sale_taxes.count != @i+1%>
|
||||
+ <% @i =+1 %>
|
||||
<%end%>
|
||||
<%end %>)
|
||||
</strong></td>
|
||||
<%end %>)
|
||||
<% else %>
|
||||
No Tax
|
||||
<% end %></strong><br>
|
||||
<button class="btn btn-link waves-effect bg-info change_tax">Change Tax</button>
|
||||
</td>
|
||||
<td class="item-attr"><strong id="order-Tax"><%= @obj_sale.total_tax rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -624,6 +638,61 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- change tax modal -->
|
||||
<div class="modal fade" id="change_taxModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog modal-md" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title" id="change_taxModalLabel">TAX</h1>
|
||||
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<% if !@tax_arr.empty? %>
|
||||
<% if @tax_arr.count > 1 %>
|
||||
<div class="row text-center">
|
||||
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
|
||||
<button type="button" class="btn btn-lg tax-btn-box btn-link bg-primary waves-effect" name="tax_type" data-value="all">
|
||||
<% @i = 0
|
||||
@tax_arr.each do |tax| %>
|
||||
<%= tax %>
|
||||
<% if @tax_arr.count != @i+1%>
|
||||
+ <% @i =+1 %><br>
|
||||
<%end%>
|
||||
<% end %>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<% @tax_arr.each_with_index do |tax, tax_index| %>
|
||||
<% if (tax_index+1)%2 == 0 %>
|
||||
<div class="row clearfix"></div>
|
||||
<% end %>
|
||||
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
|
||||
<button type="button" class="btn btn-lg tax-btn-box btn-link bg-primary waves-effect" name="tax_type" data-value="<%= tax %>">
|
||||
<%= tax %>
|
||||
</button>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="row clearfix"></div>
|
||||
<div class="row text-center">
|
||||
<% @tax_arr.each do |tax| %>
|
||||
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
|
||||
<button type="button" class="btn btn-lg tax-btn-box btn-link bg-primary waves-effect" name="tax_type" data-value="<%= tax %>"><%= tax %></button>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
|
||||
<button type="button" class="btn btn-lg tax-btn-box btn-link bg-primary waves-effect" name="tax_type" data-value="no_tax">No Tax</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var cashier_type = "cashier";
|
||||
$(document).ready(function () {
|
||||
@@ -1165,4 +1234,52 @@
|
||||
});
|
||||
}
|
||||
|
||||
/* Start function for tax changable */
|
||||
$(".change_tax").on("click",function(){
|
||||
var balance = parseFloat($("#order-grand-total").text());
|
||||
var sub_total = parseFloat($("#sub-total").text());
|
||||
var total_tax = parseFloat($("#order-Tax").text());
|
||||
if(balance > 0 && (balance >= total_tax)){
|
||||
$("#change_taxModal").modal({show: true, backdrop: false, keyboard: false});
|
||||
}
|
||||
else{
|
||||
swal("Oops","You cann't change tax!","warning");
|
||||
}
|
||||
});
|
||||
|
||||
$("button[name=tax_type]").on("click", function(){
|
||||
var type = $(this).attr("data-value");
|
||||
var cashier_type = 'cashier';
|
||||
var sale_id = $('#sale_id').text();
|
||||
var dining_id = "<%= @dining.id rescue "" %> ";
|
||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>";
|
||||
localStorage.removeItem("tax_type");
|
||||
swal({
|
||||
title: "Alert",
|
||||
text: "Are you sure want to change tax?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Yes, change it!",
|
||||
closeOnConfirm: false
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/origami/payment/"+cashier_type+"/change_tax",
|
||||
data: {sale_id: sale_id, cashier_type: cashier_type, tax_type: type},
|
||||
success:function(data){
|
||||
if(data.status){
|
||||
// console.log(type);
|
||||
localStorage.setItem("tax_type", type);
|
||||
window.location.href = '/origami/table/'+dining_id;
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
swal.close();
|
||||
}
|
||||
});
|
||||
});
|
||||
/* End function for tax changable */
|
||||
</script>
|
||||
|
||||
@@ -94,7 +94,11 @@
|
||||
<% if room.status == 'occupied' %>
|
||||
|
||||
<% if room.get_booking.nil? %>
|
||||
<% if room.get_checkout_booking.nil? %>
|
||||
<div class="card rooms red text-white table_<%= room.id %>" data-id="<%= room.id %>">
|
||||
<% else %>
|
||||
<div class="card rooms orange text-white table_<%= room.id %>" data-id="<%= room.id %>">
|
||||
<% end %>
|
||||
<div class="card-block">
|
||||
<%= room.name %>
|
||||
<!-- <% if !@order_items_count.nil? %>
|
||||
@@ -107,7 +111,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<% if room.get_checkout_booking.nil? %>
|
||||
<div class="card rooms blue text-white table_<%= room.id %>" data-id="<%= room.id %>">
|
||||
<% else %>
|
||||
<div class="card rooms orange text-white table_<%= room.id %>" data-id="<%= room.id %>">
|
||||
<% end %>
|
||||
<div class="card-block">
|
||||
<%= room.name %>
|
||||
<!-- <% if !@order_items_count.nil? %>
|
||||
@@ -169,7 +177,12 @@
|
||||
<div class="card" >
|
||||
<div class="card-header">
|
||||
<% if @status_order == 'order' %>
|
||||
<div id="save_order_id" data-order="<%= @obj_order.order_id %>"><strong id="order-title">ORDER DETAILS </strong> | Table <%= @room.name rescue "" %>
|
||||
<% 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 <%= @room.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 %>
|
||||
@@ -334,15 +347,21 @@
|
||||
</tr>
|
||||
<% if @status_sale == "sale" %>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Tax:
|
||||
(<% @i = 0
|
||||
@account_arr.each do |ct| %>
|
||||
<%=ct.name%>
|
||||
<% if @account_arr.count != @i+1%>
|
||||
<td class="charges-name"><strong>
|
||||
<% if !@sale_taxes.empty? %>
|
||||
Tax:
|
||||
(<% @i = 0
|
||||
@sale_taxes.each do |ct| %>
|
||||
<%=ct.tax_name%>
|
||||
<% if @sale_taxes.count != @i+1%>
|
||||
+ <% @i =+1 %>
|
||||
<%end%>
|
||||
<%end %>)
|
||||
</strong></td>
|
||||
<%end %>)
|
||||
<% else %>
|
||||
No Tax
|
||||
<% end %></strong><br>
|
||||
<button class="btn btn-link waves-effect bg-info change_tax">Change Tax</button>
|
||||
</td>
|
||||
<td class="item-attr"><strong id="order-Tax"><%= @obj_sale.total_tax rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -443,7 +462,7 @@
|
||||
<button type="button" id="add_order" class="btn btn-block btn- bg-blue waves-effect">Add Order</button>
|
||||
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect">Survey</button>
|
||||
<% if @room.status != "available" %>
|
||||
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
||||
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
||||
<!-- <button type="button" class="btn bg-blue btn-block" >Add Order</button> -->
|
||||
<!-- <button type="button" id="customer" class="btn bg-blue btn-block" disabled>Customer</button> -->
|
||||
<!-- <button type="button" class="btn bg-blue btn-block" disabled >Edit</button> -->
|
||||
@@ -460,8 +479,8 @@
|
||||
<!-- <button type="button" id="first_bill" class="btn bg-blue btn-block" disabled>First Bill</button> -->
|
||||
<!-- <button type="button" id="pay" class="btn bg-blue btn-block" disabled>Pay</button> -->
|
||||
<!-- <button type="button" class="btn bg-blue btn-block" disabled=""> Void </button> -->
|
||||
<% end %>
|
||||
<% if @status_sale == 'sale' %>
|
||||
<% end %>
|
||||
<% if @status_sale == 'sale' %>
|
||||
<!-- <button type="button" class="btn bg-blue btn-block" disabled>Add Order</button> -->
|
||||
<button type="button" id="customer" class="btn bg-blue btn-block" >Customer</button>
|
||||
<% if current_login_employee.role != "waiter" %>
|
||||
@@ -493,37 +512,41 @@
|
||||
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
|
||||
<% end %>
|
||||
<!-- <button type="button" id="void" class="btn bg-blue btn-block" > Void </button> -->
|
||||
<% end %>
|
||||
<% if current_login_employee.role != "waiter" %>
|
||||
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
|
||||
<span class="hidden" id="member_discount"><%= @membership.discount%></span>
|
||||
<span class="hidden" id="membership_id"><%= @obj_sale.customer.membership_id rescue 0%></span>
|
||||
<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">
|
||||
<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 %>
|
||||
</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>
|
||||
<!-- Cashier Buttons -->
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if current_login_employee.role != "waiter" %>
|
||||
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
|
||||
<span class="hidden" id="member_discount"><%= @membership.discount%></span>
|
||||
<span class="hidden" id="membership_id"><%= @obj_sale.customer.membership_id rescue 0%></span>
|
||||
<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">
|
||||
<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 %>
|
||||
</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>
|
||||
<!-- Cashier Buttons -->
|
||||
<% end %>
|
||||
<!-- <button type="button" id="re-print" class="btn bg-blue btn-block" >Re.Print</button> -->
|
||||
<% else %>
|
||||
<% if !@checkout_time.empty? && !@checkout_alert_time.empty? %>
|
||||
<button type="button" id="check_in" class="btn btn-block bg-blue waves-effect"><%= t("views.btn.check_in") %></button>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -610,6 +633,61 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- change tax modal -->
|
||||
<div class="modal fade" id="change_taxModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog modal-md" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title" id="change_taxModalLabel">TAX</h1>
|
||||
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<% if !@tax_arr.empty? %>
|
||||
<% if @tax_arr.count > 1 %>
|
||||
<div class="row text-center">
|
||||
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
|
||||
<button type="button" class="btn btn-lg tax-btn-box btn-link bg-primary waves-effect" name="tax_type" data-value="all">
|
||||
<% @i = 0
|
||||
@tax_arr.each do |tax| %>
|
||||
<%= tax %>
|
||||
<% if @tax_arr.count != @i+1%>
|
||||
+ <% @i =+1 %><br>
|
||||
<%end%>
|
||||
<% end %>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<% @tax_arr.each_with_index do |tax, tax_index| %>
|
||||
<% if (tax_index+1)%2 == 0 %>
|
||||
<div class="row clearfix"></div>
|
||||
<% end %>
|
||||
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
|
||||
<button type="button" class="btn btn-lg tax-btn-box btn-link bg-primary waves-effect" name="tax_type" data-value="<%= tax %>">
|
||||
<%= tax %>
|
||||
</button>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="row clearfix"></div>
|
||||
<div class="row text-center">
|
||||
<% @tax_arr.each do |tax| %>
|
||||
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
|
||||
<button type="button" class="btn btn-lg tax-btn-box btn-link bg-primary waves-effect" name="tax_type" data-value="<%= tax %>"><%= tax %></button>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
|
||||
<button type="button" class="btn btn-lg tax-btn-box btn-link bg-primary waves-effect" name="tax_type" data-value="no_tax">No Tax</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var cashier_type = "cashier";
|
||||
$(document).ready(function(){
|
||||
@@ -1206,4 +1284,69 @@ $('#add_invoice').on('click',function(){
|
||||
});
|
||||
}
|
||||
|
||||
/* check in process */
|
||||
$('#check_in').on('click',function(){
|
||||
var room_id = "<%= @room.id %>";
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
data: {'dining_id' : room_id},
|
||||
datatype: 'JSON',
|
||||
url: '/origami/check_in',
|
||||
success: function(data) {
|
||||
if(data.status == 'ok'){
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/* Start function for tax changable */
|
||||
$(".change_tax").on("click",function(){
|
||||
var balance = parseFloat($("#order-grand-total").text());
|
||||
var sub_total = parseFloat($("#sub-total").text());
|
||||
var total_tax = parseFloat($("#order-Tax").text());
|
||||
if(balance > 0 && (balance >= total_tax)){
|
||||
$("#change_taxModal").modal({show: true, backdrop: false, keyboard: false});
|
||||
}
|
||||
else{
|
||||
swal("Oops","You cann't change tax!","warning");
|
||||
}
|
||||
});
|
||||
|
||||
$("button[name=tax_type]").on("click", function(){
|
||||
var type = $(this).attr("data-value");
|
||||
var cashier_type = 'cashier';
|
||||
var sale_id = $('#sale_id').text();
|
||||
var dining_id = "<%= @room.id rescue "" %> ";
|
||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>";
|
||||
localStorage.removeItem("tax_type");
|
||||
swal({
|
||||
title: "Alert",
|
||||
text: "Are you sure want to change tax?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Yes, change it!",
|
||||
closeOnConfirm: false
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/origami/payment/"+cashier_type+"/change_tax",
|
||||
data: {sale_id: sale_id, cashier_type: cashier_type, tax_type: type},
|
||||
success:function(data){
|
||||
if(data.status){
|
||||
// console.log(type);
|
||||
localStorage.setItem("tax_type", type);
|
||||
window.location.href = '/origami/room/'+dining_id;
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
swal.close();
|
||||
}
|
||||
});
|
||||
});
|
||||
/* End function for tax changable */
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user