updated ui

This commit is contained in:
Yan
2017-06-02 11:28:07 +06:30
parent f28f0bf292
commit 95fd260c76
4 changed files with 43 additions and 25 deletions

View File

@@ -18,31 +18,37 @@
$(document).ready(function(){ $(document).ready(function(){
$('.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();
$('#order-title').text("ORDER DETAILS - " + orderZone); $('#order-title').text("ORDER DETAILS - " + orderZone);
$('#order-by').text(orderBy); $('#order-by').text(orderBy);
$('#order-at').text(orderAt); $('#order-at').text(orderAt);
$('#order-customer').text(orderCustomer); $('#order-customer').text(orderCustomer);
$('#order-from').text(orderZone); $('#order-from').text(orderZone);
$('#order-items').text(orderItem); $('#order-items').text(orderItem);
$('#order-qty').text(orderQty); $('#order-qty').text(orderQty);
}); });
// complete for queue item // complete for queue item
$('.order-complete').on('click',function(){ $('.order-complete').on('click',function(){
var assigned_item_id=$(this).attr('id').substr(15); var assigned_item_id=$(this).attr('id').substr(15);
$.ajax({ var params = { 'id':assigned_item_id };
url: "", // $(this).parent().parent(".queue_station").remove();
data: "" $.ajax({
}).done(function(){ type: 'POST',
url: '/oqs/update_delivery',
}); data: params,
}); dataType: 'json',
success: function(data){
$('.order-complete').parent().parent(".queue_station").remove();
alert('updated!');
}
});
});
}); });

View File

@@ -26,8 +26,17 @@ class Oqs::HomeController < BaseOqsController
def show def show
end end
# update delivery status when complete click
def update_delivery_status def update_delivery_status
puts "WWWW" + params[:id]
assigned_item_id = params[:id]
assigned_item=AssignedOrderItem.find(assigned_item_id)
assigned_item.delivery_status=true
assigned_item.save
# respond_to do |format|
# format.json { render json: "updated" }
# end
flash[:success] = "updated!"
end end
# Query for OQS with status # Query for OQS with status

View File

@@ -200,3 +200,4 @@
</div> </div>
</div> </div>

View File

@@ -92,6 +92,8 @@ Rails.application.routes.draw do
#--------- Order Queue Station ------------# #--------- Order Queue Station ------------#
namespace :oqs do namespace :oqs do
root "home#index" root "home#index"
post 'update_delivery', to: "home#update_delivery_status"
#dashboard #dashboard
# #
end end