improve guaranteed trips

This commit is contained in:
Arnaud Delcasse 2025-10-09 00:20:38 +02:00
parent 80c40759bb
commit 49aff4318b
2 changed files with 3 additions and 2 deletions

View File

@ -47,8 +47,9 @@
if (status === 'CANCELLED') return { class: 'p-1 text-xs bg-co-red text-white rounded-xl', text: 'Annulé' }; if (status === 'CANCELLED') return { class: 'p-1 text-xs bg-co-red text-white rounded-xl', text: 'Annulé' };
return { class: '', text: '' }; return { class: '', text: '' };
}, },
guaranteedMotivations: {{ json .ViewState.guaranteed_trip_motivations }},
isGuaranteedTrip(motivation) { isGuaranteedTrip(motivation) {
return motivation === 'Santé' || motivation === 'Insertion' || motivation === 'Administratif'; return this.guaranteedMotivations.includes(motivation);
} }
}"> }">

View File

@ -4,7 +4,7 @@
Transport solidaire Transport solidaire
</h1> </h1>
{{if and .ViewState.booking.Data.motivation (or (or (eq .ViewState.booking.Data.motivation "Santé") (eq .ViewState.booking.Data.motivation "Insertion")) (eq .ViewState.booking.Data.motivation "Administratif"))}} {{if and .ViewState.booking.Data.motivation (isGuaranteedTripMotivation .ViewState.booking.Data.motivation)}}
<div class="mt-4"><span class="text-sm p-2 bg-co-green text-white rounded-2xl">Trajet garanti : {{.ViewState.booking.Data.motivation}}</span></div> <div class="mt-4"><span class="text-sm p-2 bg-co-green text-white rounded-2xl">Trajet garanti : {{.ViewState.booking.Data.motivation}}</span></div>
{{end}} {{end}}