add rnf and rna address in form view

This commit is contained in:
Lisa Durand 2024-01-31 17:28:00 +01:00 committed by Colin Darie
parent c148f5a389
commit 9e3f28e87b
No known key found for this signature in database
GPG key ID: 8C76CADD40253590
9 changed files with 19 additions and 7 deletions

View file

@ -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}"

View file

@ -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}"

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -109,4 +109,10 @@ class Champs::RNFChamp < Champ
}
end
end
def full_address
if address.present?
address['label']
end
end
end

View file

@ -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)

View file

@ -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:

View file

@ -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é lassociation liée à ce RNA dêtre trouvée"
rnf: