Adicionada compressão Brotli/Gzip, auto-import de Vue e PrimeVue, e análise visual do bundle para otimização de produção e Remove AppLayout duplicado de cada área (therapist, admin, configuracoes, account, supervisor, billing, features) e consolida sob um único pai no router/index.js. Adiciona RouterPassthrough para grupos de rota sem layout intermediário. Remove debug ativo (console.trace em router.push e queries Supabase em todo watch de rota) que degradava performance para todos os usuários.
This commit is contained in:
+161
-214
@@ -14,225 +14,172 @@
|
||||
| © 2026 — Todos os direitos reservados
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
import AppLayout from '@/layout/AppLayout.vue';
|
||||
import RouterPassthrough from '@/layout/RouterPassthrough.vue';
|
||||
|
||||
export default [
|
||||
// ======================================================
|
||||
// 🚀 SETUP WIZARD — fora do AppLayout (fullscreen)
|
||||
// ======================================================
|
||||
// ── Rotas fullscreen — ficam fora do AppLayout compartilhado ──────────────
|
||||
export const clinicStandalone = [
|
||||
{
|
||||
path: '/admin/setup',
|
||||
name: 'admin.setup',
|
||||
component: () => import('@/features/setup/SetupWizardPage.vue'),
|
||||
meta: { area: 'admin', requiresAuth: true, roles: ['clinic_admin'], fullscreen: true }
|
||||
},
|
||||
|
||||
{
|
||||
path: '/admin',
|
||||
component: AppLayout,
|
||||
|
||||
meta: {
|
||||
// 🔐 Tudo aqui dentro exige login
|
||||
area: 'admin',
|
||||
requiresAuth: true,
|
||||
|
||||
// 👤 Perfil de acesso (tenant-level)
|
||||
// tenantStore normaliza tenant_admin -> clinic_admin, mas mantemos compatibilidade
|
||||
roles: ['clinic_admin']
|
||||
},
|
||||
children: [
|
||||
// ======================================================
|
||||
// 📊 DASHBOARD
|
||||
// ======================================================
|
||||
{ path: '', name: 'admin.dashboard', component: () => import('@/views/pages/clinic/ClinicDashboard.vue') },
|
||||
|
||||
// ======================================================
|
||||
// 🧩 CLÍNICA — MÓDULOS (tenant_features)
|
||||
// ======================================================
|
||||
{
|
||||
path: 'clinic/features',
|
||||
name: 'admin-clinic-features',
|
||||
component: () => import('@/views/pages/clinic/clinic/ClinicFeaturesPage.vue'),
|
||||
meta: {
|
||||
// opcional: restringir apenas para admin canônico
|
||||
roles: ['clinic_admin', 'tenant_admin']
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'clinic/professionals',
|
||||
name: 'admin-clinic-professionals',
|
||||
component: () => import('@/views/pages/clinic/clinic/ClinicProfessionalsPage.vue'),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
roles: ['clinic_admin', 'tenant_admin']
|
||||
}
|
||||
},
|
||||
|
||||
// ======================================================
|
||||
// 💳 MEU PLANO
|
||||
// ======================================================
|
||||
{
|
||||
path: 'meu-plano',
|
||||
name: 'admin-meu-plano',
|
||||
component: () => import('@/views/pages/billing/ClinicMeuPlanoPage.vue')
|
||||
},
|
||||
|
||||
// ======================================================
|
||||
// 📅 AGENDA DA CLÍNICA
|
||||
// ======================================================
|
||||
|
||||
{
|
||||
path: 'agenda/clinica',
|
||||
name: 'admin-agenda-clinica',
|
||||
component: () => import('@/features/agenda/pages/AgendaClinicaPage.vue'),
|
||||
meta: {
|
||||
feature: 'agenda.view',
|
||||
roles: ['clinic_admin', 'tenant_admin']
|
||||
}
|
||||
},
|
||||
|
||||
// Recorrências
|
||||
{
|
||||
path: 'agenda/recorrencias',
|
||||
name: 'admin-agenda-recorrencias',
|
||||
component: () => import('@/features/agenda/pages/AgendaRecorrenciasPage.vue'),
|
||||
meta: { feature: 'agenda.view', roles: ['clinic_admin', 'tenant_admin'], mode: 'clinic' }
|
||||
},
|
||||
|
||||
// ✅ NOVO: Compromissos determinísticos (tipos)
|
||||
{
|
||||
path: 'agenda/compromissos',
|
||||
name: 'admin-agenda-compromissos',
|
||||
component: () => import('@/features/agenda/pages/CompromissosDeterminados.vue'),
|
||||
meta: {
|
||||
feature: 'agenda.view',
|
||||
roles: ['clinic_admin', 'tenant_admin']
|
||||
// ✅ sem tenantScope: a área /admin já está no tenant da clínica pelo fluxo normal
|
||||
}
|
||||
},
|
||||
|
||||
// ======================================================
|
||||
// 👥 PACIENTES (módulo ativável por clínica)
|
||||
// ======================================================
|
||||
|
||||
// 📋 Lista de pacientes
|
||||
{
|
||||
path: 'pacientes',
|
||||
name: 'admin-pacientes',
|
||||
component: () => import('@/features/patients/PatientsListPage.vue'),
|
||||
meta: {
|
||||
// ✅ depende do tenant_features.patients
|
||||
tenantFeature: 'patients'
|
||||
}
|
||||
},
|
||||
|
||||
// ➕ Cadastro de paciente (novo)
|
||||
{
|
||||
path: 'pacientes/cadastro',
|
||||
name: 'admin-pacientes-cadastro',
|
||||
component: () => import('@/features/patients/cadastro/PatientsCadastroPage.vue'),
|
||||
meta: {
|
||||
tenantFeature: 'patients'
|
||||
}
|
||||
},
|
||||
|
||||
// ✏️ Editar paciente
|
||||
{
|
||||
path: 'pacientes/cadastro/:id',
|
||||
name: 'admin-pacientes-cadastro-edit',
|
||||
component: () => import('@/features/patients/cadastro/PatientsCadastroPage.vue'),
|
||||
props: true,
|
||||
meta: {
|
||||
tenantFeature: 'patients'
|
||||
}
|
||||
},
|
||||
|
||||
// 👥 Grupos de pacientes
|
||||
{
|
||||
path: 'pacientes/grupos',
|
||||
name: 'admin-pacientes-grupos',
|
||||
component: () => import('@/features/patients/grupos/GruposPacientesPage.vue'),
|
||||
meta: {
|
||||
tenantFeature: 'patients'
|
||||
}
|
||||
},
|
||||
|
||||
// 🏷️ Tags de pacientes
|
||||
{
|
||||
path: 'pacientes/tags',
|
||||
name: 'admin-pacientes-tags',
|
||||
component: () => import('@/features/patients/tags/TagsPage.vue'),
|
||||
meta: {
|
||||
tenantFeature: 'patients'
|
||||
}
|
||||
},
|
||||
|
||||
// 🔗 Link externo para cadastro
|
||||
{
|
||||
path: 'pacientes/link-externo',
|
||||
name: 'admin-pacientes-link-externo',
|
||||
component: () => import('@/features/patients/cadastro/PatientsExternalLinkPage.vue'),
|
||||
meta: {
|
||||
tenantFeature: 'patients'
|
||||
}
|
||||
},
|
||||
|
||||
// 📥 Cadastros recebidos via link externo
|
||||
{
|
||||
path: 'pacientes/cadastro/recebidos',
|
||||
name: 'admin-pacientes-recebidos',
|
||||
component: () => import('@/features/patients/cadastro/recebidos/CadastrosRecebidosPage.vue'),
|
||||
meta: {
|
||||
tenantFeature: 'patients'
|
||||
}
|
||||
},
|
||||
|
||||
// ======================================================
|
||||
// 🔐 SEGURANÇA
|
||||
// ======================================================
|
||||
{
|
||||
path: 'settings/security',
|
||||
name: 'admin-settings-security',
|
||||
component: () => import('@/views/pages/auth/SecurityPage.vue')
|
||||
},
|
||||
|
||||
// ======================================================
|
||||
// 🔒 MÓDULO PRO — Online Scheduling
|
||||
// ======================================================
|
||||
{
|
||||
path: 'online-scheduling',
|
||||
name: 'admin-online-scheduling',
|
||||
component: () => import('@/views/pages/clinic/OnlineSchedulingAdminPage.vue'),
|
||||
meta: {
|
||||
feature: 'online_scheduling.manage'
|
||||
}
|
||||
},
|
||||
|
||||
// ======================================================
|
||||
// 🔒 PRO — Agendamentos Recebidos
|
||||
// ======================================================
|
||||
{
|
||||
path: 'agendamentos-recebidos',
|
||||
name: 'admin-agendamentos-recebidos',
|
||||
component: () => import('@/features/agenda/pages/AgendamentosRecebidosPage.vue'),
|
||||
meta: {
|
||||
feature: 'online_scheduling.manage'
|
||||
}
|
||||
},
|
||||
|
||||
// ======================================================
|
||||
// 💰 FINANCEIRO
|
||||
// ======================================================
|
||||
{
|
||||
path: 'financeiro',
|
||||
name: 'admin-financeiro',
|
||||
component: () => import('@/features/financeiro/pages/FinanceiroDashboardPage.vue')
|
||||
},
|
||||
{
|
||||
path: 'financeiro/lancamentos',
|
||||
name: 'admin-financeiro-lancamentos',
|
||||
component: () => import('@/features/financeiro/pages/FinanceiroPage.vue')
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
// ── Rotas de app — serão filhas do AppLayout compartilhado no index.js ────
|
||||
export default {
|
||||
path: 'admin',
|
||||
component: RouterPassthrough,
|
||||
meta: {
|
||||
area: 'admin',
|
||||
requiresAuth: true,
|
||||
roles: ['clinic_admin']
|
||||
},
|
||||
children: [
|
||||
// ======================================================
|
||||
// 📊 DASHBOARD
|
||||
// ======================================================
|
||||
{ path: '', name: 'admin.dashboard', component: () => import('@/views/pages/clinic/ClinicDashboard.vue') },
|
||||
|
||||
// ======================================================
|
||||
// 🧩 CLÍNICA — MÓDULOS (tenant_features)
|
||||
// ======================================================
|
||||
{
|
||||
path: 'clinic/features',
|
||||
name: 'admin-clinic-features',
|
||||
component: () => import('@/views/pages/clinic/clinic/ClinicFeaturesPage.vue'),
|
||||
meta: { roles: ['clinic_admin', 'tenant_admin'] }
|
||||
},
|
||||
{
|
||||
path: 'clinic/professionals',
|
||||
name: 'admin-clinic-professionals',
|
||||
component: () => import('@/views/pages/clinic/clinic/ClinicProfessionalsPage.vue'),
|
||||
meta: { requiresAuth: true, roles: ['clinic_admin', 'tenant_admin'] }
|
||||
},
|
||||
|
||||
// ======================================================
|
||||
// 💳 MEU PLANO
|
||||
// ======================================================
|
||||
{
|
||||
path: 'meu-plano',
|
||||
name: 'admin-meu-plano',
|
||||
component: () => import('@/views/pages/billing/ClinicMeuPlanoPage.vue')
|
||||
},
|
||||
|
||||
// ======================================================
|
||||
// 📅 AGENDA DA CLÍNICA
|
||||
// ======================================================
|
||||
{
|
||||
path: 'agenda/clinica',
|
||||
name: 'admin-agenda-clinica',
|
||||
component: () => import('@/features/agenda/pages/AgendaClinicaPage.vue'),
|
||||
meta: { feature: 'agenda.view', roles: ['clinic_admin', 'tenant_admin'] }
|
||||
},
|
||||
|
||||
// Recorrências
|
||||
{
|
||||
path: 'agenda/recorrencias',
|
||||
name: 'admin-agenda-recorrencias',
|
||||
component: () => import('@/features/agenda/pages/AgendaRecorrenciasPage.vue'),
|
||||
meta: { feature: 'agenda.view', roles: ['clinic_admin', 'tenant_admin'], mode: 'clinic' }
|
||||
},
|
||||
|
||||
// ✅ Compromissos determinísticos
|
||||
{
|
||||
path: 'agenda/compromissos',
|
||||
name: 'admin-agenda-compromissos',
|
||||
component: () => import('@/features/agenda/pages/CompromissosDeterminados.vue'),
|
||||
meta: { feature: 'agenda.view', roles: ['clinic_admin', 'tenant_admin'] }
|
||||
},
|
||||
|
||||
// ======================================================
|
||||
// 👥 PACIENTES
|
||||
// ======================================================
|
||||
{
|
||||
path: 'pacientes',
|
||||
name: 'admin-pacientes',
|
||||
component: () => import('@/features/patients/PatientsListPage.vue'),
|
||||
meta: { tenantFeature: 'patients' }
|
||||
},
|
||||
{
|
||||
path: 'pacientes/cadastro',
|
||||
name: 'admin-pacientes-cadastro',
|
||||
component: () => import('@/features/patients/cadastro/PatientsCadastroPage.vue'),
|
||||
meta: { tenantFeature: 'patients' }
|
||||
},
|
||||
{
|
||||
path: 'pacientes/cadastro/:id',
|
||||
name: 'admin-pacientes-cadastro-edit',
|
||||
component: () => import('@/features/patients/cadastro/PatientsCadastroPage.vue'),
|
||||
props: true,
|
||||
meta: { tenantFeature: 'patients' }
|
||||
},
|
||||
{
|
||||
path: 'pacientes/grupos',
|
||||
name: 'admin-pacientes-grupos',
|
||||
component: () => import('@/features/patients/grupos/GruposPacientesPage.vue'),
|
||||
meta: { tenantFeature: 'patients' }
|
||||
},
|
||||
{
|
||||
path: 'pacientes/tags',
|
||||
name: 'admin-pacientes-tags',
|
||||
component: () => import('@/features/patients/tags/TagsPage.vue'),
|
||||
meta: { tenantFeature: 'patients' }
|
||||
},
|
||||
{
|
||||
path: 'pacientes/link-externo',
|
||||
name: 'admin-pacientes-link-externo',
|
||||
component: () => import('@/features/patients/cadastro/PatientsExternalLinkPage.vue'),
|
||||
meta: { tenantFeature: 'patients' }
|
||||
},
|
||||
{
|
||||
path: 'pacientes/cadastro/recebidos',
|
||||
name: 'admin-pacientes-recebidos',
|
||||
component: () => import('@/features/patients/cadastro/recebidos/CadastrosRecebidosPage.vue'),
|
||||
meta: { tenantFeature: 'patients' }
|
||||
},
|
||||
|
||||
// ======================================================
|
||||
// 🔐 SEGURANÇA
|
||||
// ======================================================
|
||||
{
|
||||
path: 'settings/security',
|
||||
name: 'admin-settings-security',
|
||||
component: () => import('@/views/pages/auth/SecurityPage.vue')
|
||||
},
|
||||
|
||||
// ======================================================
|
||||
// 🔒 MÓDULO PRO — Online Scheduling
|
||||
// ======================================================
|
||||
{
|
||||
path: 'online-scheduling',
|
||||
name: 'admin-online-scheduling',
|
||||
component: () => import('@/views/pages/clinic/OnlineSchedulingAdminPage.vue'),
|
||||
meta: { feature: 'online_scheduling.manage' }
|
||||
},
|
||||
|
||||
// ======================================================
|
||||
// 🔒 PRO — Agendamentos Recebidos
|
||||
// ======================================================
|
||||
{
|
||||
path: 'agendamentos-recebidos',
|
||||
name: 'admin-agendamentos-recebidos',
|
||||
component: () => import('@/features/agenda/pages/AgendamentosRecebidosPage.vue'),
|
||||
meta: { feature: 'online_scheduling.manage' }
|
||||
},
|
||||
|
||||
// ======================================================
|
||||
// 💰 FINANCEIRO
|
||||
// ======================================================
|
||||
{
|
||||
path: 'financeiro',
|
||||
name: 'admin-financeiro',
|
||||
component: () => import('@/features/financeiro/pages/FinanceiroDashboardPage.vue')
|
||||
},
|
||||
{
|
||||
path: 'financeiro/lancamentos',
|
||||
name: 'admin-financeiro-lancamentos',
|
||||
component: () => import('@/features/financeiro/pages/FinanceiroPage.vue')
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user