foodcourt apis for app
This commit is contained in:
25
app/controllers/api/foodcourt/bills_controller.rb
Normal file
25
app/controllers/api/foodcourt/bills_controller.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
class Api::Foodcourt::BillsController < Api::ApiController
|
||||
|
||||
def create
|
||||
Sale.transaction do
|
||||
if shift = ShiftSale.current_open_shift(current_login_employee)
|
||||
if booking = Booking.find(params[:booking_id])
|
||||
cashier = Employee.find(shift.employee_id)
|
||||
order = booking.orders.first
|
||||
|
||||
if @sale_data = booking.sale
|
||||
@status = true
|
||||
elsif @sale_data = Sale.generate_invoice_from_booking(booking, current_login_employee, cashier, order.source, params[:current_checkin_induties_count])
|
||||
@status = true
|
||||
else
|
||||
@status = false
|
||||
end
|
||||
end
|
||||
else
|
||||
@status = false
|
||||
@error_message = "No Current Open Shift"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user