SQA feedback

This commit is contained in:
phyusin
2018-03-19 09:17:12 +06:30
parent 7524ab75ad
commit e55ff8b5e0
4 changed files with 26 additions and 10 deletions

17
app/controllers/oqs/edit_controller.rb Executable file → Normal file
View File

@@ -6,6 +6,11 @@ class Oqs::EditController < BaseOqsController
if params[:type] == 'oqs' if params[:type] == 'oqs'
assigned_item = AssignedOrderItem.find(assigned_item_id) assigned_item = AssignedOrderItem.find(assigned_item_id)
@order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_instance_code='#{ assigned_item.instance_code }'") @order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_instance_code='#{ assigned_item.instance_code }'")
elsif
assigned_item = OrderItem.find(assigned_item_id)
@booking = Booking.joins(" JOIN booking_orders as bko on bko.booking_id = bookings.booking_id")
.where("bko.order_id = '#{assigned_item.order_id}'").first()
@order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_instance_code='#{ assigned_item.item_instance_code }'")
else else
assigned_item = OrderItem.find(assigned_item_id) assigned_item = OrderItem.find(assigned_item_id)
dining = DiningFacility.find_by_id(params[:type]) dining = DiningFacility.find_by_id(params[:type])
@@ -25,13 +30,6 @@ class Oqs::EditController < BaseOqsController
order_item.item_order_by = current_user.name order_item.item_order_by = current_user.name
order_item.qty = qty_weight order_item.qty = qty_weight
order_item.remark = remarks order_item.remark = remarks
if !order_item.set_menu_items.nil?
instance_item_sets = JSON.parse(order_item.set_menu_items)
instance_item_sets.each_with_index do |instance_item, instance_index|
instance_item_sets[instance_index]["quantity"] = qty_weight
end
order_item.set_menu_items = instance_item_sets.to_json
end
order_item.save order_item.save
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
@@ -67,4 +65,9 @@ class Oqs::EditController < BaseOqsController
end end
end end
#Shop Name in Navbor
helper_method :shop_detail
def shop_detail
@shop = Shop.first
end
end end

4
app/views/oqs/edit/index.html.erb Executable file → Normal file
View File

@@ -112,6 +112,8 @@ $(document).ready(function(){
var remarks = $("textarea[name='remarks']").val(); var remarks = $("textarea[name='remarks']").val();
var order_items_id = $(this).attr('data-id'); var order_items_id = $(this).attr('data-id');
var params = { 'order_items_id': order_items_id, 'qty_weight': qty_weight, 'remarks': remarks } var params = { 'order_items_id': order_items_id, 'qty_weight': qty_weight, 'remarks': remarks }
var booking_id = '<%= @booking.booking_id %>';
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: '/oqs/' + order_items_id, url: '/oqs/' + order_items_id,
@@ -121,6 +123,8 @@ $(document).ready(function(){
<% if !@link_type.nil? %> <% if !@link_type.nil? %>
<% if @link_type == 'oqs' %> <% if @link_type == 'oqs' %>
window.location.href = '/oqs'; window.location.href = '/oqs';
<% elsif @link_type == 'pending' %>
window.location.href = '/origami/quick_service/pending_order/'+booking_id;
<% else %> <% else %>
<% if !@dining_type.nil? %> <% if !@dining_type.nil? %>
<% if @dining_type == 'Table' %> <% if @dining_type == 'Table' %>

10
app/views/origami/pending_order/show.html.erb Executable file → Normal file
View File

@@ -100,7 +100,7 @@
@order_items.each do |order_item| @order_items.each do |order_item|
sub_total = sub_total + order_item.price %> sub_total = sub_total + order_item.price %>
<input type="hidden" id="sale_id" value="<%= @bookings.booking_id %>"> <input type="hidden" id="sale_id" value="<%= @bookings.booking_id %>">
<tr> <tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
<td class='item-name'><%= order_item.item_name %></td> <td class='item-name'><%= order_item.item_name %></td>
<td class='item-attr'><%= order_item.qty %></td> <td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= order_item.price %></td> <td class='item-attr'><%= order_item.price %></td>
@@ -289,5 +289,13 @@ $(document).ready(function(){
window.location.href = linkURL; window.location.href = linkURL;
}); });
} }
/*edit order in oqs*/
$('.edit_order').on('click',function(){
var assigned_order_item_id = $(this).attr('data-id');
if((assigned_order_item_id!=undefined) && (assigned_order_item_id!='')){
window.location.href = '/oqs/'+ assigned_order_item_id + "/edit/pending";
}
});
}); });
</script> </script>

5
app/views/origami/split_bill/index.html.erb Executable file → Normal file
View File

@@ -60,7 +60,7 @@
<% if order_item.include? ('all_order') %> <% if order_item.include? ('all_order') %>
<% order_item['all_order'].each do |odr_item| %> <% order_item['all_order'].each do |odr_item| %>
<% <%
order_item_count = order_item_count.to_i + 1 order_item_count = order_item_count.to_i + 1
sub_total += odr_item['qty'].to_f * odr_item['price'].to_f sub_total += odr_item['qty'].to_f * odr_item['price'].to_f
%> %>
<tr class="item-row" id=<%= odr_item['order_items_id'] %> > <tr class="item-row" id=<%= odr_item['order_items_id'] %> >
@@ -389,7 +389,6 @@
$('#order_item_split').on('click',function () { $('#order_item_split').on('click',function () {
var cnt_order_item = "<%= order_item_count %>"; var cnt_order_item = "<%= order_item_count %>";
var order_items = get_selected_order_items();// Selected Order Items var order_items = get_selected_order_items();// Selected Order Items
var cnt_items = parseInt(cnt_order_item) - parseInt(order_items.length); var cnt_items = parseInt(cnt_order_item) - parseInt(order_items.length);
if (order_items.length > 0){ if (order_items.length > 0){
// if(cnt_items > 0){ // if(cnt_items > 0){
@@ -425,6 +424,7 @@
$.each(orders, function(key,value){ $.each(orders, function(key,value){
if($("a[href$='#"+value.order_id+"']").parent().hasClass('selected-split-item')){ if($("a[href$='#"+value.order_id+"']").parent().hasClass('selected-split-item')){
$("a[href$='#"+value.order_id+"']").parent().removeClass('selected-split-item'); $("a[href$='#"+value.order_id+"']").parent().removeClass('selected-split-item');
$(".item-row").removeClass('selected-split-item');
} }
}); });
} }
@@ -623,6 +623,7 @@ function orderItemSplitBillProcess(cnt_items){
if(cnt_items == 0){ if(cnt_items == 0){
booking_id = json_booking.booking_id; booking_id = json_booking.booking_id;
} }
console.log(booking_id);
var order_ids = []; var order_ids = [];
var arr_order_ids = []; var arr_order_ids = [];