edit login
This commit is contained in:
@@ -2,7 +2,7 @@ class HomeController < ApplicationController
|
|||||||
skip_before_action :authenticate, only: [:index, :show, :create, :update, :destroy]
|
skip_before_action :authenticate, only: [:index, :show, :create, :update, :destroy]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@employees = Employee.all.order("name asc")
|
@employees = Employee.all_emp_except_waiter.order("name asc")
|
||||||
@login_form = LoginForm.new()
|
@login_form = LoginForm.new()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -19,6 +19,8 @@ class HomeController < ApplicationController
|
|||||||
|
|
||||||
if @employee != nil
|
if @employee != nil
|
||||||
session[:session_token] = @employee.token_session
|
session[:session_token] = @employee.token_session
|
||||||
|
#if cashier => already opening cahshier?
|
||||||
|
|
||||||
redirect_to origami_root_path
|
redirect_to origami_root_path
|
||||||
else
|
else
|
||||||
render :show, flash[:notice] => "Invalid PIN for Employee. Please try again!"
|
render :show, flash[:notice] => "Invalid PIN for Employee. Please try again!"
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ class Employee < ApplicationRecord
|
|||||||
validates :emp_id, uniqueness: true, numericality: true, length: {in: 1..4}, allow_blank: true
|
validates :emp_id, uniqueness: true, numericality: true, length: {in: 1..4}, allow_blank: true
|
||||||
validates :password, numericality: true, length: {in: 3..9}, allow_blank: true
|
validates :password, numericality: true, length: {in: 3..9}, allow_blank: true
|
||||||
|
|
||||||
|
def self.all_emp_except_waiter
|
||||||
|
Employee.where('role!=?','waiter')
|
||||||
|
end
|
||||||
|
|
||||||
def self.collection
|
def self.collection
|
||||||
Employee.select("id, name").map { |e| [e.name, e.id] }
|
Employee.select("id, name").map { |e| [e.name, e.id] }
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,14 +1,24 @@
|
|||||||
<style>
|
<style>
|
||||||
.pin_pad {
|
.pin_pad {
|
||||||
width:10rem;
|
width: 30%;
|
||||||
height:10rem;
|
height:70px;
|
||||||
text-align: center;
|
line-height:70px;
|
||||||
vertical-align: middle;
|
text-align:center;
|
||||||
line-height: 10rem;
|
background:#54A5AF;
|
||||||
margin:2px;
|
font-size:20px;
|
||||||
margin-top:4px;
|
color:white;
|
||||||
margin-bottom:4px;
|
}
|
||||||
font-size:3rem;
|
.bottom{
|
||||||
|
margin-bottom: 1px;
|
||||||
|
}
|
||||||
|
.left{
|
||||||
|
margin-left:1px;
|
||||||
|
}
|
||||||
|
.orange{
|
||||||
|
background-color:#FF7F50;
|
||||||
|
}
|
||||||
|
.purple {
|
||||||
|
background-color:#7a62d3;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
@@ -23,21 +33,29 @@
|
|||||||
<%= f.input :password, label: "Access PIN", required: false, class: "form-control" %>
|
<%= f.input :password, label: "Access PIN", required: false, class: "form-control" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="content" style="margin:10px; margin-top:0px; text-align:center">
|
<div class="content row" style="padding-left:10px;margin-left:10px; margin-top:0px; text-align:center">
|
||||||
<button class="pin_pad" data-value="1">1</button>
|
<div class='col-md-12'>
|
||||||
<button class="pin_pad" data-value="2">2</button>
|
<div class='row bottom'>
|
||||||
<button class="pin_pad" data-value="3">3</button>
|
<div class="pin_pad " data-value="1">1</div>
|
||||||
<button class="pin_pad" data-value="4">4</button>
|
<div class="pin_pad left" data-value="2">2</div>
|
||||||
<button class="pin_pad" data-value="5">5</button>
|
<div class="pin_pad left" data-value="3">3</div>
|
||||||
<button class="pin_pad" data-value="6">6</button>
|
</div>
|
||||||
<button class="pin_pad" data-value="7">7</button>
|
<div class='row bottom'>
|
||||||
<button class="pin_pad" data-value="8">8</button>
|
<div class="pin_pad" data-value="4">4</div>
|
||||||
<button class="pin_pad" data-value="9">9</button>
|
<div class="pin_pad left" data-value="5">5</div>
|
||||||
<button class="pin_pad" data-value="CLR">CLR</button>
|
<div class="pin_pad left" data-value="6">6</div>
|
||||||
<button class="pin_pad" data-value="8">0</button>
|
</div>
|
||||||
<button class="pin_pad btn-warning" data-value="ENT">ENT</button>
|
<div class='row bottom'>
|
||||||
|
<div class="pin_pad" data-value="7">7</div>
|
||||||
|
<div class="pin_pad left" data-value="8">8</div>
|
||||||
|
<div class="pin_pad left" data-value="9">9</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class='row bottom'>
|
||||||
|
<div class="pin_pad orange" data-value="CLR">CLR</div>
|
||||||
|
<div class="pin_pad left" data-value="8">0</div>
|
||||||
|
<div class="pin_pad left purple" data-value="ENT">ENT</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="footer text-center" style="margin:10px">
|
<div class="footer text-center" style="margin:10px">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user