diff --git a/src/components/hr/EmployeeManagement/EmployeeForm.tsx b/src/components/hr/EmployeeManagement/EmployeeForm.tsx index 268f05e4..1aab626c 100644 --- a/src/components/hr/EmployeeManagement/EmployeeForm.tsx +++ b/src/components/hr/EmployeeManagement/EmployeeForm.tsx @@ -287,6 +287,32 @@ export function EmployeeForm({ })); }; + // 부서 선택 변경 (id와 name 모두 업데이트) + const handleDepartmentSelect = (dpId: string, departmentId: string) => { + const dept = departments.find(d => String(d.id) === departmentId); + if (dept) { + setFormData(prev => ({ + ...prev, + departmentPositions: prev.departmentPositions.map(dp => + dp.id === dpId ? { ...dp, departmentId: String(dept.id), departmentName: dept.name } : dp + ), + })); + } + }; + + // 직책 선택 변경 (id와 name 모두 업데이트) + const handlePositionSelect = (dpId: string, positionId: string) => { + const position = titles.find(t => String(t.id) === positionId); + if (position) { + setFormData(prev => ({ + ...prev, + departmentPositions: prev.departmentPositions.map(dp => + dp.id === dpId ? { ...dp, positionId: String(position.id), positionName: position.name } : dp + ), + })); + } + }; + // 저장 const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); @@ -600,13 +626,20 @@ export function EmployeeForm({ {fieldSettings.showRank && (
- handleChange('rank', e.target.value)} - placeholder="직급 입력" + onValueChange={(value) => handleChange('rank', value)} disabled={isViewMode} - /> + > + + + + + {ranks.map((rank) => ( + {rank.name} + ))} + +
)} @@ -657,20 +690,38 @@ export function EmployeeForm({
{formData.departmentPositions.map((dp) => (
- handleDepartmentPositionChange(dp.id, 'departmentName', e.target.value)} - placeholder="부서명" - className="flex-1" + handleDepartmentPositionChange(dp.id, 'positionName', e.target.value)} - placeholder="직책" - className="flex-1" + > + + + {dp.departmentName || '부서 선택'} + + + + {departments.map((dept) => ( + {dept.name} + ))} + + + {!isViewMode && (