check survey shift update
This commit is contained in:
@@ -15,9 +15,18 @@ class Api::SurveyController < Api::ApiController
|
|||||||
|
|
||||||
def create
|
def create
|
||||||
dining_facility = DiningFacility.find(params[:id])
|
dining_facility = DiningFacility.find(params[:id])
|
||||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(dining_facility.zone_id)
|
# cashier_zone = CashierTerminalByZone.find_by_zone_id(dining_facility.zone_id)
|
||||||
shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil)
|
# shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil)
|
||||||
puts params.to_json
|
# puts params.to_json
|
||||||
|
# set cashier
|
||||||
|
open_cashier = Employee.where("role = 'cashier' AND token_session <> ''")
|
||||||
|
current_shift = ShiftSale.current_shift
|
||||||
|
if open_cashier.count>0
|
||||||
|
shift_by_terminal = ShiftSale.current_open_shift(open_cashier[0].id)
|
||||||
|
else
|
||||||
|
shift_by_terminal = ShiftSale.current_open_shift(current_shift.employee_id)
|
||||||
|
end
|
||||||
|
|
||||||
if params[:survey][:id]>0
|
if params[:survey][:id]>0
|
||||||
survey = Survey.find(params[:survey][:id])
|
survey = Survey.find(params[:survey][:id])
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -40,11 +40,24 @@ class Origami::SurveysController < BaseOrigamiController
|
|||||||
def create
|
def create
|
||||||
@type = params[:cashier_type]
|
@type = params[:cashier_type]
|
||||||
@sale_id = params[:sale_id]
|
@sale_id = params[:sale_id]
|
||||||
|
|
||||||
if params[:table_id].to_i>0
|
if params[:table_id].to_i>0
|
||||||
@dining_facility = DiningFacility.find(params[:table_id])
|
@dining_facility = DiningFacility.find(params[:table_id])
|
||||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(@dining_facility.zone_id)
|
if params[:sale_id].to_i > 0
|
||||||
shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil)
|
# cashier_zone = CashierTerminalByZone.find_by_zone_id(@dining_facility.zone_id)
|
||||||
|
# shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil)
|
||||||
|
# set cashier
|
||||||
|
open_cashier = Employee.where("role = 'cashier' AND token_session <> ''")
|
||||||
|
current_shift = ShiftSale.current_shift
|
||||||
|
if open_cashier.count>0
|
||||||
|
shift_by_terminal = ShiftSale.current_open_shift(open_cashier[0].id)
|
||||||
|
else
|
||||||
|
shift_by_terminal = ShiftSale.current_open_shift(current_shift.employee_id)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
sale = Sale.find(@sale_id)
|
||||||
|
shift = ShiftSale.find(sale.shift_sale_id)
|
||||||
|
shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(shift.cashier_terminal_id,nil)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
sale = Sale.find(@sale_id)
|
sale = Sale.find(@sale_id)
|
||||||
shift = ShiftSale.find(sale.shift_sale_id)
|
shift = ShiftSale.find(sale.shift_sale_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user