diff --git a/frontend/composables/useBovineColumns.ts b/frontend/composables/useBovineColumns.ts new file mode 100644 index 0000000..bdb228b --- /dev/null +++ b/frontend/composables/useBovineColumns.ts @@ -0,0 +1,47 @@ +import { computed } from 'vue' +import { useAuthStore } from '~/stores/auth' + +export interface BovineColumn { + key: string + label: string + width?: string +} + +/** + * Définition partagée des colonnes des tableaux bovins (inventory + case). + * Deux définitions distinctes admin/user pour pouvoir ajuster les largeurs + * indépendamment selon le contexte. + */ +export const useBovineColumns = () => { + const auth = useAuthStore() + + const adminColumns: BovineColumn[] = [ + { key: 'nationalNumber', label: 'N° National', width: '80px' }, + { key: 'workNumber', label: 'N° Travail', width: '60px' }, + { key: 'sex', label: 'Sexe', width: '70px' }, + { key: 'birthDate', label: 'Né le', width: '72px' }, + { key: 'age', label: 'Age', width: '110px' }, + { key: 'breedCode', label: 'Race', width: '70px' }, + { key: 'buildingCase.building.label', label: 'Bâtiment', width: '1fr' }, + { key: 'buildingCase.caseNumber', label: 'Case', width: '42px' }, + { key: 'arrivalDate', label: 'Entrée le', width: '90px' }, + { key: 'pricePerKg', label: 'Prix/kg', width: '65px' }, + { key: 'finalPrice', label: 'Prix total', width: '100px' } + ] + + const userColumns: BovineColumn[] = [ + { key: 'nationalNumber', label: 'N° National', width: '80px' }, + { key: 'workNumber', label: 'N° Travail', width: '60px' }, + { key: 'sex', label: 'Sexe', width: '70px' }, + { key: 'birthDate', label: 'Né le', width: '72px' }, + { key: 'age', label: 'Age', width: '110px' }, + { key: 'breedCode', label: 'Race', width: '70px' }, + { key: 'buildingCase.building.label', label: 'Bâtiment', width: '1fr' }, + { key: 'buildingCase.caseNumber', label: 'Case', width: '42px' }, + { key: 'arrivalDate', label: 'Entrée le', width: '90px' } + ] + + const columns = computed(() => auth.isAdmin ? adminColumns : userColumns) + + return { columns } +} diff --git a/frontend/pages/infrastructure/case.vue b/frontend/pages/infrastructure/case.vue index 7479157..9306352 100644 --- a/frontend/pages/infrastructure/case.vue +++ b/frontend/pages/infrastructure/case.vue @@ -33,7 +33,22 @@ -
+
+
+ {{ stats.over24 }} + ≥ 24 mois +
+
+ {{ stats.between22And24 }} + 22 – 24 mois +
+
+ {{ stats.between20And22 }} + 20 – 22 mois +
+
+ +