feat: replace vessel selection with text input for testing purposes in ConfigDrivenSection

This commit is contained in:
estifanos
2026-08-11 07:39:13 +00:00
parent 0e8a82c518
commit 8446b28549

View File

@@ -122,21 +122,33 @@ export function ConfigDrivenSection({
onChange={(v) => onChange(field.key, v)}
/>
) : isVesselPicker ? (
<Select
// ponytail: swapped for a plain text input while testing —
// vessels list is empty until the backend seed exists. Paste a
// vessel id here to exercise the autofill; restore the Select
// below once GET /vessels/mine returns real rows.
// <Select
// {...common}
// placeholder="Select a registered vessel"
// data={vessels.map((v) => ({ value: v.id, label: `${v.name} — ${v.registrationNumber}` }))}
// value={(value as string) ?? null}
// onChange={(v) => {
// onChange(field.key, v);
// const vessel = vessels.find((x) => x.id === v);
// if (vessel) fillFromVessel(vessel, fields, onChange);
// }}
// searchable
// clearable={!field.required}
// />
<TextInput
{...common}
placeholder="Select a registered vessel"
data={vessels.map((v) => ({ value: v.id, label: `${v.name}${v.registrationNumber}` }))}
value={(value as string) ?? null}
onChange={(v) => {
placeholder="Paste a vessel id (testing)"
value={(value as string) ?? ''}
onChange={(e) => {
const v = e.currentTarget.value;
onChange(field.key, v);
const vessel = vessels.find((x) => x.id === v);
// Selecting a different vessel replaces whatever the last
// selection filled in — unlike the nationality/ID prefill,
// this is a live user choice, not a one-time background fill.
if (vessel) fillFromVessel(vessel, fields, onChange);
}}
searchable
clearable={!field.required}
/>
) : field.type === 'SELECT' ? (
<Select