add vehicles status in stat

This commit is contained in:
soukainna 2023-03-06 10:22:25 +01:00
parent 511baa6a8e
commit a36827a6ff
1 changed files with 36 additions and 7 deletions

View File

@ -51,6 +51,7 @@
</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">
@ -58,8 +59,28 @@
<span class="mt-1 p-1 bg-gray-500 text-white text-xs font-bold rounded-xl" >
Disponible
</span>
{{else}}
{{range .Bookings}}
{{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é
@ -73,13 +94,21 @@
<span class="mt-1 p-1 bg-co-green text-white text-xs font-bold rounded-xl" >
En cours
</span>
{{else}}
<span class="mt-1 p-1 bg-gray-500 text-white text-xs font-bold rounded-xl" >
Disponible
</span>
{{end}}
{{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>