diff --git a/src/Vistas/Componentes/Organismos/Clientes/DetalleClienteModal.jsx b/src/Vistas/Componentes/Organismos/Clientes/DetalleClienteModal.jsx index f4e99658..7f97ae2a 100644 --- a/src/Vistas/Componentes/Organismos/Clientes/DetalleClienteModal.jsx +++ b/src/Vistas/Componentes/Organismos/Clientes/DetalleClienteModal.jsx @@ -40,6 +40,7 @@ export const DetalleClienteModal = ({ variant: 'outlined', outlineColor: colores.rojo[2], onClick: onToggleEliminar, + disabled: !usuario?.permisos?.includes(PERMISOS.ELIMINAR_CLIENTE), }, { label: modoEdicion ? 'GUARDAR' : 'EDITAR', diff --git a/src/Vistas/Paginas/Categorias/ListaCategorias.jsx b/src/Vistas/Paginas/Categorias/ListaCategorias.jsx index 0a602c5c..8d4da7b1 100644 --- a/src/Vistas/Paginas/Categorias/ListaCategorias.jsx +++ b/src/Vistas/Paginas/Categorias/ListaCategorias.jsx @@ -12,7 +12,8 @@ import { useConsultarCategorias } from '@Hooks/Categorias/useConsultarCategorias import { leerCategoria } from '@Hooks/Categorias/useLeerCategoria'; import useActualizarCategoria from '@Hooks/Categorias/useActualizarCategoria'; import obtenerProductosCategoria from '@Servicios/obtenerProductosCategoria'; - +import { PERMISOS } from '@Utilidades/Constantes/permisos'; +import { useAuth } from '@Hooks/AuthProvider'; import { Box, useTheme } from '@mui/material'; import { tokens } from '@SRC/theme'; import ModalCrearCategoria from '@Organismos/ModalCrearCategoria'; @@ -35,6 +36,8 @@ const ListaCategorias = () => { const actualizar = useActualizarCategoria(); const theme = useTheme(); const colores = tokens(theme.palette.mode); + const { usuario } = useAuth(); + const columns = useMemo( () => [ @@ -225,9 +228,11 @@ const ListaCategorias = () => { size: 'large', backgroundColor: colores.altertex[1], onClick: handleAbrirModalCrear, + disabled: !usuario?.permisos?.includes(PERMISOS.CREAR_CATEGORIA_PRODUCTOS), }, { label: 'Eliminar', + disabled: !usuario?.permisos?.includes(PERMISOS.ELIMINAR_CATEGORIA_PRODUCTOS), onClick: () => { if (seleccionados.size === 0 || seleccionados.ids?.size === 0) { setAlerta({ @@ -246,8 +251,9 @@ const ListaCategorias = () => { size: 'large', backgroundColor: colores.altertex[1], }, + ], - [colores.altertex, handleAbrirModalCrear, seleccionados] + [colores.altertex, handleAbrirModalCrear, seleccionados, usuario?.permisos] ); const botonesModalDetalle = useMemo(() => { diff --git a/src/Vistas/Paginas/Cuotas/ListaCuotas.jsx b/src/Vistas/Paginas/Cuotas/ListaCuotas.jsx index 9707ad73..054bd936 100644 --- a/src/Vistas/Paginas/Cuotas/ListaCuotas.jsx +++ b/src/Vistas/Paginas/Cuotas/ListaCuotas.jsx @@ -154,9 +154,11 @@ const ListaCuotas = () => { size: 'large', backgroundColor: colores.altertex[1], onClick: handleAbrirModalCrear, + disabled: !usuario?.permisos?.includes(PERMISOS.CREAR_SET_CUOTAS), }, { label: 'Eliminar', + disabled: !usuario?.permisos?.includes(PERMISOS.ELIMINAR_SET_CUOTAS), onClick: () => { if (seleccionados.length === 0) { setAlerta({ diff --git a/src/Vistas/Paginas/Empleados/ListaGrupoEmpleados.jsx b/src/Vistas/Paginas/Empleados/ListaGrupoEmpleados.jsx index 1a32fc0f..6f4d3abf 100644 --- a/src/Vistas/Paginas/Empleados/ListaGrupoEmpleados.jsx +++ b/src/Vistas/Paginas/Empleados/ListaGrupoEmpleados.jsx @@ -161,6 +161,7 @@ const ListaGrupoEmpleados = () => { color: 'error', size: 'large', backgroundColor: colores.altertex[1], + disabled: !usuario?.permisos?.includes(PERMISOS.CREAR_GRUPO_EMPLEADOS), // construccion: true, }, { diff --git a/src/Vistas/Paginas/Eventos/ListaEventos.jsx b/src/Vistas/Paginas/Eventos/ListaEventos.jsx index b8c5abfd..8429fe11 100644 --- a/src/Vistas/Paginas/Eventos/ListaEventos.jsx +++ b/src/Vistas/Paginas/Eventos/ListaEventos.jsx @@ -121,6 +121,7 @@ const ListaEventos = () => { size: 'large', backgroundColor: colores.altertex[1], onClick: manejarAbrirCrear, + disabled: !usuario?.permisos?.includes(PERMISOS.CREAR_EVENTO), }, { label: 'Eliminar', diff --git a/src/Vistas/Paginas/Productos/ListaProductos.jsx b/src/Vistas/Paginas/Productos/ListaProductos.jsx index 770b14c3..dce165ea 100644 --- a/src/Vistas/Paginas/Productos/ListaProductos.jsx +++ b/src/Vistas/Paginas/Productos/ListaProductos.jsx @@ -219,6 +219,7 @@ const ListaProductos = () => { onClick: mostrarFormularioProducto, size: 'large', backgroundColor: colores.altertex[1], + disabled: !usuario?.permisos?.includes(PERMISOS.CREAR_PRODUCTO), }, { variant: 'outlined', @@ -227,6 +228,7 @@ const ListaProductos = () => { color: 'primary', size: 'large', outlineColor: colores.altertex[1], + disabled: !usuario?.permisos?.includes(PERMISOS.IMPORTAR_PRODUCTOS), }, { diff --git a/src/Vistas/Paginas/SetsProductos/ListaSetsProductos.jsx b/src/Vistas/Paginas/SetsProductos/ListaSetsProductos.jsx index e53d1a82..9c8330c4 100644 --- a/src/Vistas/Paginas/SetsProductos/ListaSetsProductos.jsx +++ b/src/Vistas/Paginas/SetsProductos/ListaSetsProductos.jsx @@ -186,6 +186,7 @@ const ListaSetsProductos = () => { size: 'large', backgroundColor: colores.altertex[1], onClick: () => setModalCrearAbierto(true), + disabled: !usuario?.permisos?.includes(PERMISOS.CREAR_SET_PRODUCTOS), }, { label: 'Eliminar', @@ -202,7 +203,7 @@ const ListaSetsProductos = () => { setAbrirPopUpEliminar(true); } }, - disabled: !usuario?.permisos?.includes(PERMISOS.ELIMINAR_GRUPO_EMPLEADOS), + disabled: !usuario?.permisos?.includes(PERMISOS.ELIMINAR_SET_PRODUCTOS), size: 'large', color: 'error', backgroundColor: colores.altertex[1],