From 39e770bb0903f6020f313fed955a7c64716e716e Mon Sep 17 00:00:00 2001 From: Arnaud Delcasse Date: Wed, 12 Apr 2023 10:52:29 +0200 Subject: [PATCH] Bookings list in admin --- config.yaml | 4 + .../_partials/bookings_list.html | 115 ++++++++++++++++++ .../administration/bookings_stats.html | 31 +++++ .../administration/vehicles_stats.html | 14 ++- web/layouts/beneficiaries/create.html | 17 ++- web/layouts/beneficiaries/display.html | 6 + web/layouts/beneficiaries/update.html | 20 +-- .../dashboard/_partials/agenda-widget.html | 2 + 8 files changed, 185 insertions(+), 24 deletions(-) create mode 100644 web/layouts/administration/_partials/bookings_list.html create mode 100644 web/layouts/administration/bookings_stats.html diff --git a/config.yaml b/config.yaml index 81a3dae..bae16d7 100644 --- a/config.yaml +++ b/config.yaml @@ -184,6 +184,10 @@ views: vehicles_list: files: - web/layouts/administration/vehicles_stats.html + bookings_list: + files: + - web/layouts/administration/_partials/bookings_list.html + - web/layouts/administration/bookings_stats.html settings: files: - web/layouts/administration/_partials/groups_admins.html diff --git a/web/layouts/administration/_partials/bookings_list.html b/web/layouts/administration/_partials/bookings_list.html new file mode 100644 index 0000000..9c5fd5e --- /dev/null +++ b/web/layouts/administration/_partials/bookings_list.html @@ -0,0 +1,115 @@ +{{define "bookings_list"}} +
+
+
+
+
+ + + + + + + + + + + + + + + + {{range .ViewState.bookings}} + + + + + + + + + + + + {{end}} + +
+ Statut + + Type + + Numéro + + Gestionnaire véhicule + + Prescripteur + + Beneficiaire + + Dates + + Commentaire + + Actions +
+ {{if .Data.administrator_unavailability}} + + Retiré + + {{else}} + {{if eq .Status 1 }} + + A venir + + {{end}} + {{if eq .Status 0 }} + + En cours + + {{end}} + {{if eq .Status -1 }} + + Terminé + + {{end}} + {{end}} + +
{{ (index $.ViewState.vehicles_map .Vehicleid).Type }}
+
+
{{ (index $.ViewState.vehicles_map .Vehicleid).Data.licence_plate }}
+
+
{{ (index $.ViewState.admingroups (index (index $.ViewState.vehicles_map .Vehicleid).Administrators 0)).Data.name }}
+
+
{{ .Data.booked_by.group.name }}
({{ .Data.booked_by.user.display_name }})
+
+ {{if .Data.administrator_unavailability}} +
+ {{else}} +
+ + {{$b := (index $.ViewState.beneficiaries_map .Driver)}} + {{$b.Data.first_name}} {{$b.Data.last_name}}
+ {{$b.Data.file_number}} +
+ {{end}} +
+ {{if .Data.administrator_unavailability}} +
Retiré du {{(timeFrom .Unavailablefrom).Format "02/01/2006"}}
+ au {{(timeFrom .Unavailableto).Format "02/01/2006"}}
+ {{else}} +
Du {{(timeFrom .Startdate).Format "02/01/2006"}}
+ au {{(timeFrom .Enddate).Format "02/01/2006"}}
+ {{end}} +
+
{{ .Data.comment }}
+
+ Voir +
+
+
+
+
+
+{{end}} \ No newline at end of file diff --git a/web/layouts/administration/bookings_stats.html b/web/layouts/administration/bookings_stats.html new file mode 100644 index 0000000..61d574b --- /dev/null +++ b/web/layouts/administration/bookings_stats.html @@ -0,0 +1,31 @@ +{{define "content"}} +
+

Historique des réservations de véhicules

+ + + +
+ +{{template "bookings_list" .}} + +{{end}} \ No newline at end of file diff --git a/web/layouts/administration/vehicles_stats.html b/web/layouts/administration/vehicles_stats.html index 06432c4..146cc62 100644 --- a/web/layouts/administration/vehicles_stats.html +++ b/web/layouts/administration/vehicles_stats.html @@ -2,14 +2,18 @@
diff --git a/web/layouts/beneficiaries/create.html b/web/layouts/beneficiaries/create.html index 36ba876..a725af1 100644 --- a/web/layouts/beneficiaries/create.html +++ b/web/layouts/beneficiaries/create.html @@ -20,7 +20,7 @@ email: ['required', 'email'], phone_number: ['required', 'regexMatch:^((\\+)33|0)[1-9](\\d{2}){4}$'], birthdate: ['required'], - file_number: ['optional'], + file_number: ['required'], }, formValidation: { valid: false, @@ -100,6 +100,13 @@ x-model="fields.birthdate" @blur="validateField('birthdate')" :class="formValidation.fields.birthdate.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
+
+ + +
@@ -114,14 +121,6 @@
-
- - -
-
diff --git a/web/layouts/beneficiaries/display.html b/web/layouts/beneficiaries/display.html index 8b8584f..40dbc4b 100644 --- a/web/layouts/beneficiaries/display.html +++ b/web/layouts/beneficiaries/display.html @@ -69,6 +69,12 @@
{{.ViewState.beneficiary.Data.address.properties.label}}
{{end}} + {{if .ViewState.beneficiary.Data.file_number}} +
+
Numéro de dossier (CAF / Pole emploi)
+
{{.ViewState.beneficiary.Data.file_number}}
+
+ {{end}}
diff --git a/web/layouts/beneficiaries/update.html b/web/layouts/beneficiaries/update.html index da1b4c9..a938274 100644 --- a/web/layouts/beneficiaries/update.html +++ b/web/layouts/beneficiaries/update.html @@ -21,7 +21,7 @@ email: ['required', 'email'], phone_number: ['required', 'regexMatch:^((\\+)33|0)[1-9](\\d{2}){4}$'], birthdate: ['required'], - file_number: ['optional'], + file_number: ['required'], }, formValidation: { valid: false, @@ -101,6 +101,15 @@ x-model="fields.birthdate" @blur="validateField('birthdate')" :class="formValidation.fields.birthdate.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
+ +
+ + +
+ @@ -114,15 +123,6 @@
- -
- - -
-
diff --git a/web/layouts/dashboard/_partials/agenda-widget.html b/web/layouts/dashboard/_partials/agenda-widget.html index c63ce4b..d121b2f 100644 --- a/web/layouts/dashboard/_partials/agenda-widget.html +++ b/web/layouts/dashboard/_partials/agenda-widget.html @@ -10,6 +10,7 @@