Update Keycloak configuration and normalize API endpoint paths in invoices API
This commit is contained in:
@@ -325,7 +325,7 @@ export const invoicesApi = {
|
||||
});
|
||||
}
|
||||
|
||||
return api.get<InvoiceListResponse>(`/v1/a76/invoices?${params.toString()}`);
|
||||
return api.get<InvoiceListResponse>(`/v1/a76/invoices/?${params.toString()}`);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -345,7 +345,7 @@ export const invoicesApi = {
|
||||
const params = new URLSearchParams({
|
||||
company_id: companyId.toString()
|
||||
});
|
||||
return api.post<Invoice>(`/v1/a76/invoices?${params.toString()}`, data);
|
||||
return api.post<Invoice>(`/v1/a76/invoices/?${params.toString()}`, data);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -378,21 +378,21 @@ export const invoicesApi = {
|
||||
const params = new URLSearchParams({
|
||||
company_id: companyId.toString()
|
||||
});
|
||||
return api.get<InvoiceLogistics[]>(`/v1/a76/invoices/${invoiceId}/logistics?${params.toString()}`);
|
||||
return api.get<InvoiceLogistics[]>(`/v1/a76/invoices/${invoiceId}/logistics/?${params.toString()}`);
|
||||
},
|
||||
|
||||
create: (invoiceId: number, companyId: number, data: Omit<InvoiceLogistics, 'id' | 'invoice_id'>) => {
|
||||
const params = new URLSearchParams({
|
||||
company_id: companyId.toString()
|
||||
});
|
||||
return api.post<InvoiceLogistics>(`/v1/a76/invoices/${invoiceId}/logistics?${params.toString()}`, data);
|
||||
return api.post<InvoiceLogistics>(`/v1/a76/invoices/${invoiceId}/logistics/?${params.toString()}`, data);
|
||||
},
|
||||
|
||||
delete: (invoiceId: number, logisticsId: number, companyId: number) => {
|
||||
const params = new URLSearchParams({
|
||||
company_id: companyId.toString()
|
||||
});
|
||||
return api.delete(`/v1/a76/invoices/${invoiceId}/logistics/${logisticsId}?${params.toString()}`);
|
||||
return api.delete(`/v1/a76/invoices/${invoiceId}/logistics/${logisticsId}/?${params.toString()}`);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -404,21 +404,21 @@ export const invoicesApi = {
|
||||
const params = new URLSearchParams({
|
||||
company_id: companyId.toString()
|
||||
});
|
||||
return api.get<InvoiceSalesDetails[]>(`/v1/a76/invoices/${invoiceId}/details?${params.toString()}`);
|
||||
return api.get<InvoiceSalesDetails[]>(`/v1/a76/invoices/${invoiceId}/details/?${params.toString()}`);
|
||||
},
|
||||
|
||||
create: (invoiceId: number, companyId: number, data: Omit<InvoiceSalesDetails, 'id' | 'invoice_id'>) => {
|
||||
const params = new URLSearchParams({
|
||||
company_id: companyId.toString()
|
||||
});
|
||||
return api.post<InvoiceSalesDetails>(`/v1/a76/invoices/${invoiceId}/details?${params.toString()}`, data);
|
||||
return api.post<InvoiceSalesDetails>(`/v1/a76/invoices/${invoiceId}/details/?${params.toString()}`, data);
|
||||
},
|
||||
|
||||
delete: (invoiceId: number, detailId: number, companyId: number) => {
|
||||
const params = new URLSearchParams({
|
||||
company_id: companyId.toString()
|
||||
});
|
||||
return api.delete(`/v1/a76/invoices/${invoiceId}/details/${detailId}?${params.toString()}`);
|
||||
return api.delete(`/v1/a76/invoices/${invoiceId}/details/${detailId}/?${params.toString()}`);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -430,21 +430,21 @@ export const invoicesApi = {
|
||||
const params = new URLSearchParams({
|
||||
company_id: companyId.toString()
|
||||
});
|
||||
return api.get<InvoiceCollections[]>(`/v1/a76/invoices/${invoiceId}/collections?${params.toString()}`);
|
||||
return api.get<InvoiceCollections[]>(`/v1/a76/invoices/${invoiceId}/collections/?${params.toString()}`);
|
||||
},
|
||||
|
||||
create: (invoiceId: number, companyId: number, data: Omit<InvoiceCollections, 'id' | 'invoice_id'>) => {
|
||||
const params = new URLSearchParams({
|
||||
company_id: companyId.toString()
|
||||
});
|
||||
return api.post<InvoiceCollections>(`/v1/a76/invoices/${invoiceId}/collections?${params.toString()}`, data);
|
||||
return api.post<InvoiceCollections>(`/v1/a76/invoices/${invoiceId}/collections/?${params.toString()}`, data);
|
||||
},
|
||||
|
||||
delete: (invoiceId: number, collectionId: number, companyId: number) => {
|
||||
const params = new URLSearchParams({
|
||||
company_id: companyId.toString()
|
||||
});
|
||||
return api.delete(`/v1/a76/invoices/${invoiceId}/collections/${collectionId}?${params.toString()}`);
|
||||
return api.delete(`/v1/a76/invoices/${invoiceId}/collections/${collectionId}/?${params.toString()}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -31,14 +31,14 @@ export const load: PageServerLoad = async ({ params, cookies, fetch, url }) => {
|
||||
|
||||
// Cargar datos de referencia necesarios
|
||||
const invoiceTypesPromise = authenticatedFetch(
|
||||
'v1/public/refrence_data/invoice-types?page=1&page_size=100',
|
||||
'v1/public/refrence_data/invoice-types/?page=1&page_size=100',
|
||||
{},
|
||||
cookies,
|
||||
fetch
|
||||
);
|
||||
|
||||
const customsBrokersPromise = authenticatedFetch(
|
||||
`v1/a76/customs-brokers?company_id=${companyId}&page=1&page_size=1000`,
|
||||
`v1/a76/customs-brokers/?company_id=${companyId}&page=1&page_size=100`,
|
||||
{},
|
||||
cookies,
|
||||
fetch
|
||||
@@ -46,14 +46,14 @@ export const load: PageServerLoad = async ({ params, cookies, fetch, url }) => {
|
||||
|
||||
// Cargar clientes y proveedores
|
||||
const clientsPromise = authenticatedFetch(
|
||||
`v1/a76/clients-providers?company_id=${companyId}&type=client&page=1&page_size=1000`,
|
||||
`v1/a76/clients-providers/?company_id=${companyId}&type=client&page=1&page_size=1000`,
|
||||
{},
|
||||
cookies,
|
||||
fetch
|
||||
);
|
||||
|
||||
const providersPromise = authenticatedFetch(
|
||||
`v1/a76/clients-providers?company_id=${companyId}&type=provider&page=1&page_size=1000`,
|
||||
`v1/a76/clients-providers/?company_id=${companyId}&type=provider&page=1&page_size=1000`,
|
||||
{},
|
||||
cookies,
|
||||
fetch
|
||||
@@ -61,42 +61,35 @@ export const load: PageServerLoad = async ({ params, cookies, fetch, url }) => {
|
||||
|
||||
// Cargar tipos de moneda, transporte, etc.
|
||||
const currencyTypesPromise = authenticatedFetch(
|
||||
'v1/public/refrence_data/currency-types?page=1&page_size=100',
|
||||
'v1/public/refrence_data/currency-types/?page=1&page_size=100',
|
||||
{},
|
||||
cookies,
|
||||
fetch
|
||||
);
|
||||
|
||||
const transportTypesPromise = authenticatedFetch(
|
||||
'v1/public/refrence_data/transport-types?page=1&page_size=100',
|
||||
'v1/public/refrence_data/transport-types/?page=1&page_size=100',
|
||||
{},
|
||||
cookies,
|
||||
fetch
|
||||
);
|
||||
|
||||
const sealsPromise = authenticatedFetch(
|
||||
'v1/public/refrence_data/seals?page=1&page_size=100',
|
||||
`v1/a76/seals/?company_id=${companyId}&page=1&page_size=100`,
|
||||
{},
|
||||
cookies,
|
||||
fetch
|
||||
);
|
||||
|
||||
const incotermsPromise = authenticatedFetch(
|
||||
'v1/public/refrence_data/incoterms?page=1&page_size=100',
|
||||
{},
|
||||
cookies,
|
||||
fetch
|
||||
);
|
||||
|
||||
const enclosurePromise = authenticatedFetch(
|
||||
'v1/public/refrence_data/enclosure?page=1&page_size=100',
|
||||
'v1/public/refrence_data/incoterms/?page=1&page_size=100',
|
||||
{},
|
||||
cookies,
|
||||
fetch
|
||||
);
|
||||
|
||||
const pedimentosPromise = authenticatedFetch(
|
||||
`v1/a76/pedimentos?company_id=${companyId}&page=1&page_size=100`,
|
||||
`v1/a76/pedimentos/?company_id=${companyId}&page=1&page_size=100`,
|
||||
{},
|
||||
cookies,
|
||||
fetch
|
||||
@@ -113,7 +106,6 @@ export const load: PageServerLoad = async ({ params, cookies, fetch, url }) => {
|
||||
transportTypesResponse,
|
||||
sealsResponse,
|
||||
incotermsResponse,
|
||||
enclosureResponse,
|
||||
pedimentosResponse
|
||||
] = await Promise.all([
|
||||
invoiceTypesPromise,
|
||||
@@ -124,7 +116,6 @@ export const load: PageServerLoad = async ({ params, cookies, fetch, url }) => {
|
||||
transportTypesPromise,
|
||||
sealsPromise,
|
||||
incotermsPromise,
|
||||
enclosurePromise,
|
||||
pedimentosPromise
|
||||
]);
|
||||
|
||||
@@ -136,7 +127,6 @@ export const load: PageServerLoad = async ({ params, cookies, fetch, url }) => {
|
||||
const transportTypes = transportTypesResponse.ok ? await transportTypesResponse.json() : { items: [] };
|
||||
const seals = sealsResponse.ok ? await sealsResponse.json() : { items: [] };
|
||||
const incoterms = incotermsResponse.ok ? await incotermsResponse.json() : { items: [] };
|
||||
const enclosure = enclosureResponse.ok ? await enclosureResponse.json() : { items: [] };
|
||||
const pedimentos = pedimentosResponse.ok ? await pedimentosResponse.json() : { items: [] };
|
||||
|
||||
return {
|
||||
@@ -151,7 +141,6 @@ export const load: PageServerLoad = async ({ params, cookies, fetch, url }) => {
|
||||
transportTypes: transportTypes.items || [],
|
||||
seals: seals.items || [],
|
||||
incoterms: incoterms.items || [],
|
||||
enclosure: enclosure.items || [],
|
||||
pedimentos: pedimentos.items || [],
|
||||
// Filtros desde query parameters para preselección
|
||||
filters: {
|
||||
@@ -191,7 +180,6 @@ export const load: PageServerLoad = async ({ params, cookies, fetch, url }) => {
|
||||
transportTypesResponse,
|
||||
sealsResponse,
|
||||
incotermsResponse,
|
||||
enclosureResponse,
|
||||
pedimentosResponse
|
||||
] = await Promise.all([
|
||||
invoiceTypesPromise,
|
||||
@@ -202,7 +190,6 @@ export const load: PageServerLoad = async ({ params, cookies, fetch, url }) => {
|
||||
transportTypesPromise,
|
||||
sealsPromise,
|
||||
incotermsPromise,
|
||||
enclosurePromise,
|
||||
pedimentosPromise
|
||||
]);
|
||||
|
||||
@@ -214,7 +201,6 @@ export const load: PageServerLoad = async ({ params, cookies, fetch, url }) => {
|
||||
const transportTypes = transportTypesResponse.ok ? await transportTypesResponse.json() : { items: [] };
|
||||
const seals = sealsResponse.ok ? await sealsResponse.json() : { items: [] };
|
||||
const incoterms = incotermsResponse.ok ? await incotermsResponse.json() : { items: [] };
|
||||
const enclosure = enclosureResponse.ok ? await enclosureResponse.json() : { items: [] };
|
||||
const pedimentos = pedimentosResponse.ok ? await pedimentosResponse.json() : { items: [] };
|
||||
|
||||
return {
|
||||
@@ -229,7 +215,6 @@ export const load: PageServerLoad = async ({ params, cookies, fetch, url }) => {
|
||||
transportTypes: transportTypes.items || [],
|
||||
seals: seals.items || [],
|
||||
incoterms: incoterms.items || [],
|
||||
enclosure: enclosure.items || [],
|
||||
pedimentos: pedimentos.items || [],
|
||||
// Filtros desde query parameters para preselección
|
||||
filters: {
|
||||
|
||||
Reference in New Issue
Block a user