class Api::BookingsController < Api::ApiController skip_before_action :authenticate #Show customer by 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]) 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