From 196b70924e3632470677881fe4c8f94c28552ae0 Mon Sep 17 00:00:00 2001 From: hreyes Date: Wed, 4 Mar 2026 10:56:40 -0700 Subject: [PATCH] feature/parametros-csv --- .../dashboard/csv-upload/CsvParamsBar.svelte | 124 ++++++++++++++++++ frontend/src/lib/config/csv-upload.ts | 74 +++++++++++ frontend/src/routes/dashboard/+layout.svelte | 2 +- .../routes/dashboard/csv-upload/+page.svelte | 71 ++++++---- 4 files changed, 247 insertions(+), 24 deletions(-) create mode 100644 frontend/src/lib/components/dashboard/csv-upload/CsvParamsBar.svelte diff --git a/frontend/src/lib/components/dashboard/csv-upload/CsvParamsBar.svelte b/frontend/src/lib/components/dashboard/csv-upload/CsvParamsBar.svelte new file mode 100644 index 00000000..45c640e8 --- /dev/null +++ b/frontend/src/lib/components/dashboard/csv-upload/CsvParamsBar.svelte @@ -0,0 +1,124 @@ + + + +
+
+
+ +
+
+ + Parámetros globales +
+ {#each globalCsvParams as param} +
+ + +
+ {/each} +
+ + + {#if currentTabFields.length > 0} +
+ Configuración: {activeTab} + {#each currentTabFields as field} +
+ {#if field.type !== 'boolean'} + + {/if} + {#if field.type === 'select' && field.options} + + {:else if field.type === 'radio' && field.options} +
+ {#each field.options as opt} + + {/each} +
+ {:else if field.type === 'boolean'} + + {/if} +
+ {/each} +
+ {/if} +
+
+
diff --git a/frontend/src/lib/config/csv-upload.ts b/frontend/src/lib/config/csv-upload.ts index 8c7420ec..f665a1d4 100644 --- a/frontend/src/lib/config/csv-upload.ts +++ b/frontend/src/lib/config/csv-upload.ts @@ -44,6 +44,80 @@ export interface CsvUploadField { defaultValue?: any; } +/** Global parameters shown in the CSV upload footer bar (one option or the other via select). */ +export interface GlobalCsvParam { + name: string; + label: string; + type: 'select'; + options: { label: string; value: string }[]; + defaultValue: string; +} + +/** Global parameters for all CSV loads; merged with tab-specific settings when sending footer_config. */ +export const globalCsvParams: GlobalCsvParam[] = [ + { + name: 'mode', + label: 'Modo de Carga', + type: 'select', + options: [ + { label: 'Actualizar', value: 'update' }, + { label: 'Reemplazar', value: 'replace' } + ], + defaultValue: 'update' + }, + { + name: 'dateFormat', + label: 'Formato de Fecha', + type: 'select', + options: [ + { label: 'DD/MM/YYYY', value: 'dd/mm/yyyy' }, + { label: 'MM/DD/YYYY', value: 'mm/dd/yyyy' }, + { label: 'YYYY-MM-DD', value: 'yyyy-mm-dd' } + ], + defaultValue: 'dd/mm/yyyy' + }, + { + name: 'weight_unit', + label: 'Unidad de Peso', + type: 'select', + options: [ + { label: 'Kilos (Kgs)', value: 'kgs' }, + { label: 'Libras (Lbs)', value: 'lbs' } + ], + defaultValue: 'kgs' + }, + { + name: 'autonumber_series', + label: 'Autonumerar Partidas/Series', + type: 'select', + options: [ + { label: 'Sí', value: 'true' }, + { label: 'No', value: 'false' } + ], + defaultValue: 'false' + }, + { + name: 'load_subpartidas', + label: 'Levantar Subpartidas', + type: 'select', + options: [ + { label: 'Sí', value: 'true' }, + { label: 'No', value: 'false' } + ], + defaultValue: 'false' + }, + { + name: 'recalculate_pedimento_date', + label: 'Recalcular Fecha Pedimento', + type: 'select', + options: [ + { label: 'Sí', value: 'true' }, + { label: 'No', value: 'false' } + ], + defaultValue: 'false' + } +]; + // Map of Tab ID -> Array of Fields export const tabSettings: Record = { catalogos: [ diff --git a/frontend/src/routes/dashboard/+layout.svelte b/frontend/src/routes/dashboard/+layout.svelte index adc8e934..a5f19609 100644 --- a/frontend/src/routes/dashboard/+layout.svelte +++ b/frontend/src/routes/dashboard/+layout.svelte @@ -57,7 +57,7 @@ --> -
+
{@render children?.()}
diff --git a/frontend/src/routes/dashboard/csv-upload/+page.svelte b/frontend/src/routes/dashboard/csv-upload/+page.svelte index e2c43003..b98087cf 100644 --- a/frontend/src/routes/dashboard/csv-upload/+page.svelte +++ b/frontend/src/routes/dashboard/csv-upload/+page.svelte @@ -1,7 +1,7 @@ -
- -
+
+ +

Importación Masiva de Datos (CSV)

@@ -481,15 +509,12 @@
-
+ +
- - {#if allSettings[activeTab]} -
- -
- {/if} + +
{#if scanResults || commitResults}