evol: champs optionnels profil et nettoyage templates
This commit is contained in:
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}}
|
||||
Reference in New Issue
Block a user