Limpieza de Comantarios
All checks were successful
Optimized Build and Deploy / remote-build-and-deploy (push) Successful in 7m59s
All checks were successful
Optimized Build and Deploy / remote-build-and-deploy (push) Successful in 7m59s
This commit is contained in:
@@ -3,12 +3,8 @@ import { Box, Paper, Typography, List, ListItemButton, ListItemText, Collapse, C
|
||||
import { Outlet, useNavigate, useLocation } from 'react-router-dom';
|
||||
import ExpandLess from '@mui/icons-material/ExpandLess';
|
||||
import ExpandMore from '@mui/icons-material/ExpandMore';
|
||||
// --- INICIO DE LA MODIFICACIÓN ---
|
||||
import { usePermissions } from '../../hooks/usePermissions';
|
||||
// --- FIN DE LA MODIFICACIÓN ---
|
||||
|
||||
// --- INICIO DE LA MODIFICACIÓN ---
|
||||
// Ahora cada reporte tiene su permiso requerido asociado.
|
||||
const allReportModules: { category: string; label: string; path: string; requiredPermission: string; }[] = [
|
||||
{ category: 'Existencia Papel', label: 'Existencia de Papel', path: 'existencia-papel', requiredPermission: 'RR005' },
|
||||
{ category: 'Movimientos Bobinas', label: 'Movimiento de Bobinas', path: 'movimiento-bobinas', requiredPermission: 'RR006' },
|
||||
@@ -30,7 +26,6 @@ const allReportModules: { category: string; label: string; path: string; require
|
||||
{ category: 'Suscripciones', label: 'Facturas para Publicidad', path: 'suscripciones-facturas-publicidad', requiredPermission: 'RR010' },
|
||||
{ category: 'Suscripciones', label: 'Distribución de Suscripciones', path: 'suscripciones-distribucion', requiredPermission: 'RR011' },
|
||||
];
|
||||
// --- FIN DE LA MODIFICACIÓN ---
|
||||
|
||||
const predefinedCategoryOrder = [
|
||||
'Balance de Cuentas', 'Listados Distribución', 'Ctrl. Devoluciones',
|
||||
@@ -43,8 +38,6 @@ const ReportesIndexPage: React.FC = () => {
|
||||
const location = useLocation();
|
||||
const [expandedCategory, setExpandedCategory] = useState<string | false>(false);
|
||||
const [isLoadingInitialNavigation, setIsLoadingInitialNavigation] = useState(true);
|
||||
|
||||
// --- INICIO DE LA MODIFICACIÓN ---
|
||||
const { tienePermiso, isSuperAdmin } = usePermissions();
|
||||
|
||||
// 1. Creamos una lista memoizada de reportes a los que el usuario SÍ tiene acceso.
|
||||
@@ -59,7 +52,6 @@ const ReportesIndexPage: React.FC = () => {
|
||||
const categoriesWithAccess = new Set(accessibleReportModules.map(r => r.category));
|
||||
return predefinedCategoryOrder.filter(category => categoriesWithAccess.has(category));
|
||||
}, [accessibleReportModules]);
|
||||
// --- FIN DE LA MODIFICACIÓN ---
|
||||
|
||||
useEffect(() => {
|
||||
const currentBasePath = '/reportes';
|
||||
|
||||
Reference in New Issue
Block a user