parcoursmob-default-theme/web/layouts/members/update.html

155 lines
8.7 KiB
HTML
Raw Normal View History

2022-12-15 16:11:41 +00:00
{{define "content"}}
2023-02-17 09:53:57 +00:00
{{if eq .UserID .ViewState.ID}}
2022-12-15 16:11:41 +00:00
<div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8">
<h1 class="text-2xl font-semibold text-gray-900">Modifier vos informations</h1>
</div>
<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 }}',
gender: {{.ViewState.Data.gender}}
},
rules: {
first_name: ['required'],
last_name: ['required'],
email: ['required', 'email'],
2023-02-23 08:52:02 +00:00
phone_number: ['regexMatch:^((\\+)33|0)[1-9](\\d{2}){4}$'],
2022-12-15 16:11:41 +00:00
},
2023-02-23 08:52:02 +00:00
2022-12-15 16:11:41 +00:00
formValidation: {
valid: false,
fields: {
first_name: {valid: null},
last_name: {valid: null},
email: {valid: null},
phone_number: {valid: null},
}
},
isFormValid: true,
validate() {
this.formValidation = Iodine.assert(this.fields, this.rules)
},
validateField(field) {
this.formValidation.fields[field] = Iodine.assert(this.fields[field], this.rules[field])
},
submit(event) {
this.validate()
if(!this.formValidation.valid) {
this.isFormValid = false
event.preventDefault()
}
return this.formValidation.valid
}
}">
<form class="space-y-6" method="POST" @submit="submit">
<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">Informations obligatoires</h3>
<p class="mt-1 text-sm text-gray-500">Informations personnelles sur le conseiller obligatoires
pour créer son profil dans PARCOURSMOB</p>
</div>
<div class="mt-5 md:mt-0 md:col-span-2">
<div class="grid grid-cols-6 gap-6">
<div class="col-span-6 sm:col-span-3">
<label for="first_name" class="block text-sm font-medium text-gray-700">Prénom</label>
2022-12-19 14:27:50 +00:00
<input type="text" value="{{.ViewState.Data.first_name}}" name="first_name" id="first_name" autocomplete="given-name"
2022-12-15 16:11:41 +00:00
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
2022-12-19 14:27:50 +00:00
@blur="validateField('first_name')"
2022-12-15 16:11:41 +00:00
:class="formValidation.fields.first_name.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
</div>
<div class="col-span-6 sm:col-span-3">
<label for="last_name" class="block text-sm font-medium text-gray-700">Nom</label>
2022-12-19 14:27:50 +00:00
<input type="text" name="last_name" id="last_name" value="{{.ViewState.Data.last_name}}" autocomplete="family-name"
2022-12-15 16:11:41 +00:00
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
2022-12-19 14:27:50 +00:00
@blur="validateField('last_name')"
2022-12-15 16:11:41 +00:00
:class="formValidation.fields.last_name.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
</div>
<div class="col-span-6 sm:col-span-3">
<label for="email" class="block text-sm font-medium text-gray-700">Email</label>
2022-12-19 14:27:50 +00:00
<input type="text" name="email" id="email" autocomplete="email" value="{{.ViewState.Data.email}}"
2022-12-15 16:11:41 +00:00
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
2022-12-19 14:27:50 +00:00
@blur="validateField('email')"
2022-12-15 16:11:41 +00:00
:class="formValidation.fields.email.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
</div>
<div class="col-span-6 sm:col-span-3">
<label for="phone_number" class="block text-sm font-medium text-gray-700">Numéro de
téléphone</label>
<input type="text" name="phone_number" id="phone_number" autocomplete="phone" placeholder="+33612345678"
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
x-model="fields.phone_number" @blur="validateField('phone_number')"
:class="formValidation.fields.phone_number.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
</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">Informations optionnelles</h3>
<p class="mt-1 text-sm text-gray-500">Autres informations de profil optionnelles</p>
</div>
<div class="mt-5 space-y-6 md:mt-0 md:col-span-2">
<div class="grid grid-cols-6 gap-6">
<div class="col-span-6 sm:col-span-3">
<label for="gender" class="block text-sm font-medium text-gray-700">Genre</label>
<div class="sm:mt-0 sm:col-span-2">
<select id="gender" name="gender" autocomplete="gender" x-model="gender"
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="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>
</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>
2023-01-17 07:26:46 +00:00
<a href="/app/members/{{.ViewState.ID}}">
2022-12-15 16:11:41 +00:00
<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>
<button type="submit"
class="ml-3 inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-2xl text-white bg-co-blue hover:bg-co-blue focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-co-blue">Modifier</button>
</div>
</form>
</div>
2023-02-17 09:53:57 +00:00
{{else}}
<div class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity"></div>
<div class="fixed inset-0 z-10 overflow-y-auto">
<div class="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0">
<div class="relative transform overflow-hidden rounded-lg bg-white px-4 pt-5 pb-4 text-left shadow-xl transition-all sm:my-8 sm:w-full max-w-lg sm:p-6">
<div>
<div class="mx-auto flex h-12 w-12 items-center justify-center rounded-co bg-co-blue text-white">
{{.IconSet.Icon "hero:outline/information-circle" "h-6 w-6"}}
</div>
<div class="mt-3 text-center sm:mt-5">
2023-02-17 16:24:45 +00:00
<h3 class="text-lg font-medium leading-6 text-gray-900" id="modal-title">Vous n'avez pas le droit de modifier ce profil</h3>
2023-02-17 09:53:57 +00:00
</div>
</div>
<div class="flex justify-center items-center mt-5 sm:mt-6 sm:grid sm:grid-flow-row-dense ">
<a href="/app/members/{{.ViewState.ID}}"class="rounded-2xl mt-3 inline-flex w-full justify-center rounded-l-2xl border border-gray-300 bg-white px-4 py-2 text-base font-medium text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-co-blue focus:ring-offset-2 sm:col-start-1 sm:mt-0 sm:text-sm">Annuler</a>
</div>
</div>
</div>
</div>
{{end}}
2022-12-15 16:11:41 +00:00
{{end}}