Booking filters + documents deletion

This commit is contained in:
Arnaud Delcasse 2025-10-13 19:59:48 +02:00
parent c442ef9d92
commit 62a3095f91
9 changed files with 135 additions and 26 deletions

View File

@ -145,6 +145,7 @@ views:
- web/layouts/vehicles_management/overview.html
bookings_list:
files:
- web/layouts/vehicles_management/_partials/booking_filters.html
- web/layouts/vehicles_management/_partials/bookings-list.html
- web/layouts/vehicles_management/bookings-list.html
fleet_add:
@ -359,6 +360,7 @@ views:
- web/layouts/administration/vehicles_stats.html
bookings_list:
files:
- web/layouts/vehicles_management/_partials/booking_filters.html
- web/layouts/administration/_partials/bookings_list.html
- web/layouts/administration/bookings_stats.html
settings:
@ -393,6 +395,7 @@ icons:
svg:
coopgo:parcoursmob/monogram: <svg xmlns="http://www.w3.org/2000/svg" class="%s" viewBox="0 0 61.85 33.58"><defs><style>.cls-1{fill:#ff1300;}.cls-2{fill:#243887;}</style></defs><g id="Calque_2" data-name="Calque 2"><g id="Calque_1-2" data-name="Calque 1"><path class="cls-1" d="M44.978,0C31.337,0,28.1,6.824,27.875,15.505H39.536V9.434a.727.727,0,0,1,1.123-.607L52.6,16.453,40.659,24.08a.729.729,0,0,1-1.123-.608v-6.1H27.865c.075,8.427,1.527,16.213,17.113,16.213,14.867,0,16.872-7.764,16.872-17.032C61.85,7.91,59.894,0,44.978,0Z"/><polygon class="cls-1" points="41.412 21.385 49.133 16.453 41.412 11.521 41.412 21.385"/><path class="cls-2" d="M14.175,11.4l-.019,4.151H26.311a14.781,14.781,0,0,0,.819-5.141C27.046,3.767,22.545,0,14.764,0H1.052A1.147,1.147,0,0,0,0,1.24V31.87a1.149,1.149,0,0,0,1.094,1.239H11.525a1.145,1.145,0,0,0,1.051-1.239V10.41h.758C13.88,10.41,14.175,10.756,14.175,11.4Z"/><path class="cls-2" d="M14.148,17.3l-.015,3.514H18.97A7.521,7.521,0,0,0,25.458,17.3Z"/></g></g></svg>
hero:outline/archive-box: <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="%s"><path stroke-linecap="round" stroke-linejoin="round" d="m20.25 7.5-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5M10 11.25h4M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z" /></svg>
hero:outline/archive-box-x-mark: <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="%s"><path stroke-linecap="round" stroke-linejoin="round" d="m20.25 7.5-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5m6 4.125 2.25 2.25m0 0 2.25 2.25M12 13.875l2.25-2.25M12 13.875l-2.25 2.25M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z" /></svg>
hero:outline/arrow-long-right: <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="%s"><path stroke-linecap="round" stroke-linejoin="round" d="M17.25 8.25 21 12m0 0-3.75 3.75M21 12H3" /></svg>
hero:outline/arrow-path-rounded-square: <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="%s"><path stroke-linecap="round" stroke-linejoin="round" d="M19.5 12c0-1.232-.046-2.453-.138-3.662a4.006 4.006 0 0 0-3.7-3.7 48.678 48.678 0 0 0-7.324 0 4.006 4.006 0 0 0-3.7 3.7c-.017.22-.032.441-.046.662M19.5 12l3-3m-3 3-3-3m-12 3c0 1.232.046 2.453.138 3.662a4.006 4.006 0 0 0 3.7 3.7 48.656 48.656 0 0 0 7.324 0 4.006 4.006 0 0 0 3.7-3.7c.017-.22.032-.441.046-.662M4.5 12l3 3m-3-3-3 3" /></svg>
hero:outline/briefcase: <svg xmlns="http://www.w3.org/2000/svg" class="%s" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M21 13.255A23.931 23.931 0 0112 15c-3.183 0-6.22-.62-9-1.745M16 6V4a2 2 0 00-2-2h-4a2 2 0 00-2 2v2m4 6h.01M5 20h14a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" /></svg>

View File

@ -5,33 +5,29 @@
<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="/exports/fleets/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">
Export
</button>
</a>
<div class="mt-4 sm:mt-0 sm:ml-16 sm:flex-none flex gap-2">
<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">
class="inline-flex items-center justify-center bg-co-blue hover:bg-blue-700 border-co-blue border px-4 py-2 text-white 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">
<a href="/exports/fleets/bookings/all_bookings.xlsx?status={{.ViewState.filters.status}}&date_start={{.ViewState.filters.date_start}}&date_end={{.ViewState.filters.date_end}}">
<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">
class="inline-flex items-center justify-center bg-white hover:bg-gray-50 border-gray-300 border px-4 py-2 text-gray-700 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
Export
</button>
</a> -->
</a>
</div>
</div>
</div>
{{template "vehicle_booking_filters" .}}
{{template "bookings_list" .}}
{{end}}

View File

@ -65,9 +65,20 @@ x-data="{
<td class="px-3 py-3.5 text-sm text-gray-900 lg:table-cell">{{.Metadata.Name}}</td>
<td class="px-3 py-3.5 text-sm text-gray-500 lg:table-cell">{{.LastModified.Format "02/01/2006"}}</td>
<td class="relative py-3.5 pl-3 pr-4 sm:pr-6 text-right text-sm font-medium">
<a href="/app/beneficiaries/{{$.ViewState.beneficiary.ID}}/documents/{{.FileName}}" target="_blank">
<button type="button" class="inline-flex items-center rounded-md border border-gray-300 bg-white px-3 py-2 text-sm font-medium leading-4 text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-co-blue focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-30">Télécharger<span class="sr-only"> le document</span></button>
</a>
<div class="flex gap-2 justify-end">
<a href="/app/beneficiaries/{{$.ViewState.beneficiary.ID}}/documents/{{.FileName}}" target="_blank">
<button type="button" class="inline-flex items-center rounded-md border border-gray-300 bg-white px-3 py-2 text-sm font-medium leading-4 text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-co-blue focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-30">
{{$.IconSet.Icon "hero:outline/document-arrow-down" "h-4 w-4 mr-1"}}
Télécharger<span class="sr-only"> le document</span>
</button>
</a>
<button type="button"
onclick="if(confirm('Êtes-vous sûr de vouloir supprimer ce document ?')) { window.location.href='/app/beneficiaries/{{$.ViewState.beneficiary.ID}}/documents/{{.FileName}}/delete'; }"
class="inline-flex items-center rounded-md border border-transparent bg-co-red px-3 py-2 text-sm font-medium leading-4 text-white shadow-sm hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-co-red focus:ring-offset-2">
{{$.IconSet.Icon "hero:outline/trash" "h-4 w-4 mr-1"}}
Supprimer<span class="sr-only"> le document</span>
</button>
</div>
</td>
</tr>
{{end}}

View File

@ -14,6 +14,15 @@
Exporter
</button>
</a>
{{if .ViewState.Archived}}
<a href="/app/beneficiaries/">
<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/archive-box-x-mark" "h-5 w-5 mr-3"}}
Bénéficiaires actifs
</button>
</a>
{{else}}
<a href="/app/beneficiaries/?archived=true">
<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">
@ -21,6 +30,7 @@
Bénéficiaires archivés
</button>
</a>
{{end}}
<a href="/app/beneficiaries/create">
<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-ci-blue focus:ring-offset-2 sm:w-auto">

View File

@ -65,9 +65,20 @@ x-data="{
<td class="px-3 py-3.5 text-sm text-gray-900 lg:table-cell">{{.Metadata.Name}}</td>
<td class="px-3 py-3.5 text-sm text-gray-500 lg:table-cell">{{.LastModified.Format "02/01/2006"}}</td>
<td class="relative py-3.5 pl-3 pr-4 sm:pr-6 text-right text-sm font-medium">
<a href="/app/organized-carpool/drivers/{{$.ViewState.driver.ID}}/documents/{{.FileName}}" target="_blank">
<button type="button" class="inline-flex items-center rounded-md border border-gray-300 bg-white px-3 py-2 text-sm font-medium leading-4 text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-co-blue focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-30">Télécharger<span class="sr-only"> le document</span></button>
</a>
<div class="flex gap-2 justify-end">
<a href="/app/organized-carpool/drivers/{{$.ViewState.driver.ID}}/documents/{{.FileName}}" target="_blank">
<button type="button" class="inline-flex items-center rounded-md border border-gray-300 bg-white px-3 py-2 text-sm font-medium leading-4 text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-co-blue focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-30">
{{$.IconSet.Icon "hero:outline/document-arrow-down" "h-4 w-4 mr-1"}}
Télécharger<span class="sr-only"> le document</span>
</button>
</a>
<button type="button"
onclick="if(confirm('Êtes-vous sûr de vouloir supprimer ce document ?')) { window.location.href='/app/organized-carpool/drivers/{{$.ViewState.driver.ID}}/documents/{{.FileName}}/delete'; }"
class="inline-flex items-center rounded-md border border-transparent bg-co-red px-3 py-2 text-sm font-medium leading-4 text-white shadow-sm hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-co-red focus:ring-offset-2">
{{$.IconSet.Icon "hero:outline/trash" "h-4 w-4 mr-1"}}
Supprimer<span class="sr-only"> le document</span>
</button>
</div>
</td>
</tr>
{{end}}

View File

@ -66,9 +66,20 @@ x-data="{
<td class="px-3 py-3.5 text-sm text-gray-900 lg:table-cell">{{.Metadata.Name}}</td>
<td class="px-3 py-3.5 text-sm text-gray-500 lg:table-cell">{{.LastModified.Format "02/01/2006"}}</td>
<td class="relative py-3.5 pl-3 pr-4 sm:pr-6 text-right text-sm font-medium">
<a href="/app/solidarity-transport/drivers/{{$.ViewState.driver.ID}}/documents/{{.FileName}}" target="_blank">
<button type="button" class="inline-flex items-center rounded-md border border-gray-300 bg-white px-3 py-2 text-sm font-medium leading-4 text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-co-blue focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-30">Télécharger<span class="sr-only"> le document</span></button>
</a>
<div class="flex gap-2 justify-end">
<a href="/app/solidarity-transport/drivers/{{$.ViewState.driver.ID}}/documents/{{.FileName}}" target="_blank">
<button type="button" class="inline-flex items-center rounded-md border border-gray-300 bg-white px-3 py-2 text-sm font-medium leading-4 text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-co-blue focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-30">
{{$.IconSet.Icon "hero:outline/document-arrow-down" "h-4 w-4 mr-1"}}
Télécharger<span class="sr-only"> le document</span>
</button>
</a>
<button type="button"
onclick="if(confirm('Êtes-vous sûr de vouloir supprimer ce document ?')) { window.location.href='/app/solidarity-transport/drivers/{{$.ViewState.driver.ID}}/documents/{{.FileName}}/delete'; }"
class="inline-flex items-center rounded-md border border-transparent bg-co-red px-3 py-2 text-sm font-medium leading-4 text-white shadow-sm hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-co-red focus:ring-offset-2">
{{$.IconSet.Icon "hero:outline/trash" "h-4 w-4 mr-1"}}
Supprimer<span class="sr-only"> le document</span>
</button>
</div>
</td>
</tr>
{{end}}

View File

@ -0,0 +1,41 @@
{{ define "vehicle_booking_filters" }}
<div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8">
<form>
<div class="flex flex-row justify-end flex-wrap">
<div class="m-4">
<div>
<label for="vehicles_date_start" class="block text-sm/6 font-medium text-gray-900 dark:text-white">Dates (début / fin)</label>
<div class="mt-2 flex">
<input id="vehicles_date_start" type="date" name="date_start" class="block w-full rounded-md bg-white px-3 py-1.5 text-base text-gray-900 outline-1 -outline-offset-1 outline-gray-300 placeholder:text-gray-400 focus:outline-2 focus:-outline-offset-2 focus:outline-indigo-600 sm:text-sm/6 dark:bg-white/5 dark:text-white dark:outline-white/10 dark:placeholder:text-gray-500 dark:focus:outline-co-blue" value="{{.ViewState.filters.date_start}}" onchange="this.form.submit()" />
<input id="vehicles_date_end" type="date" name="date_end" class="mx-2 block w-full rounded-md bg-white px-3 py-1.5 text-base text-gray-900 outline-1 -outline-offset-1 outline-gray-300 placeholder:text-gray-400 focus:outline-2 focus:-outline-offset-2 focus:outline-indigo-600 sm:text-sm/6 dark:bg-white/5 dark:text-white dark:outline-white/10 dark:placeholder:text-gray-500 dark:focus:outline-co-blue" value="{{.ViewState.filters.date_end}}" onchange="this.form.submit()" />
</div>
</div>
</div>
<div class="m-4">
<label for="vehicles_status" class="block text-sm/6 font-medium text-gray-900 dark:text-white">Statut</label>
<div class="mt-2 grid grid-cols-1">
<select id="vehicles_status" name="status" class="col-start-1 row-start-1 w-full appearance-none rounded-md bg-white py-1.5 pr-8 pl-3 text-base text-gray-900 outline-1 -outline-offset-1 outline-gray-300 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-indigo-600 sm:text-sm/6 dark:bg-white/5 dark:text-white dark:outline-white/10 dark:*:bg-gray-800 dark:focus-visible:outline-co-blue" onchange="this.form.submit()">
<option></option>
<option value="FORTHCOMING"{{if eq .ViewState.filters.status "FORTHCOMING"}} selected{{end}}>A venir</option>
<option value="ONGOING"{{if eq .ViewState.filters.status "ONGOING"}} selected{{end}}>En cours</option>
<option value="TERMINATED"{{if eq .ViewState.filters.status "TERMINATED"}} selected{{end}}>Terminé</option>
<option value="CANCELLED"{{if eq .ViewState.filters.status "CANCELLED"}} selected{{end}}>Annulé</option>
</select>
<svg viewBox="0 0 16 16" fill="currentColor" data-slot="icon" aria-hidden="true" class="pointer-events-none col-start-1 row-start-1 mr-2 size-5 self-center justify-self-end text-gray-500 sm:size-4 dark:text-gray-400">
<path d="M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06Z" clip-rule="evenodd" fill-rule="evenodd" />
</svg>
</div>
</div>
<div class="m-4">
</div>
</div>
</form>
</div>
{{ end }}

View File

@ -5,11 +5,11 @@
<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="/exports/fleets/bookings">
<a href="/exports/fleets/bookings/group_bookings.xlsx?status={{.ViewState.filters.status}}&date_start={{.ViewState.filters.date_start}}&date_end={{.ViewState.filters.date_end}}">
<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"}}
@ -20,6 +20,8 @@
</div>
</div>
{{template "vehicle_booking_filters" .}}
{{template "bookings_list" .}}
{{end}}
{{end}}

View File

@ -6,9 +6,11 @@
"Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
"Courier New", monospace;
--color-red-50: oklch(0.971 0.013 17.38);
--color-red-100: oklch(0.936 0.032 17.717);
--color-red-500: oklch(0.637 0.237 25.331);
--color-red-600: oklch(0.577 0.245 27.325);
--color-red-700: oklch(0.505 0.213 27.518);
--color-red-800: oklch(0.444 0.177 26.899);
--color-red-900: oklch(0.396 0.141 25.723);
--color-orange-50: oklch(0.98 0.016 73.684);
@ -2552,6 +2554,9 @@
.text-red-600 {
color: var(--color-red-600);
}
.text-red-700 {
color: var(--color-red-700);
}
.text-red-800 {
color: var(--color-red-800);
}
@ -3207,6 +3212,20 @@
}
}
}
.hover\:bg-red-50 {
&:hover {
@media (hover: hover) {
background-color: var(--color-red-50);
}
}
}
.hover\:bg-red-700 {
&:hover {
@media (hover: hover) {
background-color: var(--color-red-700);
}
}
}
.hover\:bg-white {
&:hover {
@media (hover: hover) {
@ -3362,6 +3381,11 @@
--tw-ring-color: var(--color-indigo-500);
}
}
.focus\:ring-red-500 {
&:focus {
--tw-ring-color: var(--color-red-500);
}
}
.focus\:ring-white {
&:focus {
--tw-ring-color: var(--color-white);