Compare commits

..

2 Commits

Author SHA1 Message Date
941e3d2258 Merge branch 'refs/heads/develop' into feat/poc-identification-bovin
# Conflicts:
#	.idea/workspace.xml
#	frontend/i18n/locales/fr.json
#	frontend/layouts/default.vue
2026-02-13 10:47:29 +01:00
6421419812 feat : Ajout d'un écran pour afficher les informations d'un bovin 2026-02-02 11:35:10 +01:00
4 changed files with 98 additions and 1 deletions

View File

@@ -0,0 +1,49 @@
<template>
<div>
<div class="flex justify-between">
<h1 class="font-bold text-4xl uppercase">Passeport du bovin</h1>
<p v-if="bovinData">{{ bovinData.presencePeriod }}</p>
</div>
<div class="overflow-x-auto mt-12" v-if="bovinData">
<table class="w-full border-collapse border border-black text-sm">
<tr>
<th
rowspan="2"
class="w-10 border border-black p-0 align-middle"
>
<div class="flex h-full w-full items-center justify-center">
<span class="-rotate-90 whitespace-nowrap font-semibold tracking-widest">
VEAU
</span>
</div>
</th>
<th class="border border-black px-4 py-3 text-center font-semibold">N° de travail</th>
<th class="border border-black px-4 py-3 text-center font-semibold">Sexe</th>
<th class="border border-black px-4 py-3 text-center font-semibold">Code Race</th>
<th class="border border-black px-4 py-3 text-center font-semibold">Code pays</th>
<th class="border border-black px-4 py-3 text-center font-semibold">Type de racial</th>
<th class="border border-black px-4 py-3 text-center font-semibold">Date de naissance</th>
</tr>
<tr>
<th class="border border-black px-4 py-3 text-center font-semibold">{{ bovinData.workNumber }}</th>
<th class="border border-black px-4 py-3 text-center font-semibold">{{ bovinData.sex }}</th>
<th class="border border-black px-4 py-3 text-center font-semibold">{{ bovinData.breedType }}</th>
<th class="border border-black px-4 py-3 text-center font-semibold">FR {{ bovinData.numeroNational }}</th>
<th class="border border-black px-4 py-3 text-center font-semibold">???</th>
<th class="border border-black px-4 py-3 text-center font-semibold">{{ bovinData.birthDate }}</th>
</tr>
</table>
</div>
</div>
</template>
<script setup lang="ts">
import {getBovinData} from "~/services/identification-bovin";
const bovinData = ref<IdentificationBovinData|null>()
onMounted(async () => {
bovinData.value = await getBovinData('7979580026');
})
</script>

View File

@@ -0,0 +1,22 @@
interface IdentificationBovinData {
numeroNational: string,
sex: string | null,
breedType: string | null,
workNumber: string | null,
birthDate: string | null,
birthDateCompletenessFlag: string | null,
isFilie: boolean | null,
motherNationalNumber: string | null,
motherBreedType: string | null,
fatherNationalNumber: string | null,
fatherBreedType: string | null,
birthExploitationNumber: string | null,
presencePeriod: PresencePeriod[]
}
interface PresencePeriod {
entryDate: string | null,
entryCause: string | null,
exitDate: string | null,
exitCause: string | null
}

View File

@@ -0,0 +1,25 @@
import { useApi } from '~/composables/useApi'
export type BovinDataResponse =
| IdentificationBovinData
| { 'hydra:member'?: IdentificationBovinData }
export async function getBovinData(
nationalNumber: string
): Promise<IdentificationBovinData | null> {
const api = useApi()
const response = await api.get<BovinDataResponse>(
`bovins/${nationalNumber}/identification`,
{},
{ toastErrorKey: 'errors.building.list' }
)
if (response && typeof response === 'object') {
// direct item
if (!('hydra:member' in response)) return response as IdentificationBovinData
// hydra format
if (response['hydra:member']) return response['hydra:member']
}
return null
}

View File

@@ -15,7 +15,8 @@ use App\State\BovinIdentificationProvider;
uriTemplate: '/bovins/{numeroNational}/identification',
provider: BovinIdentificationProvider::class
),
]
],
security: "is_granted('ROLE_USER')",
)]
final class BovinIdentification
{