fix(tkuser): 연차 배정 모달 간소화 — 휴가유형 드롭다운 제거

- "휴가 유형" 드롭다운 → hidden (vacation_type_id 자동 설정)
- "배정 유형"이 메인 셀렉터: 기본연차/이월/장기근속/경조사
- balance_type별 vacation_type_id 자동 매핑:
  AUTO/MANUAL→ANNUAL_FULL, CARRY_OVER→CARRYOVER, LONG_SERVICE→LONG_SERVICE
- 경조사(COMPANY_GRANT) 선택 시 서브 드롭다운 표시

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-03-31 09:12:33 +09:00
parent 9528a544c6
commit 9bd3888738
7 changed files with 239 additions and 64 deletions

View File

@@ -9,16 +9,21 @@
const AttendanceModel = require('../models/attendanceModel');
const vacationBalanceModel = require('../models/vacationBalanceModel');
const { getDb } = require('../dbPool');
const { ValidationError, NotFoundError, DatabaseError } = require('../utils/errors');
const logger = require('../utils/logger');
/**
* 휴가 사용 유형 ID 차감 일수로 변환
* vacation_type_id: 1=연차(1일), 2=반차(0.5일), 3=반반차(0.25일)
* 휴가 사용 유형 ID 차감 일수 (DB vacation_types.deduct_days 조회)
*/
const getVacationDays = (vacationTypeId) => {
const daysMap = { 1: 1, 2: 0.5, 3: 0.25 };
return daysMap[vacationTypeId] || 0;
const getVacationDays = async (vacationTypeId) => {
if (!vacationTypeId) return 0;
const db = await getDb();
const [rows] = await db.execute(
'SELECT deduct_days FROM vacation_types WHERE id = ?',
[vacationTypeId]
);
return rows.length > 0 ? parseFloat(rows[0].deduct_days) || 0 : 0;
};
/**
@@ -143,8 +148,8 @@ const upsertAttendanceRecordService = async (recordData) => {
// 3. 휴가 잔액 연동 (vacation_balance_details.used_days 업데이트)
const year = new Date(record_date).getFullYear();
const previousDays = getVacationDays(previousVacationTypeId);
const newDays = getVacationDays(vacation_type_id);
const previousDays = await getVacationDays(previousVacationTypeId);
const newDays = await getVacationDays(vacation_type_id);
// 이전 휴가가 있었고 변경된 경우 → 복구 후 차감
if (previousDays !== newDays) {