diff --git a/frontend/pages/bovine/[id].vue b/frontend/pages/bovine/[id].vue index d1ed0f8..4db4650 100644 --- a/frontend/pages/bovine/[id].vue +++ b/frontend/pages/bovine/[id].vue @@ -3,7 +3,7 @@
-
+
{ + if (window.history.state?.back) { + router.back() + } else { + router.push('/inventory') + } +} + const bovine = ref(null) const buildings = ref([]) const newMovementBuildingId = ref(null) diff --git a/frontend/pages/infrastructure/bovine.vue b/frontend/pages/infrastructure/bovine.vue deleted file mode 100644 index 3eeeb35..0000000 --- a/frontend/pages/infrastructure/bovine.vue +++ /dev/null @@ -1,182 +0,0 @@ - - - diff --git a/frontend/pages/infrastructure/case.vue b/frontend/pages/infrastructure/case.vue index 8de1836..220ee52 100644 --- a/frontend/pages/infrastructure/case.vue +++ b/frontend/pages/infrastructure/case.vue @@ -23,14 +23,6 @@
- - - Ajouter -
@@ -56,7 +48,7 @@ :items="items" :total-items="totalItems" :loading="loading" - :row-clickable="auth.isAdmin" + row-clickable empty-message="Aucun bovin dans cette case." @row-click="goToBovine" > @@ -134,7 +126,6 @@ useHead({ title: 'Cases' }) import type { BuildingCaseData } from '~/services/dto/building-case-data' import type { BovineData } from '~/services/dto/bovine-data' -import { useAuthStore } from '~/stores/auth' import { useDataTableServerState } from '~/composables/useDataTableServerState' import { useBovineColumns } from '~/composables/useBovineColumns' import { formatAgeLabel, ageBadgeClass } from '~/utils/bovine-age' @@ -143,7 +134,6 @@ const route = useRoute() const router = useRouter() const { printPdf } = usePdfPrinter() const api = useApi() -const auth = useAuthStore() const caseId = computed(() => Number(route.query.id)) const hasCaseId = computed(() => Number.isFinite(caseId.value) && caseId.value > 0) @@ -233,11 +223,6 @@ const title = computed(() => { return `${buildingLabel} case ${caseNumber}`.trim() }) -const addBovineRoute = computed(() => ({ - path: '/infrastructure/bovine', - query: { caseId: String(caseId.value) } -})) - const formatDate = (date: string | null) => { if (!date) return '—' const d = new Date(date) @@ -270,11 +255,7 @@ const printCaseReport = async () => { } const goToBovine = (bovine: BovineData) => { - if (!auth.isAdmin) return - router.push({ - path: '/infrastructure/bovine', - query: { id: String(bovine.id), caseId: String(caseId.value) } - }) + router.push(`/bovine/${bovine.id}`) } watch(caseId, (id) => {