feat(bovine-type) : piloter l'affichage en réception via un champ display [#FER-30]

Ajoute un champ display (défaut false) sur BovineType : seuls les types
activés par un admin apparaissent à la sélection des races en réception.
Les types créés par la synchro inventaire restent masqués par défaut.

- Affichage des races en grille 4 colonnes (création réception)
- Édition réception : conserve les types déjà saisis même masqués
- Admin : badge "Affiché en réception" + checkbox dans le formulaire

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-21 11:33:17 +02:00
parent 39f67b3c90
commit 50dd660713
8 changed files with 108 additions and 20 deletions

View File

@@ -5,9 +5,13 @@ export type BovineTypeListResponse =
| BovineTypeData[]
| { 'hydra:member'?: BovineTypeData[] }
export async function getBovineTypeList(): Promise<BovineTypeData[]> {
export async function getBovineTypeList(filters: { display?: boolean } = {}): Promise<BovineTypeData[]> {
const api = useApi()
const response = await api.get<BovineTypeListResponse>('bovine_types', {}, {
const query: Record<string, string> = {}
if (filters.display !== undefined) {
query.display = filters.display ? 'true' : 'false'
}
const response = await api.get<BovineTypeListResponse>('bovine_types', query, {
toastErrorKey: 'errors.bovin.list'
})
@@ -51,10 +55,12 @@ export async function updateBovin(id: number, payload: BovinPayload = {}): Promi
const mapToBovineTypeData = (item: BovineTypeData): BovineTypeData => ({
id: item.id,
label: item.label,
code: item.code
code: item.code,
display: item.display ?? false
})
const toBovineTypePayload = (payload: BovinPayload): Partial<BovineTypeData> => ({
label: payload.label ?? undefined,
code: payload.code ?? undefined
code: payload.code ?? undefined,
display: payload.display ?? undefined
})