Merge branch 'main' into spie06
This commit is contained in:
		
						commit
						2747ce67fa
					
				| 
						 | 
				
			
			@ -220,6 +220,7 @@ views:
 | 
			
		|||
      ko: 
 | 
			
		||||
        files:
 | 
			
		||||
          - web/layouts/auth/onboarding-ko.html
 | 
			
		||||
 | 
			
		||||
icons:
 | 
			
		||||
  svg:
 | 
			
		||||
    coopgo:parcoursmob/monogram: <svg xmlns="http://www.w3.org/2000/svg" class="%s" viewBox="0 0 61.85 33.58"><defs><style>.cls-1{fill:#ff1300;}.cls-2{fill:#243887;}</style></defs><g id="Calque_2" data-name="Calque 2"><g id="Calque_1-2" data-name="Calque 1"><path class="cls-1" d="M44.978,0C31.337,0,28.1,6.824,27.875,15.505H39.536V9.434a.727.727,0,0,1,1.123-.607L52.6,16.453,40.659,24.08a.729.729,0,0,1-1.123-.608v-6.1H27.865c.075,8.427,1.527,16.213,17.113,16.213,14.867,0,16.872-7.764,16.872-17.032C61.85,7.91,59.894,0,44.978,0Z"/><polygon class="cls-1" points="41.412 21.385 49.133 16.453 41.412 11.521 41.412 21.385"/><path class="cls-2" d="M14.175,11.4l-.019,4.151H26.311a14.781,14.781,0,0,0,.819-5.141C27.046,3.767,22.545,0,14.764,0H1.052A1.147,1.147,0,0,0,0,1.24V31.87a1.149,1.149,0,0,0,1.094,1.239H11.525a1.145,1.145,0,0,0,1.051-1.239V10.41h.758C13.88,10.41,14.175,10.756,14.175,11.4Z"/><path class="cls-2" d="M14.148,17.3l-.015,3.514H18.97A7.521,7.521,0,0,0,25.458,17.3Z"/></g></g></svg>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,7 +8,7 @@
 | 
			
		|||
            
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="mt-4 sm:mt-0 sm:ml-16 sm:flex-none">
 | 
			
		||||
            <a href="/exports/fleets/bookings">
 | 
			
		||||
            <a href="/app/administration/stats/bookings/export">
 | 
			
		||||
                <button type="button"
 | 
			
		||||
                    class="inline-flex items-center justify-center 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">
 | 
			
		||||
                    Export
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,13 +5,6 @@
 | 
			
		|||
            <h1 class="text-2xl font-semibold text-gray-900">Liste des véhicules</h1>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="mt-4 sm:mt-0 sm:ml-16 sm:flex-none">
 | 
			
		||||
            <a href="/exports/fleets/bookings">
 | 
			
		||||
                <button type="button"
 | 
			
		||||
                        class="inline-flex items-center justify-center 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/document-arrow-down" "h-5 w-5 mr-3"}}
 | 
			
		||||
                    Exporter
 | 
			
		||||
                </button>
 | 
			
		||||
            </a>
 | 
			
		||||
            <a href="/app/administration/">
 | 
			
		||||
                <a href="/app/administration/stats/bookings">
 | 
			
		||||
                    <button type="button"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -104,7 +104,9 @@
 | 
			
		|||
                            </button>
 | 
			
		||||
                        </a>
 | 
			
		||||
                    </div>
 | 
			
		||||
                {{template "subscribers_table" .}}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                        {{template "subscribers_table" .}}
 | 
			
		||||
                </div>
 | 
			
		||||
            </section>
 | 
			
		||||
            {{end}}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,63 @@
 | 
			
		|||
{{define "beneficiary_events"}}
 | 
			
		||||
<div class="px-4 py-6 sm:px-6">
 | 
			
		||||
{{ $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">Actions réalisées</h2>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="border-t border-gray-200">
 | 
			
		||||
        {{ $eventCount := len .ViewState.event }}
 | 
			
		||||
        <ul role="list" class="divide-y divide-gray-200 flex-1">
 | 
			
		||||
            {{if eq $eventCount 0}}
 | 
			
		||||
                <li class="py-2 px-4">
 | 
			
		||||
                    <p class="py-5 mt-1 max-w-2xl text-sm text-gray-500">Aucun dispositif n'est prévu pour le moment.</p>
 | 
			
		||||
                </li>
 | 
			
		||||
            {{else}}
 | 
			
		||||
                {{range .ViewState.event}}
 | 
			
		||||
                {{if eq .Deleted false}}
 | 
			
		||||
                    <li class="py-5 px-4 flex">
 | 
			
		||||
                        <a href="{{.Db}}{{.ID}}" class="flex w-full">
 | 
			
		||||
                            <div class="flex-1 ml-3">
 | 
			
		||||
                                <div class="flex items-center">
 | 
			
		||||
 | 
			
		||||
                                    {{if eq .Status 2}}
 | 
			
		||||
                                        {{if eq .Icons "vehicle"}}
 | 
			
		||||
                                            <span class="bg-co-green text-white rounded-full h-8 w-10 flex items-center justify-center">{{$carIcon}}</span>
 | 
			
		||||
                                        {{else}}
 | 
			
		||||
                                            <span class="bg-co-green text-white rounded-full h-8 w-10 flex items-center justify-center">{{$calendarIcon}}</span>
 | 
			
		||||
                                        {{end}}
 | 
			
		||||
                                    {{end}}
 | 
			
		||||
 | 
			
		||||
                                    {{if eq .Status 1}}
 | 
			
		||||
                                        {{if eq .Icons "vehicle"}}
 | 
			
		||||
                                            <span class="bg-co-blue text-white rounded-full h-8 w-10 flex items-center justify-center">{{$carIcon}}</span>
 | 
			
		||||
                                        {{else}}
 | 
			
		||||
                                            <span class="bg-co-blue text-white rounded-full h-8 w-10 flex items-center justify-center">{{$calendarIcon}}</span>
 | 
			
		||||
                                        {{end}}
 | 
			
		||||
                                    {{end}}
 | 
			
		||||
 | 
			
		||||
                                    {{if eq .Status 3}}
 | 
			
		||||
                                        {{if eq .Icons "vehicle"}}
 | 
			
		||||
                                            <span class="bg-gray-500 text-white rounded-full h-8 w-10 flex items-center justify-center">{{$carIcon}}</span>
 | 
			
		||||
                                        {{else}}
 | 
			
		||||
                                            <span class="bg-gray-500 text-white rounded-full h-8 w-10 flex items-center justify-center">{{$calendarIcon}}</span>
 | 
			
		||||
                                        {{end}}
 | 
			
		||||
                                    {{end}} 
 | 
			
		||||
 | 
			
		||||
                                    {{if eq .Date .DateEnd}}
 | 
			
		||||
                                        <p class="text-sm font-medium text-gray-500">  le {{(timeFrom .Date).Format "02/01/2006"}}</p>
 | 
			
		||||
                                    {{else}}
 | 
			
		||||
                                        <p class="text-sm font-medium text-gray-500"> du {{(timeFrom .Date).Format "02/01/2006"}} au {{(timeFrom .DateEnd).Format "02/01/2006"}}</p>
 | 
			
		||||
                                    {{end}}
 | 
			
		||||
                                </div>
 | 
			
		||||
                                <p class="mt-1 text-sm text-gray-900">{{.Type}} - {{.Name}}</p>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </a>
 | 
			
		||||
                    </li>
 | 
			
		||||
                {{end}}
 | 
			
		||||
                {{end}}
 | 
			
		||||
            {{end}}
 | 
			
		||||
        </ul>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
{{end}}
 | 
			
		||||
| 
						 | 
				
			
			@ -151,10 +151,7 @@
 | 
			
		|||
        </div>
 | 
			
		||||
 | 
			
		||||
        <section aria-labelledby="timeline-title" class="lg:col-start-3 lg:col-span-1">
 | 
			
		||||
            <div class="bg-white px-4 py-5 shadow sm:rounded-lg sm:px-6">
 | 
			
		||||
                <h2 id="timeline-title" class="text-lg font-medium text-gray-900">Actions réalisées</h2>
 | 
			
		||||
                <p class="p-12 text-gray-500 text-center text-md">Aucune action réalisée pour le moment</p>
 | 
			
		||||
            </div>
 | 
			
		||||
        {{template "beneficiary_events" .}}
 | 
			
		||||
        </section>
 | 
			
		||||
    </div>
 | 
			
		||||
</main>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -162,13 +162,14 @@
 | 
			
		|||
                </div>
 | 
			
		||||
                <div class="mt-5 space-y-6 md:mt-0 md:col-span-2">
 | 
			
		||||
 | 
			
		||||
                        {{ $fieldName := "address" }} 
 | 
			
		||||
                        {{if .ViewState.Data.address}}
 | 
			
		||||
                        {{$default := .ViewState.Data.address}}
 | 
			
		||||
                        {{ template "address" dict "FieldName" $fieldName  "Default" $default}}
 | 
			
		||||
                        {{else}}
 | 
			
		||||
                        {{ template "address_autocomplete" dict "FieldName" $fieldName}}
 | 
			
		||||
                        {{end}}
 | 
			
		||||
                    {{ $fieldName := "address" }}
 | 
			
		||||
                    {{if .ViewState.Data.address}}
 | 
			
		||||
                    {{$default := .ViewState.Data.address}}
 | 
			
		||||
                    {{ template "address" dict "FieldName" $fieldName  "Default" $default}}
 | 
			
		||||
                    {{else}}
 | 
			
		||||
                    {{ template "address_autocomplete" dict "FieldName" $fieldName}}
 | 
			
		||||
                    {{end}}
 | 
			
		||||
                    <!-- will dolater : tags, groups, ... -->
 | 
			
		||||
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -54,7 +54,7 @@
 | 
			
		|||
                            
 | 
			
		||||
                            {{range .ViewState.bookings}}
 | 
			
		||||
                            <tr>
 | 
			
		||||
                                <td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6 text-center">
 | 
			
		||||
                                <td class="flex-col py-4 pl-4 pr-3 text-sm sm:pl-6 text-center">
 | 
			
		||||
                                    {{if .Data.administrator_unavailability}}
 | 
			
		||||
                                    <span class="p-1 bg-black text-white text-xs font-bold rounded-xl" >
 | 
			
		||||
                                        Retiré
 | 
			
		||||
| 
						 | 
				
			
			@ -76,15 +76,11 @@
 | 
			
		|||
                                        </span>
 | 
			
		||||
                                        {{end}}
 | 
			
		||||
                                    {{end}}
 | 
			
		||||
                                    {{if not .bookings}}
 | 
			
		||||
                                    <span class="p-1 bg-black text-white text-xs font-bold rounded-xl" >
 | 
			
		||||
                                       Disponible
 | 
			
		||||
                                    </span>
 | 
			
		||||
                                    {{end}}
 | 
			
		||||
                                </td>
 | 
			
		||||
                                <td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
 | 
			
		||||
                                    <div class="text-gray-900" >{{(index $.ViewState.vehicles_map .Vehicleid).Type}}</div>
 | 
			
		||||
                                </td>
 | 
			
		||||
                                  </td>
 | 
			
		||||
                                
 | 
			
		||||
                                <td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
 | 
			
		||||
                                    <div class="text-gray-900" >{{(index $.ViewState.vehicles_map .Vehicleid).Data.licence_plate}}</div>
 | 
			
		||||
                                </td>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -223,13 +223,11 @@
 | 
			
		|||
                                            </div>
 | 
			
		||||
                                          </div>
 | 
			
		||||
                                          {{end}}
 | 
			
		||||
                                          <div x-data="{
 | 
			
		||||
                                            buttondialog: false
 | 
			
		||||
                                          }"class="mt-5 sm:mt-6" x-show="!buttondialog">
 | 
			
		||||
                                            <button @click="buttondialog = !buttondialog" type="submit" class="inline-flex w-full justify-center rounded-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:text-sm">Réserver</button>
 | 
			
		||||
                                          <div class="mt-5 sm:mt-6">
 | 
			
		||||
                                            <button type="submit" class="inline-flex w-full justify-center rounded-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:text-sm">Réserver</button>
 | 
			
		||||
                                          </div>
 | 
			
		||||
                                        </form>
 | 
			
		||||
                                        <div class="mt-5 sm:mt-6" >
 | 
			
		||||
                                        <div class="mt-5 sm:mt-6">
 | 
			
		||||
                                          <button @click="documentsdialog=false" type="button" class="inline-flex w-full justify-center max-w-xs bg-white hover:bg-gray-50 border-gray-300 border px-4 py-2 text-gray-700 items-center text-sm rounded-2xl focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-co-blue">Annuler</button>
 | 
			
		||||
                                        </div>
 | 
			
		||||
                                      </div>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,6 +23,8 @@
 | 
			
		|||
                </button>
 | 
			
		||||
            </a>
 | 
			
		||||
            {{end}}
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
            <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>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,7 +11,7 @@
 | 
			
		|||
            
 | 
			
		||||
            <a href="/exports/fleets/bookings">
 | 
			
		||||
                <button type="button"
 | 
			
		||||
                        class="inline-flex items-center justify-center 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">
 | 
			
		||||
                    class="inline-flex items-center justify-center 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/document-arrow-down" "h-5 w-5 mr-3"}}
 | 
			
		||||
                    Exporter
 | 
			
		||||
                </button>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,4 @@
 | 
			
		|||
{{define "content"}}
 | 
			
		||||
 | 
			
		||||
<div x-data="{dialog: false}">
 | 
			
		||||
    <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">
 | 
			
		||||
| 
						 | 
				
			
			@ -14,12 +13,11 @@
 | 
			
		|||
                    <h1 class="text-2xl font-bold text-gray-900">{{.ViewState.vehicle.Data.name}}</h1>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            {{ if eq (index .ViewState.vehicle.Administrators 0) .Group.ID }}
 | 
			
		||||
            <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/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> {{end}}
 | 
			
		||||
                <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>
 | 
			
		||||
                <!-- <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> -->
 | 
			
		||||
            </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">
 | 
			
		||||
| 
						 | 
				
			
			@ -106,10 +104,6 @@
 | 
			
		|||
                                                    <span class="p-1 bg-black text-white text-xs font-bold rounded-xl" >
 | 
			
		||||
                                                        Retiré
 | 
			
		||||
                                                    </span>
 | 
			
		||||
                                                    {{else if .Data.Deleted}}
 | 
			
		||||
                                                    <span class="p-1 bg-co-red text-white text-xs font-bold rounded-xl" >
 | 
			
		||||
                                                        Annulé
 | 
			
		||||
                                                    </span>
 | 
			
		||||
                                                    {{else}}
 | 
			
		||||
                                                        {{if eq .Status 1 }}
 | 
			
		||||
                                                        <span class="p-1 bg-co-blue text-white text-xs font-bold rounded-xl" >
 | 
			
		||||
| 
						 | 
				
			
			@ -171,19 +165,13 @@
 | 
			
		|||
                    <p class="p-12 text-gray-500 text-center text-md">Aucune réservation à venir</p>
 | 
			
		||||
                    {{end}}
 | 
			
		||||
                    <ul role="list" class="divide-y divide-gray-200">
 | 
			
		||||
                        {{$noReservation := true}}
 | 
			
		||||
                        {{range .ViewState.vehicle.Bookings}}
 | 
			
		||||
                        <li class="py-4 flex">
 | 
			
		||||
                        <div class="ml-3">
 | 
			
		||||
                            {{if eq .Status 1 }}
 | 
			
		||||
                            <a href="/app/vehicles-management/bookings/{{.ID}}" class="hover:bg-gray-200">
 | 
			
		||||
                                <p class="text-sm font-medium text-gray-900">Du {{(timeFrom .Startdate).Format "02/01/2006"}} au {{(timeFrom .Enddate).Format "02/01/2006"}}</p>
 | 
			
		||||
                                <p class="text-sm text-gray-500"></p>
 | 
			
		||||
                            </a>
 | 
			
		||||
                            {{else if $noReservation}}
 | 
			
		||||
                            {{$noReservation = false}}
 | 
			
		||||
                            <p class="p-12 text-gray-500 text-center text-md">Aucune réservation à venir</p>
 | 
			
		||||
                            {{end}}
 | 
			
		||||
                        </div>
 | 
			
		||||
                        </li>
 | 
			
		||||
                        {{end}}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,28 +1,24 @@
 | 
			
		|||
{{define "content"}}
 | 
			
		||||
 | 
			
		||||
{{ if eq (index .ViewState.vehicle.Administrators 0) .Group.ID }}
 | 
			
		||||
 | 
			
		||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8">
 | 
			
		||||
    <h1 class="text-2xl font-semibold text-gray-900">Modifier le véhicule</h1>
 | 
			
		||||
    <h1 class="text-2xl font-semibold text-gray-900">Modifier un véhicule</h1>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8 mt-8" x-data="{
 | 
			
		||||
        fields: {
 | 
			
		||||
            licence_plate: '{{ .ViewState.vehicle.Data.licence_plate }}',
 | 
			
		||||
            name: '{{ .ViewState.vehicle.Data.name }}',
 | 
			
		||||
            type: '{{ .ViewState.vehicle.Type }}',
 | 
			
		||||
        },
 | 
			
		||||
        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}$'],
 | 
			
		||||
            name: ['required'],
 | 
			
		||||
            type: ['required'],
 | 
			
		||||
        },
 | 
			
		||||
        formValidation: {
 | 
			
		||||
            valid: false,
 | 
			
		||||
            fields: {
 | 
			
		||||
                name: {valid: null},
 | 
			
		||||
                licence_plate: {valid: null},
 | 
			
		||||
                type: {valid: null},
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        isFormValid: true,
 | 
			
		||||
| 
						 | 
				
			
			@ -39,10 +35,6 @@
 | 
			
		|||
                event.preventDefault()
 | 
			
		||||
            }
 | 
			
		||||
            return this.formValidation.valid
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        displayAutomatic(type) {
 | 
			
		||||
            return type == 'Voiture'
 | 
			
		||||
        }
 | 
			
		||||
    }">
 | 
			
		||||
    <form class="space-y-6" method="POST" @submit="submit">
 | 
			
		||||
| 
						 | 
				
			
			@ -55,44 +47,19 @@
 | 
			
		|||
                <div class="mt-5 md:mt-0 md:col-span-2">
 | 
			
		||||
                    <div class="grid grid-cols-3 md:grid-cols-6 gap-6">
 | 
			
		||||
                        <div class="col-span-5">
 | 
			
		||||
                            <label for="name" class="block text-sm font-medium text-gray-700">Modèle (ou nom donné au véhicule)</label>
 | 
			
		||||
                            <label for="name" class="block text-sm font-medium text-gray-700">Modèle (ou nom donné au
 | 
			
		||||
                                véhicule)</label>
 | 
			
		||||
                            <input type="text" name="name" id="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 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">
 | 
			
		||||
                                    {{if .ViewState.vehicle.Data.automatic}}
 | 
			
		||||
                                    <input id="automatic" aria-describedby="automatic-description" name="automatic" type="checkbox" checked class="h-4 w-4 rounded border-gray-300 text-co-blue focus:ring-co-blue">
 | 
			
		||||
                                    {{else}}
 | 
			
		||||
                                    <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">
 | 
			
		||||
                                    {{end}}
 | 
			
		||||
                                </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>
 | 
			
		||||
                            {{template "vehicle_type_select" .}}
 | 
			
		||||
                        </div>
 | 
			
		||||
                        
 | 
			
		||||
                        <div class="col-span-3">
 | 
			
		||||
                            <label for="licence_plate"
 | 
			
		||||
                                class="block text-sm font-medium text-gray-700">Numéro (Immat, Bicycode, ...)</label>
 | 
			
		||||
                                class="block text-sm font-medium text-gray-700">Immatriculation</label>
 | 
			
		||||
                            <input type="text" name="licence_plate" id="licence_plate" placeholder="XX-123-YY"
 | 
			
		||||
                                class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm  rounded-2xl"
 | 
			
		||||
                                x-model="fields.licence_plate"
 | 
			
		||||
| 
						 | 
				
			
			@ -110,18 +77,19 @@
 | 
			
		|||
                    <p class="mt-1 text-sm text-gray-500">Informations pratiques pour la réservation</p>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="mt-5 md:mt-0 md:col-span-2">
 | 
			
		||||
                    {{ $fieldName := "address" }} 
 | 
			
		||||
                    {{if .ViewState.vehicle.Data.address}}
 | 
			
		||||
                    {{$default := .ViewState.vehicle.Data.address}}
 | 
			
		||||
                    {{ $fieldName := "address" }}
 | 
			
		||||
                    {{if .ViewState.Data.address}}
 | 
			
		||||
                    {{$default := .ViewState.Data.address}}
 | 
			
		||||
                    {{ template "address" dict "FieldName" $fieldName  "Default" $default}}
 | 
			
		||||
                    {{else}}
 | 
			
		||||
                    {{ template "address_autocomplete" dict "FieldName" $fieldName}}
 | 
			
		||||
                    {{end}}
 | 
			
		||||
 | 
			
		||||
                    <div class="mt-5">
 | 
			
		||||
                        <label for="informations" class="block text-sm font-medium text-gray-700">Informations pratiques</label>
 | 
			
		||||
                        <label for="informations" class="block text-sm font-medium text-gray-700">Informations pratiques pour le bénéficiaire</label>
 | 
			
		||||
                        <div class="mt-1">
 | 
			
		||||
                            <textarea rows="4" name="informations" id="informations" value="{{.ViewState.vehicle.Data.informations}}"
 | 
			
		||||
                                class="shadow-sm focus:ring-co-blue focus:border-co-blue block w-full sm:text-sm border-gray-300 rounded-2xl">{{ if .ViewState.vehicle.Data.informations}} {{.ViewState.vehicle.Data.informations}} {{end}}</textarea>
 | 
			
		||||
                            <textarea rows="4" name="informations" id="informations"
 | 
			
		||||
                                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>
 | 
			
		||||
                </div>
 | 
			
		||||
| 
						 | 
				
			
			@ -140,28 +108,4 @@
 | 
			
		|||
        </div>
 | 
			
		||||
    </form>
 | 
			
		||||
</div>
 | 
			
		||||
{{else}}
 | 
			
		||||
 <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">Vous n'avez pas le droit de modifier ce véhicule</h3>
 | 
			
		||||
         </div>
 | 
			
		||||
     </div>
 | 
			
		||||
     <div class="flex justify-center  items-center mt-5 sm:mt-6 sm:grid sm:grid-flow-row-dense ">
 | 
			
		||||
        <!-- class="flex justify-center items-center py-2 px-3 border-t dark:border-gray-600 -->
 | 
			
		||||
         <a href="/app/vehicles-management/fleet/{{.ViewState.vehicle.ID}}" class="rounded-2xl 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>
 | 
			
		||||
{{end}}
 | 
			
		||||
{{end}}
 | 
			
		||||
		Loading…
	
		Reference in New Issue