Class: OrdersController
- Inherits:
-
ArtfullyOseController
- Object
- ActionController::Base
- ArtfullyOseController
- OrdersController
- Defined in:
- app/controllers/orders_controller.rb
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 |
# File 'app/controllers/orders_controller.rb', line 2 def index :manage, Order if params[:search] @results = search(params[:search]).sort{|a,b| b.created_at <=> a.created_at }.paginate(:page => params[:page], :per_page => 25) if @results.length == 1 redirect_to order_path(@results.first.id) end else @results = current_organization.orders.includes(:person, :items).all.sort{|a,b| b.created_at <=> a.created_at }.paginate(:page => params[:page], :per_page => 25) end end |
#resend ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'app/controllers/orders_controller.rb', line 21 def resend :view, Order @order = Order.find(params[:id]) OrderMailer.delay.confirmation_for(@order) flash[:notice] = "A copy of the order receipt has been sent to #{@order.person.email}" redirect_to order_url(@order) end |
#sales ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/controllers/orders_controller.rb', line 30 def sales :view, Order @organization = current_user.current_organization @event = Event.find_by_id(params[:event_id]) if params[:event_id].present? @events = @organization.events_with_sales @show = @event.shows.find_by_id(params[:show_id]) if @event && params[:show_id].present? @shows = @event.shows_with_sales(@organization) if @event search_terms = { :start => params[:start], :stop => params[:stop], :organization => current_user.current_organization, :event => @event, :show => @show } @search = SaleSearch.new(search_terms) do |results| results.paginate(:page => params[:page], :per_page => 25) end end |