feat : creation du composant datatable (WIP)

This commit is contained in:
2026-02-18 14:54:18 +01:00
parent c229d0ab62
commit 32fe51caaa
20 changed files with 287 additions and 64 deletions

View File

@@ -11,13 +11,18 @@ export const formatBovinShipments = (value: unknown): string => {
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('\n ')
let gross = 0
let tare = 0
for (const item of value as Array<{ type?: string; weight?:
unknown }>) {
const w = Number(item.weight)
if (!Number.isFinite(w)) continue
if (item.type === 'gross') gross += w
else if (item.type === 'tare') tare += w
}
return `${gross - tare} kg`
}
export const formatRoleLabels = (