Compare commits
	
		
			11 Commits
		
	
	
		
			main
			...
			silvermobi
		
	
	| Author | SHA1 | Date | 
|---|---|---|
|  | 1631cc9359 | |
|  | 8d2ca79bc5 | |
|  | 9edd80bd3c | |
|  | 079348cddc | |
|  | 8098d32260 | |
|  | fd459c0d31 | |
|  | e491233ea8 | |
|  | 2b75be0b19 | |
|  | 32494410b0 | |
|  | 3e1e2c66b9 | |
|  | 5d1a444697 | 
							
								
								
									
										33
									
								
								config.yaml
								
								
								
								
							
							
						
						
									
										33
									
								
								config.yaml
								
								
								
								
							|  | @ -28,7 +28,9 @@ views: | |||
|         - web/layouts/beneficiaries/_partials/beneficiary-events.html | ||||
|         - web/layouts/beneficiaries/_partials/beneficiary-files.html | ||||
|         - web/layouts/beneficiaries/_partials/beneficiary-organizations.html | ||||
|         - web/layouts/solidarity_service/beneficiary-solidarity.html | ||||
|         - web/layouts/beneficiaries/display.html | ||||
| 
 | ||||
|     update: | ||||
|       files: | ||||
|         - web/layouts/_partials/address_autocomplete.html | ||||
|  | @ -84,18 +86,19 @@ views: | |||
|     fleet_update: | ||||
|       files: | ||||
|         - web/layouts/_partials/address_autocomplete.html | ||||
|         - web/layouts/agenda/_partials/address.html | ||||
|         - web/layouts/vehicles_management/_partials/vehicle-type-select.html | ||||
|         - web/layouts/vehicles_management/fleet-update.html | ||||
|     booking_display:  | ||||
|       files:  | ||||
|         - web/layouts/vehicles_management/booking-display.html | ||||
|     delete_booking:  | ||||
|       files:  | ||||
|         - web/layouts/vehicles_management/delete-booking.html | ||||
|   agenda:  | ||||
|     list:  | ||||
|       files:  | ||||
|         - web/layouts/agenda/home.html | ||||
|     history:  | ||||
|       files:  | ||||
|         - web/layouts/agenda/history.html | ||||
|     display_event:  | ||||
|       files:  | ||||
|         - web/layouts/agenda/_partials/subscribers-table.html | ||||
|  | @ -129,7 +132,8 @@ views: | |||
|         - web/layouts/journeys/_partials/journeys-all.html | ||||
|         - web/layouts/journeys/_partials/journeys-others.html | ||||
|         - web/layouts/journeys/_partials/journeys-carpool.html | ||||
|         - web/layouts/journeys/_partials/journeys-public-transit.html | ||||
|         #- web/layouts/journeys/_partials/journeys-public-transit.html | ||||
|         - web/layouts/journeys/_partials/journeys-solidarity-service.html | ||||
|         - web/layouts/journeys/search.html | ||||
|     list: | ||||
|       files: | ||||
|  | @ -184,10 +188,6 @@ views: | |||
|     vehicles_list: | ||||
|       files: | ||||
|         - web/layouts/administration/vehicles_stats.html | ||||
|     bookings_list: | ||||
|       files: | ||||
|         - web/layouts/administration/_partials/bookings_list.html | ||||
|         - web/layouts/administration/bookings_stats.html | ||||
|     settings:  | ||||
|       files: | ||||
|         - web/layouts/administration/_partials/groups_admins.html | ||||
|  | @ -215,6 +215,21 @@ views: | |||
|       ko:  | ||||
|         files: | ||||
|           - web/layouts/auth/onboarding-ko.html | ||||
|   solidarity_service:  | ||||
|     list: | ||||
|       files: | ||||
|         - web/layouts/solidarity_service/main.html | ||||
|         - web/layouts/solidarity_service/_partials/beneficiary-list.html | ||||
|         - web/layouts/solidarity_service/_partials/driver-list.html | ||||
|         - web/layouts/solidarity_service/_partials/booking-list.html | ||||
|     create: | ||||
|       files: | ||||
|         - web/layouts/_partials/address_autocomplete.html | ||||
|         - web/layouts/solidarity_service/_partials/create-booking.html | ||||
|     create_driver: | ||||
|       files: | ||||
|         - web/layouts/solidarity_service/_partials/create-driver.html | ||||
|         - web/layouts/_partials/address_autocomplete.html | ||||
| 
 | ||||
| icons: | ||||
|   svg: | ||||
|  | @ -293,4 +308,4 @@ emails: | |||
|       subject: PARCOURSMOB - Un bénéficiaire a été retiré d'un dispositif | ||||
|       files: | ||||
|         - emails/layout.html | ||||
|         - emails/onboarding/delete-subscriber.html | ||||
|         - emails/onboarding/delete-subscriber.html | ||||
|  | @ -8,7 +8,7 @@ | |||
|     <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}} | ||||
|             {{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> | ||||
|  | @ -53,11 +53,33 @@ | |||
|                                 <p class="mt-1 text-sm text-gray-900">{{.Type}} - {{.Name}}</p> | ||||
|                             </div> | ||||
|                         </a> | ||||
|                     </li> | ||||
|                     </li>  | ||||
|                 {{end}} | ||||
|                 {{end}} | ||||
|             {{end}} | ||||
|         </ul> | ||||
|     </div> | ||||
|       <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 class="flex-shrink-0"> | ||||
|                 <div class="relative"> | ||||
|                     <span class="absolute inset-0 shadow-inner rounded-full" aria-hidden="true"></span> | ||||
|                 </div> | ||||
|             </div> | ||||
|         </div> | ||||
|     </div> | ||||
|     <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 class="flex-shrink-0"> | ||||
|                 <div class="relative"> | ||||
|                     <!-- <img class="h-16 w-16 rounded-co" src="/app/beneficiaries/solidarity_service{{.ViewState.Passenger.Id}}/picture" alt=""> --> | ||||
|                     <span class="absolute inset-0 shadow-inner rounded-full" aria-hidden="true"></span> | ||||
|                 </div> | ||||
|             </div> | ||||
|         </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"> | ||||
|         </div> | ||||
|     </div> | ||||
| </div> | ||||
| {{end}} | ||||
|  | @ -167,7 +167,7 @@ | |||
| 
 | ||||
|                 </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> | ||||
|  |  | |||
|  | @ -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 = 'solidarityService'" | ||||
|                                         class="whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm" | ||||
|                                         :class="tab == 'solidarityService' ? 'border-co-blue text-co-blue' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'"> | ||||
|                                         Transport Solidaire </a> | ||||
|                                     </nav> | ||||
|                                 </div> | ||||
|                             </div> | ||||
|  | @ -145,6 +150,8 @@ | |||
|                         <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 == 'solidarityService'">{{template "beneficiary_solidarity" .}}</div> | ||||
| 
 | ||||
|                     </div> | ||||
|                 </div> | ||||
|             </section> | ||||
|  |  | |||
|  | @ -61,10 +61,8 @@ | |||
|                                 </th> | ||||
|                                 <th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900"> | ||||
|                                     Labels | ||||
|                                 </th> | ||||
|                                 <th scope="col" class="relative py-3.5 pl-3 pr-4 sm:pr-6"> | ||||
|                                     <span class="sr-only">Modifier</span> | ||||
|                                 </th> | ||||
|                                 </th>                                 | ||||
|                                 | ||||
|                             </tr> | ||||
|                         </thead> | ||||
|                         <tbody class="divide-y divide-gray-200 bg-white"> | ||||
|  | @ -96,6 +94,7 @@ | |||
|                                                 class="inline-flex rounded-full bg-green-100 px-2 text-xs font-semibold leading-5 text-green-800" | ||||
|                                                 x-text="tag"></span> | ||||
|                                         </template> | ||||
| 
 | ||||
|                                     </td> | ||||
|                                     <td | ||||
|                                         class="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6"> | ||||
|  |  | |||
|  | @ -51,46 +51,10 @@ | |||
|     </div> | ||||
|      | ||||
| 
 | ||||
|     {{end}} | ||||
| 
 | ||||
|     {{ if gt (len .ViewState.journeys.Journeys) 0}} | ||||
|     <div class="px-4 pt-4 flex text-sm text-grey-900 font-bold border-t-2"> | ||||
|         <div class="flex-1"> | ||||
|             {{.IconSet.Icon "tabler-icons:bus" "h-6 w-6 inline-flex mr-4"}} | ||||
|             {{(timeFrom (index .ViewState.journeys.Journeys 0).Departure).Format "15:04"}} - {{(timeFrom (index .ViewState.journeys.Journeys 0).Arrival).Format "15:04"}} | ||||
|             ({{(index .ViewState.journeys.Journeys 0).Duration.Minutes | printf "%.0f"}} Minutes) | ||||
|         </div> | ||||
|         <div></div> | ||||
|     </div> | ||||
|     <div class="p-4 pb-8 flex"> | ||||
|         {{$firstwalk := true}} | ||||
|         {{range (index .ViewState.journeys.Journeys 0).Sections}} | ||||
|         {{if eq .Type "street_network"}} | ||||
|         <span class="ml-2 mt-1 h-5 w-5 rounded-co bg-gray-200 flex items-center justify-center ring-8 ring-white text-white"> | ||||
|             {{$.IconSet.Icon "tabler-icons:walk" "h-4 w-4 stroke-gray-800"}} | ||||
|         </span> | ||||
|         {{if $firstwalk}} | ||||
|         {{$firstwalk = false}} | ||||
|         {{$.IconSet.Icon "hero:outline/chevron-right" "h-3 w-3 stroke-gray-800 m-2"}} | ||||
|         {{end}} | ||||
|         {{end}} | ||||
|         {{if eq .Type "public_transport"}} | ||||
|         <span class="ml-2 rounded-xl px-2 py-1 bg-co-blue flex items-center justify-center ring-8 ring-white text-sm text-white whitespace-nowrap"> | ||||
|             {{if eq .Display.Network "Antibes - Envibus"}}Envibus{{else}}{{.Display.Network}}{{end}} Ligne {{.Display.Label}} | ||||
|         </span> | ||||
|         {{$.IconSet.Icon "hero:outline/chevron-right" "h-3 w-3 stroke-gray-800 m-2"}} | ||||
|         {{end}} | ||||
|         {{end}} | ||||
|         <div class="flex-1"></div> | ||||
|         <button class="text-sm px-2 py-1 bg-gray-200 text-co-blue rounded-xl" @click="tab = 'public-transit'">Voir le détail</button> | ||||
|     </div> | ||||
|     <div class="p-4 text-center"> | ||||
|         <button class="rounded-xl text-md px-4 py-1 bg-gray-200 text-co-blue" @click="tab = 'public-transit'">{{ len .ViewState.journeys.Journeys}} solutions en transports en commun : les voir toutes</button> | ||||
|     </div> | ||||
| 
 | ||||
|     {{end}} | ||||
| 
 | ||||
|     <!--VEHICLES--> | ||||
| 
 | ||||
|     <div class="px-4 pt-16 flex text-sm text-grey-900  border-t-2"> | ||||
|         <div class="flex-1"> | ||||
|             {{.IconSet.Icon "tabler-icons:car" "h-6 w-6 inline-flex mr-4"}} | ||||
|  | @ -102,4 +66,6 @@ | |||
|         <a href="/app/vehicles/"><button class="text-md px-4 py-1 bg-gray-200 text-co-blue rounded-xl">Réserver un véhicule</button></a> | ||||
|     </div> | ||||
| </div> | ||||
| {{end}} | ||||
| {{end}} | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -0,0 +1,208 @@ | |||
| {{define "journeys_solidarity_service"}} | ||||
| 
 | ||||
| <form class="space-y-6" method="POST" name="create_booking"> | ||||
|     <div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8" > | ||||
|         <div class="bg-white shadow sm:rounded-2xl"> | ||||
|             <h2 class="text-lg font-medium text-gray-900 p-4 sm:px-6"> | ||||
|                 Bénéficiaires | ||||
|             </h2> | ||||
|             <div class="border-t border-gray-200 px-4 py-5 sm:px-6"> | ||||
|                 <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"> | ||||
|                                     <tbody class="divide-y divide-gray-200 bg-white"> | ||||
|                                         {{range $beneficiary := .ViewState.solidarity_results.Beneficiaries}} | ||||
|                                         <tr> | ||||
|                                             <td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6"> | ||||
|                                                 <div class="flex items-center"> | ||||
|                                                     <button type="button" @click=" | ||||
|                                                     document.getElementById('passenger_id').value = '{{$beneficiary.Id}}' | ||||
|                                                     document.getElementById('passenger_name').textContent = '{{$beneficiary.FirstName}}{{$beneficiary.LastName}}'" class="ml-4">                                                               | ||||
|                                                         <div class="font-medium text-gray-900"> | ||||
|                                                             <span> | ||||
|                                                                 {{$beneficiary.FirstName}} | ||||
|                                                             </span> | ||||
|                                                             <span> | ||||
|                                                                 {{$beneficiary.LastName}} | ||||
|                                                             </span> | ||||
|                                                         </div> | ||||
|                                                     </button> | ||||
|                                                 </div> | ||||
|                                             </td> | ||||
|                                             <td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500"> | ||||
|                                              | ||||
|                                             </td> | ||||
|                                             <td | ||||
|                                                 class="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6"> | ||||
|                                              | ||||
|                                             </td> | ||||
|                                         </tr> | ||||
|                                         {{end}} | ||||
|                                         <!-- More people... --> | ||||
|                                     </tbody> | ||||
|                                 </table> | ||||
|                                 <div class="bg-white px-4 py-3 flex items-center justify-between border-t border-gray-200 sm:px-6"> | ||||
|                                     <div class="flex-1 flex justify-between sm:hidden"> | ||||
|                                         <a href="#" class="relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50" | ||||
|                                         @click="paginate(current)"> Previous </a> | ||||
|                                         <a href="#" class="ml-3 relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50" | ||||
|                                         @click="paginate(current+2)"> Next </a> | ||||
|                                     </div> | ||||
|                                     <div class="hidden sm:flex-1 sm:flex sm:items-center sm:justify-between"> | ||||
|                                     <div> | ||||
|                                         <p class="text-sm text-gray-700"> | ||||
|                                             Résultats | ||||
|                                             <span class="font-medium" x-text="Math.min((current * 10)+1, state.count)"></span> | ||||
|                                             à | ||||
|                                             <span class="font-medium" x-text="Math.min((current * 10)+10, state.count)"></span> | ||||
|                                             sur | ||||
|                                             <span class="font-medium" x-text="state.count"></span> | ||||
|                                         </p> | ||||
|                                     </div> | ||||
|                                     <div> | ||||
|                                         <nav class="relative z-0 inline-flex rounded-md shadow-sm -space-x-px" aria-label="Pagination"> | ||||
|                                         <a href="#" class="relative inline-flex items-center px-2 py-2 rounded-l-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50" | ||||
|                                             @click="paginate(current)"> | ||||
|                                             <span class="sr-only">Previous</span> | ||||
|                                             <!-- Heroicon name: solid/chevron-left --> | ||||
|                                             <svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"> | ||||
|                                             <path fill-rule="evenodd" d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" clip-rule="evenodd" /> | ||||
|                                             </svg> | ||||
|                                         </a> | ||||
|                                         <template x-for="i in nb_pages"> | ||||
|                                             <a href="#" @click="paginate(i)" | ||||
|                                             class="relative inline-flex items-center px-4 py-2 border text-sm font-medium" | ||||
|                                             :class="i == current+1 ? 'z-10 bg-indigo-50 border-co-blue text-co-blue' : 'bg-white border-gray-300 text-gray-500 hover:bg-gray-50'" | ||||
|                                             x-text="i"></a> | ||||
|                                         </template> | ||||
|                                         <!-- Current: "z-10 bg-indigo-50 border-indigo-500 text-indigo-600", Default: "bg-white border-gray-300 text-gray-500 hover:bg-gray-50" --> | ||||
|                                         <a href="#" class="relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50" | ||||
|                                             @click="paginate(current+2)"> | ||||
|                                             <span class="sr-only">Next</span> | ||||
|                                             <!-- Heroicon name: solid/chevron-right --> | ||||
|                                             <svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"> | ||||
|                                             <path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd" /> | ||||
|                                             </svg> | ||||
|                                         </a> | ||||
|                                         </nav> | ||||
|                                     </div> | ||||
|                                 </div> | ||||
|                             </div> | ||||
|                         </div> | ||||
|                     </div> | ||||
|                 </div> | ||||
|             </div> | ||||
|         </div> | ||||
|         <p id="passenger_name"></p> | ||||
|         <input type="hidden" id="passenger_id" name="passenger_id" >              | ||||
|     </div> | ||||
| </div>                 | ||||
|     <div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8" x-data="{ | ||||
|     }"> | ||||
|     <h2 class="text-lg font-medium text-gray-900 p-4 sm:px-6"> | ||||
|         Sélectionner un Conducteurs | ||||
|     </h2> | ||||
|     <div class="border-t border-gray-200 px-4 py-5 sm:px-6"> | ||||
| 
 | ||||
|         <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"> | ||||
|                             <tbody class="divide-y divide-gray-200 bg-white"> | ||||
|                                 {{ if gt (len .ViewState.solidarity_results.Drivers) 0}} | ||||
|                                 {{range $driver := .ViewState.solidarity_results.Drivers}} | ||||
|                                 <tr> | ||||
|                                     <td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6"> | ||||
|                                         <div class="flex items-center"> | ||||
|                                             <button type="button" @click=" | ||||
|                                             document.getElementById('driver_id').value = '{{$driver.User.Id}}' | ||||
|                                             document.getElementById('driver_name').textContent = '{{$driver.User.FirstName}}{{$driver.User.LastName}}'" class="ml-4">                                                               | ||||
|                                                 <div class="font-medium text-gray-900"> | ||||
|                                                     <span> | ||||
|                                                         {{$driver.User.FirstName}} | ||||
|                                                     </span> | ||||
|                                                     <span> | ||||
|                                                         {{$driver.User.LastName}} | ||||
|                                                     </span> | ||||
|                                                 </div> | ||||
|                                             </button> | ||||
|                                         </div> | ||||
|                                     </td> | ||||
|                                     <td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500"> | ||||
|                                      | ||||
|                                     </td> | ||||
|                                     <td | ||||
|                                         class="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6"> | ||||
|                                      | ||||
|                                     </td> | ||||
|                                 </tr> | ||||
|                                 {{end}} | ||||
|                                 {{end}} | ||||
|                                 <!-- More people... --> | ||||
|                             </tbody> | ||||
|                         </table> | ||||
|                         <div class="bg-white px-4 py-3 flex items-center justify-between border-t border-gray-200 sm:px-6"> | ||||
|                             <div class="flex-1 flex justify-between sm:hidden"> | ||||
|                             <a href="#" class="relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50" | ||||
|                             @click="paginate(current)"> Previous </a> | ||||
|                             <a href="#" class="ml-3 relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50" | ||||
|                             @click="paginate(current+2)"> Next </a> | ||||
|                             </div> | ||||
|                             <div class="hidden sm:flex-1 sm:flex sm:items-center sm:justify-between"> | ||||
|                                 <div> | ||||
|                                     <p class="text-sm text-gray-700"> | ||||
|                                     Résultats | ||||
|                                     <span class="font-medium" x-text="Math.min((current * 10)+1, state.count)"></span> | ||||
|                                     à | ||||
|                                     <span class="font-medium" x-text="Math.min((current * 10)+10, state.count)"></span> | ||||
|                                     sur | ||||
|                                     <span class="font-medium" x-text="state.count"></span> | ||||
|                                     </p> | ||||
|                                 </div> | ||||
|                                 <div> | ||||
|                                     <nav class="relative z-0 inline-flex rounded-md shadow-sm -space-x-px" aria-label="Pagination"> | ||||
|                                     <a href="#" class="relative inline-flex items-center px-2 py-2 rounded-l-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50" | ||||
|                                         @click="paginate(current)"> | ||||
|                                         <span class="sr-only">Previous</span> | ||||
|                                         <!-- Heroicon name: solid/chevron-left --> | ||||
|                                         <svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"> | ||||
|                                         <path fill-rule="evenodd" d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" clip-rule="evenodd" /> | ||||
|                                         </svg> | ||||
|                                     </a> | ||||
|                                     <template x-for="i in nb_pages"> | ||||
|                                         <a href="#" @click="paginate(i)" | ||||
|                                         class="relative inline-flex items-center px-4 py-2 border text-sm font-medium" | ||||
|                                         :class="i == current+1 ? 'z-10 bg-indigo-50 border-co-blue text-co-blue' : 'bg-white border-gray-300 text-gray-500 hover:bg-gray-50'" | ||||
|                                         x-text="i"></a> | ||||
|                                     </template> | ||||
|                                     <!-- Current: "z-10 bg-indigo-50 border-indigo-500 text-indigo-600", Default: "bg-white border-gray-300 text-gray-500 hover:bg-gray-50" --> | ||||
|                                     <a href="#" class="relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50" | ||||
|                                         @click="paginate(current+2)"> | ||||
|                                         <span class="sr-only">Next</span> | ||||
|                                         <!-- Heroicon name: solid/chevron-right --> | ||||
|                                         <svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"> | ||||
|                                         <path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd" /> | ||||
|                                         </svg> | ||||
|                                     </a> | ||||
|                                     </nav> | ||||
|                                 </div> | ||||
|                             </div> | ||||
|                         </div> | ||||
|                     </div> | ||||
|                 </div> | ||||
|             </div> | ||||
|         </div> | ||||
|         <p id="driver_name"></p> | ||||
|         <input type="hidden" id="driver_id" name="driver_id" > | ||||
|         <input type="submit" | ||||
|         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"  | ||||
|         value="Confirmer"> | ||||
|         </div> | ||||
| </div> | ||||
| 
 | ||||
| </form> | ||||
| {{end}} | ||||
| 
 | ||||
|  | @ -81,6 +81,8 @@ | |||
| 
 | ||||
|                                 <option value="public-transit">Transports</option> | ||||
| 
 | ||||
|                                 <option value="solidarity-service">Transports Solidaire</option> | ||||
| 
 | ||||
|                                 <!-- <option value="active-modes">Modes actifs</option> --> | ||||
| 
 | ||||
|                                 <option value="others">Autres</option> | ||||
|  | @ -104,6 +106,11 @@ | |||
|                                         class="whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm" | ||||
|                                         :class="tab == 'public-transit' ? 'border-co-blue text-co-blue' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'"> | ||||
|                                         Transports </a> | ||||
|                                      | ||||
|                                     <a href="#" @click="tab = 'solidarity-service'" | ||||
|                                         class="whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm" | ||||
|                                         :class="tab == 'solidarity-service' ? 'border-co-blue text-co-blue' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'"> | ||||
|                                         Transports Solidaire </a> | ||||
| 
 | ||||
|                                     <!-- <a href="#" @click="tab = 'active-modes'" | ||||
|                                         class="whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm" | ||||
|  | @ -121,7 +128,7 @@ | |||
| 
 | ||||
|                     <div x-show="tab == 'all'">{{template "journeys_all" .}}</div> | ||||
|                     <div x-show="tab == 'carpool'">{{template "journeys_carpool" .}}</div> | ||||
|                     <div x-show="tab == 'public-transit'">{{template "journeys_public_transit" .}}</div> | ||||
|                     <div x-show="tab == 'solidarity-service'">{{template "journeys_solidarity_service" .}}</div> | ||||
|                     <div x-show="tab == 'others'">{{template "journeys_others" .}}</div> | ||||
|                 </div> | ||||
|             </div> | ||||
|  | @ -131,4 +138,5 @@ | |||
|     </div> | ||||
|   | ||||
| </div> | ||||
| {{end}} | ||||
| {{end}} | ||||
| 
 | ||||
|  |  | |||
|  | @ -0,0 +1,157 @@ | |||
| {{define "beneficiary_solidarity_list"}} | ||||
| <main> | ||||
|     <div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8 px-4 py-5 sm:px-6" > | ||||
|         <h1 class="text-2xl font-semibold text-gray-900">Bénéficiaires Silvermobi</h1> | ||||
|     </div> | ||||
|                 <form class="space-y-6" method="GET" name="driver_journeys" @submit="submit">                 | ||||
|                     <div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8" x-data="{ | ||||
|                                 state: {{.ViewState.JSONWithLimits 0 10}}, | ||||
|                                 current: 0, | ||||
|                                 nb_pages() { | ||||
|                                     let nbEl = this.state.count  | ||||
|                                     return Math.ceil(nbEl/10) | ||||
|                                 }, | ||||
|                                 async paginate(page) { | ||||
|                                     let start = (page-1)*10 | ||||
|                                     if(start < 0|| start > this.state.count) { | ||||
|                                         return | ||||
|                                     } | ||||
|                                     let resp = await fetch('/api/cache/' + this.state.cache_id + '?limits.min=' + start + '&limits.max=' + (start+10)) | ||||
|                                     let data = await resp.json() | ||||
|                                     this.state.beneficiariessolidarity = data | ||||
|                                     this.current=page-1 | ||||
|                                 } | ||||
|                             }"> | ||||
|                             <div class=" px-4 py-5 sm:px-6"> | ||||
|                                 <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="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6"> | ||||
|                                                                 Nom | ||||
|                                                             </th> | ||||
|                                                             <th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900"> | ||||
|                                                                 Téléphone | ||||
|                                                             </th> | ||||
|                                                             <th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900"> | ||||
|                                                                 Adresse | ||||
|                                                             </th> | ||||
|                                                             <th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900"> | ||||
|                                                                 Labels | ||||
|                                                             </th> | ||||
|                                                             <th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900"> | ||||
|                                                                 Option | ||||
|                                                             </th> | ||||
|                                                             <th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900"> | ||||
|                                                                 Info | ||||
|                                                             </th> | ||||
|                                                            | ||||
|                                                         </tr> | ||||
|                                                     </thead> | ||||
|                                                     <tbody class="divide-y divide-gray-200 bg-white"> | ||||
|                                                         <template x-for="beneficiary in state.beneficiariessolidarity.passenger"> | ||||
|                                                             <tr> | ||||
|                                                                 <td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6"> | ||||
|                                                                     <div class="flex items-center"> | ||||
|                                                                         <button type="button" @click=" | ||||
|                                                                                 document.getElementById('passenger_id').value = beneficiary.id; | ||||
|                                                                                 document.getElementById('passenger_name').textContent = beneficiary.first_name+' '+beneficiary.last_name" class="ml-4"> | ||||
|                                                                             <div class="font-medium text-gray-900"> | ||||
|                                                                                 <span | ||||
|                                                                                     x-text="beneficiary.first_name" > | ||||
|                                                                                 </span> | ||||
|                                                                                 <span | ||||
|                                                                                     x-text="beneficiary.last_name"> | ||||
|                                                                                 </span> | ||||
|                                                                             </div> | ||||
|                                                                             <div class="text-gray-500" x-text="beneficiary.email">                                                                 | ||||
|                                                                             </div> | ||||
|                                                                         </button> | ||||
|                                                                     </div> | ||||
|                                                                 </td> | ||||
|                                                                 | ||||
|                                                                 <td class="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6"> | ||||
|                                                                     <a :href="'/app/solidarity_service/create/'+ beneficiary.id" | ||||
|                                                                         class="text-co-blue hover:text-co-blue">Demande de trajet<span class="sr-only"> | ||||
|                                                                     </a> | ||||
|                                                                 </td> | ||||
|                                                                 <td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500"> | ||||
|                                                                     <div class="text-gray-900" x-text="beneficiary.phone_number"></div> | ||||
|                                                                 </td> | ||||
|                                                                 <td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500" | ||||
|                                                                     x-text="beneficiary.data.address ? beneficiary.address.properties.label : ''"> | ||||
|                                                                 </td> | ||||
|                                                                 <td class="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6"> | ||||
|                                                                     <a :href="'/app/beneficiaries/' + beneficiary.id" | ||||
|                                                                         class="text-co-blue hover:text-co-blue">Voir<span class="sr-only">, <span | ||||
|                                                                                 x-text="beneficiary.first_name"></span> <span | ||||
|                                                                                 x-text="beneficiary.last_name"></span> | ||||
|                                                                     </a> | ||||
|                                                                 </td> | ||||
|                                                             </tr> | ||||
|                                                         </template> | ||||
|                                                         <!-- More people... --> | ||||
|                                                     </tbody> | ||||
|                                                 </table> | ||||
|                                                 <div class="bg-white px-4 py-3 flex items-center justify-between border-t border-gray-200 sm:px-6"> | ||||
|                                                     <div class="flex-1 flex justify-between sm:hidden"> | ||||
|                                                         <a href="#" class="relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50" | ||||
|                                                         @click="paginate(current)"> Previous </a> | ||||
|                                                         <a href="#" class="ml-3 relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50" | ||||
|                                                         @click="paginate(current+2)"> Next </a> | ||||
|                                                     </div> | ||||
|                                                     <div class="hidden sm:flex-1 sm:flex sm:items-center sm:justify-between"> | ||||
|                                                     <div> | ||||
|                                                         <p class="text-sm text-gray-700"> | ||||
|                                                             Résultats | ||||
|                                                             <span class="font-medium" x-text="Math.min((current * 10)+1, state.count)"></span> | ||||
|                                                             à | ||||
|                                                             <span class="font-medium" x-text="Math.min((current * 10)+10, state.count)"></span> | ||||
|                                                             sur | ||||
|                                                             <span class="font-medium" x-text="state.count"></span> | ||||
|                                                         </p> | ||||
|                                                     </div> | ||||
|                                                     <div> | ||||
|                                                         <nav class="relative z-0 inline-flex rounded-md shadow-sm -space-x-px" aria-label="Pagination"> | ||||
|                                                         <a href="#" class="relative inline-flex items-center px-2 py-2 rounded-l-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50" | ||||
|                                                             @click="paginate(current)"> | ||||
|                                                             <span class="sr-only">Previous</span> | ||||
|                                                             <!-- Heroicon name: solid/chevron-left --> | ||||
|                                                             <svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"> | ||||
|                                                             <path fill-rule="evenodd" d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" clip-rule="evenodd" /> | ||||
|                                                             </svg> | ||||
|                                                         </a> | ||||
|                                                         <template x-for="i in nb_pages"> | ||||
|                                                             <a href="#" @click="paginate(i)" | ||||
|                                                             class="relative inline-flex items-center px-4 py-2 border text-sm font-medium" | ||||
|                                                             :class="i == current+1 ? 'z-10 bg-indigo-50 border-co-blue text-co-blue' : 'bg-white border-gray-300 text-gray-500 hover:bg-gray-50'" | ||||
|                                                             x-text="i"></a> | ||||
|                                                         </template> | ||||
|                                                         <!-- Current: "z-10 bg-indigo-50 border-indigo-500 text-indigo-600", Default: "bg-white border-gray-300 text-gray-500 hover:bg-gray-50" --> | ||||
|                                                         <a href="#" class="relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50" | ||||
|                                                             @click="paginate(current+2)"> | ||||
|                                                             <span class="sr-only">Next</span> | ||||
|                                                             <!-- Heroicon name: solid/chevron-right --> | ||||
|                                                             <svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"> | ||||
|                                                             <path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd" /> | ||||
|                                                             </svg> | ||||
|                                                         </a> | ||||
|                                                         </nav> | ||||
|                                                     </div> | ||||
|                                                 </div> | ||||
|                                             </div> | ||||
|                                         </div> | ||||
|                                     </div> | ||||
|                                 </div> | ||||
|                             </div> | ||||
|                             <input type="hidden" id="passenger_id" name="passenger_id" > | ||||
|                             | ||||
|                     </div> | ||||
|                 </div> | ||||
|                 </form> | ||||
| </main> | ||||
| {{end}} | ||||
|  | @ -0,0 +1,133 @@ | |||
| {{define "booking_solidarity_list" }} | ||||
| <main>               | ||||
|     <div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8 px-4 py-5 sm:px-6" x-data="{ | ||||
|         state: {{.ViewState.JSONWithLimits 0 10}}, | ||||
|         current: 0, | ||||
|         nb_pages() { | ||||
|             let nbEl = this.state.count  | ||||
|             return Math.ceil(nbEl/10) | ||||
|         }, | ||||
|         async paginate(page) { | ||||
|             let start = (page-1)*10 | ||||
|             if(start < 0|| start > this.state.count) { | ||||
|                 return | ||||
|             } | ||||
|             let resp = await fetch('/api/cache/' + this.state.cache_id + '?limits.min=' + start + '&limits.max=' + (start+10)) | ||||
|             let data = await resp.json() | ||||
|             this.state.bookings = data | ||||
|             this.current=page-1 | ||||
|         }             | ||||
|     }"> | ||||
|     <h1 class="text-2xl font-semibold text-gray-900">Transports | ||||
|     </h1> | ||||
|     <div class="px-4 py-5 sm:px-6"> | ||||
| 
 | ||||
|         <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"> | ||||
|                             <tbody class="divide-y divide-gray-200 bg-white"> | ||||
|                                 <tr> | ||||
|                                     <th>Date</th> | ||||
|                                     <th>Conducteur</th> | ||||
|                                     <th>Passager</th> | ||||
|                                 </tr> | ||||
|                                 <template x-for="booking in state.bookings.booking">      | ||||
|                                     <tr> | ||||
|                                         <td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6"> | ||||
|                                             <div class="flex items-center">                                                         | ||||
|                                                     <div class="font-medium text-gray-900"> | ||||
|                                                         <span | ||||
|                                                             x-text="booking.passengerPickupDate"> | ||||
|                                                         </span> | ||||
|                                                     </div> | ||||
|                                                 </button> | ||||
|                                             </div> | ||||
|                                         </td> | ||||
|                                         <td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6"> | ||||
|                                             <div class="flex items-center">                                                              | ||||
|                                                     <div class="font-medium text-gray-900">                                                        | ||||
|                                                         <span | ||||
|                                                             x-text="booking.driver.first_name"> | ||||
|                                                         </span>    | ||||
|                                                         <span | ||||
|                                                             x-text="booking.driver.last_name"> | ||||
|                                                         </span>                                                     | ||||
|                                                     </div> | ||||
|                                                 </button> | ||||
|                                             </div> | ||||
|                                         </td> | ||||
|                                         <td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6"> | ||||
|                                             <div class="flex items-center">                                                              | ||||
|                                                     <div class="font-medium text-gray-900">                                                        | ||||
|                                                         <span | ||||
|                                                         x-text="booking.passenger.first_name"> | ||||
|                                                         </span> | ||||
|                                                         <span | ||||
|                                                             x-text="booking.passenger.last_name"> | ||||
|                                                         </span>                                                                                                        | ||||
|                                                     </div> | ||||
|                                                 </button> | ||||
|                                             </div> | ||||
|                                         </td> | ||||
|                                     </tr> | ||||
|                                 </template>     | ||||
|                             </tbody> | ||||
|                         </table> | ||||
|                         <div class="bg-white px-4 py-3 flex items-center justify-between border-t border-gray-200 sm:px-6"> | ||||
|                             <div class="flex-1 flex justify-between sm:hidden"> | ||||
|                             <a href="#" class="relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50" | ||||
|                             @click="paginate(current)"> Previous </a> | ||||
|                             <a href="#" class="ml-3 relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50" | ||||
|                             @click="paginate(current+2)"> Next </a> | ||||
|                             </div> | ||||
|                             <div class="hidden sm:flex-1 sm:flex sm:items-center sm:justify-between"> | ||||
|                                 <div> | ||||
|                                     <p class="text-sm text-gray-700"> | ||||
|                                     Résultats | ||||
|                                     <span class="font-medium" x-text="Math.min((current * 10)+1, state.count)"></span> | ||||
|                                     à | ||||
|                                     <span class="font-medium" x-text="Math.min((current * 10)+10, state.count)"></span> | ||||
|                                     sur | ||||
|                                     <span class="font-medium" x-text="state.count"></span> | ||||
|                                     </p> | ||||
|                                 </div> | ||||
|                                 <div> | ||||
|                                     <nav class="relative z-0 inline-flex rounded-md shadow-sm -space-x-px" aria-label="Pagination"> | ||||
|                                     <a href="#" class="relative inline-flex items-center px-2 py-2 rounded-l-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50" | ||||
|                                         @click="paginate(current)"> | ||||
|                                         <span class="sr-only">Previous</span> | ||||
|                                         <!-- Heroicon name: solid/chevron-left --> | ||||
|                                         <svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"> | ||||
|                                         <path fill-rule="evenodd" d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" clip-rule="evenodd" /> | ||||
|                                         </svg> | ||||
|                                     </a> | ||||
|                                     <template x-for="i in nb_pages"> | ||||
|                                         <a href="#" @click="paginate(i)" | ||||
|                                         class="relative inline-flex items-center px-4 py-2 border text-sm font-medium" | ||||
|                                         :class="i == current+1 ? 'z-10 bg-indigo-50 border-co-blue text-co-blue' : 'bg-white border-gray-300 text-gray-500 hover:bg-gray-50'" | ||||
|                                         x-text="i"></a> | ||||
|                                     </template> | ||||
|                                     <!-- Current: "z-10 bg-indigo-50 border-indigo-500 text-indigo-600", Default: "bg-white border-gray-300 text-gray-500 hover:bg-gray-50" --> | ||||
|                                     <a href="#" class="relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50" | ||||
|                                         @click="paginate(current+2)"> | ||||
|                                         <span class="sr-only">Next</span> | ||||
|                                         <!-- Heroicon name: solid/chevron-right --> | ||||
|                                         <svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"> | ||||
|                                         <path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd" /> | ||||
|                                         </svg> | ||||
|                                     </a> | ||||
|                                     </nav> | ||||
|                                 </div> | ||||
|                             </div> | ||||
|                         </div> | ||||
|                     </div> | ||||
|                 </div> | ||||
|             </div> | ||||
|         </div> | ||||
|         <p id="booking_name"></p> | ||||
|         </div> | ||||
|     </div> | ||||
| </main> | ||||
| {{end}} | ||||
|  | @ -0,0 +1,165 @@ | |||
| {{define "content"}} | ||||
| <main> | ||||
|     <div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8"> | ||||
|         <h1 class="text-2xl font-semibold text-gray-900"> | ||||
|             Transport Solidaire | ||||
|         </h1> | ||||
|     </div> | ||||
|     <div> | ||||
|         <div class="-my-2 -mx-4 overflow-x-auto sm:-mx-6 lg:-mx-8"> | ||||
|             <div class="mt-8 max-w-3xl mx-auto grid grid-cols-1 gap-6 lg:max-w-7xl lg:grid-flow-col-dense lg:grid-cols-3"> | ||||
|                 <form class="space-y-6" method="GET" name="driver_journeys" @submit="submit">                 | ||||
|                      | ||||
|                         <div class="border-t border-gray-200 px-4 py-5 sm:px-6">     | ||||
|                             {{ $departureField := "departure" }} | ||||
|                             {{ $departureLabel := "Départ" }} | ||||
|                             {{ template "address_autocomplete" dict "FieldName" $departureField "FieldLabel" $departureLabel }} | ||||
|                      | ||||
|                             {{ $destinationField := "destination" }} | ||||
|                             {{ $destinationLabel := "Destination" }} | ||||
|                             {{ template "address_autocomplete" dict "FieldName" $destinationField "FieldLabel" $destinationLabel }} | ||||
|      | ||||
|                             <div class="py-4 grid grid-cols-2"> | ||||
|                                 <div class="lg:col-span-1"> | ||||
|                                     <label for="date" class="block text-sm font-medium text-gray-700">Le</label> | ||||
|                                     <div class="mt-1"> | ||||
|                                         <input type="datetime-local" id="date" name="date"  | ||||
|                                             class="shadow-sm focus:ring-co-blue focus:border-co-blue block w-full sm:text-sm border-gray-300 rounded-l-2xl border-r-1"> | ||||
|                                     </div> | ||||
|                                 </div>  | ||||
|                             </div> | ||||
|                             <input type="submit" | ||||
|                                     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"  | ||||
|                                     value="Chercher un Conducteurs">                | ||||
|                         </div> | ||||
|                 </div> | ||||
|                 </form> | ||||
|                 <div class="bg-white shadow sm:rounded-2xl"> | ||||
| 
 | ||||
|                     <form class="space-y-6" method="POST" name="create_booking"> | ||||
|                      | ||||
|                         <div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8" x-data="{ | ||||
|                             state: {{.ViewState.JSONWithLimits 0 10}}, | ||||
|                             current: 0, | ||||
|                             nb_pages() { | ||||
|                                 let nbEl = this.state.count  | ||||
|                                 return Math.ceil(nbEl/10) | ||||
|                             }, | ||||
|                             async paginate(page) { | ||||
|                                 let start = (page-1)*10 | ||||
|                                 if(start < 0|| start > this.state.count) { | ||||
|                                     return | ||||
|                                 } | ||||
|                                 let resp = await fetch('/api/cache/' + this.state.cache_id + '?limits.min=' + start + '&limits.max=' + (start+10)) | ||||
|                                 let data = await resp.json() | ||||
|                                 this.state.drivers = data | ||||
|                                 this.current=page-1 | ||||
|                             } | ||||
|                         }"> | ||||
|                         <h2 class="text-lg font-medium text-gray-900 p-4 sm:px-6"> | ||||
|                             Sélectionner un Conducteurs | ||||
|                         </h2> | ||||
|                         <div class="border-t border-gray-200 px-4 py-5 sm:px-6"> | ||||
| 
 | ||||
|                             <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"> | ||||
|                                                 <tbody class="divide-y divide-gray-200 bg-white"> | ||||
|                                                     <template x-for="driver in state.drivers.driver_journeys"> | ||||
|                                                         <tr> | ||||
|                                                             <td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6"> | ||||
|                                                                 <div class="flex items-center"> | ||||
|                                                                     <button type="button" @click=" | ||||
|                                                                     document.getElementById('driver_id').value = driver.user.id | ||||
|                                                                     document.getElementById('driver_name').textContent = driver.user.first_name+' '+driver.user.last_name" class="ml-4">                                                               | ||||
|                                                                         <div class="font-medium text-gray-900"> | ||||
|                                                                             <span | ||||
|                                                                             x-text="driver.user.first_name"> | ||||
|                                                                             </span> | ||||
|                                                                             <span | ||||
|                                                                                 x-text="driver.user.last_name"> | ||||
|                                                                             </span> | ||||
|                                                                         </div> | ||||
|                                                                     </button> | ||||
|                                                                 </div> | ||||
|                                                             </td> | ||||
|                                                             <td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500"> | ||||
|                                                              | ||||
|                                                             </td> | ||||
|                                                             <td | ||||
|                                                                 class="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6"> | ||||
|                                                              | ||||
|                                                             </td> | ||||
|                                                         </tr> | ||||
|                                                     </template> | ||||
|                          | ||||
|                                                     <!-- More people... --> | ||||
|                                                 </tbody> | ||||
|                                             </table> | ||||
|                                             <div class="bg-white px-4 py-3 flex items-center justify-between border-t border-gray-200 sm:px-6"> | ||||
|                                                 <div class="flex-1 flex justify-between sm:hidden"> | ||||
|                                                 <a href="#" class="relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50" | ||||
|                                                 @click="paginate(current)"> Previous </a> | ||||
|                                                 <a href="#" class="ml-3 relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50" | ||||
|                                                 @click="paginate(current+2)"> Next </a> | ||||
|                                                 </div> | ||||
|                                                 <div class="hidden sm:flex-1 sm:flex sm:items-center sm:justify-between"> | ||||
|                                                     <div> | ||||
|                                                         <p class="text-sm text-gray-700"> | ||||
|                                                         Résultats | ||||
|                                                         <span class="font-medium" x-text="Math.min((current * 10)+1, state.count)"></span> | ||||
|                                                         à | ||||
|                                                         <span class="font-medium" x-text="Math.min((current * 10)+10, state.count)"></span> | ||||
|                                                         sur | ||||
|                                                         <span class="font-medium" x-text="state.count"></span> | ||||
|                                                         </p> | ||||
|                                                     </div> | ||||
|                                                     <div> | ||||
|                                                         <nav class="relative z-0 inline-flex rounded-md shadow-sm -space-x-px" aria-label="Pagination"> | ||||
|                                                         <a href="#" class="relative inline-flex items-center px-2 py-2 rounded-l-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50" | ||||
|                                                             @click="paginate(current)"> | ||||
|                                                             <span class="sr-only">Previous</span> | ||||
|                                                             <!-- Heroicon name: solid/chevron-left --> | ||||
|                                                             <svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"> | ||||
|                                                             <path fill-rule="evenodd" d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" clip-rule="evenodd" /> | ||||
|                                                             </svg> | ||||
|                                                         </a> | ||||
|                                                         <template x-for="i in nb_pages"> | ||||
|                                                             <a href="#" @click="paginate(i)" | ||||
|                                                             class="relative inline-flex items-center px-4 py-2 border text-sm font-medium" | ||||
|                                                             :class="i == current+1 ? 'z-10 bg-indigo-50 border-co-blue text-co-blue' : 'bg-white border-gray-300 text-gray-500 hover:bg-gray-50'" | ||||
|                                                             x-text="i"></a> | ||||
|                                                         </template> | ||||
|                                                         <!-- Current: "z-10 bg-indigo-50 border-indigo-500 text-indigo-600", Default: "bg-white border-gray-300 text-gray-500 hover:bg-gray-50" --> | ||||
|                                                         <a href="#" class="relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50" | ||||
|                                                             @click="paginate(current+2)"> | ||||
|                                                             <span class="sr-only">Next</span> | ||||
|                                                             <!-- Heroicon name: solid/chevron-right --> | ||||
|                                                             <svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"> | ||||
|                                                             <path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd" /> | ||||
|                                                             </svg> | ||||
|                                                         </a> | ||||
|                                                         </nav> | ||||
|                                                     </div> | ||||
|                                                 </div> | ||||
|                                             </div> | ||||
|                                         </div> | ||||
|                                     </div> | ||||
|                                 </div> | ||||
|                             </div> | ||||
|                             <p id="driver_name"></p> | ||||
|                             <input type="hidden" id="driver_id" name="driver_id" > | ||||
|                             <input type="submit" | ||||
|                             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"  | ||||
|                             value="Confirmer"> | ||||
|                             </div> | ||||
|                         </div> | ||||
|                     </form> | ||||
|                 </div> | ||||
|             </div> | ||||
|         </div> | ||||
|     </div> | ||||
| </main> | ||||
| {{end}} | ||||
|  | @ -0,0 +1,305 @@ | |||
| {{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 conducteur</h1> | ||||
| </div> | ||||
| 
 | ||||
| <div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8 mt-8" | ||||
|     x-data="{ | ||||
|         fields: { | ||||
|             first_name: null, | ||||
|             last_name: null, | ||||
|             email: null, | ||||
|             phone_number: null, | ||||
|             birthdate: null, | ||||
|             file_number: null | ||||
|         }, | ||||
|         | ||||
|         formValidation: { | ||||
|             valid: false, | ||||
|             fields: { | ||||
|                 first_name: {valid: null}, | ||||
|                 last_name: {valid: null}, | ||||
|                 email: {valid: null}, | ||||
|                 phone_number: {valid: null}, | ||||
|                 birthdate: {valid: null}, | ||||
|                 file_number: {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 personnelles sur le conducteur obligatoires | ||||
|                         pour créer son profil 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="first_name" class="block text-sm font-medium text-gray-700">Prénom</label> | ||||
|                             <input type="text" name="first_name" id="first_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.first_name" @blur="validateField('first_name')" | ||||
|                                 :class="formValidation.fields.first_name.valid == false ? 'border-co-red border-2' : 'border-gray-300'"> | ||||
|                         </div> | ||||
| 
 | ||||
|                         <div class="col-span-6 sm:col-span-3"> | ||||
|                             <label for="last_name" class="block text-sm font-medium text-gray-700">Nom</label> | ||||
|                             <input type="text" name="last_name" id="last_name" autocomplete="family-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.last_name" @blur="validateField('last_name')" | ||||
|                                 :class="formValidation.fields.last_name.valid == false ? 'border-co-red border-2' : 'border-gray-300'"> | ||||
|                         </div> | ||||
| 
 | ||||
|                         <div class="col-span-6 sm:col-span-3"> | ||||
|                             <label for="email" class="block text-sm font-medium text-gray-700">Email</label> | ||||
|                             <input type="text" name="email" id="email" autocomplete="email" | ||||
|                                 class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl" | ||||
|                                 x-model="fields.email" @blur="validateField('email')" | ||||
|                                 :class="formValidation.fields.email.valid == false ? 'border-co-red border-2' : 'border-gray-300'"> | ||||
|                         </div> | ||||
| 
 | ||||
|                         <div class="col-span-6 sm:col-span-3"> | ||||
|                             <label for="phone_number" class="block text-sm font-medium text-gray-700">Numéro de | ||||
|                                 téléphone</label> | ||||
|                             <input type="text" name="phone_number" id="phone_number" autocomplete="phone" placeholder="+33612345678" | ||||
|                                 class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl" | ||||
|                                 x-model="fields.phone_number" @blur="validateField('phone_number')" | ||||
|                                 :class="formValidation.fields.phone_number.valid == false ? 'border-co-red border-2' : 'border-gray-300'"> | ||||
|                         </div> | ||||
| 
 | ||||
|                         <div class="col-span-6 sm:col-span-3"> | ||||
|                             <label for="birthdate" class="block text-sm font-medium text-gray-700">Date de | ||||
|                                 naissance</label> | ||||
|                             <input type="date" name="birthdate" id="birthdate" autocomplete="birthdate" placeholder="JJ/MM/AAAA" | ||||
|                                 class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl" | ||||
|                                 x-model="fields.birthdate" @blur="validateField('birthdate')" | ||||
|                                 :class="formValidation.fields.birthdate.valid == false ? 'border-co-red border-2' : 'border-gray-300'"> | ||||
|                         </div> | ||||
|                         | ||||
|                     </div> | ||||
|                 </div> | ||||
|             </div> | ||||
|         </div> | ||||
| 
 | ||||
|         <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 optionnelles</h3> | ||||
|                     <p class="mt-1 text-sm text-gray-500">Autres informations de profil optionnelles</p> | ||||
|                 </div> | ||||
|                 <div class="mt-5 space-y-6 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="gender" class="block text-sm font-medium text-gray-700">Genre</label> | ||||
|                             <div class="sm:mt-0 sm:col-span-2"> | ||||
|                                 <select id="gender" name="gender" autocomplete="gender" x-model="gender" | ||||
|                                     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 border-gray-300 rounded-2xl"> | ||||
|                                     <option value="0">Inconnu</option> | ||||
|                                     <option value="1">Masculin</option> | ||||
|                                     <option value="2">Féminin</option> | ||||
|                                     <option value="9">Sans objet</option> | ||||
|                                 </select> | ||||
|                             </div> | ||||
|                         </div> | ||||
| 
 | ||||
|                         <!-- <div class="col-span-3 sm:col-span-3"> | ||||
|                             <label class="block text-sm font-medium text-gray-700"> Photo </label> | ||||
|                             <div class="mt-1 flex items-center space-x-5"> | ||||
|                                 <span class="inline-block h-12 w-12 rounded-co overflow-hidden bg-gray-100"> | ||||
|                                     {{.IconSet.Icon "img:profile-picture-placeholder" "h-full w-full"}} | ||||
|                                 </span> | ||||
|                                 <button type="button" | ||||
|                                     class="bg-white py-2 px-3 border border-gray-300 rounded-2xl shadow-sm text-sm leading-4 font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-co-blue"> | ||||
|                                     Charger la photo | ||||
|                                 </button> | ||||
|                             </div> | ||||
|                         </div> --> | ||||
| 
 | ||||
| 
 | ||||
|                     </div> | ||||
|                 </div> | ||||
|             </div> | ||||
|         </div> | ||||
|         <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">Paramètres</h3> | ||||
|                     <p class="mt-1 text-sm text-gray-500">Paramètres liés au conducteur, utiles pour exploiter les fonctionnalités de PARCOURSMOB</p> | ||||
|                 </div> | ||||
|             </div> | ||||
|         </div>  | ||||
| 
 | ||||
|         <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 conducteur solidaire</h3> | ||||
|                     <p class="mt-1 text-sm text-gray-500">Informations personnelles sur le conducteur obligatoires | ||||
|                         pour créer son profil 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="model" class="block text-sm font-medium text-gray-700">Model</label> | ||||
|                             <input type="text" name="model" id="model"  | ||||
|                                 class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm  rounded-2xl" | ||||
|                                 :class="border-gray-300"> | ||||
|                         </div> | ||||
|                         <div class="col-span-6 sm:col-span-3"> | ||||
|                             <label for="brand" class="block text-sm font-medium text-gray-700">Marque</label> | ||||
|                             <input type="text" name="brand" id="brand"  | ||||
|                                 class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm  rounded-2xl" | ||||
|                                 :class="border-gray-300"> | ||||
|                         </div> | ||||
|                         <div class="col-span-6 sm:col-span-3"> | ||||
|                             <label for="radius" class="block text-sm font-medium text-gray-700">Périmètre de service </label> | ||||
|                             <input type="number" name="radius" id="radius"  | ||||
|                                 class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm  rounded-2xl" | ||||
|                                 :class="border-gray-300"> | ||||
|                         </div> | ||||
|                         <div class="col-span-6 sm:col-span-3"> | ||||
|                             <label for="alias" class="block text-sm font-medium text-gray-700">Alias</label> | ||||
|                             <input type="text" name="alias" id="alias"  | ||||
|                                 class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm  rounded-2xl" | ||||
|                                 :class="border-gray-300"> | ||||
|                         </div> | ||||
|                         <div class="col-span-6 sm:col-span-3"> | ||||
|                             <label for="grade" class="block text-sm font-medium text-gray-700">Grade</label> | ||||
|                             <input type="text" name="grade" id="grade"  | ||||
|                                 class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm  rounded-2xl" | ||||
|                                 :class="border-gray-100"> | ||||
|                         </div>   | ||||
|                         <div class="col-span-6 sm:col-span-3"> | ||||
| 
 | ||||
|                             {{ $fieldName := "address" }} | ||||
|                             {{ template "address_autocomplete" dict "FieldName" $fieldName }} | ||||
|          | ||||
|                             <!-- will dolater : tags, groups, ... --> | ||||
|          | ||||
|                         </div>                      | ||||
|                     </div> | ||||
|                 </div> | ||||
|             </div> | ||||
|         </div> | ||||
|        | ||||
|         <div x-data="{ | ||||
|             days : [ | ||||
|             'Monday' , | ||||
|             'Tuesday' , | ||||
|             'Wednesday' , | ||||
|             'Thursday' , | ||||
|             'Friday' , | ||||
|             'Saturday' , | ||||
|             'Sunday' , | ||||
|             ], | ||||
| 
 | ||||
|             hours : [ | ||||
|             '12:00 AM', | ||||
|             '01:00 AM', | ||||
|             '02:00 AM', | ||||
|             '03:00 AM', | ||||
|             '04:00 AM', | ||||
|             '05:00 AM', | ||||
|             '06:00 AM', | ||||
|             '07:00 AM', | ||||
|             '08:00 AM', | ||||
|             '09:00 AM', | ||||
|             '10:00 AM', | ||||
|             '11:00 AM', | ||||
|             '12:00 PM', | ||||
|             '01:00 PM', | ||||
|             '02:00 PM', | ||||
|             '03:00 PM', | ||||
|             '04:00 PM', | ||||
|             '05:00 PM', | ||||
|             '06:00 PM', | ||||
|             '07:00 PM', | ||||
|             '08:00 PM', | ||||
|             '09:00 PM', | ||||
|             '10:00 PM', | ||||
|             '11:00 PM' | ||||
|             ], | ||||
| 
 | ||||
|             confirmAvailabilities() { | ||||
|                 const driverAvailabilities = []; | ||||
| 
 | ||||
|                 this.days.forEach(day  => { | ||||
|                     this.hours.forEach(hour => { | ||||
|                         let checkbox = document.getElementById('hour-' + day + '-' + hour).checked; | ||||
|                         if( checkbox && checkbox === true){ | ||||
|                             const startTime = hour; | ||||
|                             const endTime = hour; | ||||
|      | ||||
|                             const availabilitySlot = { | ||||
|                                 DayOfWeek: day,  | ||||
|                                 StartTime: startTime, | ||||
|                                 EndTime: endTime, | ||||
|                             }; | ||||
|      | ||||
|                             driverAvailabilities.push(availabilitySlot); | ||||
|                         } | ||||
|                     }) | ||||
|                 }) | ||||
|                 console.log(driverAvailabilities); | ||||
|                 let availabilities = document.getElementById('availabilities'); | ||||
|                 availabilities.value = JSON.stringify(driverAvailabilities); | ||||
|                 return | ||||
|                  | ||||
|             } | ||||
|         }"> | ||||
|         <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">Disponibilitées</h3> | ||||
|                     <p class="mt-1 text-sm text-gray-500">La définition de vos horraires permet de vous proposer des trajés uniquement quand vous serai disponible.  </p> | ||||
|                 </div> | ||||
|             </div> | ||||
|         </div> | ||||
|         <div class="grid grid-cols-1 grid-rows-7 gap-4"> | ||||
|         <template x-for="day in days" :key="day" > | ||||
|             <div class="mb-4 gap-2 mt-4 bg-white shadow px-4 py-5 sm:rounded-lg sm:p-6">  | ||||
|                 <label :for="'day-select-'+ day" class="block text-sm font-medium select-none transition-colors duration-200 hover:text-gray-900 text-center mb-4" x-text="day"></label> | ||||
|                 <div :name="day" :id="'day-select-' + day" class="grid grid-cols-6 grid-rows-2"> | ||||
|                         <template x-for="hour in hours" :key="hour"> | ||||
|                             <div class="flex flex-col items-center mb-4 "> | ||||
|                                 <input :id="'hour-' + day + '-' + hour" type="checkbox"  x-value="hour" class="mt-1 focus:ring-co-blue focus:border-co-blue block shadow-sm sm:text-sm text-xl py-2 px-4 h-12 rounded-2xl w-auto"></input> | ||||
|                                 <label :for="'hour-' + day + '-' + hour" x-text="hour" class="block text-sm font-medium text-gray-700 select-none transition-colors duration-200 hover:text-gray-900 text-center "></label> | ||||
|                             </div> | ||||
|                         </template> | ||||
|                 </div> | ||||
|             </div> | ||||
|         </template> | ||||
|     </div> | ||||
|         <input type="hidden" id="availabilities" name="availabilities" > | ||||
|         <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/"> | ||||
|                 <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="button" @click="confirmAvailabilities()" | ||||
|         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">Confirmer les horaires</button> | ||||
|             <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 conducteur</button> | ||||
|         </div> | ||||
|     </form> | ||||
| </div> | ||||
| {{end}} | ||||
|  | @ -0,0 +1,123 @@ | |||
| 
 | ||||
| {{define "driver_solidarity_list" }} | ||||
| <main> | ||||
|                          | ||||
|         <div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8 px-4 py-5 sm:px-6" x-data="{ | ||||
|             state: {{.ViewState.JSONWithLimits 0 10}}, | ||||
|             current: 0, | ||||
|             nb_pages() { | ||||
|                 let nbEl = this.state.count  | ||||
|                 return Math.ceil(nbEl/10) | ||||
|             }, | ||||
|             async paginate(page) { | ||||
|                 let start = (page-1)*10 | ||||
|                 if(start < 0|| start > this.state.count) { | ||||
|                     return | ||||
|                 } | ||||
|                 let resp = await fetch('/api/cache/' + this.state.cache_id + '?limits.min=' + start + '&limits.max=' + (start+10)) | ||||
|                 let data = await resp.json() | ||||
|                 this.state.drivers = data | ||||
|                 this.current=page-1 | ||||
|             } | ||||
| 
 | ||||
|         }"> | ||||
|         <h1 class="text-2xl font-semibold text-gray-900">            Conducteurs | ||||
|         </h1> | ||||
|         <div class="px-4 py-5 sm:px-6"> | ||||
|             <a | ||||
|              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"  | ||||
|              href="driver/create">Ajouter un conducteur solidaire</a> | ||||
|             <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"> | ||||
|                                 <tbody class="divide-y divide-gray-200 bg-white"> | ||||
|                                     <template x-for="driver in state.drivers.driver_journeys"> | ||||
|                                         <tr> | ||||
|                                             <td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6"> | ||||
|                                                 <div class="flex items-center"> | ||||
|                                                     <button type="button" @click=" | ||||
|                                                     document.getElementById('driver_id').value = driver.id | ||||
|                                                     document.getElementById('driver_name').textContent = driver.first_name+' '+driver.last_name" class="ml-4">                                                               | ||||
|                                                         <div class="font-medium text-gray-900"> | ||||
|                                                             <span | ||||
|                                                             x-text="driver.first_name"> | ||||
|                                                             </span> | ||||
|                                                             <span | ||||
|                                                                 x-text="driver.last_name"> | ||||
|                                                             </span> | ||||
|                                                         </div> | ||||
|                                                     </button> | ||||
|                                                 </div> | ||||
|                                             </td> | ||||
|                                             <td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500"> | ||||
|                                              | ||||
|                                             </td> | ||||
|                                             <td | ||||
|                                                 class="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6"> | ||||
|                                              | ||||
|                                             </td> | ||||
|                                         </tr> | ||||
|                                     </template> | ||||
|          | ||||
|                                     <!-- More people... --> | ||||
|                                 </tbody> | ||||
|                             </table> | ||||
|                             <div class="bg-white px-4 py-3 flex items-center justify-between border-t border-gray-200 sm:px-6"> | ||||
|                                 <div class="flex-1 flex justify-between sm:hidden"> | ||||
|                                 <a href="#" class="relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50" | ||||
|                                 @click="paginate(current)"> Previous </a> | ||||
|                                 <a href="#" class="ml-3 relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50" | ||||
|                                 @click="paginate(current+2)"> Next </a> | ||||
|                                 </div> | ||||
|                                 <div class="hidden sm:flex-1 sm:flex sm:items-center sm:justify-between"> | ||||
|                                     <div> | ||||
|                                         <p class="text-sm text-gray-700"> | ||||
|                                         Résultats | ||||
|                                         <span class="font-medium" x-text="Math.min((current * 10)+1, state.count)"></span> | ||||
|                                         à | ||||
|                                         <span class="font-medium" x-text="Math.min((current * 10)+10, state.count)"></span> | ||||
|                                         sur | ||||
|                                         <span class="font-medium" x-text="state.count"></span> | ||||
|                                         </p> | ||||
|                                     </div> | ||||
|                                     <div> | ||||
|                                         <nav class="relative z-0 inline-flex rounded-md shadow-sm -space-x-px" aria-label="Pagination"> | ||||
|                                         <a href="#" class="relative inline-flex items-center px-2 py-2 rounded-l-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50" | ||||
|                                             @click="paginate(current)"> | ||||
|                                             <span class="sr-only">Previous</span> | ||||
|                                             <!-- Heroicon name: solid/chevron-left --> | ||||
|                                             <svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"> | ||||
|                                             <path fill-rule="evenodd" d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" clip-rule="evenodd" /> | ||||
|                                             </svg> | ||||
|                                         </a> | ||||
|                                         <template x-for="i in nb_pages"> | ||||
|                                             <a href="#" @click="paginate(i)" | ||||
|                                             class="relative inline-flex items-center px-4 py-2 border text-sm font-medium" | ||||
|                                             :class="i == current+1 ? 'z-10 bg-indigo-50 border-co-blue text-co-blue' : 'bg-white border-gray-300 text-gray-500 hover:bg-gray-50'" | ||||
|                                             x-text="i"></a> | ||||
|                                         </template> | ||||
|                                         <!-- Current: "z-10 bg-indigo-50 border-indigo-500 text-indigo-600", Default: "bg-white border-gray-300 text-gray-500 hover:bg-gray-50" --> | ||||
|                                         <a href="#" class="relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50" | ||||
|                                             @click="paginate(current+2)"> | ||||
|                                             <span class="sr-only">Next</span> | ||||
|                                             <!-- Heroicon name: solid/chevron-right --> | ||||
|                                             <svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"> | ||||
|                                             <path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd" /> | ||||
|                                             </svg> | ||||
|                                         </a> | ||||
|                                         </nav> | ||||
|                                     </div> | ||||
|                                 </div> | ||||
|                             </div> | ||||
|                         </div> | ||||
|                     </div> | ||||
|                 </div> | ||||
|             </div> | ||||
|             <p id="driver_name"></p> | ||||
|             <input type="hidden" id="driver_id" name="driver_id" > | ||||
|             </div> | ||||
|         </div> | ||||
| </main> | ||||
| {{end}} | ||||
|  | @ -0,0 +1,36 @@ | |||
| {{define "beneficiary_solidarity"}} | ||||
| <div class="px-4 py-6 sm:px-6"> | ||||
|     <h3 class="text-lg">Transport solidaire</h3> | ||||
|         {{ $bookingSolidarity := len .ViewState.bookingSolidarity }} | ||||
|         {{if eq $bookingSolidarity 0}}  | ||||
|         <p class="py-5 mt-1 max-w-2xl text-sm text-gray-500">Aucune course Silvermobi n'est prévue pour le moment.</p> | ||||
|         <div> | ||||
|             <form method="POST" @submit="submit"> | ||||
|             <button | ||||
|                 type="submit" | ||||
|                 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"> | ||||
|                 Inscription aux Transports Solidaires | ||||
|             </button> | ||||
|             </form> | ||||
|         </div> | ||||
|         {{else}} | ||||
|         <table class="min-w-full divide-y divide-gray-300"> | ||||
|             <tbody class="divide-y divide-gray-200 bg-white"> | ||||
|                 <tr> | ||||
|                     <th>Date</th> | ||||
|                     <th>Conducteur</th> | ||||
|                     <th>Passager</th> | ||||
|                 </tr> | ||||
|             | ||||
|             {{range .ViewState.bookingSolidarity}} | ||||
|                 <tr>      | ||||
|                     <td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">{{( .PassengerPickupDate)}}</td> | ||||
|                     <td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">{{.Driver.FirstName}} {{.Driver.LastName}}</td> | ||||
|                     <td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">{{.Passenger.FirstName}} {{.Passenger.LastName}} </td> | ||||
|                 </tr> | ||||
|                 {{end}} | ||||
|             </tbody> | ||||
|         </table> | ||||
|         {{end}} | ||||
|     </div> | ||||
| {{end}} | ||||
|  | @ -0,0 +1,47 @@ | |||
| {{define "content"}} | ||||
| <main> | ||||
|     <div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8 px-4 py-5 sm:px-6"> | ||||
|         <h1 class="text-2xl font-semibold text-gray-900"> | ||||
|             Transport Solidaire | ||||
|         </h1> | ||||
|     </div> | ||||
|     <section aria-labelledby="functionalities-title" x-data="{ | ||||
|         tab: 'beneficiaries', | ||||
|         to(event) { | ||||
|             this.tab = event.target.value | ||||
|         } | ||||
|     }"> | ||||
|     <div class="bg-white shadow sm:rounded-lg sm:overflow-hidden px-4 py-5 sm:px-6"> | ||||
|         <div class="divide-y divide-gray-200"> | ||||
|             <div> | ||||
|                 <div class="hidden sm:block"> | ||||
|                     <div class="border-b border-gray-200 pl-4"> | ||||
|                         <nav class="-mb-px flex space-x-8" aria-label="Tabs">  | ||||
|                             <a href="#" @click="tab = 'beneficiaries'" | ||||
|                                 class="whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm" | ||||
|                                 :class="tab == 'documents' ? 'border-co-blue text-co-blue' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'"> | ||||
|                                 Bénéficiaires </a> | ||||
| 
 | ||||
|                             <a href="#" @click="tab = 'drivers'" | ||||
|                                 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'"> | ||||
|                                 Conducteurs </a> | ||||
|                              | ||||
|                             <a href="#" @click="tab = 'solidarityService'" | ||||
|                                 class="whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm" | ||||
|                                 :class="tab == 'solidarityService' ? 'border-co-blue text-co-blue' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'"> | ||||
|                                 Trajets Solidaire </a> | ||||
|                         </nav> | ||||
|                     </div> | ||||
|                 </div> | ||||
|             </div> | ||||
| 
 | ||||
|             <div x-show="tab == 'beneficiaries'">{{template "beneficiary_solidarity_list" .}}</div> | ||||
|             <div x-show="tab == 'drivers'">{{template "driver_solidarity_list" .}}</div> | ||||
|             <div x-show="tab == 'solidarityService'">{{template "booking_solidarity_list" .}}</div> | ||||
| 
 | ||||
|         </div> | ||||
|     </div> | ||||
|     </section> | ||||
| </main> | ||||
| {{end}} | ||||
		Loading…
	
		Reference in New Issue