Skip to content

Commit

Permalink
add instructeur feedback on accuse de lecture agreement
Browse files Browse the repository at this point in the history
  • Loading branch information
lisa-durand committed Apr 15, 2024
1 parent 98b4b83 commit 1bd2e76
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/models/dossier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,10 @@ def hide_info_with_accuse_lecture?
procedure.accuse_lecture? && termine? && accuse_lecture_agreement_at.blank?
end

def termine_and_accuse_lecture?
procedure.accuse_lecture? && termine?
end

private

def champs_by_public_id
Expand Down
9 changes: 9 additions & 0 deletions app/views/shared/dossiers/_demande.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
.fr-container.counter-start-header-section.dossier-show{ class: class_names("dossier-show-instructeur" => profile =="instructeur") }
.fr-grid-row.fr-grid-row--center
.fr-col-12.fr-col-xl-8
- if profile == 'instructeur' && dossier.termine_and_accuse_lecture?
= render Dsfr::CalloutComponent.new(title: nil) do |c|
- c.with_html_body do
= t('views.shared.dossiers.demande.accuse_lecture')
- if dossier.accuse_lecture_agreement_at.present?
= t('views.shared.dossiers.demande.accuse_lecture_with_agreement', agreement: l(dossier.accuse_lecture_agreement_at, format: :long))
- else
= t('views.shared.dossiers.demande.accuse_lecture_without_agreement')
%h2.fr-h6.fr-background-alt--grey.fr-mb-0
.flex-grow.fr-py-3v.fr-px-2w= t('views.shared.dossiers.demande.en_construction')
Expand Down
3 changes: 3 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,9 @@ en:
form: "Form"
edit_siret: "Edit SIRET"
edit_identity: "Edit identity data"
accuse_lecture: This procedure is subject to a reading receipt.
accuse_lecture_with_agreement: The user has read the decision taken on his file on %{agreement}.
accuse_lecture_without_agreement: The user has not yet learned of the decision on their file.
gestionnaires:
groupe_gestionnaires:
delete: Delete
Expand Down
3 changes: 3 additions & 0 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,9 @@ fr:
form: "Sections du formulaire"
edit_siret: "Modifier le SIRET"
edit_identity: "Modifier l’identité"
accuse_lecture: Cette démarche est soumise à un accusé de lecture.
accuse_lecture_with_agreement: L’usager a pris connaissance de la décision prise sur son dossier le %{agreement}.
accuse_lecture_without_agreement: L’usager n’a pas encore pris connaissance de la décision sur son dossier.
gestionnaires:
groupe_gestionnaires:
delete: Supprimer
Expand Down
28 changes: 28 additions & 0 deletions spec/views/instructeur/dossiers/show.html.haml_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,32 @@
end
end
end

describe 'accuse de lecture ' do
context 'dossier not termine' do
let(:dossier) { create(:dossier, :en_instruction, procedure: create(:procedure, :accuse_lecture)) }

it 'does not display a text about accuse de lecture for instructeur' do
expect(subject).not_to have_text('Cette démarche est soumise à un accusé de lecture')
end
end

context 'dossier termine with accuse de lecture not accepted by user' do
let(:dossier) { create(:dossier, :accepte, procedure: create(:procedure, :accuse_lecture)) }

it 'displays a text about accuse de lecture for instructeur' do
expect(subject).to have_text('Cette démarche est soumise à un accusé de lecture')
expect(subject).to have_text('L’usager n’a pas encore pris connaissance de la décision sur son dossier')
end
end

context 'dossier termine with accuse de lecture accepted by user' do
let(:dossier) { create(:dossier, :accepte, accuse_lecture_agreement_at: Time.zone.now, procedure: create(:procedure, :accuse_lecture)) }

it 'displays a text about accuse de lecture for instructeur' do
expect(subject).to have_text('Cette démarche est soumise à un accusé de lecture')
expect(subject).to have_text('L’usager a pris connaissance de la décision prise sur son dossier le')
end
end
end
end
1 change: 1 addition & 0 deletions spec/views/users/dossiers/demande.html.haml_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
it 'display information about accuse de lecture and not the motivation' do
expect(rendered).to have_text('Cette démarche est soumise à un accusé de lecture.')
expect(rendered).not_to have_text('Motivation')
expect(rendered).not_to have_text('L’usager n’a pas encore pris connaissance de la décision sur son dossier')
end
end
end

0 comments on commit 1bd2e76

Please sign in to comment.