From 4d0f13106da8124a55ddefd6c31654a68b75b5cc Mon Sep 17 00:00:00 2001 From: Myat Zin Wai Maw Date: Tue, 17 Dec 2019 13:49:15 +0630 Subject: [PATCH 1/3] foodcourt --- app/controllers/api/customers_controller.rb | 6 ++-- app/controllers/api/orders_controller.rb | 2 +- .../api/verifications_controller.rb | 2 +- .../order_queue_stations_controller.rb | 4 +-- app/models/customer.rb | 8 ++--- app/models/order.rb | 2 ++ app/models/printer/printer_worker.rb | 30 +++++++++---------- .../get_customer_last_orders.json.jbuilder | 9 ++++++ .../foodcourt/dashboard/_menu.json.jbuilder | 14 ++++----- .../order_queue_stations/_form.html.erb | 20 ++++++------- config/routes.rb | 2 +- 11 files changed, 53 insertions(+), 46 deletions(-) create mode 100644 app/views/api/customers/get_customer_last_orders.json.jbuilder diff --git a/app/controllers/api/customers_controller.rb b/app/controllers/api/customers_controller.rb index ce432b90..e20a2d68 100755 --- a/app/controllers/api/customers_controller.rb +++ b/app/controllers/api/customers_controller.rb @@ -1,5 +1,5 @@ -class Api::CustomersController < ActionController::API - +class Api::CustomersController < Api::ApiController + skip_before_action :authenticate #List all active customers by name def index @customers = Customer.order("name asc") @@ -17,6 +17,6 @@ class Api::CustomersController < ActionController::API #Show customer last five order def get_customer_last_orders - @customer = Customer.find(params[:customer_id]) + @sales =Sale.where("sales.customer_id=? and sales.sale_status =?",params[:customer_id],'completed').order("created_at desc").limit(5) end end diff --git a/app/controllers/api/orders_controller.rb b/app/controllers/api/orders_controller.rb index 68d1e32c..777588ba 100755 --- a/app/controllers/api/orders_controller.rb +++ b/app/controllers/api/orders_controller.rb @@ -46,7 +46,7 @@ class Api::OrdersController < Api::ApiController @tax_profile = TaxProfile.where("lower(group_type)='cashier'") # end - # + # return @shop.to_json end diff --git a/app/controllers/api/verifications_controller.rb b/app/controllers/api/verifications_controller.rb index b53b2bad..845c7bc4 100644 --- a/app/controllers/api/verifications_controller.rb +++ b/app/controllers/api/verifications_controller.rb @@ -5,7 +5,7 @@ class Api::VerificationsController < Api::ApiController #TODO - user generate cus = Customer.new - @cus = cus.draft_customer(phone_number, rand(1000..9999)) + @cus = cus.draft_customer(params, rand(1000..9999)) if @cus.verify_status == false VerifyNumber.send_message(phone_number, @cus.pin_code) @result = true diff --git a/app/controllers/settings/order_queue_stations_controller.rb b/app/controllers/settings/order_queue_stations_controller.rb index aa856801..ae9ad34a 100755 --- a/app/controllers/settings/order_queue_stations_controller.rb +++ b/app/controllers/settings/order_queue_stations_controller.rb @@ -6,7 +6,7 @@ class Settings::OrderQueueStationsController < ApplicationController # GET /settings/order_queue_stations # GET /settings/order_queue_stations.json def index - @settings_order_queue_stations = OrderQueueStation.all + @settings_order_queue_stations = OrderQueueStation.where("shop_code=?",@shop.shop_code) @settings_order_queue_stations = Kaminari.paginate_array(@settings_order_queue_stations).page(params[:page]).per(50) end @@ -29,7 +29,7 @@ class Settings::OrderQueueStationsController < ApplicationController # POST /settings/order_queue_stations # POST /settings/order_queue_stations.json def create - + @settings_order_queue_station = OrderQueueStation.new(settings_order_queue_station_params) @settings_order_queue_station.created_by = current_login_employee.name @settings_order_queue_station.processing_items = "[]" diff --git a/app/models/customer.rb b/app/models/customer.rb index 569efac1..0850b6a4 100755 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -17,11 +17,11 @@ class Customer < ApplicationRecord paginates_per 50 - def draft_customer(phone, pin) - cus = Customer.find_by_contact_no(phone) + def draft_customer(params, pin) + cus = Customer.find_by_contact_no(params[:phone_number]) if cus.nil? - self.name = "User " + pin.to_s - self.contact_no = phone + self.name = params[:name] + self.contact_no = params[:phone_number] self.email = pin.to_s + "@gmail.com" self.pin_code = pin.to_s self.pin_sent_at = Time.now diff --git a/app/models/order.rb b/app/models/order.rb index 6bf30813..f7b2c269 100755 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -37,11 +37,13 @@ class Order < ApplicationRecord :checkin_at => Time.now.utc,:checkout_at => Time.now.utc + self.extra_time.to_i, :checkin_by => self.employee_name, :booking_status => "assign", + :customer_id => self.customer_id, :shop_code=>self.shop_code}) else booking = Booking.create({:dining_facility_id => table_id,:type => "TableBooking", :checkin_at => Time.now.utc, :checkin_by => self.employee_name, :booking_status => "assign", + :customer_id => self.customer_id, :shop_code=>self.shop_code }) end #end extra time diff --git a/app/models/printer/printer_worker.rb b/app/models/printer/printer_worker.rb index 39cbb431..e0d4fc85 100755 --- a/app/models/printer/printer_worker.rb +++ b/app/models/printer/printer_worker.rb @@ -38,20 +38,20 @@ class Printer::PrinterWorker end def print(file_path,printer_destination = nil ) - # if printer_destination.nil? - # printer_destination = self.printer_destination - # end - # - # puts printer_destination - # puts '........Printer Destination..........' - # - # copy = self.print_copies - # #Print only when printer information is not null - # if !self.printer_destination.nil? - # (1..copy).each do - # page = Cups::PrintJob.new(file_path, printer_destination) - # page.print - # end - # end + if printer_destination.nil? + printer_destination = self.printer_destination + end + + puts printer_destination + puts '........Printer Destination..........' + + copy = self.print_copies + #Print only when printer information is not null + if !self.printer_destination.nil? + (1..copy).each do + page = Cups::PrintJob.new(file_path, printer_destination) + page.print + end + end end end diff --git a/app/views/api/customers/get_customer_last_orders.json.jbuilder b/app/views/api/customers/get_customer_last_orders.json.jbuilder new file mode 100644 index 00000000..79acbfed --- /dev/null +++ b/app/views/api/customers/get_customer_last_orders.json.jbuilder @@ -0,0 +1,9 @@ +if(@sales) + json.sales @sales do |sale| + json.sale_id sale.sale_id + json.customer_id sale.customer_id + json.receipt_no sale.receipt_no + json.grand_total sale.grand_total + json.sale_items sale.sale_items + end +end diff --git a/app/views/foodcourt/dashboard/_menu.json.jbuilder b/app/views/foodcourt/dashboard/_menu.json.jbuilder index 9c9f1963..19b05aa5 100644 --- a/app/views/foodcourt/dashboard/_menu.json.jbuilder +++ b/app/views/foodcourt/dashboard/_menu.json.jbuilder @@ -8,22 +8,17 @@ json.valid_time_to menu.valid_time_to.strftime("%H:%M") if (menu.menu_categories) order_by = Lookup.find_by_lookup_type("order_by") # if !order_by.nil? && order_by.value == "name" - # categories = MenuCategory.unscoped.where("menu_id ='#{menu.id}'").order("name asc") + # categories = MenuCategory.unscope(:order).where("menu_id ='#{menu.id}'").order("name asc") # else # categories = menu.menu_categories # end categories = menu.menu_categories json.categories categories do |category| if category.is_available - parent_category = category.parent - if !parent_category.nil? - json.sub_category "true" - else - json.sub_category "false" - end + json.sub_category category.children.present? + valid_time = category.valid_time json.valid_time valid_time - json.id category.id json.code category.code json.order_by category.order_by @@ -80,7 +75,7 @@ if (menu.menu_categories) alt_name: its.alt_name, min_selectable_qty: its.min_selectable_qty, max_selectable_qty: its.max_selectable_qty, - instances: its.menu_item_instances.pluck(:id).map { |id| {id: id}} + instances: its.menu_item_instances.map { |i| {id: i.id} } } } @@ -100,6 +95,7 @@ if (menu.menu_categories) json.is_default is.is_default json.is_on_promotion is.is_on_promotion json.promotion_price is.promotion_price + json.out_of_stock is.is_out_of_stock json.values instance_attr end end diff --git a/app/views/settings/order_queue_stations/_form.html.erb b/app/views/settings/order_queue_stations/_form.html.erb index 908e2844..41185fca 100755 --- a/app/views/settings/order_queue_stations/_form.html.erb +++ b/app/views/settings/order_queue_stations/_form.html.erb @@ -31,7 +31,7 @@ div.form-inputs span{ <%= f.input :print_copy %> <%= f.hidden_field :processing_items %> <%= f.label "Select Zones", :class => 'control-label' %> - <%= f.collection_check_boxes :zone_ids , Zone.all, :id, :name , :class => 'checkbox'%> + <%= f.collection_check_boxes :zone_ids , Zone.shop, :id, :name , :class => 'checkbox'%> <%= f.input :cut_per_item %> <%= f.input :use_alternate_name %> <%= f.input :processing_items, as: :hidden %> @@ -69,24 +69,24 @@ div.form-inputs span{ 2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.order_queue_stations_txt") %>

- + diff --git a/config/routes.rb b/config/routes.rb index 0cd05e48..8828b51f 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -83,7 +83,7 @@ scope "(:locale)", locale: /en|mm/ do get "customers/get_order/:id" => "customers#get_customer_order" #get customer last five orders - get "customers/get_orders/:customer_id" => "customers#get_customer_last_orders" + get "get_customer_last_orders" => "customers#get_customer_last_orders" #Generating Invoice and making payments - output render @sale resources :invoices, only: [:index, :show, :create, :update, :destroy] do From 8af99742a3ed6e5c59aa148517ef61787647350f Mon Sep 17 00:00:00 2001 From: Myat Zin Wai Maw Date: Tue, 17 Dec 2019 15:06:37 +0630 Subject: [PATCH 2/3] bill and tax --- app/controllers/api/orders_controller.rb | 9 --------- app/controllers/foodcourt/home_controller.rb | 4 ++-- app/controllers/origami/pending_order_controller.rb | 8 ++++---- app/models/sale.rb | 2 ++ 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/app/controllers/api/orders_controller.rb b/app/controllers/api/orders_controller.rb index 777588ba..0c512f5d 100755 --- a/app/controllers/api/orders_controller.rb +++ b/app/controllers/api/orders_controller.rb @@ -122,21 +122,12 @@ class Api::OrdersController < Api::ApiController end @status, @booking = @order.generate - if @status && @booking - Order.process_order_queue(@order.order_id,@order.table_id,@order.source) - end if @order.table_id.to_i > 0 table = DiningFacility.find(@booking.dining_facility_id) type = 'order' from = getCloudDomain #get sub domain in cloud mode ActionCable.server.broadcast "order_channel",table: table,type:type,from:from end - # # for parallel order - # remoteIP = "" - # begin - # @status, @booking = @order.generate - # remoteIP = request.remote_ip - # end while request.remote_ip != remoteIP if current_user.role != "waiter" && params[:create_type] == "create_pay" if @status && @booking && (@order.source == 'quick_service') || (@order.source == 'food_court') || (@order.source == 'app') @status, @sale = Sale.request_bill(@order,current_user,current_user) diff --git a/app/controllers/foodcourt/home_controller.rb b/app/controllers/foodcourt/home_controller.rb index 09b85b16..3bfc6867 100755 --- a/app/controllers/foodcourt/home_controller.rb +++ b/app/controllers/foodcourt/home_controller.rb @@ -6,7 +6,7 @@ class Foodcourt::HomeController < BaseFoodcourtController @webview = check_mobile @tables = Table.unscoped.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc') @rooms = Room.unscoped.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc') - @complete = Sale.completed_sale("cashier",@shop.shop_code) + @complete = Sale.completed_sale("cashier") @orders = Order.includes("sale_orders").where("shop_code='#{@shop.shop_code}' and DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc') @customers = Customer.pluck("customer_id, name") @@ -21,7 +21,7 @@ class Foodcourt::HomeController < BaseFoodcourtController @webview = check_mobile @tables = Table.unscoped.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc') @rooms = Room.unscoped.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc') - @complete = Sale.completed_sale("cashier",@shop.shop_code) + @complete = Sale.completed_sale("cashier") @orders = Order.includes("sale_orders").where("shop_code='#{@shop.shop_code}' and DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc') @customers = Customer.pluck("customer_id, name") @shift = ShiftSale.current_open_shift(current_user) diff --git a/app/controllers/origami/pending_order_controller.rb b/app/controllers/origami/pending_order_controller.rb index c6bdb2e7..773a217e 100644 --- a/app/controllers/origami/pending_order_controller.rb +++ b/app/controllers/origami/pending_order_controller.rb @@ -5,7 +5,7 @@ class Origami::PendingOrderController < BaseOrigamiController @cashier_type = params[:type] @sale = Sale.pending_sale(@cashier_type) @order = Sale.pending_order(@cashier_type) - @completed = Sale.completed_sale(@cashier_type,@shop.shop_code) + @completed = Sale.completed_sale(@cashier_type) @customers = Customer.pluck("customer_id, name") @occupied_table = @sale.count.length + @order.count.length @@ -36,7 +36,7 @@ class Origami::PendingOrderController < BaseOrigamiController @cashier_type = params[:type] @sales = Sale.pending_sale(@cashier_type) @orders = Sale.pending_order(@cashier_type) - @completed = Sale.completed_sale(@cashier_type,@shop.shop_code) + @completed = Sale.completed_sale(@cashier_type) @customers = Customer.pluck("customer_id, name") @occupied_table = @sales.count.length + @orders.count.length @@ -46,7 +46,7 @@ class Origami::PendingOrderController < BaseOrigamiController @cashier_type = params[:type] @sales = Sale.pending_sale(@cashier_type) @orders = Sale.pending_order(@cashier_type) - @completed = Sale.completed_sale(@cashier_type,@shop.shop_code) + @completed = Sale.completed_sale(@cashier_type) @customers = Customer.pluck("customer_id, name") @occupied_table = @sales.count.length + @orders.count.length @@ -81,7 +81,7 @@ class Origami::PendingOrderController < BaseOrigamiController @cashier_type = params[:type] @sales = Sale.pending_sale(@cashier_type) @orders = Sale.pending_order(@cashier_type) - @completed = Sale.completed_sale(@cashier_type,@shop.shop_code) + @completed = Sale.completed_sale(@cashier_type) @occupied_table = @sales.count.length + @orders.count.length diff --git a/app/models/sale.rb b/app/models/sale.rb index 5b0b08d4..88bf96f9 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -527,6 +527,8 @@ class Sale < ApplicationRecord if order_source.to_s == "emenu" order_source = "cashier" + elsif order_source.to_s == "app" + order_source = "food_court" end tax_profiles = unique_tax_profiles(order_source, self.customer_id) From 16485875c1d9d3982d5cf9dfe80a1abafaa62ecb Mon Sep 17 00:00:00 2001 From: Myat Zin Wai Maw Date: Wed, 18 Dec 2019 10:15:24 +0630 Subject: [PATCH 3/3] add to existing order --- README.md | 3 + app/assets/javascripts/addorder.js | 28 +++++++++ app/controllers/api/orders_controller.rb | 3 + .../foodcourt/addorders_controller.rb | 51 ++++++++++++++++ .../foodcourt/food_court_controller.rb | 9 +++ .../foodcourt/sale_edit_controller.rb | 47 --------------- app/views/foodcourt/addorders/detail.html.erb | 59 +++---------------- app/views/foodcourt/sale_edit/edit.html.erb | 7 ++- config/puma.rb | 22 +++---- config/routes.rb | 1 + 10 files changed, 119 insertions(+), 111 deletions(-) diff --git a/README.md b/README.md index 54474f5e..62c69ed9 100755 --- a/README.md +++ b/README.md @@ -311,6 +311,9 @@ settings/lookups => {type:show_total_before_tax, name:Show Total Before Tax, val For Using Staff Meal settings/lookups => { type:customer_type, name: Staff, value:Staff } +For FoodCourt Cashier role +settings/lookups => { type:employee_roles, name: FoodCourt Cashier, value:foodcourt_cashier } + * ToDo list 1. Migration diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index d94dddb7..c40db476 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -1655,4 +1655,32 @@ $(function() { //end is_sub_item false } } + $("#add_to_existing_order").on('click', function(e){ + $(this).attr('disabled', 'disabled'); + e.preventDefault(); + type = $("#link_type").val(); + $("#oqs_loading_wrapper").show(); + var ajax_url = 'addorders/add_to_existing_order'; + var table_type = $('#table_type').text(); + var table_id = $('#table_id').text(); + var customer_id = $('#customer_id').text(); + var booking_id = $('#booking_id').text(); + var sale_id = $('#sale_id').text(); + var order_items = JSON.stringify(get_order_item_rows()); + var params = {'order_source': type, 'order_type': "dine_in", + 'customer_id': customer_id, 'guest_info': "",'booking_id':booking_id, + 'table_id': table_id, + 'order_items': order_items,'sale_id': sale_id,'create_type': "create_pay" }; + $.ajax({ + type: "POST", + url: ajax_url, + data: params, + dataType: "json", + success:function(result){ + if (result.status) { + window.location.href = "/foodcourt/table/sale/" + sale_id + "/food_court/edit"; + } + } + }); + }); }); diff --git a/app/controllers/api/orders_controller.rb b/app/controllers/api/orders_controller.rb index 0c512f5d..ec2f7eed 100755 --- a/app/controllers/api/orders_controller.rb +++ b/app/controllers/api/orders_controller.rb @@ -122,6 +122,9 @@ class Api::OrdersController < Api::ApiController end @status, @booking = @order.generate + if params[:order_source] != "app" + @order.process_order_queue(@order.order_id,@order.table_id,@order.source) + end if @order.table_id.to_i > 0 table = DiningFacility.find(@booking.dining_facility_id) type = 'order' diff --git a/app/controllers/foodcourt/addorders_controller.rb b/app/controllers/foodcourt/addorders_controller.rb index 2af43923..79ffdb37 100755 --- a/app/controllers/foodcourt/addorders_controller.rb +++ b/app/controllers/foodcourt/addorders_controller.rb @@ -305,5 +305,56 @@ class Foodcourt::AddordersController < BaseFoodcourtController return from end + def add_to_existing_order + if params[:booking_id].present? && params[:sale_id].present? + booking = Booking.find(params[:booking_id]) + saleobj =Sale.find(params[:sale_id]) + order =saleobj.orders[0] + items_arr = [] + JSON.parse(params[:order_items]).each { |i| + i["item_instance_code"] = i["item_instance_code"].downcase.to_s + if i["item_instance_code"].include? "ext" + is_extra_time = true + arr_exts = i["item_instance_code"].split("_") + if arr_exts[1].match(/^(\d)+$/) + time = arr_exts[1].to_i*60*i["quantity"].to_i + extra_time = Time.at(time) + end + end + if i["parent_order_item_id"]; + items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"parent_order_item_id": i["parent_order_item_id"],"options": JSON.parse(i["options"])} + else + items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"options": JSON.parse(i["options"])} + end + items_arr.push(items) + } + order.items = items_arr + order.new_booking = false + order.booking_id = booking.booking_id + @status, booking = order.generate + order_array = [] + items_arr.each do |item| + order_item =order.order_items.where("item_instance_code=?",item[:item_instance_code]).last + saleobj.add_item (order_item) + if !order_item.set_menu_items.nil? + saleobj.add_sub_item(order_item.set_menu_items) + end + end + # Re-compute for add + saleobj.compute(order.source) + saleobj.save + order.save + booking.save + order_array.push(order.order_id) + receipt_no = saleobj.receipt_no + action_by = current_user.name + type = "ADD_TO_EXISTING" + + remark = "#{action_by} add to existing order #{order_array} to Receipt No=>#{receipt_no}" + sale_audit = SaleAudit.record_audit_sale(saleobj.sale_id,remark,action_by,type ) + end + result = {:status=> @status} + render :json => result.to_json + end end diff --git a/app/controllers/foodcourt/food_court_controller.rb b/app/controllers/foodcourt/food_court_controller.rb index 13f72dc3..f5d4b653 100644 --- a/app/controllers/foodcourt/food_court_controller.rb +++ b/app/controllers/foodcourt/food_court_controller.rb @@ -8,6 +8,15 @@ class Foodcourt::FoodCourtController < ApplicationController end def index + if params[:sale_id].present? + sale =Sale.find(params[:sale_id]) + if sale + @sale_id =sale.sale_id + @booking_id =sale.bookings[0].booking_id + end + end + + today = DateTime.now day = Date.today.wday @menus = [] diff --git a/app/controllers/foodcourt/sale_edit_controller.rb b/app/controllers/foodcourt/sale_edit_controller.rb index 9971e50d..9bebbe0e 100755 --- a/app/controllers/foodcourt/sale_edit_controller.rb +++ b/app/controllers/foodcourt/sale_edit_controller.rb @@ -38,19 +38,6 @@ class Foodcourt::SaleEditController < BaseFoodcourtController # re-calc tax saleObj = Sale.find(saleitemObj.sale_id) - - - # booking = Booking.find_by_sale_id(saleitemObj.sale_id) - # booking.booking_orders.each do |bo| - # order = Order.find(bo.order_id) - # order.order_items.each do |o| - # if saleitemObj.product_code == o.item_code - # o.qty = saleitemObj.qty * -1 - # o.price = saleitemObj.price * -1 - # o.save - # end - # end - # end # FOr Sale Audit action_by = current_user.name if access_code != "null" && current_user.role == "cashier" @@ -99,26 +86,6 @@ class Foodcourt::SaleEditController < BaseFoodcourtController ProductCommission.create_product_commission(@newsaleitem, saleitemObj) end - # def item_edit - # saleitemId = params[:sale_item_id] - # update_qty = params[:update_qty] - # update_price = params[:update_price] - # saleitemObj = SaleItem.find(saleitemId) - # saleitemObj.status = 'void' - # saleitemObj.save - # @newsaleitem = SaleItem.new - # @newsaleitem = saleitemObj.dup - # @newsaleitem.save - # @newsaleitem.qty = update_qty - # @newsaleitem.price = update_price - # @newsaleitem.unit_price = update_price - # @newsaleitem.taxable_price = update_price - # @newsaleitem.is_taxable = 0 - # @newsaleitem.remark = 'edit' - # @newsaleitem.product_name = saleitemObj.product_name + " - updated" - # @newsaleitem.save - # end - def item_edit saleitemId = params[:sale_item_id] update_qty = params[:update_qty] @@ -149,20 +116,6 @@ class Foodcourt::SaleEditController < BaseFoodcourtController saleitemObj.save - # re-calc tax - # saleObj = Sale.find(saleitemObj.sale_id) - - # order_id = SaleOrder.find_by_sale_id(saleitemObj.sale_id).order_id - # order = Order.find(order_id) - - # order.order_items.each do |o| - # if saleitemObj.product_code == o.item_code - # o.qty = update_qty - # o.price = update_price - # o.save - # end - # end - sale.compute_by_sale_items(sale.total_discount, nil, order_source) ProductCommission.edit_product_commission(saleitemObj,sale.shop_code) diff --git a/app/views/foodcourt/addorders/detail.html.erb b/app/views/foodcourt/addorders/detail.html.erb index 73ee792e..f02dfb88 100644 --- a/app/views/foodcourt/addorders/detail.html.erb +++ b/app/views/foodcourt/addorders/detail.html.erb @@ -151,63 +151,17 @@
- <% if type %> -
-
- ORDER DETAILS -
- <% if modify_order %> - <% if @table.nil? %> - -
Table :
- - - - <% else%> - -
Table : <%=@table.name%>
- - - - <% end%> - - - - - -
- -
- <% else%> - -
- -
-
- -
- <% end%> -
- <% else %>
- ORDER DETAILS | Table-<%=@table.name%> - - - - + ORDER DETAILS - - +
- <% end%>
@@ -237,7 +191,11 @@ - + <% if @sale_id.nil?%> + + <% else %> + + <% end %>
@@ -360,7 +318,7 @@
- +
@@ -727,4 +685,5 @@ var webview = <%= @webview %>; showHideNavbar(webview); <% end %> }); + diff --git a/app/views/foodcourt/sale_edit/edit.html.erb b/app/views/foodcourt/sale_edit/edit.html.erb index e1a8dd85..a97364f3 100755 --- a/app/views/foodcourt/sale_edit/edit.html.erb +++ b/app/views/foodcourt/sale_edit/edit.html.erb @@ -155,6 +155,7 @@
+
@@ -421,7 +422,7 @@ var access_code = localStorage.getItem("access_code"); } } - function checkPrice(obj_value,sale_item_id) { - - } + $('#add_order').on('click', function () { + window.location.href = '/foodcourt/food_court?sale_id=<%=@saleobj.sale_id %>'; + }); diff --git a/config/puma.rb b/config/puma.rb index f0013d25..d24425ae 100755 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,11 +1,11 @@ -# application_path="#{File.expand_path("../..", __FILE__)}" -# directory application_path -# #environment ENV.fetch("RAILS_ENV") { "production" } -# environment "production" -# pidfile "#{application_path}/tmp/puma/pid" -# state_path "#{application_path}/tmp/puma/state" -# stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log" -# port ENV.fetch("PORT") { 62158 } -# workers 2 -# preload_app! -# threads 1,1 +application_path="#{File.expand_path("../..", __FILE__)}" +directory application_path +#environment ENV.fetch("RAILS_ENV") { "production" } +environment "production" +pidfile "#{application_path}/tmp/puma/pid" +state_path "#{application_path}/tmp/puma/state" +stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log" +port ENV.fetch("PORT") { 62158 } +workers 2 +preload_app! +threads 1,1 diff --git a/config/routes.rb b/config/routes.rb index 8828b51f..630265ba 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -677,6 +677,7 @@ scope "(:locale)", locale: /en|mm/ do get '/:addorders/:id' => "addorders#detail" post '/:addorders/create' => "addorders#create",:as => "addorder_create", :defaults => { :format => 'json' } + post '/:addorders/add_to_existing_order' => "addorders#add_to_existing_order",:as => "add_to_existing_order", :defaults => { :format => 'json' } get '/addorders/get_item_instance/:id' => "addorders#get_item_instance",:as => "get_item_instance", :defaults => { :format => 'json' }