Update
This commit is contained in:
@@ -17,15 +17,16 @@
|
|||||||
//= require cable
|
//= require cable
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
||||||
// auto refresh every 10 seconds
|
// auto refresh every 10 seconds
|
||||||
// setTimeout(function(){
|
// setTimeout(function(){
|
||||||
// window.location.reload(1);
|
// window.location.reload(1);
|
||||||
// }, 10000);
|
// }, 10000);
|
||||||
|
|
||||||
$('.queue_station').on('click',function(){
|
$('.queue_station').on('click',function(){
|
||||||
var orderZone=$(this).children().children().children('.order-zone').text();
|
var orderZone=$(this).children().children().children('.order-zone').text();
|
||||||
var orderItem=$(this).children().children().children('.order-item').text();
|
var orderItem=$(this).children().children().children('.order-item').text();
|
||||||
var orderQty=$(this).children().children().children('.order-qty').text();
|
var orderQty=$(this).children().children().children('.order-qty').text();
|
||||||
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();
|
||||||
@@ -44,19 +45,19 @@ $(document).ready(function(){
|
|||||||
});
|
});
|
||||||
|
|
||||||
// complete for queue item
|
// complete for queue item
|
||||||
$('.order-complete').on('click',function(e){
|
$('.order-complete').on('click',function(e){
|
||||||
//e.preventDefault();
|
//e.preventDefault();
|
||||||
var _self = $(this); // To know in ajax return
|
var _self = $(this); // To know in ajax return
|
||||||
var assigned_item_id=$(this).attr('id').substr(15);
|
var assigned_item_id=$(this).attr('id').substr(15);
|
||||||
var params = { 'id':assigned_item_id };
|
var params = { 'id':assigned_item_id };
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: '/oqs/update_delivery',
|
url: '/oqs/update_delivery',
|
||||||
data: params,
|
data: params,
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(data){
|
success: function(data){
|
||||||
for (i = 0; i < data.length; i++) {
|
for (i = 0; i < data.length; i++) {
|
||||||
var queue_station = $('#assigned_queue_' + data[i]).parent().parent(".queue_station");
|
var queue_station = $('#assigned_queue_' + data[i]).parent().parent(".queue_station");
|
||||||
var station = queue_station.parent().parent().attr('id');
|
var station = queue_station.parent().parent().attr('id');
|
||||||
|
|
||||||
@@ -65,7 +66,7 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
// Remove a queue card from current station
|
// Remove a queue card from current station
|
||||||
queue_station.children('.card-footer').remove();
|
queue_station.children('.card-footer').remove();
|
||||||
|
|
||||||
// Add removed queue card from station to completed
|
// Add removed queue card from station to completed
|
||||||
$("#completed").children('.card-columns').append(queue_station);
|
$("#completed").children('.card-columns').append(queue_station);
|
||||||
|
|
||||||
@@ -73,33 +74,33 @@ $(document).ready(function(){
|
|||||||
var station_count=parseInt($("#"+station+"_count").text()) - 1;
|
var station_count=parseInt($("#"+station+"_count").text()) - 1;
|
||||||
$("#"+station+"_count").text(station_count);
|
$("#"+station+"_count").text(station_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
// update queue item count in completed station
|
// update queue item count in completed station
|
||||||
$("#completed_count").text(parseInt($("#completed_count").text()) + data.length);
|
$("#completed_count").text(parseInt($("#completed_count").text()) + data.length);
|
||||||
|
|
||||||
alert("updated!");
|
alert("updated!");
|
||||||
// Page reload
|
// Page reload
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#print_order_item').on('click',function(){
|
$('#print_order_item').on('click',function(){
|
||||||
var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text();
|
var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text();
|
||||||
var params = { 'id':assigned_item_id };
|
var params = { 'id':assigned_item_id };
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: '/oqs/print/print/'+assigned_item_id,
|
url: '/oqs/print/print/'+assigned_item_id,
|
||||||
success: function(data){ }
|
success: function(data){ }
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#print_order_summary').on('click',function(){
|
$('#print_order_summary').on('click',function(){
|
||||||
var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text();
|
var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text();
|
||||||
var params = { 'id':assigned_item_id };
|
var params = { 'id':assigned_item_id };
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: '/oqs/print/print_order_summary/'+assigned_item_id,
|
url: '/oqs/print/print_order_summary/'+assigned_item_id,
|
||||||
success: function(data){ }
|
success: function(data){ }
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,22 +1,22 @@
|
|||||||
class Oqs::HomeController < BaseOqsController
|
class Oqs::HomeController < BaseOqsController
|
||||||
def index
|
def index
|
||||||
queue_stations=OrderQueueStation.all
|
queue_stations=OrderQueueStation.all
|
||||||
|
|
||||||
@queue_items_details = queue_items_query(0)
|
@queue_items_details = queue_items_query(0)
|
||||||
|
|
||||||
@queue_completed_item = queue_items_query(1)
|
@queue_completed_item = queue_items_query(1)
|
||||||
|
|
||||||
@queue_stations_items=Array.new
|
@queue_stations_items=Array.new
|
||||||
|
|
||||||
# Calculate Count for each station tab
|
# Calculate Count for each station tab
|
||||||
queue_stations.each do |que|
|
queue_stations.each do |que|
|
||||||
i=0
|
i=0
|
||||||
@queue_items_details.each do |qid|
|
@queue_items_details.each do |qid|
|
||||||
if qid.station_name == que.station_name
|
if qid.station_name == que.station_name
|
||||||
i=i+1
|
i=i+1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@queue_stations_items.push({:station_name => que.station_name, :is_active => que.is_active ,:item_count => i })
|
@queue_stations_items.push({:station_name => que.station_name, :is_active => que.is_active ,:item_count => i })
|
||||||
end
|
end
|
||||||
|
|
||||||
@queue_stations_items
|
@queue_stations_items
|
||||||
@@ -35,24 +35,23 @@ class Oqs::HomeController < BaseOqsController
|
|||||||
# update delivery status for completed same order items
|
# update delivery status for completed same order items
|
||||||
assigned_items.each do |ai|
|
assigned_items.each do |ai|
|
||||||
ai.delivery_status=true
|
ai.delivery_status=true
|
||||||
ai.save
|
ai.save
|
||||||
removed_item.push(ai.assigned_order_item_id)
|
removed_item.push(ai.assigned_order_item_id)
|
||||||
end
|
end
|
||||||
render :json => removed_item.to_json
|
render :json => removed_item.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
# Query for OQS with status
|
# Query for OQS with status
|
||||||
def queue_items_query(status)
|
def queue_items_query(status)
|
||||||
AssignedOrderItem.select("assigned_order_items.assigned_order_item_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")
|
AssignedOrderItem.select("assigned_order_items.assigned_order_item_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(" left join order_queue_process_by_zones as oqpz ON oqpz.order_queue_station_id = assigned_order_items.order_queue_station_id
|
.joins("left 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 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 order_queue_stations as oqs ON oqs.id = assigned_order_items.order_queue_station_id
|
||||||
left join orders as od ON od.order_id = assigned_order_items.order_id
|
left join orders as od ON od.order_id = assigned_order_items.order_id
|
||||||
left join order_items as odt ON odt.item_code = assigned_order_items.item_code
|
left join order_items as odt ON odt.item_code = assigned_order_items.item_code
|
||||||
left join customers as cus ON cus.customer_id = od.customer_id")
|
left join customers as cus ON cus.customer_id = od.customer_id")
|
||||||
.where("assigned_order_items.delivery_status = #{status}")
|
.where("assigned_order_items.delivery_status = #{status}")
|
||||||
.group("assigned_order_items.assigned_order_item_id")
|
.group("assigned_order_items.assigned_order_item_id")
|
||||||
.order("odt.item_name DESC")
|
.order("odt.item_name DESC")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -235,7 +235,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
<!-- Waiter Buttons -->
|
<!-- Waiter Buttons -->
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block"> Foc </button>
|
<button type="button" class="btn btn-primary btn-lg btn-block"> FOC </button>
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block"> Void </button>
|
<button type="button" class="btn btn-primary btn-lg btn-block"> Void </button>
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block" onclick="localStorage.removeItem('cash');window.location.href = '/origami';"> Back </button>
|
<button type="button" class="btn btn-primary btn-lg btn-block" onclick="localStorage.removeItem('cash');window.location.href = '/origami';"> Back </button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user