Compare commits
8 Commits
18e2517805
...
8778f88fbd
Author | SHA1 | Date |
---|---|---|
soukainna | 8778f88fbd | |
soukainna | 3aba9e0071 | |
soukainna | 560af60f32 | |
soukainna | 4789c5a49e | |
soukainna | b480747b86 | |
soukainna | 5617646bdb | |
soukainna | 4c05d570f7 | |
soukainna | 11e377ddb3 |
|
@ -43,6 +43,12 @@ views:
|
||||||
list:
|
list:
|
||||||
files:
|
files:
|
||||||
- web/layouts/members/membersList.html
|
- web/layouts/members/membersList.html
|
||||||
|
group:
|
||||||
|
settings:
|
||||||
|
files:
|
||||||
|
- web/layouts/administration/_partials/groups_admins.html
|
||||||
|
- web/layouts/administration/_partials/group_members.html
|
||||||
|
- web/layouts/group/settings.html
|
||||||
vehicles:
|
vehicles:
|
||||||
search:
|
search:
|
||||||
files:
|
files:
|
||||||
|
@ -78,6 +84,7 @@ views:
|
||||||
fleet_update:
|
fleet_update:
|
||||||
files:
|
files:
|
||||||
- web/layouts/_partials/address_autocomplete.html
|
- web/layouts/_partials/address_autocomplete.html
|
||||||
|
- web/layouts/agenda/_partials/address.html
|
||||||
- web/layouts/vehicles_management/_partials/vehicle-type-select.html
|
- web/layouts/vehicles_management/_partials/vehicle-type-select.html
|
||||||
- web/layouts/vehicles_management/fleet-update.html
|
- web/layouts/vehicles_management/fleet-update.html
|
||||||
booking_display:
|
booking_display:
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
{{define "content"}}
|
{{define "content"}}
|
||||||
|
|
||||||
<div x-data="{dialog: false}">
|
<div x-data="{dialog: false}">
|
||||||
<main class="py-10">
|
<main class="py-10">
|
||||||
<div class="max-w-3xl mx-auto px-4 sm:px-6 md:flex md:items-center md:justify-between md:space-x-5 lg:max-w-7xl lg:px-8">
|
<div class="max-w-3xl mx-auto px-4 sm:px-6 md:flex md:items-center md:justify-between md:space-x-5 lg:max-w-7xl lg:px-8">
|
||||||
|
@ -13,11 +14,12 @@
|
||||||
<h1 class="text-2xl font-bold text-gray-900">{{.ViewState.vehicle.Data.name}}</h1>
|
<h1 class="text-2xl font-bold text-gray-900">{{.ViewState.vehicle.Data.name}}</h1>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{{ if eq (index .ViewState.vehicle.Administrators 0) .Group.ID }}
|
||||||
<div class="mt-6 flex flex-col-reverse justify-stretch space-y-4 space-y-reverse sm:flex-row-reverse sm:justify-end sm:space-x-reverse sm:space-y-0 sm:space-x-3 md:mt-0 md:flex-row md:space-x-3">
|
<div class="mt-6 flex flex-col-reverse justify-stretch space-y-4 space-y-reverse sm:flex-row-reverse sm:justify-end sm:space-x-reverse sm:space-y-0 sm:space-x-3 md:mt-0 md:flex-row md:space-x-3">
|
||||||
|
<a href="/app/vehicles-management/fleet/{{.ViewState.vehicle.ID}}/update" class="inline-flex"><button type="button"
|
||||||
|
class="w-full px-4 py-2 border border-transparent text-sm font-medium rounded-2xl shadow-sm text-white bg-co-blue hover:bg-co-blue focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-100 focus:ring-co-blue">Modifier</button></a> {{end}}
|
||||||
<button type="button" @click="dialog = !dialog"
|
<button type="button" @click="dialog = !dialog"
|
||||||
class="inline-flex items-center justify-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-2xl text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-100 focus:ring-co-blue">Retirer de la flotte</button>
|
class="inline-flex items-center justify-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-2xl text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-100 focus:ring-co-blue">Retirer de la flotte</button>
|
||||||
<!-- <a href="/app/vehicles-management/fleet/{{.ViewState.vehicle.ID}}/update" class="inline-flex"><button type="button"
|
|
||||||
class="w-full px-4 py-2 border border-transparent text-sm font-medium rounded-2xl shadow-sm text-white bg-co-blue hover:bg-co-blue focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-100 focus:ring-co-blue">Modifier</button></a> -->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-8 max-w-3xl mx-auto grid grid-cols-1 gap-6 sm:px-6 lg:max-w-7xl lg:grid-flow-col-dense lg:grid-cols-3">
|
<div class="mt-8 max-w-3xl mx-auto grid grid-cols-1 gap-6 sm:px-6 lg:max-w-7xl lg:grid-flow-col-dense lg:grid-cols-3">
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
{{define "content"}}
|
{{define "content"}}
|
||||||
|
|
||||||
|
{{ if eq (index .ViewState.vehicle.Administrators 0) .Group.ID }}
|
||||||
|
|
||||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8">
|
<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 un véhicule</h1>
|
<h1 class="text-2xl font-semibold text-gray-900">Modifier le véhicule</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8 mt-8" x-data="{
|
<div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8 mt-8" x-data="{
|
||||||
fields: {
|
fields: {
|
||||||
licence_plate: '{{ .ViewState.vehicle.Data.licence_plate }}',
|
licence_plate: '{{ .ViewState.vehicle.Data.licence_plate }}',
|
||||||
name: '{{ .ViewState.vehicle.Data.name }}',
|
name: '{{ .ViewState.vehicle.Data.name }}',
|
||||||
|
type: '{{ .ViewState.vehicle.Type }}',
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
licence_plate: ['required', 'regexMatch:^[A-Z]{1,2}-[0-9]{1,3}-[A-Z]{1,2}$'],
|
licence_plate: ['required'], // 'regexMatch:^[A-Z]{1,2}-[0-9]{1,3}-[A-Z]{1,2}$'
|
||||||
name: ['required'],
|
name: ['required'],
|
||||||
|
type: ['required'],
|
||||||
},
|
},
|
||||||
formValidation: {
|
formValidation: {
|
||||||
valid: false,
|
valid: false,
|
||||||
fields: {
|
fields: {
|
||||||
name: {valid: null},
|
name: {valid: null},
|
||||||
licence_plate: {valid: null},
|
licence_plate: {valid: null},
|
||||||
|
type: {valid: null},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isFormValid: true,
|
isFormValid: true,
|
||||||
|
@ -35,6 +39,10 @@
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
}
|
}
|
||||||
return this.formValidation.valid
|
return this.formValidation.valid
|
||||||
|
},
|
||||||
|
|
||||||
|
displayAutomatic(type) {
|
||||||
|
return type == 'Voiture'
|
||||||
}
|
}
|
||||||
}">
|
}">
|
||||||
<form class="space-y-6" method="POST" @submit="submit">
|
<form class="space-y-6" method="POST" @submit="submit">
|
||||||
|
@ -47,19 +55,44 @@
|
||||||
<div class="mt-5 md:mt-0 md:col-span-2">
|
<div class="mt-5 md:mt-0 md:col-span-2">
|
||||||
<div class="grid grid-cols-3 md:grid-cols-6 gap-6">
|
<div class="grid grid-cols-3 md:grid-cols-6 gap-6">
|
||||||
<div class="col-span-5">
|
<div class="col-span-5">
|
||||||
<label for="name" class="block text-sm font-medium text-gray-700">Modèle (ou nom donné au
|
<label for="name" class="block text-sm font-medium text-gray-700">Modèle (ou nom donné au véhicule)</label>
|
||||||
véhicule)</label>
|
|
||||||
<input type="text" name="name" id="name"
|
<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"
|
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')"
|
x-model="fields.name" @blur="validateField('name')"
|
||||||
:class="formValidation.fields.name.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
|
:class="formValidation.fields.name.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-span-3">
|
<div class="col-span-3">
|
||||||
{{template "vehicle_type_select" .}}
|
<label for="type" class="block text-sm font-medium text-gray-700">Type de véhicule</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.vehicle_types}}
|
||||||
|
<option value="{{.}}">{{.}}</option>
|
||||||
|
{{end}}
|
||||||
|
</select>
|
||||||
|
<div class="m-4" x-show="displayAutomatic(fields.type)">
|
||||||
|
<legend class="sr-only">Automatique</legend>
|
||||||
|
<div class="relative flex items-start">
|
||||||
|
<div class="flex h-5 items-center">
|
||||||
|
{{if .ViewState.vehicle.Data.automatic}}
|
||||||
|
<input id="automatic" aria-describedby="automatic-description" name="automatic" type="checkbox" checked class="h-4 w-4 rounded border-gray-300 text-co-blue focus:ring-co-blue">
|
||||||
|
{{else}}
|
||||||
|
<input id="automatic" aria-describedby="automatic-description" name="automatic" type="checkbox" class="h-4 w-4 rounded border-gray-300 text-co-blue focus:ring-co-blue">
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
<div class="ml-3 text-sm">
|
||||||
|
<label for="automatic" class="font-medium text-gray-700">Automatique</label>
|
||||||
|
<p id="automatic-description" class="text-gray-500">Ce véhicule a une boite automatique.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-span-3">
|
<div class="col-span-3">
|
||||||
<label for="licence_plate"
|
<label for="licence_plate"
|
||||||
class="block text-sm font-medium text-gray-700">Immatriculation</label>
|
class="block text-sm font-medium text-gray-700">Numéro (Immat, Bicycode, ...)</label>
|
||||||
<input type="text" name="licence_plate" id="licence_plate" placeholder="XX-123-YY"
|
<input type="text" name="licence_plate" id="licence_plate" placeholder="XX-123-YY"
|
||||||
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
|
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
|
||||||
x-model="fields.licence_plate"
|
x-model="fields.licence_plate"
|
||||||
|
@ -78,13 +111,18 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-5 md:mt-0 md:col-span-2">
|
<div class="mt-5 md:mt-0 md:col-span-2">
|
||||||
{{ $fieldName := "address" }}
|
{{ $fieldName := "address" }}
|
||||||
{{ template "address_autocomplete" (dict "FieldName" $fieldName "Address" .ViewState.vehicle.Data.address) }}
|
{{if .ViewState.vehicle.Data.address}}
|
||||||
|
{{$default := .ViewState.vehicle.Data.address}}
|
||||||
|
{{ template "address" dict "FieldName" $fieldName "Default" $default}}
|
||||||
|
{{else}}
|
||||||
|
{{ template "address_autocomplete" dict "FieldName" $fieldName}}
|
||||||
|
{{end}}
|
||||||
|
|
||||||
<div class="mt-5">
|
<div class="mt-5">
|
||||||
<label for="informations" class="block text-sm font-medium text-gray-700">Informations pratiques pour le bénéficiaire</label>
|
<label for="informations" class="block text-sm font-medium text-gray-700">Informations pratiques</label>
|
||||||
<div class="mt-1">
|
<div class="mt-1">
|
||||||
<textarea rows="4" name="informations" id="informations"
|
<textarea rows="4" name="informations" id="informations" value="{{.ViewState.vehicle.Data.informations}}"
|
||||||
class="shadow-sm focus:ring-co-blue focus:border-co-blue block w-full sm:text-sm border-gray-300 rounded-2xl"></textarea>
|
class="shadow-sm focus:ring-co-blue focus:border-co-blue block w-full sm:text-sm border-gray-300 rounded-2xl">{{ if .ViewState.vehicle.Data.informations}}{{.ViewState.vehicle.Data.informations}}{{end}}</textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -103,4 +141,26 @@
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
{{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">
|
||||||
|
<h3 class="text-lg font-medium leading-6 text-gray-900" id="modal-title">Vous n'avez pas le droit de modifier ce véhicule</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex justify-center items-center mt-5 sm:mt-6 sm:grid sm:grid-flow-row-dense ">
|
||||||
|
<a href="/app/vehicles-management/fleet/{{.ViewState.vehicle.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}}
|
||||||
{{end}}
|
{{end}}
|
Loading…
Reference in New Issue