From 498a15efd4ba89de527bba5d0717590288f65b64 Mon Sep 17 00:00:00 2001 From: Edgar Mendez Mendoza Date: Sat, 8 Nov 2025 11:23:17 -0600 Subject: [PATCH] feat: add commercial classification management with CRUD operations and routing --- src/components/layout/Sidebar.vue | 150 ++--- .../components/ClassificationsComercial.vue | 5 + .../components/ComercialClassification.vue | 624 ++++++++++++++++++ .../services/clasificationsComercial.ts | 57 ++ .../stores/comercialClassificationStore.ts | 142 ++++ .../types/comercialClassification.d.ts | 61 ++ src/router/index.ts | 14 +- 7 files changed, 941 insertions(+), 112 deletions(-) create mode 100644 src/modules/catalog/components/ClassificationsComercial.vue create mode 100644 src/modules/catalog/components/ComercialClassification.vue create mode 100644 src/modules/catalog/services/clasificationsComercial.ts create mode 100644 src/modules/catalog/stores/comercialClassificationStore.ts create mode 100644 src/modules/catalog/types/comercialClassification.d.ts diff --git a/src/components/layout/Sidebar.vue b/src/components/layout/Sidebar.vue index 8492db1..05a1971 100644 --- a/src/components/layout/Sidebar.vue +++ b/src/components/layout/Sidebar.vue @@ -18,6 +18,14 @@ const menuItems = ref([ icon: 'pi pi-chart-line', to: '/' }, + { + label: 'Catálogo', + icon: 'pi pi-book', + items: [ + { label: 'Unidades de Medida', icon: 'pi pi-calculator', to: '/catalog/units-of-measure' }, + { label: 'Clasificaciones Comerciales', icon: 'pi pi-tags', to: '/catalog/classifications-comercial' } + ] + }, { label: 'Almacén', icon: 'pi pi-box', @@ -26,56 +34,6 @@ const menuItems = ref([ { label: 'Administrar Clasificaciones', icon: 'pi pi-sitemap', to: '/warehouse/classifications' } ] }, - { - label: 'Catálogo', - icon: 'pi pi-book', - items: [ - { label: 'Unidades de Medida', icon: 'pi pi-calculator', to: '/catalog/units-of-measure' } - ] - }, - { - label: 'Ventas', - icon: 'pi pi-shopping-cart', - items: [ - { label: 'Nueva Venta', icon: 'pi pi-plus', to: '/ventas/nueva' }, - { label: 'Lista de Ventas', icon: 'pi pi-list', to: '/ventas/lista' }, - { label: 'Cotizaciones', icon: 'pi pi-file-edit', to: '/ventas/cotizaciones' } - ] - }, - { - label: 'Clientes', - icon: 'pi pi-users', - to: '/clientes' - }, - { - label: 'Inventario', - icon: 'pi pi-box', - to: '/inventario' - }, - { - label: 'Finanzas', - icon: 'pi pi-wallet', - items: [ - { label: 'Ingresos', icon: 'pi pi-arrow-up', to: '/finanzas/ingresos' }, - { label: 'Gastos', icon: 'pi pi-credit-card', to: '/finanzas/gastos' }, - { label: 'Cuentas por Cobrar', icon: 'pi pi-money-bill', to: '/finanzas/cobrar' } - ] - }, - { - label: 'Reportes', - icon: 'pi pi-chart-bar', - to: '/reportes' - }, - { - label: 'Documentos', - icon: 'pi pi-file', - to: '/documentos' - }, - { - label: 'Módulo Personalizado', - icon: 'pi pi-th-large', - to: '/modulo-personalizado' - }, { label: 'Configuración', icon: 'pi pi-cog', @@ -105,17 +63,17 @@ const isItemOpen = (label: string) => { const isRouteActive = (to: string | undefined) => { if (!to) return false; - + // Coincidencia exacta if (route.path === to) { return true; } - + // Para la ruta raíz, solo coincidencia exacta if (to === '/') { return false; } - + // Si la ruta actual es hija (ej: /warehouse/create) // y el item es el padre (ej: /warehouse) // SOLO marcar activo si la ruta hija NO está explícitamente en el menú @@ -127,11 +85,11 @@ const isRouteActive = (to: string | undefined) => { } return item.to === route.path; }); - + // Si NO está explícitamente en el menú, entonces es una ruta hija (create, edit, etc) return !isExplicitRoute; } - + return false; }; @@ -159,20 +117,16 @@ defineExpose({ toggleSidebar });