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 } }