diff --git a/Backend/GestionIntegral.Api/Controllers/Reportes/ReportesController.cs b/Backend/GestionIntegral.Api/Controllers/Reportes/ReportesController.cs index b46f0a6..25e3bf4 100644 --- a/Backend/GestionIntegral.Api/Controllers/Reportes/ReportesController.cs +++ b/Backend/GestionIntegral.Api/Controllers/Reportes/ReportesController.cs @@ -40,6 +40,7 @@ namespace GestionIntegral.Api.Controllers private const string PermisoVerReporteListadoDistMensual = "RR009"; private const string PermisoVerReporteFacturasPublicidad = "RR010"; private const string PermisoVerReporteDistSuscripciones = "RR011"; + private const string PermisoVerReportesSecretaria = "RR012"; public ReportesController( IReportesService reportesService, @@ -526,7 +527,7 @@ namespace GestionIntegral.Api.Controllers [ProducesResponseType(StatusCodes.Status404NotFound)] public async Task GetVentaMensualSecretariaElDia([FromQuery] DateTime fechaDesde, [FromQuery] DateTime fechaHasta) { - if (!TienePermiso(PermisoVerListadoDistribucion)) return Forbid(); // Asumiendo RR002 para todos estos + if (!TienePermiso(PermisoVerReportesSecretaria)) return Forbid(); // Asumiendo RR002 para todos estos var (data, error) = await _reportesService.ObtenerVentaMensualSecretariaElDiaAsync(fechaDesde, fechaHasta); if (error != null) return BadRequest(new { message = error }); if (data == null || !data.Any()) return NotFound(new { message = "No hay datos para el reporte de ventas 'El Día'." }); @@ -540,7 +541,7 @@ namespace GestionIntegral.Api.Controllers [ProducesResponseType(StatusCodes.Status404NotFound)] public async Task GetVentaMensualSecretariaElDiaPdf([FromQuery] DateTime fechaDesde, [FromQuery] DateTime fechaHasta) { - if (!TienePermiso(PermisoVerListadoDistribucion)) return Forbid(); + if (!TienePermiso(PermisoVerReportesSecretaria)) return Forbid(); var (data, error) = await _reportesService.ObtenerVentaMensualSecretariaElDiaAsync(fechaDesde, fechaHasta); @@ -577,7 +578,7 @@ namespace GestionIntegral.Api.Controllers [ProducesResponseType(StatusCodes.Status404NotFound)] public async Task GetVentaMensualSecretariaElPlata([FromQuery] DateTime fechaDesde, [FromQuery] DateTime fechaHasta) { - if (!TienePermiso(PermisoVerListadoDistribucion)) return Forbid(); // Asumiendo RR002 + if (!TienePermiso(PermisoVerReportesSecretaria)) return Forbid(); // Asumiendo RR002 var (data, error) = await _reportesService.ObtenerVentaMensualSecretariaElPlataAsync(fechaDesde, fechaHasta); if (error != null) return BadRequest(new { message = error }); if (data == null || !data.Any()) return NotFound(new { message = "No hay datos para el reporte de ventas 'El Plata'." }); @@ -591,7 +592,7 @@ namespace GestionIntegral.Api.Controllers [ProducesResponseType(StatusCodes.Status404NotFound)] public async Task GetVentaMensualSecretariaElPlataPdf([FromQuery] DateTime fechaDesde, [FromQuery] DateTime fechaHasta) { - if (!TienePermiso(PermisoVerListadoDistribucion)) return Forbid(); + if (!TienePermiso(PermisoVerReportesSecretaria)) return Forbid(); var (data, error) = await _reportesService.ObtenerVentaMensualSecretariaElPlataAsync(fechaDesde, fechaHasta); @@ -628,7 +629,7 @@ namespace GestionIntegral.Api.Controllers [ProducesResponseType(StatusCodes.Status404NotFound)] public async Task GetVentaMensualSecretariaTirDevo([FromQuery] DateTime fechaDesde, [FromQuery] DateTime fechaHasta) { - if (!TienePermiso(PermisoVerListadoDistribucion)) return Forbid(); // Asumiendo RR002 + if (!TienePermiso(PermisoVerReportesSecretaria)) return Forbid(); // Asumiendo RR002 var (data, error) = await _reportesService.ObtenerVentaMensualSecretariaTirDevoAsync(fechaDesde, fechaHasta); if (error != null) return BadRequest(new { message = error }); if (data == null || !data.Any()) return NotFound(new { message = "No hay datos para el reporte de tirada/devolución." }); @@ -642,7 +643,7 @@ namespace GestionIntegral.Api.Controllers [ProducesResponseType(StatusCodes.Status404NotFound)] public async Task GetVentaMensualSecretariaTirDevoPdf([FromQuery] DateTime fechaDesde, [FromQuery] DateTime fechaHasta) { - if (!TienePermiso(PermisoVerListadoDistribucion)) return Forbid(); + if (!TienePermiso(PermisoVerReportesSecretaria)) return Forbid(); var (data, error) = await _reportesService.ObtenerVentaMensualSecretariaTirDevoAsync(fechaDesde, fechaHasta); diff --git a/Frontend/src/pages/Reportes/ReportesIndexPage.tsx b/Frontend/src/pages/Reportes/ReportesIndexPage.tsx index b540911..e868bd5 100644 --- a/Frontend/src/pages/Reportes/ReportesIndexPage.tsx +++ b/Frontend/src/pages/Reportes/ReportesIndexPage.tsx @@ -14,7 +14,7 @@ const allReportModules: { category: string; label: string; path: string; require { category: 'Listados Distribución', label: 'Distribución General', path: 'listado-distribucion-general', requiredPermission: 'RR002' }, { category: 'Listados Distribución', label: 'Distrib. Canillas (Importe)', path: 'listado-distribucion-canillas-importe', requiredPermission: 'RR002' }, { category: 'Listados Distribución', label: 'Detalle Distribución Canillas', path: 'detalle-distribucion-canillas', requiredPermission: 'MC005' }, - { category: 'Secretaría', label: 'Venta Mensual Secretaría', path: 'venta-mensual-secretaria', requiredPermission: 'RR002' }, + { category: 'Secretaría', label: 'Reportes de Ventas', path: 'venta-mensual-secretaria', requiredPermission: 'RR012' }, { category: 'Tiradas por Publicación', label: 'Tiradas Publicación/Sección', path: 'tiradas-publicaciones-secciones', requiredPermission: 'RR008' }, { category: 'Consumos Bobinas', label: 'Consumo Bobinas/Sección', path: 'consumo-bobinas-seccion', requiredPermission: 'RR007' }, { category: 'Consumos Bobinas', label: 'Consumo Bobinas/Publicación', path: 'consumo-bobinas-publicacion', requiredPermission: 'RR007' }, diff --git a/Frontend/src/pages/Reportes/SeleccionaReporteListadoDistribucionCanillas.tsx b/Frontend/src/pages/Reportes/SeleccionaReporteListadoDistribucionCanillas.tsx index 3670b1a..4d978bf 100644 --- a/Frontend/src/pages/Reportes/SeleccionaReporteListadoDistribucionCanillas.tsx +++ b/Frontend/src/pages/Reportes/SeleccionaReporteListadoDistribucionCanillas.tsx @@ -3,7 +3,7 @@ import { Box, Typography, TextField, Button, CircularProgress, Alert, FormControl, InputLabel, Select, MenuItem } from '@mui/material'; -import type { PublicacionDto } from '../../models/dtos/Distribucion/PublicacionDto'; +import type { PublicacionDropdownDto } from '../../models/dtos/Distribucion/PublicacionDropdownDto'; import publicacionService from '../../services/Distribucion/publicacionService'; interface SeleccionaReporteListadoDistribucionCanillasProps { @@ -26,7 +26,7 @@ const SeleccionaReporteListadoDistribucionCanillas: React.FC(new Date().toISOString().split('T')[0]); const [fechaHasta, setFechaHasta] = useState(new Date().toISOString().split('T')[0]); - const [publicaciones, setPublicaciones] = useState([]); + const [publicaciones, setPublicaciones] = useState([]); const [loadingDropdowns, setLoadingDropdowns] = useState(false); const [localErrors, setLocalErrors] = useState<{ [key: string]: string | null }>({}); @@ -34,7 +34,7 @@ const SeleccionaReporteListadoDistribucionCanillas: React.FC { setLoadingDropdowns(true); try { - const data = await publicacionService.getAllPublicaciones(undefined, undefined); + const data = await publicacionService.getPublicacionesForDropdown(undefined); setPublicaciones(data.map(p => p)); } catch (error) { console.error("Error al cargar publicaciones:", error);