delete view origami file
This commit is contained in:
9
Gemfile
9
Gemfile
@@ -10,11 +10,11 @@ end
|
|||||||
gem 'rails', '~> 5.1.0'
|
gem 'rails', '~> 5.1.0'
|
||||||
# Use mysql as the database for Active Record
|
# Use mysql as the database for Active Record
|
||||||
|
|
||||||
#gem 'mysql2', '>= 0.3.18', '< 0.5'
|
gem 'mysql2', '>= 0.3.18', '< 0.5'
|
||||||
|
|
||||||
#Use PosgreSQL
|
#Use PosgreSQL
|
||||||
|
|
||||||
gem 'pg'
|
#gem 'pg'
|
||||||
|
|
||||||
|
|
||||||
# redis server for cable
|
# redis server for cable
|
||||||
@@ -46,9 +46,6 @@ gem 'to_xls-rails'
|
|||||||
#Reporting gem
|
#Reporting gem
|
||||||
#gem 'compendium'
|
#gem 'compendium'
|
||||||
|
|
||||||
# Pagination
|
|
||||||
gem 'kaminari', :git => "git://github.com/amatsuda/kaminari.git", :branch => 'master'
|
|
||||||
|
|
||||||
# Use jquery as the JavaScript library
|
# Use jquery as the JavaScript library
|
||||||
gem 'jquery-rails'
|
gem 'jquery-rails'
|
||||||
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
|
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
|
||||||
@@ -63,7 +60,7 @@ gem 'bcrypt', '~> 3.1.7'
|
|||||||
gem 'sidekiq'
|
gem 'sidekiq'
|
||||||
|
|
||||||
# Pagination
|
# Pagination
|
||||||
gem 'kaminari', :git => "git://github.com/amatsuda/kaminari.git", :branch => 'master'
|
gem 'kaminari', '~> 0.16.3'
|
||||||
|
|
||||||
# Use Capistrano for deployment
|
# Use Capistrano for deployment
|
||||||
# gem 'capistrano-rails', group: :development
|
# gem 'capistrano-rails', group: :development
|
||||||
|
|||||||
27
Gemfile.lock
27
Gemfile.lock
@@ -1,21 +1,3 @@
|
|||||||
GIT
|
|
||||||
remote: git://github.com/amatsuda/kaminari.git
|
|
||||||
revision: bc52ae73d41386d344b5d1b18e689e5a988f1a03
|
|
||||||
branch: master
|
|
||||||
specs:
|
|
||||||
kaminari (1.0.1)
|
|
||||||
activesupport (>= 4.1.0)
|
|
||||||
kaminari-actionview (= 1.0.1)
|
|
||||||
kaminari-activerecord (= 1.0.1)
|
|
||||||
kaminari-core (= 1.0.1)
|
|
||||||
kaminari-actionview (1.0.1)
|
|
||||||
actionview
|
|
||||||
kaminari-core (= 1.0.1)
|
|
||||||
kaminari-activerecord (1.0.1)
|
|
||||||
activerecord
|
|
||||||
kaminari-core (= 1.0.1)
|
|
||||||
kaminari-core (1.0.1)
|
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
@@ -104,6 +86,9 @@ GEM
|
|||||||
rails-dom-testing (>= 1, < 3)
|
rails-dom-testing (>= 1, < 3)
|
||||||
railties (>= 4.2.0)
|
railties (>= 4.2.0)
|
||||||
thor (>= 0.14, < 2.0)
|
thor (>= 0.14, < 2.0)
|
||||||
|
kaminari (0.16.3)
|
||||||
|
actionpack (>= 3.0.0)
|
||||||
|
activesupport (>= 3.0.0)
|
||||||
listen (3.0.8)
|
listen (3.0.8)
|
||||||
rb-fsevent (~> 0.9, >= 0.9.4)
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||||
rb-inotify (~> 0.9, >= 0.9.7)
|
rb-inotify (~> 0.9, >= 0.9.7)
|
||||||
@@ -119,11 +104,11 @@ GEM
|
|||||||
minitest (5.10.2)
|
minitest (5.10.2)
|
||||||
multi_json (1.12.1)
|
multi_json (1.12.1)
|
||||||
multi_xml (0.6.0)
|
multi_xml (0.6.0)
|
||||||
|
mysql2 (0.4.6)
|
||||||
nio4r (2.1.0)
|
nio4r (2.1.0)
|
||||||
nokogiri (1.7.2)
|
nokogiri (1.7.2)
|
||||||
mini_portile2 (~> 2.1.0)
|
mini_portile2 (~> 2.1.0)
|
||||||
pdf-core (0.7.0)
|
pdf-core (0.7.0)
|
||||||
pg (0.20.0)
|
|
||||||
prawn (2.2.2)
|
prawn (2.2.2)
|
||||||
pdf-core (~> 0.7.0)
|
pdf-core (~> 0.7.0)
|
||||||
ttfunk (~> 1.5)
|
ttfunk (~> 1.5)
|
||||||
@@ -256,9 +241,9 @@ DEPENDENCIES
|
|||||||
httparty (~> 0.15.5)
|
httparty (~> 0.15.5)
|
||||||
jbuilder (~> 2.5)
|
jbuilder (~> 2.5)
|
||||||
jquery-rails
|
jquery-rails
|
||||||
kaminari!
|
kaminari (~> 0.16.3)
|
||||||
listen (~> 3.0.5)
|
listen (~> 3.0.5)
|
||||||
pg
|
mysql2 (>= 0.3.18, < 0.5)
|
||||||
prawn
|
prawn
|
||||||
prawn-table
|
prawn-table
|
||||||
puma (~> 3.0)
|
puma (~> 3.0)
|
||||||
|
|||||||
@@ -1,367 +0,0 @@
|
|||||||
<div class="row">
|
|
||||||
<!-- Column One -->
|
|
||||||
<div class="col-lg-6 col-md-6 col-sm-8">
|
|
||||||
|
|
||||||
<!-- Nav tabs -->
|
|
||||||
<ul class="nav nav-tabs" role="tablist">
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link active" data-toggle="tab" href="#tables" role="tab">Tables</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" data-toggle="tab" href="#rooms" role="tab">Rooms</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" data-toggle="tab" href="#orders" role="tab">Orders</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<!-- Nav tabs - End -->
|
|
||||||
|
|
||||||
<div class="tab-content" style="min-height:670px; max-height:670px; overflow:auto">
|
|
||||||
|
|
||||||
<!--- Panel 0 - Table Orders -->
|
|
||||||
<div class="tab-pane active" id="tables" role="tabpanel">
|
|
||||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
|
||||||
<%
|
|
||||||
@booking_orders.each do |bko|
|
|
||||||
# Assigned Id for new Order? Sale?
|
|
||||||
unique_id=""
|
|
||||||
# For CSS- Class for Order? Sale?
|
|
||||||
sale_status=""
|
|
||||||
if bko.order_status == 'new'
|
|
||||||
unique_id=bko.booking_id
|
|
||||||
else
|
|
||||||
unique_id=bko.sale_id
|
|
||||||
sale_status="sold"
|
|
||||||
end
|
|
||||||
%>
|
|
||||||
<div class="card orders <%= sale_status %>">
|
|
||||||
<div class="card-block">
|
|
||||||
<p class="hidden orders-id"><%= unique_id %></p>
|
|
||||||
<h4 class="card-title orders-table"><%= bko.table_name %></h4>
|
|
||||||
<p class="card-text">
|
|
||||||
Receipt No :
|
|
||||||
<span class="orders-receipt-no">
|
|
||||||
<%= bko.receipt_no %>
|
|
||||||
</span>
|
|
||||||
</p>
|
|
||||||
<p class="card-text">
|
|
||||||
Order Status :
|
|
||||||
<span class="orders-order-status">
|
|
||||||
<%= bko.order_status %>
|
|
||||||
</span>
|
|
||||||
</small>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<%
|
|
||||||
end
|
|
||||||
%>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!--- Panel 1 - Room Orders -->
|
|
||||||
<div class="tab-pane active" id="rooms" role="tabpanel">
|
|
||||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
|
||||||
<%
|
|
||||||
@booking_rooms.each do |rmo|
|
|
||||||
# Assigned Id for new Order? Sale?
|
|
||||||
unique_id=""
|
|
||||||
# For CSS- Class for Order? Sale?
|
|
||||||
sale_status=""
|
|
||||||
if rmo.order_status == 'new'
|
|
||||||
unique_id=rmo.booking_id
|
|
||||||
else
|
|
||||||
unique_id=rmo.sale_id
|
|
||||||
sale_status="sold"
|
|
||||||
end
|
|
||||||
%>
|
|
||||||
<div class="card orders <%= sale_status %>">
|
|
||||||
<div class="card-block">
|
|
||||||
<p class="hidden orders-id"><%= unique_id %></p>
|
|
||||||
<h4 class="card-title orders-table"><%= rmo.room_name %></h4>
|
|
||||||
<p class="card-text">
|
|
||||||
Receipt No :
|
|
||||||
<span class="orders-receipt-no">
|
|
||||||
<%= rmo.receipt_no %>
|
|
||||||
</span>
|
|
||||||
</p>
|
|
||||||
<p class="card-text">
|
|
||||||
Order Status :
|
|
||||||
<span class="orders-order-status">
|
|
||||||
<%= rmo.order_status %>
|
|
||||||
</span>
|
|
||||||
</small>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<%
|
|
||||||
end
|
|
||||||
%>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!--- Panel 2 - Orders -->
|
|
||||||
<div class="tab-pane active" id="orders" role="tabpanel">
|
|
||||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
|
||||||
<%
|
|
||||||
@orders.each do |odr|
|
|
||||||
# Assigned Id for new Order? Sale?
|
|
||||||
unique_id=""
|
|
||||||
# For CSS- Class for Order? Sale?
|
|
||||||
sale_status=""
|
|
||||||
if odr.order_status == 'new'
|
|
||||||
unique_id=odr.booking_id
|
|
||||||
else
|
|
||||||
unique_id=odr.sale_id
|
|
||||||
sale_status="sold"
|
|
||||||
end
|
|
||||||
%>
|
|
||||||
<div class="card orders <%= sale_status %>">
|
|
||||||
<div class="card-block">
|
|
||||||
<p class="hidden orders-id"><%= unique_id %></p>
|
|
||||||
<h4 class="card-title orders-table"><%= odr.table_name %></h4>
|
|
||||||
<p class="card-text">
|
|
||||||
Receipt No :
|
|
||||||
<span class="orders-receipt-no">
|
|
||||||
<%= odr.receipt_no %>
|
|
||||||
</span>
|
|
||||||
</p>
|
|
||||||
<p class="card-text">
|
|
||||||
Order Status :
|
|
||||||
<span class="orders-order-status">
|
|
||||||
<%= odr.order_status %>
|
|
||||||
</span>
|
|
||||||
</small>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<%
|
|
||||||
end
|
|
||||||
%>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</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">ORDER DETAILS -</strong></div>
|
|
||||||
</div>
|
|
||||||
<div class="card-block">
|
|
||||||
<div class="card-title row">
|
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
|
||||||
<p>Receipt No: <span id="receipt_no"></span></p>
|
|
||||||
<p>Cashier: <span id="cashier"></span></p>
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
|
||||||
<p>Date: <span id="receipt_date"></span></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-text">
|
|
||||||
<table class="table table-striped" id="order-items-table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th class="item-name">Items</th>
|
|
||||||
<th class="item-attr">QTY</td>
|
|
||||||
<th class="item-attr">Price</td>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<!-- Append Javascript Template -->
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<div class="card-footer">
|
|
||||||
<table class="table" id="order-charges-table" border="0">
|
|
||||||
<tr>
|
|
||||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
|
||||||
<td class="item-attr"><strong id="order-sub-total"></strong></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="charges-name"><strong>Food:</strong></td>
|
|
||||||
<td class="item-attr"><strong id="order-food"></strong></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="charges-name"><strong>Beverage:</strong></td>
|
|
||||||
<td class="item-attr"><strong id="order-beverage"></strong></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="charges-name"><strong>Discount:</strong></td>
|
|
||||||
<td class="item-attr"><strong id="order-discount"></strong></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="charges-name"><strong>Tax:</strong></td>
|
|
||||||
<td class="item-attr"><strong id="order-Tax"></strong></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
|
||||||
<td class="item-attr"><strong id="order-grand-total"></strong></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div><p id="sale" value=""></p>
|
|
||||||
<!-- Column Three -->
|
|
||||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
|
||||||
<!-- Waiter Buttons -->
|
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Add Order</button>
|
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Edit</button>
|
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Move</button>
|
|
||||||
<button type="button" id="customer" value="SAL-000000000001" class="btn btn-primary btn-lg btn-block">Customer</button>
|
|
||||||
<button type="button" id="request_bills" class="btn btn-primary btn-lg btn-block">Req.Bill</button>
|
|
||||||
<!-- Cashier Buttons -->
|
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block">Discount</button>
|
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block">Tax</button>
|
|
||||||
<button type="button" id="pay" class="btn btn-primary btn-lg btn-block" >Pay</button>
|
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Re.Print</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
var old_order_id = 0
|
|
||||||
var old_table_name = ""
|
|
||||||
var table_or_order_id = 0
|
|
||||||
var pay_sale_id = 0
|
|
||||||
|
|
||||||
function callOrderDetails(sale_order_id){
|
|
||||||
|
|
||||||
var order_id = 0
|
|
||||||
var sale_id = 0
|
|
||||||
var data_val = ""
|
|
||||||
sale_order = sale_order_id.split("_")[0]
|
|
||||||
|
|
||||||
if (sale_order == 'sale') {
|
|
||||||
order_id = sale_order_id.split("_")[1]
|
|
||||||
url = "origami/"+sale_order_id.split("_")[1]
|
|
||||||
data_val = { sale_id: sale_order_id.split("_")[1]}
|
|
||||||
$("#pay").prop('disabled',false);
|
|
||||||
$("#customer").prop('disabled',false);
|
|
||||||
$("#request_bills").prop('disabled',true);
|
|
||||||
}else{
|
|
||||||
order_id = sale_order_id.split("_")[1]
|
|
||||||
url = "origami/"+order_id
|
|
||||||
data_val = { order_id: sale_order_id.split("_")[1]}
|
|
||||||
$("#request_bills").prop('disabled',false);
|
|
||||||
$("#pay").prop('disabled',true);
|
|
||||||
$("#customer").prop('disabled',true);
|
|
||||||
}
|
|
||||||
|
|
||||||
table_or_order_id = order_id
|
|
||||||
pay_sale_id = sale_id
|
|
||||||
alert(table_or_order_id)
|
|
||||||
var tbody = ""
|
|
||||||
$("#append-table").html("")
|
|
||||||
if (old_order_id != order_id){
|
|
||||||
$("#table-order-"+old_order_id).removeClass("selected_color")
|
|
||||||
$("#table-order-"+order_id).addClass("selected_color")
|
|
||||||
old_order_id = order_id
|
|
||||||
}
|
|
||||||
|
|
||||||
$("#order-detail-header").html("")
|
|
||||||
$("#order-detail-header").append("Table Name : "+document.getElementById("table-name-"+order_id).innerHTML)
|
|
||||||
$("#sub-total").html("")
|
|
||||||
$.ajax({type: "GET",
|
|
||||||
url: url,
|
|
||||||
data: data_val,
|
|
||||||
success:function(result){
|
|
||||||
var sub_total = 0
|
|
||||||
var discount_amount = 0
|
|
||||||
var receipt_no = ""
|
|
||||||
var cashier_name = ""
|
|
||||||
var receipt_date = ""
|
|
||||||
var tax_amount = 0
|
|
||||||
var grand_total_amount = 0
|
|
||||||
row = "<tbody>"
|
|
||||||
for (i = 0; i < result.length; i++) {
|
|
||||||
var data = JSON.stringify(result[i]);
|
|
||||||
var parse_data = JSON.parse(data)
|
|
||||||
sub_total += (parse_data.qty*parse_data.price)
|
|
||||||
row = '<tr><td style="width:60%; text-align:left"><span id="item-name-price">'+parse_data.item_name+"@"+(parse_data.price*1)+'</span></td>'
|
|
||||||
+'<td style="width:20%; text-align:right"><span id="item-qty">'+(parse_data.qty*1)+'</span></td>s'
|
|
||||||
+'<td style="width:20%; text-align:right"><span id="item-total-price">'+(parse_data.qty*parse_data.price)+'</span></td>'
|
|
||||||
+'</tr>>'
|
|
||||||
tbody += row
|
|
||||||
|
|
||||||
discount_amount = result[i].discount_amount;
|
|
||||||
|
|
||||||
tax_amount = result[i].tax_amount;
|
|
||||||
grand_total_amount = result[i].grand_total_amount;
|
|
||||||
|
|
||||||
receipt_no = result[i].receipt_no;
|
|
||||||
cashier_name = result[i].cashier_name;
|
|
||||||
receipt_date = result[i].receipt_date;
|
|
||||||
}
|
|
||||||
row = "</tbody>"
|
|
||||||
$("#append-table").append(tbody)
|
|
||||||
|
|
||||||
$("#sub-total").append((sub_total)+"<br/>")
|
|
||||||
|
|
||||||
if (discount_amount > 0 ) {
|
|
||||||
$("#discount-header").html("(Discount)")
|
|
||||||
$("#discount_amount").html("("+discount_amount+")")
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tax_amount > 0 ) {
|
|
||||||
$("#tax-header").html("Tax")
|
|
||||||
$("#tax_amount").html(tax_amount)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grand_total_amount > 0 ) {
|
|
||||||
$("#grand-total-header").html("Grand Total")
|
|
||||||
$("#grand_total_amount").html(grand_total_amount)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cashier_name == null){
|
|
||||||
cashier_name = ""
|
|
||||||
}
|
|
||||||
if(receipt_no != null){
|
|
||||||
$("#receipt-no").html("Receipt No : "+receipt_no)
|
|
||||||
}
|
|
||||||
if (receipt_date != null) {
|
|
||||||
$("#receipt-date").html("Receipt Date : "+receipt_date);
|
|
||||||
}
|
|
||||||
if (cashier_name != null) {
|
|
||||||
$("#cashier-name").html("Cashier Name : "+cashier_name);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error:function(result){
|
|
||||||
// alert('error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
$( document ).ready(function() {
|
|
||||||
$('#request_bills').click(function() {
|
|
||||||
window.location.href = '/origami/request_bills/'+ table_or_order_id
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$('#pay').click(function() {
|
|
||||||
window.location.href = '/origami/sale/'+ pay_sale_id + "/payment"
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#customer').click(function() {
|
|
||||||
var sale_id = $(this).val();
|
|
||||||
window.location.href = '/crm/customers/'+ sale_id + "/assign_sale_id"
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
<style type="text/css">
|
|
||||||
.selected_color{
|
|
||||||
color:white;
|
|
||||||
background-color: blue;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,328 +0,0 @@
|
|||||||
<div class="row">
|
|
||||||
<div class="col-lg-6 col-md-6 col-sm-8">
|
|
||||||
<!-- Column One -->
|
|
||||||
|
|
||||||
<!-- Nav tabs -->
|
|
||||||
<ul class="nav nav-tabs" role="tablist">
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link active" data-toggle="tab" href="#tables" role="tab">Tables</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" data-toggle="tab" href="#rooms" role="tab">Rooms</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" data-toggle="tab" href="#orders" role="tab">Orders</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<!-- Nav tabs - End -->
|
|
||||||
|
|
||||||
<div class="tab-content" style="min-height:670px; max-height:670px; overflow-y:scroll">
|
|
||||||
<!-- Panel 1 - Tables -->
|
|
||||||
|
|
||||||
<div class="tab-pane active" id="tables" role="tabpanel">
|
|
||||||
<!--- Booking Items -->
|
|
||||||
<div class="card-columns" style="padding-top:10px">
|
|
||||||
|
|
||||||
<% if @booking_orders %>
|
|
||||||
<% @booking_orders.each do |booking_order| %>
|
|
||||||
<% if booking_order.order_status != "new" %>
|
|
||||||
<div style="background-color: red;color: white;" class="card" id="table-order-<%=booking_order.sale_id%>" onclick="callOrderDetails('sale_<%=booking_order.sale_id%>')">
|
|
||||||
<div class="card-block">
|
|
||||||
<h4 class="card-title">
|
|
||||||
<span id="table-name-<%=booking_order.sale_id%>" class="table-name"><%=booking_order.table_name%></span></h4>
|
|
||||||
<span>Receipt No : <%=booking_order.receipt_no%></span><br/>
|
|
||||||
<span>Order Status : <%=booking_order.order_status %></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% else %>
|
|
||||||
<div class="card" id="table-order-<%=booking_order.id%>" onclick="callOrderDetails('order_<%=booking_order.id%>')">
|
|
||||||
<div class="card-block">
|
|
||||||
<h4 class="card-title"><span id="table-name-<%=booking_order.id%>" class="table-name"><%=booking_order.table_name%></span></h4>
|
|
||||||
<span>Order Status : <%=booking_order.order_status %></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
<%end %>
|
|
||||||
<%end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- Panel 1 - Tables - End -->
|
|
||||||
<!-- Panel 2 - Rooms -->
|
|
||||||
<div class="tab-pane" id="rooms" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:scroll">
|
|
||||||
<!--- Booking Items -->
|
|
||||||
<div class="card-columns" style="padding-top:10px">
|
|
||||||
|
|
||||||
<% if @booking_rooms %>
|
|
||||||
<% @booking_rooms.each do |booking_room| %>
|
|
||||||
<% if !booking_room.order_status = 'new'%>
|
|
||||||
<div style="background-color: red;color: white;" class="card" id="table-order-<%=booking_room.id%>" onclick="callOrderDetails('sale_<%=booking_room.id%>')">
|
|
||||||
<div class="card-block">
|
|
||||||
<h4 class="card-title">
|
|
||||||
<span id="table-name-<%=booking_room.id%>" class="table-name"><%=booking_room.room_name%></span></h4>
|
|
||||||
<span>Receipt No : <%=booking_room.receipt_no%></span><br/>
|
|
||||||
<span>Order Status : <%=booking_room.order_status %></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% else %>
|
|
||||||
<div class="card" id="table-order-<%=booking_room.id%>" onclick="callOrderDetails('order_<%=booking_room.id%>')">
|
|
||||||
<div class="card-block">
|
|
||||||
<h4 class="card-title"><span id="table-name-<%=booking_room.id%>" class="table-name"><%=booking_room.room_name%>ddd</span></h4> \
|
|
||||||
<span>Order Status : <%=booking_room.order_status %></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
<%end %>
|
|
||||||
<%end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- Panel 2 - Rooms - End -->
|
|
||||||
<!-- Panel 3 - Orders -->
|
|
||||||
<div class="tab-pane" id="orders" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:scroll">
|
|
||||||
|
|
||||||
<!--- Booking Items -->
|
|
||||||
<div class="card-columns" style="padding-top:10px">
|
|
||||||
|
|
||||||
<% if @orders %>
|
|
||||||
<% @orders.each do |order| %>
|
|
||||||
<% if !order.order_status = 'new'%>
|
|
||||||
<div style="background-color: green;color: white;" class="card" id="table-order-<%=order.order_id%>" onclick="callOrderDetails('sale_<%=order.order_id%>')">
|
|
||||||
<div class="card-block">
|
|
||||||
<h4 class="card-title">
|
|
||||||
<span id="table-name-<%=order.order_id%>" class="table-name">Order No:<%=order.order_id%></span></h4>
|
|
||||||
<span>Receipt No : <%=order.receipt_no%></span><br/>
|
|
||||||
<span>Order Status : <%=order.order_status %></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% else %>
|
|
||||||
<div class="card" id="table-order-<%=order.order_id%>" onclick="callOrderDetails('order_<%=order.order_id%>')">
|
|
||||||
<div class="card-block">
|
|
||||||
<h4 class="card-title"><span id="table-name-<%=order.order_id%>" class="table-name">Order No:<%=order.order_id%></span></h4>
|
|
||||||
<span>Order Status : <%=order.order_status %></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
<%end %>
|
|
||||||
<%end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- Panel 3 - Orders - End -->
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!-- Column Two -->
|
|
||||||
<div class="col-lg-5 col-md-5 col-sm-3">
|
|
||||||
<div class="card" >
|
|
||||||
<div class="card-header">
|
|
||||||
<div id="order-title"><strong><span id="receipt-no">ORDER DETAILS</span></strong>
|
|
||||||
<strong><span id ="receipt-date" style="margin-left: 30%"></span></strong></div><br/>
|
|
||||||
<div ><strong><span id="cashier-name"></span></strong><strong><span style="margin-left: 36%" id="order-detail-header"></span></strong></div>
|
|
||||||
</div>
|
|
||||||
<div class="card-block">
|
|
||||||
<div class="card-title">
|
|
||||||
<table class="table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th style="width:60%; text-align:left">Items</th>
|
|
||||||
<th style="width:20%; text-align:right">QTY</td>
|
|
||||||
<th style="width:20%; text-align:right">Price</td>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<div id="table-details" class="card-text" style="min-height:400px; max-height:400px; overflow-x:scroll">
|
|
||||||
<table class="table" id="append-table">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td style="width:60%; text-align:left">
|
|
||||||
<span id="item-name-price"></span>
|
|
||||||
</td>
|
|
||||||
<td style="width:20%; text-align:right">
|
|
||||||
<span id="item-qty"></span>
|
|
||||||
</td>
|
|
||||||
<td style="width:20%; text-align:right">
|
|
||||||
<span id="item-total-price"></span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<div class="card-footer">
|
|
||||||
<table class="table" style="margin-bottom:0px">
|
|
||||||
<tfooter>
|
|
||||||
<tr>
|
|
||||||
<td style="width:80%; text-align:left; border-top:none"><strong>Sub Total</strong></td>
|
|
||||||
<td style="width:20%; text-align:right; border-top:none"><strong><span id="sub-total"></span></strong></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td style="width:80%; text-align:left; border-top:none"><strong><span id="discount-header"></strong></td>
|
|
||||||
<td style="width:20%; text-align:right; border-top:none"><strong><span id="discount_amount"></span></strong></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td style="width:80%; text-align:left; border-top:none"><strong><span id="tax-header"></strong></td>
|
|
||||||
<td style="width:20%; text-align:right; border-top:none"><strong><span id="tax_amount"></span></strong></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td style="width:80%; text-align:left; border-top:none"><strong><span id="grand-total-header"></strong></td>
|
|
||||||
<td style="width:20%; text-align:right; border-top:none"><strong><span id="grand_total_amount"></span></strong></td>
|
|
||||||
</tr>
|
|
||||||
</tfooter>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- Column Three--->
|
|
||||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
|
||||||
<!-- Waiter Buttons -->
|
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Add Order</button>
|
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Edit</button>
|
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Move</button>
|
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Customer</button>
|
|
||||||
<!-- <button type="button" class="btn btn-primary btn-lg btn-block" disabled>Req.Bill</button> -->
|
|
||||||
<button type="button" id="request_bills" class="btn btn-primary btn-lg btn-block">
|
|
||||||
Req.Bill
|
|
||||||
</button>
|
|
||||||
<!-- Cashier Buttons -->
|
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Discount</button>
|
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Tax</button>
|
|
||||||
<button type="button" id="pay" class="btn btn-primary btn-lg btn-block" >Pay</button>
|
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Re.Print</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script>
|
|
||||||
var old_order_id = 0
|
|
||||||
var old_table_name = ""
|
|
||||||
var table_or_order_id = 0
|
|
||||||
var pay_sale_id = 0
|
|
||||||
|
|
||||||
function callOrderDetails(sale_order_id){
|
|
||||||
var order_id = 0
|
|
||||||
var sale_id = 0
|
|
||||||
var data_val = ""
|
|
||||||
sale_order = sale_order_id.split("_")[0]
|
|
||||||
|
|
||||||
if (sale_order == 'sale') {
|
|
||||||
sale_id = sale_order_id.split("_")[1]
|
|
||||||
url = "origami/"+sale_id
|
|
||||||
data_val = { sale_id: sale_id }
|
|
||||||
sale_or_order_id=sale_id
|
|
||||||
}else{
|
|
||||||
order_id = sale_order_id.split("_")[1]
|
|
||||||
url = "origami/"+order_id
|
|
||||||
data_val = { order_id: sale_order_id.split("_")[1]}
|
|
||||||
sale_or_order_id=order_id
|
|
||||||
}
|
|
||||||
|
|
||||||
table_or_order_id = order_id
|
|
||||||
pay_sale_id = sale_id
|
|
||||||
var tbody = ""
|
|
||||||
|
|
||||||
// clear data in table
|
|
||||||
$("#append-table").html("")
|
|
||||||
|
|
||||||
if (old_order_id != order_id){
|
|
||||||
$("#table-order-"+old_order_id).removeClass("selected_color")
|
|
||||||
$("#table-order-"+order_id).addClass("selected_color")
|
|
||||||
old_order_id = order_id
|
|
||||||
}
|
|
||||||
|
|
||||||
$("#order-detail-header").html("")
|
|
||||||
$("#order-detail-header").append("Table Name : "+document.getElementById("table-name-" + sale_or_order_id).innerHTML)
|
|
||||||
$("#sub-total").html("")
|
|
||||||
$.ajax({type: "GET",
|
|
||||||
url: url,
|
|
||||||
data: data_val,
|
|
||||||
success:function(result){
|
|
||||||
var sub_total = 0
|
|
||||||
var discount_amount = 0
|
|
||||||
var receipt_no = ""
|
|
||||||
var cashier_name = ""
|
|
||||||
var receipt_date = ""
|
|
||||||
var tax_amount = 0
|
|
||||||
var grand_total_amount = 0
|
|
||||||
row = "<tbody>"
|
|
||||||
for (i = 0; i < result.length; i++) {
|
|
||||||
var data = JSON.stringify(result[i]);
|
|
||||||
var parse_data = JSON.parse(data)
|
|
||||||
|
|
||||||
sub_total += (parse_data.qty*parse_data.price)
|
|
||||||
row = '<tr><td style="width:60%; text-align:left"><span id="item-name-price">'+parse_data.item_name+"@"+(parse_data.price*1)+'</span></td>'
|
|
||||||
+'<td style="width:20%; text-align:right"><span id="item-qty">'+(parse_data.qty*1)+'</span></td>s'
|
|
||||||
+'<td style="width:20%; text-align:right"><span id="item-total-price">'+(parse_data.qty*parse_data.price)+'</span></td>'
|
|
||||||
+'</tr>>'
|
|
||||||
tbody += row
|
|
||||||
|
|
||||||
discount_amount = result[i].discount_amount;
|
|
||||||
|
|
||||||
tax_amount = result[i].tax_amount;
|
|
||||||
grand_total_amount = result[i].grand_total_amount;
|
|
||||||
|
|
||||||
receipt_no = result[i].receipt_no;
|
|
||||||
cashier_name = result[i].cashier_name;
|
|
||||||
receipt_date = result[i].receipt_date;
|
|
||||||
}
|
|
||||||
row = "</tbody>";
|
|
||||||
$("#append-table").append(tbody);
|
|
||||||
|
|
||||||
$("#sub-total").append((sub_total)+"<br/>");
|
|
||||||
|
|
||||||
if (discount_amount > 0 ) {
|
|
||||||
$("#discount-header").html("(Discount)");
|
|
||||||
$("#discount_amount").html("("+discount_amount+")");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tax_amount > 0 ) {
|
|
||||||
$("#tax-header").html("Tax");
|
|
||||||
$("#tax_amount").html(tax_amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grand_total_amount > 0 ) {
|
|
||||||
$("#grand-total-header").html("Grand Total")
|
|
||||||
$("#grand_total_amount").html(grand_total_amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cashier_name == null){
|
|
||||||
cashier_name = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
if(receipt_no != null){
|
|
||||||
$("#receipt-no").html("Receipt No : " + receipt_no);
|
|
||||||
}
|
|
||||||
if (receipt_date != null) {
|
|
||||||
$("#receipt-date").html("Receipt Date : "+receipt_date);
|
|
||||||
}
|
|
||||||
if (cashier_name != null) {
|
|
||||||
$("#cashier-name").html("Cashier Name : "+cashier_name);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error:function(result){
|
|
||||||
// alert('error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
$( document ).ready(function() {
|
|
||||||
$('#request_bills').click(function() {
|
|
||||||
console.log(table_or_order_id);
|
|
||||||
window.location.href = '/origami/request_bills/'+ table_or_order_id
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#pay').click(function() {
|
|
||||||
window.location.href = '/origami/sale/'+ pay_sale_id + "/payment"
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
<style type="text/css">
|
|
||||||
.selected_color{
|
|
||||||
color:white;
|
|
||||||
background-color: blue;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
Reference in New Issue
Block a user