feat(proxy-input): 연차 정보 연동 — 연차 작업자 비활성화 + 뱃지
- 모델: getDailyStatus에 vacation_type 쿼리 추가 - 프론트: 연차(ANNUAL_FULL) 카드 비활성화 + 선택/일괄설정/저장에서 제외 - 반차/반반차/조퇴: 뱃지 표시 + 근무시간 자동 조정 (4h/6h/2h) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -99,6 +99,17 @@ const ProxyInputModel = {
|
||||
GROUP BY dwr.user_id
|
||||
`, [date]);
|
||||
|
||||
// 4. 해당 날짜의 연차 기록
|
||||
const [vacationRecords] = await db.query(`
|
||||
SELECT dar.user_id, dar.vacation_type_id,
|
||||
vt.type_code AS vacation_type_code,
|
||||
vt.type_name AS vacation_type_name,
|
||||
vt.deduct_days
|
||||
FROM daily_attendance_records dar
|
||||
JOIN vacation_types vt ON dar.vacation_type_id = vt.id
|
||||
WHERE dar.record_date = ? AND dar.vacation_type_id IS NOT NULL
|
||||
`, [date]);
|
||||
|
||||
// 메모리에서 조합
|
||||
const tbmMap = {};
|
||||
tbmAssignments.forEach(ta => {
|
||||
@@ -109,6 +120,9 @@ const ProxyInputModel = {
|
||||
const reportMap = {};
|
||||
reports.forEach(r => { reportMap[r.user_id] = r; });
|
||||
|
||||
const vacMap = {};
|
||||
vacationRecords.forEach(v => { vacMap[v.user_id] = v; });
|
||||
|
||||
let tbmCompleted = 0, reportCompleted = 0, bothCompleted = 0, bothMissing = 0;
|
||||
|
||||
const workerList = workers.map(w => {
|
||||
@@ -120,6 +134,7 @@ const ProxyInputModel = {
|
||||
is_proxy_input: !!ta.is_proxy_input
|
||||
}));
|
||||
const totalReportHours = reportMap[w.user_id]?.total_hours || 0;
|
||||
const vac = vacMap[w.user_id] || null;
|
||||
|
||||
let status = 'both_missing';
|
||||
if (hasTbm && hasReport) { status = 'complete'; bothCompleted++; }
|
||||
@@ -133,7 +148,11 @@ const ProxyInputModel = {
|
||||
return {
|
||||
user_id: w.user_id, worker_name: w.worker_name, job_type: w.job_type,
|
||||
department_name: w.department_name, has_tbm: hasTbm, has_report: hasReport,
|
||||
tbm_sessions: tbmSessions, total_report_hours: totalReportHours, status
|
||||
tbm_sessions: tbmSessions, total_report_hours: totalReportHours, status,
|
||||
vacation_type_id: vac ? vac.vacation_type_id : null,
|
||||
vacation_type_code: vac ? vac.vacation_type_code : null,
|
||||
vacation_type_name: vac ? vac.vacation_type_name : null,
|
||||
vacation_hours: vac ? (8 - parseFloat(vac.deduct_days) * 8) : null
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user