From 18755271d3a6a15a037446711010deb193e0f60d Mon Sep 17 00:00:00 2001 From: Juan Felipe Zapata Moreno Date: Tue, 10 Mar 2026 11:20:34 -0600 Subject: [PATCH] =?UTF-8?q?feat:=20agregar=20control=20de=20permisos=20par?= =?UTF-8?q?a=20la=20secci=C3=B3n=20de=20devoluciones=20en=20la=20navegaci?= =?UTF-8?q?=C3=B3n=20y=20en=20el=20m=C3=B3dulo=20de=20devoluciones?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/AppLayout.vue | 3 ++- src/pages/POS/Returns/Module.js | 16 ++++++++++++++++ src/router/Index.js | 1 + 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 src/pages/POS/Returns/Module.js diff --git a/src/layouts/AppLayout.vue b/src/layouts/AppLayout.vue index 50d6e27..3901656 100644 --- a/src/layouts/AppLayout.vue +++ b/src/layouts/AppLayout.vue @@ -78,7 +78,7 @@ onMounted(() => { to="pos.suppliers.index" /> { to="pos.sales.index" /> route(`returns.${name}`, params) + +// Ruta visual +const viewTo = ({ name = '', params = {}, query = {} }) => ({ name: `pos.returns.${name}`, params, query }) + +// Determina si un usuario puede hacer algo en base a los permisos +const can = (permission) => hasPermission(`returns.${permission}`) + +export { + can, + viewTo, + apiTo +} diff --git a/src/router/Index.js b/src/router/Index.js index ed5f6bf..d2c1cea 100644 --- a/src/router/Index.js +++ b/src/router/Index.js @@ -92,6 +92,7 @@ const router = createRouter({ { path: 'returns', name: 'pos.returns.index', + beforeEnter: (to, from, next) => can(next, 'returns.index'), component: () => import('@Pages/POS/Returns/Index.vue') }, {