Merge pull request #757 from Tria-plc/freight/feature/user_management_UI

Freight/feature/user management UI
This commit is contained in:
yaschalew10
2026-07-17 12:37:22 +03:00
committed by GitHub
6 changed files with 129 additions and 1 deletions

View File

@@ -271,8 +271,14 @@ const FleetFormDialog = ({
return;
}
if (!validate()) return;
// Derived fields are never edited, so form state for them can be stale (or
// seeded from the record) — recompute before building the payload.
const submitted: Record<string, unknown> = { ...values };
fields.forEach((field) => {
if (field.derivedValue) submitted[field.name] = field.derivedValue(values);
});
const payload = Object.fromEntries(
Object.entries(values)
Object.entries(submitted)
.map(([key, value]) => {
if (value === FLEET_SELECT_NONE || value === "")
return [key, undefined];
@@ -294,6 +300,23 @@ const FleetFormDialog = ({
// only by verification and never hand-edited.
const isDisabled = Boolean(field.disabled || field.faydaLocked);
// Computed from other fields (e.g. the import run implied by the export
// run) — read-only, and recomputed here rather than read from form state.
if (field.derivedValue) {
return (
<TextInput
key={field.name}
label={field.label}
description={field.description}
placeholder={field.placeholder}
value={field.derivedValue(values)}
readOnly
variant="filled"
error={error}
/>
);
}
if (field.type === "radio") {
return (
<Radio.Group
@@ -319,6 +342,8 @@ const FleetFormDialog = ({
<Select
key={field.name}
label={field.label}
description={field.description}
placeholder={field.placeholder}
data={field.options ?? []}
value={
value == null || value === ""