feature/csv-clarion-exchange-type

This commit is contained in:
hreyes
2026-03-04 15:50:30 -07:00
parent afc0a35f1c
commit e486fd750f
8 changed files with 208 additions and 26 deletions

View File

@@ -437,11 +437,20 @@ export const api = {
// CSV import for Tipos de Cambio (flujo en general_catalogs/exchange_rate/imports)
exchangeRateImports: {
upload: (file: File, companyId: number) => {
upload: (
file: File,
companyId: number,
params?: { reemplazar_sin_preguntar?: boolean; date_format?: string }
) => {
const formData = new FormData();
formData.append('file', file);
const search = new URLSearchParams({ company_id: String(companyId) });
if (params?.reemplazar_sin_preguntar !== undefined)
search.set('reemplazar_sin_preguntar', String(!!params.reemplazar_sin_preguntar));
if (params?.date_format != null && params.date_format !== '')
search.set('date_format', params.date_format);
return fetchApi(
`/v1/a76/exchange-rate/imports/upload?company_id=${companyId}`,
`/v1/a76/exchange-rate/imports/upload?${search.toString()}`,
{ method: 'POST', body: formData }
);
},