From 7ddf495d7f9c73520d13189fdadacdd38d23fe65 Mon Sep 17 00:00:00 2001 From: tristan Date: Wed, 17 Jun 2026 17:46:58 +0200 Subject: [PATCH] =?UTF-8?q?style(transport)=20:=20tableau=20prix=20consult?= =?UTF-8?q?ation=20=E2=80=94=20code=20du=20site=20(d=C3=A9partement)=20+?= =?UTF-8?q?=20en-t=C3=AAtes=20Forfait/Tonne=20(=E2=82=AC)=20(ERP-172)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/i18n/locales/fr.json | 4 ++-- .../transport/pages/carriers/[id]/index.vue | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/frontend/i18n/locales/fr.json b/frontend/i18n/locales/fr.json index 440175b..be42253 100644 --- a/frontend/i18n/locales/fr.json +++ b/frontend/i18n/locales/fr.json @@ -558,8 +558,8 @@ "carrier": "Transporteurs", "aproOrSite": "Adresse sites", "delivery": "Adresse livraisons", - "forfait": "Forfait €", - "tonne": "Tonne €", + "forfait": "Forfait (€)", + "tonne": "Tonne (€)", "indexation": "Indexation", "state": "État du prix", "export": "Exporter", diff --git a/frontend/modules/transport/pages/carriers/[id]/index.vue b/frontend/modules/transport/pages/carriers/[id]/index.vue index 392eabe..8e66616 100644 --- a/frontend/modules/transport/pages/carriers/[id]/index.vue +++ b/frontend/modules/transport/pages/carriers/[id]/index.vue @@ -253,6 +253,7 @@ import { showArchiveAction, showRestoreAction, type CarrierPriceRead, + type Relation, } from '~/modules/transport/utils/forms/carrierMappers' import { extractApiErrorMessage } from '~/shared/utils/api' @@ -354,16 +355,25 @@ function formatAmount(value: string | null | undefined): string { return `${n.toLocaleString('fr-FR', { minimumFractionDigits: 2, maximumFractionDigits: 2 })} €` } +/** Code du site = département (2 premiers chiffres du code postal, ex: 86 / 17 / 82). */ +function siteCode(relation: Relation): string { + if (!relation || typeof relation === 'string') { + return '' + } + const postalCode = relation.postalCode as string | undefined + return postalCode ? postalCode.slice(0, 2) : '' +} + /** * Construit une ligne d'affichage depuis un prix embarqué (maquette Prix) : - * - « Adresse sites » = le site (Châtellerault / Saint-Jean / Pommevic…) ; + * - « Adresse sites » = le CODE du site (département, ex: 86 / 17 / 82) ; * - « Adresse livraisons » = l'adresse (voie) du client/fournisseur ; * - le prix tombe dans Forfait € OU Tonne € selon `pricingUnit`. */ function toPriceRow(price: CarrierPriceRead): PriceRowView { const isClient = price.direction === 'CLIENT' return { - apro: isClient ? labelOfRelation(price.departureSite) : labelOfRelation(price.deliverySite), + apro: isClient ? siteCode(price.departureSite) : siteCode(price.deliverySite), delivery: isClient ? labelOfRelation(price.clientDeliveryAddress) : labelOfRelation(price.supplierSupplyAddress), forfait: price.pricingUnit === 'FORFAIT' ? formatAmount(price.price) : '', tonne: price.pricingUnit === 'TONNE' ? formatAmount(price.price) : '',