From 3d235f9d69d59570fc046747edcbecf4bc930c5c Mon Sep 17 00:00:00 2001 From: phyusin Date: Wed, 27 Dec 2017 10:30:22 +0630 Subject: [PATCH] add alert_time_min in api/checkin and check for waiter login --- .../api/check_in_process_controller.rb | 12 ++++++++- app/controllers/home_controller.rb | 5 ++-- app/views/layouts/_header.html.erb | 24 ++++++++++-------- app/views/layouts/login_dashboard.html.erb | 25 +++++++++++++++++++ app/views/origami/home/index.html.erb | 3 ++- app/views/origami/home/show.html.erb | 3 ++- 6 files changed, 56 insertions(+), 16 deletions(-) diff --git a/app/controllers/api/check_in_process_controller.rb b/app/controllers/api/check_in_process_controller.rb index 4f1c4ae2..488684e7 100644 --- a/app/controllers/api/check_in_process_controller.rb +++ b/app/controllers/api/check_in_process_controller.rb @@ -11,7 +11,17 @@ class Api::CheckInProcessController < Api::ApiController check_in_time = booking.checkin_at.utc.getlocal.strftime("%Y-%m-%d %H:%M") check_out_time = booking.checkout_at.utc.getlocal.strftime("%Y-%m-%d %H:%M") - render :json => { :status => true, :check_in_time => check_in_time, :check_out_time => check_out_time } + lookup_checkout_time = Lookup.collection_of("checkout_alert_time") + alert_time_min = 0 + if !lookup_checkout_time.nil? + if lookup_checkout_time[0][0] == 'min' + alert_time_min = (lookup_checkout_time[0][1]).to_i + else + alert_time_min = 15 + end + end + + render :json => { :status => true, :check_in_time => check_in_time, :check_out_time => check_out_time, :alert_time_min => alert_time_min } else render :json => { :status => false, :error_message => "No current booking!" } end diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index d3666a60..1ee30bab 100755 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -3,7 +3,8 @@ class HomeController < ApplicationController skip_before_action :authenticate, only: [:index, :show, :create, :update, :destroy] def index - @employees = Employee.all_emp_except_waiter.order("name asc") + # @employees = Employee.all_emp_except_waiter.order("name asc") + @employees = Employee.all.order("name asc") @login_form = LoginForm.new() render "layouts/login_dashboard", layout: false end @@ -45,7 +46,7 @@ class HomeController < ApplicationController elsif @employee.role == "manager" session[:session_token] = @employee.token_session redirect_to dashboard_path - elsif @employee.role == "supervisor" + elsif @employee.role == "supervisor" || @employee.role == "waiter" session[:session_token] = @employee.token_session redirect_to origami_root_path elsif @employee.role == "account" diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 41fe9480..a90636f3 100755 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -14,7 +14,9 @@
diff --git a/app/views/origami/home/index.html.erb b/app/views/origami/home/index.html.erb index 939b969a..46132fff 100755 --- a/app/views/origami/home/index.html.erb +++ b/app/views/origami/home/index.html.erb @@ -118,12 +118,13 @@ <%end%> + <%if current_login_employee.role != "waiter" %> - + <%end%>
diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index b77e3b96..4343e230 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -369,6 +369,7 @@ <%= t("views.btn.back") %> + <% if current_login_employee.role != "waiter" %> <% if @dining.status != "available" %> <% if @status_order == 'order' && @status_sale != 'sale' %> @@ -432,7 +433,7 @@ - + <% end %>