update transaction

This commit is contained in:
Aung Myo
2017-11-14 15:48:22 +06:30
parent 937576856f
commit f927d99807
7 changed files with 58 additions and 30 deletions

View File

@@ -4,7 +4,22 @@ class Transactions::BookingsController < ApplicationController
def index
@bookings = Booking.all.order("booking_id desc")
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