Sha256: 47860fddb14cb4e8f9ff725587fecac70b0250151d06cd79207c19fee998cd2f

Contents?: true

Size: 1.38 KB

Versions: 22

Compression:

Stored size: 1.38 KB

Contents

# Used on the Event Registrations tickets step

class EffectiveEventRegistrantsDatatable < Effective::Datatable
  datatable do
    order :id

    col :full_name, label: 'Name'
    col :id, visible: false

    col :event_ticket, search: :string, label: 'Ticket' do |er|
      [er.event_ticket.to_s, er.details.presence].compact.join('<br>').html_safe
    end

    col :user, label: 'Member', visible: false
    col :organization, visible: false

    col :first_name, visible: false
    col :last_name, visible: false
    col :email, visible: false
    col :company, visible: false

    col :response1, visible: false
    col :response2, visible: false
    col :response3, visible: false

    col :responses, label: 'Details'

    col :price, as: :price
    col :archived, visible: false

    # no actions_col
  end

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

    if event.present?
      scope = scope.where(event: event)
    end

    if event_registration.present?
      scope = scope.where(event_registration_id: event_registration).sorted
    end

    scope
  end

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

  def event_registration
    @event_registration ||= if attributes[:event_registration_id]
      EffectiveEvents.EventRegistration.find_by_id(attributes[:event_registration_id])
    end
  end

end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
effective_events-2.31.4 app/datatables/effective_event_registrants_datatable.rb
effective_events-2.31.3 app/datatables/effective_event_registrants_datatable.rb
effective_events-2.31.2 app/datatables/effective_event_registrants_datatable.rb
effective_events-2.31.1 app/datatables/effective_event_registrants_datatable.rb
effective_events-2.31.0 app/datatables/effective_event_registrants_datatable.rb
effective_events-2.30.3 app/datatables/effective_event_registrants_datatable.rb
effective_events-2.30.2 app/datatables/effective_event_registrants_datatable.rb
effective_events-2.30.1 app/datatables/effective_event_registrants_datatable.rb
effective_events-2.30.0 app/datatables/effective_event_registrants_datatable.rb
effective_events-2.29.6 app/datatables/effective_event_registrants_datatable.rb
effective_events-2.29.5 app/datatables/effective_event_registrants_datatable.rb
effective_events-2.29.4 app/datatables/effective_event_registrants_datatable.rb
effective_events-2.29.3 app/datatables/effective_event_registrants_datatable.rb
effective_events-2.29.2 app/datatables/effective_event_registrants_datatable.rb
effective_events-2.29.1 app/datatables/effective_event_registrants_datatable.rb
effective_events-2.29.0 app/datatables/effective_event_registrants_datatable.rb
effective_events-2.28.3 app/datatables/effective_event_registrants_datatable.rb
effective_events-2.28.2 app/datatables/effective_event_registrants_datatable.rb
effective_events-2.28.1 app/datatables/effective_event_registrants_datatable.rb
effective_events-2.28.0 app/datatables/effective_event_registrants_datatable.rb