Sha256: c98277f6d97b18e7d73ff35334e25d5ee24c49f1c3cc50a17f7f1d84d91a4a59

Contents?: true

Size: 1.09 KB

Versions: 13

Compression:

Stored size: 1.09 KB

Contents

module Admin
  class EffectiveEventAddonsDatatable < 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 :event_registration, visible: false

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

      col :purchased_order
      col :owner

      col :first_name
      col :last_name
      col :email
      col :notes, label: 'Notes'

      actions_col
    end

    collection do
      scope = Effective::EventAddon.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_addons_datatable.rb
effective_events-0.9.1 app/datatables/admin/effective_event_addons_datatable.rb
effective_events-0.9.0 app/datatables/admin/effective_event_addons_datatable.rb
effective_events-0.8.0 app/datatables/admin/effective_event_addons_datatable.rb
effective_events-0.7.4 app/datatables/admin/effective_event_addons_datatable.rb
effective_events-0.7.3 app/datatables/admin/effective_event_addons_datatable.rb
effective_events-0.7.2 app/datatables/admin/effective_event_addons_datatable.rb
effective_events-0.7.1 app/datatables/admin/effective_event_addons_datatable.rb
effective_events-0.7.0 app/datatables/admin/effective_event_addons_datatable.rb
effective_events-0.6.13 app/datatables/admin/effective_event_addons_datatable.rb
effective_events-0.6.12 app/datatables/admin/effective_event_addons_datatable.rb
effective_events-0.6.11 app/datatables/admin/effective_event_addons_datatable.rb
effective_events-0.6.10 app/datatables/admin/effective_event_addons_datatable.rb