Improvements
This commit is contained in:
45
web/layouts/organized_carpool/_partials/booking_filters.html
Normal file
45
web/layouts/organized_carpool/_partials/booking_filters.html
Normal file
@@ -0,0 +1,45 @@
|
||||
{{ define "booking_filters" }}
|
||||
{{$tab := or .tab "carpoolService"}}
|
||||
|
||||
<form>
|
||||
|
||||
<input type="hidden" name="tab" value="{{$tab}}" />
|
||||
|
||||
<div class="flex flex-row justify-end flex-wrap">
|
||||
|
||||
<div class="m-4">
|
||||
<div>
|
||||
<label for="{{$tab}}_date_start" class="block text-sm/6 font-medium text-gray-900 dark:text-white">Dates (début / fin)</label>
|
||||
<div class="mt-2 flex">
|
||||
<input id="{{$tab}}_date_start" type="date" name="date_start" class="block w-full rounded-md bg-white px-3 py-1.5 text-base text-gray-900 outline-1 -outline-offset-1 outline-gray-300 placeholder:text-gray-400 focus:outline-2 focus:-outline-offset-2 focus:outline-indigo-600 sm:text-sm/6 dark:bg-white/5 dark:text-white dark:outline-white/10 dark:placeholder:text-gray-500 dark:focus:outline-co-blue" value="{{.filters.date_start}}" onchange="this.form.submit()" />
|
||||
<input id="{{$tab}}_date_end" type="date" name="date_end" class="mx-2 block w-full rounded-md bg-white px-3 py-1.5 text-base text-gray-900 outline-1 -outline-offset-1 outline-gray-300 placeholder:text-gray-400 focus:outline-2 focus:-outline-offset-2 focus:outline-indigo-600 sm:text-sm/6 dark:bg-white/5 dark:text-white dark:outline-white/10 dark:placeholder:text-gray-500 dark:focus:outline-co-blue" value="{{.filters.date_end}}" onchange="this.form.submit()" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="m-4">
|
||||
<label for="{{$tab}}_status" class="block text-sm/6 font-medium text-gray-900 dark:text-white">Statut</label>
|
||||
<div class="mt-2 grid grid-cols-1">
|
||||
<select id="{{$tab}}_status" name="status" class="col-start-1 row-start-1 w-full appearance-none rounded-md bg-white py-1.5 pr-8 pl-3 text-base text-gray-900 outline-1 -outline-offset-1 outline-gray-300 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-indigo-600 sm:text-sm/6 dark:bg-white/5 dark:text-white dark:outline-white/10 dark:*:bg-gray-800 dark:focus-visible:outline-co-blue" onchange="this.form.submit()">
|
||||
<option></option>
|
||||
<option value="VALIDATED"{{if eq .filters.status "VALIDATED"}} selected{{end}}>Validé</option>
|
||||
<option value="CONFIRMED"{{if eq .filters.status "CONFIRMED"}} selected{{end}}>Confirmé</option>
|
||||
<option value="CANCELLED"{{if eq .filters.status "CANCELLED"}} selected{{end}}>Annulé</option>
|
||||
<option value="WAITING_CONFIRMATION"{{if eq .filters.status "WAITING_CONFIRMATION"}} selected{{end}}>Attente confirmation</option>
|
||||
<option value="WAITING_DRIVER_CONFIRMATION"{{if eq .filters.status "WAITING_DRIVER_CONFIRMATION"}} selected{{end}}>Attente confirmation conducteur</option>
|
||||
</select>
|
||||
<svg viewBox="0 0 16 16" fill="currentColor" data-slot="icon" aria-hidden="true" class="pointer-events-none col-start-1 row-start-1 mr-2 size-5 self-center justify-self-end text-gray-500 sm:size-4 dark:text-gray-400">
|
||||
<path d="M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06Z" clip-rule="evenodd" fill-rule="evenodd" />
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="m-4">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
{{ end }}
|
||||
@@ -0,0 +1,96 @@
|
||||
|
||||
{{ define "carpool_bookings_history" }}
|
||||
{{template "booking_filters" dict "tab" "carpoolHistory" "filters" .ViewState.hist_filters }}
|
||||
{{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">
|
||||
Prix
|
||||
</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/organized-carpool/drivers/{{.Driver.Id}}">
|
||||
{{ (index $.ViewState.drivers_map .Driver.Id).Data.first_name }}
|
||||
{{ (index $.ViewState.drivers_map .Driver.Id).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/{{.Passenger.Id}}">
|
||||
{{ (index $.ViewState.passengers_map .Passenger.Id).Data.first_name }}
|
||||
{{ (index $.ViewState.passengers_map .Passenger.Id).Data.last_name }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="py-4 pl-4 pr-3 text-sm sm:pl-6">
|
||||
{{ .PassengerPickupAddress }}
|
||||
</td>
|
||||
<td class="py-4 pl-4 pr-3 text-sm sm:pl-6">
|
||||
{{ .PassengerDropAddress }}
|
||||
</td>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
|
||||
{{ timeFormat .PassengerPickupDate.AsTime "02/01/2006 15:04" }}
|
||||
</td>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
|
||||
{{ if eq .Status.String "WAITING_DRIVER_CONFIRMATION"}}
|
||||
<span class="p-1 text-xs bg-gray-300 rounded-xl">Attente confirmation</span>
|
||||
{{ else if eq .Status.String "CONFIRMED"}}
|
||||
<span class="p-1 text-xs bg-co-green rounded-xl">Confirmé</span>
|
||||
{{ else if eq .Status.String "VALIDATED"}}
|
||||
<span class="p-1 text-xs bg-co-green rounded-xl">Validé</span>
|
||||
{{ else if eq .Status.String "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">
|
||||
{{ if .Price }}
|
||||
{{ printf "%.2f" (round2 .Price.Amount) }} {{ .Price.Currency }}
|
||||
{{ else }}
|
||||
N/A
|
||||
{{ end }}
|
||||
</td>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
|
||||
<a class="text-co-blue" href="/app/organized-carpool/bookings/{{.Id}}">
|
||||
Voir
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</tbody>
|
||||
</table>
|
||||
{{end}}
|
||||
{{end}}
|
||||
@@ -1,5 +1,6 @@
|
||||
|
||||
{{ define "carpool_bookings_list" }}
|
||||
{{template "booking_filters" dict "tab" "carpoolService" "filters" .ViewState.filters }}
|
||||
{{if eq (len .ViewState.bookings) 0}}
|
||||
<div class="m-10 text-center text-gray-600">Aucun trajet déclaré</div>
|
||||
{{else}}
|
||||
@@ -30,6 +31,10 @@
|
||||
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">
|
||||
Prix
|
||||
</th>
|
||||
<th scope="col"
|
||||
class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">
|
||||
|
||||
@@ -63,12 +68,23 @@
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
|
||||
{{ if eq .Status.String "WAITING_DRIVER_CONFIRMATION"}}
|
||||
<span class="p-1 text-xs bg-gray-300 rounded-xl">Attente confirmation</span>
|
||||
{{ else if eq .Status.String "WAITING_PASSENGER_CONFIRMATION"}}
|
||||
<span class="p-1 text-xs bg-gray-300 rounded-xl">Attente confirmation passager</span>
|
||||
{{ else if eq .Status.String "CONFIRMED"}}
|
||||
<span class="p-1 text-xs bg-co-green rounded-xl">Confirmé</span>
|
||||
{{ else if eq .Status.String "VALIDATED"}}
|
||||
<span class="p-1 text-xs bg-co-green rounded-xl">Validé</span>
|
||||
{{ else if eq .Status.String "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">
|
||||
{{ if .Price }}
|
||||
{{ printf "%.2f" (round2 .Price.Amount) }} {{ .Price.Currency }}
|
||||
{{ else }}
|
||||
N/A
|
||||
{{ end }}
|
||||
</td>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
|
||||
<a class="text-co-blue" href="/app/organized-carpool/bookings/{{.Id}}">
|
||||
Voir
|
||||
|
||||
@@ -39,9 +39,31 @@
|
||||
<dd class="mt-1 text-sm text-gray-900">{{(index .journey.Features 1).Properties.MustString "label"}}</dd>
|
||||
</div>
|
||||
<div class="sm:col-span-1">
|
||||
<dt class="text-sm font-medium text-gray-500">Prix (passager)</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900">0 EUR</dd>
|
||||
<dt class="text-sm font-medium text-gray-500">Date et heure</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900">
|
||||
{{ if .journey.ExtraMembers.departure_date }}
|
||||
{{ timeFormat .journey.ExtraMembers.departure_date "02/01/2006 15:04" }}
|
||||
{{ else }}
|
||||
Non définie
|
||||
{{ end }}
|
||||
</dd>
|
||||
</div>
|
||||
<div class="sm:col-span-1">
|
||||
<dt class="text-sm font-medium text-gray-500">Prix (passager)</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900">
|
||||
{{if .pricing_result}}
|
||||
{{ printf "%.2f" (round2 .pricing_result.passenger.Amount) }} {{.pricing_result.passenger.Currency}}
|
||||
{{else}}
|
||||
0.00 EUR
|
||||
{{end}}
|
||||
</dd>
|
||||
</div>
|
||||
{{if and .pricing_result .pricing_result.driver (gt (round2 .pricing_result.driver.Amount) 0.0)}}
|
||||
<div class="sm:col-span-1">
|
||||
<dt class="text-sm font-medium text-gray-500">Indemnité conducteur</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900">{{ printf "%.2f" (round2 .pricing_result.driver.Amount) }} {{.pricing_result.driver.Currency}}</dd>
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="sm:col-span-1">
|
||||
<dt class="text-sm font-medium text-gray-500">Distance passager</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900">{{ printf "%.2f" .journey.ExtraMembers.passenger_distance }} km</dd>
|
||||
@@ -299,7 +321,7 @@
|
||||
</div>
|
||||
<div class="sm:col-span-1">
|
||||
<dt class="text-sm font-medium text-gray-500">Compte mobilié (solde)</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900">{{if .passenger.Data.wallet}}{{ .passenger.Data.wallet }}{{else}}0{{end}} EUR</dd>
|
||||
<dd class="mt-1 text-sm text-gray-900">{{ printf "%.2f" (round2 .passenger_wallet_balance) }} EUR</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user