diff --git a/src/components/EditStaff/EditStaff.tsx b/src/components/EditStaff/EditStaff.tsx index 4864504..b33ad85 100644 --- a/src/components/EditStaff/EditStaff.tsx +++ b/src/components/EditStaff/EditStaff.tsx @@ -56,11 +56,11 @@ const EditStaff: React.FC = ({ Staff, combos }) => { name: Staff.name, companyId: Staff.company.id, teamId: Staff.team?.id, - departmentId: Staff.department.id, - gradeId: Staff.department.id, + departmentId: Staff.department?.id, + gradeId: Staff.grade?.id, skillSetId: defaultSkillset, // removeSkillSetId: [], - currentPositionId: Staff.currentPosition.id, + currentPositionId: Staff.currentPosition?.id, salaryId: Staff.salary.id, employType: Staff.employType, email: Staff.email, @@ -69,7 +69,7 @@ const EditStaff: React.FC = ({ Staff, combos }) => { emergContactName: Staff.emergContactName, emergContactPhone: Staff.emergContactPhone, joinDate: dayjs(Staff.joinDate).toString() || "", - joinPositionId: Staff.joinPosition.id, + joinPositionId: Staff.joinPosition?.id, departDate: dayjs(Staff.departDate).toString() || "", departReason: Staff.departReason, remark: Staff.remark, @@ -188,11 +188,11 @@ const EditStaff: React.FC = ({ Staff, combos }) => { name: Staff.name, companyId: Staff.company.id, teamId: Staff.team?.id, - departmentId: Staff.department.id, - gradeId: Staff.department.id, + departmentId: Staff.department?.id, + gradeId: Staff.grade?.id, skillSetId: defaultSkillset, // removeSkillSetId: [], - currentPositionId: Staff.currentPosition.id, + currentPositionId: Staff.currentPosition?.id, salaryId: Staff.salary.id, employType: Staff.employType, email: Staff.email, @@ -201,7 +201,7 @@ const EditStaff: React.FC = ({ Staff, combos }) => { emergContactName: Staff.emergContactName, emergContactPhone: Staff.emergContactPhone, joinDate: dayjs(Staff.joinDate).format(INPUT_DATE_FORMAT) || "", - joinPositionId: Staff.joinPosition.id, + joinPositionId: Staff.joinPosition?.id, departDate: !Staff.departDate ? "" : dayjs(Staff.departDate).format(INPUT_DATE_FORMAT), departReason: Staff.departReason, remark: Staff.remark,