check OQS edit process
This commit is contained in:
@@ -243,21 +243,4 @@ $(document).on('turbolinks:load', function() {
|
||||
success: function(data){ }
|
||||
});
|
||||
});
|
||||
|
||||
// Qty update for OQS Edit Controller
|
||||
$('#qty-update').on('click', function(){
|
||||
var qty_weight = $("input[name='qty_weight']").val();
|
||||
var remarks = $("textarea[name='remarks']").val();
|
||||
var order_items_id = $(this).attr('data-id');
|
||||
var params = { 'order_items_id': order_items_id, 'qty_weight': qty_weight, 'remarks': remarks }
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/oqs/' + order_items_id,
|
||||
data: params,
|
||||
success: function(result){
|
||||
alert("Updated!");
|
||||
window.location.href = '/oqs';
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -25,6 +25,6 @@ class Oqs::EditController < BaseOqsController
|
||||
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_order_item(print_settings, oqs,order_item.order_id, order_item.item_instance_code, print_status=" (Cancel)" )
|
||||
order_queue_printer.print_order_item(print_settings, oqs, order_item.order_items_id,order_item.order_id, order_item.item_instance_code, print_status=" (Cancel)" )
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
|
||||
def print_order_item(print_settings,oqs,order_id, instance_code, print_status, options="")
|
||||
def print_order_item(print_settings,oqs, order_items_id, order_id, instance_code, print_status, options="")
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
@@ -10,7 +10,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
print_settings.save!
|
||||
end
|
||||
|
||||
order_item = print_query('order_item', instance_code) #OrderItem.find_by_item_code(item_code)
|
||||
order_item = print_query('order_item', order_items_id) #OrderItem.find_by_item_code(item_code)
|
||||
|
||||
filename = "tmp/order_item.pdf"
|
||||
|
||||
@@ -147,7 +147,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
||||
left join customers as cus ON cus.customer_id = orders.customer_id
|
||||
left join menu_items as item ON item.item_code = order_items.item_code")
|
||||
.where("order_items.item_instance_code = '#{ id }'")
|
||||
.where("order_items.order_items_id = '#{ id }'")
|
||||
.group("order_items.item_code")
|
||||
elsif type == "order_summary"
|
||||
OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.type, df.name as dining,item.alt_name as alt_name")
|
||||
|
||||
@@ -99,11 +99,12 @@
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
original_value = $('#qty').val();
|
||||
|
||||
console.log(original_value);
|
||||
// Qty update for OQS Edit Controller
|
||||
$('#qty-update').on('click', function(){
|
||||
var qty_weight = $("input[name='qty_weight']").val();
|
||||
if(qty_weight > original_value){
|
||||
console.log(qty_weight);
|
||||
if(parseInt(qty_weight) > parseInt(original_value)){
|
||||
swal("Alert!", "Not allowed over quantity", "warning");
|
||||
return;
|
||||
}
|
||||
@@ -116,7 +117,7 @@ $(document).ready(function(){
|
||||
url: '/oqs/' + order_items_id,
|
||||
data: params,
|
||||
success: function(result){
|
||||
alert("Updated!");
|
||||
// alert("Updated!");
|
||||
window.location.href = '/oqs';
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user