amelioration(dossier.pdf): pour les champs de type Champs::AddressChamp, ajoute le code insee de la commune sous l'adresse complete, ajoute le code postal, ajoute le departemenent et son code. Pour les champs de type Champs::CommuneChamp ajoute le code postal de la commune
This commit is contained in:
parent
8a4299ade1
commit
2295d64300
2 changed files with 14 additions and 1 deletions
|
@ -47,6 +47,10 @@ class Champs::AddressChamp < Champs::TextChamp
|
||||||
APIGeoService.departement_name(address.fetch('department_code'))
|
APIGeoService.departement_name(address.fetch('department_code'))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def departement_code_and_name
|
||||||
|
"#{address.fetch('department_code')} – #{departement_name}"
|
||||||
|
end
|
||||||
|
|
||||||
def departement
|
def departement
|
||||||
if full_address?
|
if full_address?
|
||||||
{ code: address.fetch('department_code'), name: departement_name }
|
{ code: address.fetch('department_code'), name: departement_name }
|
||||||
|
|
|
@ -176,10 +176,19 @@ def add_single_champ(pdf, champ)
|
||||||
when 'Champs::NumberChamp'
|
when 'Champs::NumberChamp'
|
||||||
value = champ.blank? ? 'Non communiqué' : number_with_delimiter(champ.to_s)
|
value = champ.blank? ? 'Non communiqué' : number_with_delimiter(champ.to_s)
|
||||||
format_in_2_lines(pdf, tdc.libelle, value)
|
format_in_2_lines(pdf, tdc.libelle, value)
|
||||||
|
when 'Champs::AddressChamp'
|
||||||
|
value = champ.blank? ? 'Non communiqué' : champ.to_s
|
||||||
|
format_in_2_lines(pdf, tdc.libelle, value)
|
||||||
|
if champ.full_address?
|
||||||
|
format_in_2_lines(pdf, "Code INSEE :", champ.commune&.fetch(:code))
|
||||||
|
format_in_2_lines(pdf, "Code Postal :", champ.commune&.fetch(:postal_code))
|
||||||
|
format_in_2_lines(pdf, "Département :", champ.departement_code_and_name)
|
||||||
|
end
|
||||||
when 'Champs::CommuneChamp'
|
when 'Champs::CommuneChamp'
|
||||||
value = champ.blank? ? 'Non communiqué' : champ.to_s
|
value = champ.blank? ? 'Non communiqué' : champ.to_s
|
||||||
format_in_2_lines(pdf, tdc.libelle, value)
|
format_in_2_lines(pdf, tdc.libelle, value)
|
||||||
pdf.text "Département : #{champ.departement_code_and_name}" if champ.departement?
|
format_in_2_lines(pdf, "Code Postal :", champ.code_postal) if champ.code_postal?
|
||||||
|
format_in_2_lines(pdf, "Département :", champ.departement_code_and_name) if champ.departement?
|
||||||
else
|
else
|
||||||
value = champ.blank? ? 'Non communiqué' : champ.to_s
|
value = champ.blank? ? 'Non communiqué' : champ.to_s
|
||||||
format_in_2_lines(pdf, tdc.libelle, value)
|
format_in_2_lines(pdf, tdc.libelle, value)
|
||||||
|
|
Loading…
Reference in a new issue