feat: mejorar pos movil y cierre de jornada
This commit is contained in:
@@ -16,14 +16,9 @@
|
||||
|
||||
<v-main>
|
||||
<v-container fluid class="pa-4 pa-md-6">
|
||||
<div class="d-flex flex-wrap align-center justify-space-between mb-3 ga-2">
|
||||
<v-breadcrumbs :items="breadcrumbs" class="pa-0" aria-label="Migas de pan">
|
||||
<template #prepend><v-icon icon="mdi-home-outline" size="small" /></template>
|
||||
</v-breadcrumbs>
|
||||
<div class="d-flex ga-2">
|
||||
<v-btn variant="text" size="small" prepend-icon="mdi-arrow-left" data-testid="back-button" @click="goBack">Atrás</v-btn>
|
||||
<v-btn to="/" variant="text" size="small" prepend-icon="mdi-home">Inicio</v-btn>
|
||||
</div>
|
||||
<div class="d-flex justify-end mb-3 ga-2">
|
||||
<v-btn variant="text" size="small" prepend-icon="mdi-arrow-left" data-testid="back-button" @click="goBack">Atrás</v-btn>
|
||||
<v-btn to="/" variant="text" size="small" prepend-icon="mdi-home">Inicio</v-btn>
|
||||
</div>
|
||||
<router-view />
|
||||
</v-container>
|
||||
@@ -32,30 +27,26 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, onUnmounted, ref } from 'vue';
|
||||
import { onMounted, onUnmounted, ref } from 'vue';
|
||||
import { JornadaService } from '@toldo/services';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
const drawer = ref(true);
|
||||
const isMobile = ref(false);
|
||||
const jornada = ref<any>(null);
|
||||
const jornadaService = new JornadaService();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const navItems = [
|
||||
{ to: '/jornada', icon: 'mdi-calendar-check', title: 'Jornada' },
|
||||
{ to: '/inventario', icon: 'mdi-package-variant', title: 'Inventario' },
|
||||
{ to: '/ventas', icon: 'mdi-cart', title: 'Ventas POS' },
|
||||
{ to: '/gastos', icon: 'mdi-cash-minus', title: 'Gastos' },
|
||||
{ to: '/cuadre', icon: 'mdi-cash-register', title: 'Cierre de caja' },
|
||||
{ to: '/ajustes', icon: 'mdi-pencil', title: 'Ajustes' },
|
||||
{ to: '/reportes', icon: 'mdi-chart-bar', title: 'Reportes' },
|
||||
{ to: '/exportar', icon: 'mdi-export', title: 'Exportar / importar' },
|
||||
];
|
||||
const breadcrumbs = computed(() => [{ title: 'Inicio', disabled: false, to: '/' }, ...(route.path === '/' ? [] : [{ title: String(route.meta.title ?? 'Sección'), disabled: true }])]);
|
||||
function goBack() { if (window.history.state?.back) router.back(); else router.push('/'); }
|
||||
function updateViewport() { isMobile.value = window.innerWidth < 960; if (isMobile.value) drawer.value = false; }
|
||||
function closeOnMobile() { if (isMobile.value) drawer.value = false; }
|
||||
function goBack() { if (window.history.state?.back) router.back(); else router.push('/'); }
|
||||
onMounted(async () => { updateViewport(); window.addEventListener('resize', updateViewport); jornada.value = await jornadaService.getJornadaAbierta(); });
|
||||
onUnmounted(() => window.removeEventListener('resize', updateViewport));
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user