diff --git a/frontend/src/lib/components/dashboard/transportation/vehicles/create-edit-dialog.svelte b/frontend/src/lib/components/dashboard/transportation/vehicles/create-edit-dialog.svelte index e288a1a4..8bbc2f07 100644 --- a/frontend/src/lib/components/dashboard/transportation/vehicles/create-edit-dialog.svelte +++ b/frontend/src/lib/components/dashboard/transportation/vehicles/create-edit-dialog.svelte @@ -4,6 +4,7 @@ import { Input } from '$lib/components/ui/input'; import { Label } from '$lib/components/ui/label'; import * as Select from '$lib/components/ui/select'; + import * as Tabs from '$lib/components/ui/tabs'; import { vehiclesApi, type Vehicle } from '$lib/api/dashboard/a76/vehicles'; import { transportersApi, type Transporter } from '$lib/api/dashboard/a76/transporters'; import { transportTypesApi } from '$lib/api/dashboard/reference_data/transport_types'; @@ -72,6 +73,29 @@ { value: 'B', label: 'B' } ]; + const TRANSPORT_TYPE_TRANSLATIONS: Record = { + AR: 'Camión Blindado', + AU: 'Automóviles', + BT: 'Camión de Caja', + BU: 'Autobús', + BV: 'Camión de Bebidas', + BY: 'Bicicleta', + CO: 'Vehículo de Construcción', + EV: 'Vehículo de Emergencia', + FE: 'Ferry', + FM: 'Tractor Agrícola', + GB: 'Camión de Basura', + MC: 'Motocicleta', + OC: 'Otro', + PM: 'Camioneta con cabina', + PN: 'Camión Panel', + PU: 'Camioneta (Pick-up)', + PV: 'Pasajero', + RV: 'Vehículo Recreativo (RV)', + TR: 'Tractocamión', + TV: 'Van' + }; + const countryM3 = $derived( countries.find((c) => c.ame_key === formData.country)?.m3_key ?? null ); @@ -209,7 +233,7 @@ - + {title} @@ -232,221 +256,263 @@ {/if} -
- -
-

Identificación del Vehículo

+ + + Información General + Seguro y Detalles + -
- - -
+ + +
+

+ Identificación del Vehículo +

-
-
- - +
+
+ + +
+ +
+ + +
+
+ + +
+ +
+ + +
+ +
+ + +
-
- - +
+ + +
+

+ Datos de Transporte +

+ +
+
+ + + + {refsLoading + ? '...' + : formData.transporter_key + ? `${formData.transporter_key} — ${transporters.find((t) => t.transporter_key === formData.transporter_key)?.name ?? ''}` + : '— Seleccionar transportista —'} + + + — Vacío — + {#each transporters as t} + + {t.transporter_key} — {t.name || t.short_name || ''} + + {/each} + + +
+ +
+ + +
+ +
+ + + + {refsLoading + ? '...' + : formData.transport_type + ? `${formData.transport_type} — ${TRANSPORT_TYPE_TRANSLATIONS[formData.transport_type] || transportTypes.find((x) => x.transport_code === formData.transport_type)?.description || ''}` + : '— Opcional —'} + + + — Vacío — + {#each transportTypes as x} + + {x.transport_code} — {TRANSPORT_TYPE_TRANSLATIONS[x.transport_code] || x.description} + + {/each} + + +
+ +
+ + + + {ENTITY_OPTS.find((o) => o.value === (formData.entity_code || ''))?.label ?? + '— Sin código —'} + + + {#each ENTITY_OPTS as o} + {o.label} + {/each} + + +

Obligatorio al crear (reglas CSV)

+
+ +
+ + +
-
+ + -
- - -
+ + +
+

+ Seguro y Otros +

-
- - -
-
+
+
+ + +
- -
-

Datos de Transporte

+
+ + +
+
+ + +
-
- - - - {refsLoading - ? '...' - : formData.transporter_key - ? `${formData.transporter_key} — ${transporters.find((t) => t.transporter_key === formData.transporter_key)?.name ?? ''}` - : '— Opcional —'} - - - — Vacío — - {#each transporters as t} - - {t.transporter_key} — {t.name || t.short_name || ''} - - {/each} - - -
- -
- - -
- -
- - - - {refsLoading - ? '...' - : formData.transport_type - ? `${formData.transport_type} — ${transportTypes.find((x) => x.transport_code === formData.transport_type)?.description ?? ''}` - : '— Opcional —'} - - - — Vacío — - {#each transportTypes as x} - - {x.transport_code} — {x.description} - - {/each} - - -
- -
- - - - {ENTITY_OPTS.find((o) => o.value === (formData.entity_code || ''))?.label ?? - '— Sin código —'} - - - {#each ENTITY_OPTS as o} - {o.label} - {/each} - - -

Obligatorio al crear (reglas CSV).

-
- -
- - -
-
- - -
-

Seguro y Otros

- -
- - -
- -
-
- - +
+ + +
-
- - +
+ + +
+

+ Ubicación y Detalles +

+ +
+
+ + + + {refsLoading + ? '...' + : formData.country + ? `${formData.country} — ${countries.find((c) => c.ame_key === formData.country)?.description_es ?? ''}` + : '— Opcional —'} + + + — Vacío — + {#each countries as c} + + {c.ame_key} — {c.description_es} + + {/each} + + +
+
+ + + + {refsLoading + ? '...' + : formData.state || + (formData.country ? '— Selecciona —' : '— Primero el país —')} + + + — Vacío — + {#each statesFiltered as s} + + {s.description} + + {/each} + + +
+ +
+ + +
+
+ + +
+ +
+ + +
-
+ -
- - -
- - - -
-

Ubicación y Detalles

- -
+
- - - - {refsLoading - ? '...' - : formData.country - ? `${formData.country} — ${countries.find((c) => c.ame_key === formData.country)?.description_es ?? ''}` - : '— Opcional —'} - - - — Vacío — - {#each countries as c} - - {c.ame_key} — {c.description_es} - - {/each} - - -
-
- - - - {refsLoading - ? '...' - : formData.state || - (formData.country ? '— Selecciona —' : '— Primero el país —')} - - - — Vacío — - {#each statesFiltered as s} - - {s.description} - - {/each} - - -
-
- -
- - -
- -
-
- - -
-
- +
-
-
- + +
+