Configurable fields in solidarity driver profile + wallet details display + change SMS
This commit is contained in:
@@ -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}}
|
||||
@@ -249,7 +249,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">{{if .passenger.Data.wallet}}{{ printf "%.2f" .passenger.Data.wallet }}{{else}}0{{end}} EUR</dd>
|
||||
<dd class="mt-1 text-sm text-gray-900">{{ printf "%.2f" .passenger_wallet_balance }} EUR</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
@@ -120,7 +120,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="max-w-7xl mx-auto py-8 px-4 sm:px-6 md:px-8">
|
||||
{{template "journey_preview" (dict "driver_journey" .ViewState.booking.Journey "driver" .ViewState.driver "passenger" .ViewState.passenger "beneficiaries" .ViewState.beneficiaries)}}
|
||||
{{template "journey_preview" (dict "driver_journey" .ViewState.booking.Journey "driver" .ViewState.driver "passenger" .ViewState.passenger "beneficiaries" .ViewState.beneficiaries "passenger_wallet_balance" .ViewState.passenger_wallet_balance)}}
|
||||
</div>
|
||||
|
||||
{{ end }}
|
||||
|
||||
@@ -116,31 +116,46 @@
|
||||
<div class="mt-5 space-y-6 md:mt-0 md:col-span-2">
|
||||
<div class="grid grid-cols-6 gap-6">
|
||||
|
||||
{{range .ViewState.profile_optional_fields}}
|
||||
<div class="col-span-6 sm:col-span-3">
|
||||
<label for="gender" class="block text-sm font-medium text-gray-700">Genre</label>
|
||||
<label for="{{.name}}" class="block text-sm font-medium text-gray-700">{{.label}}</label>
|
||||
{{if eq .type "select"}}
|
||||
<div class="sm:mt-0 sm:col-span-2">
|
||||
<select id="gender" name="gender" autocomplete="gender" x-model="gender"
|
||||
<select id="{{.name}}" name="{{.name}}"
|
||||
{{if eq .name "gender"}}x-model="gender"{{else}}x-model="other_properties.{{.name}}"{{end}}
|
||||
class="p-2 max-w-lg mt-1 block focus:ring-co-blue focus:border-co-blue w-full shadow-sm sm:max-w-xs sm:text-sm border-gray-300 rounded-2xl">
|
||||
<option value="0">Inconnu</option>
|
||||
<option value="1">Masculin</option>
|
||||
<option value="2">Féminin</option>
|
||||
<option value="9">Sans objet</option>
|
||||
{{range .options}}
|
||||
<option value="{{.value}}">{{.label}}</option>
|
||||
{{end}}
|
||||
</select>
|
||||
</div>
|
||||
{{else if eq .type "textarea"}}
|
||||
<textarea id="{{.name}}" name="{{.name}}" rows="3" x-model="other_properties.{{.name}}"
|
||||
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm border-gray-300 rounded-2xl"></textarea>
|
||||
{{else if eq .type "multicheckbox"}}
|
||||
<div class="mt-1 space-y-2">
|
||||
{{$name := .name}}
|
||||
{{range .options}}
|
||||
<label class="flex items-center">
|
||||
<input type="checkbox" name="{{$name}}[]" value="{{.value}}"
|
||||
x-model="other_properties.{{$name}}___{{.value}}"
|
||||
class="h-4 w-4 text-co-blue focus:ring-co-blue border-co-blue rounded">
|
||||
<span class="ml-2 text-sm text-gray-700">{{.label}}</span>
|
||||
</label>
|
||||
{{end}}
|
||||
</div>
|
||||
{{else if eq .type "date"}}
|
||||
<input type="date" id="{{.name}}" name="{{.name}}" x-model="other_properties.{{.name}}"
|
||||
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm border-gray-300 rounded-2xl">
|
||||
{{else if eq .type "number"}}
|
||||
<input type="number" id="{{.name}}" name="{{.name}}" x-model="other_properties.{{.name}}"
|
||||
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm border-gray-300 rounded-2xl">
|
||||
{{else}}
|
||||
<input type="text" id="{{.name}}" name="{{.name}}" x-model="other_properties.{{.name}}"
|
||||
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm border-gray-300 rounded-2xl">
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
<div class="col-span-6 sm:col-span-3">
|
||||
<label for="last_subscription_date" class="block text-sm font-medium text-gray-700">Date de dernière adhésion</label>
|
||||
<input type="date" name="last_subscription_date" id="last_subscription_date" autocomplete="last_subscription_date" placeholder="JJ/MM/AAAA"
|
||||
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
|
||||
x-model="other_properties.last_subscription_date">
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3">
|
||||
<label for="comment" class="block text-sm font-medium text-gray-700">Commentaire</label>
|
||||
<textarea name="comment" id="comment"
|
||||
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
|
||||
x-model="other_properties.comment"></textarea>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
<!-- <div class="col-span-3 sm:col-span-3">
|
||||
<label class="block text-sm font-medium text-gray-700"> Photo </label>
|
||||
|
||||
@@ -89,17 +89,58 @@
|
||||
<dd class="mt-1 text-sm text-gray-900">{{.ViewState.driver.Data.file_number}}</dd>
|
||||
</div>
|
||||
{{end}}
|
||||
{{if and .ViewState.driver.Data.other_properties .ViewState.driver.Data.other_properties.last_subscription_date}}
|
||||
<div class="sm:col-span-1">
|
||||
<dt class="text-sm font-medium text-gray-500">Dernière adhésion</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900">{{ .ViewState.driver.Data.other_properties.last_subscription_date}}</dd>
|
||||
</div>
|
||||
{{range .ViewState.profile_optional_fields}}
|
||||
{{$fieldName := .name}}
|
||||
{{$fieldLabel := .label}}
|
||||
{{$fieldType := .type}}
|
||||
{{if eq .type "multicheckbox"}}
|
||||
{{$hasValues := false}}
|
||||
{{range .options}}
|
||||
{{$optionKey := printf "%s___%s" $fieldName .value}}
|
||||
{{if index $.ViewState.driver.Data.other_properties $optionKey}}{{$hasValues = true}}{{end}}
|
||||
{{end}}
|
||||
{{if $hasValues}}
|
||||
<div class="sm:col-span-2">
|
||||
<dt class="text-sm font-medium text-gray-500">{{$fieldLabel}}</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900">
|
||||
<div class="flex flex-wrap gap-2">
|
||||
{{range .options}}
|
||||
{{$optionKey := printf "%s___%s" $fieldName .value}}
|
||||
{{if index $.ViewState.driver.Data.other_properties $optionKey}}
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-200 text-gray-800">
|
||||
{{.label}}
|
||||
</span>
|
||||
{{end}}
|
||||
{{end}}
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
{{end}}
|
||||
{{else if eq .type "select"}}
|
||||
{{$fieldValue := index $.ViewState.driver.Data.other_properties $fieldName}}
|
||||
{{if and $fieldValue (ne $fieldValue "0") (ne $fieldValue "")}}
|
||||
<div class="sm:col-span-1">
|
||||
<dt class="text-sm font-medium text-gray-500">{{$fieldLabel}}</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900">
|
||||
{{if eq $fieldName "gender"}}
|
||||
{{genderISO5218 $fieldValue}}
|
||||
{{else}}
|
||||
{{range .options}}
|
||||
{{if eq .value $fieldValue}}{{.label}}{{end}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
</dd>
|
||||
</div>
|
||||
{{end}}
|
||||
{{else}}
|
||||
{{$fieldValue := index $.ViewState.driver.Data.other_properties $fieldName}}
|
||||
{{if $fieldValue}}
|
||||
<div class="sm:col-span-1">
|
||||
<dt class="text-sm font-medium text-gray-500">{{$fieldLabel}}</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900">{{$fieldValue}}</dd>
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{if and .ViewState.driver.Data.other_properties .ViewState.driver.Data.other_properties.comment}}
|
||||
<div class="sm:col-span-1">
|
||||
<dt class="text-sm font-medium text-gray-500">Commentaire</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900">{{ .ViewState.driver.Data.other_properties.comment}}</dd>
|
||||
</div>
|
||||
{{end}}
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
@@ -26,12 +26,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="max-w-7xl mx-auto py-8 px-4 sm:px-6 md:px-8">
|
||||
{{template "journey_preview" (dict "driver_journey" .ViewState.driver_journey "driver" .ViewState.driver "passenger" .ViewState.passenger "beneficiaries" .ViewState.beneficiaries)}}
|
||||
{{template "journey_preview" (dict "driver_journey" .ViewState.driver_journey "driver" .ViewState.driver "passenger" .ViewState.passenger "beneficiaries" .ViewState.beneficiaries "passenger_wallet_balance" .ViewState.passenger_wallet_balance)}}
|
||||
{{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}}
|
||||
{{$wallet := (or .ViewState.passenger.Data.wallet 0.0)}}
|
||||
{{if lt $wallet .ViewState.driver_journey.Price.Amount}}
|
||||
{{if lt .ViewState.passenger_wallet_balance .ViewState.driver_journey.Price.Amount}}
|
||||
<p class="text-xl text-co-red text-center p-4">Le solde du compte mobilité est insuffisant.</p>
|
||||
{{end}}
|
||||
<form method="POST">
|
||||
|
||||
@@ -121,31 +121,46 @@
|
||||
<div class="mt-5 space-y-6 md:mt-0 md:col-span-2">
|
||||
<div class="grid grid-cols-6 gap-6">
|
||||
|
||||
{{range .ViewState.profile_optional_fields}}
|
||||
<div class="col-span-6 sm:col-span-3">
|
||||
<label for="gender" class="block text-sm font-medium text-gray-700">Genre</label>
|
||||
<label for="{{.name}}" class="block text-sm font-medium text-gray-700">{{.label}}</label>
|
||||
{{if eq .type "select"}}
|
||||
<div class="sm:mt-0 sm:col-span-2">
|
||||
<select id="gender" name="gender" autocomplete="gender" x-model="gender"
|
||||
<select id="{{.name}}" name="{{.name}}"
|
||||
{{if eq .name "gender"}}x-model="gender"{{else}}x-model="other_properties.{{.name}}"{{end}}
|
||||
class="p-2 max-w-lg mt-1 block focus:ring-co-blue focus:border-co-blue w-full shadow-sm sm:max-w-xs sm:text-sm border-gray-300 rounded-2xl">
|
||||
<option value="0">Inconnu</option>
|
||||
<option value="1">Masculin</option>
|
||||
<option value="2">Féminin</option>
|
||||
<option value="9">Sans objet</option>
|
||||
{{range .options}}
|
||||
<option value="{{.value}}">{{.label}}</option>
|
||||
{{end}}
|
||||
</select>
|
||||
</div>
|
||||
{{else if eq .type "textarea"}}
|
||||
<textarea id="{{.name}}" name="{{.name}}" rows="3" x-model="other_properties.{{.name}}"
|
||||
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm border-gray-300 rounded-2xl"></textarea>
|
||||
{{else if eq .type "multicheckbox"}}
|
||||
<div class="mt-1 space-y-2">
|
||||
{{$name := .name}}
|
||||
{{range .options}}
|
||||
<label class="flex items-center">
|
||||
<input type="checkbox" name="{{$name}}[]" value="{{.value}}"
|
||||
x-model="other_properties.{{$name}}___{{.value}}"
|
||||
class="h-4 w-4 text-co-blue focus:ring-co-blue border-co-blue rounded">
|
||||
<span class="ml-2 text-sm text-gray-700">{{.label}}</span>
|
||||
</label>
|
||||
{{end}}
|
||||
</div>
|
||||
{{else if eq .type "date"}}
|
||||
<input type="date" id="{{.name}}" name="{{.name}}" x-model="other_properties.{{.name}}"
|
||||
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm border-gray-300 rounded-2xl">
|
||||
{{else if eq .type "number"}}
|
||||
<input type="number" id="{{.name}}" name="{{.name}}" x-model="other_properties.{{.name}}"
|
||||
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm border-gray-300 rounded-2xl">
|
||||
{{else}}
|
||||
<input type="text" id="{{.name}}" name="{{.name}}" x-model="other_properties.{{.name}}"
|
||||
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm border-gray-300 rounded-2xl">
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
<div class="col-span-6 sm:col-span-3">
|
||||
<label for="last_subscription_date" class="block text-sm font-medium text-gray-700">Date de dernière adhésion</label>
|
||||
<input type="date" name="last_subscription_date" id="last_subscription_date" autocomplete="last_subscription_date" placeholder="JJ/MM/AAAA"
|
||||
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
|
||||
x-model="other_properties.last_subscription_date">
|
||||
</div>
|
||||
<div class="col-span-6 sm:col-span-3">
|
||||
<label for="comment" class="block text-sm font-medium text-gray-700">Commentaire</label>
|
||||
<textarea name="comment" id="comment"
|
||||
class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
|
||||
x-model="other_properties.comment"></textarea>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
<!-- <div class="col-span-3 sm:col-span-3">
|
||||
<label class="block text-sm font-medium text-gray-700"> Photo </label>
|
||||
|
||||
Reference in New Issue
Block a user