diff --git a/config.yaml b/config.yaml
index a3c323f..b361c40 100644
--- a/config.yaml
+++ b/config.yaml
@@ -91,6 +91,7 @@ views:
display:
files:
- web/layouts/_partials/address_autocomplete.html
+ - web/layouts/_partials/profile_optional_fields_display.html
- web/layouts/vehicles_management/_partials/vehicle-type-select.html
- web/layouts/beneficiaries/_partials/beneficiary-vehicles.html
- web/layouts/beneficiaries/_partials/beneficiary-notes.html
@@ -274,6 +275,7 @@ views:
driver_display:
files:
- web/layouts/_partials/address_autocomplete.html
+ - web/layouts/_partials/profile_optional_fields_display.html
- web/layouts/solidarity_transport/_partials/driver_availabilities.html
- web/layouts/solidarity_transport/_partials/driver_history.html
- web/layouts/solidarity_transport/_partials/driver_documents.html
@@ -322,6 +324,7 @@ views:
driver_display:
files:
- web/layouts/_partials/address_autocomplete.html
+ - web/layouts/_partials/profile_optional_fields_display.html
- web/layouts/organized_carpool/_partials/driver_availabilities.html
- web/layouts/organized_carpool/_partials/driver_documents.html
- web/layouts/organized_carpool/_partials/driver_wallet.html
diff --git a/web/layouts/_partials/profile_optional_fields_display.html b/web/layouts/_partials/profile_optional_fields_display.html
new file mode 100644
index 0000000..2c5408b
--- /dev/null
+++ b/web/layouts/_partials/profile_optional_fields_display.html
@@ -0,0 +1,64 @@
+{{define "profile_optional_fields_display"}}
+{{if .other_properties}}
+{{range .fields}}
+{{$fieldName := .name}}
+{{$fieldLabel := .label}}
+{{if eq .type "multicheckbox"}}
+ {{$hasValues := false}}
+ {{range .options}}
+ {{$optionKey := printf "%s___%s" $fieldName .value}}
+ {{if index $.other_properties $optionKey}}{{$hasValues = true}}{{end}}
+ {{end}}
+ {{if $hasValues}}
+
+
{{$fieldLabel}}
+
+
+ {{range .options}}
+ {{$optionKey := printf "%s___%s" $fieldName .value}}
+ {{if index $.other_properties $optionKey}}
+
+ {{.label}}
+
+ {{end}}
+ {{end}}
+
+
+
+ {{end}}
+{{else if eq .type "select"}}
+ {{$fieldValue := index $.other_properties $fieldName}}
+ {{if and $fieldValue (ne $fieldValue "0") (ne $fieldValue "")}}
+
+
{{$fieldLabel}}
+
+ {{if eq $fieldName "gender"}}
+ {{genderISO5218 $fieldValue}}
+ {{else}}
+ {{range .options}}
+ {{if eq .value $fieldValue}}{{.label}}{{end}}
+ {{end}}
+ {{end}}
+
+
+ {{end}}
+{{else if eq .type "date"}}
+ {{$fieldValue := index $.other_properties $fieldName}}
+ {{if $fieldValue}}
+
+
{{$fieldLabel}}
+ {{ (timeFrom $fieldValue).Format "02/01/2006" }}
+
+ {{end}}
+{{else}}
+ {{$fieldValue := index $.other_properties $fieldName}}
+ {{if $fieldValue}}
+
+
{{$fieldLabel}}
+ {{$fieldValue}}
+
+ {{end}}
+{{end}}
+{{end}}
+{{end}}
+{{end}}
diff --git a/web/layouts/beneficiaries/display.html b/web/layouts/beneficiaries/display.html
index 670188d..8866bc4 100644
--- a/web/layouts/beneficiaries/display.html
+++ b/web/layouts/beneficiaries/display.html
@@ -89,36 +89,7 @@
{{.ViewState.beneficiary.Data.file_number}}
{{end}}
- {{if and .ViewState.beneficiary.Data.other_properties .ViewState.beneficiary.Data.other_properties.status}}
-
-
Statut
- {{.ViewState.beneficiary.Data.other_properties.status}}
-
- {{end}}
- {{if and .ViewState.beneficiary.Data.other_properties .ViewState.beneficiary.Data.other_properties.situation}}
-
-
Situation sociale
- {{.ViewState.beneficiary.Data.other_properties.situation}}
-
- {{end}}
- {{if and .ViewState.beneficiary.Data.other_properties .ViewState.beneficiary.Data.other_properties.subscription_reason}}
-
-
Motif d'inscription
- {{.ViewState.beneficiary.Data.other_properties.subscription_reason}}
-
- {{end}}
- {{if and .ViewState.beneficiary.Data.other_properties .ViewState.beneficiary.Data.other_properties.last_subscription_date}}
-
-
Dernière adhésion
- {{ (timeFrom .ViewState.beneficiary.Data.other_properties.last_subscription_date).Format "02/01/2006" }}
-
- {{end}}
- {{if and .ViewState.beneficiary.Data.other_properties .ViewState.beneficiary.Data.other_properties.comment}}
-
-
Commentaire
- {{.ViewState.beneficiary.Data.other_properties.comment}}
-
- {{end}}
+ {{ template "profile_optional_fields_display" dict "other_properties" .ViewState.beneficiary.Data.other_properties "fields" $.ViewState.profile_optional_fields }}
diff --git a/web/layouts/beneficiaries/update.html b/web/layouts/beneficiaries/update.html
index 5a921cc..4d75521 100644
--- a/web/layouts/beneficiaries/update.html
+++ b/web/layouts/beneficiaries/update.html
@@ -7,15 +7,15 @@
+ {{if .DynamicData}}{{end}}
{{ template "content" . }}
diff --git a/web/layouts/organized_carpool/driver_display.html b/web/layouts/organized_carpool/driver_display.html
index a8d5e88..189d40e 100644
--- a/web/layouts/organized_carpool/driver_display.html
+++ b/web/layouts/organized_carpool/driver_display.html
@@ -91,6 +91,7 @@
{{.ViewState.driver.Data.address_destination.properties.label}}
{{end}}
+ {{ template "profile_optional_fields_display" dict "other_properties" .ViewState.driver.Data.other_properties "fields" $.ViewState.profile_optional_fields }}
diff --git a/web/layouts/solidarity_transport/driver_display.html b/web/layouts/solidarity_transport/driver_display.html
index b00ea0d..b876ea0 100644
--- a/web/layouts/solidarity_transport/driver_display.html
+++ b/web/layouts/solidarity_transport/driver_display.html
@@ -89,59 +89,7 @@
{{.ViewState.driver.Data.file_number}}
{{end}}
- {{range .ViewState.profile_optional_fields}}
- {{$fieldName := .name}}
- {{$fieldLabel := .label}}
- {{$fieldType := .type}}
- {{if eq .type "multicheckbox"}}
- {{$hasValues := false}}
- {{range .options}}
- {{$optionKey := printf "%s___%s" $fieldName .value}}
- {{if index $.ViewState.driver.Data.other_properties $optionKey}}{{$hasValues = true}}{{end}}
- {{end}}
- {{if $hasValues}}
-
-
{{$fieldLabel}}
-
-
- {{range .options}}
- {{$optionKey := printf "%s___%s" $fieldName .value}}
- {{if index $.ViewState.driver.Data.other_properties $optionKey}}
-
- {{.label}}
-
- {{end}}
- {{end}}
-
-
-
- {{end}}
- {{else if eq .type "select"}}
- {{$fieldValue := index $.ViewState.driver.Data.other_properties $fieldName}}
- {{if and $fieldValue (ne $fieldValue "0") (ne $fieldValue "")}}
-
-
{{$fieldLabel}}
-
- {{if eq $fieldName "gender"}}
- {{genderISO5218 $fieldValue}}
- {{else}}
- {{range .options}}
- {{if eq .value $fieldValue}}{{.label}}{{end}}
- {{end}}
- {{end}}
-
-
- {{end}}
- {{else}}
- {{$fieldValue := index $.ViewState.driver.Data.other_properties $fieldName}}
- {{if $fieldValue}}
-
-
{{$fieldLabel}}
- {{$fieldValue}}
-
- {{end}}
- {{end}}
- {{end}}
+ {{ template "profile_optional_fields_display" dict "other_properties" .ViewState.driver.Data.other_properties "fields" $.ViewState.profile_optional_fields }}