Clean rna champ_row

This commit is contained in:
Damien Le Thiec 2022-09-22 17:14:05 +02:00
parent 542c5b518f
commit bd0df2b60b
6 changed files with 44 additions and 2 deletions

View file

@ -0,0 +1,16 @@
- if champ.blank?
%p= t('.not_filled')
- elsif profile == 'instructeur'
- if champ.data.blank?
%p= t('.fetching_data', rna: champ.value)
- else
%p= t('.data_fetched_title', rna: champ.value)
%ul
- ['association_titre', 'association_objet', ].each do |scope|
- if champ.data[scope].present?
%li #{t("activemodel.attributes.rna_champ.data.#{scope}")} : #{champ.data[scope].capitalize}
- ['association_date_creation', 'association_date_declaration', 'association_date_publication'].each do |scope|
- if champ.data[scope].present?
%li #{t("activemodel.attributes.rna_champ.data.#{scope}")} : #{l(champ.data[scope].to_date)}
- else
%p= champ.value

View file

@ -50,6 +50,8 @@
= render partial: "shared/champs/communes/show", locals: { champ: c }
- when TypeDeChamp.type_champs.fetch(:regions)
= render partial: "shared/champs/regions/show", locals: { champ: c }
- when TypeDeChamp.type_champs.fetch(:rna)
= render partial: "shared/champs/rna/show", locals: { champ: c, profile: profile }
- when TypeDeChamp.type_champs.fetch(:date)
= c.to_s
- when TypeDeChamp.type_champs.fetch(:datetime)

View file

@ -0,0 +1,11 @@
fr:
activemodel:
attributes:
rna_champ:
value: Numéro RNA
data:
association_titre: Nom de l'association
association_objet: Objet de l'association
association_date_creation: Date de création
association_date_declaration: Date de déclaration
association_date_publication: Date de publication

View file

@ -16,6 +16,11 @@ en:
fetching_data: "Fetching data for recipient No. %{numero_allocataire} with postal code %{code_postal}."
data_fetched: "Data concerning %{sources} linked to the account Nº %{numero_allocataire} with the postal code %{code_postal} has been received from the CAF."
data_fetched_title: "Data received from la Caisse nationale dallocations familiales"
rna:
show:
not_filled: not filled
fetching_data: "Fetching data for RNA number %{rna}."
data_fetched_title: Data received thanks to RNA number "%{rna}"
dgfip:
show:
not_filled: not filled

View file

@ -18,6 +18,11 @@ fr:
fetching_data: "La récupération automatique des données pour lallocataire Nº %{numero_allocataire} avec le code postal %{code_postal} est en cours."
data_fetched: "Des données concernant %{sources} liées au compte Nº %{numero_allocataire} avec le code postal %{code_postal} ont été reçues depuis la CAF."
data_fetched_title: "Données obtenues de la Caisse nationale dallocations familiales"
rna:
show:
not_filled: non renseigné
fetching_data: "La récupération automatique des données pour l'association avec le numéro RNA %{rna} est en cours."
data_fetched_title: Données complémentaires obtenues grâce au RNA "%{rna}"
dgfip:
show:
not_filled: non renseigné

View file

@ -17,7 +17,8 @@ describe 'shared/dossiers/champs.html.haml', type: :view do
let(:champ3) { create(:champ_explication, dossier: dossier, value: "mazette") }
let(:champ4) { create(:champ_dossier_link, dossier: dossier, value: dossier.id) }
let(:champ5) { create(:champ_textarea, dossier: dossier, value: "Some long text in a textarea.") }
let(:champs) { [champ1, champ2, champ3, champ4, champ5] }
let(:champ6) { create(:champ_rna, value: "W173847273") }
let(:champs) { [champ1, champ2, champ3, champ4, champ5, champ6] }
it "renders titles and values of champs" do
expect(subject).to include(champ1.libelle)
@ -29,7 +30,9 @@ describe 'shared/dossiers/champs.html.haml', type: :view do
expect(subject).to include(dossier.text_summary)
expect(subject).to include(champ5.libelle)
expect(subject).to include(champ5.libelle)
expect(subject).to include(champ5.value)
expect(subject).to include(champ6.libelle)
expect(subject).to include(champ6.value)
end
it "doesn't render explication champs" do