Edit dashboard ligin
This commit is contained in:
@@ -20,7 +20,9 @@ class HomeController < ApplicationController
|
||||
def index
|
||||
# @employees = Employee.all_emp_except_waiter.order("name asc")
|
||||
@employees = Employee.all.where("is_active = true").order("name asc")
|
||||
@roles = Lookup.collection_of("employee_roles")
|
||||
@roles = Employee.distinct.pluck(:role)
|
||||
# byebug
|
||||
# @roles = Lookup.collection_of("employee_roles")
|
||||
@login_form = LoginForm.new()
|
||||
render "layouts/login_dashboard", layout: false
|
||||
end
|
||||
|
||||
@@ -113,9 +113,9 @@
|
||||
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6 p-t-20 p-l-10 p-r-10 p-b-50 bg-white">
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<% @roles.each do |role| %>
|
||||
<%if role[1] != "administrator" %>
|
||||
<%if role != "administrator" %>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#<%=role[1]%>" role="tab"><b><%=role[0]%></b></a>
|
||||
<a class="nav-link" data-toggle="tab" href="#<%=role%>" role="tab"><b><%=role%></b></a>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -124,124 +124,33 @@
|
||||
|
||||
<div class="tab-content" style="max-height:650px; overflow:auto">
|
||||
|
||||
<div class="tab-pane" id="manager" role="tabpanel" style="max-height:; overflow:auto">
|
||||
<% @employees.each do |employee| %>
|
||||
<%if employee.role == "manager" %>
|
||||
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4 empBtn" data-formid="#form_<%= employee.emp_id %>" style="float: left;">
|
||||
<form id="form_<%= employee.emp_id %>" action="<%= emp_login_path(employee.emp_id) %>" method="PATCH">
|
||||
</form>
|
||||
<%if employee.image_path.present? %>
|
||||
<div class="login_dashboard p-card">
|
||||
<%= image_tag employee.image_path, :class => "style_image" %>
|
||||
<div class="p-name"><b><%= employee.name%></b>
|
||||
</div>
|
||||
<% @roles.each do |role| %>
|
||||
<%if role != "administrator" %>
|
||||
<div class="tab-pane" id="<%=role%>" role="tabpanel" style="max-height:; overflow:auto">
|
||||
<% @employees.each do |employee| %>
|
||||
<%if employee.role == role %>
|
||||
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4 empBtn" data-formid="#form_<%= employee.emp_id %>" style="float: left;">
|
||||
<form id="form_<%= employee.emp_id %>" action="<%= emp_login_path(employee.emp_id) %>" method="PATCH">
|
||||
</form>
|
||||
<%if employee.image_path.present? %>
|
||||
<div class="login_dashboard p-card">
|
||||
<%= image_tag employee.image_path, :class => "style_image" %>
|
||||
<div class="p-name"><b><%= employee.name%></b>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="login_dashboard p-card">
|
||||
<i class="material-icons style_icon">person</i>
|
||||
<div class="p-name"><b><%= employee.name%></b>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="login_dashboard p-card">
|
||||
<i class="material-icons style_icon">person</i>
|
||||
<div class="p-name"><b><%= employee.name%></b>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="tab-pane" id="supervisor" role="tabpanel" style="max-height:; overflow:auto">
|
||||
<% @employees.each do |employee| %>
|
||||
<%if employee.role == "supervisor" %>
|
||||
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4 empBtn" data-formid="#form_<%= employee.emp_id %>" style="float: left;">
|
||||
<form id="form_<%= employee.emp_id %>" action="<%= emp_login_path(employee.emp_id) %>" method="PATCH">
|
||||
</form>
|
||||
<%if employee.image_path.present? %>
|
||||
<div class="login_dashboard p-card">
|
||||
<%= image_tag employee.image_path, :class => "style_image" %>
|
||||
<div class="p-name"><b><%= employee.name%></b>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="login_dashboard p-card">
|
||||
<i class="material-icons style_icon">person</i>
|
||||
<div class="p-name"><b><%= employee.name%></b>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="cashier" role="tabpanel" style="max-height:; overflow:auto">
|
||||
<% @employees.each do |employee| %>
|
||||
<%if employee.role == "cashier" %>
|
||||
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4 empBtn" data-formid="#form_<%= employee.emp_id %>" style="float: left;">
|
||||
<form id="form_<%= employee.emp_id %>" action="<%= emp_login_path(employee.emp_id) %>" method="PATCH">
|
||||
</form>
|
||||
<%if employee.image_path.present? %>
|
||||
<div class="login_dashboard p-card">
|
||||
<%= image_tag employee.image_path, :class => "style_image" %>
|
||||
<div class="p-name"><b><%= employee.name%></b>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="login_dashboard p-card">
|
||||
<i class="material-icons style_icon">person</i>
|
||||
<div class="p-name"><b><%= employee.name%></b>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="account" role="tabpanel" style="max-height:; overflow:auto">
|
||||
<% @employees.each do |employee| %>
|
||||
<%if employee.role == "account" %>
|
||||
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4 empBtn" data-formid="#form_<%= employee.emp_id %>" style="float: left;">
|
||||
<form id="form_<%= employee.emp_id %>" action="<%= emp_login_path(employee.emp_id) %>" method="PATCH">
|
||||
</form>
|
||||
<%if employee.image_path.present? %>
|
||||
<div class="login_dashboard p-card">
|
||||
<%= image_tag employee.image_path, :class => "style_image" %>
|
||||
<div class="p-name"><b><%= employee.name%></b>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="login_dashboard p-card">
|
||||
<i class="material-icons style_icon">person</i>
|
||||
<div class="p-name"><b><%= employee.name%></b>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="waiter" role="tabpanel" style="max-height:; overflow:auto">
|
||||
<% @employees.each do |employee| %>
|
||||
<%if employee.role == "waiter" %>
|
||||
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4 empBtn" data-formid="#form_<%= employee.emp_id %>" style="float: left;">
|
||||
<form id="form_<%= employee.emp_id %>" action="<%= emp_login_path(employee.emp_id) %>" method="PATCH">
|
||||
</form>
|
||||
<%if employee.image_path.present? %>
|
||||
<div class="login_dashboard p-card">
|
||||
<%= image_tag employee.image_path, :class => "style_image" %>
|
||||
<div class="p-name"><b><%= employee.name%></b>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="login_dashboard p-card">
|
||||
<i class="material-icons style_icon">person</i>
|
||||
<div class="p-name"><b><%= employee.name%></b>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="col-xs-12 col-sm-12 col-md-2 col-lg-2"> </div> -->
|
||||
|
||||
Reference in New Issue
Block a user