feat : calcul de l'âge en mois côté back + colonne Age et alertes visuelles
- Champ ageMonths (int) ajouté à Bovine avec migration - Lifecycle PrePersist/PreUpdate pour maintenir la cohérence - Sync processor recalcule explicitement ageMonths à chaque passage (cron-friendly) - Colonne Age + rowClass côté front : rouge >= 24 mois, orange 22-24 mois - Util formatAgeLabel remplace le calcul client - Boutons pagination Prev/Next en français avec style bouton bordure primary - Colonnes Sexe/N° Travail réduites au profit de Bâtiment Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
10
frontend/utils/bovine-age.ts
Normal file
10
frontend/utils/bovine-age.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
export const formatAgeLabel = (months: number | null | undefined): string => {
|
||||
if (months === null || months === undefined) return '—'
|
||||
const years = Math.floor(months / 12)
|
||||
const remaining = months % 12
|
||||
let label = ''
|
||||
if (years > 0) label = `${years} an${years > 1 ? 's' : ''}`
|
||||
if (remaining > 0) label += `${label ? ' ' : ''}${remaining} mois`
|
||||
if (!label) label = '< 1 mois'
|
||||
return label
|
||||
}
|
||||
Reference in New Issue
Block a user