diff --git a/app/components/editable_champ/rnf_component/rnf_component.en.yml b/app/components/editable_champ/rnf_component/rnf_component.en.yml index 4c810a5b4..24faeae48 100644 --- a/app/components/editable_champ/rnf_component/rnf_component.en.yml +++ b/app/components/editable_champ/rnf_component/rnf_component.en.yml @@ -2,4 +2,4 @@ en: rnf_info_error: No foundation found rnf_info_pending: RNF verification pending - rnf_info_success: "This RNF matches %{title}" + rnf_info_success: "This RNF matches %{title}, %{address}" diff --git a/app/components/editable_champ/rnf_component/rnf_component.fr.yml b/app/components/editable_champ/rnf_component/rnf_component.fr.yml index 4040fd158..6c1441985 100644 --- a/app/components/editable_champ/rnf_component/rnf_component.fr.yml +++ b/app/components/editable_champ/rnf_component/rnf_component.fr.yml @@ -2,4 +2,4 @@ fr: rnf_info_error: Aucune fondation trouvée rnf_info_pending: Vérification du RNF en cours - rnf_info_success: "Ce RNF correspond à %{title}" + rnf_info_success: "Ce RNF correspond à %{title}, %{address}" diff --git a/app/components/editable_champ/rnf_component/rnf_component.html.haml b/app/components/editable_champ/rnf_component/rnf_component.html.haml index edf5f07f4..9fc2bca98 100644 --- a/app/components/editable_champ/rnf_component/rnf_component.html.haml +++ b/app/components/editable_champ/rnf_component/rnf_component.html.haml @@ -6,4 +6,4 @@ - elsif @champ.fetch_external_data_pending? %p.fr-info-text= t('.rnf_info_pending') - elsif @champ.data? - %p.fr-info-text= t('.rnf_info_success', title: @champ.title) + %p.fr-info-text= t('.rnf_info_success', title: @champ.title, address: @champ.full_address) diff --git a/app/lib/api_entreprise/rna_adapter.rb b/app/lib/api_entreprise/rna_adapter.rb index 456d9a989..a35b24f3f 100644 --- a/app/lib/api_entreprise/rna_adapter.rb +++ b/app/lib/api_entreprise/rna_adapter.rb @@ -23,7 +23,8 @@ class APIEntreprise::RNAAdapter < APIEntreprise::Adapter "association_date_creation" => data[:date_creation], # see: https://mattermost.incubateur.net/betagouv/pl/r6txumw9cpyx58rt7iq5dte9qe "association_date_declaration" => meta[:date_derniere_mise_a_jour_rna], - "association_date_publication" => data[:date_publication_journal_officiel] + "association_date_publication" => data[:date_publication_journal_officiel], + "address" => data[:adresse_siege] } end end diff --git a/app/models/champs/rna_champ.rb b/app/models/champs/rna_champ.rb index a0b080369..e8d82694d 100644 --- a/app/models/champs/rna_champ.rb +++ b/app/models/champs/rna_champ.rb @@ -11,6 +11,11 @@ class Champs::RNAChamp < Champ data&.dig("association_titre") end + def full_address + address = data&.dig("address") + "#{address["numero_voie"]} #{address["type_voie"]} #{address["libelle_voie"]} #{address["code_postal"]} #{address["commune"]}" + end + def identifier title.present? ? "#{value} (#{title})" : value end diff --git a/app/models/champs/rnf_champ.rb b/app/models/champs/rnf_champ.rb index b487e78f6..7b5106fb8 100644 --- a/app/models/champs/rnf_champ.rb +++ b/app/models/champs/rnf_champ.rb @@ -109,4 +109,10 @@ class Champs::RNFChamp < Champ } end end + + def full_address + if address.present? + address['label'] + end + end end diff --git a/app/views/shared/champs/rna/_association.html.haml b/app/views/shared/champs/rna/_association.html.haml index 558373ade..f0520db90 100644 --- a/app/views/shared/champs/rna/_association.html.haml +++ b/app/views/shared/champs/rna/_association.html.haml @@ -8,4 +8,4 @@ %p.fr-error-text= t('.network_error') - else - if champ.value.present? - %p.fr-info-text= t('.data_fetched', title: champ.title) + %p.fr-info-text= t('.data_fetched', title: champ.title, address: champ.full_address) diff --git a/config/locales/shared.en.yml b/config/locales/shared.en.yml index 4250b311b..38431ed9b 100644 --- a/config/locales/shared.en.yml +++ b/config/locales/shared.en.yml @@ -28,7 +28,7 @@ en: not_filled: not filled not_found: "RNA number %{rna} (no association found)" association: - data_fetched: "This RNA number is linked to %{title}" + data_fetched: "This RNA number is linked to %{title}, %{address}" not_found: "No association found" network_error: "A network error has prevented the association associated with this RNA to be fetched" rnf: diff --git a/config/locales/shared.fr.yml b/config/locales/shared.fr.yml index d5e599f6a..00b238b57 100644 --- a/config/locales/shared.fr.yml +++ b/config/locales/shared.fr.yml @@ -30,7 +30,7 @@ fr: not_filled: non renseigné not_found: "RNA %{rna} (aucun établissement trouvé)" association: - data_fetched: "Ce RNA correspond à %{title}" + data_fetched: "Ce RNA correspond à %{title}, %{address}" not_found: "Aucun établissement trouvé" network_error: "Une erreur réseau a empêché l’association liée à ce RNA d’être trouvée" rnf: