From e55ff8b5e0d240c8b4eb20f819917b97f21e1e63 Mon Sep 17 00:00:00 2001 From: phyusin Date: Mon, 19 Mar 2018 09:17:12 +0630 Subject: [PATCH] SQA feedback --- app/controllers/oqs/edit_controller.rb | 17 ++++++++++------- app/views/oqs/edit/index.html.erb | 4 ++++ app/views/origami/pending_order/show.html.erb | 10 +++++++++- app/views/origami/split_bill/index.html.erb | 5 +++-- 4 files changed, 26 insertions(+), 10 deletions(-) mode change 100755 => 100644 app/controllers/oqs/edit_controller.rb mode change 100755 => 100644 app/views/oqs/edit/index.html.erb mode change 100755 => 100644 app/views/origami/pending_order/show.html.erb mode change 100755 => 100644 app/views/origami/split_bill/index.html.erb diff --git a/app/controllers/oqs/edit_controller.rb b/app/controllers/oqs/edit_controller.rb old mode 100755 new mode 100644 index b123ac73..94ba5842 --- a/app/controllers/oqs/edit_controller.rb +++ b/app/controllers/oqs/edit_controller.rb @@ -6,6 +6,11 @@ class Oqs::EditController < BaseOqsController if params[:type] == 'oqs' 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 }'") + 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 assigned_item = OrderItem.find(assigned_item_id) 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.qty = qty_weight 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 if ENV["SERVER_MODE"] != "cloud" #no print in cloud server @@ -67,4 +65,9 @@ class Oqs::EditController < BaseOqsController end end + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/views/oqs/edit/index.html.erb b/app/views/oqs/edit/index.html.erb old mode 100755 new mode 100644 index 775b214d..7a1eebab --- a/app/views/oqs/edit/index.html.erb +++ b/app/views/oqs/edit/index.html.erb @@ -112,6 +112,8 @@ $(document).ready(function(){ 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 } + var booking_id = '<%= @booking.booking_id %>'; + $.ajax({ type: 'POST', url: '/oqs/' + order_items_id, @@ -121,6 +123,8 @@ $(document).ready(function(){ <% if !@link_type.nil? %> <% if @link_type == 'oqs' %> window.location.href = '/oqs'; + <% elsif @link_type == 'pending' %> + window.location.href = '/origami/quick_service/pending_order/'+booking_id; <% else %> <% if !@dining_type.nil? %> <% if @dining_type == 'Table' %> diff --git a/app/views/origami/pending_order/show.html.erb b/app/views/origami/pending_order/show.html.erb old mode 100755 new mode 100644 index ac164636..a7ade0a4 --- a/app/views/origami/pending_order/show.html.erb +++ b/app/views/origami/pending_order/show.html.erb @@ -100,7 +100,7 @@ @order_items.each do |order_item| sub_total = sub_total + order_item.price %> - + <%= order_item.item_name %> <%= order_item.qty %> <%= order_item.price %> @@ -289,5 +289,13 @@ $(document).ready(function(){ 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"; + } + }); }); diff --git a/app/views/origami/split_bill/index.html.erb b/app/views/origami/split_bill/index.html.erb old mode 100755 new mode 100644 index 69743cf1..a62fb66e --- a/app/views/origami/split_bill/index.html.erb +++ b/app/views/origami/split_bill/index.html.erb @@ -60,7 +60,7 @@ <% if order_item.include? ('all_order') %> <% 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 %> > @@ -389,7 +389,6 @@ $('#order_item_split').on('click',function () { var cnt_order_item = "<%= order_item_count %>"; var order_items = get_selected_order_items();// Selected Order Items - var cnt_items = parseInt(cnt_order_item) - parseInt(order_items.length); if (order_items.length > 0){ // if(cnt_items > 0){ @@ -425,6 +424,7 @@ $.each(orders, function(key,value){ if($("a[href$='#"+value.order_id+"']").parent().hasClass('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){ booking_id = json_booking.booking_id; } + console.log(booking_id); var order_ids = []; var arr_order_ids = [];