qty edit in oqs
This commit is contained in:
@@ -68,7 +68,9 @@ $(document).ready(function(){
|
|||||||
});
|
});
|
||||||
|
|
||||||
$(".order-item-edit").on('click', function(){
|
$(".order-item-edit").on('click', function(){
|
||||||
|
var _self = $(this); // To know in ajax return
|
||||||
|
var assigned_item_id=$(this).attr('id').substr(5);
|
||||||
|
window.location.href = '/oqs/'+ assigned_item_id + "/edit"
|
||||||
});
|
});
|
||||||
|
|
||||||
// complete for queue item
|
// complete for queue item
|
||||||
@@ -137,4 +139,21 @@ $(document).ready(function(){
|
|||||||
success: function(data){ }
|
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';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
class Oqs::EditController < BaseOqsController
|
||||||
|
def index
|
||||||
|
assigned_item_id = params[:id]
|
||||||
|
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||||
|
@order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_code='#{ assigned_item.item_code }'");
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
order_items_id = params[:order_items_id]
|
||||||
|
qty_weight = params[:qty_weight]
|
||||||
|
remarks = params[:remarks]
|
||||||
|
|
||||||
|
order_item = OrderItem.find(order_items_id);
|
||||||
|
order_item.qty = qty_weight
|
||||||
|
order_item.remark = remarks
|
||||||
|
order_item.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= yield %>
|
<%= yield %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
27
app/views/oqs/edit/index.html.erb
Normal file
27
app/views/oqs/edit/index.html.erb
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">Update Quantity</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<h3><%= @order_item[0].item_name + " - [" + @order_item[0].qty.to_s + "]" %></h3>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-1">Quantity: </label>
|
||||||
|
<input type="text" name="qty_weight" class="text-right" value="<%= @order_item[0].qty %>" />
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-1">Remark: </label>
|
||||||
|
<textarea rows="2" cols="22" name="remarks"></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<a href="<%= oqs_root_path %>" class="btn btn-primary">
|
||||||
|
<i class="fa fa-arrow-left"></i> Back
|
||||||
|
</a>
|
||||||
|
<button id="qty-update" class="btn btn-info" data-id="<%= @order_item[0].order_items_id %>">Update</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
<!-- Nav tabs - End -->
|
<!-- Nav tabs - End -->
|
||||||
|
|
||||||
<div class="tab-content" style="min-height:670px; max-height:670px; overflow:auto">
|
<div class="tab-content" style="max-height:670px; overflow:auto">
|
||||||
<!--- Panel 0 - Completed -->
|
<!--- Panel 0 - Completed -->
|
||||||
<div class="tab-pane active" id="completed" role="tabpanel">
|
<div class="tab-pane active" id="completed" role="tabpanel">
|
||||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||||
@@ -105,7 +105,7 @@
|
|||||||
<p class="card-text">
|
<p class="card-text">
|
||||||
<small class="text-muted">Order at
|
<small class="text-muted">Order at
|
||||||
<span class="order-at">
|
<span class="order-at">
|
||||||
<%= qid.created_at.strftime("%Y %m %d") %>
|
<%= qid.created_at.getlocal.strftime("%Y-%m-%d") %>
|
||||||
</span> -
|
</span> -
|
||||||
<span class="order-by">
|
<span class="order-by">
|
||||||
<%= qid.item_order_by %>
|
<%= qid.item_order_by %>
|
||||||
@@ -164,7 +164,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-text" style="min-height:400px; max-height:400px; overflow:auto">
|
<div class="card-text" style="min-height:360px; max-height:360px; overflow:auto">
|
||||||
<table class="table" id="oqs-order-details-table">
|
<table class="table" id="oqs-order-details-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -200,11 +200,9 @@ $(document).ready(function(){
|
|||||||
var input_value = $(this).attr("data-value");
|
var input_value = $(this).attr("data-value");
|
||||||
if (original_value == "0.0"){
|
if (original_value == "0.0"){
|
||||||
$('#discount-amount').val(input_value);
|
$('#discount-amount').val(input_value);
|
||||||
// update_balance();
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$('#discount-amount').val(original_value + '' + input_value);
|
$('#discount-amount').val(original_value + '' + input_value);
|
||||||
// update_balance();
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -212,18 +210,15 @@ $(document).ready(function(){
|
|||||||
var input_value = $(this).attr("data-value");
|
var input_value = $(this).attr("data-value");
|
||||||
amount = parseInt(input_value);
|
amount = parseInt(input_value);
|
||||||
$('#discount-amount').val(amount);
|
$('#discount-amount').val(amount);
|
||||||
// update_balance();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'del' :
|
case 'del' :
|
||||||
var discount_text=$('#discount-amount').val();
|
var discount_text=$('#discount-amount').val();
|
||||||
$('#discount-amount').val(discount_text.substr(0,discount_text.length-1));
|
$('#discount-amount').val(discount_text.substr(0,discount_text.length-1));
|
||||||
// update_balance();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'clr':
|
case 'clr':
|
||||||
$('#discount-amount').val("0.0");
|
$('#discount-amount').val("0.0");
|
||||||
// update_balance();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
event.handled = true;
|
event.handled = true;
|
||||||
@@ -333,12 +328,6 @@ $(document).ready(function(){
|
|||||||
var discount_items = JSON.stringify(get_discount_item_rows());
|
var discount_items = JSON.stringify(get_discount_item_rows());
|
||||||
var overall_discount = $("#order-discount").text();
|
var overall_discount = $("#order-discount").text();
|
||||||
var sub_total = $('#order-sub-total').text();
|
var sub_total = $('#order-sub-total').text();
|
||||||
// var sale_item_id = $('.selected-item').attr('id').substr(0,16);
|
|
||||||
// var sub_total = $('#order-sub-total').text();
|
|
||||||
// var grand_total = $('#order-grand-total').text();
|
|
||||||
// var discount_type = $('#discount-type').val();
|
|
||||||
// var discount_value = $('#discount-amount').val();
|
|
||||||
// var discount_amount = discount_value;
|
|
||||||
var ajax_url = "/origami/" + sale_id + "/discount";
|
var ajax_url = "/origami/" + sale_id + "/discount";
|
||||||
|
|
||||||
var params = { 'sale_id': sale_id, 'sub_total': sub_total, 'discount_items': discount_items, 'overall_discount': overall_discount };
|
var params = { 'sale_id': sale_id, 'sub_total': sub_total, 'discount_items': discount_items, 'overall_discount': overall_discount };
|
||||||
@@ -355,29 +344,11 @@ $(document).ready(function(){
|
|||||||
else {
|
else {
|
||||||
window.location.href = "/origami/room/" + result.table_id
|
window.location.href = "/origami/room/" + result.table_id
|
||||||
}
|
}
|
||||||
|
|
||||||
// window.history.back();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/* For Receipt - Update Balance */
|
|
||||||
function update_balance(){
|
|
||||||
var discount_amount = $('#discount-amount').val();
|
|
||||||
var sub_total = $('#order-sub-total').text();
|
|
||||||
var tax = $('#order-Tax').text();
|
|
||||||
|
|
||||||
// For Percentage Discount
|
|
||||||
// if(discount_type == 1){
|
|
||||||
// discount_amount=(sub_total*discount_amount)/100;
|
|
||||||
// }
|
|
||||||
|
|
||||||
var total = (parseFloat(sub_total) + parseFloat(tax)) - discount_amount;
|
|
||||||
$('#order-discount').text(discount_amount);
|
|
||||||
$('#order-grand-total').text(total);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Remove Selection */
|
/* Remove Selection */
|
||||||
function selection_remove(){
|
function selection_remove(){
|
||||||
$(".item-row").removeClass("selected-item");
|
$(".item-row").removeClass("selected-item");
|
||||||
|
|||||||
@@ -143,6 +143,10 @@ Rails.application.routes.draw do
|
|||||||
|
|
||||||
post 'update_delivery', to: "home#update_delivery_status"
|
post 'update_delivery', to: "home#update_delivery_status"
|
||||||
|
|
||||||
|
# qty update
|
||||||
|
get "/:id/edit", to: "edit#index"
|
||||||
|
post "/:id", to: "edit#update"
|
||||||
|
|
||||||
# Pass assigned_order_item_id
|
# Pass assigned_order_item_id
|
||||||
get 'print/print/:id', to: "print#print"
|
get 'print/print/:id', to: "print#print"
|
||||||
get 'print/print_order_summary/:id', to: "print#print_order_summary"
|
get 'print/print_order_summary/:id', to: "print#print_order_summary"
|
||||||
|
|||||||
Reference in New Issue
Block a user