add booking list in transaction

This commit is contained in:
Aung Myo
2017-11-14 13:42:00 +06:30
parent f1a28d64e1
commit 6f06e7a9d7
17 changed files with 351 additions and 42 deletions

View 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