2022-11-08 16:17:41 +00:00
|
|
|
{{define "content"}}
|
|
|
|
|
|
|
|
|
|
|
|
<div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8">
|
|
|
|
<h1 class="text-2xl font-semibold text-gray-900">Groups > Créer un group</h1>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8 mt-8" x-data="{
|
|
|
|
fields: {
|
|
|
|
name: null,
|
|
|
|
type: null,
|
2022-11-10 15:44:48 +00:00
|
|
|
description: null,
|
2022-11-08 16:17:41 +00:00
|
|
|
},
|
|
|
|
rules: {
|
|
|
|
name: ['required'],
|
|
|
|
type: ['required'],
|
|
|
|
},
|
|
|
|
formValidation: {
|
|
|
|
valid: false,
|
|
|
|
fields: {
|
|
|
|
name: {valid: null},
|
|
|
|
type: {valid: null},
|
2022-11-10 15:44:48 +00:00
|
|
|
description: {valid: null},
|
2022-11-08 16:17:41 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
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">Nouveau groupe</h3>
|
|
|
|
<p class="mt-1 text-sm text-gray-500">Informations de base sur le groupe à créer</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-5">
|
|
|
|
<label for="name" class="block text-sm font-medium text-gray-700">Nom de groupe</label>
|
|
|
|
<input type="text" name="name" id="name"
|
|
|
|
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
|
|
|
|
x-model="fields.name" @blur="validateField('name')"
|
|
|
|
:class="formValidation.fields.name.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
|
|
|
|
</div>
|
|
|
|
<div class="col-span-3">
|
|
|
|
<label for="type" class="block text-sm font-medium text-gray-700">Type de groupe</label>
|
|
|
|
<select id="type" name="type"
|
|
|
|
x-model="fields.type" @blur="validateField('type')"
|
|
|
|
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 rounded-2xl"
|
|
|
|
:class="formValidation.fields.type.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
|
|
|
|
<option value="" selected></option>
|
|
|
|
{{range .ViewState.group_types}}
|
|
|
|
<option value="{{.}}">{{.}}</option>
|
|
|
|
{{end}}
|
|
|
|
</select>
|
|
|
|
</div>
|
2022-11-10 15:44:48 +00:00
|
|
|
<div class="col-span-6">
|
|
|
|
<label for="description" class="block text-sm font-medium text-gray-700">Description</label>
|
|
|
|
<div class="mt-1">
|
|
|
|
<textarea rows="4" name="description" id="descrpition"
|
|
|
|
x-model="fields.description" @blur="validateField('description')"
|
|
|
|
:class="formValidation.fields.description.valid == false ? 'border-co-red border-2' : 'border-gray-300'"
|
|
|
|
class="shadow-sm focus:ring-co-blue focus:border-co-blue block w-full sm:text-sm border-gray-300 rounded-2xl"></textarea>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-11-08 16:17:41 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
2022-11-10 15:44:48 +00:00
|
|
|
<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 groupe, 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" }}
|
|
|
|
{{ template "address_autocomplete" dict "FieldName" $fieldName }}
|
|
|
|
|
|
|
|
<!-- will dolater : tags, groups, ... -->
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-11-08 16:17:41 +00:00
|
|
|
<div class="flex justify-end">
|
|
|
|
<a href="/app/group_module/">
|
|
|
|
<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">Créer le groupe</button>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
{{end}}
|