Add vehicles_managment/_partials/vehicle-diag.html & vehicles_management/create-diag.html
This commit is contained in:
parent
d9bb47bc98
commit
34faa8c215
|
@ -86,6 +86,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
|
||||||
|
@ -97,6 +98,9 @@ views:
|
||||||
delete_booking:
|
delete_booking:
|
||||||
files:
|
files:
|
||||||
- web/layouts/vehicles_management/delete-booking.html
|
- web/layouts/vehicles_management/delete-booking.html
|
||||||
|
create_diag:
|
||||||
|
files:
|
||||||
|
- web/layouts/vehicles_management/create-diag.html
|
||||||
agenda:
|
agenda:
|
||||||
list:
|
list:
|
||||||
files:
|
files:
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
{{if eq .Deleted false}}
|
{{if eq .Deleted false}}
|
||||||
<li class="py-5 px-4 flex">
|
<li class="py-5 px-4 flex">
|
||||||
<div class="flex-1 ml-3">
|
<div class="flex-1 ml-3">
|
||||||
<p class="mt-1 text-sm text-gray-900">{{.Name}}</p>
|
<a href="/app/diags/{{$diags}}"class="mt-1 text-sm text-gray-900">{{.Name}}</a>
|
||||||
</div>
|
</div>
|
||||||
<a href="/app/diags/{{$diags}}/delete" class="inline-flex"><button type="button"
|
<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>
|
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>
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
<dd class="mt-1 text-sm text-gray-900">Diagnostique personnelle</dd>
|
<dd class="mt-1 text-sm text-gray-900">Diagnostique personnelle</dd>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{if eq .ViewState.diag.Namespace "parcoursmob_vehicle"}}
|
{{if eq .ViewState.diag.Namespace "parcoursmob_vehicles"}}
|
||||||
<div class="sm:col-span-1">
|
<div class="sm:col-span-1">
|
||||||
<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">Diagnostique automobile</dd>
|
<dd class="mt-1 text-sm text-gray-900">Diagnostique automobile</dd>
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
{{if eq .Namespace "parcoursmob_beneficiaries"}}
|
{{if eq .Namespace "parcoursmob_beneficiaries"}}
|
||||||
<div class="text-gray-500">Diagnostique personnelle</div>
|
<div class="text-gray-500">Diagnostique personnelle</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{if eq .Namespace "parcoursmob_vehicle"}}
|
{{if eq .Namespace "parcoursmob_vehicles"}}
|
||||||
<div class="text-gray-500">Diagnostique automobile</div>
|
<div class="text-gray-500">Diagnostique automobile</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -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 sm:px-6">
|
||||||
|
<h2 id="timeline-title" class="text-lg font-medium text-gray-900">Diagnostiques 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 dignostque
|
||||||
|
</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}}
|
|
@ -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 diagnostique</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 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'">
|
||||||
|
</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 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/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}}
|
|
@ -183,6 +183,9 @@
|
||||||
{{end}}
|
{{end}}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="mt-6">
|
||||||
|
{{template "vehicle_diags" .}}
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
Loading…
Reference in New Issue