Configurable fields in solidarity driver profile + wallet details display + change SMS

This commit is contained in:
Arnaud Delcasse
2025-09-25 13:25:33 +02:00
parent 9280f36a62
commit 27ce05a91a
10 changed files with 353 additions and 69 deletions

View File

@@ -1,10 +1,10 @@
{{define "driver_wallet"}}
<div class="px-4 py-6 sm:px-6 text-center"
<div class="py-6"
x-data="{
walletdialog: false
}">
<div class="px-4 py-5 sm:px-6">
<p class="text-center text-lg">Solde : {{if .ViewState.driver.Data.wallet}}{{ printf "%.2f" .ViewState.driver.Data.wallet }}{{else}}0{{end}} €</p>
<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
@@ -42,5 +42,72 @@
</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}}