From 44010e17623469906f7f705ef1768c7bf37cc100 Mon Sep 17 00:00:00 2001 From: Yan Date: Mon, 23 Oct 2017 11:39:41 +0630 Subject: [PATCH 01/26] add cashier zone terminal --- app/controllers/origami/shifts_controller.rb | 15 +++++++++++++-- app/models/cashier_terminal.rb | 2 ++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/controllers/origami/shifts_controller.rb b/app/controllers/origami/shifts_controller.rb index d175e36f..c5e52c99 100644 --- a/app/controllers/origami/shifts_controller.rb +++ b/app/controllers/origami/shifts_controller.rb @@ -8,12 +8,23 @@ class Origami::ShiftsController < ApplicationController#BaseOrigamiController def new @float = Lookup.where('lookup_type=?','float_value') - @terminal = CashierTerminal.all + @terminal = CashierTerminal.available end def create opening_balance = params[:opening_balance] - cashier_terminal = params[:cashier_terminal] + cashier_terminal_param = params[:cashier_terminal] + + cashier_terminal = CashierTerminal.find(cashier_terminal_param) + if cashier_terminal.is_currently_login + respond_to do |format| + format.html { redirect_to settings_order_queue_stations_url, notice: 'Cashier Terminal already signin!' } + end + end + + cashier_terminal.is_currently_login = 1 + cashier_terminal.save + @shift = ShiftSale.new @shift.create(opening_balance,cashier_terminal, current_user) end diff --git a/app/models/cashier_terminal.rb b/app/models/cashier_terminal.rb index 4f642d0a..b488f7c1 100644 --- a/app/models/cashier_terminal.rb +++ b/app/models/cashier_terminal.rb @@ -1,4 +1,6 @@ class CashierTerminal < ApplicationRecord has_many :cashier_terminal_by_zones has_many :zones, through: :cashier_terminal_by_zones + + scope :available, -> {where(is_currently_login: false)} end From ba444956631fc5fae99aedb640f9590747ea52c5 Mon Sep 17 00:00:00 2001 From: Yan Date: Mon, 23 Oct 2017 12:05:56 +0630 Subject: [PATCH 02/26] shift open fix --- app/controllers/origami/shifts_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/origami/shifts_controller.rb b/app/controllers/origami/shifts_controller.rb index 41c84a8c..a0e027ba 100755 --- a/app/controllers/origami/shifts_controller.rb +++ b/app/controllers/origami/shifts_controller.rb @@ -25,8 +25,8 @@ class Origami::ShiftsController < BaseOrigamiController cashier_terminal.is_currently_login = 1 cashier_terminal.save - @shift = ShiftSale.new - @shift.create(opening_balance,cashier_terminal, current_user) + @shift_sale = ShiftSale.new + @shift_sale.create(opening_balance,cashier_terminal_param, current_user) end def update_shift From ac42c4a78ecb70f42427cd63ed7cecfc87d9ec3e Mon Sep 17 00:00:00 2001 From: Yan Date: Mon, 23 Oct 2017 13:20:41 +0630 Subject: [PATCH 03/26] ui edited --- app/assets/stylesheets/reset.css | 10 ++++++++++ app/views/layouts/_header.html.erb | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/reset.css b/app/assets/stylesheets/reset.css index c5c3af2f..7f49dc71 100644 --- a/app/assets/stylesheets/reset.css +++ b/app/assets/stylesheets/reset.css @@ -39,6 +39,16 @@ margin-top: 0px !important; } +.dropdown-menu > li > p:hover { + background-color: #ccc; +} + +@media (min-width: 768px){ + .dropdown-menu { + padding: .3rem 0; + } +} + .switch label { color: #070707 !important; } diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 8f809e47..136f0578 100755 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -32,7 +32,7 @@