add booking list in transaction
This commit is contained in:
44
app/controllers/transactions/bookings_controller.rb
Normal file
44
app/controllers/transactions/bookings_controller.rb
Normal file
@@ -0,0 +1,44 @@
|
||||
class Transactions::BookingsController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_transactions_booking, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
|
||||
@bookings = Booking.all.order("booking_id desc")
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @bookings }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# GET /transactions/bookings/1
|
||||
# GET /transactions/bookings/1.json
|
||||
def show
|
||||
|
||||
@booking = Booking.find(params[:id])
|
||||
|
||||
@order_items = []
|
||||
@booking.booking_orders.each do |booking_order|
|
||||
@order = Order.find(booking_order.order_id)
|
||||
#if (order.status == "new")
|
||||
@order_items = @order_items + @order.order_items
|
||||
#end
|
||||
end
|
||||
if @booking.sale_id.present?
|
||||
@sale = Sale.find(@booking.sale_id)
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @booking }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_transactions_booking
|
||||
@transactions_booking = Booking.find(params[:id])
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user