From 8b62d410b016e3c17998ea56e5e9a7d75ec1c8b9 Mon Sep 17 00:00:00 2001 From: Dev Team Date: Fri, 27 Jun 2025 18:22:40 +0630 Subject: [PATCH] feat: update for discount, edit for qrpay --- app/controllers/foodcourt/qrpay_controller.rb | 6 +++--- app/views/foodcourt/discounts/index.html.erb | 5 ++++- app/views/foodcourt/sale_edit/edit.html.erb | 12 ++++++++++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/app/controllers/foodcourt/qrpay_controller.rb b/app/controllers/foodcourt/qrpay_controller.rb index cc8cf505..b2559194 100644 --- a/app/controllers/foodcourt/qrpay_controller.rb +++ b/app/controllers/foodcourt/qrpay_controller.rb @@ -17,10 +17,10 @@ class Foodcourt::QrpayController < BaseFoodcourtController path = request.fullpath sale_id = params[:sale_id] @trans_flag = true - - @cashier_type = params[:cashier_type] || session[:cashier_type] || "cashier" + + @cashier_type = params[:cashier_type] || session[:cashier_type] || "food_court_qr" Rails.logger.info "Precreate action called with params: #{@cashier_type}" - + # if params[:type] == "transaction" # @trans_flag = false # @cashier_type = "cashier" diff --git a/app/views/foodcourt/discounts/index.html.erb b/app/views/foodcourt/discounts/index.html.erb index cee87565..13ad2db5 100755 --- a/app/views/foodcourt/discounts/index.html.erb +++ b/app/views/foodcourt/discounts/index.html.erb @@ -499,7 +499,10 @@ }, function () { if (cashier_type=="quick_service" || cashier_type=="food_court") { window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/'; - }else{ + }else if(cashier_type == "food_court_qr") { + window.location.href = '/foodcourt/'+sale_id+'/qrpay/precreate'; + } + else{ if(result.table_type == "Table"){ window.location.href = "/foodcourt/table/" + result.table_id } diff --git a/app/views/foodcourt/sale_edit/edit.html.erb b/app/views/foodcourt/sale_edit/edit.html.erb index 2588e2bb..0242e5dc 100755 --- a/app/views/foodcourt/sale_edit/edit.html.erb +++ b/app/views/foodcourt/sale_edit/edit.html.erb @@ -372,7 +372,11 @@ var access_code = localStorage.getItem("access_code"); var sale_id = "<%= @saleobj.sale_id %>" if (cashier_type=="quick_service" || cashier_type == "food_court") { window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/'; - }else{ + } + else if(cashier_type=="food_court_qr"){ + window.location.href = '/foodcourt/'+sale_id+'/'+ 'qrpay' +'/precreate'; + } + else{ window.location.href = '/foodcourt/table/' + table_id; } }) @@ -401,7 +405,11 @@ var access_code = localStorage.getItem("access_code"); success: function (result) { if (cashier_type=="quick_service" || cashier_type=="food_court") { window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/'; - }else{ + } + else if(cashier_type=="food_court_qr"){ + window.location.href = '/foodcourt/'+sale_id+'/'+ 'qrpay' +'/precreate'; + } + else{ window.location.href = '/foodcourt/table/' + table_id; }