chore(demande): no facultatif word on instructeur profile
This commit is contained in:
parent
1bdc6c02c6
commit
0cec8947d9
5 changed files with 44 additions and 8 deletions
|
@ -2,6 +2,7 @@ class Dossiers::ChampRowShowComponent < ApplicationComponent
|
|||
include ChampHelper
|
||||
include DossierHelper
|
||||
include ApplicationHelper
|
||||
|
||||
def initialize(champs:, demande_seen_at:, profile:, repetition:)
|
||||
@repetition = repetition
|
||||
@champs = champs
|
||||
|
@ -11,6 +12,7 @@ class Dossiers::ChampRowShowComponent < ApplicationComponent
|
|||
|
||||
def updated_after_deposer?(champ)
|
||||
return false if champ.dossier.depose_at.blank?
|
||||
|
||||
champ.updated_at > champ.dossier.depose_at
|
||||
end
|
||||
|
||||
|
@ -18,4 +20,12 @@ class Dossiers::ChampRowShowComponent < ApplicationComponent
|
|||
# we are using the span delimiter that doesn't insert spaces when copying and pasting the number
|
||||
number_with_delimiter(num, delimiter: tag.span(class: 'numbers-delimiter'))
|
||||
end
|
||||
|
||||
def blank_key(champ)
|
||||
key = ".blank"
|
||||
key += "_optional" if @profile == "usager"
|
||||
key += "_attachment" if champ.type_de_champ.piece_justificative?
|
||||
|
||||
key
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
---
|
||||
en:
|
||||
blank: "blank (optional)"
|
||||
blank_attachment: "document not supplied (optional)"
|
||||
blank: "empty"
|
||||
blank_attachment: "document not supplied"
|
||||
blank_optional: "empty (optional)"
|
||||
blank_optional_attachment: "document not supplied (optional)"
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
---
|
||||
fr:
|
||||
blank: "non saisi (facultatif)"
|
||||
blank_attachment: "pièce justificative non saisie (facultative)"
|
||||
blank: "non saisi"
|
||||
blank_attachment: "pièce justificative non saisie"
|
||||
blank_optional: "non saisi (facultatif)"
|
||||
blank_optional_attachment: "pièce justificative non saisie (facultative)"
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
- if champ.blank?
|
||||
.champ-content.fr-text-mention--grey{ class: [highlight_if_unseen_class(@demande_seen_at, champ.updated_at), champ.type_champ] }
|
||||
%p
|
||||
%em= t(champ.type_de_champ.piece_justificative? ? '.blank_attachment' : '.blank')
|
||||
%em= t(blank_key(champ))
|
||||
- else
|
||||
.champ-content{ class: [highlight_if_unseen_class(@demande_seen_at, champ.updated_at), champ.type_champ] }
|
||||
- case champ.type_champ
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
describe 'shared/dossiers/champs', type: :view do
|
||||
let(:instructeur) { create(:instructeur) }
|
||||
let(:demande_seen_at) { nil }
|
||||
let(:profile) { "instructeur" }
|
||||
|
||||
before do
|
||||
view.extend DossierHelper
|
||||
view.extend DossierLinkHelper
|
||||
allow(view).to receive(:current_instructeur).and_return(instructeur)
|
||||
|
||||
if profile == "instructeur"
|
||||
allow(view).to receive(:current_instructeur).and_return(instructeur)
|
||||
end
|
||||
end
|
||||
|
||||
subject { render 'shared/dossiers/champs', champs: champs, dossier: dossier, demande_seen_at: demande_seen_at, profile: nil }
|
||||
subject { render 'shared/dossiers/champs', champs:, dossier:, demande_seen_at:, profile: }
|
||||
|
||||
context "there are some champs" do
|
||||
let(:dossier) { create(:dossier) }
|
||||
|
@ -108,7 +112,25 @@ describe 'shared/dossiers/champs', type: :view do
|
|||
let(:champ) { create(:champ_dossier_link, dossier: dossier, value: nil) }
|
||||
let(:champs) { [champ] }
|
||||
|
||||
it { is_expected.to include("non saisi (facultatif)") }
|
||||
it { is_expected.to include("non saisi") }
|
||||
|
||||
context 'when profile is usager' do
|
||||
let(:profile) { "usager" }
|
||||
it { is_expected.to include("non saisi (facultatif)") }
|
||||
end
|
||||
end
|
||||
|
||||
context "with a piece justificative without value" do
|
||||
let(:dossier) { create(:dossier) }
|
||||
let(:champ) { create(:champ_without_piece_justificative, dossier:) }
|
||||
let(:champs) { [champ] }
|
||||
|
||||
it { is_expected.to include("pièce justificative non saisie") }
|
||||
|
||||
context 'when profile is usager' do
|
||||
let(:profile) { "usager" }
|
||||
it { is_expected.to include("pièce justificative non saisie (facultative)") }
|
||||
end
|
||||
end
|
||||
|
||||
context "with seen_at" do
|
||||
|
|
Loading…
Reference in a new issue