From 6aab112ecb32389aeadd6a719ae7c370599202d0 Mon Sep 17 00:00:00 2001 From: perco Date: Wed, 20 May 2026 16:23:34 +0200 Subject: [PATCH] =?UTF-8?q?feat(voyage):=20affichage=20d=C3=A9taill=C3=A9?= =?UTF-8?q?=20des=20gares=20de=20p=C3=A9age=20par=20segment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Chaque segment affiche maintenant la gare d'entrée et de sortie - Affichage de l'opérateur (APRR, COFIROUTE, SANEF...) - Style amélioré : distance + gares sur la même ligne - Ajout du champ 'op' dans la réponse API Co-Authored-By: Claude Sonnet 4.6 --- modules/holidays/views/detail.php | 24 +++++++++++++++++++----- modules/voyage/api.php | 1 + 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/modules/holidays/views/detail.php b/modules/holidays/views/detail.php index abd4f7f..d0540be 100644 --- a/modules/holidays/views/detail.php +++ b/modules/holidays/views/detail.php @@ -458,14 +458,28 @@ async function estimateTripCost() { html += ''; if (data.segments && data.segments.length) { - html += '
Détail par segment'; + html += '
'; + html += '
Détail du trajet
'; data.segments.forEach(s => { - html += `
- 📍 ${s.from} → ${s.to} - ${Math.round(s.distance_km)} km · péage: ${s.toll.toFixed(2)} € + html += `
`; + html += `
+ 📍 ${esc(s.from)} → ${esc(s.to)} + péage : ${s.toll.toFixed(2)} €
`; + html += `
🛣️ ${Math.round(s.distance_km)} km`; + if (s.entry_plaza && s.exit_plaza) { + html += ` · ${esc(s.entry_plaza)} → ${esc(s.exit_plaza)}`; + if (s.op) html += ` ${esc(s.op)}`; + } else if (s.note) { + html += ` · ${esc(s.note)}`; + } + html += '
'; }); - html += '
'; + html += ''; + } + + function esc(s) { + return String(s ?? '').replace(/&/g,'&').replace(//g,'>'); } result.innerHTML = html; diff --git a/modules/voyage/api.php b/modules/voyage/api.php index 7491686..0e8f4e4 100644 --- a/modules/voyage/api.php +++ b/modules/voyage/api.php @@ -224,6 +224,7 @@ for ($i = 0; $i < count($stops) - 1; $i++) { ]; if ($entryPlaza) $seg['entry_plaza'] = $entryPlaza; if ($exitPlaza) $seg['exit_plaza'] = $exitPlaza; + if ($bestOp) $seg['op'] = $bestOp; if ($tollNote) $seg['note'] = $tollNote; $segments[] = $seg;