Просмотр исходного кода

✨ feat(router): configurar rotas protegidas por tipo de usuário e módulo

Fase: dev | Origin: melhoria-interna
Gustavo Zanatta 1 неделя назад
Родитель
Сommit
f767125751

+ 2 - 2
src/router/index.js

@@ -16,8 +16,8 @@ const AUTH_ROUTES = ["LoginPage", "ForgotPasswordPage", "VerifyEmailPage", "Veri
 
 const HOME_BY_TIPO = {
   administrador: "DashboardPage",
-  associado:     "HomePage",
-  parceiro:      "HomePage",
+  associado:     "CarteirinhaPage",
+  parceiro:      "ValidarCarteirinhaPage",
 };
 
 export default defineRouter(function () {

+ 20 - 3
src/router/routes.js

@@ -14,9 +14,26 @@ const routes = [
     children: [
       {
         path: "",
-        name: "HomePage",
-        component: () => import("src/pages/home/HomePage.vue"),
-        meta: { requireAuth: true },
+        name: "CarteirinhaPage",
+        component: () => import("pages/associado/carteirinha/CarteirinhaPage.vue"),
+        meta: {
+          title: { value: "ui.navigation.carteirinha", translate: true },
+          requireAuth: true,
+          requiredPermission: "dashboard",
+          breadcrumbs: [{ name: "CarteirinhaPage", title: "Dashboard" }],
+        },
+      },
+      {
+        path: "/gestao/associados",
+        name: "GestaoAssociadosPage",
+        component: () => import("pages/gestao-associados/GestaoAssociadosPage.vue"),
+        meta: {
+          title: { value: "ui.navigation.associados", translate: true },
+          description: { value: "page.gestao_associados.description", translate: true },
+          requireAuth: true,
+          requiredPermission: "associado",
+          breadcrumbs: [{ name: "GestaoAssociadosPage", title: "ui.navigation.associados", translate: true }],
+        },
       },
       {
         path: "/dashboard",

+ 79 - 0
src/router/routes/associado.route.js

@@ -0,0 +1,79 @@
+export default [
+  {
+    path: "/associado/perfil",
+    name: "MeuPerfilPage",
+    component: () => import("pages/associado/profile/ProfilePage.vue"),
+    meta: {
+      title: { value: "ui.navigation.meu_perfil", translate: true },
+      description: { value: "page.associado.profile.description", translate: true },
+      requireAuth: true,
+      breadcrumbs: [{ name: "MeuPerfilPage", title: "ui.navigation.meu_perfil", translate: true }],
+    },
+  },
+  // {
+  //   path: "/associado/carteirinha",
+  //   name: "CarteirinhaPage",
+  //   component: () => import("pages/associado/carteirinha/CarteirinhaPage.vue"),
+  //   meta: {
+  //     title: { value: "ui.navigation.carteirinha", translate: true },
+  //     description: { value: "page.associado.carteirinha.description", translate: true },
+  //     requireAuth: true,
+  //     breadcrumbs: [{ name: "CarteirinhaPage", title: "ui.navigation.carteirinha", translate: true }],
+  //   },
+  // },
+  {
+    path: "/associado/convenios",
+    name: "ConveniosPage",
+    component: () => import("pages/parceiros-convenios/ParceirosConveniosPage.vue"),
+    meta: {
+      title: { value: "ui.navigation.convenios", translate: true },
+      description: { value: "page.associado.convenios.description", translate: true },
+      requireAuth: true,
+      breadcrumbs: [{ name: "ConveniosPage", title: "ui.navigation.convenios", translate: true }],
+    },
+  },
+  {
+    path: "/associado/loja",
+    name: "AssociadoLojaPage",
+    component: () => import("pages/associado/loja/LojaPage.vue"),
+    meta: {
+      title: { value: "ui.navigation.loja", translate: true },
+      description: { value: "page.associado.loja.description", translate: true },
+      requireAuth: true,
+      breadcrumbs: [{ name: "AssociadoLojaPage", title: "ui.navigation.loja", translate: true }],
+    },
+  },
+  {
+    path: "/associado/interesses",
+    name: "AssociadoInteressesPage",
+    component: () => import("pages/associado/interesses/InteressesPage.vue"),
+    meta: {
+      title: { value: "ui.navigation.meus_interesses", translate: true },
+      description: { value: "page.associado.interesses.description", translate: true },
+      requireAuth: true,
+      breadcrumbs: [{ name: "AssociadoInteressesPage", title: "ui.navigation.meus_interesses", translate: true }],
+    },
+  },
+  {
+    path: "/associado/agendamentos",
+    name: "AssociadoAgendamentosPage",
+    component: () => import("pages/associado/agendamentos/AgendamentosPage.vue"),
+    meta: {
+      title: { value: "ui.navigation.meus_agendamentos", translate: true },
+      description: { value: "page.associado.agendamentos.description", translate: true },
+      requireAuth: true,
+      breadcrumbs: [{ name: "AssociadoAgendamentosPage", title: "ui.navigation.meus_agendamentos", translate: true }],
+    },
+  },
+  {
+    path: "/associado/notificacoes",
+    name: "NotificacoesPage",
+    component: () => import("pages/associado/notificacoes/NotificacoesPage.vue"),
+    meta: {
+      title: { value: "ui.navigation.notifications", translate: true },
+      description: { value: "page.associado.notificacoes.description", translate: true },
+      requireAuth: true,
+      breadcrumbs: [{ name: "NotificacoesPage", title: "ui.navigation.notifications", translate: true }],
+    },
+  },
+];

+ 45 - 0
src/router/routes/parceiro-admin.route.js

@@ -0,0 +1,45 @@
+export default [
+  {
+    path: "/parceiros-convenios",
+    name: "ParceirosConveniosPage",
+    component: () => import("pages/parceiros-convenios/ParceirosConveniosPage.vue"),
+    meta: {
+      title: { value: "ui.navigation.partners", translate: true },
+      description: { value: "page.parceiros_convenios.description", translate: true },
+      requireAuth: true,
+      requiredPermission: "parceiro",
+      breadcrumbs: [
+        { name: "ParceirosConveniosPage", title: "ui.navigation.partners", translate: true },
+      ],
+    },
+  },
+  {
+    path: "/parceiros-convenios/cadastro/:id?",
+    name: "ParceiroCadastroPage",
+    component: () => import("pages/parceiros-convenios/ParceiroCadastroPage.vue"),
+    meta: {
+      title: { value: "parceiro.cadastro_title", translate: true },
+      requireAuth: true,
+      requiredPermission: "parceiro",
+      breadcrumbs: [
+        { name: "ParceirosConveniosPage", title: "ui.navigation.partners", translate: true },
+        { name: "ParceiroCadastroPage", title: "parceiro.cadastro_title", translate: true },
+      ],
+    },
+  },
+  {
+    path: "/parceiros-convenios/cadastro/:id/servico/:serviceId?",
+    name: "ParceiroServicoCadastroPage",
+    component: () => import("pages/parceiros-convenios/ParceiroServicoCadastroPage.vue"),
+    meta: {
+      title: { value: "parceiro.tab_servicos", translate: true },
+      requireAuth: true,
+      requiredPermission: "parceiro",
+      breadcrumbs: [
+        { name: "ParceirosConveniosPage", title: "ui.navigation.partners", translate: true },
+        { name: "ParceiroCadastroPage", title: "parceiro.cadastro_title", translate: true },
+        { name: "ParceiroServicoCadastroPage", title: "parceiro.tab_servicos", translate: true },
+      ],
+    },
+  },
+];