Improvements

This commit is contained in:
Arnaud Delcasse 2025-10-08 19:12:08 +02:00
parent 2fee2a4ce8
commit e499e39b3c
14 changed files with 259 additions and 60 deletions

View File

@ -97,13 +97,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/beneficiaries/_partials/beneficiary-diags.html
- web/layouts/beneficiaries/_partials/beneficiary-wallet.html
- web/layouts/beneficiaries/_partials/beneficiary-solidarity-transport.html
- web/layouts/beneficiaries/display.html
create_diag:
files:
- web/layouts/beneficiaries/create-diag.html
update:
files:
- web/layouts/_partials/address_autocomplete.html
@ -330,8 +326,10 @@ views:
organized_carpool:
overview:
files:
- web/layouts/organized_carpool/_partials/booking_filters.html
- web/layouts/organized_carpool/_partials/drivers_list.html
- web/layouts/organized_carpool/_partials/bookings_list.html
- web/layouts/organized_carpool/_partials/bookings_history.html
- web/layouts/organized_carpool/overview.html
driver_create:
files:

View File

@ -209,7 +209,6 @@
<div x-show="tab == 'wallet'">{{template "beneficiary_wallet" .}}</div>
{{if moduleAvailable "solidarity_transport"}}<div x-show="tab == 'solidarity_transport'">{{template "beneficiary_solidarity_transport" .}}</div>{{end}}
<div x-show="tab == 'organizations'">{{template "beneficiary_organizations" .}}</div>
<!--<div x-show="tab == 'diags'">{{template "beneficiary_diags" .}}</div>-->
</div>
</div>
</section>

View File

@ -22,7 +22,7 @@
</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 du covoiturage
Date et heure
</th>
<th scope="col"
class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">
@ -41,7 +41,11 @@
<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="py-4 pl-4 pr-3 text-sm sm:pl-6">{{ .DriverDepartureAddress }}</td>
<td class="py-4 pl-4 pr-3 text-sm sm:pl-6">{{ .DriverArrivalAddress }}</td>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">{{ .Distance }} km</td>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
{{ if .PassengerPickupDate }}
{{ .PassengerPickupDate.AsTime.Format "02/01/2006 15:04" }}
{{ end }}
</td>
<td class="py-4 pl-4 pr-3 text-sm sm:pl-6">
{{if carpoolDriverValidatedProfile $driver (carpoolDocuments $driver.ID) }}
<span class="p-1 px-2 text-xs bg-co-green rounded-2xl">Oui</span>
@ -51,7 +55,7 @@
</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/organized-carpool/drivers/{{$driver.ID}}/journeys/{{.Id}}">
href="/app/organized-carpool/drivers/{{$driver.ID}}/journeys/{{.Id}}?passengerid={{$.ViewState.passengerid}}">
Organiser
</a>
</td>

View 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 }}

View File

@ -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">
&nbsp;
</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}}

View File

@ -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">
&nbsp;
@ -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

View File

@ -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>

View File

@ -135,13 +135,13 @@
</dd>
</div>
<div class="py-4 sm:py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
<dt class="text-sm font-medium text-gray-500">Prix</dt>
<dt class="text-sm font-medium text-gray-500">Prix (passager)</dt>
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
{{ if .ViewState.booking.Price }}
{{ if eq .ViewState.booking.Price.Type.String "FREE" }}
<span class="text-co-green font-medium">Gratuit</span>
{{ else if eq .ViewState.booking.Price.Type.String "PAYING" }}
<span class="font-medium">{{ printf "%.2f" .ViewState.booking.Price.Amount }} {{ .ViewState.booking.Price.Currency }}</span>
<span class="font-medium">{{ printf "%.2f" (round2 .ViewState.booking.Price.Amount) }} {{ .ViewState.booking.Price.Currency }}</span>
{{ else }}
<span class="text-gray-500">Prix non défini</span>
{{ end }}
@ -150,6 +150,24 @@
{{ end }}
</dd>
</div>
{{if and .ViewState.booking.DriverCompensationAmount .ViewState.booking.DriverCompensationCurrency}}
{{if gt (round2 .ViewState.booking.DriverCompensationAmount) 0.0}}
<div class="py-4 sm:py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
<dt class="text-sm font-medium text-gray-500">Indemnité conducteur</dt>
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
<span class="font-medium">{{ printf "%.2f" (round2 .ViewState.booking.DriverCompensationAmount) }} {{ .ViewState.booking.DriverCompensationCurrency }}</span>
</dd>
</div>
{{end}}
{{end}}
{{if .ViewState.booking.Motivation}}
<div class="py-4 sm:py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
<dt class="text-sm font-medium text-gray-500">Motif</dt>
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
{{.ViewState.booking.Motivation}}
</dd>
</div>
{{end}}
</dl>
</div>
</div>

View File

@ -3,24 +3,22 @@
<h1 class="text-2xl font-semibold text-gray-900">Organiser le covoiturage</h1>
</div>
<div class="max-w-7xl mx-auto py-8 px-4 sm:px-6 md:px-8">
{{template "journey_preview" (dict "journey" .ViewState.journey "driver" .ViewState.driver "passenger" .ViewState.passenger "beneficiaries" .ViewState.beneficiaries)}}
{{template "journey_preview" (dict "journey" .ViewState.journey "driver" .ViewState.driver "passenger" .ViewState.passenger "beneficiaries" .ViewState.beneficiaries "passenger_wallet_balance" .ViewState.passenger_wallet_balance "pricing_result" .ViewState.pricing_result)}}
{{if ne .ViewState.passenger.ID ""}}
<div class="max-w-7xl m-auto px-4 sm:px-6 md:px-8 flex flex-col justify-items-center">
{{if .ViewState.passenger}}
{{if lt .ViewState.passenger_wallet_balance .ViewState.pricing_result.passenger.Amount}}
<p class="text-xl text-co-red text-center p-4">Le solde du compte mobilité est insuffisant.</p>
{{end}}
{{end}}
<form method="POST">
<div class="m-auto text-center">
<label for="motivation" class="block text-sm font-medium text-gray-700">Motif du trajet</label>
<select name="motivation" id="motivation"
class="p-2 mt-1 mb-4 focus:ring-co-blue focus:border-co-blue block shadow-sm sm:text-sm rounded-2xl bg-white m-auto">
<option value="Administratif">Administratif</option>
<option value="Commerce">Commerce</option>
<option value="Courses">Courses</option>
<option value="Insertion">Insertion</option>
<option value="Loisirs">Loisirs</option>
<option value="Travail">Travail</option>
<option value="Formation">Formation</option>
<option value="Visite à un proche">Visite à un proche</option>
<option value="Santé">Santé</option>
<option selected="selected" value="">Autre&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
{{range .ViewState.booking_motivations}}
<option value="{{.value}}"{{if eq .value ""}} selected="selected"{{end}}>{{.label}}</option>
{{end}}
</select>
</div>
{{template "submit_with_sms"

View File

@ -1,10 +1,10 @@
{{ define "content" }}
{{$defaultTab := "carpoolService"}}
<div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8">
<h1 class="text-2xl font-semibold text-gray-900">Covoiturage solidaire</h1>
<div class="bg-white shadow sm:rounded-lg sm:overflow-hidden my-4" x-data="{
tab: 'trips',
tab: '{{or .ViewState.tab $defaultTab}}',
to(event) {
this.tab = event.target.value
}
@ -14,9 +14,9 @@
<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 = 'trips'"
<a href="#" @click="tab = 'carpoolService'"
class="whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm"
:class="tab == 'trips' ? 'border-co-blue text-co-blue' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'">
:class="tab == 'carpoolService' ? 'border-co-blue text-co-blue' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'">
Trajets </a>
<a href="#" @click="tab = 'drivers'"
@ -24,20 +24,20 @@
:class="tab == 'drivers' ? 'border-co-blue text-co-blue' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'">
Covoitureurs solidaires </a>
<!--<a href="#" @click="tab = 'beneficiaries'"
<a href="#" @click="tab = 'carpoolHistory'"
class="whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm"
:class="tab == 'beneficiaries' ? 'border-co-blue text-co-blue' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'">
Bénéficiaires </a>-->
:class="tab == 'carpoolHistory' ? 'border-co-blue text-co-blue' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'">
Trajets passés </a>
</nav>
</div>
</div>
</div>
<div x-show="tab == 'trips'">{{template "carpool_bookings_list" .}}</div>
<div x-show="tab == 'carpoolService'">{{template "carpool_bookings_list" .}}</div>
<div x-show="tab == 'drivers'">{{template "carpool_drivers_list" .}}</div>
<div x-show="tab == 'beneficiaries'">1</div>
<div x-show="tab == 'carpoolHistory'">{{template "carpool_bookings_history" .}}</div>
</div>
</div>

View File

@ -75,7 +75,7 @@
{{ end }}
</td>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
{{ .Journey.Price.Amount }} {{ .Journey.Price.Currency }}
{{ printf "%.2f" (round2 .Journey.Price.Amount) }} {{ .Journey.Price.Currency }}
</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}}">

View File

@ -52,25 +52,25 @@
<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" .pricing_result.passenger.Amount }} {{.pricing_result.passenger.Currency}}
{{ printf "%.2f" (round2 .pricing_result.passenger.Amount) }} {{.pricing_result.passenger.Currency}}
{{else if .booking}}
{{ printf "%.2f" .booking.Journey.Price.Amount }} {{.booking.Journey.Price.Currency}}
{{ printf "%.2f" (round2 .booking.Journey.Price.Amount) }} {{.booking.Journey.Price.Currency}}
{{else}}
0.00 EUR
{{end}}
</dd>
</div>
{{if and .pricing_result .pricing_result.driver (gt .pricing_result.driver.Amount 0.0)}}
{{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" .pricing_result.driver.Amount }} {{.pricing_result.driver.Currency}}</dd>
<dd class="mt-1 text-sm text-gray-900">{{ printf "%.2f" (round2 .pricing_result.driver.Amount) }} {{.pricing_result.driver.Currency}}</dd>
</div>
{{else if .booking}}
{{if .booking.DriverCompensationAmount}}
{{if gt . 0.0}}
{{if gt (round2 .booking.DriverCompensationAmount) 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" . }} {{.booking.DriverCompensationCurrency}}</dd>
<dd class="mt-1 text-sm text-gray-900">{{ printf "%.2f" (round2 .booking.DriverCompensationAmount) }} {{.booking.DriverCompensationCurrency}}</dd>
</div>
{{end}}
{{end}}
@ -272,7 +272,7 @@
{{end}}
<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">{{ printf "%.2f" .passenger_wallet_balance }} EUR</dd>
<dd class="mt-1 text-sm text-gray-900">{{ printf "%.2f" (round2 .passenger_wallet_balance) }} EUR</dd>
</div>
</dl>
</div>

View File

@ -157,6 +157,22 @@
{{end}}
</dd>
</div>
{{if .ViewState.booking.Data.motivation}}
<div class="py-4 sm:py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
<dt class="text-sm font-medium text-gray-500">Motif</dt>
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
{{$motivation := .ViewState.booking.Data.motivation}}
{{$found := false}}
{{range .ViewState.booking_motivations}}
{{if eq .value $motivation}}
{{.label}}
{{$found = true}}
{{end}}
{{end}}
{{if not $found}}{{$motivation}}{{end}}
</dd>
</div>
{{end}}
<div class="py-4 sm:py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
<dt class="text-sm font-medium text-gray-500">Distance passager</dt>
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
@ -172,27 +188,19 @@
<div class="py-4 sm:py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
<dt class="text-sm font-medium text-gray-500">Prix (passager)</dt>
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
<span class="font-medium">{{ printf "%.2f" .ViewState.booking.Journey.Price.Amount }} {{ .ViewState.booking.Journey.Price.Currency }}</span>
<span class="font-medium">{{ printf "%.2f" (round2 .ViewState.booking.Journey.Price.Amount) }} {{ .ViewState.booking.Journey.Price.Currency }}</span>
</dd>
</div>
{{if .ViewState.booking.DriverCompensationAmount}}
{{if gt .ViewState.booking.DriverCompensationAmount 0.0}}
{{if gt (round2 .ViewState.booking.DriverCompensationAmount) 0.0}}
<div class="py-4 sm:py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
<dt class="text-sm font-medium text-gray-500">Indemnité conducteur</dt>
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
<span class="font-medium">{{ printf "%.2f" .ViewState.booking.DriverCompensationAmount }} {{.ViewState.booking.DriverCompensationCurrency}}</span>
<span class="font-medium">{{ printf "%.2f" (round2 .ViewState.booking.DriverCompensationAmount) }} {{.ViewState.booking.DriverCompensationCurrency}}</span>
</dd>
</div>
{{end}}
{{end}}
{{if .ViewState.booking.Data.motivation}}
<div class="py-4 sm:py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
<dt class="text-sm font-medium text-gray-500">Motif</dt>
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
{{ .ViewState.booking.Data.motivation }}
</dd>
</div>
{{end}}
</dl>
</div>
</div>

View File

@ -45,14 +45,9 @@
<label for="motivation" class="block text-sm font-medium text-gray-700">Motif du trajet</label>
<select name="motivation" id="motivation"
class="p-2 mt-1 mb-4 focus:ring-co-blue focus:border-co-blue block shadow-sm sm:text-sm rounded-2xl bg-white m-auto">
<option value="Administratif">Administratif (trajet garanti)</option>
<option value="Commerce">Commerce</option>
<option value="Courses">Courses</option>
<option value="Insertion">Insertion (trajet garanti)</option>
<option value="Loisirs">Loisirs</option>
<option value="Visite à un proche">Visite à un proche</option>
<option value="Santé">Santé (trajet garanti)</option>
<option selected="selected" value="">Autre&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
{{range .ViewState.booking_motivations}}
<option value="{{.value}}"{{if eq .value ""}} selected="selected"{{end}}>{{.label}}</option>
{{end}}
</select>
</div>
{{template "submit_with_sms"