update fixed conflict
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
class Api::ApiController < ActionController::API
|
||||
include TokenVerification
|
||||
helper_method :current_token, :current_login_employee
|
||||
helper_method :current_token, :current_login_employee, :get_cashier
|
||||
|
||||
|
||||
private
|
||||
@@ -13,6 +13,11 @@ class Api::ApiController < ActionController::API
|
||||
end
|
||||
end
|
||||
|
||||
# Get current Cashier
|
||||
def get_cashier
|
||||
@cashier = Employee.where("role = 'cashier' AND token_session <> ''")
|
||||
end
|
||||
|
||||
def current_login_employee
|
||||
@employee = Employee.find_by_token_session(current_token)
|
||||
end
|
||||
|
||||
@@ -13,7 +13,7 @@ class Api::BillController < Api::ApiController
|
||||
if booking
|
||||
if booking.sale_id.nil?
|
||||
@sale = Sale.new
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee)
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee, get_cashier)
|
||||
else
|
||||
@status = true
|
||||
@sale_id = booking.sale_id
|
||||
@@ -22,7 +22,7 @@ class Api::BillController < Api::ApiController
|
||||
|
||||
elsif (params[:order_id])
|
||||
@sale = Sale.new
|
||||
@status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee)
|
||||
@status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee, get_cashier)
|
||||
end
|
||||
|
||||
@sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
|
||||
@@ -67,13 +67,19 @@ class Api::OrdersController < Api::ApiController
|
||||
if booking
|
||||
if booking.dining_facility_id.to_i == params[:table_id].to_i && booking.booking_status != 'moved'
|
||||
if !booking.sale_id.nil?
|
||||
check_order_with_booking(booking)
|
||||
sale_status = check_order_with_booking(booking)
|
||||
if sale_status
|
||||
return false
|
||||
end
|
||||
else
|
||||
@order.new_booking = false
|
||||
@order.booking_id = params[:booking_id]
|
||||
end
|
||||
else
|
||||
check_order_with_table(params[:table_id])
|
||||
sale_status = check_order_with_table(params[:table_id])
|
||||
if sale_status
|
||||
return false
|
||||
end
|
||||
end
|
||||
end #booking exists
|
||||
else
|
||||
@@ -90,9 +96,11 @@ class Api::OrdersController < Api::ApiController
|
||||
if booking
|
||||
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "billed"
|
||||
@order.new_booking = true
|
||||
return true
|
||||
else
|
||||
@order.new_booking = false
|
||||
@order.booking_id = booking.booking_id
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -101,9 +109,11 @@ class Api::OrdersController < Api::ApiController
|
||||
def check_order_with_booking(booking)
|
||||
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "billed"
|
||||
@order.new_booking = true
|
||||
return true
|
||||
else
|
||||
@order.new_booking = false
|
||||
@order.booking_id = params[:booking_id]
|
||||
return false
|
||||
end
|
||||
end
|
||||
# Description
|
||||
|
||||
Reference in New Issue
Block a user