From 0c4b1a43a9e8da6473659f6d3cad1bd2537b0a07 Mon Sep 17 00:00:00 2001 From: Consultoria AS Date: Thu, 22 Jan 2026 03:04:25 +0000 Subject: [PATCH] feat(fase3): update sidebar navigation and seed with calendario_fiscal - Add navigation items for Reportes, Calendario, Alertas, Usuarios - Add calendario_fiscal table creation in seed - Insert demo fiscal events for all 12 months Co-Authored-By: Claude Opus 4.5 --- apps/api/prisma/seed.ts | 39 +++++++++++++++++++++++++ apps/web/components/layouts/sidebar.tsx | 8 +++++ 2 files changed, 47 insertions(+) diff --git a/apps/api/prisma/seed.ts b/apps/api/prisma/seed.ts index 4db93b0..535e3f9 100644 --- a/apps/api/prisma/seed.ts +++ b/apps/api/prisma/seed.ts @@ -185,6 +185,45 @@ async function main() { console.log('✅ Alerts created'); + // Create calendario_fiscal table + await prisma.$executeRawUnsafe(` + CREATE TABLE IF NOT EXISTS "${schemaName}"."calendario_fiscal" ( + id SERIAL PRIMARY KEY, + titulo VARCHAR(200) NOT NULL, + descripcion TEXT, + tipo VARCHAR(20) NOT NULL, + fecha_limite TIMESTAMP NOT NULL, + recurrencia VARCHAR(20) DEFAULT 'mensual', + completado BOOLEAN DEFAULT FALSE, + notas TEXT, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP + ) + `); + + // Insert demo fiscal events for current year + const año = new Date().getFullYear(); + const eventos = [ + { titulo: 'Declaración mensual IVA', tipo: 'declaracion', dia: 17 }, + { titulo: 'Declaración mensual ISR', tipo: 'declaracion', dia: 17 }, + { titulo: 'Pago provisional ISR', tipo: 'pago', dia: 17 }, + { titulo: 'DIOT', tipo: 'obligacion', dia: 17 }, + ]; + + for (let mes = 1; mes <= 12; mes++) { + for (const evento of eventos) { + const fechaLimite = new Date(año, mes - 1, evento.dia); + const completado = fechaLimite < new Date(); + await prisma.$executeRawUnsafe(` + INSERT INTO "${schemaName}"."calendario_fiscal" + (titulo, descripcion, tipo, fecha_limite, recurrencia, completado) + VALUES ($1, $2, $3, $4, 'mensual', $5) + ON CONFLICT DO NOTHING + `, evento.titulo, `${evento.titulo} - ${mes}/${año}`, evento.tipo, fechaLimite.toISOString(), completado); + } + } + + console.log('✅ Calendario fiscal created'); + console.log('🎉 Seed completed successfully!'); console.log('\n📝 Demo credentials:'); console.log(' Admin: admin@demo.com / demo123'); diff --git a/apps/web/components/layouts/sidebar.tsx b/apps/web/components/layouts/sidebar.tsx index f037fa8..02b0772 100644 --- a/apps/web/components/layouts/sidebar.tsx +++ b/apps/web/components/layouts/sidebar.tsx @@ -9,6 +9,10 @@ import { Calculator, Settings, LogOut, + BarChart3, + Calendar, + Bell, + Users, } from 'lucide-react'; import { useAuthStore } from '@/stores/auth-store'; import { logout } from '@/lib/api/auth'; @@ -18,6 +22,10 @@ const navigation = [ { name: 'Dashboard', href: '/dashboard', icon: LayoutDashboard }, { name: 'CFDI', href: '/cfdi', icon: FileText }, { name: 'Impuestos', href: '/impuestos', icon: Calculator }, + { name: 'Reportes', href: '/reportes', icon: BarChart3 }, + { name: 'Calendario', href: '/calendario', icon: Calendar }, + { name: 'Alertas', href: '/alertas', icon: Bell }, + { name: 'Usuarios', href: '/usuarios', icon: Users }, { name: 'Configuracion', href: '/configuracion', icon: Settings }, ];