mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 00:52:50 +00:00
vehicle
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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" },
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user