feat: Implement Code Pedimento Regimens Data Table

- Added columns definition for Code Pedimento Regimens including ID, Pedimento Code, Regimen Code, Type, and Actions.
- Created DataTableActions component for handling actions on each row.
- Developed data-table component to manage pagination and rendering of the data table.
- Introduced helper functions for rendering components and snippets in table cells.
- Integrated API call in the server-side load function to fetch Code Pedimento Regimens data with pagination support.
- Updated package.json to include lucide-svelte dependency for icons.
This commit is contained in:
2025-11-02 13:15:05 -06:00
parent f29e219cf8
commit 2b735c27b8
30 changed files with 1390 additions and 69 deletions

View File

@@ -0,0 +1,73 @@
/**
* API Client para Code Pedimento Regimens
* Gestiona las operaciones CRUD para las relaciones entre códigos de pedimento y regímenes
*/
import { api } from '$lib/api';
export interface CodePedimentoRegimen {
id: number;
pedimento_code: string;
regimen_code: string | null;
type_code: string | null;
}
export interface CodePedimentoRegimenListResponse {
items: CodePedimentoRegimen[];
total: number;
page: number;
page_size: number;
}
export interface CreateCodePedimentoRegimenData {
pedimento_code: string;
regimen_code?: string;
type_code?: string;
}
export interface UpdateCodePedimentoRegimenData {
pedimento_code?: string;
regimen_code?: string;
type_code?: string;
}
/**
* API para Code Pedimento Regimens
*/
export const codePedimentoRegimensApi = {
/**
* Lista todos los code pedimento regimens 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<CodePedimentoRegimenListResponse>(
`/v1/code-pedimento-regimens?page=${page}&page_size=${pageSize}`
),
/**
* Obtiene un code pedimento regimen por ID
* @param id - ID del code pedimento regimen
*/
get: (id: number) => api.get<CodePedimentoRegimen>(`/v1/code-pedimento-regimens/${id}`),
/**
* Crea un nuevo code pedimento regimen
* @param data - Datos del code pedimento regimen a crear
*/
create: (data: CreateCodePedimentoRegimenData) =>
api.post<CodePedimentoRegimen>('/v1/code-pedimento-regimens', data),
/**
* Actualiza un code pedimento regimen existente
* @param id - ID del code pedimento regimen a actualizar
* @param data - Datos a actualizar
*/
update: (id: number, data: UpdateCodePedimentoRegimenData) =>
api.put<CodePedimentoRegimen>(`/v1/code-pedimento-regimens/${id}`, data),
/**
* Elimina un code pedimento regimen
* @param id - ID del code pedimento regimen a eliminar
*/
delete: (id: number) => api.delete(`/v1/code-pedimento-regimens/${id}`)
};