fixed for survey for cashier and quick_ser
This commit is contained in:
@@ -35,18 +35,25 @@ class Origami::SurveysController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
if params[:table_id].to_i>0
|
|
||||||
@dining_facility = DiningFacility.find(params[:table_id])
|
|
||||||
end
|
|
||||||
@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
|
||||||
|
@dining_facility = DiningFacility.find(params[:table_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)
|
||||||
|
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
|
||||||
|
|
||||||
if @type == "quick_service"
|
if @type == "quick_service"
|
||||||
@url = "/origami/sale/"+@sale_id+"/"+@type+"/payment"
|
@url = "/origami/sale/"+@sale_id+"/"+@type+"/payment"
|
||||||
else
|
else
|
||||||
@url = "/origami/"+@dining_facility.type.downcase+"/"+params[:table_id]
|
@url = "/origami/"+@dining_facility.type.downcase+"/"+params[:table_id]
|
||||||
end
|
end
|
||||||
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)
|
|
||||||
|
|
||||||
if params[:survey_id].nil? || params[:survey_id] == ""
|
if params[:survey_id].nil? || params[:survey_id] == ""
|
||||||
@survey = Survey.new(survey_params)
|
@survey = Survey.new(survey_params)
|
||||||
@@ -79,15 +86,34 @@ class Origami::SurveysController < BaseOrigamiController
|
|||||||
|
|
||||||
def create_survey
|
def create_survey
|
||||||
if shift_by_terminal = ShiftSale.current_open_shift(get_cashier[0].id)
|
if shift_by_terminal = ShiftSale.current_open_shift(get_cashier[0].id)
|
||||||
|
@type = params[:cashier_type]
|
||||||
|
@sale_id = params[:sale_id]
|
||||||
|
sale = Sale.find(@sale_id)
|
||||||
|
|
||||||
|
if @type != "quick_service"
|
||||||
dining_facility = DiningFacility.find(params[:dining_id])
|
dining_facility = DiningFacility.find(params[:dining_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)
|
cashier_zone = cashier_zone.cashier_terminal_id
|
||||||
|
else
|
||||||
|
shift = ShiftSale.find(sale.shift_sale_id)
|
||||||
|
cashier_zone = shift.cashier_terminal_id
|
||||||
|
end
|
||||||
|
|
||||||
|
shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_terminal_id,nil)
|
||||||
|
|
||||||
|
if @type != "quick_service"
|
||||||
survey = Survey.find_by_dining_name(dining_facility.name)
|
survey = Survey.find_by_dining_name(dining_facility.name)
|
||||||
|
else
|
||||||
|
survey = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
if survey.nil?
|
if survey.nil?
|
||||||
survey = Survey.new
|
survey = Survey.new
|
||||||
|
if @type != "quick_service"
|
||||||
survey.dining_name = dining_facility.name
|
survey.dining_name = dining_facility.name
|
||||||
|
end
|
||||||
|
|
||||||
survey.receipt_no = params[:receipt_no]
|
survey.receipt_no = params[:receipt_no]
|
||||||
survey.shift_id = shift_by_terminal.id
|
survey.shift_id = shift_by_terminal.id
|
||||||
survey.created_by = current_user.name
|
survey.created_by = current_user.name
|
||||||
|
|||||||
@@ -90,8 +90,7 @@
|
|||||||
<% else %>
|
<% else %>
|
||||||
<input type="hidden" name="survey_id" />
|
<input type="hidden" name="survey_id" />
|
||||||
<% end %>
|
<% end %>
|
||||||
<input type="hidden" name="table_id" value="<%=@dining_facility.id%>">
|
|
||||||
<%= f.input :dining_name, :as => :hidden, :input_html => { :value => @dining_facility.name } %>
|
|
||||||
|
|
||||||
<%= f.input :created_by, :as => :hidden, :input_html => { :value => current_login_employee.name } %>
|
<%= f.input :created_by, :as => :hidden, :input_html => { :value => current_login_employee.name } %>
|
||||||
<%= f.input :receipt_no, :as => :hidden, :input_html => { :value => @receipt_no} %>
|
<%= f.input :receipt_no, :as => :hidden, :input_html => { :value => @receipt_no} %>
|
||||||
|
|||||||
Reference in New Issue
Block a user