evol: champs optionnels profil et nettoyage templates
This commit is contained in:
@@ -91,6 +91,7 @@ views:
|
|||||||
display:
|
display:
|
||||||
files:
|
files:
|
||||||
- web/layouts/_partials/address_autocomplete.html
|
- 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/vehicles_management/_partials/vehicle-type-select.html
|
||||||
- web/layouts/beneficiaries/_partials/beneficiary-vehicles.html
|
- web/layouts/beneficiaries/_partials/beneficiary-vehicles.html
|
||||||
- web/layouts/beneficiaries/_partials/beneficiary-notes.html
|
- web/layouts/beneficiaries/_partials/beneficiary-notes.html
|
||||||
@@ -274,6 +275,7 @@ views:
|
|||||||
driver_display:
|
driver_display:
|
||||||
files:
|
files:
|
||||||
- web/layouts/_partials/address_autocomplete.html
|
- 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_availabilities.html
|
||||||
- web/layouts/solidarity_transport/_partials/driver_history.html
|
- web/layouts/solidarity_transport/_partials/driver_history.html
|
||||||
- web/layouts/solidarity_transport/_partials/driver_documents.html
|
- web/layouts/solidarity_transport/_partials/driver_documents.html
|
||||||
@@ -322,6 +324,7 @@ views:
|
|||||||
driver_display:
|
driver_display:
|
||||||
files:
|
files:
|
||||||
- web/layouts/_partials/address_autocomplete.html
|
- 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_availabilities.html
|
||||||
- web/layouts/organized_carpool/_partials/driver_documents.html
|
- web/layouts/organized_carpool/_partials/driver_documents.html
|
||||||
- web/layouts/organized_carpool/_partials/driver_wallet.html
|
- web/layouts/organized_carpool/_partials/driver_wallet.html
|
||||||
|
|||||||
64
web/layouts/_partials/profile_optional_fields_display.html
Normal file
64
web/layouts/_partials/profile_optional_fields_display.html
Normal file
@@ -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}}
|
||||||
|
<div class="sm:col-span-2">
|
||||||
|
<dt class="text-sm font-medium text-gray-500">{{$fieldLabel}}</dt>
|
||||||
|
<dd class="mt-1 text-sm text-gray-900">
|
||||||
|
<div class="flex flex-wrap gap-2">
|
||||||
|
{{range .options}}
|
||||||
|
{{$optionKey := printf "%s___%s" $fieldName .value}}
|
||||||
|
{{if index $.other_properties $optionKey}}
|
||||||
|
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-200 text-gray-800">
|
||||||
|
{{.label}}
|
||||||
|
</span>
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
{{else if eq .type "select"}}
|
||||||
|
{{$fieldValue := index $.other_properties $fieldName}}
|
||||||
|
{{if and $fieldValue (ne $fieldValue "0") (ne $fieldValue "")}}
|
||||||
|
<div class="sm:col-span-1">
|
||||||
|
<dt class="text-sm font-medium text-gray-500">{{$fieldLabel}}</dt>
|
||||||
|
<dd class="mt-1 text-sm text-gray-900">
|
||||||
|
{{if eq $fieldName "gender"}}
|
||||||
|
{{genderISO5218 $fieldValue}}
|
||||||
|
{{else}}
|
||||||
|
{{range .options}}
|
||||||
|
{{if eq .value $fieldValue}}{{.label}}{{end}}
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
{{else if eq .type "date"}}
|
||||||
|
{{$fieldValue := index $.other_properties $fieldName}}
|
||||||
|
{{if $fieldValue}}
|
||||||
|
<div class="sm:col-span-1">
|
||||||
|
<dt class="text-sm font-medium text-gray-500">{{$fieldLabel}}</dt>
|
||||||
|
<dd class="mt-1 text-sm text-gray-900">{{ (timeFrom $fieldValue).Format "02/01/2006" }}</dd>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
{{else}}
|
||||||
|
{{$fieldValue := index $.other_properties $fieldName}}
|
||||||
|
{{if $fieldValue}}
|
||||||
|
<div class="sm:col-span-1">
|
||||||
|
<dt class="text-sm font-medium text-gray-500">{{$fieldLabel}}</dt>
|
||||||
|
<dd class="mt-1 text-sm text-gray-900">{{$fieldValue}}</dd>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
@@ -89,36 +89,7 @@
|
|||||||
<dd class="mt-1 text-sm text-gray-900">{{.ViewState.beneficiary.Data.file_number}}</dd>
|
<dd class="mt-1 text-sm text-gray-900">{{.ViewState.beneficiary.Data.file_number}}</dd>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{if and .ViewState.beneficiary.Data.other_properties .ViewState.beneficiary.Data.other_properties.status}}
|
{{ template "profile_optional_fields_display" dict "other_properties" .ViewState.beneficiary.Data.other_properties "fields" $.ViewState.profile_optional_fields }}
|
||||||
<div class="sm:col-span-1">
|
|
||||||
<dt class="text-sm font-medium text-gray-500">Statut</dt>
|
|
||||||
<dd class="mt-1 text-sm text-gray-900">{{.ViewState.beneficiary.Data.other_properties.status}}</dd>
|
|
||||||
</div>
|
|
||||||
{{end}}
|
|
||||||
{{if and .ViewState.beneficiary.Data.other_properties .ViewState.beneficiary.Data.other_properties.situation}}
|
|
||||||
<div class="sm:col-span-1">
|
|
||||||
<dt class="text-sm font-medium text-gray-500">Situation sociale</dt>
|
|
||||||
<dd class="mt-1 text-sm text-gray-900">{{.ViewState.beneficiary.Data.other_properties.situation}}</dd>
|
|
||||||
</div>
|
|
||||||
{{end}}
|
|
||||||
{{if and .ViewState.beneficiary.Data.other_properties .ViewState.beneficiary.Data.other_properties.subscription_reason}}
|
|
||||||
<div class="sm:col-span-1">
|
|
||||||
<dt class="text-sm font-medium text-gray-500">Motif d'inscription</dt>
|
|
||||||
<dd class="mt-1 text-sm text-gray-900">{{.ViewState.beneficiary.Data.other_properties.subscription_reason}}</dd>
|
|
||||||
</div>
|
|
||||||
{{end}}
|
|
||||||
{{if and .ViewState.beneficiary.Data.other_properties .ViewState.beneficiary.Data.other_properties.last_subscription_date}}
|
|
||||||
<div class="sm:col-span-1">
|
|
||||||
<dt class="text-sm font-medium text-gray-500">Dernière adhésion</dt>
|
|
||||||
<dd class="mt-1 text-sm text-gray-900">{{ (timeFrom .ViewState.beneficiary.Data.other_properties.last_subscription_date).Format "02/01/2006" }}</dd>
|
|
||||||
</div>
|
|
||||||
{{end}}
|
|
||||||
{{if and .ViewState.beneficiary.Data.other_properties .ViewState.beneficiary.Data.other_properties.comment}}
|
|
||||||
<div class="sm:col-span-1">
|
|
||||||
<dt class="text-sm font-medium text-gray-500">Commentaire</dt>
|
|
||||||
<dd class="mt-1 text-sm text-gray-900">{{.ViewState.beneficiary.Data.other_properties.comment}}</dd>
|
|
||||||
</div>
|
|
||||||
{{end}}
|
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -7,15 +7,15 @@
|
|||||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8 mt-8"
|
<div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8 mt-8"
|
||||||
x-data="{
|
x-data="{
|
||||||
fields: {
|
fields: {
|
||||||
first_name: '{{ .ViewState.beneficiary.Data.first_name }}',
|
first_name: null,
|
||||||
last_name: '{{ .ViewState.beneficiary.Data.last_name }}',
|
last_name: null,
|
||||||
email: '{{ .ViewState.beneficiary.Data.email }}',
|
email: null,
|
||||||
phone_number: '{{ .ViewState.beneficiary.Data.phone_number }}',
|
phone_number: null,
|
||||||
birthdate: {{if .ViewState.beneficiary.Data.birthdate}}'{{ (timeFrom .ViewState.beneficiary.Data.birthdate).Format "2006-01-02" }}'{{else}}null{{end}},
|
birthdate: null,
|
||||||
file_number: '{{ .ViewState.beneficiary.Data.file_number }}',
|
file_number: null,
|
||||||
gender: {{.ViewState.beneficiary.Data.gender}}
|
gender: 0
|
||||||
},
|
},
|
||||||
other_properties: {{if .ViewState.beneficiary.Data.other_properties}}{{ json .ViewState.beneficiary.Data.other_properties }}{{else}}{}{{end}},
|
other_properties: {},
|
||||||
other_properties_serialized: null,
|
other_properties_serialized: null,
|
||||||
rules: {
|
rules: {
|
||||||
first_name: ['required'],
|
first_name: ['required'],
|
||||||
@@ -37,6 +37,19 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
isFormValid: true,
|
isFormValid: true,
|
||||||
|
init() {
|
||||||
|
const data = window.__PARCOURSMOB_DATA__ || {};
|
||||||
|
this.fields.first_name = data.first_name || '';
|
||||||
|
this.fields.last_name = data.last_name || '';
|
||||||
|
this.fields.email = data.email || '';
|
||||||
|
this.fields.phone_number = data.phone_number || '';
|
||||||
|
this.fields.file_number = data.file_number || '';
|
||||||
|
this.fields.gender = data.gender || 0;
|
||||||
|
if (data.birthdate) {
|
||||||
|
this.fields.birthdate = String(data.birthdate).substring(0, 10);
|
||||||
|
}
|
||||||
|
this.other_properties = data.other_properties || {};
|
||||||
|
},
|
||||||
validate() {
|
validate() {
|
||||||
this.formValidation = Iodine.assert(this.fields, this.rules)
|
this.formValidation = Iodine.assert(this.fields, this.rules)
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -173,6 +173,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{if .DynamicData}}<script id="dynamic-data">window.__PARCOURSMOB_DATA__ = {{ json .DynamicData }};</script>{{end}}
|
||||||
<main>
|
<main>
|
||||||
<div class="py-6">
|
<div class="py-6">
|
||||||
{{ template "content" . }}
|
{{ template "content" . }}
|
||||||
|
|||||||
@@ -91,6 +91,7 @@
|
|||||||
<dd class="mt-1 text-sm text-gray-900">{{.ViewState.driver.Data.address_destination.properties.label}}</dd>
|
<dd class="mt-1 text-sm text-gray-900">{{.ViewState.driver.Data.address_destination.properties.label}}</dd>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
{{ template "profile_optional_fields_display" dict "other_properties" .ViewState.driver.Data.other_properties "fields" $.ViewState.profile_optional_fields }}
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -89,59 +89,7 @@
|
|||||||
<dd class="mt-1 text-sm text-gray-900">{{.ViewState.driver.Data.file_number}}</dd>
|
<dd class="mt-1 text-sm text-gray-900">{{.ViewState.driver.Data.file_number}}</dd>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{range .ViewState.profile_optional_fields}}
|
{{ template "profile_optional_fields_display" dict "other_properties" .ViewState.driver.Data.other_properties "fields" $.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}}
|
|
||||||
<div class="sm:col-span-2">
|
|
||||||
<dt class="text-sm font-medium text-gray-500">{{$fieldLabel}}</dt>
|
|
||||||
<dd class="mt-1 text-sm text-gray-900">
|
|
||||||
<div class="flex flex-wrap gap-2">
|
|
||||||
{{range .options}}
|
|
||||||
{{$optionKey := printf "%s___%s" $fieldName .value}}
|
|
||||||
{{if index $.ViewState.driver.Data.other_properties $optionKey}}
|
|
||||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-200 text-gray-800">
|
|
||||||
{{.label}}
|
|
||||||
</span>
|
|
||||||
{{end}}
|
|
||||||
{{end}}
|
|
||||||
</div>
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
{{end}}
|
|
||||||
{{else if eq .type "select"}}
|
|
||||||
{{$fieldValue := index $.ViewState.driver.Data.other_properties $fieldName}}
|
|
||||||
{{if and $fieldValue (ne $fieldValue "0") (ne $fieldValue "")}}
|
|
||||||
<div class="sm:col-span-1">
|
|
||||||
<dt class="text-sm font-medium text-gray-500">{{$fieldLabel}}</dt>
|
|
||||||
<dd class="mt-1 text-sm text-gray-900">
|
|
||||||
{{if eq $fieldName "gender"}}
|
|
||||||
{{genderISO5218 $fieldValue}}
|
|
||||||
{{else}}
|
|
||||||
{{range .options}}
|
|
||||||
{{if eq .value $fieldValue}}{{.label}}{{end}}
|
|
||||||
{{end}}
|
|
||||||
{{end}}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
{{end}}
|
|
||||||
{{else}}
|
|
||||||
{{$fieldValue := index $.ViewState.driver.Data.other_properties $fieldName}}
|
|
||||||
{{if $fieldValue}}
|
|
||||||
<div class="sm:col-span-1">
|
|
||||||
<dt class="text-sm font-medium text-gray-500">{{$fieldLabel}}</dt>
|
|
||||||
<dd class="mt-1 text-sm text-gray-900">{{$fieldValue}}</dd>
|
|
||||||
</div>
|
|
||||||
{{end}}
|
|
||||||
{{end}}
|
|
||||||
{{end}}
|
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user