2026-01-16 20:55:40 +00:00
|
|
|
import { renderDashboard } from './DashboardPage.js';
|
2026-01-23 18:53:02 +00:00
|
|
|
import { renderFacturasPage } from './Facturas.js';
|
2026-02-02 16:58:52 +00:00
|
|
|
import { renderCreateInvoicePage } from './CreateInvoicePage.js';
|
2026-02-06 18:27:48 +00:00
|
|
|
import { renderClientesPage } from './ClientesPage.js';
|
2026-04-16 16:43:15 +00:00
|
|
|
import { renderSettingsPage } from './SettingsPage.js';
|
2026-05-15 19:50:10 +00:00
|
|
|
import { renderBancoPage } from './BancoPage.js';
|
2026-05-14 17:02:04 +00:00
|
|
|
import { icons } from '../services/icons.js';
|
2026-01-16 20:55:40 +00:00
|
|
|
|
2026-01-16 20:22:14 +00:00
|
|
|
export const pagesRegistry = [
|
|
|
|
|
{
|
|
|
|
|
route: 'dashboard',
|
|
|
|
|
name: 'Dashboard',
|
2026-05-14 17:02:04 +00:00
|
|
|
icon: icons.dashboard,
|
2026-05-13 18:03:58 +00:00
|
|
|
voicePatterns: ['dashboard', 'inicio', 'ir al inicio', 'ir al dashboard', 'resumen', 'home', 'panel', 'principal'],
|
2026-01-16 20:55:40 +00:00
|
|
|
requiresAuth: true,
|
|
|
|
|
showInSidebar: true,
|
|
|
|
|
render: renderDashboard
|
2026-01-16 20:22:14 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
route: 'invoices',
|
|
|
|
|
name: 'Facturas',
|
2026-05-14 17:02:04 +00:00
|
|
|
icon: icons.invoices,
|
2026-05-13 18:03:58 +00:00
|
|
|
voicePatterns: ['facturas', 'ver facturas', 'ir a facturas', 'lista facturas', 'mis facturas', 'listado facturas'],
|
2026-01-16 20:55:40 +00:00
|
|
|
requiresAuth: true,
|
|
|
|
|
showInSidebar: true,
|
2026-01-23 18:53:02 +00:00
|
|
|
render: renderFacturasPage
|
2026-01-16 20:22:14 +00:00
|
|
|
},
|
2026-02-02 16:58:52 +00:00
|
|
|
{
|
|
|
|
|
route: 'create-invoice',
|
|
|
|
|
name: 'Nueva Factura',
|
2026-05-14 17:02:04 +00:00
|
|
|
icon: icons.plus,
|
2026-05-13 18:03:58 +00:00
|
|
|
voicePatterns: ['nueva factura', 'crear factura', 'factura nueva', 'añadir factura'],
|
2026-02-02 16:58:52 +00:00
|
|
|
requiresAuth: true,
|
2026-05-14 17:02:04 +00:00
|
|
|
showInSidebar: false,
|
2026-02-02 16:58:52 +00:00
|
|
|
render: renderCreateInvoicePage
|
|
|
|
|
},
|
2026-01-16 20:22:14 +00:00
|
|
|
{
|
|
|
|
|
route: 'clients',
|
|
|
|
|
name: 'Clientes',
|
2026-05-14 17:02:04 +00:00
|
|
|
icon: icons.clients,
|
2026-05-13 18:03:58 +00:00
|
|
|
voicePatterns: ['clientes', 'ver clientes', 'ir a clientes', 'lista clientes', 'mis clientes'],
|
2026-01-16 20:55:40 +00:00
|
|
|
requiresAuth: true,
|
|
|
|
|
showInSidebar: true,
|
2026-02-06 18:27:48 +00:00
|
|
|
render: renderClientesPage
|
2026-01-16 20:22:14 +00:00
|
|
|
},
|
2026-05-15 19:50:10 +00:00
|
|
|
{
|
|
|
|
|
route: 'banco',
|
|
|
|
|
name: 'Banco',
|
|
|
|
|
icon: icons.bank,
|
|
|
|
|
voicePatterns: ['banco', 'ir al banco', 'cuentas', 'cuentas bancarias', 'movimientos'],
|
|
|
|
|
requiresAuth: true,
|
|
|
|
|
showInSidebar: true,
|
|
|
|
|
render: renderBancoPage
|
|
|
|
|
},
|
2026-01-16 20:22:14 +00:00
|
|
|
{
|
|
|
|
|
route: 'settings',
|
|
|
|
|
name: 'Configuración',
|
2026-05-14 17:02:04 +00:00
|
|
|
icon: icons.settings,
|
|
|
|
|
voicePatterns: ['configuración', 'configuracion', 'ajustes', 'settings', 'preferencias'],
|
|
|
|
|
requiresAuth: true,
|
2026-01-16 20:55:40 +00:00
|
|
|
showInSidebar: true,
|
2026-04-16 16:43:15 +00:00
|
|
|
render: renderSettingsPage
|
2026-01-16 20:22:14 +00:00
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
export function getAvailablePages(isAuthenticated) {
|
|
|
|
|
if (!isAuthenticated) {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
2026-01-16 20:55:40 +00:00
|
|
|
return pagesRegistry.filter(page => {
|
|
|
|
|
if (page.requiresAuth && !isAuthenticated) return false;
|
|
|
|
|
return page.showInSidebar;
|
|
|
|
|
});
|
2026-01-16 20:22:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function getPageByRoute(route) {
|
|
|
|
|
return pagesRegistry.find(page => page.route === route);
|
2026-05-14 17:02:04 +00:00
|
|
|
}
|