inject dossier_state at build time

This commit is contained in:
simon lehericey 2024-11-06 16:24:29 +01:00
parent 2b6cc49541
commit e2bc45dc4a
No known key found for this signature in database
GPG key ID: CDE670D827C7B3C5
2 changed files with 6 additions and 4 deletions

View file

@ -46,9 +46,7 @@ class Instructeurs::ColumnFilterValueComponent < ApplicationComponent
end end
def options_for_select_of_column def options_for_select_of_column
if column.scope.present? if column.groupe_instructeur?
I18n.t(column.scope).map(&:to_a).map(&:reverse)
elsif column.groupe_instructeur?
current_instructeur.groupe_instructeurs.filter_map do current_instructeur.groupe_instructeurs.filter_map do
if _1.procedure_id == procedure_id if _1.procedure_id == procedure_id
[_1.label, _1.id] [_1.label, _1.id]

View file

@ -53,7 +53,11 @@ module ColumnsConcern
def dossier_id_column = Columns::DossierColumn.new(procedure_id: id, table: 'self', column: 'id', type: :number) def dossier_id_column = Columns::DossierColumn.new(procedure_id: id, table: 'self', column: 'id', type: :number)
def dossier_state_column = Columns::DossierColumn.new(procedure_id: id, table: 'self', column: 'state', type: :enum, scope: 'instructeurs.dossiers.filterable_state', displayable: false) def dossier_state_column
options_for_select = I18n.t('instructeurs.dossiers.filterable_state').map(&:to_a).map(&:reverse)
Columns::DossierColumn.new(procedure_id: id, table: 'self', column: 'state', type: :enum, options_for_select:, displayable: false)
end
def notifications_column = Columns::DossierColumn.new(procedure_id: id, table: 'notifications', column: 'notifications', label: "notifications", filterable: false) def notifications_column = Columns::DossierColumn.new(procedure_id: id, table: 'notifications', column: 'notifications', label: "notifications", filterable: false)