From 49e30658665c0c2f9a0b0c68b34d4c54ea3b9ec6 Mon Sep 17 00:00:00 2001 From: yarzar_code Date: Tue, 14 Jan 2020 18:09:40 +0630 Subject: [PATCH] food court cashier --- app/assets/javascripts/addorder.js | 2 +- app/controllers/home_controller.rb | 17 +++++++++++---- app/views/layouts/CRM.html.erb | 3 ++- app/views/layouts/_header.html.erb | 21 +++++++++---------- app/views/layouts/application.html.erb | 3 ++- .../transactions/bookings/index.html.erb | 3 ++- app/views/transactions/orders/index.html.erb | 3 ++- app/views/transactions/sales/index.html.erb | 3 ++- 8 files changed, 34 insertions(+), 21 deletions(-) diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index ee0e7567..ab5670ac 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -1041,7 +1041,7 @@ $(function() { }else if(result.data == 'OK'){ window.location.href = '/origami/'+type+'/pending_order/' + $('#sale_id').text(); }else{ - if(result.current_user_role == 'foodcourt_cashier'){ + if(result.current_user_role == 'cashier'){ window.location.href = "/foodcourt/sale/"+result.data["sale_id"]+"/"+type+"/payment"; } else{ diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 0da2bbf5..607f7e66 100755 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -199,13 +199,22 @@ class HomeController < ApplicationController redirect_to dashboard_path end elsif employee.role == "cashier" + food_court = Lookup.find_by_lookup_type_and_value("food_court", "1") #check if cashier has existing open cashier shift = ShiftSale.current_open_shift(employee) - if !shift.nil? - redirect_to origami_dashboard_path - # redirect_to origami_root_path + if food_court + if !shift.nil? + redirect_to foodcourt_food_court_path + else + redirect_to new_foodcourt_shift_path + end else - redirect_to new_origami_shift_path + if !shift.nil? + redirect_to origami_dashboard_path + # redirect_to origami_root_path + else + redirect_to new_origami_shift_path + end end elsif employee.role == "manager" redirect_to dashboard_path diff --git a/app/views/layouts/CRM.html.erb b/app/views/layouts/CRM.html.erb index f41f96f3..25a17752 100755 --- a/app/views/layouts/CRM.html.erb +++ b/app/views/layouts/CRM.html.erb @@ -37,7 +37,8 @@ <%= render 'layouts/header' %>
- <%if current_login_employee.role == "foodcourt_cashier" %> + <%food_court = Lookup.find_by_lookup_type_and_value("food_court", "1")%> + <% if food_court %> <%= render 'layouts/foodcourt_left_sidebar' %> <% else %> <%= render 'layouts/left_sidebar' %> diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index e3bba515..59979ce0 100755 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -23,7 +23,12 @@ <% elsif current_login_employee.role == "cashier" || current_login_employee.role == "waiter"%> <%if ShiftSale.current_open_shift(current_login_employee) %> - + <%food_court = Lookup.find_by_lookup_type_and_value("food_court", "1")%> + <%if current_login_employee.role == "cashier" && food_court %> + + <%else%> + + <%end%> <%else%> <%end%> @@ -46,7 +51,8 @@ <%= current_shop.name %> - <% if current_login_employee.role !='foodcourt_cashier' %> + <%food_court = Lookup.find_by_lookup_type_and_value("food_court", "1")%> + <% if !food_court %>