feat: agregar control de permisos para la sección de devoluciones en la navegación y en el módulo de devoluciones
This commit is contained in:
parent
a743ea73e7
commit
18755271d3
@ -78,7 +78,7 @@ onMounted(() => {
|
||||
to="pos.suppliers.index"
|
||||
/>
|
||||
<SubLink
|
||||
v-if="hasPermission('units')"
|
||||
v-if="hasPermission('units.index')"
|
||||
icon="scale"
|
||||
name="pos.unitMeasure"
|
||||
to="pos.unitMeasure.index"
|
||||
@ -101,6 +101,7 @@ onMounted(() => {
|
||||
to="pos.sales.index"
|
||||
/>
|
||||
<Link
|
||||
v-if="hasPermission('returns.index')"
|
||||
icon="Sync"
|
||||
name="pos.returns"
|
||||
to="pos.returns.index"
|
||||
|
||||
16
src/pages/POS/Returns/Module.js
Normal file
16
src/pages/POS/Returns/Module.js
Normal file
@ -0,0 +1,16 @@
|
||||
import { hasPermission } from '@Plugins/RolePermission.js';
|
||||
|
||||
// Ruta API
|
||||
const apiTo = (name, params = {}) => 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
|
||||
}
|
||||
@ -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')
|
||||
},
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user