Sha256: 479dc06657b80760871df7f3ae09a832bd5bba3b81e3c869fc9b255ce516e410

Contents?: true

Size: 1.2 KB

Versions: 13

Compression:

Stored size: 1.2 KB

Contents

module Admin
  class EffectiveEventRegistrantsDatatable < Effective::Datatable
    filters do
      scope :unarchived, label: "All"
      scope :purchased
      scope :deferred
      scope :archived
    end

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

      col :event

      col :owner, visible: false
      col :event_registration, visible: false

      if attributes[:event_id]
        col :event_ticket, search: Effective::EventTicket.where(event: event).all
      else
        col :event_ticket, search: :string
      end

      col :purchased_order, visible: false

      col :first_name
      col :last_name
      col :email
      col :company
      col :number, label: 'Designations'
      col :notes, label: 'Restrictions and notes'

      actions_col
    end

    collection do
      scope = Effective::EventRegistrant.deep.purchased_or_deferred.includes(:purchased_order, :owner)

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

      scope
    end

    def event
      @event ||= if attributes[:event_id]
        Effective::Event.find_by_id(attributes[:event_id])
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
effective_events-0.9.2 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.9.1 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.9.0 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.8.0 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.7.4 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.7.3 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.7.2 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.7.1 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.7.0 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.6.13 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.6.12 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.6.11 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.6.10 app/datatables/admin/effective_event_registrants_datatable.rb