solidarity carpool
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
|
||||
{{ define "solidarity_bookings_history" }}
|
||||
{{if eq (len .ViewState.bookings_history) 0}}
|
||||
<div class="m-10 text-center text-gray-600">Aucun trajet dans le passé</div>
|
||||
{{else}}
|
||||
<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">
|
||||
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">
|
||||
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">
|
||||
Départ
|
||||
</th>
|
||||
<th scope="col"
|
||||
class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">
|
||||
Destination
|
||||
</th>
|
||||
<th scope="col"
|
||||
class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">
|
||||
Date
|
||||
</th>
|
||||
<th scope="col"
|
||||
class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">
|
||||
Statut
|
||||
</th>
|
||||
<th scope="col"
|
||||
class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">
|
||||
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-200 bg-white">
|
||||
{{range .ViewState.bookings_history}}
|
||||
<tr>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
|
||||
<a class="text-co-blue" href="/app/solidarity-transport/drivers/{{.DriverId}}">
|
||||
{{ (index $.ViewState.drivers_map .DriverId).Data.first_name }}
|
||||
{{ (index $.ViewState.drivers_map .DriverId).Data.last_name }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
|
||||
<a class="text-co-blue" href="/app/beneficiaries/{{.PassengerId}}">
|
||||
{{ (index $.ViewState.passengers_map .PassengerId).Data.first_name }}
|
||||
{{ (index $.ViewState.passengers_map .PassengerId).Data.last_name }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="py-4 pl-4 pr-3 text-sm sm:pl-6">
|
||||
{{ .Journey.PassengerPickup.Properties.label }}
|
||||
</td>
|
||||
<td class="py-4 pl-4 pr-3 text-sm sm:pl-6">
|
||||
{{ .Journey.PassengerDrop.Properties.label }}
|
||||
</td>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
|
||||
{{ .Journey.PassengerPickupDate.Format "02/01/2006 15:04" }}
|
||||
</td>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
|
||||
{{ if eq .Status "WAITING_CONFIRMATION"}}
|
||||
<span class="p-1 text-xs bg-gray-300 rounded-xl">Attente confirmation</span>
|
||||
{{ else if eq .Status "VALIDATED"}}
|
||||
<span class="p-1 text-xs bg-co-green rounded-xl">Validé</span>
|
||||
{{ else if eq .Status "CANCELLED"}}
|
||||
<span class="p-1 text-xs bg-co-red text-white rounded-xl">Annulé</span>
|
||||
{{ end }}
|
||||
</td>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
|
||||
<a class="text-co-blue" href="/app/solidarity-transport/bookings/{{.Id}}">
|
||||
Voir
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</tbody>
|
||||
</table>
|
||||
{{end}}
|
||||
{{end}}
|
||||
@@ -52,7 +52,11 @@
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">{{if .Data.address}}{{.Data.address.properties.label}}{{end}}</td>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">{{ .Data.phone_number }}</td>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
|
||||
{{if and .Data.other_properties (gt .Data.other_properties.last_subscription_date "2025")}}
|
||||
<span class="p-1 px-2 text-xs bg-co-green rounded-2xl">Oui</span>
|
||||
{{else}}
|
||||
<span class="p-1 px-2 text-xs bg-co-red text-white rounded-2xl">Non</span>
|
||||
{{end}}
|
||||
</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"
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
<dt class="text-sm font-medium text-gray-500">Destination conducteur</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900">{{.driver_journey.DriverArrival.Properties.label}}</dd>
|
||||
</div>
|
||||
<div class="sm:col-span-1">
|
||||
<dt class="text-sm font-medium text-gray-500">Kilomètres passager</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900">{{.driver_journey.PassengerDistance}} km</dd>
|
||||
</div>
|
||||
@@ -54,35 +53,88 @@
|
||||
<div>
|
||||
<div id="map" class="w-full h-full"></div>
|
||||
<script>
|
||||
let protocol = new pmtiles.Protocol();
|
||||
maplibregl.addProtocol("pmtiles",protocol.tile);
|
||||
var map = new maplibregl.Map({
|
||||
container: 'map', // container id
|
||||
style: {
|
||||
version: 8,
|
||||
glyphs:'https://protomaps.github.io/basemaps-assets/fonts/{fontstack}/{range}.pbf',
|
||||
sprite: "https://protomaps.github.io/basemaps-assets/sprites/v4/light",
|
||||
sources: {
|
||||
"protomaps": {
|
||||
type: "vector",
|
||||
url: "pmtiles://https://coopgo-gis-data.s3.fr-par.scw.cloud/vector-tiles/pmtiles/europe-latest.pmtiles",
|
||||
// ^-- Remember to prefix the URL with pmtiles://
|
||||
attribution: '<a href="https://protomaps.com">Protomaps</a> © <a href="https://openstreetmap.org">OpenStreetMap</a>'
|
||||
},
|
||||
"points": {
|
||||
type: "geojson",
|
||||
data: {
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{{ json .driver_journey.DriverDeparture }},
|
||||
{{ json .driver_journey.PassengerPickup }},
|
||||
{{ json .driver_journey.PassengerDrop }},
|
||||
{{ json .driver_journey.DriverArrival }}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
layers: basemaps.layers("protomaps",basemaps.namedFlavor("light"),{lang:"en"})
|
||||
}
|
||||
style: "/public/maps/protomaps-light/style.json",
|
||||
});
|
||||
|
||||
const geojsonPoints = {
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{{ json .driver_journey.DriverDeparture }},
|
||||
{{ json .driver_journey.PassengerPickup }},
|
||||
{{ json .driver_journey.PassengerDrop }},
|
||||
{{ json .driver_journey.DriverArrival }}
|
||||
]
|
||||
}
|
||||
const driverGeojsonPoints = {
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{{ json .driver_journey.DriverDeparture }},
|
||||
{{ json .driver_journey.DriverArrival }}
|
||||
]
|
||||
}
|
||||
const passengerGeojsonPoints = {
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{{ json .driver_journey.PassengerPickup }},
|
||||
{{ json .driver_journey.PassengerDrop }},
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
map.on('load', async () => {
|
||||
{{if .driver_journey.JourneyPolyline}}
|
||||
var linestring = polyline.toGeoJSON('{{.driver_journey.JourneyPolyline}}');
|
||||
map.addSource('trip', {
|
||||
type: "geojson",
|
||||
data: linestring
|
||||
})
|
||||
map.addLayer({
|
||||
'id': 'trip',
|
||||
'type': 'line',
|
||||
'source': 'trip',
|
||||
'layout': {
|
||||
'line-join': 'round',
|
||||
'line-cap': 'round',
|
||||
},
|
||||
'paint': {
|
||||
'line-color': '#243887',
|
||||
'line-width': 3
|
||||
},
|
||||
});
|
||||
{{end}}
|
||||
|
||||
map.addSource('driver_points', {
|
||||
type: "geojson",
|
||||
data: driverGeojsonPoints
|
||||
})
|
||||
map.addLayer({
|
||||
'id': 'driver_points',
|
||||
'type': 'circle',
|
||||
'source': 'driver_points',
|
||||
'paint': {
|
||||
'circle-color': '#000'
|
||||
},
|
||||
});
|
||||
map.addSource('passenger_points', {
|
||||
type: "geojson",
|
||||
data: passengerGeojsonPoints
|
||||
})
|
||||
map.addLayer({
|
||||
'id': 'passenger_points',
|
||||
'type': 'circle',
|
||||
'source': 'passenger_points',
|
||||
'paint': {
|
||||
'circle-color': '#243887',
|
||||
'circle-radius': 8
|
||||
},
|
||||
});
|
||||
var bbox=turf.bbox(geojsonPoints)
|
||||
map.fitBounds(bbox, { padding: 30 })
|
||||
})
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user