Sha256: 528ac53be97e82b2770da34f32e3e350ddc529ccb0bd1ec7ac81fb0a0bfa41be

Contents?: true

Size: 1.06 KB

Versions: 5

Compression:

Stored size: 1.06 KB

Contents

module Admin
  class EffectiveCpdStatementsDatatable < Effective::Datatable
    filters do
      scope :all
      scope :draft, label: 'In Progress'
      scope :completed, label: 'Submitted'
    end

    datatable do
      order :updated_at

      col :id, visible: false
      col :token, visible: false
      col :created_at, visible: false
      col :updated_at, visible: false

      col :cpd_cycle, label: cpd_cycle_label.capitalize, search: Effective::CpdCycle.sorted
      col :user
      col :submitted_at, as: :date, label: 'Submitted on'

      col :score, label: cpd_credits_label.capitalize do |cpd_statement|
        cpd_score(cpd_statement.score)
      end

      if attributes[:user_id].present?
        col :required_score, label: 'Required' do |cpd_statement|
          cpd_score(cpd_statement.required_score || cpd_statement.targeted_score)
        end
      end

      col :carry_forward do |cpd_statement|
        cpd_score(cpd_statement.carry_forward)
      end

      actions_col
    end

    collection do
      Effective::CpdStatement.all.deep
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
effective_cpd-0.5.4 app/datatables/admin/effective_cpd_statements_datatable.rb
effective_cpd-0.5.3 app/datatables/admin/effective_cpd_statements_datatable.rb
effective_cpd-0.5.2 app/datatables/admin/effective_cpd_statements_datatable.rb
effective_cpd-0.5.1 app/datatables/admin/effective_cpd_statements_datatable.rb
effective_cpd-0.5.0 app/datatables/admin/effective_cpd_statements_datatable.rb