pagination + optionsl vehicles fields
This commit is contained in:
@@ -9,8 +9,9 @@
|
||||
fields: {
|
||||
licence_plate: '{{ .ViewState.vehicle.Data.licence_plate }}',
|
||||
name: '{{ .ViewState.vehicle.Data.name }}',
|
||||
type: '{{ .ViewState.vehicle.Type }}',
|
||||
kilometers: '{{ .ViewState.vehicle.Data.kilometers }}',
|
||||
informations: '{{ .ViewState.vahicle.Data.informations}}',
|
||||
informations: '{{ .ViewState.vehicle.Data.informations}}',
|
||||
},
|
||||
rules: {
|
||||
licence_plate: ['required', 'regexMatch:^[A-Z]{1,2}-[0-9]{1,3}-[A-Z]{1,2}$'],
|
||||
@@ -86,7 +87,7 @@
|
||||
<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">
|
||||
<input id="automatic" aria-describedby="automatic-description" name="automatic" type="checkbox" {{if .ViewState.vehicle.Data.automatic}}checked{{end}} 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>
|
||||
@@ -126,8 +127,8 @@
|
||||
</div>
|
||||
<div class="mt-5 md:mt-0 md:col-span-2">
|
||||
{{ $fieldName := "address" }}
|
||||
{{if .ViewState.Data.address}}
|
||||
{{$default := .ViewState.Data.address}}
|
||||
{{if .ViewState.vehicle.Data.address}}
|
||||
{{$default := .ViewState.vehicle.Data.address}}
|
||||
{{ template "address" dict "FieldName" $fieldName "Default" $default}}
|
||||
{{else}}
|
||||
{{ template "address_autocomplete" dict "FieldName" $fieldName}}
|
||||
@@ -144,6 +145,48 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{if .ViewState.vehicle_optional_fields}}
|
||||
<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">Autres propriétés</h3>
|
||||
<p class="mt-1 text-sm text-gray-500">Informations complémentaires sur le véhicule</p>
|
||||
</div>
|
||||
<div class="mt-5 md:mt-0 md:col-span-2">
|
||||
<div class="grid grid-cols-6 gap-6">
|
||||
{{range .ViewState.vehicle_optional_fields}}
|
||||
<div class="col-span-6 sm:col-span-3">
|
||||
<label for="{{.name}}" class="block text-sm font-medium text-gray-700">{{.label}}</label>
|
||||
{{if eq .type "select"}}
|
||||
<div class="sm:mt-0 sm:col-span-2">
|
||||
<select id="{{.name}}" name="{{.name}}"
|
||||
class="p-2 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 border-gray-300 rounded-2xl">
|
||||
{{range .options}}
|
||||
<option value="{{.value}}" {{if eq .value (index $.ViewState.vehicle.Data .name)}}selected{{end}}>{{.label}}</option>
|
||||
{{end}}
|
||||
</select>
|
||||
</div>
|
||||
{{else if eq .type "textarea"}}
|
||||
<textarea id="{{.name}}" name="{{.name}}" rows="3"
|
||||
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm border-gray-300 rounded-2xl">{{index $.ViewState.vehicle.Data .name}}</textarea>
|
||||
{{else if eq .type "date"}}
|
||||
<input type="date" id="{{.name}}" name="{{.name}}" value="{{index $.ViewState.vehicle.Data .name}}"
|
||||
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm border-gray-300 rounded-2xl">
|
||||
{{else if eq .type "number"}}
|
||||
<input type="number" id="{{.name}}" name="{{.name}}" value="{{index $.ViewState.vehicle.Data .name}}"
|
||||
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm border-gray-300 rounded-2xl">
|
||||
{{else}}
|
||||
<input type="text" id="{{.name}}" name="{{.name}}" value="{{index $.ViewState.vehicle.Data .name}}"
|
||||
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm border-gray-300 rounded-2xl">
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{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>
|
||||
<a href="/app/vehicles-management/fleet/{{.ViewState.vehicle.ID}}">
|
||||
|
||||
Reference in New Issue
Block a user