feat: Enhance Pedimentos CRUD operations with related data handling
- Updated PedimentosService to create and update related tables for Pedimentos. - Added company_id filtering in queries for Pedimentos. - Improved error handling and logging during creation and update processes. - Refactored router tags for consistency and clarity. - Adjusted API endpoints for customs brokers to include company_id in requests. - Enhanced company selection logic in various components to prioritize active company. - Implemented event listeners for company changes to reload data dynamically. - Updated frontend components to handle loading states and errors more effectively. - Ensured all relevant routes and API calls are aligned with the new company context.
This commit is contained in:
@@ -88,32 +88,40 @@ export interface CreateCustomsBrokerData {
|
||||
* API para Agentes Aduanales
|
||||
*/
|
||||
export const customsBrokersApi = {
|
||||
/**
|
||||
* Lista todos los agentes aduanales
|
||||
*/
|
||||
list: (companyId: string) => {
|
||||
return api.get<CustomsBroker[]>(`/v1/a76/customs-brokers?company_id=${companyId}`);
|
||||
},
|
||||
|
||||
/**
|
||||
* Obtiene un agente aduanal por su clave
|
||||
*/
|
||||
get: (brokerKey: string) => {
|
||||
return api.get<CustomsBroker>(`/api/v1/a76/customs-broker/${brokerKey}`);
|
||||
return api.get<CustomsBroker>(`/v1/a76/customs-brokers/${brokerKey}`);
|
||||
},
|
||||
|
||||
/**
|
||||
* Crea un nuevo agente aduanal
|
||||
*/
|
||||
create: (data: CreateCustomsBrokerData) => {
|
||||
return api.post<CustomsBroker>('/api/v1/a76/customs-broker', data);
|
||||
const companyId = data.company_id;
|
||||
return api.post<CustomsBroker>(`/v1/a76/customs-brokers?company_id=${companyId}`, data);
|
||||
},
|
||||
|
||||
/**
|
||||
* Elimina un agente aduanal
|
||||
*/
|
||||
delete: (brokerKey: string) => {
|
||||
return api.delete<CustomsBroker>(`/api/v1/a76/customs-broker/${brokerKey}`);
|
||||
delete: (brokerKey: string, companyId: string) => {
|
||||
return api.delete<CustomsBroker>(`/v1/a76/customs-brokers/${brokerKey}?company_id=${companyId}`);
|
||||
},
|
||||
|
||||
/**
|
||||
* Actualiza la información de VU de un agente aduanal
|
||||
*/
|
||||
updateVU: (brokerKey: string, data: CustomsBrokerVU) => {
|
||||
return api.put<CustomsBrokerVU>(`/api/v1/a76/customs-broker-vu/${brokerKey}`, data);
|
||||
return api.put<CustomsBrokerVU>(`/v1/a76/customs-broker-vu/${brokerKey}`, data);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -121,7 +129,7 @@ export const customsBrokersApi = {
|
||||
*/
|
||||
updatePersonnel: (brokerKey: string, line: number, data: CustomsBrokerPersonnel) => {
|
||||
return api.put<CustomsBrokerPersonnel>(
|
||||
`/api/v1/a76/customs-broker-personnel/${brokerKey}/${line}`,
|
||||
`/v1/a76/customs-broker-personnel/${brokerKey}/${line}`,
|
||||
data
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user