feat : creation du composant datatable (WIP)

This commit is contained in:
2026-02-16 16:05:04 +01:00
parent d16a81630c
commit 316a20c43a
7 changed files with 358 additions and 130 deletions

View File

@@ -0,0 +1,41 @@
export const formatBovinShipments = (value: unknown): string => {
if (!Array.isArray(value) || value.length === 0) return '-'
return value.map((item: any) => {
const label = item?.shipmentType?.label ?? item?.shipmentType?.code ??
'Type inconnu'
const qty = item?.nbBovinSend ?? '-'
return `${label} (${qty})`
}).join(', ')
}
export const formatWeights = (value: unknown): string => {
if (!Array.isArray(value) || value.length === 0) return '-'
return value
.map((item: any) => {
const type = item?.type === 'tare'
? 'Poids à vide'
: item?.type === 'gross'
? 'Poids à plein'
: (item?.type ?? 'Poids')
const weight = item?.weight ?? '-'
return `${type}: ${weight}`
})
.join(', ')
}
export const formatPelletBuildings = (value: unknown): string => {
if (!Array.isArray(value) || value.length === 0) return '-'
return value
.map((item: any) => {
const pelletLabel =
item?.pelletType?.label ?? item?.pelletType?.code ?? 'Granule inconnu'
const buildingLabel =
item?.building?.label ?? item?.building?.code ?? 'Bâtiment inconnu'
return `${pelletLabel} : ${buildingLabel}`
})
.join('\n')
}