Initial commit

This commit is contained in:
2022-11-06 18:19:13 +01:00
commit 7512f2e5ee
69 changed files with 11111 additions and 0 deletions

View File

@@ -0,0 +1,77 @@
{{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 (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="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="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6 text-center">
{{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}}
</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" ><img class="h-6 w-6 rounded-co"
src="/app/beneficiaries/{{.Driver}}/picture" alt=""></div>
</td>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
<div class="text-gray-900" >Du {{(timeFrom .Startdate).Format "02/01/2006"}} au {{(timeFrom .Enddate).Format "02/01/2006"}}</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,259 @@
{{define "calendar"}}
<div class="flex items-center">
<h2 class="flex-auto font-semibold text-gray-900">Août 2022</h2>
<button type="button"
class="-my-1.5 flex flex-none items-center justify-center p-1.5 text-gray-400 hover:text-gray-500">
<span class="sr-only">Mois précédent</span>
<!-- Heroicon name: solid/chevron-left -->
<svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor"
aria-hidden="true">
<path fill-rule="evenodd"
d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z"
clip-rule="evenodd" />
</svg>
</button>
<button type="button"
class="-my-1.5 -mr-1.5 ml-2 flex flex-none items-center justify-center p-1.5 text-gray-400 hover:text-gray-500">
<span class="sr-only">Mois suivant</span>
<!-- Heroicon name: solid/chevron-right -->
<svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor"
aria-hidden="true">
<path fill-rule="evenodd"
d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z"
clip-rule="evenodd" />
</svg>
</button>
</div>
<div class="mt-10 grid grid-cols-7 text-center text-xs leading-6 text-gray-500">
<div>L</div>
<div>M</div>
<div>M</div>
<div>J</div>
<div>V</div>
<div>S</div>
<div>D</div>
</div>
<div class="mt-2 grid grid-cols-7 text-sm">
<div class="py-2">
<!--
Always include: "mx-auto flex h-8 w-8 items-center justify-center rounded-full"
Is selected, include: "text-white"
Is not selected and is today, include: "text-indigo-600"
Is not selected and is not today and is current month, include: "text-gray-900"
Is not selected and is not today and is not current month, include: "text-gray-400"
Is selected and is today, include: "bg-indigo-600"
Is selected and is not today, include: "bg-gray-900"
Is not selected, include: "hover:bg-gray-200"
Is selected or is today, include: "font-semibold"
-->
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-900 hover:bg-gray-200">
<time datetime="2022-08-01">1</time>
</button>
</div>
<div class="py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-900 hover:bg-gray-200">
<time datetime="2022-08-02">2</time>
</button>
</div>
<div class="py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-900 hover:bg-gray-200">
<time datetime="2022-08-03">3</time>
</button>
</div>
<div class="py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-900 hover:bg-gray-200">
<time datetime="2022-08-04">4</time>
</button>
</div>
<div class="py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-900 hover:bg-gray-200">
<time datetime="2022-08-05">5</time>
</button>
</div>
<div class="py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-900 hover:bg-gray-200">
<time datetime="2022-08-06">6</time>
</button>
</div>
<div class="py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-900 hover:bg-gray-200">
<time datetime="2022-08-07">7</time>
</button>
</div>
<div class="border-t border-gray-200 py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-900 hover:bg-gray-200">
<time datetime="2022-08-08">8</time>
</button>
</div>
<div class="border-t border-gray-200 py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-900 hover:bg-gray-200">
<time datetime="2022-08-09">9</time>
</button>
</div>
<div class="border-t border-gray-200 py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-900 hover:bg-gray-200">
<time datetime="2022-08-10">10</time>
</button>
</div>
<div class="border-t border-gray-200 py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-900 hover:bg-gray-200">
<time datetime="2022-08-11">11</time>
</button>
</div>
<div class="border-t border-gray-200 py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full bg-gray-900 font-semibold text-white">
<time datetime="2022-08-12">12</time>
</button>
</div>
<div class="border-t border-gray-200 py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-900 hover:bg-gray-200">
<time datetime="2022-08-13">13</time>
</button>
</div>
<div class="border-t border-gray-200 py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-900 hover:bg-gray-200">
<time datetime="2022-08-14">14</time>
</button>
</div>
<div class="border-t border-gray-200 py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-900 hover:bg-gray-200">
<time datetime="2022-08-15">15</time>
</button>
</div>
<div class="border-t border-gray-200 py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-900 hover:bg-gray-200">
<time datetime="2022-08-16">16</time>
</button>
</div>
<div class="border-t border-gray-200 py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-900 hover:bg-gray-200">
<time datetime="2022-08-17">17</time>
</button>
</div>
<div class="border-t border-gray-200 py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-900 hover:bg-gray-200">
<time datetime="2022-08-18">18</time>
</button>
</div>
<div class="border-t border-gray-200 py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-900 hover:bg-gray-200">
<time datetime="2022-08-19">19</time>
</button>
</div>
<div class="border-t border-gray-200 py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-900 hover:bg-gray-200">
<time datetime="2022-08-20">20</time>
</button>
</div>
<div class="border-t border-gray-200 py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-900 hover:bg-gray-200">
<time datetime="2022-08-21">21</time>
</button>
</div>
<div class="border-t border-gray-200 py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-900 hover:bg-gray-200">
<time datetime="2022-08-22">22</time>
</button>
</div>
<div class="border-t border-gray-200 py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-900 hover:bg-gray-200">
<time datetime="2022-08-23">23</time>
</button>
</div>
<div class="border-t border-gray-200 py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-900 hover:bg-gray-200">
<time datetime="2022-08-24">24</time>
</button>
</div>
<div class="border-t border-gray-200 py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-900 hover:bg-gray-200">
<time datetime="2022-08-25">25</time>
</button>
</div>
<div class="border-t border-gray-200 py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-900 hover:bg-gray-200">
<time datetime="2022-08-26">26</time>
</button>
</div>
<div class="border-t border-gray-200 py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-900 hover:bg-gray-200">
<time datetime="2022-08-27">27</time>
</button>
</div>
<div class="border-t border-gray-200 py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-900 hover:bg-gray-200">
<time datetime="2022-08-28">28</time>
</button>
</div>
<div class="border-t border-gray-200 py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-900 hover:bg-gray-200">
<time datetime="2022-08-29">29</time>
</button>
</div>
<div class="border-t border-gray-200 py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-900 hover:bg-gray-200">
<time datetime="2022-08-30">30</time>
</button>
</div>
<div class="border-t border-gray-200 py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-900 hover:bg-gray-200">
<time datetime="2022-08-31">31</time>
</button>
</div>
<div class="border-t border-gray-200 py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-400 hover:bg-gray-200">
<time datetime="2022-09-01">1</time>
</button>
</div>
<div class="border-t border-gray-200 py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-400 hover:bg-gray-200">
<time datetime="2022-09-02">2</time>
</button>
</div>
<div class="border-t border-gray-200 py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-400 hover:bg-gray-200">
<time datetime="2022-09-03">3</time>
</button>
</div>
<div class="border-t border-gray-200 py-2">
<button type="button"
class="mx-auto flex h-8 w-8 items-center justify-center rounded-full text-gray-400 hover:bg-gray-200">
<time datetime="2022-09-04">4</time>
</button>
</div>
</div>
{{end}}

View File

@@ -0,0 +1,105 @@
{{define "vehicle_type_select"}}
<div x-data="{
selectOpen: false,
vehicle_type: 'car',
vehicle_label: 'Voiture',
selectType(type, label) {
this.vehicle_type = type,
this.vehicle_label = label
this.selectOpen = false
}
}">
<input type="hidden" name="vehicle_type" x-model="vehicle_type">
<label id="listbox-label" class="block text-sm font-medium text-gray-700"> Type de véhicule </label>
<div class="mt-1 relative">
<button @click="selectOpen = ! selectOpen" type="button"
class="relative w-full bg-white border border-gray-300 rounded-2xl shadow-sm pl-3 pr-10 py-2 text-left cursor-default focus:outline-none focus:ring-1 focus:ring-co-blue focus:border-co-blue sm:text-sm"
aria-haspopup="listbox" aria-expanded="true" aria-labelledby="listbox-label">
<span class="block truncate" x-text="vehicle_label"></span>
<span class="absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none">
{{$.IconSet.Icon "hero:solid/selector" "h-5 w-5 text-gray-400"}}
</span>
</button>
<ul class="absolute z-10 mt-1 w-full bg-white shadow-lg max-h-60 rounded-xl py-1 text-base ring-1 ring-black ring-opacity-5 overflow-auto focus:outline-none sm:text-sm"
tabindex="-1" role="listbox" aria-labelledby="listbox-label" aria-activedescendant="listbox-option-3"
x-show="selectOpen" x-transition:leave="transition ease-in duration-100"
x-transition:leave-start="transform opacity-100" x-transition:leave-end="transform opacity-0">
<li class="text-gray-900 cursor-default select-none relative py-2 pl-8 pr-4 hover:bg-co-blue hover:text-white" id="listbox-option-0"
role="option" @click="selectType('car', 'Voiture')">
<!-- Selected: "font-semibold", Not Selected: "font-normal" -->
<span class="font-normal block truncate "> Voiture </span>
<span x-show="vehicle_type == 'car'"
class="text-co-blue absolute inset-y-0 left-0 flex items-center pl-1.5">
<svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor"
aria-hidden="true">
<path fill-rule="evenodd"
d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
clip-rule="evenodd" />
</svg>
</span>
</li>
<li class="text-gray-900 cursor-default select-none relative py-2 pl-8 pr-4 hover:bg-co-blue hover:text-white" id="listbox-option-0"
role="option" @click="selectType('no_licence_car', 'Voiture sans permis')">
<!-- Selected: "font-semibold", Not Selected: "font-normal" -->
<span class="font-normal block truncate "> Voiture sans permis </span>
<span x-show="vehicle_type == 'no_licence_car'"
class="text-co-blue absolute inset-y-0 left-0 flex items-center pl-1.5">
<svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor"
aria-hidden="true">
<path fill-rule="evenodd"
d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
clip-rule="evenodd" />
</svg>
</span>
</li>
<li class="text-gray-900 cursor-default select-none relative py-2 pl-8 pr-4 hover:bg-co-blue hover:text-white" id="listbox-option-0"
role="option" @click="selectType('scooter', 'Scooter')">
<!-- Selected: "font-semibold", Not Selected: "font-normal" -->
<span class="font-normal block truncate "> Scooter </span>
<span x-show="vehicle_type == 'scooter'"
class="text-co-blue absolute inset-y-0 left-0 flex items-center pl-1.5">
<svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor"
aria-hidden="true">
<path fill-rule="evenodd"
d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
clip-rule="evenodd" />
</svg>
</span>
</li>
<li class="text-gray-900 cursor-default select-none relative py-2 pl-8 pr-4 hover:bg-co-blue hover:text-white" id="listbox-option-0"
role="option" @click="selectType('trott', 'Trotinette')">
<!-- Selected: "font-semibold", Not Selected: "font-normal" -->
<span class="font-normal block truncate "> Trotinette </span>
<span x-show="vehicle_type == 'trott'"
class="text-co-blue absolute inset-y-0 left-0 flex items-center pl-1.5">
<svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor"
aria-hidden="true">
<path fill-rule="evenodd"
d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
clip-rule="evenodd" />
</svg>
</span>
</li>
<li class="text-gray-900 cursor-default select-none relative py-2 pl-8 pr-4 hover:bg-co-blue hover:text-white" id="listbox-option-0"
role="option" @click="selectType('electric_bike', 'Vélo électrique')">
<!-- Selected: "font-semibold", Not Selected: "font-normal" -->
<span class="font-normal block truncate "> Vélo électrique </span>
<span x-show="vehicle_type == 'electric_bike'"
class="text-co-blue hover:text-inherit absolute inset-y-0 left-0 flex items-center pl-1.5">
<svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor"
aria-hidden="true">
<path fill-rule="evenodd"
d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
clip-rule="evenodd" />
</svg>
</span>
</li>
<!-- More items... -->
</ul>
</div>
</div>
{{end}}

View File

@@ -0,0 +1,56 @@
{{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 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">
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">
<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" >{{if eq .Type "electric_bike"}}Vélo électrique{{else}}Voiture{{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>
</div>
</div>
</div>
</div>
</div>
{{end}}

View File

@@ -0,0 +1,276 @@
{{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">Réservation de véhicule</h1>
<div class="sm:flex sm:items-center">
<div class="sm:flex-auto">
<p class="mt-2 text-sm text-gray-700"></p>
</div>
<!-- <div class="mt-4 sm:mt-0 sm:ml-16 sm:flex-none">
<button type="button"
class="inline-flex items-center justify-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-2xl text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-100 focus:ring-co-blue">
Changer de véhicule
</button>
<a href="/app/vehicles-management/bookings/{{.ViewState.booking.ID}}/delete">
<button type="button"
class="inline-flex items-center justify-center rounded-2xl border border-transparent bg-co-red px-4 py-2 text-sm font-medium text-white shadow-sm focus:outline-none focus:ring-2 focus:ring-co-red focus:ring-offset-2 sm:w-auto">
Annuler
</button>
</a>
</div> -->
</div>
<div class="mt-8 max-w-3xl mx-auto grid grid-cols-1 gap-6 lg:max-w-7xl lg:grid-flow-col-dense lg:grid-cols-3">
<div class="space-y-6 lg:col-start-1 lg:col-span-1">
<div class="bg-white shadow sm:rounded-2xl">
<h2 id="timeline-title" class="text-lg font-medium text-gray-900 p-4 sm:px-6">Bénéficiaire</h2>
<div class="border-t border-gray-200 px-4 py-5 sm:px-6">
<div>
<div class="mt-5 border-gray-200">
<dl class="sm:divide-y sm:divide-gray-200">
<div class="sm:pb-5 sm:grid sm:grid-cols-3 sm:gap-4">
<dt class="text-sm font-medium text-gray-500">Nom</dt>
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
{{.ViewState.beneficiary.Data.first_name}}
{{.ViewState.beneficiary.Data.last_name}}</dd>
</div>
<div class="py-4 sm:py-5 sm:grid sm:grid-cols-3 sm:gap-4">
<dt class="text-sm font-medium text-gray-500">Email</dt>
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
{{.ViewState.beneficiary.Data.email}}</dd>
</div>
<div class="py-4 sm:py-5 sm:grid sm:grid-cols-3 sm:gap-4">
<dt class="text-sm font-medium text-gray-500">Téléphone</dt>
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
{{.ViewState.beneficiary.Data.phone_number}}</dd>
</div>
{{if .ViewState.Data.birthdate}}
<div class="py-4 sm:py-5 sm:grid sm:grid-cols-3 sm:gap-4">
<dt class="text-sm font-medium text-gray-500">Date de naissance</dt>
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">{{(timeFrom
.ViewState.Data.birthdate).Format
"02/01/2006"}}</dd>
</div>
{{end}}
{{if and .ViewState.Data.gender (ne .ViewState.Data.gender "0")}}
<div class="py-4 sm:py-5 sm:grid sm:grid-cols-3 sm:gap-4">
<dt class="text-sm font-medium text-gray-500">Date de naissance</dt>
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">{{genderISO5218
.ViewState.Data.gender}}</dd>
</div>
{{end}}
{{if .ViewState.Data.address}}
<div class="py-4 sm:py-5 sm:grid sm:grid-cols-3 sm:gap-4">
<dt class="text-sm font-medium text-gray-500">Adresse</dt>
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
{{.ViewState.Data.address.properties.label}}
</dd>
</div>
{{end}}
</dl>
</div>
</div>
</div>
</div>
</div>
<div class="lg:col-start-2 lg:col-span-2">
<div class="bg-white shadow sm:rounded-2xl sm:px-6">
<div class="bg-white px-4 py-5 border-b border-gray-200 sm:px-6">
<div class="-ml-4 -mt-4 flex justify-between items-center flex-wrap sm:flex-nowrap">
<div class="ml-4 mt-4">
<h3 class="text-lg leading-6 font-medium text-gray-900">Réservation</h3>
<p class="mt-1 text-sm text-gray-500">Informations utiles sur la réservation.</p>
</div>
<div class="ml-4 mt-4 flex-shrink-0">
<button type="button"
class="relative inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-xs font-medium rounded-2xl text-co-blue bg-gray-100 hover:bg-co-blue hover:text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-co-blue">SMS</button>
<button type="button"
class="relative inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-xs font-medium rounded-2xl text-co-blue bg-gray-100 hover:bg-co-blue hover:text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-co-blue">Email</button>
<!-- <button type="button"
class="relative inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-xs font-medium rounded-2xl text-co-blue bg-gray-100 hover:bg-co-blue hover:text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-co-blue">Imprimer</button> -->
</div>
</div>
</div>
<div class="px-4 py-5 sm:px-6">
<div>
<div class="mt-5 border-gray-200">
<dl class="sm:divide-y sm:divide-gray-200">
<!-- <div class="sm:pb-5 sm:grid sm:grid-cols-3 sm:gap-4">
<dt class="text-sm font-medium text-gray-500">Gestionnaire</dt>
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
COOPGO
</dd>
</div> -->
{{if .ViewState.booking.Data.booked_by}}
<!-- <div class="py-4 sm:py-5 sm:grid sm:grid-cols-3 sm:gap-4"> -->
<div class="sm:pb-5 sm:grid sm:grid-cols-3 sm:gap-4">
<dt class="text-sm font-medium text-gray-500">Prescripteur</dt>
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
{{if .ViewState.booking.Data.booked_by.user}}
<a href="/app/members/{{.ViewState.booking.Data.booked_by.user.id}}" class="flex inline">
<img class="h-5 w-5 rounded-co mr-1"
src="/app/members/{{.ViewState.booking.Data.booked_by.user.id}}/picture" alt="">
{{.ViewState.booking.Data.booked_by.user.display_name}}
</a>
{{end}}
{{if .ViewState.booking.Data.booked_by.group}}{{.ViewState.booking.Data.booked_by.group.name}}{{end}}
</dd>
</div>
{{end}}
<div class="py-4 sm:py-5 sm:grid sm:grid-cols-3 sm:gap-4">
<dt class="text-sm font-medium text-gray-500">Véhicule</dt>
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
{{.ViewState.vehicle.Data.name}}</dd>
</div>
<div class="py-4 sm:py-5 sm:grid sm:grid-cols-3 sm:gap-4">
<dt class="text-sm font-medium text-gray-500">Immatriculation</dt>
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
{{.ViewState.vehicle.Data.licence_plate}}</dd>
</div>
<div class="py-4 sm:py-5 sm:grid sm:grid-cols-3 sm:gap-4">
<dt class="text-sm font-medium text-gray-500">Type</dt>
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
Voiture</dd>
</div>
{{if .ViewState.vehicle.Data.address}}
<div class="py-4 sm:py-5 sm:grid sm:grid-cols-3 sm:gap-4">
<dt class="text-sm font-medium text-gray-500">Lieu de récupération</dt>
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">{{.ViewState.vehicle.Data.address.properties.label}}</dd>
</div>
{{end}}
<div class="py-4 sm:py-5 sm:grid sm:grid-cols-3 sm:gap-4">
<dt class="text-sm font-medium text-gray-500">Date de récupération</dt>
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2 inline-flex"
x-data="{ updateOpen: false }">
<div class="w-full inline-flex" x-show="!updateOpen">
<div class="flex-1">{{(timeFrom .ViewState.booking.Startdate).Format "02/01/2006"}}</div>
<a href="#" class="text-co-blue hover:text-co-blue ml-5" @click="updateOpen = ! updateOpen">Modifier</a>
</div>
<form method="POST" class="inline-flex" x-show="updateOpen">
<div class="flex-1">
<input type="date" name="startdate" value="{{(timeFrom .ViewState.booking.Startdate).Format "2006-01-02"}}"
class="shadow-sm focus:ring-co-blue focus:border-co-blue block sm:text-sm border-gray-300 rounded-2xl">
</div>
<button
class=" justify-center text-co-blue px-4">
OK
</button>
</form>
</dd>
</div>
<div class="py-4 sm:py-5 sm:grid sm:grid-cols-3 sm:gap-4">
<dt class="text-sm font-medium text-gray-500">Date de retour</dt>
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2"
x-data="{ updateOpen: false }">
<div class="w-full inline-flex" x-show="!updateOpen">
<div class="flex-1">{{(timeFrom .ViewState.booking.Enddate).Format "02/01/2006"}}</div>
<a href="#" class="text-co-blue hover:text-co-blue ml-5" @click="updateOpen = ! updateOpen">Modifier</a>
</div>
<form method="POST" class="inline-flex" x-show="updateOpen">
<div class="flex-1">
<input type="date" name="enddate" value="{{(timeFrom .ViewState.booking.Enddate).Format "2006-01-02"}}"
class="shadow-sm focus:ring-co-blue focus:border-co-blue block sm:text-sm border-gray-300 rounded-2xl">
</div>
<button
class=" justify-center text-co-blue px-4">
OK
</button>
</form>
</dd>
</div>
<div class="py-4 sm:py-5 sm:grid sm:grid-cols-3 sm:gap-4">
<dt class="text-sm font-medium text-gray-500">Indisponible à partir du</dt>
<dd class="mt-1 text-sm font-bold text-co-red sm:mt-0 sm:col-span-2 inline-flex"
x-data="{ updateOpen: false }">
<div class="w-full inline-flex" x-show="!updateOpen">
<div class="flex-1">{{(timeFrom .ViewState.booking.Unavailablefrom).Format "02/01/2006"}}</div>
<a href="#" class="text-co-blue hover:text-co-blue ml-5" @click="updateOpen = ! updateOpen">Modifier</a>
</div>
<form method="POST" class="inline-flex" x-show="updateOpen">
<div class="flex-1">
<input type="date" name="unavailablefrom" value="{{(timeFrom .ViewState.booking.Unavailablefrom).Format "2006-01-02"}}"
class="shadow-sm focus:ring-co-blue focus:border-co-blue block sm:text-sm border-gray-300 rounded-2xl">
</div>
<button
class=" justify-center text-co-blue px-4">
OK
</button>
</form>
</dd>
</div>
<div class="py-4 sm:py-5 sm:grid sm:grid-cols-3 sm:gap-4">
<dt class="text-sm font-medium text-gray-500">Sera à nouveau disponible le</dt>
<dd class="mt-1 text-sm font-bold text-co-green sm:mt-0 sm:col-span-2 inline-flex"
x-data="{ updateOpen: false }">
<div class="w-full inline-flex" x-show="!updateOpen">
<div class="flex-1">{{(timeFrom .ViewState.booking.Unavailableto).Format "02/01/2006"}}</div>
<a href="#" class="text-co-blue hover:text-co-blue ml-5" @click="updateOpen = ! updateOpen">Modifier</a>
</div>
<form method="POST" class="inline-flex" x-show="updateOpen">
<div class="flex-1">
<input type="date" name="unavailableto" value="{{(timeFrom .ViewState.booking.Unavailableto).Format "2006-01-02"}}"
class="shadow-sm focus:ring-co-blue focus:border-co-blue block sm:text-sm border-gray-300 rounded-2xl">
</div>
<button
class=" justify-center text-co-blue px-4">
OK
</button>
</dd>
</div>
<div>
<p class="text-sm font-medium text-gray-500 my-4">Documents</p>
{{if eq (len .ViewState.documents) 0}}
<p class="p-12 text-gray-500 text-center text-md">Aucun document</p>
{{end}}
{{if gt (len .ViewState.documents) 0}}
<div class="-mx-4 mb-10 ring-1 ring-gray-300 sm:-mx-6 md:mx-0 md:rounded-lg">
<table class="min-w-full divide-y divide-gray-300 table-fixed">
<thead>
<tr>
<th scope="col" class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">Type</th>
<th scope="col" class="hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 lg:table-cell">Nom du document</th>
<th scope="col" class="hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 lg:table-cell">Ajouté le</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>
{{range .ViewState.documents}}
<tr>
<td class="relative py-4 pl-4 sm:pl-6 pr-3 text-sm">
<div class="font-medium text-gray-900">
<span class="bg-co-blue text-xs text-white rounded-xl p-1 mr-2">{{index $.ViewState.file_types_map .Metadata.Type}}</span>
</div>
</td>
<td class="px-3 py-3.5 text-sm text-gray-900 table-cell max-w-10 overflow-hidden">
<p class=" overflow-hidden">{{.Metadata.Name}}</p>
</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/vehicles/bookings/{{$.ViewState.booking.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">Voir<span class="sr-only"> le document</span></button>
</a>
</td>
</tr>
{{end}}
<!-- More plans... -->
</tbody>
</table>
</div>
{{end}}
</div>
</dl>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{{end}}

View File

@@ -0,0 +1,25 @@
{{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="/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

@@ -0,0 +1,106 @@
{{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">Ajouter un véhicule</h1>
</div>
<div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8 mt-8" x-data="{
fields: {
licence_plate: null,
name: null,
},
rules: {
licence_plate: ['required', 'regexMatch:^[A-Z]{1,2}-[0-9]{1,3}-[A-Z]{1,2}$'],
name: ['required'],
},
formValidation: {
valid: false,
fields: {
name: {valid: null},
licence_plate: {valid: null},
}
},
isFormValid: true,
validate() {
this.formValidation = Iodine.assert(this.fields, this.rules)
},
validateField(field) {
this.formValidation.fields[field] = Iodine.assert(this.fields[field], this.rules[field])
},
submit(event) {
this.validate()
if(!this.formValidation.valid) {
this.isFormValid = false
event.preventDefault()
}
return this.formValidation.valid
}
}">
<form class="space-y-6" method="POST" @submit="submit">
<div class="bg-white shadow px-4 py-5 sm:rounded-lg sm:p-6">
<div class="md:grid md:grid-cols-3 md:gap-6">
<div class="md:col-span-1">
<h3 class="text-lg font-medium leading-6 text-gray-900">Identité du véhicule</h3>
<p class="mt-1 text-sm text-gray-500">Informations de base sur le véhicule</p>
</div>
<div class="mt-5 md:mt-0 md:col-span-2">
<div class="grid grid-cols-3 md:grid-cols-6 gap-6">
<div class="col-span-5">
<label for="name" class="block text-sm font-medium text-gray-700">Modèle (ou nom donné au
véhicule)</label>
<input type="text" name="name" id="name"
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
x-model="fields.name" @blur="validateField('name')"
:class="formValidation.fields.name.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
</div>
<div class="col-span-3">
{{template "vehicle_type_select" .}}
</div>
<div class="col-span-3">
<label for="licence_plate"
class="block text-sm font-medium text-gray-700">Immatriculation</label>
<input type="text" name="licence_plate" id="licence_plate" placeholder="XX-123-YY"
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
x-model="fields.licence_plate"
@blur="fields.licence_plate = fields.licence_plate.toUpperCase(); validateField('licence_plate')"
:class="formValidation.fields.licence_plate.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
</div>
</div>
</div>
</div>
</div>
<div class="bg-white shadow px-4 py-5 sm:rounded-lg sm:p-6">
<div class="md:grid md:grid-cols-3 md:gap-6">
<div class="md:col-span-1">
<h3 class="text-lg font-medium leading-6 text-gray-900">Informations pratiques</h3>
<p class="mt-1 text-sm text-gray-500">Informations pratiques pour la réservation</p>
</div>
<div class="mt-5 md:mt-0 md:col-span-2">
{{ $fieldName := "address" }}
{{ template "address_autocomplete" dict "FieldName" $fieldName }}
<div class="mt-5">
<label for="informations" class="block text-sm font-medium text-gray-700">Informations pratiques pour le bénéficiaire</label>
<div class="mt-1">
<textarea rows="4" name="informations" id="informations"
class="shadow-sm focus:ring-co-blue focus:border-co-blue block w-full sm:text-sm border-gray-300 rounded-2xl"></textarea>
</div>
</div>
</div>
</div>
</div>
<div class="flex justify-end">
<p x-show="! isFormValid" class="px-4 py-2 text-sm text-co-red">Certains champs de sont pas valides.</p>
<a href="/app/vehicles-management/">
<button type="button"
class="bg-white py-2 px-4 border border-gray-300 rounded-2xl shadow-sm text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-co-blue">Annuler</button>
</a>
<button type="submit"
class="ml-3 inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-2xl text-white bg-co-blue hover:bg-co-blue focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-co-blue">Ajouter
le véhicule</button>
</div>
</form>
</div>
{{end}}

View File

@@ -0,0 +1,90 @@
{{define "content"}}
<main class="py-10">
<div class="max-w-3xl mx-auto px-4 sm:px-6 md:flex md:items-center md:justify-between md:space-x-5 lg:max-w-7xl lg:px-8">
<div class="flex items-center space-x-5">
<!-- <div class="flex-shrink-0">
<div class="relative">
<img class="h-16 w-16 rounded-co" src="/app/beneficiaries/{{.ViewState.ID}}/picture" alt="">
<span class="absolute inset-0 shadow-inner rounded-full" aria-hidden="true"></span>
</div>
</div> -->
<div>
<h1 class="text-2xl font-bold text-gray-900">{{.ViewState.vehicle.Data.name}}</h1>
</div>
</div>
<div
class="mt-6 flex flex-col-reverse justify-stretch space-y-4 space-y-reverse sm:flex-row-reverse sm:justify-end sm:space-x-reverse sm:space-y-0 sm:space-x-3 md:mt-0 md:flex-row md:space-x-3">
<button type="button"
class="inline-flex items-center justify-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-2xl text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-100 focus:ring-co-blue">Retirer de la flotte</button>
<a href="/app/vehicles-management/fleet/{{.ViewState.vehicle.ID}}/update" class="inline-flex"><button type="button"
class="w-full px-4 py-2 border border-transparent text-sm font-medium rounded-2xl shadow-sm text-white bg-co-blue hover:bg-co-blue focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-100 focus:ring-co-blue">Modifier</button></a>
</div>
</div>
<div class="mt-8 max-w-3xl mx-auto grid grid-cols-1 gap-6 sm:px-6 lg:max-w-7xl lg:grid-flow-col-dense lg:grid-cols-3">
<div class="space-y-6 lg:col-start-1 lg:col-span-2">
<section aria-labelledby="vehicle-information-title">
<div class="bg-white shadow sm:rounded-lg">
<div class="px-4 py-5 sm:px-6">
<h2 id="vehicle-information-title" class="text-lg leading-6 font-medium text-gray-900">Informations</h2>
<p class="mt-1 max-w-2xl text-sm text-gray-500">Informations sur le véhicule</p>
</div>
<div class="border-t border-gray-200 px-4 py-5 sm:px-6">
<dl class="grid grid-cols-1 gap-x-4 gap-y-8 sm:grid-cols-2">
{{if .ViewState.vehicle.Data.type}}
<div class="sm:col-span-1">
<dt class="text-sm font-medium text-gray-500">Type</dt>
<dd class="mt-1 text-sm text-gray-900">{{if eq .ViewState.vehicle.Data.type "electric_bike"}}Vélo électrique{{else}}Voiture{{end}}</dd>
</div>
{{else}}
<div class="sm:col-span-1">
<dt class="text-sm font-medium text-gray-500">Type</dt>
<dd class="mt-1 text-sm text-gray-900">Voiture</dd>
</div>
{{end}}
{{if .ViewState.vehicle.Data.licence_plate}}
<div class="sm:col-span-1">
<dt class="text-sm font-medium text-gray-500">Numéro (Immatriculation, bicycode, ...)</dt>
<dd class="mt-1 text-sm text-gray-900">{{.ViewState.vehicle.Data.licence_plate}}</dd>
</div>
{{end}}
{{if .ViewState.vehicle.Data.address}}
<div class="sm:col-span-1">
<dt class="text-sm font-medium text-gray-500">Lieu</dt>
<dd class="mt-1 text-sm text-gray-900">{{.ViewState.vehicle.Data.address.properties.label}}</dd>
</div>
{{end}}
{{if .ViewState.vehicle.Data.informations}}
<div class="sm:col-span-2">
<dt class="text-sm font-medium text-gray-500">Informations pratiques pour le bénéficiaire</dt>
<dd class="mt-1 text-sm text-gray-900">{{.ViewState.vehicle.Data.informations}}</dd>
</div>
{{end}}
</div>
</div>
</section>
</div>
<section aria-labelledby="timeline-title" class="lg:col-start-3 lg:col-span-1">
<div class="bg-white px-4 py-5 shadow sm:rounded-lg sm:px-6">
<h2 id="timeline-title" class="text-lg font-medium text-gray-900">Réservations à venir</h2>
{{if eq (len .ViewState.vehicle.Bookings) 0}}
<p class="p-12 text-gray-500 text-center text-md">Aucune réservation à venir</p>
{{end}}
<ul role="list" class="divide-y divide-gray-200">
{{range .ViewState.vehicle.Bookings}}
<li class="py-4 flex">
<div class="ml-3">
<a href="/app/vehicles-management/bookings/{{.ID}}" class="hover:bg-gray-200">
<p class="text-sm font-medium text-gray-900">Du {{(timeFrom .Startdate).Format "02/01/2006"}} au {{(timeFrom .Enddate).Format "02/01/2006"}}</p>
<p class="text-sm text-gray-500"></p>
</a>
</div>
</li>
{{end}}
</ul>
{{template "calendar" .}}
</div>
</section>
</div>
</main>
{{end}}

View File

@@ -0,0 +1,106 @@
{{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">Modifier un véhicule</h1>
</div>
<div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8 mt-8" x-data="{
fields: {
licence_plate: '{{ .ViewState.vehicle.Data.licence_plate }}',
name: '{{ .ViewState.vehicle.Data.name }}',
},
rules: {
licence_plate: ['required', 'regexMatch:^[A-Z]{1,2}-[0-9]{1,3}-[A-Z]{1,2}$'],
name: ['required'],
},
formValidation: {
valid: false,
fields: {
name: {valid: null},
licence_plate: {valid: null},
}
},
isFormValid: true,
validate() {
this.formValidation = Iodine.assert(this.fields, this.rules)
},
validateField(field) {
this.formValidation.fields[field] = Iodine.assert(this.fields[field], this.rules[field])
},
submit(event) {
this.validate()
if(!this.formValidation.valid) {
this.isFormValid = false
event.preventDefault()
}
return this.formValidation.valid
}
}">
<form class="space-y-6" method="POST" @submit="submit">
<div class="bg-white shadow px-4 py-5 sm:rounded-lg sm:p-6">
<div class="md:grid md:grid-cols-3 md:gap-6">
<div class="md:col-span-1">
<h3 class="text-lg font-medium leading-6 text-gray-900">Identité du véhicule</h3>
<p class="mt-1 text-sm text-gray-500">Informations de base sur le véhicule</p>
</div>
<div class="mt-5 md:mt-0 md:col-span-2">
<div class="grid grid-cols-3 md:grid-cols-6 gap-6">
<div class="col-span-5">
<label for="name" class="block text-sm font-medium text-gray-700">Modèle (ou nom donné au
véhicule)</label>
<input type="text" name="name" id="name"
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
x-model="fields.name" @blur="validateField('name')"
:class="formValidation.fields.name.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
</div>
<div class="col-span-3">
{{template "vehicle_type_select" .}}
</div>
<div class="col-span-3">
<label for="licence_plate"
class="block text-sm font-medium text-gray-700">Immatriculation</label>
<input type="text" name="licence_plate" id="licence_plate" placeholder="XX-123-YY"
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
x-model="fields.licence_plate"
@blur="fields.licence_plate = fields.licence_plate.toUpperCase(); validateField('licence_plate')"
:class="formValidation.fields.licence_plate.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
</div>
</div>
</div>
</div>
</div>
<div class="bg-white shadow px-4 py-5 sm:rounded-lg sm:p-6">
<div class="md:grid md:grid-cols-3 md:gap-6">
<div class="md:col-span-1">
<h3 class="text-lg font-medium leading-6 text-gray-900">Informations pratiques</h3>
<p class="mt-1 text-sm text-gray-500">Informations pratiques pour la réservation</p>
</div>
<div class="mt-5 md:mt-0 md:col-span-2">
{{ $fieldName := "address" }}
{{ template "address_autocomplete" (dict "FieldName" $fieldName "Address" .ViewState.vehicle.Data.address) }}
<div class="mt-5">
<label for="informations" class="block text-sm font-medium text-gray-700">Informations pratiques pour le bénéficiaire</label>
<div class="mt-1">
<textarea rows="4" name="informations" id="informations"
class="shadow-sm focus:ring-co-blue focus:border-co-blue block w-full sm:text-sm border-gray-300 rounded-2xl"></textarea>
</div>
</div>
</div>
</div>
</div>
<div class="flex justify-end">
<p x-show="! isFormValid" class="px-4 py-2 text-sm text-co-red">Certains champs de sont pas valides.</p>
<a href="/app/vehicles-management/fleet/{{.ViewState.vehicle.ID}}">
<button type="button"
class="bg-white py-2 px-4 border border-gray-300 rounded-2xl shadow-sm text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-co-blue">Annuler</button>
</a>
<button type="submit"
class="ml-3 inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-2xl text-white bg-co-blue hover:bg-co-blue focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-co-blue">Modifier
le véhicule</button>
</div>
</form>
</div>
{{end}}

View File

@@ -0,0 +1,45 @@
{{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">Gestion des véhicules et réservations</h1>
<div class="sm:flex sm:items-center">
<div class="sm:flex-auto">
<h2 class="text-xl font-semibold text-gray-600 pt-8">Réservations en cours et à venir</h2>
</div>
<div class="mt-4 sm:mt-0 sm:ml-16 sm:flex-none">
<a href="/app/vehicles-management/bookings/">
<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">
{{$.IconSet.Icon "hero:outline/table-cells" "h-5 w-5 mr-3"}}
Historique
</button>
</a>
</div>
</div>
</div>
{{template "bookings_list" .}}
<div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8 mt-8">
<div class="sm:flex sm:items-center">
<div class="sm:flex-auto">
<h2 class="text-xl font-semibold text-gray-600 pt-8">Véhicules</h2>
</div>
<div class="mt-4 sm:mt-0 sm:ml-16 sm:flex-none">
<a href="/app/vehicles-management/fleet/add">
<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">
{{$.IconSet.Icon "hero:outline/plus-circle" "h-5 w-5 mr-3"}}
Ajouter un véhicule
</button>
</a>
</div>
</div>
</div>
{{template "vehicles_list" .}}
{{end}}