Merge branch 'diags' into dev

This commit is contained in:
Nicolas CARON 2024-12-16 15:02:07 +01:00
commit eddd57219c
16 changed files with 945 additions and 0 deletions

View File

@ -29,7 +29,11 @@ views:
- web/layouts/beneficiaries/_partials/beneficiary-events.html
- web/layouts/beneficiaries/_partials/beneficiary-files.html
- web/layouts/beneficiaries/_partials/beneficiary-organizations.html
- web/layouts/beneficiaries/_partials/beneficiary-diags.html
- web/layouts/beneficiaries/display.html
create_diag:
files:
- web/layouts/beneficiaries/create-diag.html
update:
files:
- web/layouts/_partials/address_autocomplete.html
@ -59,10 +63,14 @@ views:
booking_display:
files:
- web/layouts/vehicles/booking-display.html
- web/layouts/vehicles_management/_partials/booking-diags.html
bookings_list:
files:
- web/layouts/vehicles_management/_partials/bookings-list.html
- web/layouts/vehicles/bookings-list.html
create_booking_diag:
files:
- web/layouts/vehicles/create-booking-diag.html
vehicles_management:
overview:
files:
@ -82,6 +90,7 @@ views:
files:
- web/layouts/vehicles_management/_partials/calendar.html
- web/layouts/vehicles_management/fleet-display.html
- web/layouts/vehicles_management/_partials/vehicle-diags.html
fleet_update:
files:
- web/layouts/_partials/address_autocomplete.html
@ -90,9 +99,16 @@ views:
booking_display:
files:
- 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:
list:
files:
@ -168,6 +184,19 @@ views:
display_group:
files:
- web/layouts/group_module/display_group.html
diags:
list:
files:
- web/layouts/diags/home.html
display_diag:
files:
- web/layouts/diags/display-diag.html
delete:
files:
- web/layouts/diags/delete-diag.html
update:
files:
- web/layouts/diags/update-diag.html
administration:
home:

View File

@ -0,0 +1,51 @@
{{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>
<a href="/app/diags/{{$diags}}/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>
</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">Ce diagnostic a été retiré</p>
</div>
</li>
{{end}}
{{end}}
{{end}}
</ul>
</div>
</div>
{{end}}

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_beneficiaries',
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_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="tab == 'organizations' ? 'border-co-blue text-co-blue' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'">
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>
</div>
</div>
@ -145,6 +150,7 @@
<div x-show="tab == 'documents'">{{template "beneficiary_files" .}}</div>
<div x-show="tab == 'notes'">{{template "beneficiary_notes" .}}</div>
<div x-show="tab == 'organizations'">{{template "beneficiary_organizations" .}}</div>
<div x-show="tab == 'diags'">{{template "beneficiary_diags" .}}</div>
</div>
</div>
</section>

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,63 @@
{{ 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">
<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>
</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">
{{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>
{{ end }}

View File

@ -0,0 +1,74 @@
{{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="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 false}}
<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,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: 'parcoursmob_beneficiaries',
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="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 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>
{{template "booking_diags" .}}
</div>
</div>
</div>
<div class="lg:col-start-2 lg:col-span-2">
<div class="bg-white shadow sm:rounded-2xl sm:px-6">

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/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,49 @@
{{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>
<a href="/app/diags/{{$diags}}/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>
</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">Ce diagnostique a été retiré</p>
</div>
</li>
{{end}}
{{end}}
{{end}}
</ul>
</div>
</div>
{{end}}

View File

@ -0,0 +1,49 @@
{{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>
<a href="/app/diags/{{$diags}}/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>
</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">Ce diagnostique a été retiré</p>
</div>
</li>
{{end}}
{{end}}
{{end}}
</ul>
</div>
</div>
{{end}}

View File

@ -103,6 +103,9 @@
</div>
</div>
</div>
<div>
{{template "booking_diags" .}}
</div>
</div>
<div class="lg:col-start-2 lg:col-span-2">
<div class="bg-white shadow sm:rounded-2xl sm:px-6">

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,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_vehicles',
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_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

@ -183,6 +183,9 @@
{{end}}
</ul>
</div>
<div class="mt-6">
{{template "vehicle_diags" .}}
</div>
</section>
</div>
</main>