Refinamiento de permisos y ajustes en controles. Añade gestión sobre saldos y visualización. Entre otros..
This commit is contained in:
@@ -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;
|
||||
Reference in New Issue
Block a user