Sha256: b29f72a27548cefc6510bfdafc75e76d96a1c58f1fe37c0a97bcca225102252e

Contents?: true

Size: 1.84 KB

Versions: 33

Compression:

Stored size: 1.84 KB

Contents

# Dashboard Event Registrations
class EffectiveEventRegistrationsDatatable < Effective::Datatable
  datatable do
    order :created_at

    col :token, visible: false
    col :created_at, visible: false

    col(:submitted_at, label: 'Registered on') do |er|
      er.submitted_at&.strftime('%F') || 'Incomplete'
    end

    col :event, search: :string do |er|
      link_to(er.event.to_s, effective_events.event_path(er.event))
    end

    col :owner, visible: false, search: :string
    col :status, visible: false
    col :event_registrants, label: 'Registrants', search: :string

    col :event_addons, label: 'Add-ons', search: :string
    col :orders, action: :show, visible: false, search: :string

    actions_col(actions: []) do |er|
      if er.draft? || er.submitted?
        dropdown_link_to('Continue', effective_events.event_event_registration_build_path(er.event, er, er.next_step), 'data-turbolinks' => false)
      elsif er.completed?
        if EffectiveResources.authorized?(self, :update_blank_registrants, er)
          dropdown_link_to('Continue', effective_events.event_event_registration_path(er.event, er))
        else
          dropdown_link_to('Show', effective_events.event_event_registration_path(er.event, er))
        end

        # Register Again
        if er.event.registerable? && !er.event.sold_out?
          url = er.event.external_registration_url.presence || effective_events.new_event_event_registration_path(er.event)
          dropdown_link_to('Register Again', url)
        end
      end

      if EffectiveResources.authorized?(self, :destroy, er)
        dropdown_link_to('Delete', effective_events.event_event_registration_path(er.event, er), 'data-confirm': "Really delete #{er}?", 'data-method': :delete)
      end

    end
  end

  collection do
    EffectiveEvents.EventRegistration.deep.where(owner: current_user)
  end

end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
effective_events-2.30.0 app/datatables/effective_event_registrations_datatable.rb
effective_events-2.29.6 app/datatables/effective_event_registrations_datatable.rb
effective_events-2.29.5 app/datatables/effective_event_registrations_datatable.rb
effective_events-2.29.4 app/datatables/effective_event_registrations_datatable.rb
effective_events-2.29.3 app/datatables/effective_event_registrations_datatable.rb
effective_events-2.29.2 app/datatables/effective_event_registrations_datatable.rb
effective_events-2.29.1 app/datatables/effective_event_registrations_datatable.rb
effective_events-2.29.0 app/datatables/effective_event_registrations_datatable.rb
effective_events-2.28.3 app/datatables/effective_event_registrations_datatable.rb
effective_events-2.28.2 app/datatables/effective_event_registrations_datatable.rb
effective_events-2.28.1 app/datatables/effective_event_registrations_datatable.rb
effective_events-2.28.0 app/datatables/effective_event_registrations_datatable.rb
effective_events-2.27.0 app/datatables/effective_event_registrations_datatable.rb
effective_events-2.26.0 app/datatables/effective_event_registrations_datatable.rb
effective_events-2.25.1 app/datatables/effective_event_registrations_datatable.rb
effective_events-2.25.0 app/datatables/effective_event_registrations_datatable.rb
effective_events-0.24.0 app/datatables/effective_event_registrations_datatable.rb
effective_events-0.23.1 app/datatables/effective_event_registrations_datatable.rb
effective_events-0.23.0 app/datatables/effective_event_registrations_datatable.rb
effective_events-0.22.2 app/datatables/effective_event_registrations_datatable.rb