Sha256: 3bb9b507e3d536eb3041dff462f3dce6efdd89bf8b5c981efcbcc5c5f7dd09e2

Contents?: true

Size: 1.2 KB

Versions: 6

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 :archived, 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

      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

6 entries across 6 versions & 1 rubygems

Version Path
effective_events-0.11.3 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.11.2 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.11.1 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.11.0 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.10.2 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.10.1 app/datatables/admin/effective_event_registrants_datatable.rb