diff --git a/app/controllers/foodcourt/qrpay_controller.rb b/app/controllers/foodcourt/qrpay_controller.rb
index 0d7558a7..b85ef339 100644
--- a/app/controllers/foodcourt/qrpay_controller.rb
+++ b/app/controllers/foodcourt/qrpay_controller.rb
@@ -18,7 +18,7 @@ class Foodcourt::QrpayController < BaseFoodcourtController
sale_id = params[:sale_id]
@trans_flag = true
- @cashier_type = params[:cashier_type] || session[:cashier_type] || "food_court_qr"
+ @cashier_type = params[:cashier_type] || session[:cashier_type] || "food_court"
Rails.logger.info "Precreate action called with params: #{@cashier_type}"
# if params[:type] == "transaction"
diff --git a/app/views/foodcourt/discounts/index.html.erb b/app/views/foodcourt/discounts/index.html.erb
index ebc481a2..6b150676 100755
--- a/app/views/foodcourt/discounts/index.html.erb
+++ b/app/views/foodcourt/discounts/index.html.erb
@@ -40,7 +40,7 @@
<% sub_total = 0 %>
<% @sale_data.sale_items.includes(:discount_item).each do |sale_item| %>
- <% sub_total += sale_item.qty * sale_item.unit_price %>
+ <% sub_total += sale_item.status == "Discount"? sale_item.price : sale_item.qty * sale_item.unit_price %>
<% if sale_item.price > 0 && sale_item.status.blank? %>
;
var originalAmount = totalAmount;
var originalDiscount = totalDiscount;
+ var queryParams = new URLSearchParams(window.location.search)
+
$(document).ready(function(){
setHeaderBreadCrumb(_DISCOUNTS_);
/* check webview loaded*/
@@ -281,17 +283,10 @@
var id = $("#table_id").text();
var type = $("#table_type").text();
var sale_id = $('#sale-id').text();
- if (cashier_type=="quick_service" || cashier_type=="food_court") {
+ if (cashier_type=="food_court" && queryParams.get('payment_type') == 'qr') {
+ window.location.href = '/foodcourt/'+sale_id+'/'+'qrpay/precreate';
+ } else if(cashier_type == "food_court") {
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
- } else if (cashier_type == 'food_court_qr') {
- window.location.href = '/foodcourt/'+sale_id+'/qrpay/precreate';
- }
- else{
- if (type=="Table") {
- window.location.href = '/foodcourt/table/'+id
- }else{
- window.location.href = '/foodcourt/room/'+id
- }
}
})
@@ -488,12 +483,7 @@
var sub_total = totalAmount;
var ajax_url = "/foodcourt/" + sale_id + "/discount";
- if (cashier_type == "food_court_qr") {
- var c_type = "food_court";
- var params = { 'cashier_type' : c_type, 'sale_id': sale_id, 'sub_total': sub_total, 'discount_items': discount_items, 'overall_discount': overall_discount };
- }else{
- var params = { 'cashier_type' : cashier_type, 'sale_id': sale_id, 'sub_total': sub_total, 'discount_items': discount_items, 'overall_discount': overall_discount };
- }
+ var params = { 'cashier_type' : cashier_type, 'sale_id': sale_id, 'sub_total': sub_total, 'discount_items': discount_items, 'overall_discount': overall_discount };
$.ajax({
type: "POST",
@@ -505,18 +495,11 @@
title: "Information!",
text: result.status,
}, function () {
- if (cashier_type=="quick_service" || cashier_type=="food_court") {
- window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
- }else if(cashier_type == "food_court_qr") {
- window.location.href = '/foodcourt/'+sale_id+'/qrpay/precreate';
+ if (cashier_type=="food_court" && queryParams.get('payment_type') == 'qr') {
+ window.location.href = '/foodcourt/'+sale_id+'/'+'qrpay/precreate';
}
- else{
- if(result.table_type == "Table"){
- window.location.href = "/foodcourt/table/" + result.table_id
- }
- else {
- window.location.href = "/foodcourt/room/" + result.table_id
- }
+ else if(cashier_type == "food_court") {
+ window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
}
});
}
@@ -554,15 +537,11 @@
text: result.status,
type: "success",
}, function () {
- if (cashier_type=="quick_service" || cashier_type=="food_court") {
+ if (cashier_type=="food_court" && queryParams.get('payment_type') == 'qr') {
+ window.location.href = '/foodcourt/'+sale_id+'/'+'qrpay/precreate';
+ }
+ else if(cashier_type == "food_court") {
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
- }else{
- if(result.table_type == "Table"){
- window.location.href = "/foodcourt/table/" + result.table_id
- }
- else {
- window.location.href = "/foodcourt/room/" + result.table_id
- }
}
});
}
@@ -581,15 +560,11 @@
text: result.status,
type: "success",
}, function () {
- if (cashier_type=="quick_service" || cashier_type=="food_court") {
+ if (cashier_type=="food_court" && queryParams.get('payment_type') == 'qr') {
+ window.location.href = '/foodcourt/'+sale_id+'/'+'qrpay/precreate';
+ }
+ else if(cashier_type == "food_court") {
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
- }else{
- if(result.table_type == "Table"){
- window.location.href = "/foodcourt/table/" + result.table_id
- }
- else {
- window.location.href = "/foodcourt/room/" + result.table_id
- }
}
});
}
diff --git a/app/views/foodcourt/other_charges/index.html.erb b/app/views/foodcourt/other_charges/index.html.erb
index 6805012f..74d9ed9d 100755
--- a/app/views/foodcourt/other_charges/index.html.erb
+++ b/app/views/foodcourt/other_charges/index.html.erb
@@ -32,7 +32,7 @@
<% sub_total = 0 %>
<% @sale_data.sale_items.each do |sale_item| %>
<%
- sub_total += sale_item.qty*sale_item.unit_price
+ sub_total += sale_item.status == "Discount" ? sale_item.price : sale_item.qty*sale_item.unit_price
unless sale_item.price == 0
%>
>
@@ -200,7 +200,7 @@
<%if !@table.nil?%>
<%else%>
-
+
<%end%>
@@ -210,6 +210,7 @@