This commit is contained in:
natib21
2026-06-19 13:58:33 +00:00
parent e3aacb8b4a
commit 1c420781ea
3 changed files with 25 additions and 2 deletions

View File

@@ -6,6 +6,7 @@ import {
Modal,
NumberInput,
Select,
MultiSelect,
SimpleGrid,
Stack,
Text,
@@ -144,6 +145,28 @@ const FleetFormDialog = ({
);
}
if (field.type === "multiselect") {
const arrayValue = Array.isArray(value) ? value : (typeof value === "string" && value ? [value] : []);
return (
<MultiSelect
key={field.name}
label={field.label}
placeholder={field.placeholder || "Select options"}
data={field.options ?? []}
value={arrayValue.map(String)}
onChange={(next) =>
setValues((current) => ({ ...current, [field.name]: next }))
}
error={error}
searchable
clearable
disabled={selectOptionsLoading}
rightSection={selectOptionsLoading ? <Loader2 size={14} className="animate-spin" /> : undefined}
/>
);
}
if (field.type === "number") {
return (
<NumberInput

View File

@@ -473,7 +473,7 @@ export const FLEET_RESOURCES: FleetResourceConfig[] = [
{ name: "dateOfBirth", label: "Date of Birth", type: "date", required: true },
{ name: "licenseExpiryDate", label: "License Expiry Date", type: "date", required: true },
{ name: "status", label: "Status", type: "select", required: true, options: DRIVER_STATUS_OPTIONS },
{ name: "vehicleTypesAuthorized", label: "Authorized Vehicle Types", type: "text" },
{ name: "vehicleTypesAuthorized", label: "Authorized Vehicle Types", type: "multiselect", options: VEHICLE_TYPE_OPTIONS },
{ name: "address", label: "Address", type: "textarea" },
{ name: "emergencyContact", label: "Emergency Contact", type: "text" },
{ name: "notes", label: "Notes", type: "textarea" },

View File

@@ -14,7 +14,7 @@ export type ColumnFormat =
| "entityLabel"
| "rateLabel";
export type FormFieldType = "text" | "number" | "boolean" | "date" | "select" | "textarea";
export type FormFieldType = "text" | "number" | "boolean" | "date" | "email" | "select" | "multiselect" | "textarea";
export interface ResourceColumn {
id: string;