fix(tkuser): hire_date 지원 + 부서 팀장 타부서 선택 허용
- findAll()에 hire_date 추가, update()에 hire_date 처리 - 사용자 편집 모달에 입사일 input 추가 - 사용자 목록에 입사일 뱃지 표시 (미등록 시 주황 경고) - 부서 팀장 드롭다운: 전체 사용자 optgroup 방식으로 변경 - u.id → u.user_id 버그 수정 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -106,13 +106,30 @@ async function editDepartment(id) {
|
||||
if (!deptUsers || !deptUsers.length) {
|
||||
try { const r = await api('/users'); deptUsers = r.data || r; } catch(e) { /* ignore */ }
|
||||
}
|
||||
const members = (deptUsers || []).filter(u => u.department_id === d.department_id && u.is_active !== 0 && u.is_active !== false);
|
||||
members.forEach(u => {
|
||||
const o = document.createElement('option');
|
||||
o.value = u.id;
|
||||
o.textContent = u.name || u.username;
|
||||
if (d.leader_user_id && d.leader_user_id === u.id) o.selected = true;
|
||||
leaderSel.appendChild(o);
|
||||
const activeUsers = (deptUsers || []).filter(u => u.is_active !== 0 && u.is_active !== false);
|
||||
const byDept = {};
|
||||
activeUsers.forEach(u => {
|
||||
const dName = deptLabel(u.department, u.department_id);
|
||||
if (!byDept[dName]) byDept[dName] = [];
|
||||
byDept[dName].push(u);
|
||||
});
|
||||
const currentDeptName = d.department_name;
|
||||
const sortedKeys = Object.keys(byDept).sort((a, b) => {
|
||||
if (a === currentDeptName) return -1;
|
||||
if (b === currentDeptName) return 1;
|
||||
return a.localeCompare(b, 'ko');
|
||||
});
|
||||
sortedKeys.forEach(dName => {
|
||||
const grp = document.createElement('optgroup');
|
||||
grp.label = dName;
|
||||
byDept[dName].forEach(u => {
|
||||
const o = document.createElement('option');
|
||||
o.value = u.user_id;
|
||||
o.textContent = u.name || u.username;
|
||||
if (d.leader_user_id && d.leader_user_id === u.user_id) o.selected = true;
|
||||
grp.appendChild(o);
|
||||
});
|
||||
leaderSel.appendChild(grp);
|
||||
});
|
||||
|
||||
document.getElementById('editDepartmentModal').classList.remove('hidden');
|
||||
|
||||
Reference in New Issue
Block a user