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 <noreply@anthropic.com>
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user