Sha256: 58fc6230a49051c62144acb2b34677c1f4df85fc107b88184efd6cc23206bd6f

Contents?: true

Size: 983 Bytes

Versions: 5

Compression:

Stored size: 983 Bytes

Contents

module Admin
  class EffectiveEventTicketsDatatable < Effective::Datatable
    datatable do
      reorder :position

      col :updated_at, visible: false
      col :created_at, visible: false
      col :id, visible: false

      col :event

      col :title
      col :regular_price, as: :price
      col :early_bird_price, as: :price

      col :capacity
      col :purchased_event_registrants_count, label: 'Registered'

      col :purchased_event_registrants, label: 'Registrants' do |ticket|
        ticket.purchased_event_registrants.sort_by(&:last_name).map do |registrant|
          content_tag(:div, registrant.last_first_name, class: 'col-resource_item')
        end.join.html_safe
      end

      actions_col
    end

    collection do
      scope = Effective::EventTicket.deep.all

      if attributes[:event_id]
        scope = scope.where(event: event)
      end

      scope
    end

    def event
      Effective::Event.find(attributes[:event_id])
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
effective_events-0.1.4 app/datatables/admin/effective_event_tickets_datatable.rb
effective_events-0.1.3 app/datatables/admin/effective_event_tickets_datatable.rb
effective_events-0.1.2 app/datatables/admin/effective_event_tickets_datatable.rb
effective_events-0.1.1 app/datatables/admin/effective_event_tickets_datatable.rb
effective_events-0.1.0 app/datatables/admin/effective_event_tickets_datatable.rb