diff --git a/README.md b/README.md index 0e92142a..2d9d60c9 100755 --- a/README.md +++ b/README.md @@ -193,6 +193,7 @@ For MoveTablePdf in print settings 1) settings/lookups => { type:tax_profiles, name: Cashier, value:cashier } 2) settings/lookups => { type:tax_profiles, name: Quick Service, value: quick_service } 3) settings/lookups => { type:tax_profiles, name: Doemal, value: doemal } +4) settings/lookups => { type:tax_profiles, name: Food Court, value: food_court } /* Tax Profile Group Types in lookups */ /*Receipt Pdf View in lookups */ @@ -261,6 +262,13 @@ For Food Court Settings On/Off ** '0' means can not use food court and '1' means can use food court ** => settings/lookups => { type:food_court, name: FoodCourt, value:'{0 or 1}' } +/* Customer Types in lookups */ +1) settings/lookups => { type:customer_type, name: Dinein, value:Dinein } +2) settings/lookups => { type:customer_type, name: Takeaway, value: Takeaway } +3) settings/lookups => { type:customer_type, name: Doemal, value: Doemal } +4) settings/lookups => { type:customer_type, name: FoodCourt, value: FoodCourt } +/* Tax Profile Group Types in lookups */ + * ToDo list 1. Migration diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index d7c176ab..1c6acf1b 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -2,7 +2,7 @@ $(function() { var role = $('#role').val(); var second_display_lookup = $("#display_type"); console.log(second_display_lookup) - type = window.location.href.indexOf("quick_service"); + type = window.location.href.indexOf("quick_service") || window.location.href.indexOf("food_court"); modify_order = window.location.href.indexOf("modify_order"); //click menu sidebar menu category @@ -146,7 +146,7 @@ $(function() { } }else{ - type = window.location.href.indexOf("quick_service"); + type = window.location.href.indexOf("quick_service") || window.location.href.indexOf("food_court"); modify_order = window.location.href.indexOf("modify_order"); if (type != -1 && modify_order != -1) { @@ -155,7 +155,7 @@ $(function() { url_item = 'addorders/'+url_item; } if (type ==-1 && modify_order == -1){ - url_item = url_item + url_item = url_item; } //Start Ajax @@ -241,7 +241,7 @@ $(function() { } } }else{ - type = window.location.href.indexOf("quick_service"); + type = window.location.href.indexOf("quick_service") || window.location.href.indexOf("food_court"); modify_order = window.location.href.indexOf("modify_order"); if (type != -1 && modify_order != -1) { url = '../../../addorders/get_item_instance/'+value[i]["id"]; @@ -848,17 +848,18 @@ $(function() { $(this).attr('disabled', 'disabled'); e.preventDefault(); $("#oqs_loading_wrapper").show(); - + var cashier_type = $("#link_type").val(); quick_service = window.location.href.indexOf("quick_service"); - if (quick_service != -1) { - type = 'quick_service' + food_court = window.location.href.indexOf("food_court"); + if (quick_service != -1 || food_court != -1) { + type = cashier_type; var table_type = $('#table_type').text(); var table_id = $('#table_id').val(); var customer_id = $('#customer_id').val(); var booking_id = $('#booking_id').text(); var ajax_url = 'addorders/create'; }else{ - type = 'cashier' + type = 'cashier'; var table_type = $('#table_type').text(); var table_id = $('#table_id').text(); var customer_id = $('#customer_id').text(); @@ -886,14 +887,14 @@ $(function() { data: params, dataType: "json", success:function(result){ - if (type == "quick_service") { - window.location.href = "/origami/quick_service" + if (type == "quick_service" || type=="food_court") { + window.location.href = "/origami/"+type; }else{ if(table_type == "Table"){ - window.location.href = "/origami/table/" + table_id + window.location.href = "/origami/table/" + table_id; } else { - window.location.href = "/origami/room/" + table_id + window.location.href = "/origami/room/" + table_id; } } if ($('#server_mode').val() != "cloud" && second_display_lookup == 2){ @@ -914,11 +915,11 @@ $(function() { $("#create_pay_order").on('click', function(e){ $(this).attr('disabled', 'disabled'); e.preventDefault(); - type = "quick_service" + type = $("#link_type").val(); modify_order = window.location.href.indexOf("modify_order"); $("#oqs_loading_wrapper").show(); if (modify_order !=-1) { - var ajax_url = '../../../quick_service/update_modify_order'; + var ajax_url = '../../../'+type+'/update_modify_order'; var table_type = $('#table_type').text(); var table_id = $('#table_id').text(); var customer_id = $('#customer_id').text(); @@ -962,13 +963,13 @@ $(function() { confirmButtonText: "Ok", closeOnConfirm: false }, function () { - window.location.href = '/origami/quick_service/pending_order/' + $('#sale_id').text(); + window.location.href = '/origami/'+type+'/pending_order/' + $('#sale_id').text(); }); }else if(result.data == 'OK'){ - window.location.href = '/origami/quick_service/pending_order/' + $('#sale_id').text(); + window.location.href = '/origami/'+type+'/pending_order/' + $('#sale_id').text(); }else{ - window.location.href = "/origami/sale/"+result.data["sale_id"]+"/"+type+"/payment" + window.location.href = "/origami/sale/"+result.data["sale_id"]+"/"+type+"/payment"; } } } @@ -1096,13 +1097,14 @@ $(function() { $("#back").on("click", function(){ var table_id = $('#table_id').text(); var table_type = $('#table_type').text(); - type = window.location.href.includes("quick_service"); + var cashier_type = $("#link_type").val(); + type = window.location.href.includes("quick_service") || window.location.href.includes("food_court"); if (type == true) { var table_type = $('#table_id').find("option:selected").data('type'); var table_id = $('#table_id').val(); if(window.location.href.includes("modify_order")){ var link_url = window.location.href.split("/"); - window.location.href = "/origami/quick_service/pending_order/"+link_url[link_url.length - 1]; + window.location.href = "/origami/"+cashier_type+"/pending_order/"+link_url[link_url.length - 1]; }else{ window.location.href = "/origami/dashboard"; } diff --git a/app/assets/javascripts/channels/bill.js b/app/assets/javascripts/channels/bill.js index 278e3d41..f551c103 100755 --- a/app/assets/javascripts/channels/bill.js +++ b/app/assets/javascripts/channels/bill.js @@ -9,16 +9,18 @@ App.order = App.cable.subscriptions.create('BillChannel', { var hostname = location.hostname.trim(); if(data.from == "" || hostname == data.from) { - if($('.table_'+data.table.id).hasClass('blue')){ - $('.table_'+data.table.id).removeClass('blue'); - $('.table_'+data.table.id).removeClass('green'); - $('.table_'+data.table.id).addClass('red'); - }else{ - $('.table_'+data.table.id).removeClass('orange'); - $('.table_'+data.table.id).addClass('red'); - } - $('.new_text_'+data.table.id).removeClass('hide'); - $('.new_text_'+data.table.id).text('billed'); + if(data.table != undefined && data.table != null && data.table!=""){ + if($('.table_'+data.table.id).hasClass('blue')){ + $('.table_'+data.table.id).removeClass('blue'); + $('.table_'+data.table.id).removeClass('green'); + $('.table_'+data.table.id).addClass('red'); + }else{ + $('.table_'+data.table.id).removeClass('orange'); + $('.table_'+data.table.id).addClass('red'); + } + $('.new_text_'+data.table.id).removeClass('hide'); + $('.new_text_'+data.table.id).text('billed'); + } } } }); diff --git a/app/assets/javascripts/custom.js b/app/assets/javascripts/custom.js index 3843f297..6aeace1e 100644 --- a/app/assets/javascripts/custom.js +++ b/app/assets/javascripts/custom.js @@ -228,6 +228,7 @@ function getOnlineOrderCount(){ url: "/origami/get_order_info", dataType: "json", success: function(data){ + console.log(data); if(parseInt(data) > 0){ count = parseInt(data); } diff --git a/app/controllers/origami/addorders_controller.rb b/app/controllers/origami/addorders_controller.rb index 025da23c..35d2a534 100755 --- a/app/controllers/origami/addorders_controller.rb +++ b/app/controllers/origami/addorders_controller.rb @@ -14,6 +14,7 @@ class Origami::AddordersController < BaseOrigamiController end def detail + @cashier_type = params[:type] @webview = false if check_mobile @webview = true @@ -194,7 +195,7 @@ class Origami::AddordersController < BaseOrigamiController end - if params[:order_source] != "quick_service" + if params[:order_source] != "quick_service" && params[:order_source] != "food_court" process_order_queue(@order.order_id,@order.table_id,@order.source) end end @@ -202,13 +203,16 @@ class Origami::AddordersController < BaseOrigamiController # Order.send_customer_view(@booking) if current_user.role != "waiter" && params[:create_type] == "create_pay" - if @status && @booking && @order.source == 'quick_service' + if @status && @booking && (@order.source == 'quick_service') || (@order.source == 'food_court') @status, @sale = Sale.request_bill(@order,current_user,current_login_employee) + # for second display - from = getCloudDomain #get sub domain in cloud mode - ActionCable.server.broadcast "second_display_channel",data: @sale,status:"sale",from:from - #end + if @order.source == 'quick_service' + from = getCloudDomain #get sub domain in cloud mode + ActionCable.server.broadcast "second_display_channel",data: @sale,status:"sale",from:from + end + #end result = {:status=> @status, :data => @sale } render :json => result.to_json end diff --git a/app/controllers/origami/dashboard_controller.rb b/app/controllers/origami/dashboard_controller.rb index 4d53cc15..08557cd6 100644 --- a/app/controllers/origami/dashboard_controller.rb +++ b/app/controllers/origami/dashboard_controller.rb @@ -59,6 +59,16 @@ class Origami::DashboardController < BaseOrigamiController if !quick_service[0].nil? @quick_service = quick_service[0][1] end + + #fourt court + food_court = Lookup.collection_of('food_court') + @food_court = 0 + @food_court_name = nil + if !food_court[0].nil? + @food_court = food_court[0][1] + @food_court_name = food_court[0][0] + end + #order reservation order_reservation = Lookup.collection_of('order_reservation') @order_reservation = 0 diff --git a/app/controllers/origami/food_court_controller.rb b/app/controllers/origami/food_court_controller.rb new file mode 100644 index 00000000..857da01f --- /dev/null +++ b/app/controllers/origami/food_court_controller.rb @@ -0,0 +1,262 @@ +class Origami::FoodCourtController < ApplicationController + # before_action :set_dining, only: [:detail] + before_action :check_user + def check_user + if current_user.nil? + redirect_to root_path + end + end + + def index + today = DateTime.now + day = Date.today.wday + # if params[:menu] == "true" + @menus = [] + @menu = [] + # else + # @menus = Menu.all + # @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc') + # end + @zone = Zone.all + @customer = Customer.all + @tables = Table.all.active.order('status desc') + @rooms = Room.all.active.order('status desc') + @cashier_type = "food_court" + #checked quick_service only + @quick_service_only = true + lookup_dine_in = Lookup.collection_of('dinein_cashier') + if !lookup_dine_in.empty? + lookup_dine_in.each do |dine_in| + if dine_in[0].downcase == "dineincashier" + if dine_in[1] == '1' + @quick_service_only = false + end + end + end + end + + render "origami/addorders/detail" + end + + def modify_order + @cashier_type = "food_court" + today = DateTime.now + day = Date.today.wday + # if params[:menu] == "true" + @menus = [] + @menu = [] + # else + # @menus = Menu.all + # @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc') + # end + if(params[:id][0,3] == "BKI") + @table_id = nil + @table = nil + @booking = Booking.find(params[:id]) + else + @table_id = params[:id] + @table = DiningFacility.find(@table_id) + @booking = @table.get_booking + end + + @sale_id = params[:sale_id] + + if @booking + @booking_id = @booking.booking_id + @order_items = Array.new + @booking.booking_orders.each do |booking_order| + order = Order.find(booking_order.order_id) + if (order.status == "new") + @obj_order = order + @customer = order.customer + @date = order.created_at + order.order_items.each do |item| + @order_items.push(item) + end + end + end + else + @booking = nil + end + render "origami/addorders/detail" + end + + def update_modify_order + Rails.logger.debug "Order Source - " + params[:order_source].to_s + Rails.logger.debug "Table ID - " + params[:table_id].to_s + is_extra_time = false + extra_time = '' + @cashier_type = "food_court" + + 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": i["options"]} + else + items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"options": i["options"]} + end + items_arr.push(items) + } + + # begin + @order = Order.new + @order.source = params[:order_source] + @order.order_type = params[:order_type] + @order.customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile + @order.items = items_arr + @order.guest = params[:guest_info] + @order.table_id = params[:table_id] # this is dining facilities's id + @order.new_booking = true + @order.waiters = current_login_employee.name + @order.employee_name = current_login_employee.name + + @order.is_extra_time = is_extra_time + @order.extra_time = extra_time + + #Create Table Booking or Room Booking + if !params["booking_id"].nil? + # check booking id is already completed. + booking = Booking.find(params[:booking_id]) + if params[:table_id].to_i > 0 + table_status = booking.dining_facility_id.to_i == params[:table_id].to_i + else + table_status = true + end + if booking + if table_status && booking.booking_status != 'moved' + if !booking.sale_id.nil? + sale_status = check_order_with_booking(booking) + if sale_status + return return_json_status_with_code(400, "bill requested") + end + else + @order.new_booking = false + @order.booking_id = params[:booking_id] + end + else + if params[:table_id].to_i > 0 + sale_status = check_order_with_table(params[:table_id]) + if sale_status + return return_json_status_with_code(400, "bill requested") + end + end + end + end #booking exists + else + if params[:table_id].to_i > 0 + sale_status = check_order_with_table(params[:table_id]) + if sale_status + # return false , @message = "bill requested" + return return_json_status_with_code(400, "bill requested") + end + end + end + + @status, @booking = @order.generate + if(params[:sale_id][0,3] == "SAL") + if @status && @booking && (@order.source == 'quick_service' || @order.source == 'food_court') + if params[:sale_id] + @sale = Sale.find(params[:sale_id]) + if @order.table_id.to_i > 0 + @table_id = @order.table_id + else + @table_id = nil + end + update = Sale.add_to_existing_pending_invoice(@table_id,params[:sale_id],@booking) + end + + result = {:status=> true, :data => @sale } + render :json => result.to_json + end + elsif (params[:sale_id][0,3] == "BKI") + result = {:status=> true, :data => 'OK' } + render :json => result.to_json + else + result = {:status=> true, :data => nil } + render :json => result.to_json + end + + end + + def get_menu_category () + if (params[:id]) + puts params[:id] + #Pull this menu + @menu = MenuCategory.find_by_id(params[:id]) + # puts @menu.menu_items[1].item_attributes.to_json + return @menu + else + MenuCategory.current_menu + end + end + + + def get_menu_sub_category () + id = params[:id] + if (id) + #Pull this menu + @sub_menu = MenuCategory.where("menu_category_id = #{id}").active + # puts @menu.menu_items[1].item_attributes.to_json + return @sub_menu + end + end + + def get_all_product() + @product = Product.all + end + + # render json for http status code + def return_json_status_with_code(code, msg) + render status: code, json: { + message: msg, + booking_id: booking_id + }.to_json + end + + def check_order_with_table(table_id) + table = DiningFacility.find(table_id) + if table + booking = table.get_current_booking + # puts booking + if booking + if !booking.sale_id.nil? + if booking.sale.sale_status == "completed" || booking.sale.sale_status == "new" + @order.new_booking = true + return false + end + else + @order.new_booking = false + @order.booking_id = booking.booking_id + return false + end + end + end + end + + def check_user + if current_user.nil? + redirect_to root_path + end + end + # this can always true + def check_order_with_booking(booking) + if booking.sale.sale_status == "completed" || booking.sale.sale_status == "new" + @order.new_booking = true + return false + else + @order.new_booking = false + @order.booking_id = params[:booking_id] + return false + end + end + +end diff --git a/app/controllers/origami/paymal_controller.rb b/app/controllers/origami/paymal_controller.rb index 19645e18..36c19327 100644 --- a/app/controllers/origami/paymal_controller.rb +++ b/app/controllers/origami/paymal_controller.rb @@ -1,68 +1,66 @@ class Origami::PaymalController < BaseOrigamiController def index - @sale_id = params[:sale_id] - payment_method = params[:payment_method] - @cashier_type = params[:type] - @membership_rebate_balance=0 - sale_data = Sale.find_by_sale_id(@sale_id) - @receipt_no = sale_data.receipt_no - @shop = Shop.first - if @shop.is_rounding_adj - new_total = Sale.get_rounding_adjustment(sale_data.grand_total) - else - new_total = sale_data.grand_total - end - @rounding_adj = new_total-sale_data.grand_total - # @rounding_adj = sale_data.rounding_adjustment + @sale_id = params[:sale_id] + payment_method = params[:payment_method] + @cashier_type = params[:type] + @membership_rebate_balance=0 + sale_data = Sale.find_by_sale_id(@sale_id) + @receipt_no = sale_data.receipt_no + @shop = Shop.first + if @shop.is_rounding_adj + new_total = Sale.get_rounding_adjustment(sale_data.grand_total) + else + new_total = sale_data.grand_total + end + @rounding_adj = new_total-sale_data.grand_total + # @rounding_adj = sale_data.rounding_adjustment - @payparcount = 0 - others = 0 - sale_data.sale_payments.each do |sale_payment| - if sale_payment.payment_method == "paypar" - @payparcount = @payparcount + sale_payment.payment_amount + @payparcount = 0 + others = 0 + sale_data.sale_payments.each do |sale_payment| + if sale_payment.payment_method == "paypar" + @payparcount = @payparcount + sale_payment.payment_amount + else + others = others + sale_payment.payment_amount + end + end + @payment_prices = sale_data.grand_total - @payparcount -others + + + if sale_data + if sale_data.customer_id + customer_data= Customer.find_by_customer_id(sale_data.customer_id) + if customer_data + @membership_id = customer_data.membership_id + if !@membership_id.nil? + membership_setting = MembershipSetting.find_by_membership_type("paypar_url") + if membership_setting.gateway_url + member_actions =MembershipAction.find_by_membership_type("get_account_balance") + if member_actions.gateway_url + @campaign_type_id = nil + url = membership_setting.gateway_url.to_s + member_actions.gateway_url.to_s + merchant_uid= member_actions.merchant_account_id + auth_token = member_actions.auth_token.to_s + membership_data = SalePayment.get_paypar_account(url,membership_setting.auth_token,@membership_id,@campaign_type_id,merchant_uid,auth_token) + if membership_data["status"]==true + @membership_rebate_balance=membership_data["balance"] + @out = true, @membership_rebate_balance,@membership_id + end else - others = others + sale_payment.payment_amount + @out =false,0 end - end - @payment_prices = sale_data.grand_total - @payparcount -others - - - if sale_data - if sale_data.customer_id - customer_data= Customer.find_by_customer_id(sale_data.customer_id) - if customer_data - @membership_id = customer_data.membership_id - if !@membership_id.nil? - membership_setting = MembershipSetting.find_by_membership_type("paypar_url") - if membership_setting.gateway_url - member_actions =MembershipAction.find_by_membership_type("get_account_balance") - if member_actions.gateway_url - @campaign_type_id = nil - url = membership_setting.gateway_url.to_s + member_actions.gateway_url.to_s - merchant_uid= member_actions.merchant_account_id - auth_token = member_actions.auth_token.to_s - membership_data = SalePayment.get_paypar_account(url,membership_setting.auth_token,@membership_id,@campaign_type_id,merchant_uid,auth_token) - if membership_data["status"]==true - @membership_rebate_balance=membership_data["balance"] - @out = true, @membership_rebate_balance,@membership_id - end - else - @out =false,0 - end - else + else @out = false,0 end - - else - @out = false, 0 - end - else + @out = false, 0 + end + else + @out = false, 0 + end + else @out = false, 0 end - else - @out = false, 0 - end else @out = false, 0 end diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index 7294eb80..bade57a0 100755 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -271,7 +271,8 @@ class Origami::PaymentsController < BaseOrigamiController end @member_discount = MembershipSetting.find_by_discount(1) - + @membership_rebate_balance=0 + if Sale.exists?(sale_id) @cash = 0.0 @other = 0.0 @@ -399,6 +400,8 @@ class Origami::PaymentsController < BaseOrigamiController #end customer amount + #paymal payment + @sale_data.bookings.each do |sbk| if sbk.dining_facility_id.to_i >0 df = DiningFacility.find(sbk.dining_facility_id) diff --git a/app/controllers/origami/pending_order_controller.rb b/app/controllers/origami/pending_order_controller.rb index f66c4017..20b3f6f7 100644 --- a/app/controllers/origami/pending_order_controller.rb +++ b/app/controllers/origami/pending_order_controller.rb @@ -2,17 +2,21 @@ class Origami::PendingOrderController < BaseOrigamiController def index # @dining= DiningFacility.where("status = 'occupied'") # @order = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status = 'billed' and source = 'quick_service'",DateTime.now.strftime('%Y-%m-%d')) - @sale = Sale.pending_sale - @order = Sale.pending_order - @completed = Sale.completed_sale("quick_service") + @cashier_type = params[:type] + @sale = Sale.pending_sale(@cashier_type) + @order = Sale.pending_order(@cashier_type) + @completed = Sale.completed_sale(@cashier_type) @customers = Customer.pluck("customer_id, name") @occupied_table = @sale.count.length + @order.count.length + end + def show - @sales = Sale.pending_sale - @orders = Sale.pending_order - @completed = Sale.completed_sale("quick_service") + @cashier_type = params[:type] + @sales = Sale.pending_sale(@cashier_type) + @orders = Sale.pending_order(@cashier_type) + @completed = Sale.completed_sale(@cashier_type) @customers = Customer.pluck("customer_id, name") @occupied_table = @sales.count.length + @orders.count.length @@ -51,9 +55,10 @@ class Origami::PendingOrderController < BaseOrigamiController end def completed_sale - @sales = Sale.pending_sale - @orders = Sale.pending_order - @completed = Sale.completed_sale("quick_service") + @cashier_type = params[:type] + @sales = Sale.pending_sale(@cashier_type) + @orders = Sale.pending_order(@cashier_type) + @completed = Sale.completed_sale(@cashier_type) @customers = Customer.pluck("customer_id, name") @occupied_table = @sales.count.length + @orders.count.length @@ -76,16 +81,19 @@ class Origami::PendingOrderController < BaseOrigamiController end def cash_ins + @cashier_type = params[:type] render "origami/cash_ins/new" end def cash_outs + @cashier_type = params[:type] render "origami/cash_outs/new" end def credit_sale - @sales = Sale.pending_sale - @orders = Sale.pending_order - @completed = Sale.completed_sale("quick_service") + @cashier_type = params[:type] + @sales = Sale.pending_sale(@cashier_type) + @orders = Sale.pending_order(@cashier_type) + @completed = Sale.completed_sale(@cashier_type) @occupied_table = @sales.count.length + @orders.count.length diff --git a/app/controllers/origami/quick_service_controller.rb b/app/controllers/origami/quick_service_controller.rb index 1924f33e..85d09486 100644 --- a/app/controllers/origami/quick_service_controller.rb +++ b/app/controllers/origami/quick_service_controller.rb @@ -21,7 +21,7 @@ class Origami::QuickServiceController < ApplicationController @customer = Customer.all @tables = Table.all.active.order('status desc') @rooms = Room.all.active.order('status desc') - + @cashier_type = "quick_service" #checked quick_service only @quick_service_only = true lookup_dine_in = Lookup.collection_of('dinein_cashier') @@ -39,6 +39,7 @@ class Origami::QuickServiceController < ApplicationController end def modify_order + @cashier_type = "quick_service" today = DateTime.now day = Date.today.wday # if params[:menu] == "true" @@ -85,6 +86,7 @@ class Origami::QuickServiceController < ApplicationController Rails.logger.debug "Table ID - " + params[:table_id].to_s is_extra_time = false extra_time = '' + @cashier_type = "quick_service" items_arr = [] JSON.parse(params[:order_items]).each { |i| diff --git a/app/controllers/origami/request_bills_controller.rb b/app/controllers/origami/request_bills_controller.rb index 6d57904e..617e5c35 100755 --- a/app/controllers/origami/request_bills_controller.rb +++ b/app/controllers/origami/request_bills_controller.rb @@ -62,8 +62,10 @@ class Origami::RequestBillsController < ApplicationController from = "" end - ActionCable.server.broadcast "bill_channel",table: table, from: from - if order.source == "quick_service" + if order.source == "cashier" || order.source == "quick_service" + ActionCable.server.broadcast "bill_channel",table: table, from: from + end + if order.source == "quick_service" || order.source == "food_court" result = {:status=> @status, :data => @sale.sale_id } render :json => result.to_json else diff --git a/app/controllers/origami/surveys_controller.rb b/app/controllers/origami/surveys_controller.rb index 222a3a88..700159bb 100644 --- a/app/controllers/origami/surveys_controller.rb +++ b/app/controllers/origami/surveys_controller.rb @@ -64,7 +64,7 @@ class Origami::SurveysController < BaseOrigamiController shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(shift.cashier_terminal_id,nil) end - if @type == "quick_service" + if @type == "quick_service" || @type == "food_court" @url = "/origami/sale/"+@sale_id+"/"+@type+"/payment" else @url = "/origami/"+@dining_facility.type.downcase+"/"+params[:table_id] diff --git a/app/models/sale.rb b/app/models/sale.rb index 4890aadf..c772516d 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -2889,18 +2889,18 @@ end end end - def self.pending_sale + def self.pending_sale(type) query = Sale.all query = query.joins("join sale_orders as sale_orders on sale_orders.sale_id = sales.sale_id") .joins("join orders as orders on orders.order_id = sale_orders.order_id") - query = query.where("sales.sale_status = 'new' AND orders.status = 'billed' AND orders.source =? ","quick_service") + query = query.where("sales.sale_status = 'new' AND orders.status = 'billed' AND orders.source =? ","#{type}") .group("sales.sale_id") end - def self.pending_order + def self.pending_order(type) query = Booking.all query = query.joins("join booking_orders as booking_orders on booking_orders.booking_id = bookings.booking_id") .joins("join orders as orders on orders.order_id = booking_orders.order_id") - query = query.where("bookings.booking_status = 'assign' AND orders.status = 'new' AND orders.source =? ","quick_service") + query = query.where("bookings.booking_status = 'assign' AND orders.status = 'new' AND orders.source =? ","#{type}") .group("bookings.booking_id") end def self.completed_sale(type) diff --git a/app/pdf/order_item_customise_pdf.rb b/app/pdf/order_item_customise_pdf.rb index dde79917..dcd45ebd 100644 --- a/app/pdf/order_item_customise_pdf.rb +++ b/app/pdf/order_item_customise_pdf.rb @@ -52,6 +52,15 @@ class OrderItemCustomisePdf < Prawn::Document # Write Order Information to PDF def order_info(order_no, order_by, order_at) + #booking ID + booking_id = get_booking_id(order_no) + + y_position = cursor + bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do + text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left + end + + move_down 1 y_position = cursor bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do text "OrderNo: #{order_no} ", :size => self.order_no_font_size,:align => :left @@ -142,4 +151,12 @@ class OrderItemCustomisePdf < Prawn::Document end end + def get_booking_id(order_no) + booking = Booking.joins(" JOIN booking_orders bo ON bo.booking_id = bookings.booking_id") + .joins(" JOIN orders o ON o.order_id=bo.order_id") + .where("o.order_id='#{order_no}'") + .first() + + return booking.booking_id + end end diff --git a/app/pdf/order_item_pdf.rb b/app/pdf/order_item_pdf.rb index c3bf566f..086447db 100755 --- a/app/pdf/order_item_pdf.rb +++ b/app/pdf/order_item_pdf.rb @@ -50,7 +50,16 @@ class OrderItemPdf < Prawn::Document end # Write Order Information to PDF - def order_info(order_no, order_by, order_at) + def order_info(order_no, order_by, order_at) + #booking ID + booking_id = get_booking_id(order_no) + + y_position = cursor + bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do + text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left + end + + move_down 2 y_position = cursor bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do text "OrderNo: #{order_no}", :size => self.item_font_size,:align => :left @@ -141,4 +150,12 @@ class OrderItemPdf < Prawn::Document end end + def get_booking_id(order_no) + booking = Order.joins(" JOIN booking_orders bo ON bo.order_id = orders.order_id") + .joins(" JOIN bookings b ON b.booking_id=bo.booking_id") + .where("orders.order_id='#{order_no}'") + .first() + + return booking.booking_id + end end diff --git a/app/pdf/order_item_slim_customise_pdf.rb b/app/pdf/order_item_slim_customise_pdf.rb index a63900a6..f2a67eb0 100644 --- a/app/pdf/order_item_slim_customise_pdf.rb +++ b/app/pdf/order_item_slim_customise_pdf.rb @@ -52,6 +52,15 @@ class OrderItemSlimCustomisePdf < Prawn::Document # Write Order Information to PDF def order_info(order_no, order_by, order_at) + #booking ID + booking_id = get_booking_id(order_no) + + y_position = cursor + bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do + text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left + end + + move_down 1 y_position = cursor bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do text "OrderNo: #{order_no} ", :size => self.item_slim_font_size,:align => :left @@ -141,4 +150,13 @@ class OrderItemSlimCustomisePdf < Prawn::Document end end end + + def get_booking_id(order_no) + booking = Booking.joins(" JOIN booking_orders bo ON bo.booking_id = bookings.booking_id") + .joins(" JOIN orders o ON o.order_id=bo.order_id") + .where("o.order_id='#{order_no}'") + .first() + + return booking.booking_id + end end diff --git a/app/pdf/order_item_slim_pdf.rb b/app/pdf/order_item_slim_pdf.rb index 92158663..5db7e78a 100755 --- a/app/pdf/order_item_slim_pdf.rb +++ b/app/pdf/order_item_slim_pdf.rb @@ -51,6 +51,15 @@ class OrderItemSlimPdf < Prawn::Document # Write Order Information to PDF def order_info(order_no, order_by, order_at) + #booking ID + booking_id = get_booking_id(order_no) + + y_position = cursor + bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do + text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left + end + + move_down 1 y_position = cursor bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do text "OrderNo: #{order_no} ", :size => self.item_font_size,:align => :left @@ -140,4 +149,13 @@ class OrderItemSlimPdf < Prawn::Document end end + def get_booking_id(order_no) + booking = Booking.joins(" JOIN booking_orders bo ON bo.booking_id = bookings.booking_id") + .joins(" JOIN orders o ON o.order_id=bo.order_id") + .where("o.order_id='#{order_no}'") + .first() + + return booking.booking_id + end + end diff --git a/app/pdf/order_set_item_customise_pdf.rb b/app/pdf/order_set_item_customise_pdf.rb index 2f985c5f..7cdea13a 100644 --- a/app/pdf/order_set_item_customise_pdf.rb +++ b/app/pdf/order_set_item_customise_pdf.rb @@ -51,6 +51,15 @@ class OrderSetItemCustomisePdf < Prawn::Document # Write Order Information to PDF def order_info(order_no, order_by, order_at) + #booking ID + booking_id = get_booking_id(order_no) + + y_position = cursor + bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do + text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left + end + + move_down 1 y_position = cursor bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do text "OrderNo: #{order_no} ", :size => self.order_no_font_size,:align => :left @@ -157,4 +166,13 @@ class OrderSetItemCustomisePdf < Prawn::Document end end + def get_booking_id(order_no) + booking = Booking.joins(" JOIN booking_orders bo ON bo.booking_id = bookings.booking_id") + .joins(" JOIN orders o ON o.order_id=bo.order_id") + .where("o.order_id='#{order_no}'") + .first() + + return booking.booking_id + end + end diff --git a/app/pdf/order_set_item_pdf.rb b/app/pdf/order_set_item_pdf.rb index 14a8ff62..1e9ca6cd 100755 --- a/app/pdf/order_set_item_pdf.rb +++ b/app/pdf/order_set_item_pdf.rb @@ -50,6 +50,15 @@ class OrderSetItemPdf < Prawn::Document # Write Order Information to PDF def order_info(order_no, order_by, order_at) + #booking ID + booking_id = get_booking_id(order_no) + + y_position = cursor + bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do + text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left + end + + move_down 2 y_position = cursor bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do text "OrderNo: #{order_no} ", :size => self.item_font_size,:align => :left @@ -143,17 +152,26 @@ class OrderSetItemPdf < Prawn::Document end - #add updated qty text - def add_updated_qty_text(before_updated_qty, updated_qty, precision) - if before_updated_qty.to_i > 0 && !before_updated_qty.nil? - move_down 5 + #add updated qty text + def add_updated_qty_text(before_updated_qty, updated_qty, precision) + if before_updated_qty.to_i > 0 && !before_updated_qty.nil? + move_down 5 - # add option - y_position = cursor - bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do - text "* Change quantity [#{number_with_precision(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_with_precision(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left + # add option + y_position = cursor + bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do + text "* Change quantity [#{number_with_precision(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_with_precision(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left + end end end - end + + def get_booking_id(order_no) + booking = Booking.joins(" JOIN booking_orders bo ON bo.booking_id = bookings.booking_id") + .joins(" JOIN orders o ON o.order_id=bo.order_id") + .where("o.order_id='#{order_no}'") + .first() + + return booking.booking_id + end end diff --git a/app/pdf/order_summary_customise_pdf.rb b/app/pdf/order_summary_customise_pdf.rb index 30a32117..a5b39dd9 100644 --- a/app/pdf/order_summary_customise_pdf.rb +++ b/app/pdf/order_summary_customise_pdf.rb @@ -55,7 +55,16 @@ class OrderSummaryCustomisePdf < Prawn::Document end # Write Order Information to PDF - def order_info(order_no, order_by, order_at) + def order_info(order_no, order_by, order_at) + #booking ID + booking_id = get_booking_id(order_no) + + y_position = cursor + bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do + text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left + end + + move_down 1 y_position = cursor bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do text "OrderNo: #{order_no} ", :size => self.order_no_font_size,:align => :left @@ -144,4 +153,13 @@ class OrderSummaryCustomisePdf < Prawn::Document # end end end + + def get_booking_id(order_no) + booking = Booking.joins(" JOIN booking_orders bo ON bo.booking_id = bookings.booking_id") + .joins(" JOIN orders o ON o.order_id=bo.order_id") + .where("o.order_id='#{order_no}'") + .first() + + return booking.booking_id + end end diff --git a/app/pdf/order_summary_pdf.rb b/app/pdf/order_summary_pdf.rb index 5feb337e..e1d7e17d 100755 --- a/app/pdf/order_summary_pdf.rb +++ b/app/pdf/order_summary_pdf.rb @@ -54,7 +54,16 @@ class OrderSummaryPdf < Prawn::Document end # Write Order Information to PDF - def order_info(order_no, order_by, order_at) + def order_info(order_no, order_by, order_at) + #booking ID + booking_id = get_booking_id(order_no) + + y_position = cursor + bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do + text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left + end + + move_down 5 y_position = cursor bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do text "OrderNo: #{order_no} ", :size => self.item_font_size,:align => :left @@ -154,4 +163,13 @@ class OrderSummaryPdf < Prawn::Document # end end end + + def get_booking_id(order_no) + booking = Booking.joins(" JOIN booking_orders bo ON bo.booking_id = bookings.booking_id") + .joins(" JOIN orders o ON o.order_id=bo.order_id") + .where("o.order_id='#{order_no}'") + .first() + + return booking.booking_id + end end diff --git a/app/pdf/order_summary_set_customise_pdf.rb b/app/pdf/order_summary_set_customise_pdf.rb index 5f12fc4c..e2d22891 100644 --- a/app/pdf/order_summary_set_customise_pdf.rb +++ b/app/pdf/order_summary_set_customise_pdf.rb @@ -55,6 +55,15 @@ class OrderSummarySetCustomisePdf < Prawn::Document # Write Order Information to PDF def order_info(order_no, order_by, order_at) + #booking ID + booking_id = get_booking_id(order_no) + + y_position = cursor + bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do + text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left + end + + move_down 1 y_position = cursor bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do text "OrderNo: #{order_no} ", :size => self.order_no_font_size,:align => :left @@ -159,4 +168,13 @@ class OrderSummarySetCustomisePdf < Prawn::Document # end end end + + def get_booking_id(order_no) + booking = Booking.joins(" JOIN booking_orders bo ON bo.booking_id = bookings.booking_id") + .joins(" JOIN orders o ON o.order_id=bo.order_id") + .where("o.order_id='#{order_no}'") + .first() + + return booking.booking_id + end end diff --git a/app/pdf/order_summary_set_pdf.rb b/app/pdf/order_summary_set_pdf.rb index 316bbe44..d07f7afe 100755 --- a/app/pdf/order_summary_set_pdf.rb +++ b/app/pdf/order_summary_set_pdf.rb @@ -54,6 +54,15 @@ class OrderSummarySetPdf < Prawn::Document # Write Order Information to PDF def order_info(order_no, order_by, order_at) + #booking ID + booking_id = get_booking_id(order_no) + + y_position = cursor + bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do + text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left + end + + move_down 5 y_position = cursor bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do text "OrderNo: #{order_no} ", :size => self.item_font_size,:align => :left @@ -169,4 +178,13 @@ class OrderSummarySetPdf < Prawn::Document # end end end + + def get_booking_id(order_no) + booking = Booking.joins(" JOIN booking_orders bo ON bo.booking_id = bookings.booking_id") + .joins(" JOIN orders o ON o.order_id=bo.order_id") + .where("o.order_id='#{order_no}'") + .first() + + return booking.booking_id + end end diff --git a/app/pdf/order_summary_slim_customise_pdf.rb b/app/pdf/order_summary_slim_customise_pdf.rb index 2b7402af..8225c0c3 100644 --- a/app/pdf/order_summary_slim_customise_pdf.rb +++ b/app/pdf/order_summary_slim_customise_pdf.rb @@ -54,7 +54,16 @@ class OrderSummarySlimCustomisePdf < Prawn::Document end # Write Order Information to PDF - def order_info(order_no, order_by, order_at) + def order_info(order_no, order_by, order_at) + #booking ID + booking_id = get_booking_id(order_no) + + y_position = cursor + bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do + text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left + end + + move_down 1 y_position = cursor bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do text "OrderNo: #{order_no} ", :size => self.item_slim_font_size,:align => :left @@ -145,4 +154,13 @@ class OrderSummarySlimCustomisePdf < Prawn::Document # end end end + + def get_booking_id(order_no) + booking = Booking.joins(" JOIN booking_orders bo ON bo.booking_id = bookings.booking_id") + .joins(" JOIN orders o ON o.order_id=bo.order_id") + .where("o.order_id='#{order_no}'") + .first() + + return booking.booking_id + end end diff --git a/app/pdf/order_summary_slim_pdf.rb b/app/pdf/order_summary_slim_pdf.rb index 1e93fc0d..8f60c711 100755 --- a/app/pdf/order_summary_slim_pdf.rb +++ b/app/pdf/order_summary_slim_pdf.rb @@ -54,6 +54,15 @@ class OrderSummarySlimPdf < Prawn::Document # Write Order Information to PDF def order_info(order_no, order_by, order_at) + #booking ID + booking_id = get_booking_id(order_no) + + y_position = cursor + bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do + text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left + end + + move_down 1 y_position = cursor bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do text "OrderNo: #{order_no} ", :size => self.item_font_size,:align => :left @@ -152,4 +161,13 @@ class OrderSummarySlimPdf < Prawn::Document # end end end + + def get_booking_id(order_no) + booking = Booking.joins(" JOIN booking_orders bo ON bo.booking_id = bookings.booking_id") + .joins(" JOIN orders o ON o.order_id=bo.order_id") + .where("o.order_id='#{order_no}'") + .first() + + return booking.booking_id + end end diff --git a/app/pdf/receipt_bill_a5_pdf.rb b/app/pdf/receipt_bill_a5_pdf.rb index f32c1009..579c6ff8 100644 --- a/app/pdf/receipt_bill_a5_pdf.rb +++ b/app/pdf/receipt_bill_a5_pdf.rb @@ -118,12 +118,17 @@ class ReceiptBillA5Pdf < Prawn::Document end def cashier_info(sale_data, customer_name, latest_order_no) + move_down line_move + text "Booking : #{ sale_data.bookings[0].booking_id }", :size => self.header_font_size+5,:align => :left + move_down line_move + move_down line_move if !latest_order_no.nil? move_down line_move - text "OrderNo : #{ latest_order_no }", :size => self.header_font_size,:align => :left + text "OrderNo : #{ latest_order_no }", :size => self.header_font_size+2,:align => :left end move_down line_move + # move_down 2 y_position = cursor bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb index e3fb259b..9dd3faeb 100755 --- a/app/pdf/receipt_bill_pdf.rb +++ b/app/pdf/receipt_bill_pdf.rb @@ -118,12 +118,17 @@ class ReceiptBillPdf < Prawn::Document end def cashier_info(sale_data, customer_name, latest_order_no) + move_down line_move + text "Booking : #{ sale_data.bookings[0].booking_id }", :size => self.header_font_size+2,:align => :left + move_down line_move + move_down line_move if !latest_order_no.nil? move_down line_move - text "OrderNo : #{ latest_order_no }", :size => self.header_font_size,:align => :left + text "OrderNo : #{ latest_order_no }", :size => self.header_font_size+2,:align => :left end move_down line_move + # move_down 2 y_position = cursor bounding_box([0,y_position], :width =>self.description_width + self.price_num_width, :height => self.item_height) do diff --git a/app/views/origami/addorders/detail.html.erb b/app/views/origami/addorders/detail.html.erb index a553c018..50f25902 100644 --- a/app/views/origami/addorders/detail.html.erb +++ b/app/views/origami/addorders/detail.html.erb @@ -2,7 +2,7 @@ <%= javascript_include_tag 'addorder', 'data-turbolinks-track': 'reload' %> -<% type = request.path_info.include?('quick_service')%> +<% type = request.path_info.include?('quick_service') || request.path_info.include?('food_court')%> <% modify_order = request.path_info.include?('modify_order')%>
@@ -11,6 +11,7 @@
+
diff --git a/app/views/origami/cash_outs/new.html.erb b/app/views/origami/cash_outs/new.html.erb index 32f43099..ea83b2e0 100755 --- a/app/views/origami/cash_outs/new.html.erb +++ b/app/views/origami/cash_outs/new.html.erb @@ -25,7 +25,7 @@
diff --git a/app/views/origami/customers/index.html.erb b/app/views/origami/customers/index.html.erb index 968f8d12..585ee33f 100644 --- a/app/views/origami/customers/index.html.erb +++ b/app/views/origami/customers/index.html.erb @@ -120,7 +120,7 @@ - <% elsif @cashier_type == 'quick_service' %> + <% elsif @cashier_type == 'quick_service' || @cashier_type == "food_court" %> @@ -643,7 +643,7 @@ <% if !@booking_order.nil? %> booking_id = "<%= @booking_order.booking_id %>"; <% end %> - if (cashier_type == "quick_service") { + if (cashier_type == "quick_service" || cashier_type == "food_court") { if(booking_id!= "" && page == "pending"){ window.location.href = '/origami/'+cashier_type+'/pending_order/'+booking_id; }else{ @@ -673,7 +673,7 @@ var id = $("#table_id").val(); var type = $("#table_type").val(); var sale_id = $("#sale_id").val(); - if (cashier_type == "quick_service") { + if (cashier_type == "quick_service" || cashier_type == "food_court") { window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/'; }else{ if(page == "pending"){ diff --git a/app/views/origami/dashboard/index.html.erb b/app/views/origami/dashboard/index.html.erb index 92b34074..065c0686 100644 --- a/app/views/origami/dashboard/index.html.erb +++ b/app/views/origami/dashboard/index.html.erb @@ -31,6 +31,16 @@ <% end %> + <% if @food_court == '1' %> +
+
+
+ arrow_forward +
+
<%= @food_court_name %>
+
+
+ <% end %> <% if @dinein_cashier == '1' %>
@@ -242,6 +252,19 @@ $(function() { window.location.href = '/origami/quick_service'; }); + $(".fc_view").on('click', function() { + var display_type = '<%= @display_type %>'; + if (display_type.length>0) { + display_type = '<%= @display_type %>'; + }else{ + display_type = null; + } + if ($('#server_mode').val() != "cloud" && display_type == 2) { + document.getElementById('second_view').click(); + } + window.location.href = '/origami/food_court'; + }); + $(".order_reservation").on('click', function() { window.location.href = '/origami/order_reservation'; }); diff --git a/app/views/origami/discounts/index.html.erb b/app/views/origami/discounts/index.html.erb index ac94fd18..e23e4e6f 100755 --- a/app/views/origami/discounts/index.html.erb +++ b/app/views/origami/discounts/index.html.erb @@ -265,7 +265,7 @@ var cashier_type = "<%= @cashier_type %>"; var id = $("#table_id").text(); var type = $("#table_type").text(); var sale_id = $('#sale-id').text(); - if (cashier_type=="quick_service") { + if (cashier_type=="quick_service" || cashier_type=="food_court") { window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/'; }else{ if (type=="Table") { @@ -454,7 +454,7 @@ var cashier_type = "<%= @cashier_type %>"; title: "Information!", text: result.status, }, function () { - if (cashier_type=="quick_service") { + if (cashier_type=="quick_service" || cashier_type=="food_court") { window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/'; }else{ if(result.table_type == "Table"){ @@ -504,7 +504,7 @@ var cashier_type = "<%= @cashier_type %>"; text: result.status, type: "success", }, function () { - if (cashier_type=="quick_service") { + if (cashier_type=="quick_service" || cashier_type=="food_court") { window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/'; }else{ if(result.table_type == "Table"){ @@ -531,7 +531,7 @@ var cashier_type = "<%= @cashier_type %>"; text: result.status, type: "success", }, function () { - if (cashier_type=="quick_service") { + if (cashier_type=="quick_service" || cashier_type=="food_court") { window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/'; }else{ if(result.table_type == "Table"){ @@ -580,7 +580,7 @@ var cashier_type = "<%= @cashier_type %>"; confirmButtonText: 'OK', confirmButtonColor: btn_color, }, function () { - if (cashier_type=="quick_service") { + if (cashier_type=="quick_service" || cashier_type=="food_court") { window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/'; }else{ if(result.table_type == "Table"){ diff --git a/app/views/origami/other_charges/index.html.erb b/app/views/origami/other_charges/index.html.erb index fe74f057..886eda51 100755 --- a/app/views/origami/other_charges/index.html.erb +++ b/app/views/origami/other_charges/index.html.erb @@ -333,7 +333,7 @@ title: "Information!", text: "Success", }, function () { - if (cashier_type=="quick_service") { + if (cashier_type=="quick_service" || cashier_type=="food_court") { window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/'; }else{ if(result.table_type == "Table"){ diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index 4d3f430c..caa72f5e 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -35,7 +35,7 @@
Customer : - <% if @cashier_type == 'quick_service' %> + <% if @cashier_type == 'quick_service' || @cashier_type == 'food_court' %> <% else %> <%= @sale_data.customer.name%> @@ -193,7 +193,7 @@ <%= number_with_precision(@cash, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %>
- <% if @sale_payment.nil? %> + <% if @sale_payment.nil? && @cashier_type != "food_court" %>
Credit
<%= number_with_precision(@credit, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %>
@@ -209,7 +209,7 @@
<% else %> -
+
Other Payments
<%= number_with_precision(@other_payment, precision: precision.to_i) rescue number_with_precision(0, precision: precision.to_i) %> @@ -432,7 +432,7 @@ <% end %> <% end %> -<% if @cashier_type=="quick_service" && @sale_payment.nil? %> +<% if (@cashier_type=="quick_service" || @cashier_type=="food_court") && @sale_payment.nil? %>
@@ -669,6 +669,32 @@
+ + + diff --git a/app/views/origami/pending_order/completed_sale.html.erb b/app/views/origami/pending_order/completed_sale.html.erb index f2d66b37..a90c8d8f 100644 --- a/app/views/origami/pending_order/completed_sale.html.erb +++ b/app/views/origami/pending_order/completed_sale.html.erb @@ -10,10 +10,11 @@ - + <% if @cashier_type == "quick_service" %> + <% end %>
@@ -49,37 +50,39 @@
-
-
-
-
- + <% if @cashier_type == "quick_service" %> +
+
+
+
+ +
+
+ +
-
- +
+ + + + + + + + + +
<%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %><%= t("views.right_panel.detail.receipt_no") %> <%= t :cashier %> <%= t("views.right_panel.detail.name") %> <%= t :customer %> <%= t("views.right_panel.detail.name") %> <%= t("views.right_panel.detail.credit_amount") %>
-
- - - - - - - - - -
<%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %><%= t("views.right_panel.detail.receipt_no") %> <%= t :cashier %> <%= t("views.right_panel.detail.name") %> <%= t :customer %> <%= t("views.right_panel.detail.name") %> <%= t("views.right_panel.detail.credit_amount") %>
-
-
+ <% end %>
@@ -303,17 +306,17 @@ diff --git a/app/views/origami/quick_service/index.html.erb b/app/views/origami/quick_service/index.html.erb deleted file mode 100644 index e69de29b..00000000 diff --git a/app/views/origami/sale_edit/edit.html.erb b/app/views/origami/sale_edit/edit.html.erb index 08613715..66aaf379 100755 --- a/app/views/origami/sale_edit/edit.html.erb +++ b/app/views/origami/sale_edit/edit.html.erb @@ -321,7 +321,7 @@ var access_code = localStorage.getItem("access_code"); $('#back').on('click', function () { var table_id = '<%= @table_id %>' var sale_id = "<%= @saleobj.sale_id %>" - if (cashier_type=="quick_service") { + if (cashier_type=="quick_service" || cashier_type == "food_court") { window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/'; }else{ window.location.href = '/origami/table/' + table_id; @@ -350,7 +350,7 @@ var access_code = localStorage.getItem("access_code"); url: ajax_url, data: 'sale_id=' + sale_id+'&type='+cashier_type, success: function (result) { - if (cashier_type=="quick_service") { + if (cashier_type=="quick_service" || cashier_type=="food_court") { window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/'; }else{ window.location.href = '/origami/table/' + table_id; diff --git a/app/views/origami/surveys/_form.html.erb b/app/views/origami/surveys/_form.html.erb index eddb275d..8bc99b8b 100755 --- a/app/views/origami/surveys/_form.html.erb +++ b/app/views/origami/surveys/_form.html.erb @@ -429,7 +429,7 @@ var cashier_type = "<%= @cashier_type %>"; var table_type = $('#table_type').val(); var table_id = $('#table_id').val(); - if (cashier_type == "quick_service") { + if (cashier_type == "quick_service" || cashier_type == "food_court") { window.location.href = '/origami/sale/<%= @id %>/<%= @cashier_type %>/payment/'; }else{ if(table_type == "Table"){ diff --git a/config/routes.rb b/config/routes.rb index 3dabf4d8..b3ad9a6a 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -105,16 +105,24 @@ scope "(:locale)", locale: /en|mm/ do get "quick_service" => "quick_service#index" - get "quick_service/pending_order" => "pending_order#index" - get "quick_service/pending_order/:sale_id" => "pending_order#show" - get "quick_service/completed_sale/:sale_id" => "pending_order#completed_sale" + get ":type/pending_order" => "pending_order#index" + get ":type/pending_order/:sale_id" => "pending_order#show" + get ":type/completed_sale/:sale_id" => "pending_order#completed_sale" get "quick_service/modify_order/:id/:sale_id" => "quick_service#modify_order" get "quick_service/modify_order/:sale_id" => "quick_service#modify_order" post 'quick_service/update_modify_order' => "quick_service#update_modify_order", :defaults => { :format => 'json' } - get "quick_service/cash_ins" => "pending_order#cash_ins" - get "quick_service/cash_outs" => "pending_order#cash_outs" + get ":type/cash_ins" => "pending_order#cash_ins" + get ":type/cash_outs" => "pending_order#cash_outs" + + #food court routes + get "food_court" => "food_court#index" + + get "food_court/modify_order/:id/:sale_id" => "food_court#modify_order" + get "food_court/modify_order/:sale_id" => "food_court#modify_order" + post 'food_court/update_modify_order' => "food_court#update_modify_order", :defaults => { :format => 'json' } + #food court routes resources :cash_ins, only: [:new, :create] resources :cash_outs, only: [:new, :create] diff --git a/db/seeds.rb b/db/seeds.rb index df5e815e..6cd11d4c 100755 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -95,6 +95,7 @@ float_value = Lookup.create([{lookup_type:'float_value', name: '500', value: '50 # customer type customer_type = Lookup.create([{lookup_type:'customer_type', name: 'Dinein', value: 'Dinein'}, + {lookup_type:'customer_type', name: 'FoodCourt', value: 'FoodCourt'}, {lookup_type:'customer_type', name: 'Takeaway', value: 'Takeaway'}, {lookup_type:'customer_type', name: 'Delivery', value: 'Delivery'}])