From 865e580b6e877ae213731ea2fa36f0e45bf1d09c Mon Sep 17 00:00:00 2001 From: tristan Date: Fri, 19 Jun 2026 10:50:25 +0200 Subject: [PATCH] =?UTF-8?q?fix(transport)=20:=20tableau=20prix=20=E2=80=94?= =?UTF-8?q?=20colonne=20Fournisseurs/Clients,=20fusion=20adresses=20sites/?= =?UTF-8?q?livraisons,=20renomme=20Transport=20(ERP-193)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/i18n/locales/fr.json | 7 ++-- .../transport/pages/carriers/[id]/index.vue | 41 +++++++++++-------- .../forms/__tests__/carrierMappers.test.ts | 4 ++ .../transport/utils/forms/carrierMappers.ts | 9 +++- 4 files changed, 38 insertions(+), 23 deletions(-) diff --git a/frontend/i18n/locales/fr.json b/frontend/i18n/locales/fr.json index e6bba9e..4c35833 100644 --- a/frontend/i18n/locales/fr.json +++ b/frontend/i18n/locales/fr.json @@ -554,10 +554,9 @@ "message": "Ce transporteur réapparaîtra dans le répertoire actif. Confirmer la restauration ?" }, "price": { - "group": "Type de transport", - "carrier": "Transporteurs", - "aproOrSite": "Adresse sites", - "delivery": "Adresse livraisons", + "group": "Transport", + "carrier": "Fournisseurs / Clients", + "aproOrSite": "Adresse sites / livraisons", "forfait": "Forfait (€)", "tonne": "Tonne (€)", "indexation": "Indexation", diff --git a/frontend/modules/transport/pages/carriers/[id]/index.vue b/frontend/modules/transport/pages/carriers/[id]/index.vue index 5a3f272..c1b97c7 100644 --- a/frontend/modules/transport/pages/carriers/[id]/index.vue +++ b/frontend/modules/transport/pages/carriers/[id]/index.vue @@ -145,18 +145,18 @@ groupe (Fond Mouvant / Benne) fusionné en rowspan ; séparateur épais entre les deux groupes. --> - + - - + + + + + + - - - - - @@ -164,7 +164,6 @@ - @@ -187,9 +186,13 @@ > {{ group.label }} - - - + + + @@ -197,7 +200,7 @@ - @@ -346,6 +349,8 @@ function countryOptionsFor(country: string): SelectOption[] { const PRICE_GROUP_ORDER = ['FOND_MOUVANT', 'BENNE'] as const interface PriceRowView { + /** Fournisseur ou client lié au prix (raison sociale). */ + party: string apro: string delivery: string forfait: string @@ -383,13 +388,15 @@ function siteCode(relation: Relation): string { /** * Construit une ligne d'affichage depuis un prix embarqué (maquette Prix) : - * - « Adresse sites » = le CODE du site (département, ex: 86 / 17 / 82) ; - * - « Adresse livraisons » = l'adresse (voie) du client/fournisseur ; + * - « Fournisseurs / Clients » = le fournisseur OU le client lié (raison sociale) ; + * - « Adresse sites / livraisons » = code du site (département) + adresse de + * livraison/appro du client/fournisseur, regroupés dans une seule colonne ; * - le prix tombe dans Forfait € OU Tonne € selon `pricingUnit`. */ function toPriceRow(price: CarrierPriceRead): PriceRowView { const isClient = price.direction === 'CLIENT' return { + party: labelOfRelation(isClient ? price.client : price.supplier), apro: isClient ? siteCode(price.departureSite) : siteCode(price.deliverySite), delivery: isClient ? labelOfRelation(price.clientDeliveryAddress) : labelOfRelation(price.supplierSupplyAddress), forfait: price.pricingUnit === 'FORFAIT' ? formatAmount(price.price) : '', diff --git a/frontend/modules/transport/utils/forms/__tests__/carrierMappers.test.ts b/frontend/modules/transport/utils/forms/__tests__/carrierMappers.test.ts index 2db002d..4cc6cb5 100644 --- a/frontend/modules/transport/utils/forms/__tests__/carrierMappers.test.ts +++ b/frontend/modules/transport/utils/forms/__tests__/carrierMappers.test.ts @@ -27,6 +27,10 @@ describe('carrierMappers', () => { expect(iriOf(undefined)).toBeNull() }) + it('labelOfRelation : companyName (client/fournisseur) prioritaire sur name/adresse', () => { + expect(labelOfRelation({ '@id': '/api/suppliers/8', companyName: 'AAAAAAA', name: 'X' })).toBe('AAAAAAA') + }) + it('labelOfRelation : name (site) à défaut adresse condensée', () => { expect(labelOfRelation({ '@id': '/api/sites/1', name: 'Châtellerault' })).toBe('Châtellerault') expect(labelOfRelation({ '@id': '/api/client_addresses/8', street: '1 rue X', postalCode: '86000', city: 'Poitiers' })).toBe('1 rue X · 86000 · Poitiers') diff --git a/frontend/modules/transport/utils/forms/carrierMappers.ts b/frontend/modules/transport/utils/forms/carrierMappers.ts index a474f77..6ea50a1 100644 --- a/frontend/modules/transport/utils/forms/carrierMappers.ts +++ b/frontend/modules/transport/utils/forms/carrierMappers.ts @@ -97,13 +97,18 @@ export function iriOf(relation: Relation): string | null { } /** - * Libellé d'affichage d'une relation embarquée : `name` (site) à défaut une adresse - * condensée (voie · CP · ville). Chaîne vide si la relation est un IRI nu / absente. + * Libellé d'affichage d'une relation embarquée : `companyName` (client/fournisseur) + * à défaut `name` (site), à défaut une adresse condensée (voie · CP · ville). Chaîne + * vide si la relation est un IRI nu / absente. */ export function labelOfRelation(relation: Relation): string { if (!relation || typeof relation === 'string') { return '' } + const companyName = relation.companyName as string | undefined + if (companyName) { + return companyName + } const name = relation.name as string | undefined if (name) { return name
{{ t('transport.carriers.consultation.price.group') }} {{ t('transport.carriers.consultation.price.carrier') }} {{ t('transport.carriers.consultation.price.aproOrSite') }}{{ t('transport.carriers.consultation.price.delivery') }} {{ t('transport.carriers.consultation.price.forfait') }} {{ t('transport.carriers.consultation.price.tonne') }} {{ t('transport.carriers.consultation.price.indexation') }}{{ headerTitle }}{{ row.apro }}{{ row.delivery }}{{ row.party }} +
{{ row.apro }}
+
{{ row.delivery }}
+
{{ row.forfait }} {{ row.tonne }} {{ row.indexation }}
+ {{ t('transport.carriers.consultation.price.empty') }}