Solidarity transport implementation

This commit is contained in:
2025-03-05 00:42:47 +01:00
parent 82773f090b
commit 0cc1c1451c
23 changed files with 701 additions and 93 deletions

View File

@@ -53,7 +53,7 @@
{{end}}
{{ if gt (len .ViewState.journeys.Journeys) 0}}
{{ if and .ViewState.journeys (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"}}
@@ -101,33 +101,10 @@
<div class="p-4 text-center">
<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>-->
<h3 class="p-4 text-lg">Transport solidaire</h3>
<table class="min-w-full divide-y divide-gray-300 border-gray-300 border-t-1">
<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">
Conducteurs disponibles
</th>
<th scope="col"
class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">
&nbsp;
</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200 bg-white">
{{ range .ViewState.solidarity_drivers }}
<tr>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">{{ .Data.first_name }} {{ .Data.last_name }}</td>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
<a class="text-co-blue hover:text-co-blue"
href="/app/solidarity-transport/drivers/{{.ID}}/match">
Organiser le transport solidaire
</a>
</td>
</tr>
{{ end }}
</tbody>
</table>
{{template "journeys_solidarity_transport" .}}
</div>
{{end}}

View File

@@ -1,6 +1,7 @@
{{define "journeys_others"}}
<!--VEHICLES-->
{{if moduleAvailable "vehicles"}}
<div class="p-4 flex text-sm text-grey-900">
<div class="flex-1">
{{.IconSet.Icon "tabler-icons:car" "h-6 w-6 inline-flex mr-4"}}
@@ -34,5 +35,5 @@
<div class="p-4 text-center">
<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>
{{end}}
{{end}}
{{end}}

View File

@@ -1,10 +1,11 @@
{{define "journeys_public_transit"}}
{{ if eq (len .ViewState.journeys.Journeys) 0}}
{{ if or (not .ViewState.journeys) (eq (len .ViewState.journeys.Journeys) 0)}}
<p class="p-12 text-gray-500 text-center text-md">Aucun transport en commun pour ce trajet.</p>
{{end}}
{{$first := true}}
{{if .ViewState.journeys}}
{{range .ViewState.journeys.Journeys}}
{{if $first}}
{{$first = false}}
@@ -78,4 +79,5 @@
</div>
</div>
{{end}}
{{end}}
{{end}}
{{end}}

View File

@@ -1,7 +1,7 @@
{{define "journeys_solidarity_transport"}}
{{ if eq (len .ViewState.solidarity_drivers) 0}}
{{ if eq (len .ViewState.driver_journeys) 0}}
<p class="p-12 text-gray-500 text-center text-md">Aucun conducteur solidaire disponible pour ce trajet.</p>
{{else}}
@@ -12,6 +12,14 @@
class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">
Conducteurs disponibles
</th>
<th scope="col"
class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">
Distance conducteur
</th>
<th scope="col"
class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">
Distance passager
</th>
<th scope="col"
class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">
&nbsp;
@@ -19,13 +27,16 @@
</tr>
</thead>
<tbody class="divide-y divide-gray-200 bg-white">
{{ range .ViewState.solidarity_drivers }}
{{ range .ViewState.driver_journeys }}
{{ $driver := (index $.ViewState.solidarity_drivers .DriverId)}}
<tr>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">{{ .Data.first_name }} {{ .Data.last_name }}</td>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">{{ $driver.Data.first_name }} {{ $driver.Data.last_name }}</td>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">{{ .DriverDistance }} km</td>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">{{ .PassengerDistance }} km</td>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
<a class="text-co-blue hover:text-co-blue"
href="/app/solidarity-transport/drivers/{{.ID}}/match">
Organiser le transport solidaire
href="/app/solidarity-transport/drivers/{{$driver.ID}}/journeys/{{.Id}}">
Organiser
</a>
</td>
</tr>