- Added create-edit-dialog component for creating and editing pedimentos. - Integrated dialog with data table actions for editing existing pedimentos. - Implemented infinite scroll functionality in the data table for loading more pedimentos. - Enhanced server-side loading of pedimentos with authentication checks. - Added filtering options for pedimentos based on status, client ID, and year. - Improved error handling and user feedback for actions like creating, editing, and deleting pedimentos.
70 lines
1.6 KiB
TypeScript
70 lines
1.6 KiB
TypeScript
/**
|
|
* API Client para Containers
|
|
* Gestiona las operaciones CRUD para los contenedores
|
|
*/
|
|
import { api } from '$lib/api';
|
|
|
|
export interface Container {
|
|
key: string;
|
|
description: string;
|
|
}
|
|
|
|
export interface ContainerListResponse {
|
|
items: Container[];
|
|
total: number;
|
|
page: number;
|
|
page_size: number;
|
|
}
|
|
|
|
export interface CreateContainerData {
|
|
key: string;
|
|
description: string;
|
|
}
|
|
|
|
export interface UpdateContainerData {
|
|
key?: string;
|
|
description?: string;
|
|
}
|
|
|
|
/**
|
|
* API para Containers
|
|
*/
|
|
export const containersApi = {
|
|
/**
|
|
* Lista todos los containers con paginación
|
|
* @param page - Número de página (por defecto 1)
|
|
* @param pageSize - Tamaño de página (por defecto 50)
|
|
*/
|
|
list: (page = 1, pageSize = 50) =>
|
|
api.get<ContainerListResponse>(
|
|
`/v1/public/refrence_data/containers?page=${page}&page_size=${pageSize}`
|
|
),
|
|
|
|
/**
|
|
* Obtiene un container por ID
|
|
* @param key - ID del container
|
|
*/
|
|
get: (key: number) => api.get<Container>(`/v1/containers/${key}`),
|
|
|
|
/**
|
|
* Crea un nuevo container
|
|
* @param data - Datos del container a crear
|
|
*/
|
|
create: (data: CreateContainerData) =>
|
|
api.post<Container>('/v1/public/refrence_data/containers', data),
|
|
|
|
/**
|
|
* Actualiza un container existente
|
|
* @param key - ID del container a actualizar
|
|
* @param data - Datos a actualizar
|
|
*/
|
|
update: (key: number, data: UpdateContainerData) =>
|
|
api.put<Container>(`/v1/public/refrence_data/containers/${key}`, data),
|
|
|
|
/**
|
|
* Elimina un container
|
|
* @param key - ID del container a eliminar
|
|
*/
|
|
delete: (key: number) => api.delete(`/v1/public/refrence_data/containers/${key}`)
|
|
};
|