UI updated

This commit is contained in:
Yan
2017-06-01 18:37:15 +06:30
parent 356923a9d8
commit f28f0bf292
5 changed files with 149 additions and 90 deletions

View File

@@ -15,7 +15,7 @@ gem 'mysql2', '>= 0.3.18', '< 0.5'
#gem 'pg'
# redis server for cable
gem 'redis', '~> 3.0'
# gem 'redis', '~> 3.0'
# Use Puma as the app server
gem 'puma', '~> 3.0'

View File

@@ -119,7 +119,6 @@ GEM
nokogiri (1.7.2)
mini_portile2 (~> 2.1.0)
pdf-core (0.7.0)
pg (0.20.0)
prawn (2.2.2)
pdf-core (~> 0.7.0)
ttfunk (~> 1.5)
@@ -253,13 +252,11 @@ DEPENDENCIES
kaminari!
listen (~> 3.0.5)
mysql2 (>= 0.3.18, < 0.5)
pg
prawn
prawn-table
puma (~> 3.0)
rack-cors
rails (~> 5.1.0)
redis (~> 3.0)
rspec-rails (~> 3.5)
sass-rails (~> 5.0)
schema_to_scaffold

View File

@@ -17,21 +17,32 @@
//= require cable
$(document).ready(function(){
$('.queue_station').on('click',function(){
var title=$(this).children().children('.card-title').text();
var titles=title.split(' ');
$('.queue_station').on('click',function(){
var orderZone=$(this).children().children().children('.order-zone').text();
var orderItem=$(this).children().children().children('.order-item').text();
var orderQty=$(this).children().children().children('.order-qty').text();
var orderBy=$(this).children().children().children().children('.order-by').text();
var orderAt=$(this).children().children().children().children('.order-at').text();
var orderCustomer=$(this).children().children('.order-customer').text();
$('#order-title').text($('#order-title').text() + titles[0]);
$('#order-title').text("ORDER DETAILS - " + orderZone);
$('#order-by').text(orderBy);
$('#order-at').text(orderAt);
$('#order-customer').text(orderCustomer);
$('#order-from').text(titles[0]);
$('#order-from').text(orderZone);
$('#order-items').text(titles[1]);
$('#order-qty').text(titles[2].substr(2).replace(']',''));
$('#order-items').text(orderItem);
$('#order-qty').text(orderQty);
});
// complete for queue item
$('.order-complete').on('click',function(){
var assigned_item_id=$(this).attr('id').substr(15);
$.ajax({
url: "",
data: ""
}).done(function(){
});
});
});

View File

@@ -1,31 +1,47 @@
class Oqs::HomeController < BaseOqsController
def index
@queue_stations=OrderQueueStation.all
@queue_items_details = queue_items_query('false')
#sample Data
@queue_items_details = { :queue_id => 1, :order_id => 1, :station_name => 'Queue Station 1', :zone => 'Table4', :item_name => 'beef', :price => 10.00, :qty => 2, :customer => 'Wathon', :item_order_by => 'Yan', :created_at => '2007-05-17'}
# @queue_items_details = OrderItem.select("oqs as queue_id, oqs.station_name, oqs.is_active, oqpz.zone_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.created_at")
# .joins("join order_queue_process_by_zones as oqpz ON oqpz.order_queue_station_id = order_queue_items.order_queue_station_id")
# .joins("right join order_queue_stations as oqs ON oqs.id = order_queue_items.order_queue_station_id")
# .joins("right join orders as od ON od.id = order_queue_items.order_id")
# .joins("right join order_items as odt ON odt.item_code = order_queue_items.item_code")
# .order("odt.item_name DESC")
@queue_completed_item = queue_items_query('true')
@queue_stations_items=Array.new
# Calculate Count for each station tab
@queue_stations.each do |que|
i=0
@queue_items_details.each do |qid|
if qid.station_name == que.station_name
i+=1
@queue_stations_items.push({:station_name => que.station_name ,:item_count => i })
break
end
end
end
# Order.select("orders.id as order_id,sum(order_items.qty*order_items.price) as total_price,
# order_items.id as order_items_id,dining_facilities.name as table_name")
# .joins("left join booking_orders on booking_orders.order_id = orders.id
# left join bookings on bookings.id = booking_orders.id
# left join dining_facilities on dining_facilities.id = bookings.dining_facility_id
# left join order_items on order_items.order_id = orders.id")
# .where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,"dine_in",true)
# .group("orders.id")
@queue_stations_items
end
def show
end
def update_delivery_status
end
# Query for OQS with status
def queue_items_query(status)
AssignedOrderItem.select("assigned_order_items.id, oqs.station_name, oqs.is_active, df.name as zone, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, cus.name as customer_name, odt.created_at")
.joins("join order_queue_process_by_zones as oqpz ON oqpz.order_queue_station_id = assigned_order_items.order_queue_station_id
left join dining_facilities as df on df.zone_id = oqpz.zone_id
left join order_queue_stations as oqs ON oqs.id = assigned_order_items.order_queue_station_id
left join orders as od ON od.id = assigned_order_items.order_id
left join order_items as odt ON odt.item_code = assigned_order_items.item_code
left join customers as cus ON cus.id = od.customer_id")
.where('assigned_order_items.delivery_status=' + status)
.group('oqs.station_name')
.order("odt.item_name DESC")
end
end

View File

@@ -1,14 +1,16 @@
<div class="row">
<div class="col-lg-8 col-md-8 col-sm-8">
<!-- Column One -->
<!-- Column One -->
<div class="col-lg-8 col-md-8 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="#completed" role="tab">Processed <span class="badge badge-pill badge-default">2000</span></a>
<a class="nav-link active" data-toggle="tab" href="#completed" role="tab">Processed <span class="badge badge-pill badge-default"><%= @queue_completed_item.length %></span></a>
</li>
<%
<%
# For Tab Disable for Station is inactive
status=""
@queue_stations.each do |que|
if que.is_active == false
@@ -16,76 +18,111 @@
end
%>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href=<%= '#' + que.station_name %> role="tab" <%= status %>><%= que.station_name %><span class="badge badge-pill badge-default">18</span></a>
<a class="nav-link" data-toggle="tab" href=<%= '#' + que.station_name.gsub(' ', '_') %> role="tab" <%= status %>>
<%= que.station_name %>
<%
@queue_stations_items.each do |qsi|
if qsi[:station_name] == que.station_name
%>
<span class="badge badge-pill badge-default"><%= qsi[:item_count] %></span>
<%
end
end
%>
</a>
</li>
<% end %>
</ul>
<!-- Nav tabs - End -->
<div class="tab-content" style="min-height:670px; max-height:670px; overflow-y:scroll">
<div class="tab-content" style="min-height:670px; max-height:670px; overflow:auto">
<!--- Panel 0 - Completed -->
<div class="tab-pane active" id="completed" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:scroll">
<div class="card-columns" style="padding-top:10px">
<div class="card">
<div class="card-block order-completed">
<h4 class="card-title">9. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text">
<small class="text-muted">Order at 12:23, Kyaw Lwin</small> |
<small class="text-muted">Printed at 12:23</small> |
<small class="text-muted">Completed at 12:43</small>
</p>
</div>
</div>
<!-- <div class="card">
<div class="card-block order-void">
<h4 class="card-title">9. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">9. Table 4 - Beef Steak [x3]</h4>
<p class="card-text">Well Done, Fries, Salad</p>
<p class="card-text"><small class="text-muted">Order at 12:23, Kyaw Lwin</small></p>
</div>
</div> -->
<div class="tab-pane active" id="completed" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<%
@queue_completed_item.each do |qid|
%>
<div class="card queue_station">
<div class="card-block">
<h4 class="card-title">
<span class="order-zone">
<%= qid.zone %>
</span> -
<span class="order-item">
<%= qid.item_name %>
</span> [x
<span class="order-qty">
<%= qid.qty %>
</span> ]
</h4>
<p class="card-text">Medium, Fries, Salad</p>
<p class="card-text">
<small class="text-muted">Order at
<span class="order-at">
<%= qid.created_at.strftime("%Y %m %d") %>
</span> -
<span class="order-by">
<%= qid.item_order_by %>
</span>
</small>
</p>
<p class="hidden order-customer"><%= qid.customer_name %></p>
</div>
<!-- <div class="card-footer">
<button id=<%= 'assigned_queue_' + qid.id.to_s %> class="btn btn-primary btn-lg btn-block order-complete">COMPLETE</button>
</div> -->
</div>
<%
end
%>
</div>
</div>
<!-- End Panel 0 - Completed -->
<%
<!-- Order Item for Queue Station -->
<%
@queue_stations.each do |que|
%>
<!-- Generated Pane -->
<div class="tab-pane" id=<%= que.station_name %> role="tabpanel">
<div class="tab-pane" id=<%= que.station_name.gsub(' ', '_') %> role="tabpanel">
<!--- Order Items -->
<div class="card-columns" style="padding-top:10px">
<%
if @queue_items_details[:station_name] == que.station_name
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<%
@queue_items_details.each do |qid|
if qid.station_name == que.station_name
%>
<div class="card queue_station">
<div class="card-block">
<h4 class="card-title"><%= @queue_items_details[:zone] + ' ' + @queue_items_details[:item_name] + ' [x' + @queue_items_details[:qty].to_s + ']' %></h4>
<h4 class="card-title">
<span class="order-zone">
<%= qid.zone %>
</span> -
<span class="order-item">
<%= qid.item_name %>
</span> [x
<span class="order-qty">
<%= qid.qty %>
</span> ]
</h4>
<p class="card-text">Medium, Fries, Salad</p>
<p class="card-text">
<small class="text-muted">Order at
<span class="order-at">
<%= @queue_items_details[:created_at] %>
<%= qid.created_at.strftime("%Y %m %d") %>
</span> -
<span class="order-by">
<%= @queue_items_details[:item_order_by] %>
<%= qid.item_order_by %>
</span>
</small>
</p>
<p class="hidden order-customer"><%= @queue_items_details[:customer] %></p>
<p class="hidden order-customer"><%= qid.customer_name %></p>
</div>
<div class="card-footer">
<button id="#id" class="btn btn-primary btn-lg btn-block">COMPLETE</button>
<button id=<%= 'assigned_queue_' + qid.id.to_s %> class="btn btn-primary btn-lg btn-block order-complete">COMPLETE</button>
</div>
</div>
<%
end
end
%>
@@ -93,17 +130,16 @@
</div>
</div>
<!-- end of Pane -->
<% end %>
<% end %>
<!-- End Order Item for Queue Station -->
</div>
</div>
<!-- Column Two -->
<div class="col-lg-3 col-md-3 col-sm-3">
<div class="card" >
<div class="card-header">
<div id="order-title"><strong>ORDER DETAILS</strong> - </div>
<div><strong id="order-title">ORDER DETAILS -</strong></div>
</div>
<div class="card-block">
<div class="card-title">
@@ -117,28 +153,26 @@
</thead>
<tbody>
<tr>
<td id="order-by" style="width:33%; text-align:left">Kyaw Lwin</td>
<td id="order-at" style="width:33%; text-align:right">20/04/17 9:30PM</td>
<td id="order-customer" style="width:33%; text-align:right">John Smith</td>
<td id="order-by" style="width:33%; text-align:left"></td>
<td id="order-at" style="width:33%; text-align:right"></td>
<td id="order-customer" style="width:33%; text-align:right"></td>
</tr>
<tr>
<td><strong>Table/Room</strong></td>
<td id="order-from" colspan="2"></td>
</tr>
</tbody>
</table>
</table>
</div>
<div class="card-text" style="min-height:400px; max-height:400px; overflow:auto">
<table class="table">
<thead>
<tr>
<th style="width:80%; text-align:left">Items</th>
<th style="width:20%; text-align:right">QTY</td>
<th style="width:20%; text-align:right">QTY</th>
</tr>
</thead>
</table>
</div>
<div class="card-text" style="min-height:400px; max-height:400px; overflow-x:scroll">
<table class="table">
<tbody>
<tbody>
<tr>
<td id="order-items" style="width:80%; text-align:left">
<!-- Menu Items Name <br/>
@@ -157,6 +191,7 @@
</div>
</div>
</div>
<!-- Column Three--->
<div class="col-lg-1 col-md-1 col-sm-1">
<!-- OQS Buttons -->