Refinamiento de permisos y ajustes en controles. Añade gestión sobre saldos y visualización. Entre otros..
This commit is contained in:
31
Frontend/src/services/Contables/saldoService.ts
Normal file
31
Frontend/src/services/Contables/saldoService.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import apiClient from '../apiClient';
|
||||
import type { SaldoGestionDto } from '../../models/dtos/Contables/SaldoGestionDto';
|
||||
import type { AjusteSaldoRequestDto } from '../../models/dtos/Contables/AjusteSaldoRequestDto';
|
||||
|
||||
interface GetSaldosParams {
|
||||
destino?: 'Distribuidores' | 'Canillas' | '';
|
||||
idDestino?: number | string; // Puede ser string si viene de un input antes de convertir
|
||||
idEmpresa?: number | string;
|
||||
}
|
||||
|
||||
const getAllSaldosGestion = async (filters?: GetSaldosParams): Promise<SaldoGestionDto[]> => {
|
||||
const params: Record<string, string | number> = {};
|
||||
if (filters?.destino) params.destino = filters.destino;
|
||||
if (filters?.idDestino) params.idDestino = Number(filters.idDestino); // Asegurar número
|
||||
if (filters?.idEmpresa) params.idEmpresa = Number(filters.idEmpresa); // Asegurar número
|
||||
|
||||
const response = await apiClient.get<SaldoGestionDto[]>('/saldos', { params });
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const ajustarSaldo = async (data: AjusteSaldoRequestDto): Promise<SaldoGestionDto> => { // Esperamos el saldo actualizado
|
||||
const response = await apiClient.post<SaldoGestionDto>('/saldos/ajustar', data);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const saldoService = {
|
||||
getAllSaldosGestion,
|
||||
ajustarSaldo,
|
||||
};
|
||||
|
||||
export default saldoService;
|
||||
@@ -5,11 +5,17 @@ import type { UpdateCanillaDto } from '../../models/dtos/Distribucion/UpdateCani
|
||||
import type { ToggleBajaCanillaDto } from '../../models/dtos/Distribucion/ToggleBajaCanillaDto';
|
||||
|
||||
|
||||
const getAllCanillas = async (nomApeFilter?: string, legajoFilter?: number, soloActivos?: boolean): Promise<CanillaDto[]> => {
|
||||
const getAllCanillas = async (
|
||||
nomApeFilter?: string,
|
||||
legajoFilter?: number,
|
||||
soloActivos?: boolean,
|
||||
esAccionistaFilter?: boolean // Asegúrate que esté aquí
|
||||
): Promise<CanillaDto[]> => {
|
||||
const params: Record<string, string | number | boolean> = {};
|
||||
if (nomApeFilter) params.nomApe = nomApeFilter;
|
||||
if (legajoFilter !== undefined && legajoFilter !== null) params.legajo = legajoFilter;
|
||||
if (soloActivos !== undefined) params.soloActivos = soloActivos;
|
||||
if (esAccionistaFilter !== undefined) params.esAccionista = esAccionistaFilter; // <<-- ¡CLAVE! Verifica esto.
|
||||
|
||||
const response = await apiClient.get<CanillaDto[]>('/canillas', { params });
|
||||
return response.data;
|
||||
|
||||
@@ -2,6 +2,8 @@ import apiClient from '../apiClient';
|
||||
import type { DistribuidorDto } from '../../models/dtos/Distribucion/DistribuidorDto';
|
||||
import type { CreateDistribuidorDto } from '../../models/dtos/Distribucion/CreateDistribuidorDto';
|
||||
import type { UpdateDistribuidorDto } from '../../models/dtos/Distribucion/UpdateDistribuidorDto';
|
||||
import type { DistribuidorDropdownDto } from '../../models/dtos/Distribucion/DistribuidorDropdownDto';
|
||||
import type { DistribuidorLookupDto } from '../../models/dtos/Distribucion/DistribuidorLookupDto';
|
||||
|
||||
const getAllDistribuidores = async (nombreFilter?: string, nroDocFilter?: string): Promise<DistribuidorDto[]> => {
|
||||
const params: Record<string, string> = {};
|
||||
@@ -17,6 +19,11 @@ const getDistribuidorById = async (id: number): Promise<DistribuidorDto> => {
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const getDistribuidorLookupById = async (id: number): Promise<DistribuidorLookupDto> => {
|
||||
const response = await apiClient.get<DistribuidorLookupDto>(`/distribuidores/${id}/lookup`);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const createDistribuidor = async (data: CreateDistribuidorDto): Promise<DistribuidorDto> => {
|
||||
const response = await apiClient.post<DistribuidorDto>('/distribuidores', data);
|
||||
return response.data;
|
||||
@@ -30,12 +37,19 @@ const deleteDistribuidor = async (id: number): Promise<void> => {
|
||||
await apiClient.delete(`/distribuidores/${id}`);
|
||||
};
|
||||
|
||||
const getAllDistribuidoresDropdown = async (): Promise<DistribuidorDropdownDto[]> => {
|
||||
const response = await apiClient.get<DistribuidorDropdownDto[]>('/distribuidores/dropdown');
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const distribuidorService = {
|
||||
getAllDistribuidores,
|
||||
getDistribuidorById,
|
||||
createDistribuidor,
|
||||
updateDistribuidor,
|
||||
deleteDistribuidor,
|
||||
getAllDistribuidoresDropdown,
|
||||
getDistribuidorLookupById,
|
||||
};
|
||||
|
||||
export default distribuidorService;
|
||||
@@ -2,6 +2,8 @@ import apiClient from '../apiClient';
|
||||
import type { EmpresaDto } from '../../models/dtos/Distribucion/EmpresaDto';
|
||||
import type { CreateEmpresaDto } from '../../models/dtos/Distribucion/CreateEmpresaDto';
|
||||
import type { UpdateEmpresaDto } from '../../models/dtos/Distribucion/UpdateEmpresaDto';
|
||||
import type { EmpresaDropdownDto } from '../../models/dtos/Distribucion/EmpresaDropdownDto';
|
||||
import type { EmpresaLookupDto } from '../../models/dtos/Distribucion/EmpresaLookupDto';
|
||||
|
||||
const getAllEmpresas = async (nombreFilter?: string, detalleFilter?: string): Promise<EmpresaDto[]> => {
|
||||
const params: Record<string, string> = {};
|
||||
@@ -19,6 +21,12 @@ const getEmpresaById = async (id: number): Promise<EmpresaDto> => {
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const getEmpresaLookupById = async (id: number): Promise<EmpresaLookupDto> => {
|
||||
// Llama a GET /api/empresas/{id}/lookup
|
||||
const response = await apiClient.get<EmpresaLookupDto>(`/empresas/${id}/lookup`);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const createEmpresa = async (data: CreateEmpresaDto): Promise<EmpresaDto> => {
|
||||
// Llama a POST /api/empresas
|
||||
const response = await apiClient.post<EmpresaDto>('/empresas', data);
|
||||
@@ -35,12 +43,20 @@ const deleteEmpresa = async (id: number): Promise<void> => {
|
||||
await apiClient.delete(`/empresas/${id}`);
|
||||
};
|
||||
|
||||
const getEmpresasDropdown = async (): Promise<EmpresaDropdownDto[]> => {
|
||||
// Llama a GET /api/empresas
|
||||
const response = await apiClient.get<EmpresaDropdownDto[]>('/empresas/dropdown');
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const empresaService = {
|
||||
getAllEmpresas,
|
||||
getEmpresaById,
|
||||
createEmpresa,
|
||||
updateEmpresa,
|
||||
deleteEmpresa,
|
||||
getEmpresasDropdown,
|
||||
getEmpresaLookupById,
|
||||
};
|
||||
|
||||
export default empresaService;
|
||||
56
Frontend/src/services/Distribucion/novedadCanillaService.ts
Normal file
56
Frontend/src/services/Distribucion/novedadCanillaService.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import apiClient from '../apiClient';
|
||||
import type { NovedadCanillaDto } from '../../models/dtos/Distribucion/NovedadCanillaDto';
|
||||
import type { CreateNovedadCanillaDto } from '../../models/dtos/Distribucion/CreateNovedadCanillaDto';
|
||||
import type { UpdateNovedadCanillaDto } from '../../models/dtos/Distribucion/UpdateNovedadCanillaDto';
|
||||
|
||||
interface GetNovedadesParams {
|
||||
fechaDesde?: string | null; // "yyyy-MM-dd"
|
||||
fechaHasta?: string | null; // "yyyy-MM-dd"
|
||||
}
|
||||
|
||||
// Obtiene las novedades para un canillita específico, opcionalmente filtradas por fecha.
|
||||
// Corresponde a GET api/novedadescanilla/porcanilla/{idCanilla}
|
||||
const getNovedadesPorCanilla = async (idCanilla: number, params?: GetNovedadesParams): Promise<NovedadCanillaDto[]> => {
|
||||
const queryParams: Record<string, string> = {};
|
||||
if (params?.fechaDesde) queryParams.fechaDesde = params.fechaDesde;
|
||||
if (params?.fechaHasta) queryParams.fechaHasta = params.fechaHasta;
|
||||
|
||||
const response = await apiClient.get<NovedadCanillaDto[]>(`/novedadescanilla/porcanilla/${idCanilla}`, { params: queryParams });
|
||||
return response.data;
|
||||
};
|
||||
|
||||
// Obtiene una novedad específica por su ID.
|
||||
// Corresponde a GET api/novedadescanilla/{idNovedad}
|
||||
const getNovedadById = async (idNovedad: number): Promise<NovedadCanillaDto> => {
|
||||
const response = await apiClient.get<NovedadCanillaDto>(`/novedadescanilla/${idNovedad}`);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
// Crea una nueva novedad. El IdCanilla está en el DTO.
|
||||
// Corresponde a POST api/novedadescanilla
|
||||
const createNovedad = async (data: CreateNovedadCanillaDto): Promise<NovedadCanillaDto> => {
|
||||
const response = await apiClient.post<NovedadCanillaDto>('/novedadescanilla', data);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
// Actualiza una novedad existente.
|
||||
// Corresponde a PUT api/novedadescanilla/{idNovedad}
|
||||
const updateNovedad = async (idNovedad: number, data: UpdateNovedadCanillaDto): Promise<void> => {
|
||||
await apiClient.put(`/novedadescanilla/${idNovedad}`, data);
|
||||
};
|
||||
|
||||
// Elimina una novedad.
|
||||
// Corresponde a DELETE api/novedadescanilla/{idNovedad}
|
||||
const deleteNovedad = async (idNovedad: number): Promise<void> => {
|
||||
await apiClient.delete(`/novedadescanilla/${idNovedad}`);
|
||||
};
|
||||
|
||||
const novedadCanillaService = {
|
||||
getNovedadesPorCanilla,
|
||||
getNovedadById,
|
||||
createNovedad,
|
||||
updateNovedad,
|
||||
deleteNovedad,
|
||||
};
|
||||
|
||||
export default novedadCanillaService;
|
||||
@@ -16,6 +16,10 @@ import type { ComparativaConsumoBobinasDto } from '../../models/dtos/Reportes/Co
|
||||
import type { ReporteCuentasDistribuidorResponseDto } from '../../models/dtos/Reportes/ReporteCuentasDistribuidorResponseDto';
|
||||
import type { ListadoDistribucionDistribuidoresResponseDto } from '../../models/dtos/Reportes/ListadoDistribucionDistribuidoresResponseDto';
|
||||
import type { ControlDevolucionesDataResponseDto } from '../../models/dtos/Reportes/ControlDevolucionesDataResponseDto';
|
||||
import type { NovedadesCanillasReporteDto } from '../../models/dtos/Reportes/NovedadesCanillasReporteDto';
|
||||
import type { CanillaGananciaReporteDto } from '../../models/dtos/Reportes/CanillaGananciaReporteDto';
|
||||
import type { ListadoDistCanMensualDiariosDto } from '../../models/dtos/Reportes/ListadoDistCanMensualDiariosDto';
|
||||
import type { ListadoDistCanMensualPubDto } from '../../models/dtos/Reportes/ListadoDistCanMensualPubDto';
|
||||
|
||||
interface GetExistenciaPapelParams {
|
||||
fechaDesde: string; // yyyy-MM-dd
|
||||
@@ -24,6 +28,18 @@ interface GetExistenciaPapelParams {
|
||||
consolidado: boolean;
|
||||
}
|
||||
|
||||
interface GetNovedadesCanillasParams {
|
||||
idEmpresa: number;
|
||||
fechaDesde: string; // yyyy-MM-dd
|
||||
fechaHasta: string; // yyyy-MM-dd
|
||||
}
|
||||
|
||||
interface GetListadoDistMensualParams {
|
||||
fechaDesde: string; // yyyy-MM-dd
|
||||
fechaHasta: string; // yyyy-MM-dd
|
||||
esAccionista: boolean;
|
||||
}
|
||||
|
||||
const getExistenciaPapelPdf = async (params: GetExistenciaPapelParams): Promise<Blob> => {
|
||||
const queryParams: Record<string, string | number | boolean> = {
|
||||
fechaDesde: params.fechaDesde,
|
||||
@@ -385,6 +401,50 @@ const getTicketLiquidacionCanillaPdf = async (params: {
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const getNovedadesCanillasReporte = async (params: GetNovedadesCanillasParams): Promise<NovedadesCanillasReporteDto[]> => {
|
||||
const response = await apiClient.get<NovedadesCanillasReporteDto[]>('/reportes/novedades-canillas', { params });
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const getNovedadesCanillasReportePdf = async (params: GetNovedadesCanillasParams): Promise<Blob> => {
|
||||
const response = await apiClient.get('/reportes/novedades-canillas/pdf', {
|
||||
params,
|
||||
responseType: 'blob',
|
||||
});
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const getCanillasGananciasReporte = async (params: GetNovedadesCanillasParams): Promise<CanillaGananciaReporteDto[]> => {
|
||||
const response = await apiClient.get<CanillaGananciaReporteDto[]>('/reportes/novedades-canillas-ganancias', { params });
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const getListadoDistMensualDiarios = async (params: GetListadoDistMensualParams): Promise<ListadoDistCanMensualDiariosDto[]> => {
|
||||
const response = await apiClient.get<ListadoDistCanMensualDiariosDto[]>('/reportes/listado-distribucion-mensual/diarios', { params });
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const getListadoDistMensualDiariosPdf = async (params: GetListadoDistMensualParams): Promise<Blob> => {
|
||||
const response = await apiClient.get('/reportes/listado-distribucion-mensual/diarios/pdf', {
|
||||
params,
|
||||
responseType: 'blob',
|
||||
});
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const getListadoDistMensualPorPublicacion = async (params: GetListadoDistMensualParams): Promise<ListadoDistCanMensualPubDto[]> => {
|
||||
const response = await apiClient.get<ListadoDistCanMensualPubDto[]>('/reportes/listado-distribucion-mensual/publicaciones', { params });
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const getListadoDistMensualPorPublicacionPdf = async (params: GetListadoDistMensualParams): Promise<Blob> => {
|
||||
const response = await apiClient.get('/reportes/listado-distribucion-mensual/publicaciones/pdf', {
|
||||
params,
|
||||
responseType: 'blob',
|
||||
});
|
||||
return response.data;
|
||||
};
|
||||
|
||||
const reportesService = {
|
||||
getExistenciaPapel,
|
||||
getExistenciaPapelPdf,
|
||||
@@ -421,6 +481,13 @@ const reportesService = {
|
||||
getControlDevolucionesData,
|
||||
getControlDevolucionesPdf,
|
||||
getTicketLiquidacionCanillaPdf,
|
||||
getNovedadesCanillasReporte,
|
||||
getNovedadesCanillasReportePdf,
|
||||
getCanillasGananciasReporte,
|
||||
getListadoDistMensualDiarios,
|
||||
getListadoDistMensualDiariosPdf,
|
||||
getListadoDistMensualPorPublicacion,
|
||||
getListadoDistMensualPorPublicacionPdf,
|
||||
};
|
||||
|
||||
export default reportesService;
|
||||
Reference in New Issue
Block a user