Skip to content

Commit

Permalink
Merge pull request #11350 from demarches-simplifiees/add-accuse-lectu…
Browse files Browse the repository at this point in the history
…re-in-exports-ldu

ETQ instructeur je peux voir la date d'accuse de lecture dans les exports et je peux filtrer sur sa présence ou non
  • Loading branch information
colinux authored Feb 26, 2025
2 parents 3bed166 + ee84471 commit 2a1a12f
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
26 changes: 26 additions & 0 deletions app/models/columns/read_agreement_column.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# frozen_string_literal: true

class Columns::ReadAgreementColumn < Columns::DossierColumn
def initialize(procedure_id:)
super(
procedure_id:,
table: nil,
column: nil,
label: "Décision vue par l'usager ?",
type: :boolean,
displayable: false,
options_for_select: [[I18n.t('activerecord.attributes.type_de_champ.type_champs.yes_no_true'), true], [I18n.t('activerecord.attributes.type_de_champ.type_champs.yes_no_false'), false]]
)
end

def value(dossier) = dossier.accuse_lecture_agreement_at

def filtered_ids(dossiers, values)
return dossiers.ids if values.include?("true") && values.include?("false")
if values == ["true"]
dossiers.where.not(accuse_lecture_agreement_at: nil).ids
else
dossiers.where(accuse_lecture_agreement_at: nil).ids
end
end
end
5 changes: 5 additions & 0 deletions app/models/concerns/columns_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def dossier_columns_for_export
columns.concat(dossier_dates_columns)
columns.concat([dossier_motivation_column])
columns.concat(sva_svr_columns(for_export: true)) if sva_svr_enabled?
columns.concat([dossier_accuse_lecture_agreement_at_column]) if accuse_lecture?
columns.concat([groupe_instructeurs_id_column, followers_instructeurs_email_column])
columns.concat([dossier_labels_column])

Expand Down Expand Up @@ -127,6 +128,8 @@ def dossier_dates_columns
.map { |column| dossier_col(table: 'self', column:, type: :datetime) }
end

def dossier_accuse_lecture_agreement_at_column = dossier_col(table: 'self', column: 'accuse_lecture_agreement_at', type: :date, filterable: false)

def email_column
dossier_col(table: 'user', column: 'email')
end
Expand All @@ -137,8 +140,10 @@ def dossier_columns
columns.concat([dossier_archived_column])
columns.concat(dossier_dates_columns)
columns.concat([dossier_motivation_column])
columns.concat([dossier_accuse_lecture_agreement_at_column]) if accuse_lecture?
columns.concat(sva_svr_columns(for_export: false)) if sva_svr_enabled?
columns.concat(dossier_non_displayable_dates_columns)
columns.concat([Columns::ReadAgreementColumn.new(procedure_id: id)])
end

def standard_columns
Expand Down
1 change: 1 addition & 0 deletions config/locales/models/procedure_presentation/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ en:
for_tiers: "For tiers"
mandataire_last_name: "Tier last name"
mandataire_first_name: "Tier first name"
accuse_lecture_agreement_at: 'Read receipt'
user:
id: User Id
email: Requester
Expand Down
1 change: 1 addition & 0 deletions config/locales/models/procedure_presentation/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ fr:
dossier_state: 'État du dossier'
last_champ_updated_at: Date de dernière modification (usager)
motivation: 'Motivation de la décision'
accuse_lecture_agreement_at: 'Accusé de lecture'
user:
id: Identifiant du demandeur
email: Demandeur
Expand Down

0 comments on commit 2a1a12f

Please sign in to comment.