solidarity pricing

This commit is contained in:
Arnaud Delcasse 2025-06-16 12:59:22 +02:00
parent b69dfc99e4
commit ba68e11785
12 changed files with 150 additions and 13 deletions

View File

@ -73,6 +73,7 @@ views:
- 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:

View File

@ -1,2 +1,2 @@
{{ define "sms_template" }}[{{ .name }}] Nouvelle demande de trajet solidaire{{ .datetime }}.
{{ define "sms_template" }}[{{ .name }}] Nouvelle demande de trajet solidaire le {{ .datetime }}.
Acceptez ou refusez sur {{ .baseUrl }}/ext/st/bp/{booking_id}{{ end }}

View File

@ -6,6 +6,8 @@
{{ $cancelText := (or .ComponentState.cancelText "Annuler" )}}
{{ $validateText := (or .ComponentState.validateText "Envoyer" )}}
{{ $infoText := (or .ComponentState.infoText "Le message suivant sera envoyé. Vous pouvez le personnaliser." )}}
{{ $doNotSendText := (or .ComponentState.doNotSendText "Ne pas envoyer le message par SMS." )}}
{{ $doNotSendOption := eq .ComponentState.doNotSendOption true }}
<div x-data="{ {{ $dialog }}: false}" class="text-center">
<button @click="{{ $dialog }} = !{{ $dialog }}" type="button" class="bg-co-blue border-gray-300 border px-4 py-2 text-white items-center text-sm rounded-2xl focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-co-blue">
{{ .ComponentState.submitText }}
@ -32,7 +34,15 @@
<textarea rows="4" name="message" id="message" class="block w-full rounded-2xl border-gray-300 shadow-sm focus:border-co-blue focus:ring-co-blue sm:text-sm">{{template "sms_template" .SMSState }}</textarea>
</div>
</div>
{{ if $doNotSendOption}}
<div>
<div class="mt-1 flex flex-row justify-items-center items-center">
<div class="flex-none m-4"><input type="checkbox" name="do_not_send" id="do_not_send" class="block w-full rounded-2xl border-gray-300 shadow-sm focus:border-co-blue focus:ring-co-blue sm:text-sm" /></div>
<label for="do_not_send" class="flex text-sm text-gray-700 align-middle">{{$doNotSendText}}</label>
</div>
</div>
</div>
{{end}}
<div class="mt-5 sm:mt-6 sm:grid sm:grid-flow-row-dense sm:grid-cols-2">
<button @click="{{$dialog}} = !{{$dialog}}" type="button" class="mt-3 inline-flex w-full justify-center rounded-l-2xl border border-gray-300 bg-white px-4 py-2 text-base font-medium text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-co-blue focus:ring-offset-2 sm:col-start-1 sm:mt-0 sm:text-sm">{{ $cancelText }}</button>
<button type="submit" class="inline-flex w-full justify-center rounded-r-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:col-start-2 sm:text-sm">{{ $validateText }}</button>

View File

@ -0,0 +1,7 @@
{{define "beneficiary_solidarity_transport"}}
<div class="px-4 py-6 sm:px-6 text-center">
<p class="text-center text-lg">Trajets réalisés : {{ .ViewState.solidarity_transport_stats.count }}</p>
<p class="text-center text-lg">Kilomètres réalisés : {{ .ViewState.solidarity_transport_stats.km}} km</p>
</div>
{{end}}

View File

@ -179,6 +179,12 @@
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="previous_solidarity_transport" class="block text-sm font-medium text-gray-700">Nombre de transports solidaires précédents</label>
<input type="number" name="previous solidarity_transport" id="previous_solidarity_transport" placeholder="0"
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.previous_solidarity_transport">
</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"

View File

@ -180,6 +180,13 @@
: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>
{{if moduleAvailable "solidarity_transport"}}<a href="#" @click="tab = 'solidarity_transport'"
class="whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm"
:class="tab == 'solidarity_transport' ? 'border-co-blue text-co-blue' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'">
Transport solidaire </a>
{{end}}
<a href="#" @click="tab = 'organizations'"
class="whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm"
:class="tab == 'organizations' ? 'border-co-blue text-co-blue' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'">
@ -197,6 +204,7 @@
<div x-show="tab == 'documents'">{{template "beneficiary_files" .}}</div>
<div x-show="tab == 'notes'">{{template "beneficiary_notes" .}}</div>
<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>

View File

@ -181,6 +181,12 @@
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="previous_solidarity_transport" class="block text-sm font-medium text-gray-700">Nombre de transports solidaires précédents</label>
<input type="text" name="previous solidarity_transport" id="previous_solidarity_transport" placeholder="0"
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.previous_solidarity_transport">
</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"

View File

@ -58,7 +58,7 @@
{{ .Journey.PassengerDrop.Properties.label }}
</td>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
{{ .Journey.PassengerPickupDate.Format "02/01/2006 15:04" }}
{{ timeFormat .Journey.PassengerPickupDate "02/01/2006 15:04" }}
</td>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
{{ if eq .Status "WAITING_CONFIRMATION"}}
@ -68,7 +68,7 @@
{{ else if eq .Status "CANCELLED"}}
<span class="p-1 text-xs bg-co-red text-white rounded-xl">Annulé</span>
{{ end }}
{{if and .Data.motivation (ne .Data.motivation "")}}<div class="mt-4"><span class="text-xs p-2 bg-co-green text-white rounded-2xl">Trajet garanti : {{.Data.motivation}}</span></div>{{end}}
{{if and .Data.motivation (or (or (eq .Data.motivation "Santé") (eq .Data.motivation "Insertion")) (eq .Data.motivation "Administratif"))}}<div class="mt-4"><span class="text-xs p-2 bg-co-green text-white rounded-2xl">Trajet garanti : {{.Data.motivation}}</span></div>{{end}}
</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

@ -42,7 +42,7 @@
</div>
<div class="sm:col-span-1">
<dt class="text-sm font-medium text-gray-500">Horaire rendez vous passager</dt>
<dd class="mt-1 text-sm text-gray-900">{{ .driver_journey.PassengerPickupDate.Format "02/01/2006 15:04"}}</dd>
<dd class="mt-1 text-sm text-gray-900">{{ timeFormat .driver_journey.PassengerPickupDate "02/01/2006 15:04"}}</dd>
</div>
<div class="sm:col-span-1">
<dt class="text-sm font-medium text-gray-500">Temps de trajet (passager)</dt>
@ -70,6 +70,16 @@
</div>
<div class="border-t border-gray-200 px-4 py-5 sm:px-6">
<dl class="grid grid-cols-1 gap-x-4 gap-y-8 sm:grid-cols-2">
<div class="sm:col-span-1">
<dt class="text-sm font-medium text-gray-500">Profil validé</dt>
<dd class="mt-1 text-sm text-gray-900">
{{if solidarityDriverValidatedProfile .driver (solidarityDocuments .driver.ID)}}
<span class="p-1 px-2 text-xs bg-co-green rounded-2xl">Oui</span>
{{else}}
<span class="p-1 px-2 text-xs bg-co-red text-white rounded-2xl">Non</span>
{{end}}
</dd>
</div>
{{if .driver.Data.email}}
<div class="sm:col-span-1">
<dt class="text-sm font-medium text-gray-500">Email</dt>

View File

@ -9,10 +9,51 @@
{{ else if eq .ViewState.booking.Status "VALIDATED"}}
<div class="mt-4"><span class="p-1 text-sm bg-co-green rounded-2xl px-4">Validé</span></div>
{{ else if eq .ViewState.booking.Status "CANCELLED"}}
<div class="mt-4"><span class="p-1 text-sm bg-co-red text-white rounded-2xl px-4">Annulé</span></div>
<div class="mt-4"><span class="p-1 text-sm bg-co-red text-white rounded-2xl px-4">Annulé : {{.ViewState.booking.Data.reason}}</span></div>
{{ end }}
<div
class="mt-6 flex flex-col-reverse justify-stretch space-y-4 space-y-reverse sm:flex-row-reverse sm:justify-end sm:space-x-reverse sm:space-y-0 sm:space-x-3 md:mt-0 md:flex-row md:space-x-3">
{{$dialog := "modif"}}
<div x-data="{ {{ $dialog }}: false}">
<button @click="{{ $dialog }} = !{{ $dialog }}" type="button" class="bg-white 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">
Modifier
</button>
<div x-show="{{$dialog}}" class="relative z-10" aria-labelledby="modal-title" role="dialog" aria-modal="true">
<div class="fixed inset-0 bg-gray-500 bg-opacity-75 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 max-w-lg sm:p-6">
<form method="POST">
<div class="mx-auto flex h-12 w-12 items-center justify-center rounded-co bg-co-blue text-white">
{{$.IconSet.Icon "hero:outline/information-circle" "h-6 w-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">Modifier</h3>
<div class="mt-2">
<p class="text-sm text-gray-500"></p>
</div>
<div>
<label for="driver_distance" class="block text-sm font-medium text-gray-700">Kilomètres conducteur</label>
<div class="mt-1">
<input type="text" name="driver_distance" id="driver_distance" class="block w-full rounded-2xl border-gray-300 shadow-sm focus:border-co-blue focus:ring-co-blue sm:text-sm" value="{{.ViewState.booking.Journey.DriverDistance}}" />
</div>
</div>
</div>
<div class="mt-5 sm:mt-6 sm:grid sm:grid-flow-row-dense sm:grid-cols-2">
<button @click="{{$dialog}} = !{{$dialog}}" type="button" class="mt-3 inline-flex w-full justify-center rounded-l-2xl border border-gray-300 bg-white px-4 py-2 text-base font-medium text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-co-blue focus:ring-offset-2 sm:col-start-1 sm:mt-0 sm:text-sm">Annuler</button>
<button type="submit" class="inline-flex w-full justify-center rounded-r-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:col-start-2 sm:text-sm">Valider</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- <button type="button"
class="inline-flex items-center justify-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-2xl text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-100 focus:ring-co-blue">Supprimer</button> -->
{{if eq .ViewState.booking.Status "CANCELLED" }}
@ -28,8 +69,51 @@
class="w-full px-4 py-2 border border-transparent text-sm font-medium rounded-2xl shadow-sm text-white bg-co-blue hover:bg-co-blue focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-100 focus:ring-co-blue">Remettre en attente</button></a>
{{end}}
{{if ne .ViewState.booking.Status "CANCELLED" }}
<a href="/app/solidarity-transport/bookings/{{.ViewState.booking.Id}}/cancel" class="inline-flex"><button type="button"
class="w-full px-4 py-2 border border-transparent text-sm font-medium rounded-2xl shadow-sm text-white bg-co-red hover:bg-co-red focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-100 focus:ring-co-blue">Annuler</button></a>
<!--<a href="/app/solidarity-transport/bookings/{{.ViewState.booking.Id}}/cancel" class="inline-flex"><button type="button"
class="w-full px-4 py-2 border border-transparent text-sm font-medium rounded-2xl shadow-sm text-white bg-co-red hover:bg-co-red focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-100 focus:ring-co-blue">Annuler</button></a>-->
{{$dialog := "cancel"}}
<div x-data="{ {{ $dialog }}: false}">
<button @click="{{ $dialog }} = !{{ $dialog }}" type="button" class="bg-co-red border-gray-300 border px-4 py-2 text-white items-center text-sm rounded-2xl focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-co-blue">
Annuler
</button>
<div x-show="{{$dialog}}" class="relative z-10" aria-labelledby="modal-title" role="dialog" aria-modal="true">
<div class="fixed inset-0 bg-gray-500 bg-opacity-75 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 max-w-lg sm:p-6">
<form method="POST" action="/app/solidarity-transport/bookings/{{.ViewState.booking.Id}}/cancel">
<div class="mx-auto flex h-12 w-12 items-center justify-center rounded-co bg-co-blue text-white">
{{$.IconSet.Icon "hero:outline/information-circle" "h-6 w-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">Annuler</h3>
<div class="mt-2">
<p class="text-sm text-gray-500"></p>
</div>
<div>
<label for="reason" class="block text-sm font-medium text-gray-700">Raison de l'annulation</label>
<div class="mt-1">
<select name="reason" id="reason" class="block w-full rounded-2xl border-gray-300 shadow-sm focus:border-co-blue focus:ring-co-blue sm:text-sm">
<option value="Trajet annulé par le passager">Trajet annulé par le passager</option>
<option value="Trajet non réalisé">Trajet non réalisé</option>
<option value="Refusé par le bénévole">Refusé par le bénévole</option>
<option value="Autre" selected="selected">Autre</option>
</select>
</div>
</div>
</div>
<div class="mt-5 sm:mt-6 sm:grid sm:grid-flow-row-dense sm:grid-cols-2">
<button @click="{{$dialog}} = !{{$dialog}}" type="button" class="mt-3 inline-flex w-full justify-center rounded-l-2xl border border-gray-300 bg-white px-4 py-2 text-base font-medium text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-co-blue focus:ring-offset-2 sm:col-start-1 sm:mt-0 sm:text-sm">Annuler</button>
<button type="submit" class="inline-flex w-full justify-center rounded-r-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:col-start-2 sm:text-sm">Valider</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
{{end}}
</div>
</div>

View File

@ -46,18 +46,23 @@
<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="Santé">Santé</option>
<option value="Insertion">Insertion</option>
<option value="Administratif">Administratif</option>
<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>
</select>
</div>
{{template "submit_with_sms"
dict "IconSet" .IconSet
"Viewstate" .ViewState
"ComponentState" (dict "submitText"
"Envoyer la mise en relation")
"ComponentState" (dict "submitText" "Envoyer la mise en relation"
"doNotSendOption" true)
"SMSState" (dict "name" (.ViewState.config.GetString "service_name")
"datetime" (timeFormat .ViewState.driver_journey.PassengerPickupDate "02/01/2006 15:04")
"baseUrl" (.ViewState.config.GetString "base_url") )}}
</form>
{{end}}

View File

@ -55,7 +55,7 @@
</div>
<div class="sm:col-span-1">
<dt class="font-medium text-gray-500">Date et heure du rendez-vous</dt>
<dd class="mt-1 text-gray-900">{{ .ViewState.booking.Journey.PassengerPickupDate.Format "02/01/2006 15:04"}}</dd>
<dd class="mt-1 text-gray-900">{{ timeFormat .ViewState.booking.Journey.PassengerPickupDate "02/01/2006 15:04"}}</dd>
</div>
{{if eq .ViewState.booking.Status "VALIDATED"}}
<div class="sm:col-span-1">