feat: extra properties dynamiques, filtrage meta_status et alertes retard
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
{{ define "vehicle_booking_filters" }}
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8">
|
||||
<div class="px-4 sm:px-6 md:px-8">
|
||||
<form>
|
||||
|
||||
<input type="hidden" name="tab" value="bookings" />
|
||||
{{if .ViewState.filters.v_type}}<input type="hidden" name="v_type" value="{{.ViewState.filters.v_type}}" />{{end}}
|
||||
{{if .ViewState.filters.v_status}}<input type="hidden" name="v_status" value="{{.ViewState.filters.v_status}}" />{{end}}
|
||||
|
||||
<div class="flex flex-row justify-end flex-wrap">
|
||||
|
||||
{{if not .ViewState.hide_date_filters}}
|
||||
<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>
|
||||
@@ -13,16 +18,40 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
{{if .ViewState.vehicle_types}}
|
||||
<div class="m-4">
|
||||
<label for="vehicles_vehicle_type" class="block text-sm/6 font-medium text-gray-900 dark:text-white">Type de véhicule</label>
|
||||
<div class="mt-2 grid grid-cols-1">
|
||||
<select id="vehicles_vehicle_type" name="vehicle_type" 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>
|
||||
{{range .ViewState.vehicle_types}}
|
||||
<option value="{{.}}"{{if eq $.ViewState.filters.vehicle_type .}} selected{{end}}>{{.}}</option>
|
||||
{{end}}
|
||||
</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>
|
||||
{{end}}
|
||||
|
||||
<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="">Tous</option>
|
||||
{{if eq .ViewState.status_management "manual"}}
|
||||
<optgroup label="Par catégorie">
|
||||
<option value="meta:open,active"{{if eq $.ViewState.filters.status "meta:open,active"}} selected{{end}}>Actifs ({{$first := true}}{{range $.ViewState.status_options}}{{$ms := index . "meta_status"}}{{if or (eq $ms "open") (eq $ms "active")}}{{if not $first}}, {{end}}{{$first = false}}{{index . "label"}}{{end}}{{end}})</option>
|
||||
<option value="meta:closed"{{if eq $.ViewState.filters.status "meta:closed"}} selected{{end}}>Clôturés ({{$first := true}}{{range $.ViewState.status_options}}{{$ms := index . "meta_status"}}{{if eq $ms "closed"}}{{if not $first}}, {{end}}{{$first = false}}{{index . "label"}}{{end}}{{end}})</option>
|
||||
</optgroup>
|
||||
<optgroup label="Par statut">
|
||||
{{range .ViewState.status_options}}
|
||||
<option value="{{index . "name"}}"{{if eq $.ViewState.filters.status (index . "name")}} selected{{end}}>{{index . "label"}}</option>
|
||||
<option value="{{index . "name"}}"{{if eq $.ViewState.filters.status (index . "name")}} selected{{end}}>{{index . "label"}}</option>
|
||||
{{end}}
|
||||
</optgroup>
|
||||
{{else}}
|
||||
<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>
|
||||
@@ -36,10 +65,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="m-4">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
@@ -1,120 +1,125 @@
|
||||
{{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 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 (Immat / Bicycode)
|
||||
</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 and (eq $.ViewState.status_management "manual") (not .Deleted)}}
|
||||
{{$manualStatus := .ManualStatus}}
|
||||
{{range $.ViewState.status_options}}
|
||||
{{if eq (index . "name") $manualStatus}}
|
||||
{{if eq (index . "meta_status") "open"}}
|
||||
<span class="p-1 px-2 text-xs bg-co-blue text-white font-bold rounded-xl">{{index . "label"}}</span>
|
||||
{{else if eq (index . "meta_status") "active"}}
|
||||
<span class="p-1 px-2 text-xs bg-co-green text-white font-bold rounded-xl">{{index . "label"}}</span>
|
||||
{{else if eq (index . "meta_status") "closed"}}
|
||||
<span class="p-1 px-2 text-xs bg-co-red text-white font-bold rounded-xl">{{index . "label"}}</span>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{else if .Deleted}}
|
||||
<span class="p-1 bg-black text-white text-xs font-bold rounded-xl" >
|
||||
Annulé
|
||||
</span>
|
||||
{{else}}
|
||||
{{if eq .Status 1 }}
|
||||
<span class="p-1 bg-co-blue text-white text-xs font-bold rounded-xl" >
|
||||
A venir
|
||||
</span>
|
||||
{{end}}
|
||||
{{if eq .Status 0 }}
|
||||
<span class="p-1 bg-co-green text-white text-xs font-bold rounded-xl" >
|
||||
En 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">
|
||||
{{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="">-->
|
||||
{{ (index $.ViewState.drivers_map .Driver).Data.first_name }}
|
||||
{{ (index $.ViewState.drivers_map .Driver).Data.last_name }}
|
||||
</div>
|
||||
{{end}}
|
||||
</td>
|
||||
<td class="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"}} au {{(timeFrom .Unavailableto).Format "02/01/2006"}}</div>
|
||||
{{else}}
|
||||
<div class="text-gray-900" >
|
||||
<div>Du {{(timeFrom .Startdate).Format "02/01/2006 à 15:04"}}</div>
|
||||
<div>au {{(timeFrom .Enddate).Format "02/01/2006 à 15:04"}}</div>
|
||||
</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>
|
||||
<table class="min-w-full divide-y divide-gray-300 border-gray-300 border-t-1">
|
||||
<thead class="bg-gray-50">
|
||||
<tr>
|
||||
<th scope="col"
|
||||
class="py-3.5 pl-4 pr-3 text-center text-sm font-semibold text-gray-900 sm:pl-6">
|
||||
Statut
|
||||
</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-center text-sm font-semibold text-gray-900 sm:pl-6">
|
||||
Type
|
||||
</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-center text-sm font-semibold text-gray-900 sm:pl-6">
|
||||
Numéro (Immat / Bicycode)
|
||||
</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-center text-sm font-semibold text-gray-900 sm:pl-6">
|
||||
Beneficiaire
|
||||
</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-center text-sm font-semibold text-gray-900 sm:pl-6">
|
||||
Dates
|
||||
</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-center text-sm font-semibold text-gray-900 sm:pl-6">
|
||||
</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 and (eq $.ViewState.status_management "manual") (not .Deleted)}}
|
||||
{{$manualStatus := .ManualStatus}}
|
||||
{{range $.ViewState.status_options}}
|
||||
{{if eq (index . "name") $manualStatus}}
|
||||
{{if eq (index . "meta_status") "open"}}
|
||||
<span class="p-1 px-2 text-xs bg-co-blue text-white font-bold rounded-xl">{{index . "label"}}</span>
|
||||
{{else if eq (index . "meta_status") "active"}}
|
||||
<span class="p-1 px-2 text-xs bg-co-green text-white font-bold rounded-xl">{{index . "label"}}</span>
|
||||
{{else if eq (index . "meta_status") "closed"}}
|
||||
<span class="p-1 px-2 text-xs bg-co-red text-white font-bold rounded-xl">{{index . "label"}}</span>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{else if .Deleted}}
|
||||
<span class="p-1 bg-black text-white text-xs font-bold rounded-xl" >
|
||||
Annulé
|
||||
</span>
|
||||
{{else}}
|
||||
{{if eq .Status 1 }}
|
||||
<span class="p-1 bg-co-blue text-white text-xs font-bold rounded-xl" >
|
||||
A venir
|
||||
</span>
|
||||
{{end}}
|
||||
{{if eq .Status 0 }}
|
||||
<span class="p-1 bg-co-green text-white text-xs font-bold rounded-xl" >
|
||||
En 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">
|
||||
{{if .Data.administrator_unavailability}}
|
||||
<div class="text-gray-900" ></div>
|
||||
{{else}}
|
||||
<div class="text-gray-900" >
|
||||
{{ (index $.ViewState.drivers_map .Driver).Data.first_name }}
|
||||
{{ (index $.ViewState.drivers_map .Driver).Data.last_name }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</td>
|
||||
<td class="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"}} au {{(timeFrom .Unavailableto).Format "02/01/2006"}}</div>
|
||||
{{else}}
|
||||
<div class="text-gray-900" >
|
||||
<div>Du {{(timeFrom .Startdate).Format "02/01/2006 à 15:04"}}</div>
|
||||
<div>au {{(timeFrom .Enddate).Format "02/01/2006 à 15:04"}}</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</td>
|
||||
<td class="py-4 pl-4 pr-3 text-sm sm:pl-6 text-center">
|
||||
{{if and (eq $.ViewState.status_management "manual") (not .Data.administrator_unavailability) (not .Deleted)}}
|
||||
{{$manualStatus := .ManualStatus}}
|
||||
{{$startdate := .Startdate}}
|
||||
{{$enddate := .Enddate}}
|
||||
{{range $.ViewState.status_options}}
|
||||
{{if eq (index . "name") $manualStatus}}
|
||||
{{if and (eq (index . "meta_status") "open") (isPast $startdate)}}
|
||||
<span class="text-red-600" title="Retard : la date de début de réservation est dépassée">
|
||||
{{$.IconSet.Icon "hero:outline/exclamation-triangle" "h-6 w-6 inline-block"}}
|
||||
</span>
|
||||
{{else if and (eq (index . "meta_status") "active") (isPast $enddate)}}
|
||||
<span class="text-red-600" title="Retard : la date de fin de réservation est dépassée">
|
||||
{{$.IconSet.Icon "hero:outline/exclamation-triangle" "h-6 w-6 inline-block"}}
|
||||
</span>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
</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>
|
||||
{{end}}
|
||||
|
||||
@@ -1,124 +1,95 @@
|
||||
{{define "vehicles_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 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">
|
||||
Statut Réservation
|
||||
</th>
|
||||
<th scope="col"
|
||||
class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">
|
||||
Numéro (Immat / Bicycode)
|
||||
</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">
|
||||
Modèle
|
||||
</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:pl-6">
|
||||
Lieu
|
||||
</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.vehicles}}
|
||||
<tr>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6 text-center">
|
||||
<div class="flex flex-col px-6">
|
||||
{{if not .Bookings}}
|
||||
<span class="mt-1 p-1 bg-gray-500 text-white text-xs font-bold rounded-xl" >
|
||||
Disponible
|
||||
</span>
|
||||
{{else if len .Bookings | eq 1}}
|
||||
{{range .Bookings}}
|
||||
{{if .Data.administrator_unavailability}}
|
||||
<span class="mt-1 p-1 bg-black text-white text-xs font-bold rounded-xl" >
|
||||
Retiré
|
||||
</span>
|
||||
{{else if eq .Status -1 }}
|
||||
<span class="mt-1 p-1 bg-gray-500 text-white text-xs font-bold rounded-xl" >
|
||||
Disponible
|
||||
</span>
|
||||
{{else if eq .Status 1 }}
|
||||
<span class="mt-1 p-1 bg-co-blue text-white text-xs font-bold rounded-xl" >
|
||||
A venir
|
||||
</span>
|
||||
{{else if eq .Status 0 }}
|
||||
<span class="mt-1 p-1 bg-co-green text-white text-xs font-bold rounded-xl" >
|
||||
En cours
|
||||
</span>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{else if gt (len .Bookings) 1}}
|
||||
{{range .Bookings}}
|
||||
{{if .Data.administrator_unavailability}}
|
||||
<span class="mt-1 p-1 bg-black text-white text-xs font-bold rounded-xl" >
|
||||
Retiré
|
||||
</span>
|
||||
{{else}}
|
||||
{{if eq .Status 1 }}
|
||||
<span class="mt-1 p-1 bg-co-blue text-white text-xs font-bold rounded-xl" >
|
||||
A venir
|
||||
</span>
|
||||
{{else if eq .Status 0 }}
|
||||
<span class="mt-1 p-1 bg-co-green text-white text-xs font-bold rounded-xl" >
|
||||
En cours
|
||||
</span>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{$allAvailable := true}}
|
||||
{{range .Bookings}}
|
||||
{{if ne .Status -1}}
|
||||
{{ $allAvailable = false }}
|
||||
{{break}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{if $allAvailable}}
|
||||
<span class="mt-1 p-1 bg-gray-500 text-white text-xs font-bold rounded-xl" >
|
||||
Disponible
|
||||
</span>
|
||||
{{end}}
|
||||
{{end}}
|
||||
</div>
|
||||
</td>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
|
||||
<div class="text-gray-900" >{{.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" >
|
||||
{{.Type}}
|
||||
{{if eq .Type "Voiture"}}
|
||||
{{ if .Data.automatic}} (boite auto){{ end }}
|
||||
{{end}}
|
||||
</div>
|
||||
</td>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
|
||||
<div class="text-gray-900" >{{.Data.name}}</div>
|
||||
</td>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
|
||||
<div class="text-gray-900" >{{if .Data.address}}{{.Data.address.properties.label}}{{end}}</div>
|
||||
</td>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
|
||||
<a href="/app/vehicles-management/fleet/{{.ID}}"
|
||||
class="text-co-blue hover:text-co-blue">Voir</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="min-w-full divide-y divide-gray-300 border-gray-300 border-t-1">
|
||||
<thead class="bg-gray-50">
|
||||
<tr>
|
||||
<th scope="col"
|
||||
class="py-3.5 pl-4 pr-3 text-center text-sm font-semibold text-gray-900 sm:pl-6">
|
||||
Disponibilité
|
||||
</th>
|
||||
<th scope="col"
|
||||
class="py-3.5 pl-4 pr-3 text-center text-sm font-semibold text-gray-900 sm:pl-6">
|
||||
Numéro (Immat / Bicycode)
|
||||
</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-center text-sm font-semibold text-gray-900 sm:pl-6">
|
||||
Type
|
||||
</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-center text-sm font-semibold text-gray-900 sm:pl-6">
|
||||
Modèle
|
||||
</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-center text-sm font-semibold text-gray-900 sm:pl-6">
|
||||
Lieu
|
||||
</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.vehicles}}
|
||||
<tr>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6 text-center">
|
||||
<div class="flex flex-col px-6">
|
||||
{{if not .Bookings}}
|
||||
<span class="mt-1 p-1 bg-co-green text-white text-xs font-bold rounded-xl">
|
||||
Disponible
|
||||
</span>
|
||||
{{else}}
|
||||
{{$hasActive := false}}
|
||||
{{$hasUpcoming := false}}
|
||||
{{$hasRetired := false}}
|
||||
{{range .Bookings}}
|
||||
{{if .Data.administrator_unavailability}}
|
||||
{{$hasRetired = true}}
|
||||
{{else if eq .Status 0}}
|
||||
{{$hasActive = true}}
|
||||
{{else if eq .Status 1}}
|
||||
{{$hasUpcoming = true}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{if $hasRetired}}
|
||||
<span class="mt-1 p-1 bg-black text-white text-xs font-bold rounded-xl">
|
||||
Retiré
|
||||
</span>
|
||||
{{end}}
|
||||
{{if $hasActive}}
|
||||
<span class="mt-1 p-1 bg-co-red text-white text-xs font-bold rounded-xl">
|
||||
En prêt
|
||||
</span>
|
||||
{{else if $hasUpcoming}}
|
||||
<span class="mt-1 p-1 bg-co-blue text-white text-xs font-bold rounded-xl">
|
||||
Réservé
|
||||
</span>
|
||||
{{else if not $hasRetired}}
|
||||
<span class="mt-1 p-1 bg-co-green text-white text-xs font-bold rounded-xl">
|
||||
Disponible
|
||||
</span>
|
||||
{{end}}
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
|
||||
<div class="text-gray-900" >{{.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" >
|
||||
{{.Type}}
|
||||
{{if eq .Type "Voiture"}}
|
||||
{{ if .Data.automatic}} (boite auto){{ end }}
|
||||
{{end}}
|
||||
</div>
|
||||
</td>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
|
||||
<div class="text-gray-900" >{{.Data.name}}</div>
|
||||
</td>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
|
||||
<div class="text-gray-900" >{{if .Data.address}}{{.Data.address.properties.label}}{{end}}</div>
|
||||
</td>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
|
||||
<a href="/app/vehicles-management/fleet/{{.ID}}"
|
||||
class="text-co-blue hover:text-co-blue">Voir</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{end}}
|
||||
|
||||
Reference in New Issue
Block a user