add cashier zone terminal
This commit is contained in:
@@ -8,12 +8,23 @@ class Origami::ShiftsController < ApplicationController#BaseOrigamiController
|
|||||||
|
|
||||||
def new
|
def new
|
||||||
@float = Lookup.where('lookup_type=?','float_value')
|
@float = Lookup.where('lookup_type=?','float_value')
|
||||||
@terminal = CashierTerminal.all
|
@terminal = CashierTerminal.available
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
opening_balance = params[:opening_balance]
|
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 = ShiftSale.new
|
||||||
@shift.create(opening_balance,cashier_terminal, current_user)
|
@shift.create(opening_balance,cashier_terminal, current_user)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
class CashierTerminal < ApplicationRecord
|
class CashierTerminal < ApplicationRecord
|
||||||
has_many :cashier_terminal_by_zones
|
has_many :cashier_terminal_by_zones
|
||||||
has_many :zones, through: :cashier_terminal_by_zones
|
has_many :zones, through: :cashier_terminal_by_zones
|
||||||
|
|
||||||
|
scope :available, -> {where(is_currently_login: false)}
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user