From daf6b1e8d85674ea352fc3cdaefeaa9e1e8c353c Mon Sep 17 00:00:00 2001 From: Magnus Dahl <55053871+Dahly96@users.noreply.github.com> Date: Wed, 6 Mar 2024 15:09:10 +0100 Subject: [PATCH] Update consultant (#450) Co-authored-by: md --- .../components/consultants/EditableTableCompetencesCell.tsx | 6 ++++++ .../src/components/consultants/EditableTableDegreeCell.tsx | 4 ++++ .../consultants/EditableTableSelectDepartmentCell.tsx | 4 ++++ .../consultants/EditableTableSelectGradYearEdit.tsx | 4 ++++ 4 files changed, 18 insertions(+) diff --git a/frontend/src/components/consultants/EditableTableCompetencesCell.tsx b/frontend/src/components/consultants/EditableTableCompetencesCell.tsx index 12a4c9a3..0682b72b 100644 --- a/frontend/src/components/consultants/EditableTableCompetencesCell.tsx +++ b/frontend/src/components/consultants/EditableTableCompetencesCell.tsx @@ -33,6 +33,12 @@ export default function EditableTableCompetencesCell({ useEffect(() => { if (isEditing) { + setSelectedValues( + newCompetences.map((option) => ({ + value: option.id, + label: option.name, + })), + ); setConsultant(newCompetences); } }, [newCompetences]); diff --git a/frontend/src/components/consultants/EditableTableDegreeCell.tsx b/frontend/src/components/consultants/EditableTableDegreeCell.tsx index 9f90e5dc..3a6967d3 100644 --- a/frontend/src/components/consultants/EditableTableDegreeCell.tsx +++ b/frontend/src/components/consultants/EditableTableDegreeCell.tsx @@ -31,6 +31,10 @@ export default function EditableTableDegreeCell({ useEffect(() => { if (isEditing) { + setSelectedValue({ + value: Degree[newDegree], + label: newDegree.toString(), + }); setConsultant(newDegree); } }, [newDegree]); diff --git a/frontend/src/components/consultants/EditableTableSelectDepartmentCell.tsx b/frontend/src/components/consultants/EditableTableSelectDepartmentCell.tsx index 725bd5f8..33dfde47 100644 --- a/frontend/src/components/consultants/EditableTableSelectDepartmentCell.tsx +++ b/frontend/src/components/consultants/EditableTableSelectDepartmentCell.tsx @@ -32,6 +32,10 @@ export default function EditableTableSelectDepartmentCell({ useEffect(() => { if (isEditing) { + setSelectedValues({ + value: newDepartment.id, + label: newDepartment.name, + }); setConsultant(newDepartment); } }, [newDepartment]); diff --git a/frontend/src/components/consultants/EditableTableSelectGradYearEdit.tsx b/frontend/src/components/consultants/EditableTableSelectGradYearEdit.tsx index 47547e35..3485f83f 100644 --- a/frontend/src/components/consultants/EditableTableSelectGradYearEdit.tsx +++ b/frontend/src/components/consultants/EditableTableSelectGradYearEdit.tsx @@ -23,6 +23,10 @@ export default function EditableTableSelectGradYearCell({ useEffect(() => { if (isEditing) { + setSelectedValue({ + value: newYear.toString(), + label: newYear.toString(), + }); setConsultant(newYear); } }, [newYear]);