fix foodcourt sales transaction
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
if @status == true
|
||||
json.status :success
|
||||
json.id @order.id
|
||||
json.booking_id @booking.id
|
||||
json.order_id @order.id
|
||||
json.order_items do
|
||||
json.array! @order.order_items, :item_code, :item_name, :qty, :options, :remark
|
||||
end
|
||||
if @sale
|
||||
json.sale_id @sale.sale_id
|
||||
end
|
||||
else
|
||||
json.status :error
|
||||
if @error_messages
|
||||
|
||||
@@ -167,7 +167,7 @@
|
||||
Orders
|
||||
</button>
|
||||
<button class="btn btn-lg bg-blue waves-effect select_table col-md-3" data-toggle="modal" data-target="#TableModal">Select</button>
|
||||
|
||||
|
||||
<div class="row ">
|
||||
<div class="col-md-9 col-lg-9 col-sm-9 ">
|
||||
<strong id="order-title" class="font-14 p-l-10">ORDER DETAILS </strong>
|
||||
@@ -432,80 +432,53 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="TableModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header" style="margin-top: -1rem;">
|
||||
<!-- <h4 class="modal-title" id="TableModalLabel">Select Table</h4> -->
|
||||
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;">×</button>
|
||||
</div>
|
||||
<div class="modal-body" style="margin-top: -0.75rem;padding-top:5px">
|
||||
<%@zone.each do |zone| %>
|
||||
<h5>Zone : <%=zone.name%></h5>
|
||||
<div class="card-columns" style="column-count: 7;">
|
||||
<%zone.tables.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<% if table.get_booking.nil? %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<% color="red"%>
|
||||
<% else %>
|
||||
<% color="orange"%>
|
||||
<% end %>
|
||||
|
||||
<% else %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<% color="blue"%>
|
||||
<% else %>
|
||||
<% color="orange"%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% color="green"%>
|
||||
<% end %>
|
||||
<div class="card tables <%=color%> text-white table_<%= table.id %>" data-id="<%= table.id %>" data-type="<%= table.type %>" data-name="<%= table.name %>">
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
</div>
|
||||
</div>
|
||||
<%end%>
|
||||
|
||||
<%zone.rooms.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<% if table.get_booking.nil? %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<% color="red"%>
|
||||
<% else %>
|
||||
<% color="orange"%>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<% color="blue"%>
|
||||
<% else %>
|
||||
<% color="orange"%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% color="green"%>
|
||||
<% end %>
|
||||
<div class="card tables <%=color%> text-white table_<%= table.id %>" data-id="<%= table.id %>" data-type="<%= table.type %>" data-name="<%= table.name %>">
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
</div>
|
||||
</div>
|
||||
<%end%>
|
||||
</div>
|
||||
<%end%>
|
||||
<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 confirm_table" data-dismiss="modal">Confirm</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="TableModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header" style="margin-top: -1rem;">
|
||||
<!-- <h4 class="modal-title" id="TableModalLabel">Select Table</h4> -->
|
||||
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;">×</button>
|
||||
</div>
|
||||
<div class="modal-body" style="margin-top: -0.75rem;padding-top:5px">
|
||||
<%@zone.each do |zone| %>
|
||||
<h5>Zone : <%=zone.name%></h5>
|
||||
<div class="card-columns" style="column-count: 7;">
|
||||
<%zone.tables.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<% color="red"%>
|
||||
<% else %>
|
||||
<% color="green"%>
|
||||
<% end %>
|
||||
<div class="card tables <%=color%> text-white table_<%= table.id %>" data-id="<%= table.id %>" data-type="<%= table.type %>" data-name="<%= table.name %>">
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%end%>
|
||||
|
||||
<%zone.rooms.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<% color="red"%>
|
||||
<% else %>
|
||||
<% color="green"%>
|
||||
<% end %>
|
||||
<div class="card tables <%=color%> text-white table_<%= table.id %>" data-id="<%= table.id %>" data-type="<%= table.type %>" data-name="<%= table.name %>">
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
</div>
|
||||
</div>
|
||||
<%end%>
|
||||
</div>
|
||||
<%end%>
|
||||
<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 confirm_table" data-dismiss="modal">Confirm</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="server_mode" value="<%=ENV["SERVER_MODE"]%>" id="server_mode">
|
||||
</div>
|
||||
@@ -555,7 +528,7 @@ $(document).ready(function () {
|
||||
$('#table_type').text(type);
|
||||
$('.select_table').text(name);
|
||||
});
|
||||
$('#app_order').on('click', function () {
|
||||
$('#app_order').on('click', function () {
|
||||
window.location.href = '/en/foodcourt/app_orders';
|
||||
});
|
||||
|
||||
@@ -574,7 +547,7 @@ $(document).ready(function () {
|
||||
show_menu_cat_list(name, url);
|
||||
}
|
||||
});
|
||||
//End menu category Click
|
||||
//End menu category Click
|
||||
|
||||
function getAllMenu(){
|
||||
$.ajax({
|
||||
|
||||
@@ -201,7 +201,7 @@
|
||||
<div class="card-block h-100 d-flex flex-column">
|
||||
<div>
|
||||
<span class="font-14 float-left d-inline"><b>Booking</b> - <%=@booking.booking_id%></span>
|
||||
<span class="font-14 float-right d-inline"><b>Order No</b> - <%=@booking.order_id%></span>
|
||||
<span class="font-14 float-right d-inline"><b>Order No</b> - <%=@booking.order_id%></span>
|
||||
</div>
|
||||
<div class="card-text h-100" id="foodcourt-table-slimscroll" style="overflow-y: auto">
|
||||
<table class="table table-striped summary-items fixed-header">
|
||||
@@ -271,12 +271,17 @@
|
||||
<div class="card" style="height: 100%; margin-bottom: 10px;">
|
||||
<div class="card-header">
|
||||
<div>
|
||||
<strong id="order-title">INVOICE DETAILS </strong>| Table - <%= @pending.dining_facility.name rescue "" %>
|
||||
<% if @status == 'sale' %>
|
||||
<% table_name = @pending.try(:booking).try(:dining_facility).try(:name) %>
|
||||
<% elsif @status == 'order' %>
|
||||
<% table_name = @pending.try(:dining_facility).try(:name) %>
|
||||
<% end %>
|
||||
<strong id="order-title">INVOICE DETAILS </strong>| Table - <%= table_name %>
|
||||
</div>
|
||||
<div class="row p-l-5 p-r-5">
|
||||
<% if @status == 'sale' || @pending.try(:sale_status) == 'completed' || @pending.try(:sale_status) == 'void' %>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
Receipt No:
|
||||
Receipt No:
|
||||
<span id="receipt_no">
|
||||
<%= @pending.receipt_no rescue '' %>
|
||||
</span>
|
||||
@@ -380,7 +385,7 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
@@ -440,7 +445,7 @@
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
|
||||
@@ -757,53 +757,32 @@ $(document).ready(function(){
|
||||
var sale_id = $('#sale_id').text();
|
||||
// var item_row = $('.is_card');
|
||||
|
||||
// payment
|
||||
var cash = $('#cash').text();
|
||||
var credit = $('#credit').text();
|
||||
var card = $('#card').text();
|
||||
var kbz_amt = "<%= @kbz_pay_amount %>";
|
||||
var is_kbz = false;
|
||||
if (kbz_amt > 0) {
|
||||
is_kbz = true
|
||||
}
|
||||
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||
var receipt_no = ($("#receipt_no").html()).trim();
|
||||
deleteReceiptNoInFirstBillData(receipt_no);
|
||||
}
|
||||
|
||||
var tax_type = localStorage.getItem("tax_type") ? localStorage.getItem("tax_type") : 'all';
|
||||
// calculate_member_discount(sale_id,tax_type);
|
||||
/* check credit payment or not*/
|
||||
var url = "<%= foodcourt_payment_cash_path %>";
|
||||
$.ajax({type: "POST",
|
||||
url: url,
|
||||
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type + "&tax_type=" + tax_type + "&is_kbz=" + is_kbz+"&account_no="+customer_mamber_card_no,
|
||||
success:function(result) {
|
||||
/* start delete receipt no in first bill*/
|
||||
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||
var receipt_no = ($("#receipt_no").html()).trim();
|
||||
deleteReceiptNoInFirstBillData(receipt_no);
|
||||
}
|
||||
/* end delete receipt no in first bill*/
|
||||
localStorage.removeItem("cash");
|
||||
swal({
|
||||
title: "Payment Successful!",
|
||||
text: "Thank You !",
|
||||
type: 'success',
|
||||
html: true,
|
||||
closeOnConfirm: true,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
},
|
||||
function (isConfirm) {
|
||||
$("#loading_wrapper").show();
|
||||
$('.confirm').attr("disabled","disabled");
|
||||
window.location.href = "<%= foodcourt_food_court_path %>";
|
||||
});
|
||||
$("#loading_wrapper").hide();
|
||||
}
|
||||
});
|
||||
$("#loading_wrapper").hide();
|
||||
|
||||
var second_display_lookup = $("#display_type").val();
|
||||
if ($('#server_mode').val() != "cloud" && second_display_lookup == 2){
|
||||
customer_display_view(null,"reload");
|
||||
}
|
||||
|
||||
swal({
|
||||
title: "Payment Successful!",
|
||||
text: "Thank You !",
|
||||
type: 'success',
|
||||
html: true,
|
||||
closeOnConfirm: true,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
},
|
||||
function (isConfirm) {
|
||||
$("#loading_wrapper").show();
|
||||
$('.confirm').attr("disabled","disabled");
|
||||
window.location.href = "<%= foodcourt_food_court_path %>";
|
||||
});
|
||||
} else {
|
||||
var insufficient_message = result.message + '<br> Card balance : ' + customer_card_balance
|
||||
swal({
|
||||
@@ -815,7 +794,7 @@ $(document).ready(function(){
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
location.reload();
|
||||
window.location.href = '/foodcourt/food_court';
|
||||
});
|
||||
$("#loading_wrapper").hide();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user