Compare commits
2 Commits
v0.0.81
...
feat/poc-i
| Author | SHA1 | Date | |
|---|---|---|---|
| 941e3d2258 | |||
| 6421419812 |
49
frontend/pages/identification-bovin.vue
Normal file
49
frontend/pages/identification-bovin.vue
Normal 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>
|
||||
22
frontend/services/dto/identification-bovin-data.ts
Normal file
22
frontend/services/dto/identification-bovin-data.ts
Normal 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
|
||||
}
|
||||
25
frontend/services/identification-bovin.ts
Normal file
25
frontend/services/identification-bovin.ts
Normal 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
|
||||
}
|
||||
@@ -15,7 +15,8 @@ use App\State\BovinIdentificationProvider;
|
||||
uriTemplate: '/bovins/{numeroNational}/identification',
|
||||
provider: BovinIdentificationProvider::class
|
||||
),
|
||||
]
|
||||
],
|
||||
security: "is_granted('ROLE_USER')",
|
||||
)]
|
||||
final class BovinIdentification
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user