feat(transport) : upload décharge + i18n transporteur (ERP-171) #130

Merged
tristan merged 10 commits from feat/erp-171-carrier-upload-i18n into develop 2026-06-18 08:50:16 +00:00
2 changed files with 14 additions and 4 deletions
Showing only changes of commit 7ddf495d7f - Show all commits
+2 -2
View File
@@ -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",
@@ -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) : '',