add AR in user view - hide decision on second dossier tab
This commit is contained in:
parent
8eda069bfc
commit
e486f789f6
9 changed files with 65 additions and 25 deletions
5
app/components/dossiers/accuse_lecture_component.rb
Normal file
5
app/components/dossiers/accuse_lecture_component.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class Dossiers::AccuseLectureComponent < ApplicationComponent
|
||||
def initialize(dossier:)
|
||||
@dossier = dossier
|
||||
end
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
en:
|
||||
text_accuse_lecture: This procedure is subject to a reading acknowledgment. By requesting the display of the decision taken on your file, you accept the reading acknowledgment and thereby the triggering of the legal deadline in the event of an appeal.
|
||||
btn_accuse_lecture: I would like to display the decision
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
fr:
|
||||
text_accuse_lecture: Cette procédure est soumise à un accusé de lecture. En demandant l'affichage de la décision prise sur votre dossier, vous acceptez l'accusé de lecture et par là même le démarrage du délai légal en cas de recours.
|
||||
btn_accuse_lecture: Je souhaite afficher la décision
|
|
@ -0,0 +1,10 @@
|
|||
= render Dsfr::CalloutComponent.new(title: nil) do |c|
|
||||
- c.with_body do
|
||||
= t('.text_accuse_lecture')
|
||||
|
||||
= form_for @dossier,
|
||||
method: :get,
|
||||
url: set_accuse_lecture_agreement_at_dossier_path(@dossier),
|
||||
data: { controller: 'autosubmit', turbo: 'true' } do |f|
|
||||
|
||||
= f.submit t('.btn_accuse_lecture'), class: "fr-btn fr-mt-2w"
|
|
@ -1180,6 +1180,10 @@ class Dossier < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
def hide_info_with_accuse_lecture
|
||||
procedure.accuse_lecture? && termine? && accuse_lecture_agreement_at.blank?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def champs_by_public_id
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
.flex-grow.fr-py-3v.fr-px-2w= t('views.shared.dossiers.demande.en_construction')
|
||||
|
||||
- if dossier.depose_at.present?
|
||||
= render partial: "shared/dossiers/infos_generales", locals: { dossier: dossier }
|
||||
= render partial: "shared/dossiers/infos_generales", locals: { dossier: dossier, profile: profile }
|
||||
|
||||
|
||||
- if dossier.for_tiers?
|
||||
|
|
|
@ -9,18 +9,22 @@
|
|||
.fr-highlight
|
||||
%p.fr-text--sm.fr-text-mention--grey Sauf mention contraire, les champs ont été saisis à la date du dépôt du dossier.
|
||||
|
||||
- if dossier.justificatif_motivation.attached?
|
||||
= render Dossiers::RowShowComponent.new(label: "Justificatif") do |c|
|
||||
- c.with_value do
|
||||
.action
|
||||
= render Attachment::ShowComponent.new(attachment: dossier.justificatif_motivation.attachment)
|
||||
- if profile == 'usager' && dossier.hide_info_with_accuse_lecture
|
||||
= render Dossiers::AccuseLectureComponent.new(dossier: dossier)
|
||||
|
||||
- if dossier.motivation.present?
|
||||
= render Dossiers::RowShowComponent.new(label: "Motivation") do |c|
|
||||
- c.with_value do
|
||||
= simple_format dossier.motivation
|
||||
- else
|
||||
- if dossier.justificatif_motivation.attached?
|
||||
= render Dossiers::RowShowComponent.new(label: "Justificatif") do |c|
|
||||
- c.with_value do
|
||||
.action
|
||||
= render Attachment::ShowComponent.new(attachment: dossier.justificatif_motivation.attachment)
|
||||
|
||||
- if dossier.attestation.present? && dossier.attestation.pdf.attached?
|
||||
= render Dossiers::RowShowComponent.new(label: "Attestation") do |c|
|
||||
- c.with_value do
|
||||
= render Dsfr::DownloadComponent.new(attachment: dossier.attestation.pdf, name: t(:download_attestation, scope: [:views, :shared, :dossiers, :form]))
|
||||
- if dossier.motivation.present?
|
||||
= render Dossiers::RowShowComponent.new(label: "Motivation") do |c|
|
||||
- c.with_value do
|
||||
= simple_format dossier.motivation
|
||||
|
||||
- if dossier.attestation.present? && dossier.attestation.pdf.attached?
|
||||
= render Dossiers::RowShowComponent.new(label: "Attestation") do |c|
|
||||
- c.with_value do
|
||||
= render Dsfr::DownloadComponent.new(attachment: dossier.attestation.pdf, name: t(:download_attestation, scope: [:views, :shared, :dossiers, :form]))
|
||||
|
|
|
@ -55,17 +55,8 @@
|
|||
= t('views.users.dossiers.show.status_overview.use_mailbox_for_questions_html', mailbox_url: messagerie_dossier_url(dossier))
|
||||
|
||||
- elsif dossier.termine?
|
||||
- if dossier.procedure.accuse_lecture? && !dossier.accuse_lecture_agreement_at.present?
|
||||
= render Dsfr::CalloutComponent.new(title: nil) do |c|
|
||||
- c.with_body do
|
||||
Cette procédure est soumise à un accusé de lecture. En demandant l'affichage de la décision prise sur votre dossier, vous acceptez l'accusé de lecture et par là même le démarrage du délai légal en cas de recours.
|
||||
|
||||
= form_for dossier,
|
||||
method: :get,
|
||||
url: set_accuse_lecture_agreement_at_dossier_path(dossier),
|
||||
data: { controller: 'autosubmit', turbo: 'true' } do |f|
|
||||
|
||||
= f.submit "Je souhaite afficher la décision", class: "fr-btn fr-mt-2w"
|
||||
- if dossier.hide_info_with_accuse_lecture
|
||||
= render Dossiers::AccuseLectureComponent.new(dossier: dossier)
|
||||
|
||||
- elsif dossier.accepte?
|
||||
.accepte
|
||||
|
|
|
@ -59,4 +59,22 @@ describe 'users/dossiers/demande', type: :view do
|
|||
expect(rendered).to have_text(dossier.individual.email.to_s)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when a dossier is accepte with motivation' do
|
||||
let(:dossier) { create(:dossier, :accepte, :with_motivation) }
|
||||
|
||||
it 'displays the motivation' do
|
||||
expect(rendered).not_to have_text('Cette procédure est soumise à un accusé de lecture.')
|
||||
expect(rendered).to have_text('Motivation')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when a dossier is accepte with motivation and with accuse de lecture' do
|
||||
let(:dossier) { create(:dossier, :accepte, :with_motivation, procedure: create(:procedure, :accuse_lecture)) }
|
||||
|
||||
it 'display information about accuse de lecture and not the motivation' do
|
||||
expect(rendered).to have_text('Cette procédure est soumise à un accusé de lecture.')
|
||||
expect(rendered).not_to have_text('Motivation')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue