Compare commits

...

2 Commits

Author SHA1 Message Date
Arnaud Delcasse 0ecee50d1c Merge branch 'main' into spie06 2023-04-12 10:55:41 +02:00
Arnaud Delcasse 39e770bb09 Bookings list in admin 2023-04-12 10:52:29 +02:00
8 changed files with 185 additions and 24 deletions

View File

@ -184,6 +184,10 @@ views:
vehicles_list:
files:
- web/layouts/administration/vehicles_stats.html
bookings_list:
files:
- web/layouts/administration/_partials/bookings_list.html
- web/layouts/administration/bookings_stats.html
settings:
files:
- web/layouts/administration/_partials/groups_admins.html

View File

@ -0,0 +1,115 @@
{{define "bookings_list"}}
<div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8">
<div class="mt-8 flex flex-col">
<div class="-my-2 -mx-4 overflow-x-auto sm:-mx-6 lg:-mx-8">
<div class="inline-block min-w-full py-2 align-middle md:px-6 lg:px-8">
<div class="overflow-hidden shadow ring-1 ring-black ring-opacity-5 md:rounded-lg">
<table class="min-w-full divide-y divide-gray-300">
<thead class="bg-gray-50">
<tr>
<th scope="col"
class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6 text-center">
Statut
</th>
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:pl-6">
Type
</th>
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:pl-6">
Numéro
</th>
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:pl-6">
Gestionnaire véhicule
</th>
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:pl-6">
Prescripteur
</th>
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:pl-6">
Beneficiaire
</th>
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:pl-6">
Dates
</th>
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:pl-6">
Commentaire
</th>
<th scope="col" class="relative py-3.5 pl-3 pr-4 sm:pr-6">
<span class="sr-only">Actions</span>
</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200 bg-white">
{{range .ViewState.bookings}}
<tr>
<td class="flex-col py-4 pl-4 pr-3 text-sm sm:pl-6 text-center">
{{if .Data.administrator_unavailability}}
<span class="p-1 bg-black text-white text-xs font-bold rounded-xl" >
Retiré
</span>
{{else}}
{{if eq .Status 1 }}
<span class="p-1 bg-co-blue text-white text-xs font-bold rounded-xl" >
A&nbsp;venir
</span>
{{end}}
{{if eq .Status 0 }}
<span class="p-1 bg-co-green text-white text-xs font-bold rounded-xl" >
En&nbsp;cours
</span>
{{end}}
{{if eq .Status -1 }}
<span class="p-1 bg-co-red text-white text-xs font-bold rounded-xl" >
Terminé
</span>
{{end}}
{{end}}
</td>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
<div class="text-gray-900" >{{ (index $.ViewState.vehicles_map .Vehicleid).Type }}</div>
</td>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
<div class="text-gray-900" >{{ (index $.ViewState.vehicles_map .Vehicleid).Data.licence_plate }}</div>
</td>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
<div class="text-gray-900" >{{ (index $.ViewState.admingroups (index (index $.ViewState.vehicles_map .Vehicleid).Administrators 0)).Data.name }}</div>
</td>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
<div class="text-gray-900" >{{ .Data.booked_by.group.name }}<br />({{ .Data.booked_by.user.display_name }})</div>
</td>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
{{if .Data.administrator_unavailability}}
<div class="text-gray-900" ></div>
{{else}}
<div class="text-gray-900" >
<!-- <img class="h-6 w-6 rounded-co" src="/app/beneficiaries/{{.Driver}}/picture" alt=""> -->
{{$b := (index $.ViewState.beneficiaries_map .Driver)}}
{{$b.Data.first_name}} {{$b.Data.last_name}} <br />
{{$b.Data.file_number}}
</div>
{{end}}
</td>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
{{if .Data.administrator_unavailability}}
<div class="text-gray-900" >Retiré du {{(timeFrom .Unavailablefrom).Format "02/01/2006"}} <br />
au {{(timeFrom .Unavailableto).Format "02/01/2006"}}</div>
{{else}}
<div class="text-gray-900" >Du {{(timeFrom .Startdate).Format "02/01/2006"}} <br />
au {{(timeFrom .Enddate).Format "02/01/2006"}}</div>
{{end}}
</td>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
<div class="text-gray-900" >{{ .Data.comment }}</div>
</td>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
<a href="/app/vehicles-management/bookings/{{.ID}}"
class="text-co-blue hover:text-co-blue">Voir</a>
</td>
</tr>
{{end}}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
{{end}}

View File

@ -0,0 +1,31 @@
{{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">Historique des réservations de véhicules</h1>
<div class="sm:flex sm:items-center">
<div class="sm:flex-auto">
</div>
<div class="mt-4 sm:mt-0 sm:ml-16 sm:flex-none">
<a href="/app/administration/stats/vehicles">
<button type="button"
class="inline-flex items-center justify-center bg-white hover:bg-gray-50 border-gray-300 border px-4 py-2 text-gray-700 flex items-center text-sm rounded-2xl focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-co-blue">
{{$.IconSet.Icon "hero:outline/document-arrow-left" "h-5 w-5 mr-3"}}
Liste des véhicules
</button>
</a>
<!-- <a href="/api/cache/{{.ViewState.cacheid}}/export">
<button type="button"
class="inline-flex items-center justify-center bg-white hover:bg-gray-50 border-gray-300 border px-4 py-2 text-gray-700 flex items-center text-sm rounded-2xl focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-co-blue">
{{$.IconSet.Icon "hero:outline/document-arrow-down" "h-5 w-5 mr-3"}}
Exporter
</button>
</a> -->
</div>
</div>
</div>
{{template "bookings_list" .}}
{{end}}

View File

@ -2,14 +2,18 @@
<div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8">
<div class="sm:flex sm:items-center">
<div class="sm:flex-auto">
<h1 class="text-2xl font-semibold text-gray-900">La liste des voitures</h1>
<h1 class="text-2xl font-semibold text-gray-900">Liste des véhicules</h1>
</div>
<div class="mt-4 sm:mt-0 sm:ml-16 sm:flex-none">
<a href="/app/administration/">
<button type="button"
class="inline-flex items-center justify-center rounded-2xl border border-transparent bg-co-blue px-4 py-2 text-sm font-medium text-white shadow-sm focus:outline-none focus:ring-2 focus:ring-co-blue focus:ring-offset-2 sm:w-auto">
Retour
</button>
<a href="/app/administration/stats/bookings">
<button type="button"
class="inline-flex items-center justify-center bg-white hover:bg-gray-50 border-gray-300 border px-4 py-2 text-gray-700 flex items-center text-sm rounded-2xl focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-co-blue">
{{$.IconSet.Icon "hero:outline/document-arrow-left" "h-5 w-5 mr-3"}}
Liste des réservations
</button>
</a>
</a>
</div>
</div>

View File

@ -20,7 +20,7 @@
email: ['required', 'email'],
phone_number: ['required', 'regexMatch:^((\\+)33|0)[1-9](\\d{2}){4}$'],
birthdate: ['required'],
file_number: ['optional'],
file_number: ['required'],
},
formValidation: {
valid: false,
@ -100,6 +100,13 @@
x-model="fields.birthdate" @blur="validateField('birthdate')"
:class="formValidation.fields.birthdate.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
</div>
<div class="col-span-6 sm:col-span-3">
<label for="file_number" class="block text-sm font-medium text-gray-700">Numéro de dossier (CAF / Pole Emploi ...)</label>
<input type="text" name="file_number" id="file_number" placeholder=""
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
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>
</div>
</div>
</div>
@ -114,14 +121,6 @@
<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="file_number" class="block text-sm font-medium text-gray-700">Numéro de dossier (allocataire, ...)</label>
<input type="text" name="file_number" id="file_number" placeholder=""
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
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>
<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">

View File

@ -69,6 +69,12 @@
<dd class="mt-1 text-sm text-gray-900">{{.ViewState.beneficiary.Data.address.properties.label}}</dd>
</div>
{{end}}
{{if .ViewState.beneficiary.Data.file_number}}
<div class="sm:col-span-1">
<dt class="text-sm font-medium text-gray-500">Numéro de dossier (CAF / Pole emploi)</dt>
<dd class="mt-1 text-sm text-gray-900">{{.ViewState.beneficiary.Data.file_number}}</dd>
</div>
{{end}}
</dl>
</div>
</div>

View File

@ -21,7 +21,7 @@
email: ['required', 'email'],
phone_number: ['required', 'regexMatch:^((\\+)33|0)[1-9](\\d{2}){4}$'],
birthdate: ['required'],
file_number: ['optional'],
file_number: ['required'],
},
formValidation: {
valid: false,
@ -101,6 +101,15 @@
x-model="fields.birthdate" @blur="validateField('birthdate')"
:class="formValidation.fields.birthdate.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
</div>
<div class="col-span-6 sm:col-span-3">
<label for="file_number" class="block text-sm font-medium text-gray-700">Numéro de dossier (CAF / Pole Emploi ...)</label>
<input type="text" name="file_number" id="file_number"
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
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>
</div>
</div>
</div>
@ -114,15 +123,6 @@
</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="file_number" class="block text-sm font-medium text-gray-700">Numéro de dossier (allocataire, ...)</label>
<input type="text" name="file_number" id="file_number"
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
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>
<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">

View File

@ -10,6 +10,7 @@
</div>
<ul role="list" class="divide-y divide-gray-200 flex-1">
{{range .}}
{{if eq .Deleted false}}
<li class="py-2 px-4 flex">
<a href="/app/agenda/{{.ID}}" class="flex w-full">
<div class="ml-3">
@ -18,6 +19,7 @@
</a>
</li>
{{end}}
{{end}}
</ul>
<a href="/app/agenda/">