add bookings on dashboard & kilometers on vehicles management

This commit is contained in:
Nicolas CARON 2024-10-29 12:09:50 +01:00
parent d8369bad3d
commit 3526ee8700
7 changed files with 68 additions and 5 deletions

View File

@ -9,6 +9,7 @@ views:
files:
- web/layouts/dashboard/_partials/agenda-widget.html
- web/layouts/dashboard/_partials/beneficiaries-widget.html
- web/layouts/dashboard/_partials/bookings-widget.html
- web/layouts/dashboard/dashboard.html
beneficiaries:
list:
@ -89,6 +90,9 @@ views:
booking_display:
files:
- web/layouts/vehicles_management/booking-display.html
delete_booking:
files:
- web/layouts/vehicles_management/delete-booking.html
agenda:
list:
files:

View File

@ -0,0 +1,32 @@
{{define "bookings_widget"}}
<div class="col-span-1 bg-white rounded-2xl shadow divide-y divide-gray-200 flex flex-col">
<div class="-ml-4 -mt-2 px-4 py-2 flex items-center justify-between flex-wrap sm:flex-nowrap">
<div class="ml-4 mt-2">
<h3 class="text-lg leading-6 font-medium text-gray-900">Prochaines réservations</h3>
</div>
<!-- <div class="ml-4 mt-2 flex-shrink-0">
<button type="button" class="relative inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-co-blue hover:bg-co-blue focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-co-blue">Voir</button>
</div> -->
</div>
<ul role="list" class="divide-y divide-gray-200 flex-1">
{{range .}}
{{if or (eq .Data.Deleted nil) (eq .Data.Deleted false)}}
<li class="py-2 px-4 flex">
<a href="/app/vehicles-management/bookings/{{.ID}}" class="flex w-full">
<div class="ml-3">
<p class="text-sm font-medium text-gray-900">Du {{(timeFrom .Startdate).Format "02/01"}} au {{(timeFrom .Enddate).Format "02/01"}}</p>
</div>
</a>
</li>
{{end}}
{{end}}
</ul>
<a href="/app/vehicles-management/">
<button class="w-full p-2 text-center bg-co-blue text-white rounded-b-2xl text-sm">
Reservation des véhicules
</button>
</a>
</div>
{{end}}

View File

@ -70,7 +70,7 @@
{{template "beneficiaries_widget" .ViewState.beneficiaries}}
{{template "agenda_widget" .ViewState.events}}
{{template "bookings_widget" .ViewState.fleets}}
</div>
</div>

View File

@ -15,12 +15,12 @@
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">
<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> -->
</a>
<div class="relative z-10" aria-labelledby="modal-title" role="dialog" aria-modal="true" x-show="changeVehicle">
<div class="fixed inset-0 bg-gray-900 bg-opacity-30 transition-opacity"></div>
@ -158,6 +158,11 @@
<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">Kilométrage</dt>
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
{{.ViewState.vehicle.Data.kilometers}} km</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">

View File

@ -94,6 +94,13 @@
@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 class="col-span-3">
<label for="kilometers"
class="block text-sm font-medium text-gray-700">Kilométrage</label>
<input type="text" name="kilometers" id="kilometers" placeholder="1 km"
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
x-model="fields.kilometers">
</div>
</div>
</div>
</div>

View File

@ -16,8 +16,8 @@
<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" @click="dialog = !dialog"
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> -->
<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">
@ -54,6 +54,12 @@
<dd class="mt-1 text-sm text-gray-900">{{.ViewState.vehicle.Data.licence_plate}}</dd>
</div>
{{end}}
{{if .ViewState.vehicle.Data.kilometers}}
<div class="sm:col-span-1">
<dt class="text-sm font-medium text-gray-500">Kilométrage</dt>
<dd class="mt-1 text-sm text-gray-900">{{.ViewState.vehicle.Data.kilometers}} km</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>

View File

@ -66,6 +66,15 @@
@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 class="col-span-3">
<label for="kilometers"
class="block text-sm font-medium text-gray-700">Kilométrage</label>
<input type="text" name="kilometers" id="kilometers" placeholder="1200 km"
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
x-model="fields.kilometers"
@blur="fields.kilometers; validateField('kilometers')"
:class="formValidation.fields.kilometers.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
</div>
</div>
</div>
</div>