Many improvements
This commit is contained in:
@@ -7,15 +7,15 @@
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8 mt-8"
|
||||
x-data="{
|
||||
fields: {
|
||||
first_name: '{{ .ViewState.Data.first_name }}',
|
||||
last_name: '{{ .ViewState.Data.last_name }}',
|
||||
email: '{{ .ViewState.Data.email }}',
|
||||
phone_number: '{{ .ViewState.Data.phone_number }}',
|
||||
birthdate: {{if .ViewState.Data.birthdate}}'{{ (timeFrom .ViewState.Data.birthdate).Format "2006-01-02" }}'{{else}}null{{end}},
|
||||
file_number: '{{ .ViewState.Data.file_number }}',
|
||||
gender: {{.ViewState.Data.gender}}
|
||||
first_name: '{{ .ViewState.beneficiary.Data.first_name }}',
|
||||
last_name: '{{ .ViewState.beneficiary.Data.last_name }}',
|
||||
email: '{{ .ViewState.beneficiary.Data.email }}',
|
||||
phone_number: '{{ .ViewState.beneficiary.Data.phone_number }}',
|
||||
birthdate: {{if .ViewState.beneficiary.Data.birthdate}}'{{ (timeFrom .ViewState.beneficiary.Data.birthdate).Format "2006-01-02" }}'{{else}}null{{end}},
|
||||
file_number: '{{ .ViewState.beneficiary.Data.file_number }}',
|
||||
gender: {{.ViewState.beneficiary.Data.gender}}
|
||||
},
|
||||
other_properties: {{if .ViewState.Data.other_properties}}{{ json .ViewState.Data.other_properties }}{{else}}{}{{end}},
|
||||
other_properties: {{if .ViewState.beneficiary.Data.other_properties}}{{ json .ViewState.beneficiary.Data.other_properties }}{{else}}{}{{end}},
|
||||
other_properties_serialized: null,
|
||||
rules: {
|
||||
first_name: ['required'],
|
||||
@@ -113,6 +113,14 @@
|
||||
x-model="fields.file_number" @blur="validateField('file_number')"
|
||||
:class="formValidation.fields.file_number.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
|
||||
</div>
|
||||
|
||||
{{ $fieldName := "address" }}
|
||||
{{if .ViewState.beneficiary.Data.address}}
|
||||
{{$default := .ViewState.beneficiary.Data.address}}
|
||||
{{ template "address" dict "FieldName" $fieldName "Default" $default}}
|
||||
{{else}}
|
||||
{{ template "address_autocomplete" dict "FieldName" $fieldName}}
|
||||
{{end}}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -127,118 +135,42 @@
|
||||
</div>
|
||||
<div class="mt-5 space-y-6 md:mt-0 md:col-span-2">
|
||||
<div class="grid grid-cols-6 gap-6">
|
||||
{{range .ViewState.profile_optional_fields}}
|
||||
<div class="col-span-6 sm:col-span-3">
|
||||
<label for="gender" class="block text-sm font-medium text-gray-700">Genre</label>
|
||||
<label for="{{.name}}" class="block text-sm font-medium text-gray-700">{{.label}}</label>
|
||||
{{if eq .type "select"}}
|
||||
<div class="sm:mt-0 sm:col-span-2">
|
||||
<select id="gender" name="gender" autocomplete="gender" x-model="fields.gender"
|
||||
class="max-w-lg mt-1 block focus:ring-co-blue focus:border-co-blue w-3xs-full shadow-sm sm:max-w-xs sm:text-sm border-gray-300 rounded-2xl">
|
||||
<option value="0">Inconnu</option>
|
||||
<option value="1" :selected="fields.gender == '1'">Masculin</option>
|
||||
<option value="2" :selected="fields.gender == '2'">Féminin</option>
|
||||
<option value="9" :selected="fields.gender == '9'">Sans objet</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3">
|
||||
<label for="situation" class="block text-sm font-medium text-gray-700">Situation sociale</label>
|
||||
<div class="sm:mt-0 sm:col-span-2">
|
||||
<select id="situation" name="situation" autocomplete="situation" x-model="other_properties.situation"
|
||||
<select id="{{.name}}" name="{{.name}}"
|
||||
{{if eq .name "gender"}}x-model="fields.gender"{{else}}x-model="other_properties.{{.name}}"{{end}}
|
||||
class="max-w-lg mt-1 block focus:ring-co-blue focus:border-co-blue w-full shadow-sm sm:max-w-xs sm:text-sm border-gray-300 rounded-2xl">
|
||||
<option value="">Inconnu</option>
|
||||
<option value="BRSA">BRSA</option>
|
||||
<option value="Demandeur d'emploi">Demandeur d'emploi</option>
|
||||
<option value="Chantier">Chantier</option>
|
||||
<option value="Jeune -25">Jeune -25</option>
|
||||
{{range .options}}
|
||||
<option value="{{.value}}">{{.label}}</option>
|
||||
{{end}}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3">
|
||||
<label for="situation" class="block text-sm font-medium text-gray-700">Motif d'inscription</label>
|
||||
<div class="sm:mt-0 sm:col-span-2">
|
||||
<select id="subscription_reason" name="subscription_reason" autocomplete="subscription_reason" x-model="other_properties.subscription_reason"
|
||||
class="max-w-lg mt-1 block focus:ring-co-blue focus:border-co-blue w-full shadow-sm sm:max-w-xs sm:text-sm border-gray-300 rounded-2xl">
|
||||
<option value="Autre">Inconnu</option>
|
||||
<option value="Pas de permis">Pas de permis</option>
|
||||
<option value="Pas de véhicule">Pas de véhicule</option>
|
||||
<option value="Perte d'autonomie">Perte d'autonomie</option>
|
||||
<option value="Autre">Autre</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{{if moduleAvailable "solidarity_transport"}}
|
||||
<div class="col-span-6 sm:col-span-3">
|
||||
<label for="status" class="block text-sm font-medium text-gray-700">Statut (prioritaire / non prioritaire)</label>
|
||||
<div class="sm:mt-0 sm:col-span-2">
|
||||
<select id="status" name="status" autocomplete="status" x-model="other_properties.status"
|
||||
class="max-w-lg mt-1 block focus:ring-co-blue focus:border-co-blue w-full shadow-sm sm:max-w-xs sm:text-sm border-gray-300 rounded-2xl">
|
||||
<option value="Non prioritaire">Non prioritaire</option>
|
||||
<option value="Prioritaire">Prioritaire</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3">
|
||||
<label for="last_subscription_date" class="block text-sm font-medium text-gray-700">Date de dernière adhésion</label>
|
||||
<input type="date" name="last_subscription_date" id="last_subscription_date" autocomplete="last_subscription_date" placeholder="JJ/MM/AAAA"
|
||||
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
|
||||
x-model="other_properties.last_subscription_date">
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3">
|
||||
<label for="previous_solidarity_transport" class="block text-sm font-medium text-gray-700">Nombre de transports solidaires précédents</label>
|
||||
<input type="text" name="previous solidarity_transport" id="previous_solidarity_transport" placeholder="0"
|
||||
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
|
||||
x-model="other_properties.previous_solidarity_transport">
|
||||
{{else if eq .type "textarea"}}
|
||||
<textarea id="{{.name}}" name="{{.name}}" rows="3" x-model="other_properties.{{.name}}"
|
||||
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm border-gray-300 rounded-2xl"></textarea>
|
||||
{{else if eq .type "date"}}
|
||||
<input type="date" id="{{.name}}" name="{{.name}}" x-model="other_properties.{{.name}}"
|
||||
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm border-gray-300 rounded-2xl">
|
||||
{{else if eq .type "number"}}
|
||||
<input type="number" id="{{.name}}" name="{{.name}}" x-model="other_properties.{{.name}}"
|
||||
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm border-gray-300 rounded-2xl">
|
||||
{{else}}
|
||||
<input type="text" id="{{.name}}" name="{{.name}}" x-model="other_properties.{{.name}}"
|
||||
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm border-gray-300 rounded-2xl">
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="col-span-6 sm:col-span-3">
|
||||
<label for="comment" class="block text-sm font-medium text-gray-700">Commentaire</label>
|
||||
<textarea name="comment" id="comment"
|
||||
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
|
||||
x-model="other_properties.comment"></textarea>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- <div class="col-span-3 sm:col-span-3">
|
||||
<label class="block text-sm font-medium text-gray-700"> Photo </label>
|
||||
<div class="mt-1 flex items-center space-x-5">
|
||||
<span class="inline-block h-12 w-12 rounded-co overflow-hidden bg-gray-100">
|
||||
{{.IconSet.Icon "img:profile-picture-placeholder" "h-full w-full"}}
|
||||
</span>
|
||||
<button type="button"
|
||||
class="bg-white py-2 px-3 border border-gray-300 rounded-2xl shadow-sm text-sm leading-4 font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-co-blue">
|
||||
Charger la photo
|
||||
</button>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bg-white shadow px-4 py-5 sm:rounded-lg sm:p-6">
|
||||
<div class="md:grid md:grid-cols-3 md:gap-6">
|
||||
<div class="md:col-span-1">
|
||||
<h3 class="text-lg font-medium leading-6 text-gray-900">Paramètres</h3>
|
||||
<p class="mt-1 text-sm text-gray-500">Paramètres liés au bénéficiaire, utiles pour exploiter les fonctionnalités de PARCOURSMOB</p>
|
||||
</div>
|
||||
<div class="mt-5 space-y-6 md:mt-0 md:col-span-2">
|
||||
|
||||
{{ $fieldName := "address" }}
|
||||
{{if .ViewState.Data.address}}
|
||||
{{$default := .ViewState.Data.address}}
|
||||
{{ template "address" dict "FieldName" $fieldName "Default" $default}}
|
||||
{{else}}
|
||||
{{ template "address_autocomplete" dict "FieldName" $fieldName}}
|
||||
{{end}}
|
||||
<!-- will dolater : tags, groups, ... -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-end">
|
||||
<p x-show="! isFormValid" class="px-4 py-2 text-sm text-co-red">Certains champs de sont pas valides.</p>
|
||||
<a href="/app/beneficiaries/{{.ViewState.ID}}">
|
||||
<a href="/app/beneficiaries/{{.ViewState.beneficiary.ID}}">
|
||||
<button type="button"
|
||||
class="bg-white py-2 px-4 border border-gray-300 rounded-2xl shadow-sm text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-co-blue">Annuler</button>
|
||||
</a>
|
||||
|
||||
Reference in New Issue
Block a user