add 'statut' on vehicles-list template

This commit is contained in:
Nicolas CARON 2023-02-23 16:46:38 +01:00
parent e43e23353a
commit 70ad96a4e8
1 changed files with 38 additions and 0 deletions

View File

@ -1,4 +1,13 @@
{{define "vehicles_list"}} {{define "vehicles_list"}}
{{range $.ViewState.bookings}}
{{.Vehicleid}}
<br>
{{end}}
<br>
{{range $.ViewState.vehicles}}
{{.ID}}
<br>
{{end}}
<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">
<div class="mt-8 flex flex-col"> <div class="mt-8 flex flex-col">
<div class="-my-2 -mx-4 overflow-x-auto sm:-mx-6 lg:-mx-8"> <div class="-my-2 -mx-4 overflow-x-auto sm:-mx-6 lg:-mx-8">
@ -7,6 +16,10 @@
<table class="min-w-full divide-y divide-gray-300"> <table class="min-w-full divide-y divide-gray-300">
<thead class="bg-gray-50"> <thead class="bg-gray-50">
<tr> <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
</th>
<th scope="col" <th scope="col"
class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6"> class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">
Numéro (Immat / Bicycode) Numéro (Immat / Bicycode)
@ -28,6 +41,31 @@
<tbody class="divide-y divide-gray-200 bg-white"> <tbody class="divide-y divide-gray-200 bg-white">
{{range .ViewState.vehicles}} {{range .ViewState.vehicles}}
<tr> <tr>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6 text-center">
{{range $.ViewState.bookings}}
{{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 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}}
{{end}}
</td>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6"> <td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
<div class="text-gray-900" >{{.Data.licence_plate}}</div> <div class="text-gray-900" >{{.Data.licence_plate}}</div>
</td> </td>