Compare commits

...

26 Commits

Author SHA1 Message Date
Nicolas CARON 1f7515cf92 Add documents & delete JSON_Scheme and JSON_UI on diags 2025-02-10 16:17:00 +01:00
Nicolas CARON 89ffff594e mask button Historique on diags 2025-02-10 15:27:15 +01:00
Nicolas CARON 038c256fc5 add Date for diags in all pages 2025-02-10 13:07:41 +01:00
Nicolas CARON 65c2f52438 add Date for diags 2025-02-10 12:48:43 +01:00
Nicolas CARON 42ba42f3a6 Edit update-diag.html 2025-01-13 14:00:03 +01:00
Nicolas CARON 07b91da6bc Edit all template for create diag 2025-01-13 12:07:14 +01:00
Nicolas CARON d269edcfe4 add button Voir for all diags pages 2025-01-08 11:39:48 +01:00
Nicolas CARON 95afa20373 add history-diags and edit display-diag, home and booking-diags 2024-12-18 16:02:13 +01:00
Nicolas CARON 153e832649 Add VehicleBookingsCreateDiag - second route to create a diag in reservation 2024-12-16 14:41:52 +01:00
Nicolas CARON ef66fa9876 Add BookingsCreateDiag 2024-12-16 12:38:28 +01:00
Nicolas CARON 34faa8c215 Add vehicles_managment/_partials/vehicle-diag.html & vehicles_management/create-diag.html 2024-12-10 16:10:58 +01:00
Nicolas CARON d9bb47bc98 Edit delete-diag.html - Redirect to the diag page 2024-12-09 14:17:01 +01:00
Nicolas CARON b9692a09f2 Add update-diag.html 2024-12-09 13:26:29 +01:00
Nicolas CARON ea6ed41608 Add display-diag.html 2024-12-04 18:20:56 +01:00
Nicolas CARON 676eea1238 Add module diags in menu & home page for diags 2024-12-04 17:29:10 +01:00
Nicolas CARON 395160db6e Edit beneficiary-diags and create-diag template on beneficiaries 2024-12-04 14:12:51 +01:00
Nicolas CARON bc948e0141 Add diags 2024-12-02 08:58:53 +01:00
Nicolas CARON c6f40f2aa2 fix some error on web/layouts/vehicles_management/fleet-update.html 2024-10-29 14:07:08 +01:00
Nicolas CARON 3526ee8700 add bookings on dashboard & kilometers on vehicles management 2024-10-29 12:09:50 +01:00
Nicolas CARON d8369bad3d Edit web/layout/vehicles/search.html - Add Documents demandés 2024-10-28 14:38:00 +01:00
Nicolas CARON 1903cd27db edit web/layouts/agenda/create-event.html 2024-10-22 12:10:49 +02:00
Nicolas CARON 5eccdcf89b edit web/layouts/agenda/_partials/event-files.html & web/layouts/agenda/display-event.html 2024-10-15 10:52:23 +02:00
Nicolas CARON 56f0700999 edit web/layouts/agenda/_partials/event-files.html 2024-10-14 09:59:33 +02:00
Nicolas CARON c8ab3f22ef edit display-event.html & add event-files.html 2024-10-07 17:57:51 +02:00
Nicolas CARON 10c4fb22d1 edit display-event.html 2024-10-02 14:41:37 +02:00
Nicolas CARON 698ccfc9d6 edit display-event.html 2024-10-02 14:36:23 +02:00
26 changed files with 1544 additions and 42 deletions

View File

@ -9,6 +9,7 @@ views:
files: files:
- web/layouts/dashboard/_partials/agenda-widget.html - web/layouts/dashboard/_partials/agenda-widget.html
- web/layouts/dashboard/_partials/beneficiaries-widget.html - web/layouts/dashboard/_partials/beneficiaries-widget.html
- web/layouts/dashboard/_partials/bookings-widget.html
- web/layouts/dashboard/dashboard.html - web/layouts/dashboard/dashboard.html
beneficiaries: beneficiaries:
list: list:
@ -28,7 +29,11 @@ views:
- web/layouts/beneficiaries/_partials/beneficiary-events.html - web/layouts/beneficiaries/_partials/beneficiary-events.html
- web/layouts/beneficiaries/_partials/beneficiary-files.html - web/layouts/beneficiaries/_partials/beneficiary-files.html
- web/layouts/beneficiaries/_partials/beneficiary-organizations.html - web/layouts/beneficiaries/_partials/beneficiary-organizations.html
- web/layouts/beneficiaries/_partials/beneficiary-diags.html
- web/layouts/beneficiaries/display.html - web/layouts/beneficiaries/display.html
create_diag:
files:
- web/layouts/beneficiaries/create-diag.html
update: update:
files: files:
- web/layouts/_partials/address_autocomplete.html - web/layouts/_partials/address_autocomplete.html
@ -58,10 +63,14 @@ views:
booking_display: booking_display:
files: files:
- web/layouts/vehicles/booking-display.html - web/layouts/vehicles/booking-display.html
- web/layouts/vehicles_management/_partials/booking-diags.html
bookings_list: bookings_list:
files: files:
- web/layouts/vehicles_management/_partials/bookings-list.html - web/layouts/vehicles_management/_partials/bookings-list.html
- web/layouts/vehicles/bookings-list.html - web/layouts/vehicles/bookings-list.html
create_booking_diag:
files:
- web/layouts/vehicles/create-booking-diag.html
vehicles_management: vehicles_management:
overview: overview:
files: files:
@ -81,6 +90,7 @@ views:
files: files:
- web/layouts/vehicles_management/_partials/calendar.html - web/layouts/vehicles_management/_partials/calendar.html
- web/layouts/vehicles_management/fleet-display.html - web/layouts/vehicles_management/fleet-display.html
- web/layouts/vehicles_management/_partials/vehicle-diags.html
fleet_update: fleet_update:
files: files:
- web/layouts/_partials/address_autocomplete.html - web/layouts/_partials/address_autocomplete.html
@ -89,6 +99,16 @@ views:
booking_display: booking_display:
files: files:
- web/layouts/vehicles_management/booking-display.html - web/layouts/vehicles_management/booking-display.html
- web/layouts/vehicles_management/_partials/booking-diags.html
delete_booking:
files:
- web/layouts/vehicles_management/delete-booking.html
create_vehicle_diag:
files:
- web/layouts/vehicles_management/create-vehicle-diag.html
create_booking_diag:
files:
- web/layouts/vehicles_management/create-booking-diag.html
agenda: agenda:
list: list:
files: files:
@ -100,10 +120,12 @@ views:
files: files:
- web/layouts/agenda/_partials/subscribers-table.html - web/layouts/agenda/_partials/subscribers-table.html
- web/layouts/agenda/display-event.html - web/layouts/agenda/display-event.html
- web/layouts/agenda/_partials/event-files.html
create_event: create_event:
files: files:
- web/layouts/_partials/address_autocomplete.html - web/layouts/_partials/address_autocomplete.html
- web/layouts/agenda/create-event.html - web/layouts/agenda/create-event.html
- web/layouts/agenda/_partials/event-files.html
delete_subscriber: delete_subscriber:
files: files:
- web/layouts/agenda/delete-subscriber.html - web/layouts/agenda/delete-subscriber.html
@ -162,6 +184,23 @@ views:
display_group: display_group:
files: files:
- web/layouts/group_module/display_group.html - web/layouts/group_module/display_group.html
diags:
list:
files:
- web/layouts/diags/home.html
display_diag:
files:
- web/layouts/diags/display-diag.html
- web/layouts/diags/_partials/diags-files.html
delete:
files:
- web/layouts/diags/delete-diag.html
update:
files:
- web/layouts/diags/update-diag.html
history:
files:
- web/layouts/diags/history-diags.html
administration: administration:
home: home:

View File

@ -0,0 +1,134 @@
{{define "event_files"}}
<div class="px-4 py-6 sm:px-6"
x-data="{
fields: {
name: null,
type: null,
file: null,
},
rules: {
name: ['required'],
type: ['required'],
file: ['required'],
},
formValidation: {
valid: false,
fields: {
name: {valid: null},
type: {valid: null},
file: {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
}
}">
{{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">
<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 lg:table-cell">{{.Metadata.Name}}</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/agenda/{{$.ViewState.event.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}}
{{ if eq (index .ViewState.event.Owners 0) .Group.ID }}
<h3 class="text-lg">Ajouter un document</h3>
<form method="POST" action="/app/agenda/{{.ViewState.event.ID}}/documents" @submit="submit" enctype="multipart/form-data">
<div class="md:grid md:grid-cols-6 p-2">
<div class="sm:col-span-2">
<label for="type" class="block text-sm font-medium text-gray-700">Type</label>
<select id="type" name="type" class="mt-1 block w-full rounded-l-2xl border-gray-300 py-2 pl-3 pr-10 text-base focus:border-indigo-500 focus:outline-none focus:ring-indigo-500 sm:text-sm"
x-model="fields.type" @blur="validateField('type')"
:class="formValidation.fields.type.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
<option value="" selected>Sélectionner un type</option>
{{range .ViewState.events_file_types}}
<option value="{{.}}">{{index $.ViewState.file_types_map .}}</option>
{{end}}
</select>
</div>
<div class="sm:col-span-4">
<label for="name" class="block text-sm font-medium text-gray-700">Nom</label>
<input type="text" name="name" id="name"
placeholder="Nom du fichier"
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-r-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="sm:col-span-6 mt-4">
<label for="cover-photo" class="block text-sm font-medium text-gray-700">Téléchargement</label>
<div class="mt-1 flex justify-center rounded-md border-2 border-dashed px-6 pt-5 pb-6"
x-on:drop="console.log('toto')"
:class="formValidation.fields.file.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
<div class="space-y-1 text-center">
{{.IconSet.Icon "hero:outline/folder-plus" "mx-auto h-12 w-12 text-gray-400"}}
<div class="flex text-sm text-gray-600">
<label for="file-upload" class="relative cursor-pointer rounded-md bg-white font-medium text-co-blue focus-within:outline-none focus-within:ring-2 focus-within:ring-co-blue focus-within:ring-offset-2 hover:text-co-blue">
<span>Sélectionnez un fichier </span>
<input id="file-upload" name="file-upload" type="file" class="sr-only"
x-model="fields.file" @blur="validateField('file')">
</label>
<!-- <p class="pl-1">ou glissez-déposez</p> -->
</div>
<p class="text-xs text-gray-500">Jusqu'à 10MB</p>
<p class="text-co-blue p-2" x-text="fields.file" x-if="fields.file"></p>
</div>
</div>
</div>
</div>
<button type="submit"
class="rounded-2xl border border-transparent bg-co-blue px-4 py-2 my-4 mt-8 w-full 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">
Ajouter le document
</button>
</form>
{{end}}
</div>
{{end}}

View File

@ -4,8 +4,7 @@
<h1 class="text-2xl font-semibold text-gray-900">Ajouter à l'agenda</h1> <h1 class="text-2xl font-semibold text-gray-900">Ajouter à l'agenda</h1>
</div> </div>
<div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8 mt-8" <div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8 mt-8" x-data="{
x-data="{
fields: { fields: {
name: null, name: null,
type: null, type: null,
@ -16,6 +15,9 @@
starttime: null, starttime: null,
endtime: null, endtime: null,
max_subscribers: 0, max_subscribers: 0,
file_name: null,
file_type: null,
file: null,
}, },
rules: { rules: {
name: ['required'], name: ['required'],
@ -25,7 +27,10 @@
starttime: ['optional'], starttime: ['optional'],
endtime: ['optional'], endtime: ['optional'],
description: ['optional'], description: ['optional'],
max_subscribers: ['required', 'min:0'] max_subscribers: ['required', 'min:0'],
file_name: ['optional'],
file_type: ['optional'],
file: ['optional'],
}, },
formValidation: { formValidation: {
valid: false, valid: false,
@ -39,6 +44,9 @@
endtime: {valid: null}, endtime: {valid: null},
allday: {valid: null}, allday: {valid: null},
max_subscribers: {valid: null}, max_subscribers: {valid: null},
file_name: {valid: null},
file_type: {valid: null},
file: {valid: null},
} }
}, },
isFormValid: true, isFormValid: true,
@ -62,12 +70,14 @@
return this.formValidation.valid return this.formValidation.valid
} }
}"> }">
<form class="space-y-6" method="POST" @submit="submit">
<form id="eventForm" 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="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:grid md:grid-cols-3 md:gap-6">
<div class="md:col-span-1"> <div class="md:col-span-1">
<h3 class="text-lg font-medium leading-6 text-gray-900">Informations sur le dispositif</h3> <h3 class="text-lg font-medium leading-6 text-gray-900">Informations sur le dispositif</h3>
<p class="mt-1 text-sm text-gray-500">Informations générales sur le dispositif d'accompagnement à ajouter à l'agenda</p> <p class="mt-1 text-sm text-gray-500">Informations générales sur le dispositif d'accompagnement à
ajouter à l'agenda</p>
</div> </div>
<div class="mt-5 md:mt-0 md:col-span-2"> <div class="mt-5 md:mt-0 md:col-span-2">
<div class="grid grid-cols-6 gap-6"> <div class="grid grid-cols-6 gap-6">
@ -80,8 +90,7 @@
</div> </div>
<div class="sm:col-span-3"> <div class="sm:col-span-3">
<label for="type" class="block text-sm font-medium text-gray-700">Type de dispositif</label> <label for="type" class="block text-sm font-medium text-gray-700">Type de dispositif</label>
<select id="type" name="type" <select id="type" name="type" x-model="fields.type" @blur="validateField('type')"
x-model="fields.type" @blur="validateField('type')"
class="max-w-lg mt-1 block focus:ring-co-blue focus:border-co-blue w-full shadow-sm sm:max-w-xs sm:text-sm rounded-2xl" class="max-w-lg mt-1 block focus:ring-co-blue focus:border-co-blue w-full shadow-sm sm:max-w-xs sm:text-sm rounded-2xl"
:class="formValidation.fields.type.valid == false ? 'border-co-red border-2' : 'border-gray-300'"> :class="formValidation.fields.type.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
<option></option> <option></option>
@ -94,8 +103,8 @@
<div class="col-span-6"> <div class="col-span-6">
<label for="description" class="block text-sm font-medium text-gray-700">Description</label> <label for="description" class="block text-sm font-medium text-gray-700">Description</label>
<div class="mt-1"> <div class="mt-1">
<textarea rows="4" name="description" id="descrpition" <textarea rows="4" name="description" id="descrpition" x-model="fields.description"
x-model="fields.description" @blur="validateField('description')" @blur="validateField('description')"
:class="formValidation.fields.description.valid == false ? 'border-co-red border-2' : 'border-gray-300'" :class="formValidation.fields.description.valid == false ? 'border-co-red border-2' : 'border-gray-300'"
class="shadow-sm focus:ring-co-blue focus:border-co-blue block w-full sm:text-sm border-gray-300 rounded-2xl"></textarea> 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>
@ -119,12 +128,14 @@
<div class="col-span-6"> <div class="col-span-6">
<button type="button" class="relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-co-blue focus:ring-offset-2" role="switch" aria-checked="false" <button type="button"
:class="fields.allday ? 'bg-co-blue' : 'bg-gray-200'" class="relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-co-blue focus:ring-offset-2"
role="switch" aria-checked="false" :class="fields.allday ? 'bg-co-blue' : 'bg-gray-200'"
@click="fields.allday = ! fields.allday"> @click="fields.allday = ! fields.allday">
<span class="sr-only">Use setting</span> <span class="sr-only">Use setting</span>
<!-- Enabled: "translate-x-5", Not Enabled: "translate-x-0" --> <!-- Enabled: "translate-x-5", Not Enabled: "translate-x-0" -->
<span aria-hidden="true" class="pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out" <span aria-hidden="true"
class="pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out"
:class="fields.allday ? 'translate-x-5' : 'translate-x-0'"></span> :class="fields.allday ? 'translate-x-5' : 'translate-x-0'"></span>
</button> <span class="text-md font-medium text-gray-700 ml-2">Toute la journée</span> </button> <span class="text-md font-medium text-gray-700 ml-2">Toute la journée</span>
<input type="hidden" name="allday" x-model="fields.allday"> <input type="hidden" name="allday" x-model="fields.allday">
@ -134,42 +145,46 @@
<div class="sm:col-span-6"> <div class="sm:col-span-6">
<div class="inline-flex w-full"> <div class="inline-flex w-full">
<div class="flex-1"> <div class="flex-1">
<label for="startdate" class="block text-sm font-medium text-gray-700">Date de début</label> <label for="startdate" class="block text-sm font-medium text-gray-700">Date de
début</label>
<input type="date" name="startdate" id="startdate" placeholder="JJ/MM/AAAA" <input type="date" name="startdate" id="startdate" placeholder="JJ/MM/AAAA"
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-l-2xl" class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-l-2xl"
x-model="fields.startdate" @blur="validateField('startdate')" x-model="fields.startdate" @blur="validateField('startdate')"
:class="formValidation.fields.startdate.valid == false ? 'border-co-red border-2' : 'border-gray-300'"> :class="formValidation.fields.startdate.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
</div> </div>
<div class="flex-1"> <div class="flex-1">
<label for="enddate" class="block text-sm font-medium text-gray-700">Date de fin</label> <label for="enddate" class="block text-sm font-medium text-gray-700">Date de
fin</label>
<input type="date" name="enddate" id="enddate" placeholder="JJ/MM/AAAA" <input type="date" name="enddate" id="enddate" placeholder="JJ/MM/AAAA"
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-r-2xl" class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-r-2xl"
x-model="fields.enddate" @blur="validateField('enddate')" x-model="fields.enddate" @blur="validateField('enddate')"
:class="formValidation.fields.enddate.valid == false ? 'border-co-red border-2' : 'border-gray-300'"> :class="formValidation.fields.enddate.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
</div> </div>
</div> </div>
</div> </div>
<div class="sm:col-span-6" x-show="!fields.allday"> <div class="sm:col-span-6" x-show="!fields.allday">
<div class="inline-flex w-full"> <div class="inline-flex w-full">
<div class="flex-1"> <div class="flex-1">
<label for="startdate" class="block text-sm font-medium text-gray-700">Horaire de début</label> <label for="startdate" class="block text-sm font-medium text-gray-700">Horaire de
début</label>
<input type="time" name="starttime" id="starttime" placeholder="00:00" <input type="time" name="starttime" id="starttime" placeholder="00:00"
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-l-2xl" class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-l-2xl"
x-model="fields.starttime" @blur="validateField('starttime')" x-model="fields.starttime" @blur="validateField('starttime')"
:class="formValidation.fields.starttime.valid == false ? 'border-co-red border-2' : 'border-gray-300'"> :class="formValidation.fields.starttime.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
</div> </div>
<div class="flex-1"> <div class="flex-1">
<label for="endtime" class="block text-sm font-medium text-gray-700">Horaire de fin</label> <label for="endtime" class="block text-sm font-medium text-gray-700">Horaire de
fin</label>
<input type="time" name="endtime" id="endtime" placeholder="00:00" <input type="time" name="endtime" id="endtime" placeholder="00:00"
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-r-2xl" class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-r-2xl"
x-model="fields.endtime" @blur="validateField('endtime')" x-model="fields.endtime" @blur="validateField('endtime')"
:class="formValidation.fields.endtime.valid == false ? 'border-co-red border-2' : 'border-gray-300'"> :class="formValidation.fields.endtime.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
</div> </div>
</div> </div>
</div> </div>
@ -184,12 +199,14 @@
<div class="md:grid md:grid-cols-3 md:gap-6"> <div class="md:grid md:grid-cols-3 md:gap-6">
<div class="md:col-span-1"> <div class="md:col-span-1">
<h3 class="text-lg font-medium leading-6 text-gray-900">Paramètres</h3> <h3 class="text-lg font-medium leading-6 text-gray-900">Paramètres</h3>
<p class="mt-1 text-sm text-gray-500">Paramètres du dispositift (nombre de places disponibles, etc...)</p> <p class="mt-1 text-sm text-gray-500">Paramètres du dispositif (nombre de places disponibles,
etc...)</p>
</div> </div>
<div class="mt-5 space-y-6 md:mt-0 md:col-span-2 align-middle"> <div class="mt-5 space-y-6 md:mt-0 md:col-span-2 align-middle">
<div class="grid grid-cols-6 gap-6"> <div class="grid grid-cols-6 gap-6">
<div class="col-span-6 sm:col-span-3"> <div class="col-span-6 sm:col-span-3">
<label for="max_subscribers" class="block text-sm font-medium text-gray-700">Places disponibles (0 = illimité)</label> <label for="max_subscribers" class="block text-sm font-medium text-gray-700">Places
disponibles (0 = illimité)</label>
<input type="number" name="max_subscribers" id="max_subscribers" <input type="number" name="max_subscribers" id="max_subscribers"
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl" class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
x-model="fields.max_subscribers" @blur="validateField('max_subscribers')" x-model="fields.max_subscribers" @blur="validateField('max_subscribers')"
@ -199,8 +216,54 @@
</div> </div>
</div> </div>
</div> </div>
<!-- <div class="bg-white shadow px-4 py-5 sm:rounded-lg sm:p-6 mt-8">
<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">Ajouter un document</h3>
<p class="mt-1 text-sm text-gray-500">Téléchargez un document lié à cet événement</p>
</div>
<div class="md:grid md:grid-cols-6 p-2">
<div class="sm:col-span-2">
<label for="file_type" class="block text-sm font-medium text-gray-700">Type</label>
<select id="file_type" name="file_type" class="mt-1 block w-full rounded-l-2xl border-gray-300 py-2 pl-3 pr-10 text-base focus:border-indigo-500 focus:outline-none focus:ring-indigo-500 sm:text-sm"
x-model="fields.file_type" @blur="validateField('file_type')"
:class="formValidation.fields.file_type.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
<option value="" selected>Sélectionner un type</option>
{{range .ViewState.events_file_types}}
<option value="{{.}}">{{index $.ViewState.file_types_map .}}</option>
{{end}}
</select>
</div>
<div class="sm:col-span-4">
<label for="file_name" class="block text-sm font-medium text-gray-700">Nom</label>
<input type="text" name="file_name" id="file_name"
placeholder="Nom du fichier"
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-r-2xl"
x-model="fields.file_name" @blur="validateField('file_name')"
:class="formValidation.fields.file_name.valid == false ? 'border-co-red border-2' : 'border-gray-300'" />
</div>
<div class="sm:col-span-6 mt-4">
<label for="cover-photo" class="block text-sm font-medium text-gray-700">Téléchargement</label>
<div class="mt-1 flex justify-center rounded-md border-2 border-dashed px-6 pt-5 pb-6"
x-on:drop="console.log('toto')"
:class="formValidation.fields.file.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
<div class="space-y-1 text-center">
{{.IconSet.Icon "hero:outline/folder-plus" "mx-auto h-12 w-12 text-gray-400"}}
<div class="flex text-sm text-gray-600">
<label for="file-upload" class="relative cursor-pointer rounded-md bg-white font-medium text-co-blue focus-within:outline-none focus-within:ring-2 focus-within:ring-co-blue focus-within:ring-offset-2 hover:text-co-blue">
<span>Sélectionnez un fichier </span>
<input id="file-upload" name="file-upload" type="file" class="sr-only"
x-model="fields.file" @blur="validateField('file')">
</label>
</div>
<p class="text-xs text-gray-500">Jusqu'à 10MB</p>
<p class="text-co-blue p-2" x-text="fields.file" x-if="fields.file"></p>
</div>
</div>
</div>
</div>
</div>
</div> -->
<div class="flex justify-end"> <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> <p x-show="! isFormValid" class="px-4 py-2 text-sm text-co-red">Certains champs de sont pas valides.</p>

View File

@ -85,6 +85,7 @@
</div> </div>
</div> </div>
</section> </section>
{{ if eq (index .ViewState.event.Owners 0) .Group.ID }} {{ if eq (index .ViewState.event.Owners 0) .Group.ID }}
<section aria-labelledby="subscribers-table"></section> <section aria-labelledby="subscribers-table"></section>
<div class="bg-white shadow sm:rounded-lg"> <div class="bg-white shadow sm:rounded-lg">
@ -205,5 +206,17 @@
</div> </div>
</section> </section>
</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="event-documents">
<div class="bg-white mt-4 px-4 py-5 shadow sm:rounded-lg sm:px-6">
<h2 id="documents-title" class="text-lg font-medium text-gray-900">Documents</h2>
<div class="flex justify-between items-center">
<div>{{template "event_files" .}}</div>
</div>
</div>
</section>
</div>
</div>
</main> </main>
{{ end }} {{ end }}

View File

@ -0,0 +1,58 @@
{{define "beneficiary_diags"}}
{{ $calendarIcon := .IconSet.Icon "hero:outline/calendar" "h-6 w-6" }}
{{ $carIcon := .IconSet.Icon "tabler-icons:car" "h-6 w-6"}}
<div class="bg-white shadow sm:rounded-lg">
<div class="px-4 py-5 sm:px-6">
<div class="flex items-center space-x-5">
<h2 id="timeline-title" class="text-lg font-medium text-gray-900">Diagnostics réalisés</h2>
<a href="{{.ViewState.beneficiary.ID}}/create-diag">
<button type="button"
class="flex justify-around 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-ci-blue focus:ring-offset-2 sm:w-auto">
{{$.IconSet.Icon "hero:outline/plus-circle" "h-5 w-5 mr-3"}}
Créer un diagnostic
</button>
</a>
</div>
</div>
<div class="border-t border-gray-200">
{{ $diagCount := len .ViewState.diags }}
<ul role="list" class="divide-y divide-gray-200 flex-1">
{{if eq $diagCount 0}}
<li class="py-2 px-4">
<p class="py-5 mt-1 max-w-2xl text-sm text-gray-500">Aucun diagnostique effectué pour le moment.</p>
</li>
{{else}}
{{range .ViewState.diags}}
{{ $diags := .ID }}
{{if eq .Deleted false}}
<li class="py-5 px-4 flex">
<div class="flex-1 ml-3">
<a href="/app/diags/{{$diags}}"class="mt-1 text-sm text-gray-900">{{.Name}}</a>
</div>
<div class="flex-1 ml-3">
<p class="mt-1 text-sm text-gray-900">{{(timeFrom .Diagdate).Format "02/01/2006"}}</p>
</div>
<a href="/app/diags/{{$diags}}" 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 diagnostic</span></button>
</a>
</li>
{{end}}
{{if eq .Deleted true}}
<li class="py-5 px-4 flex">
<div class="flex-1 ml-3">
<p class="mt-1 text-sm text-gray-900">{{.Name}}</p>
</div>
<div class="flex-1 ml-3">
<p class="mt-1 text-sm text-gray-900">{{(timeFrom .Diagdate).Format "02/01/2006"}}</p>
</div>
<div class="flex-1 ml-3">
<p class="mt-1 text-sm text-gray-900">Ce diagnostic a été retiré</p>
</div>
</li>
{{end}}
{{end}}
{{end}}
</ul>
</div>
</div>
{{end}}

View File

@ -0,0 +1,110 @@
{{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 diagnostic</h1>
</div>
<div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8 mt-8"
x-data="{
fields: {
name: null,
namespace: 'parcoursmob_beneficiaries',
},
rules: {
name: ['required'],
namespace: ['required'],
},
formValidation: {
valid: false,
fields: {
name: {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">Informations obligatoires</h3>
<p class="mt-1 text-sm text-gray-500">Informations obligatoires
pour créer un diagnostic dans PARCOURSMOB</p>
</div>
<div class="mt-5 md:mt-0 md:col-span-2">
<div class="grid grid-cols-6 gap-6">
<div class="col-span-6 sm:col-span-3">
<label for="name" class="block text-sm font-medium text-gray-700">Nom</label>
<input type="text" name="name" id="name" autocomplete="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>
</div>
</div>
</div>
<input type="hidden" name="namespace" value="parcoursmob_beneficiaries" />
<!-- <div class="bg-white shadow px-4 py-5 sm:rounded-lg sm:p-6 mt-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">Schéma JSON</h3>
<p class="mt-1 text-sm text-gray-500">Schéma JSON pour le diagnostic</p>
</div>
<div class="mt-5 md:mt-0 md:col-span-2">
<div class="grid grid-cols-6 gap-6">
<div class="col-span-6 sm:col-span-3">
<label for="json_schema" class="block text-sm font-medium text-gray-700">Schéma JSON</label>
<textarea name="json_schema" id="json_schema" autocomplete="json_schema"
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
x-model="fields.json_schema" @blur="validateField('json_schema')"
:class="formValidation.fields.json_schema.valid == false ? 'border-co-red border-2' : 'border-gray-300'"></textarea>
</div>
</div>
</div>
</div>
</div>
<div class="bg-white shadow px-4 py-5 sm:rounded-lg sm:p-6 mt-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">Schéma UI</h3>
<p class="mt-1 text-sm text-gray-500">Schéma UI pour le diagnostic</p>
</div>
<div class="mt-5 md:mt-0 md:col-span-2">
<div class="grid grid-cols-6 gap-6">
<div class="col-span-6 sm:col-span-3">
<label for="ui_schema" class="block text-sm font-medium text-gray-700">Schéma UI</label>
<textarea name="ui_schema" id="ui_schema" autocomplete="ui_schema"
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
x-model="fields.ui_schema" @blur="validateField('ui_schema')"
:class="formValidation.fields.ui_schema.valid == false ? 'border-co-red border-2' : 'border-gray-300'"></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/beneficiaries/{{.ViewState.beneficiary}}">
<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">Créer le diagnostique</button>
</div>
</form>
</div>
{{end}}

View File

@ -137,6 +137,11 @@
class="whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm" class="whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm"
:class="tab == 'organizations' ? 'border-co-blue text-co-blue' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'"> :class="tab == 'organizations' ? 'border-co-blue text-co-blue' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'">
Gestionnaires </a> Gestionnaires </a>
<a href="#" @click="tab = 'diags'"
class="whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm"
:class="tab == 'diags' ? 'border-co-blue text-co-blue' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'">
Diagnostics </a>
</nav> </nav>
</div> </div>
</div> </div>
@ -145,6 +150,7 @@
<div x-show="tab == 'documents'">{{template "beneficiary_files" .}}</div> <div x-show="tab == 'documents'">{{template "beneficiary_files" .}}</div>
<div x-show="tab == 'notes'">{{template "beneficiary_notes" .}}</div> <div x-show="tab == 'notes'">{{template "beneficiary_notes" .}}</div>
<div x-show="tab == 'organizations'">{{template "beneficiary_organizations" .}}</div> <div x-show="tab == 'organizations'">{{template "beneficiary_organizations" .}}</div>
<div x-show="tab == 'diags'">{{template "beneficiary_diags" .}}</div>
</div> </div>
</div> </div>
</section> </section>

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 "beneficiaries_widget" .ViewState.beneficiaries}}
{{template "agenda_widget" .ViewState.events}} {{template "agenda_widget" .ViewState.events}}
{{template "bookings_widget" .ViewState.fleets}}
</div> </div>
</div> </div>

View File

@ -0,0 +1,132 @@
{{define "diags_files"}}
<div class="px-4 py-6 sm:px-6"
x-data="{
fields: {
name: null,
type: diagnostic,
file: null,
},
rules: {
name: ['required'],
type: ['required'],
file: ['required'],
},
formValidation: {
valid: false,
fields: {
name: {valid: null},
type: {valid: null},
file: {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
}
}">
{{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">
<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 lg:table-cell">{{.Metadata.Name}}</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/diags/{{$.ViewState.diag.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}}
<h3 class="text-lg">Ajouter un document</h3>
<form method="POST" action="/app/diags/{{.ViewState.diag.ID}}/documents" @submit="submit" enctype="multipart/form-data">
<div class="md:grid md:grid-cols-6 p-2">
<div class="sm:col-span-2">
<label for="type" class="block text-sm font-medium text-gray-700">Type</label>
<select id="type" name="type" class="mt-1 block w-full rounded-l-2xl border-gray-300 py-2 pl-3 pr-10 text-base focus:border-indigo-500 focus:outline-none focus:ring-indigo-500 sm:text-sm"
x-model="fields.type" @blur="validateField('type')"
:class="formValidation.fields.type.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
<option value="" selected>Sélectionner un type</option>
{{range .ViewState.events_file_types}}
<option value="{{.}}">{{index $.ViewState.file_types_map .}}</option>
{{end}}
</select>
</div>
<div class="sm:col-span-4">
<label for="name" class="block text-sm font-medium text-gray-700">Nom</label>
<input type="text" name="name" id="name"
placeholder="Nom du fichier"
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-r-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="sm:col-span-6 mt-4">
<label for="cover-photo" class="block text-sm font-medium text-gray-700">Téléchargement</label>
<div class="mt-1 flex justify-center rounded-md border-2 border-dashed px-6 pt-5 pb-6"
x-on:drop="console.log('toto')"
:class="formValidation.fields.file.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
<div class="space-y-1 text-center">
{{.IconSet.Icon "hero:outline/folder-plus" "mx-auto h-12 w-12 text-gray-400"}}
<div class="flex text-sm text-gray-600">
<label for="file-upload" class="relative cursor-pointer rounded-md bg-white font-medium text-co-blue focus-within:outline-none focus-within:ring-2 focus-within:ring-co-blue focus-within:ring-offset-2 hover:text-co-blue">
<span>Sélectionnez un fichier </span>
<input id="file-upload" name="file-upload" type="file" class="sr-only"
x-model="fields.file" @blur="validateField('file')">
</label>
<!-- <p class="pl-1">ou glissez-déposez</p> -->
</div>
<p class="text-xs text-gray-500">Jusqu'à 10MB</p>
<p class="text-co-blue p-2" x-text="fields.file" x-if="fields.file"></p>
</div>
</div>
</div>
</div>
<button type="submit"
class="rounded-2xl border border-transparent bg-co-blue px-4 py-2 my-4 mt-8 w-full 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">
Ajouter le document
</button>
</form>
</div>
{{end}}

View File

@ -0,0 +1,32 @@
{{define "content"}}
<div>
<form method="POST" >
<div class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity"></div>
<div class="fixed inset-0 z-10 overflow-y-auto">
<div class="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0">
<div class="relative transform overflow-hidden rounded-lg bg-white px-4 pt-5 pb-4 text-left shadow-xl transition-all sm:my-8 sm:w-full max-w-lg sm:p-6">
<div>
<div class="mx-auto flex h-12 w-12 items-center justify-center rounded-co bg-co-blue text-white">
{{.IconSet.Icon "hero:outline/information-circle" "h-6 w-6"}}
</div>
<div class="mt-3 text-center sm:mt-5">
<h3 class="text-lg font-medium leading-6 text-gray-900" id="modal-title">Confirmation de retrait</h3>
<div class="mt-2">
<p class="text-sm text-gray-500">Voulez-vous vraiment retirer ce dignostique ?</p>
</div>
</div>
</div>
<div class="mt-5 sm:mt-6 sm:grid sm:grid-flow-row-dense sm:grid-cols-2">
<a href="/app/diags/{{.ViewState.diag.ID}}" class="mt-3 inline-flex w-full justify-center rounded-l-2xl border border-gray-300 bg-white px-4 py-2 text-base font-medium text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-co-blue focus:ring-offset-2 sm:col-start-1 sm:mt-0 sm:text-sm">Annuler</a>
<button type="submit" class="inline-flex w-full justify-center rounded-r-2xl border border-transparent bg-co-blue px-4 py-2 text-base font-medium text-white shadow-sm hover:bg-co-blue focus:outline-none focus:ring-2 focus:ring-co-blue focus:ring-offset-2 sm:col-start-2 sm:text-sm">Confirmation</button>
</div>
</div>
</div>
</div>
</form>
</div>
{{end}}

View File

@ -0,0 +1,80 @@
{{ 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>
<h1 class="text-2xl font-bold text-gray-900">{{.ViewState.diag.Name}}</h1>
</div>
{{$diag := .ViewState.diag.ID}}
</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">
{{if eq .ViewState.diag.Deleted false}}
<a href="/app/diags/{{$diag}}/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/diags/{{$diag}}/delete" 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-red hover:bg-co-red focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-100 focus:ring-co-blue">Retirer</button></a>
{{end}}
</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="diag-information-title">
<div class="bg-white shadow sm:rounded-lg">
<div class="px-4 py-5 sm:px-6">
<h2 id="diag" 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 diagnostic.</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">
<div class="sm:col-span-1">
<dt class="text-sm font-medium text-gray-500">Date du diagnostic</dt>
<dd class="mt-1 text-sm text-gray-900">{{(timeFrom .ViewState.diag.Diagdate).Format "02/01/2006"}}</dd>
</div>
{{if eq .ViewState.diag.Namespace "parcoursmob_beneficiaries"}}
<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">Diagnostic personnelle</dd>
</div>
{{end}}
{{if eq .ViewState.diag.Namespace "parcoursmob_vehicles"}}
<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">Diagnostic automobile</dd>
</div>
{{end}}
{{if eq .ViewState.diag.Namespace "parcoursmob_bookings"}}
<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">Diagnostic véhicule réservé</dd>
</div>
{{end}}
<!-- {{if .ViewState.diag.Json_schema}}
<div class="sm:col-span-2">
<dt class="text-sm font-medium text-gray-500">JSON_schema</dt>
<dd class="mt-1 text-sm text-gray-900">{{.ViewState.diag.Json_schema}}</dd>
</div>
{{end}}
{{if .ViewState.diag.Ui_schema}}
<div class="sm:col-span-2">
<dt class="text-sm font-medium text-gray-500">UI_schema</dt>
<dd class="mt-1 text-sm text-gray-900">{{.ViewState.diag.Ui_schema}}</dd>
</div>
{{end}} -->
</dl>
</div>
</div>
</section>
<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="event-documents">
<div class="bg-white mt-4 px-4 py-5 shadow sm:rounded-lg sm:px-6">
<h2 id="documents-title" class="text-lg font-medium text-gray-900">Documents</h2>
<div class="flex justify-between items-center">
<div>{{template "diags_files" .}}</div>
</div>
</div>
</section>
</div>
</div>
{{ end }}

View File

@ -0,0 +1,73 @@
{{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">Diagnostics retirés</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">
<a href="/app/diags/">
<button type="button"
class="inline-flex items-center justify-center mr-3 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">
Retour
</button>
</a>
</div>
</div>
</div>
<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="px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:pl-6">
Nom du diagnostic
</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="relative py-3.5 pl-3 pr-4 sm:pr-6">
<span class="sr-only">Actions</span>
</th>
</tr>
<tbody class="divide-y divide-gray-200 bg-white">
{{range .ViewState.diags}}
{{if eq .Deleted true}}
<a href="/app/diags/{{.ID}}">
<tr>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
<div class="font-medium text-gray-900">{{.Name}}</div>
</td>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
{{if eq .Namespace "parcoursmob_beneficiaries"}}
<div class="text-gray-500">Diagnostic personnelle</div>
{{end}}
{{if eq .Namespace "parcoursmob_vehicles"}}
<div class="text-gray-500">Diagnostic automobile</div>
{{end}}
{{if eq .Namespace "parcoursmob_bookings"}}
<div class="text-gray-500">Diagnostic véhicule réservé</div>
{{end}}
</td>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
<a href="/app/diags/{{.ID}}" class="text-co-blue hover:text-co-blue">Voir</a>
</td>
</tr>
</a>
{{end}}
{{end}}
</tbody>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
{{end}}

View File

@ -0,0 +1,84 @@
{{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">Diagnostics effectués</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">
<a href="/app/diags/history">
<button type="button"
class="inline-flex items-center justify-center mr-3 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/calendar" "h-5 w-5 mr-3"}}
Historique
</button>
</a>
</div> -->
</div>
</div>
<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="px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:pl-6">
Nom du diagnostic
</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">
Date
</th>
<th scope="col" class="relative py-3.5 pl-3 pr-4 sm:pr-6">
<span class="sr-only">Actions</span>
</th>
</tr>
<tbody class="divide-y divide-gray-200 bg-white">
{{range .ViewState.diags}}
<a href="/app/diags/{{.ID}}">
<tr>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
<div class="font-medium text-gray-900">{{.Name}}</div>
</td>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
{{if eq .Namespace "parcoursmob_beneficiaries"}}
<div class="text-gray-500">Diagnostic personnelle</div>
{{end}}
{{if eq .Namespace "parcoursmob_vehicles"}}
<div class="text-gray-500">Diagnostic automobile</div>
{{end}}
{{if eq .Namespace "parcoursmob_bookings"}}
<div class="text-gray-500">Diagnostic véhicule réservé</div>
{{end}}
</td>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
<div class="font-medium text-gray-900">{{(timeFrom .Diagdate).Format "02/01/2006"}}</div>
</td>
<td class="whitespace nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
{{if eq .Deleted true}}
<div class="w-full px-4 py-2 border border-transparent text-sm font-medium rounded-2xl shadow-sm text-white bg-co-red hover:bg-co-red focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-100 focus:ring-co-blue">Diagnostic retiré</div>
{{end}}
</td>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
<a href="/app/diags/{{.ID}}" 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 diagnostic</span></button>
</a>
</td>
</tr>
</a>
{{end}}
</tbody>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
{{end}}

View File

@ -0,0 +1,117 @@
{{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">Éditer un diagnostique</h1>
</div>
<div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8 mt-8"
x-data="{
fields: {
name: '{{.ViewState.diag.Name}}',
namespace: '{{.ViewState.diag.Namespace}}',
json_schema: '{{.ViewState.diag.Json_schema}}',
ui_schema: '{{.ViewState.diag.Ui_schema}}',
},
rules: {
name: ['required'],
namespace: ['required'],
json_schema: ['required'],
ui_schema: ['required']
},
formValidation: {
valid: false,
fields: {
name: {valid: null},
json_schema: {valid: null},
ui_schema: {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">Informations obligatoires</h3>
<p class="mt-1 text-sm text-gray-500">Informations obligatoires
pour éditer un diagnostique dans PARCOURSMOB</p>
</div>
<div class="mt-5 md:mt-0 md:col-span-2">
<div class="grid grid-cols-6 gap-6">
<div class="col-span-6 sm:col-span-3">
<label for="name" class="block text-sm font-medium text-gray-700">Nom</label>
<input type="text" name="name" id="name" autocomplete="given-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'"
value="{{.ViewState.diag.Name}}">
</div>
</div>
</div>
</div>
</div>
<input type="hidden" name="namespace" value="{{.ViewState.diag.Namespace}}" />
<div class="bg-white shadow px-4 py-5 sm:rounded-lg sm:p-6 mt-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">Schéma JSON</h3>
<p class="mt-1 text-sm text-gray-500">Schéma JSON pour le diagnostique</p>
</div>
<div class="mt-5 md:mt-0 md:col-span-2">
<div class="grid grid-cols-6 gap-6">
<div class="col-span-6 sm:col-span-3">
<label for="json_schema" class="block text-sm font-medium text-gray-700">Schéma JSON</label>
<textarea name="json_schema" id="json_schema" autocomplete="json_schema"
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
x-model="fields.json_schema" @blur="validateField('json_schema')"
:class="formValidation.fields.json_schema.valid == false ? 'border-co-red border-2' : 'border-gray-300'"></textarea>
</div>
</div>
</div>
</div>
</div>
<div class="bg-white shadow px-4 py-5 sm:rounded-lg sm:p-6 mt-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">Schéma UI</h3>
<p class="mt-1 text-sm text-gray-500">Schéma UI pour le diagnostique</p>
</div>
<div class="mt-5 md:mt-0 md:col-span-2">
<div class="grid grid-cols-6 gap-6">
<div class="col-span-6 sm:col-span-3">
<label for="ui_schema" class="block text-sm font-medium text-gray-700">Schéma UI</label>
<textarea name="ui_schema" id="ui_schema" autocomplete="ui_schema"
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
x-model="fields.ui_schema" @blur="validateField('ui_schema')"
:class="formValidation.fields.ui_schema.valid == false ? 'border-co-red border-2' : 'border-gray-300'"></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/diags/{{.ViewState.diag.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">Éditer le diagnostique</button>
</div>
</form>
</div>
{{end}}

View File

@ -66,6 +66,11 @@
</div> </div>
</div> </div>
</div> </div>
<div>
<div>
{{template "booking_diags" .}}
</div>
</div>
</div> </div>
<div class="lg:col-start-2 lg:col-span-2"> <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 shadow sm:rounded-2xl sm:px-6">

View File

@ -0,0 +1,110 @@
{{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 diagnostic</h1>
</div>
<div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8 mt-8"
x-data="{
fields: {
name: null,
namespace: 'parcoursmob_bookings',
},
rules: {
name: ['required'],
namespace: ['required'],
},
formValidation: {
valid: false,
fields: {
name: {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">Informations obligatoires</h3>
<p class="mt-1 text-sm text-gray-500">Informations obligatoires
pour créer un diagnostic dans PARCOURSMOB</p>
</div>
<div class="mt-5 md:mt-0 md:col-span-2">
<div class="grid grid-cols-6 gap-6">
<div class="col-span-6 sm:col-span-3">
<label for="name" class="block text-sm font-medium text-gray-700">Nom</label>
<input type="text" name="name" id="name" autocomplete="given-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>
</div>
</div>
</div>
<input type="hidden" name="namespace" value="parcoursmob_bookings" />
<!-- <div class="bg-white shadow px-4 py-5 sm:rounded-lg sm:p-6 mt-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">Schéma JSON</h3>
<p class="mt-1 text-sm text-gray-500">Schéma JSON pour le diagnostic</p>
</div>
<div class="mt-5 md:mt-0 md:col-span-2">
<div class="grid grid-cols-6 gap-6">
<div class="col-span-6 sm:col-span-3">
<label for="json_schema" class="block text-sm font-medium text-gray-700">Schéma JSON</label>
<textarea name="json_schema" id="json_schema" autocomplete="json_schema"
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
x-model="fields.json_schema" @blur="validateField('json_schema')"
:class="formValidation.fields.json_schema.valid == false ? 'border-co-red border-2' : 'border-gray-300'"></textarea>
</div>
</div>
</div>
</div>
</div>
<div class="bg-white shadow px-4 py-5 sm:rounded-lg sm:p-6 mt-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">Schéma UI</h3>
<p class="mt-1 text-sm text-gray-500">Schéma UI pour le diagnostic</p>
</div>
<div class="mt-5 md:mt-0 md:col-span-2">
<div class="grid grid-cols-6 gap-6">
<div class="col-span-6 sm:col-span-3">
<label for="ui_schema" class="block text-sm font-medium text-gray-700">Schéma UI</label>
<textarea name="ui_schema" id="ui_schema" autocomplete="ui_schema"
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
x-model="fields.ui_schema" @blur="validateField('ui_schema')"
:class="formValidation.fields.ui_schema.valid == false ? 'border-co-red border-2' : 'border-gray-300'"></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/bookings/{{.ViewState.booking}}">
<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">Créer le diagnostique</button>
</div>
</form>
</div>
{{end}}

View File

@ -147,6 +147,20 @@
<div class="lg:col-start-2 lg:col-span-2"> <div class="lg:col-start-2 lg:col-span-2">
{{if .ViewState.searched}} {{if .ViewState.searched}}
<div class="bg-white px-4 py-5 shadow sm:rounded-2xl sm:px-6"> <div class="bg-white px-4 py-5 shadow sm:rounded-2xl sm:px-6">
<h2 id="timeline-title" class="text-lg font-medium text-gray-900">Documents demandés</h2>
<table>
<tbody>
{{range .ViewState.search.mandatory_documents}}
<tr>
<td class="whitespace-nowrap py-4 px-3 text-sm text-gray-500">
{{index $.ViewState.search.file_types_map .}}
</td>
</tr>
{{end}}
</tbody>
</table>
</div>
<div class="bg-white mt-8 px-4 py-5 shadow sm:rounded-2xl sm:px-6">
<h2 id="timeline-title" class="text-lg font-medium text-gray-900">Véhicules disponibles</h2> <h2 id="timeline-title" class="text-lg font-medium text-gray-900">Véhicules disponibles</h2>
<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">

View File

@ -0,0 +1,56 @@
{{define "booking_diags"}}
{{ $calendarIcon := .IconSet.Icon "hero:outline/calendar" "h-6 w-6" }}
{{ $carIcon := .IconSet.Icon "tabler-icons:car" "h-6 w-6"}}
<div class="bg-white shadow sm:rounded-lg">
<div class="px-4 py-5 flex items-center space-x-5 sm:px-6">
<h2 id="timeline-title" class="text-lg font-medium text-gray-900">Diagnostics réalisés</h2>
<a href="{{.ViewState.booking.ID}}/create-diag">
<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-ci-blue focus:ring-offset-2 sm:w-auto">
{{$.IconSet.Icon "hero:outline/plus-circle" "h-5 w-5 mr-3"}}
Créer un diagnostic
</button>
</a>
</div>
<div class="border-t border-gray-200">
{{ $diagCount := len .ViewState.diags }}
<ul role="list" class="divide-y divide-gray-200 flex-1">
{{if eq $diagCount 0}}
<li class="py-2 px-4">
<p class="py-5 mt-1 max-w-2xl text-sm text-gray-500">Aucun diagnostique effectué pour le moment.</p>
</li>
{{else}}
{{range .ViewState.diags}}
{{ $diags := .ID }}
{{if eq .Deleted false}}
<li class="py-5 px-4 flex">
<div class="flex-1 ml-3">
<a href="/app/diags/{{$diags}}" class="mt-1 text-sm text-gray-900">{{.Name}}</a>
</div>
<div class="flex-1 ml-3">
<p class="mt-1 text-sm text-gray-900">{{(timeFrom .Diagdate).Format "02/01/2006"}}</p>
</div>
<a href="/app/diags/{{$diags}}" 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 diagnostic</span></button>
</a>
</li>
{{end}}
{{if eq .Deleted true}}
<li class="py-5 px-4 flex">
<div class="flex-1 ml-3">
<p class="mt-1 text-sm text-gray-900">{{.Name}}</p>
</div>
<div class="flex-1 ml-3">
<p class="mt-1 text-sm text-gray-900">{{(timeFrom .Diagdate).Format "02/01/2006"}}</p>
</div>
<div class="flex-1 ml-3">
<p class="mt-1 text-sm text-gray-900">Ce diagnostique a été retiré</p>
</div>
</li>
{{end}}
{{end}}
{{end}}
</ul>
</div>
</div>
{{end}}

View File

@ -0,0 +1,56 @@
{{define "vehicle_diags"}}
{{ $calendarIcon := .IconSet.Icon "hero:outline/calendar" "h-6 w-6" }}
{{ $carIcon := .IconSet.Icon "tabler-icons:car" "h-6 w-6"}}
<div class="bg-white shadow sm:rounded-lg">
<div class="px-4 py-5 flex items-center space-x-5 sm:px-6">
<h2 id="timeline-title" class="text-lg font-medium text-gray-900">Diagnostics réalisés</h2>
<a href="{{.ViewState.vehicle.ID}}/create-diag">
<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-ci-blue focus:ring-offset-2 sm:w-auto">
{{$.IconSet.Icon "hero:outline/plus-circle" "h-5 w-5 mr-3"}}
Créer un diagnostic
</button>
</a>
</div>
<div class="border-t border-gray-200">
{{ $diagCount := len .ViewState.diags }}
<ul role="list" class="divide-y divide-gray-200 flex-1">
{{if eq $diagCount 0}}
<li class="py-2 px-4">
<p class="py-5 mt-1 max-w-2xl text-sm text-gray-500">Aucun diagnostique effectué pour le moment.</p>
</li>
{{else}}
{{range .ViewState.diags}}
{{ $diags := .ID }}
{{if eq .Deleted false}}
<li class="py-5 px-4 flex">
<div class="flex-1 ml-3">
<a href="app/diags/{{$diags}}" class="mt-1 text-sm text-gray-900">{{.Name}}</a>
<div class="flex-1 ml-3">
<p class="mt-1 text-sm text-gray-900">{{(timeFrom .Diagdate).Format "02/01/2006"}}</p>
</div>
</div>
<a href="/app/diags/{{$diags}}" 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 diagnostic</span></button>
</a>
</li>
{{end}}
{{if eq .Deleted true}}
<li class="py-5 px-4 flex">
<div class="flex-1 ml-3">
<p class="mt-1 text-sm text-gray-900">{{.Name}}</p>
</div>
<div class="flex-1 ml-3">
<p class="mt-1 text-sm text-gray-900">{{(timeFrom .Diagdate).Format "02/01/2006"}}</p>
</div>
<div class="flex-1 ml-3">
<p class="mt-1 text-sm text-gray-900">Ce diagnostique a été retiré</p>
</div>
</li>
{{end}}
{{end}}
{{end}}
</ul>
</div>
</div>
{{end}}

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"> 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 Changer de véhicule
</button> </button>
<!-- <a href="/app/vehicles-management/bookings/{{.ViewState.booking.ID}}/delete"> <a href="/app/vehicles-management/bookings/{{.ViewState.booking.ID}}/delete">
<button type="button" <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"> 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 Annuler
</button> </button>
</a> --> </a>
<div class="relative z-10" aria-labelledby="modal-title" role="dialog" aria-modal="true" x-show="changeVehicle"> <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> <div class="fixed inset-0 bg-gray-900 bg-opacity-30 transition-opacity"></div>
@ -103,6 +103,9 @@
</div> </div>
</div> </div>
</div> </div>
<div>
{{template "booking_diags" .}}
</div>
</div> </div>
<div class="lg:col-start-2 lg:col-span-2"> <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 shadow sm:rounded-2xl sm:px-6">
@ -158,6 +161,11 @@
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2"> <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
{{.ViewState.vehicle.Data.licence_plate}}</dd> {{.ViewState.vehicle.Data.licence_plate}}</dd>
</div> </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"> <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> <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"> <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">

View File

@ -0,0 +1,116 @@
{{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 diagnostic</h1>
</div>
<div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8 mt-8"
x-data="{
fields: {
name: null,
namespace: 'parcoursmob_bookings',
json_schema: null,
ui_schema: null,
},
rules: {
name: ['required']
namespace: ['required']
json_schema: ['required']
ui_schema: ['required']
},
formValidation: {
valid: false,
fields: {
name: {valid: null},
json_schema: {valid: null},
ui_schema: {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">Informations obligatoires</h3>
<p class="mt-1 text-sm text-gray-500">Informations obligatoires
pour créer un diagnostic dans PARCOURSMOB</p>
</div>
<div class="mt-5 md:mt-0 md:col-span-2">
<div class="grid grid-cols-6 gap-6">
<div class="col-span-6 sm:col-span-3">
<label for="name" class="block text-sm font-medium text-gray-700">Nom</label>
<input type="text" name="name" id="name" autocomplete="given-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>
</div>
</div>
</div>
<input type="hidden" name="namespace" value="parcoursmob_bookings" />
<div class="bg-white shadow px-4 py-5 sm:rounded-lg sm:p-6 mt-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">Schéma JSON</h3>
<p class="mt-1 text-sm text-gray-500">Schéma JSON pour le diagnostic</p>
</div>
<div class="mt-5 md:mt-0 md:col-span-2">
<div class="grid grid-cols-6 gap-6">
<div class="col-span-6 sm:col-span-3">
<label for="json_schema" class="block text-sm font-medium text-gray-700">Schéma JSON</label>
<textarea name="json_schema" id="json_schema" autocomplete="json_schema"
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
x-model="fields.json_schema" @blur="validateField('json_schema')"
:class="formValidation.fields.json_schema.valid == false ? 'border-co-red border-2' : 'border-gray-300'"></textarea>
</div>
</div>
</div>
</div>
</div>
<div class="bg-white shadow px-4 py-5 sm:rounded-lg sm:p-6 mt-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">Schéma UI</h3>
<p class="mt-1 text-sm text-gray-500">Schéma UI pour le diagnostic</p>
</div>
<div class="mt-5 md:mt-0 md:col-span-2">
<div class="grid grid-cols-6 gap-6">
<div class="col-span-6 sm:col-span-3">
<label for="ui_schema" class="block text-sm font-medium text-gray-700">Schéma UI</label>
<textarea name="ui_schema" id="ui_schema" autocomplete="ui_schema"
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
x-model="fields.ui_schema" @blur="validateField('ui_schema')"
:class="formValidation.fields.ui_schema.valid == false ? 'border-co-red border-2' : 'border-gray-300'"></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/bookings/{{.ViewState.booking}}">
<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">Créer le diagnostique</button>
</div>
</form>
</div>
{{end}}

View File

@ -0,0 +1,110 @@
{{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 diagnostic</h1>
</div>
<div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8 mt-8"
x-data="{
fields: {
name: null,
namespace: 'parcoursmob_vehicles',
},
rules: {
name: ['required'],
namespace: ['required'],
},
formValidation: {
valid: false,
fields: {
name: {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">Informations obligatoires</h3>
<p class="mt-1 text-sm text-gray-500">Informations obligatoires
pour créer un diagnostic dans PARCOURSMOB</p>
</div>
<div class="mt-5 md:mt-0 md:col-span-2">
<div class="grid grid-cols-6 gap-6">
<div class="col-span-6 sm:col-span-3">
<label for="name" class="block text-sm font-medium text-gray-700">Nom</label>
<input type="text" name="name" id="name" autocomplete="given-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>
</div>
</div>
</div>
<input type="hidden" name="namespace" value="parcoursmob_vehicles" />
<!-- <div class="bg-white shadow px-4 py-5 sm:rounded-lg sm:p-6 mt-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">Schéma JSON</h3>
<p class="mt-1 text-sm text-gray-500">Schéma JSON pour le diagnostic</p>
</div>
<div class="mt-5 md:mt-0 md:col-span-2">
<div class="grid grid-cols-6 gap-6">
<div class="col-span-6 sm:col-span-3">
<label for="json_schema" class="block text-sm font-medium text-gray-700">Schéma JSON</label>
<textarea name="json_schema" id="json_schema" autocomplete="json_schema"
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
x-model="fields.json_schema" @blur="validateField('json_schema')"
:class="formValidation.fields.json_schema.valid == false ? 'border-co-red border-2' : 'border-gray-300'"></textarea>
</div>
</div>
</div>
</div>
</div>
<div class="bg-white shadow px-4 py-5 sm:rounded-lg sm:p-6 mt-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">Schéma UI</h3>
<p class="mt-1 text-sm text-gray-500">Schéma UI pour le diagnostic</p>
</div>
<div class="mt-5 md:mt-0 md:col-span-2">
<div class="grid grid-cols-6 gap-6">
<div class="col-span-6 sm:col-span-3">
<label for="ui_schema" class="block text-sm font-medium text-gray-700">Schéma UI</label>
<textarea name="ui_schema" id="ui_schema" autocomplete="ui_schema"
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
x-model="fields.ui_schema" @blur="validateField('ui_schema')"
:class="formValidation.fields.ui_schema.valid == false ? 'border-co-red border-2' : 'border-gray-300'"></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}}">
<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">Créer le diagnostique</button>
</div>
</form>
</div>
{{end}}

View File

@ -94,6 +94,13 @@
@blur="fields.licence_plate = fields.licence_plate.toUpperCase(); validateField('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'"> :class="formValidation.fields.licence_plate.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
</div> </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> </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"> <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" <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> 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" <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> --> 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> </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="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> <dd class="mt-1 text-sm text-gray-900">{{.ViewState.vehicle.Data.licence_plate}}</dd>
</div> </div>
{{end}} {{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}} {{if .ViewState.vehicle.Data.address}}
<div class="sm:col-span-1"> <div class="sm:col-span-1">
<dt class="text-sm font-medium text-gray-500">Lieu</dt> <dt class="text-sm font-medium text-gray-500">Lieu</dt>
@ -177,6 +183,9 @@
{{end}} {{end}}
</ul> </ul>
</div> </div>
<div class="mt-6">
{{template "vehicle_diags" .}}
</div>
</section> </section>
</div> </div>
</main> </main>

View File

@ -9,6 +9,7 @@
fields: { fields: {
licence_plate: '{{ .ViewState.vehicle.Data.licence_plate }}', licence_plate: '{{ .ViewState.vehicle.Data.licence_plate }}',
name: '{{ .ViewState.vehicle.Data.name }}', name: '{{ .ViewState.vehicle.Data.name }}',
kilometers: '{{ .ViewState.vehicle.Data.kilometers }}',
}, },
rules: { rules: {
licence_plate: ['required', 'regexMatch:^[A-Z]{1,2}-[0-9]{1,3}-[A-Z]{1,2}$'], licence_plate: ['required', 'regexMatch:^[A-Z]{1,2}-[0-9]{1,3}-[A-Z]{1,2}$'],
@ -35,7 +36,12 @@
event.preventDefault() event.preventDefault()
} }
return this.formValidation.valid return this.formValidation.valid
},
displayAutomatic(type) {
return type == 'Voiture'
} }
}"> }">
<form class="space-y-6" method="POST" @submit="submit"> <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="bg-white shadow px-4 py-5 sm:rounded-lg sm:p-6">
@ -55,7 +61,30 @@
:class="formValidation.fields.name.valid == false ? 'border-co-red border-2' : 'border-gray-300'"> :class="formValidation.fields.name.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
</div> </div>
<div class="col-span-3"> <div class="col-span-3">
{{template "vehicle_type_select" .}} <div class="col-span-3">
<label for="type" class="block text-sm font-medium text-gray-700">Type de véhicule</label>
<select id="type" name="type"
x-model="fields.type" @blur="validateField('type')"
class="max-w-lg mt-1 block focus:ring-co-blue focus:border-co-blue w-full shadow-sm sm:max-w-xs sm:text-sm rounded-2xl"
:class="formValidation.fields.type.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
<option value="" selected></option>
{{range .ViewState.vehicle_types}}
<option value="{{.}}">{{.}}</option>
{{end}}
</select>
<div class="m-4" x-show="displayAutomatic(fields.type)">
<legend class="sr-only">Automatique</legend>
<div class="relative flex items-start">
<div class="flex h-5 items-center">
<input id="automatic" aria-describedby="automatic-description" name="automatic" type="checkbox" class="h-4 w-4 rounded border-gray-300 text-co-blue focus:ring-co-blue">
</div>
<div class="ml-3 text-sm">
<label for="automatic" class="font-medium text-gray-700">Automatique</label>
<p id="automatic-description" class="text-gray-500">Ce véhicule a une boite automatique.</p>
</div>
</div>
</div>
</div>
</div> </div>
<div class="col-span-3"> <div class="col-span-3">
<label for="licence_plate" <label for="licence_plate"
@ -66,6 +95,15 @@
@blur="fields.licence_plate = fields.licence_plate.toUpperCase(); validateField('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'"> :class="formValidation.fields.licence_plate.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
</div> </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> </div>
</div> </div>