foodcourt apis for app
This commit is contained in:
@@ -1,14 +1,42 @@
|
||||
class Api::BookingsController < Api::ApiController
|
||||
# skip_before_action :authenticate
|
||||
skip_before_action :authenticate
|
||||
#Show customer by ID
|
||||
def index
|
||||
@customer = Customer.find_by(params[:id])
|
||||
def index
|
||||
@bookings = Booking.all
|
||||
if params[:shift_id].present?
|
||||
@bookings = @bookings.includes(:dining_facility, :sale, orders: :order_items)
|
||||
.where()
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
booking = Booking.find(params[:id])
|
||||
if booking.dining_facility_id.to_i == params[:table_id].to_i
|
||||
@booking = booking
|
||||
@booking = Booking.find(params[:id])
|
||||
end
|
||||
|
||||
def pending
|
||||
@bookings = Booking.where(checkout_at: nil)
|
||||
end
|
||||
|
||||
def billed
|
||||
if shift = ShiftSale.current_shift
|
||||
@bookings = Booking.includes(:sale)
|
||||
.where(sales: {shift_sale_id: shift.id})
|
||||
.where.not(sales: {sale_status: ['completed', 'void']})
|
||||
end
|
||||
end
|
||||
|
||||
def completed
|
||||
if shift = ShiftSale.current_shift
|
||||
@bookings = Booking.includes(:sale)
|
||||
.where(sales: {shift_sale_id: shift.id, sale_status: ['completed']})
|
||||
end
|
||||
end
|
||||
|
||||
def void
|
||||
if shift = ShiftSale.current_shift
|
||||
@bookings = Booking.includes(:sale)
|
||||
.where(sales: {shift_sale_id: shift.id, sale_status: ['void']})
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user