oqs updated
This commit is contained in:
@@ -30,6 +30,7 @@ $(document).ready(function(){
|
|||||||
var orderBy = $(this).children().children().children().children('.order-by').text();
|
var orderBy = $(this).children().children().children().children('.order-by').text();
|
||||||
var orderAt = $(this).children().children().children().children('.order-at').text();
|
var orderAt = $(this).children().children().children().children('.order-at').text();
|
||||||
var orderCustomer = $(this).children().children('.order-customer').text();
|
var orderCustomer = $(this).children().children('.order-customer').text();
|
||||||
|
var order_status = $(this).children().children('.order-status').text();
|
||||||
|
|
||||||
$('#order-title').text("ORDER DETAILS - " + orderZone);
|
$('#order-title').text("ORDER DETAILS - " + orderZone);
|
||||||
$('#order-by').text(orderBy);
|
$('#order-by').text(orderBy);
|
||||||
@@ -43,6 +44,7 @@ $(document).ready(function(){
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: '/oqs/' + orderZone,
|
url: '/oqs/' + orderZone,
|
||||||
|
data: { 'status' : order_status },
|
||||||
success: function(res){
|
success: function(res){
|
||||||
for (i = 0; i < res.length; i++) {
|
for (i = 0; i < res.length; i++) {
|
||||||
var data = JSON.stringify(res[i]);
|
var data = JSON.stringify(res[i]);
|
||||||
|
|||||||
@@ -26,15 +26,29 @@ class Oqs::HomeController < BaseOqsController
|
|||||||
def get_order_items
|
def get_order_items
|
||||||
items = []
|
items = []
|
||||||
table_name = params[:table_id]
|
table_name = params[:table_id]
|
||||||
|
status = params[:status]
|
||||||
dining = DiningFacility.find_by_name(table_name);
|
dining = DiningFacility.find_by_name(table_name);
|
||||||
booking_id = dining.get_current_booking
|
oqpz = OrderQueueProcessByZone.find_by_zone_id(dining.zone_id)
|
||||||
BookingOrder.where("booking_id='#{ booking_id }'").find_each do |bo|
|
if status == ""
|
||||||
order=Order.find(bo.order_id);
|
AssignedOrderItem.where("order_queue_station_id=#{ oqpz.order_queue_station_id } AND delivery_status=0").find_each do |aoi|
|
||||||
order.order_items.each do |oi|
|
oi = OrderItem.find_by_item_code(aoi.item_code)
|
||||||
items.push(oi)
|
items.push(oi)
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
AssignedOrderItem.where("order_queue_station_id=#{ oqpz.order_queue_station_id } AND delivery_status=1").find_each do |aoi|
|
||||||
|
oi = OrderItem.find_by_item_code(aoi.item_code)
|
||||||
|
items.push(oi)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# booking_id = dining.get_new_booking
|
||||||
|
# BookingOrder.where("booking_id='#{ booking_id }'").find_each do |bo|
|
||||||
|
# order=Order.find(bo.order_id);
|
||||||
|
# order.order_items.each do |oi|
|
||||||
|
# items.push(oi)
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
render :json => items.to_json
|
render :json => items.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -18,4 +18,20 @@ class DiningFacility < ApplicationRecord
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_new_booking
|
||||||
|
# query for new
|
||||||
|
# if status
|
||||||
|
# to ask when req bill booking_status?
|
||||||
|
booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and sale_id is null and checkout_at is null").limit(1)
|
||||||
|
# else
|
||||||
|
# booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and sale_id not null").limit(1)
|
||||||
|
# end
|
||||||
|
|
||||||
|
if booking.count > 0 then
|
||||||
|
return booking[0].booking_id
|
||||||
|
else
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -19,12 +19,12 @@ class OrderQueueStation < ApplicationRecord
|
|||||||
#Get List of items -
|
#Get List of items -
|
||||||
pq_items = JSON.parse(oqs.processing_items)
|
pq_items = JSON.parse(oqs.processing_items)
|
||||||
|
|
||||||
if oqs.id == oqpbz.order_queue_station_id
|
|
||||||
#Loop through the processing items
|
#Loop through the processing items
|
||||||
pq_items.each do |pq_item|
|
pq_items.each do |pq_item|
|
||||||
#Processing through the looping items
|
#Processing through the looping items
|
||||||
order_items.each do |order_item|
|
order_items.each do |order_item|
|
||||||
if (pq_item == order_item.item_code)
|
if (pq_item == order_item.item_code)
|
||||||
|
if oqs.id == oqpbz.order_queue_station_id
|
||||||
#Same Order_items can appear in two location.
|
#Same Order_items can appear in two location.
|
||||||
AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
|
AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -60,6 +60,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</small>
|
</small>
|
||||||
</p>
|
</p>
|
||||||
|
<p class="hidden order-status">completed</p>
|
||||||
<p class="hidden order-customer"><%= qid.customer_name %></p>
|
<p class="hidden order-customer"><%= qid.customer_name %></p>
|
||||||
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
|
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user