Se mejoro el disenio de partes, se genero la informacion mas precisa en los reportes y se carga el logo en las instanacias de las empresas
This commit is contained in:
@@ -87,7 +87,7 @@ export interface CreateCustomsBrokerData {
|
||||
*/
|
||||
export const customsBrokersApi = {
|
||||
list: (companyId: string) => {
|
||||
return api.get<CustomsBroker[]>(`/v1/a76/customs-brokers/?company_id=${companyId}`);
|
||||
return api.get<CustomsBroker[]>(`/v1/a76/customs-brokers?company_id=${companyId}`);
|
||||
},
|
||||
|
||||
get: (brokerKey: string, companyId: string) => {
|
||||
@@ -95,7 +95,7 @@ export const customsBrokersApi = {
|
||||
},
|
||||
|
||||
create: (data: CreateCustomsBrokerData, companyId: string) => {
|
||||
return api.post<CustomsBroker>(`/v1/a76/customs-brokers/?company_id=${companyId}`, data);
|
||||
return api.post<CustomsBroker>(`/v1/a76/customs-brokers?company_id=${companyId}`, data);
|
||||
},
|
||||
|
||||
update: (brokerKey: string, data: CreateCustomsBrokerData, companyId: string) => {
|
||||
|
||||
@@ -25,6 +25,13 @@ export interface Company {
|
||||
order_format_type?: string | null;
|
||||
ctpat_svi?: string | null;
|
||||
trusted_exporter_number?: string | null;
|
||||
logo?: string | null;
|
||||
previous_code?: number | null;
|
||||
client_name?: string | null;
|
||||
subassembly_mode?: string | null;
|
||||
inter_db_name?: string | null;
|
||||
prevalidator_key?: string | null;
|
||||
seventh_amendment?: boolean;
|
||||
created_at: string | null;
|
||||
updated_at: string | null;
|
||||
}
|
||||
@@ -113,3 +120,13 @@ export async function updateCompany(id: number, data: CompanyUpdate): Promise<Ap
|
||||
export async function deleteCompany(id: number): Promise<ApiResponse<void>> {
|
||||
return await api.delete(`/v1/a76/company/${id}`);
|
||||
}
|
||||
|
||||
export async function uploadCompanyLogo(id: number, file: File): Promise<ApiResponse<{ path: string }>> {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
// Use api.request to pass FormData directly without JSON.stringify
|
||||
return await api.request(`/v1/a76/company/${id}/upload-logo`, {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
import { api } from '$lib/api';
|
||||
import type { PaginatedResponse } from '$lib/types';
|
||||
|
||||
export interface PaginatedResponse {
|
||||
page: number;
|
||||
page_size: number;
|
||||
total: number;
|
||||
total_pages: number;
|
||||
}
|
||||
|
||||
export interface MultiCurrencyType {
|
||||
id: number;
|
||||
@@ -29,11 +35,13 @@ export interface MultiCurrencyTypeListResponse extends PaginatedResponse {
|
||||
items: MultiCurrencyType[];
|
||||
}
|
||||
|
||||
import type { ApiResponse } from '$lib/api';
|
||||
|
||||
export async function getMultiCurrencyTypes(
|
||||
companyId: number,
|
||||
page?: number,
|
||||
pageSize?: number
|
||||
): Promise<MultiCurrencyTypeListResponse> {
|
||||
): Promise<ApiResponse<MultiCurrencyTypeListResponse>> {
|
||||
const params = new URLSearchParams({ company_id: companyId.toString() });
|
||||
if (page) params.append('page', page.toString());
|
||||
if (pageSize) params.append('page_size', pageSize.toString());
|
||||
@@ -44,7 +52,7 @@ export async function getMultiCurrencyTypes(
|
||||
export async function getMultiCurrencyType(
|
||||
multiCurrencyTypeId: number,
|
||||
companyId: number
|
||||
): Promise<MultiCurrencyType> {
|
||||
): Promise<ApiResponse<MultiCurrencyType>> {
|
||||
const params = new URLSearchParams({ company_id: companyId.toString() });
|
||||
return api.get<MultiCurrencyType>(`/v1/a76/multi-currency-types/${multiCurrencyTypeId}?${params.toString()}`);
|
||||
}
|
||||
@@ -52,7 +60,7 @@ export async function getMultiCurrencyType(
|
||||
export async function createMultiCurrencyType(
|
||||
data: MultiCurrencyTypeCreate,
|
||||
companyId: number
|
||||
): Promise<MultiCurrencyType> {
|
||||
): Promise<ApiResponse<MultiCurrencyType>> {
|
||||
const params = new URLSearchParams({ company_id: companyId.toString() });
|
||||
return api.post<MultiCurrencyType>(`/v1/a76/multi-currency-types/?${params.toString()}`, data);
|
||||
}
|
||||
@@ -61,7 +69,7 @@ export async function updateMultiCurrencyType(
|
||||
multiCurrencyTypeId: number,
|
||||
data: MultiCurrencyTypeUpdate,
|
||||
companyId: number
|
||||
): Promise<MultiCurrencyType> {
|
||||
): Promise<ApiResponse<MultiCurrencyType>> {
|
||||
const params = new URLSearchParams({ company_id: companyId.toString() });
|
||||
return api.put<MultiCurrencyType>(
|
||||
`/v1/a76/multi-currency-types/${multiCurrencyTypeId}?${params.toString()}`,
|
||||
@@ -72,7 +80,7 @@ export async function updateMultiCurrencyType(
|
||||
export async function deleteMultiCurrencyType(
|
||||
multiCurrencyTypeId: number,
|
||||
companyId: number
|
||||
): Promise<void> {
|
||||
): Promise<ApiResponse<any>> {
|
||||
const params = new URLSearchParams({ company_id: companyId.toString() });
|
||||
return api.delete(`/v1/a76/multi-currency-types/${multiCurrencyTypeId}?${params.toString()}`);
|
||||
}
|
||||
@@ -55,24 +55,24 @@ export interface Part {
|
||||
tenant_id: number;
|
||||
company_id: number;
|
||||
client_id: number;
|
||||
|
||||
|
||||
// Identificación
|
||||
part_number: string;
|
||||
commercial_part_number: string | null;
|
||||
|
||||
|
||||
// Descripciones y Clase
|
||||
description_spanish: string | null;
|
||||
description_english: string | null;
|
||||
part_class: string | null;
|
||||
unit_of_measure: string | null;
|
||||
|
||||
unit_of_measure: string | null;
|
||||
|
||||
// Costos y Pesos
|
||||
unit_cost: number | null;
|
||||
currency_key: string | null;
|
||||
currency_type: string | null;
|
||||
unit_weight: number | null;
|
||||
weight_type: string | null;
|
||||
|
||||
|
||||
// Regulatorio
|
||||
fraction: string | null;
|
||||
us_fraction: string | null;
|
||||
@@ -82,14 +82,14 @@ export interface Part {
|
||||
eccn: string | null;
|
||||
export_code: string | null;
|
||||
exclusion_symbol: string | null;
|
||||
|
||||
|
||||
// Estado y Media
|
||||
is_active: boolean;
|
||||
part_photo: string | null;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
|
||||
|
||||
|
||||
fa_data?: FaData | null;
|
||||
inv_data?: InvData | null;
|
||||
}
|
||||
@@ -99,7 +99,7 @@ export interface PartCreate extends Omit<Part, 'id' | 'tenant_id' | 'created_at'
|
||||
}
|
||||
|
||||
|
||||
export interface PartUpdate extends Partial<PartCreate> {}
|
||||
export interface PartUpdate extends Partial<PartCreate> { }
|
||||
|
||||
|
||||
export interface PartListResponse {
|
||||
@@ -112,20 +112,20 @@ export interface PartListResponse {
|
||||
|
||||
export const partsApi = {
|
||||
|
||||
list: (params: {
|
||||
company_id: number;
|
||||
page?: number;
|
||||
page_size?: number;
|
||||
q?: string
|
||||
list: (params: {
|
||||
company_id: number;
|
||||
page?: number;
|
||||
page_size?: number;
|
||||
q?: string
|
||||
}) => {
|
||||
const { company_id, page = 1, page_size = 50, q = '' } = params;
|
||||
const skip = (page - 1) * page_size;
|
||||
|
||||
|
||||
const query = new URLSearchParams({
|
||||
company_id: company_id.toString(),
|
||||
skip: skip.toString(),
|
||||
limit: page_size.toString(),
|
||||
description: q
|
||||
description: q
|
||||
});
|
||||
|
||||
return api.get<PartListResponse>(`/v1/a76/parts/?${query.toString()}`);
|
||||
@@ -140,11 +140,11 @@ export const partsApi = {
|
||||
},
|
||||
|
||||
update: (id: number, data: PartUpdate, company_id: number) => {
|
||||
return api.put<Part>(`/v1/a76/parts/${id}?company_id=${company_id}`, data);
|
||||
return api.put<Part>(`/v1/a76/parts/${id}/?company_id=${company_id}`, data);
|
||||
},
|
||||
|
||||
|
||||
delete: (id: number, company_id: number) => {
|
||||
return api.delete<void>(`/v1/a76/parts/${id}?company_id=${company_id}`);
|
||||
return api.delete<void>(`/v1/a76/parts/${id}/?company_id=${company_id}`);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user