Prevent same input on selects from the same step.
Change behaviour of initial step to allow multiple assignees
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import Option from "@/interfaces/option";
|
||||
import Select from "../Low/Select";
|
||||
import { CorporateUser, TeacherUser } from "@/interfaces/user";
|
||||
|
||||
interface Props {
|
||||
teachers: TeacherUser[];
|
||||
corporates: CorporateUser[];
|
||||
teachers: Option[];
|
||||
corporates: Option[];
|
||||
selects: (Option | null | undefined)[];
|
||||
placeholder: string;
|
||||
onSelectChange: (numberOfSelects: number, index: number, value: Option | null) => void;
|
||||
}
|
||||
|
||||
@@ -13,20 +13,10 @@ export default function WorkflowStepSelects({
|
||||
teachers,
|
||||
corporates,
|
||||
selects,
|
||||
placeholder,
|
||||
onSelectChange,
|
||||
}: Props) {
|
||||
|
||||
const teacherOptions: Option[] = teachers.map((teacher) => ({
|
||||
value: teacher.id,
|
||||
label: teacher.name,
|
||||
icon: () => <img src={teacher.profilePicture} alt={teacher.name} />
|
||||
}));
|
||||
const corporateOptions: Option[] = corporates.map((corporate) => ({
|
||||
value: corporate.id,
|
||||
label: corporate.name,
|
||||
icon: () => <img src={corporate.profilePicture} alt={corporate.name} />
|
||||
}));
|
||||
|
||||
return (
|
||||
<div
|
||||
className={"flex flex-wrap gap-0"}
|
||||
@@ -42,12 +32,12 @@ export default function WorkflowStepSelects({
|
||||
}
|
||||
|
||||
return (
|
||||
<div key={index} className="min-w-fit">
|
||||
<div key={index} className="w-[275px]">
|
||||
<Select
|
||||
options={[...teacherOptions, ...corporateOptions]}
|
||||
options={[...teachers, ...corporates]}
|
||||
value={option}
|
||||
onChange={(option) => onSelectChange(selects.length, index, option)}
|
||||
placeholder={"Approval By:"}
|
||||
placeholder={placeholder}
|
||||
flat
|
||||
isClearable
|
||||
className={classes}
|
||||
|
||||
Reference in New Issue
Block a user