Se modifico Pedimento detail se empezaron a agregar elementos del auditor y detalle completo del pedimento
This commit is contained in:
@@ -5,10 +5,12 @@ export interface PedimentoDocument {
|
||||
id: string;
|
||||
organizacion: string;
|
||||
pedimento: string;
|
||||
pedimento_numero: string;
|
||||
archivo: string;
|
||||
document_type: number;
|
||||
size: number;
|
||||
extension: string;
|
||||
fuente: number;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
@@ -20,17 +22,38 @@ export interface PedimentoDocumentsResponse {
|
||||
results: PedimentoDocument[];
|
||||
}
|
||||
|
||||
export interface DocumentFilters {
|
||||
document_type?: string;
|
||||
archivo__icontains?: string;
|
||||
extension?: string;
|
||||
created_at__date?: string;
|
||||
ordering?: string;
|
||||
}
|
||||
|
||||
const API_URL = (import.meta as any).env.VITE_EFC_API_URL;
|
||||
|
||||
export async function fetchPedimentoDocuments(
|
||||
pedimentoId: string,
|
||||
page: number = 1,
|
||||
pageSize: number = 10
|
||||
pageSize: number = 10,
|
||||
filters: DocumentFilters = {}
|
||||
): Promise<PedimentoDocumentsResponse> {
|
||||
try {
|
||||
const res = await fetchWithAuth(
|
||||
`${API_URL}/record/documents/?page=${page}&page_size=${pageSize}&pedimento=${pedimentoId}`
|
||||
);
|
||||
// Construir URL con filtros
|
||||
const params = new URLSearchParams({
|
||||
page: page.toString(),
|
||||
page_size: pageSize.toString(),
|
||||
pedimento: pedimentoId
|
||||
});
|
||||
|
||||
// Agregar filtros si existen
|
||||
Object.entries(filters).forEach(([key, value]) => {
|
||||
if (value !== undefined && value !== '') {
|
||||
params.append(key, value.toString());
|
||||
}
|
||||
});
|
||||
|
||||
const res = await fetchWithAuth(`${API_URL}/record/documents/?${params.toString()}`);
|
||||
|
||||
if (!res.ok) {
|
||||
throw new Error('No autorizado o error en la petición');
|
||||
|
||||
Reference in New Issue
Block a user