Merge branch 'adminbsb_material_ui' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -6,7 +6,9 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
sale_id = params[:id]
|
||||
if Sale.exists?(sale_id)
|
||||
@sale_data = Sale.find(sale_id)
|
||||
@table = DiningFacility.find(@sale_data.bookings[0].dining_facility_id)
|
||||
end
|
||||
|
||||
@member_discount = MembershipSetting.find_by_discount(1)
|
||||
@accounts = Account.all
|
||||
end
|
||||
|
||||
@@ -5,6 +5,7 @@ class Origami::OtherChargesController < BaseOrigamiController
|
||||
sale_id = params[:sale_id]
|
||||
if Sale.exists?(sale_id)
|
||||
@sale_data = Sale.find(sale_id)
|
||||
@table = DiningFacility.find(@sale_data.bookings[0].dining_facility_id)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
59
app/controllers/transactions/bookings_controller.rb
Normal file
59
app/controllers/transactions/bookings_controller.rb
Normal file
@@ -0,0 +1,59 @@
|
||||
class Transactions::BookingsController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_transactions_booking, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
|
||||
filter = params[:filter]
|
||||
from = params[:from]
|
||||
to = params[:to]
|
||||
|
||||
if filter.nil? && from.nil? && to.nil?
|
||||
@bookings = Booking.all.order("sale_id desc")
|
||||
@bookings = Kaminari.paginate_array(@bookings).page(params[:page]).per(2)
|
||||
else
|
||||
sale = Sale.search(filter,from,to)
|
||||
if sale.count > 0
|
||||
@bookings = sale
|
||||
@bookings = Kaminari.paginate_array(@bookings).page(params[:page]).per(2)
|
||||
else
|
||||
@bookings = 0
|
||||
end
|
||||
end
|
||||
|
||||
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