Add history for solidarity transport and organized carpool
This commit is contained in:
61
web/layouts/organized_carpool/_partials/driver_history.html
Normal file
61
web/layouts/organized_carpool/_partials/driver_history.html
Normal file
@@ -0,0 +1,61 @@
|
||||
{{define "organized_carpool_driver_history"}}
|
||||
<div class="py-6">
|
||||
{{if .ViewState.stats}}
|
||||
<div class="py-5 text-center">
|
||||
<p class="text-lg">Covoiturages réalisés : {{ .ViewState.stats.bookings.confirmed }}</p>
|
||||
<p class="text-lg">Kilomètres parcourus : {{ .ViewState.stats.bookings.km }} km</p>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
{{if .ViewState.bookings}}
|
||||
<div class="py-5">
|
||||
<h4 class="text-lg font-medium text-gray-900 mb-4 text-center">Historique des covoiturages</h4>
|
||||
<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">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">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">Arrivée</th>
|
||||
<th scope="col" class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-200 bg-white">
|
||||
{{range .ViewState.bookings}}
|
||||
{{if eq .Status.String "CONFIRMED"}}
|
||||
<tr>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
|
||||
{{if .PassengerPickupDate}}
|
||||
{{timeFormat .PassengerPickupDate.AsTime "02/01/2006 15:04"}}
|
||||
{{end}}
|
||||
</td>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
|
||||
{{if .Passenger}}
|
||||
<a class="text-co-blue" href="/app/beneficiaries/{{.Passenger.Id}}">
|
||||
{{ (index $.ViewState.beneficiaries_map .Passenger.Id).Data.first_name }}
|
||||
{{ (index $.ViewState.beneficiaries_map .Passenger.Id).Data.last_name }}
|
||||
</a>
|
||||
{{end}}
|
||||
</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">
|
||||
<a class="text-co-blue" href="/app/organized-carpool/bookings/{{.Id}}">Voir</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="py-5">
|
||||
<p class="text-sm text-gray-500 text-center">Aucun covoiturage enregistré</p>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
113
web/layouts/organized_carpool/_partials/driver_wallet.html
Normal file
113
web/layouts/organized_carpool/_partials/driver_wallet.html
Normal file
@@ -0,0 +1,113 @@
|
||||
{{define "organized_carpool_driver_wallet"}}
|
||||
<div class="py-6"
|
||||
x-data="{
|
||||
walletdialog: false
|
||||
}">
|
||||
<div class="py-5 text-center">
|
||||
<p class="text-lg">Solde : {{ printf "%.2f" .ViewState.wallet_balance }} €</p>
|
||||
<button @click="walletdialog = !walletdialog"
|
||||
class="rounded-2xl border border-transparent bg-co-blue px-4 py-2 my-4 mt-8 w-full text-sm font-medium text-white shadow-sm focus:outline-none focus:ring-2 focus:ring-co-blue focus:ring-offset-2 sm:w-auto">
|
||||
Créditer le compte
|
||||
</button>
|
||||
<div class="relative z-10" aria-labelledby="modal-title" role="dialog" aria-modal="true"
|
||||
x-show="walletdialog">
|
||||
<div class="fixed inset-0 bg-gray-900 opacity-30 transition-opacity"></div>
|
||||
|
||||
<div class="fixed inset-0 z-10 overflow-y-auto">
|
||||
<div class="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0">
|
||||
<div class="relative transform overflow-hidden rounded-lg bg-white px-4 pt-5 pb-4 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-sm sm:p-6">
|
||||
<div>
|
||||
<div class="mt-3 text-center sm:mt-5">
|
||||
<h3 class="text-lg font-medium leading-6 text-gray-900" id="modal-title">Créditer le compte</h3>
|
||||
<div class="mt-2">
|
||||
<p class="text-sm text-gray-500">Créditer le compte mobilité du conducteur</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<form method="POST" action="/app/wallets/{{.ViewState.driver.ID}}/credit" class="my-4">
|
||||
<div class="my-8">
|
||||
<input type="number" step="0.01" id="amount" name="amount" value="0"
|
||||
class="w-full shadow-sm focus:ring-co-blue focus:border-co-blue px-2 p-1 sm:text-sm border-gray-300 rounded-2xl">
|
||||
</div>
|
||||
<div class="mt-5 sm:mt-6">
|
||||
<button type="submit" class="inline-flex w-full justify-center rounded-2xl border border-transparent bg-co-blue px-4 py-2 text-base font-medium text-white shadow-sm hover:bg-co-blue focus:outline-none focus:ring-2 focus:ring-co-blue focus:ring-offset-2 sm:text-sm">Ajouter</button>
|
||||
</div>
|
||||
<div class="mt-5 sm:mt-6">
|
||||
<button @click="walletdialog=false" type="button" class="inline-flex w-full justify-center max-w-xs bg-white hover:bg-gray-50 border-gray-300 border px-4 py-2 text-gray-700 items-center text-sm rounded-2xl focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-co-blue">Annuler</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Wallet Operations History -->
|
||||
{{if .ViewState.driver.Data.wallet_history}}
|
||||
<div class="py-5">
|
||||
<h4 class="text-lg font-medium text-gray-900 mb-4 text-center">Historique des opérations</h4>
|
||||
<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">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">Crédit</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ébit</th>
|
||||
<th scope="col" class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">Moyen de paiement</th>
|
||||
<th scope="col" class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-200 bg-white">
|
||||
<!-- Initial Balance Row -->
|
||||
<tr class="bg-gray-50">
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm text-gray-500 italic sm:pl-6">
|
||||
Solde initial
|
||||
</td>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:pl-6">
|
||||
{{if .ViewState.driver.Data.wallet}}{{ printf "%.2f" .ViewState.driver.Data.wallet }} €{{else}}0.00 €{{end}}
|
||||
</td>
|
||||
<td class="py-4 pl-4 pr-3 text-sm text-gray-500 sm:pl-6">
|
||||
-
|
||||
</td>
|
||||
<td class="py-4 pl-4 pr-3 text-sm text-gray-500 sm:pl-6">
|
||||
-
|
||||
</td>
|
||||
<td class="py-4 pl-4 pr-3 text-sm text-gray-500 sm:pl-6">
|
||||
-
|
||||
</td>
|
||||
</tr>
|
||||
{{range $index, $operation := .ViewState.driver.Data.wallet_history}}
|
||||
<tr>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
|
||||
{{if $operation.timestamp}}{{timeFormat $operation.timestamp "02/01/2006 15:04"}}{{end}}
|
||||
</td>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-green-600 sm:pl-6">
|
||||
{{if $operation.amount}}
|
||||
{{if or (eq $operation.operation_type "credit") (not $operation.operation_type)}}
|
||||
{{ printf "%.2f" $operation.amount }} €
|
||||
{{end}}
|
||||
{{end}}
|
||||
</td>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-red-600 sm:pl-6">
|
||||
{{if eq $operation.operation_type "debit"}}
|
||||
{{ printf "%.2f" $operation.amount }} €
|
||||
{{end}}
|
||||
</td>
|
||||
<td class="py-4 pl-4 pr-3 text-sm sm:pl-6">
|
||||
{{$operation.payment_method}}
|
||||
</td>
|
||||
<td class="py-4 pl-4 pr-3 text-sm sm:pl-6">
|
||||
{{$operation.description}}
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="py-5">
|
||||
<p class="text-sm text-gray-500 text-center">Aucune opération enregistrée</p>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
</div>
|
||||
{{end}}
|
||||
@@ -134,6 +134,14 @@
|
||||
{{ timeFormat .ViewState.booking.PassengerPickupDate.AsTime "02/01/2006 15:04" }}
|
||||
</dd>
|
||||
</div>
|
||||
{{if .ViewState.booking.Distance}}
|
||||
<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</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
|
||||
{{ .ViewState.booking.Distance }} km
|
||||
</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">Prix (passager)</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
</section>
|
||||
|
||||
<section aria-labelledby="functionalities-title" x-data="{
|
||||
tab: 'documents',
|
||||
tab: '{{ if .ViewState.tab }}{{ .ViewState.tab }}{{ else }}documents{{ end }}',
|
||||
to(event) {
|
||||
this.tab = event.target.value
|
||||
}
|
||||
@@ -118,6 +118,10 @@
|
||||
<option value="events">Dispositifs</option> -->
|
||||
|
||||
<option value="documents">Documents</option>
|
||||
|
||||
<option value="wallet">Compte mobilité</option>
|
||||
|
||||
<option value="history">Covoiturage solidaire</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="hidden sm:block">
|
||||
@@ -134,12 +138,24 @@
|
||||
:class="tab == 'documents' ? 'border-co-blue text-co-blue' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'">
|
||||
Documents </a>
|
||||
|
||||
<a href="#" @click="tab = 'wallet'"
|
||||
class="whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm"
|
||||
:class="tab == 'wallet' ? 'border-co-blue text-co-blue' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'">
|
||||
Compte mobilité </a>
|
||||
|
||||
<a href="#" @click="tab = 'history'"
|
||||
class="whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm"
|
||||
:class="tab == 'history' ? 'border-co-blue text-co-blue' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'">
|
||||
Covoiturage solidaire </a>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div x-show="tab == 'documents'">{{template "driver_files" .}}</div>
|
||||
<div x-show="tab == 'wallet'">{{template "organized_carpool_driver_wallet" .}}</div>
|
||||
<div x-show="tab == 'history'">{{template "organized_carpool_driver_history" .}}</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user