diff --git a/frontend/src/lib/components/ui/input/file-picker-input.svelte b/frontend/src/lib/components/ui/input/file-picker-input.svelte new file mode 100644 index 00000000..36d5f19b --- /dev/null +++ b/frontend/src/lib/components/ui/input/file-picker-input.svelte @@ -0,0 +1,102 @@ + + + +
+ + buttonEl?.focus()} + /> + + + + + + +
diff --git a/frontend/src/lib/components/ui/input/index.ts b/frontend/src/lib/components/ui/input/index.ts index f47b6d3f..d73ab5b9 100644 --- a/frontend/src/lib/components/ui/input/index.ts +++ b/frontend/src/lib/components/ui/input/index.ts @@ -1,7 +1,9 @@ import Root from "./input.svelte"; +import FilePickerInput from "./file-picker-input.svelte"; export { Root, // Root as Input, + FilePickerInput, }; diff --git a/frontend/src/lib/config/shortcuts/dashboard/customs_brokers/edit.ts b/frontend/src/lib/config/shortcuts/dashboard/customs_brokers/edit.ts index 8902cccb..2c66f8ee 100644 --- a/frontend/src/lib/config/shortcuts/dashboard/customs_brokers/edit.ts +++ b/frontend/src/lib/config/shortcuts/dashboard/customs_brokers/edit.ts @@ -5,6 +5,8 @@ export const obtenerAtajosEdicionAgente = (acciones: { irContacto: () => void; irDireccion: () => void; irVU: () => void; + irDoda: () => void; + irAnam: () => void; guardar: () => void; cancelar: () => void; }): ShortcutDef[] => [ @@ -28,6 +30,16 @@ export const obtenerAtajosEdicionAgente = (acciones: { description: 'Tab Ventanilla Única', action: acciones.irVU }, + { + key: 'Alt+Digit5', + description: 'Tab DODA', + action: acciones.irDoda + }, + { + key: 'Alt+Digit6', + description: 'Tab ANAM', + action: acciones.irAnam + }, { key: 'Ctrl+S', description: 'Guardar', diff --git a/frontend/src/lib/config/shortcuts/dashboard/general_catalogs/company_information/edit.ts b/frontend/src/lib/config/shortcuts/dashboard/general_catalogs/company_information/edit.ts index 775ae7ac..cb4a90ea 100644 --- a/frontend/src/lib/config/shortcuts/dashboard/general_catalogs/company_information/edit.ts +++ b/frontend/src/lib/config/shortcuts/dashboard/general_catalogs/company_information/edit.ts @@ -11,6 +11,11 @@ export const obtenerAtajosFormularioEmpresa = (acciones: { { key: 'Alt+Digit4', description: 'Pestaña Certificaciones', action: () => acciones.cambiarPestana('certificaciones') }, { key: 'Alt+Digit5', description: 'Pestaña Direcciones', action: () => acciones.cambiarPestana('direcciones') }, { key: 'Alt+Digit6', description: 'Pestaña Config', action: () => acciones.cambiarPestana('config') }, + { + key: 'Alt+Digit7', + description: 'Pestaña Certificados Digitales', + action: () => acciones.cambiarPestana('certificados') + }, { key: 'Control+KeyS', description: 'Guardar Empresa', diff --git a/frontend/src/routes/dashboard/customs_brokers/edit/[[id]]/+page.svelte b/frontend/src/routes/dashboard/customs_brokers/edit/[[id]]/+page.svelte index 43de3704..927fbace 100644 --- a/frontend/src/routes/dashboard/customs_brokers/edit/[[id]]/+page.svelte +++ b/frontend/src/routes/dashboard/customs_brokers/edit/[[id]]/+page.svelte @@ -12,7 +12,7 @@ import CountryDialog from '$lib/components/dashboard/invoices/edit/items/fa/country-dialog.svelte'; import StateDialog from '$lib/components/dashboard/invoices/edit/items/fa/state-dialog.svelte'; import { Button } from '$lib/components/ui/button'; - import { Input } from '$lib/components/ui/input'; + import { Input, FilePickerInput } from '$lib/components/ui/input'; import { Label } from '$lib/components/ui/label'; import { Separator } from '$lib/components/ui/separator'; import { Badge } from '$lib/components/ui/badge'; @@ -32,7 +32,6 @@ FileKey, Key, Globe, - Folder, Mail, UserRound, Fingerprint, @@ -127,21 +126,6 @@ }); // --- 5. FUNCIONES --- - function handleLocalFileSelect(event: Event, targetKey: keyof typeof vuData) { - const input = event.target as HTMLInputElement; - const file = input.files?.[0]; - if (file) { - vuData[targetKey] = file.name; - if (targetKey === 'certificate_path') pendingVuFiles.certificate = file; - if (targetKey === 'key_path') pendingVuFiles.key = file; - if (targetKey === 'xml_files_path') pendingVuFiles.cove = file; - if (targetKey === 'doda_certificate_path') pendingVuFiles.dodaCertificate = file; - if (targetKey === 'doda_key_path') pendingVuFiles.dodaKey = file; - if (targetKey === 'doda_xml_files_path') pendingVuFiles.dodaCove = file; - toast.success(`Archivo ${file.name} seleccionado`); - } - } - async function uploadPendingVuFiles(companyId: string, brokerKey: string) { if (pendingVuFiles.certificate) { const res = await uploadCustomsBrokerVuFile( @@ -408,6 +392,8 @@ irContacto: () => (activeTab = 'contact'), irDireccion: () => (activeTab = 'address'), irVU: () => (activeTab = 'vu'), + irDoda: () => (activeTab = 'doda'), + irAnam: () => (activeTab = 'anam'), guardar: handleSave, cancelar: handleCancel }) @@ -791,35 +777,17 @@ class="ml-1 inline text-muted-foreground" /> -
- - handleLocalFileSelect(e, 'certificate_path')} - id="vu-cert-file" - /> - -
+ { + vuData.certificate_path = file.name; + pendingVuFiles.certificate = file; + toast.success(`Archivo ${file.name} seleccionado`); + }} + />
-
- - handleLocalFileSelect(e, 'key_path')} - id="vu-key-file" - /> - -
+ { + vuData.key_path = file.name; + pendingVuFiles.key = file; + toast.success(`Archivo ${file.name} seleccionado`); + }} + />
@@ -884,7 +834,7 @@ /> - + {vuData.vu_figure_type || 'Seleccionar tipo de figura'} @@ -936,35 +886,16 @@ class="ml-1 inline text-muted-foreground" /> -
- - handleLocalFileSelect(e, 'xml_files_path')} - id="vu-cove-file" - /> - -
+ { + vuData.xml_files_path = file.name; + pendingVuFiles.cove = file; + toast.success(`Archivo ${file.name} seleccionado`); + }} + /> @@ -1062,35 +993,17 @@ class="ml-1 inline text-muted-foreground" /> -
- - handleLocalFileSelect(e, 'doda_certificate_path')} - id="doda-cert-file" - /> - -
+ { + vuData.doda_certificate_path = file.name; + pendingVuFiles.dodaCertificate = file; + toast.success(`Archivo ${file.name} seleccionado`); + }} + />
-
- - handleLocalFileSelect(e, 'doda_key_path')} - id="doda-key-file" - /> - -
+ { + vuData.doda_key_path = file.name; + pendingVuFiles.dodaKey = file; + toast.success(`Archivo ${file.name} seleccionado`); + }} + />
@@ -1154,35 +1049,16 @@ class="ml-1 inline text-muted-foreground" /> -
- - handleLocalFileSelect(e, 'doda_xml_files_path')} - id="doda-xml-file" - /> - -
+ { + vuData.doda_xml_files_path = file.name; + pendingVuFiles.dodaCove = file; + toast.success(`Archivo ${file.name} seleccionado`); + }} + /> diff --git a/frontend/src/routes/dashboard/general_catalogs/company_information/edit/[[id]]/+page.svelte b/frontend/src/routes/dashboard/general_catalogs/company_information/edit/[[id]]/+page.svelte index d4c5d42c..5e41e305 100644 --- a/frontend/src/routes/dashboard/general_catalogs/company_information/edit/[[id]]/+page.svelte +++ b/frontend/src/routes/dashboard/general_catalogs/company_information/edit/[[id]]/+page.svelte @@ -1,8 +1,8 @@