fix(monthly-comparison): showToast 재귀 + vacation diff + 주말 0h

- showToast: 로컬 함수 제거 → tkfb-core.js 전역 함수 사용 (재귀 무한루프 수정)
- vacation 상태에서도 hours_diff 표시 (반차 8h/4h → 차이: +4h)
- 주말 + 0h 근태 → 근태 행 숨김 (주말로만 표시)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-04-01 09:30:41 +09:00
parent cf75462380
commit 798cc38945
2 changed files with 12 additions and 13 deletions

View File

@@ -265,14 +265,21 @@ function renderDailyList(records) {
if (r.attendance) {
const vacInfo = r.attendance.vacation_type ? ` (${r.attendance.vacation_type})` : '';
const editBtn = currentMode === 'detail' ? `<button class="mc-edit-btn" onclick="editAttendance('${r.date}', ${r.attendance.total_work_hours}, ${r.attendance.vacation_type_id || 'null'})" title="근태 수정"><i class="fas fa-pen"></i></button>` : '';
attendLine = `<div class="mc-daily-row mc-attend-row" id="attend-${r.date}">근태관리: <strong>${r.attendance.total_work_hours}h</strong> <span>(${escHtml(r.attendance.attendance_type)}${vacInfo})</span>${editBtn}</div>`;
// 주말+0h → 편집 불필요
const showEdit = currentMode === 'detail' && !(r.is_holiday && r.attendance.total_work_hours === 0);
const editBtn = showEdit ? `<button class="mc-edit-btn" onclick="editAttendance('${r.date}', ${r.attendance.total_work_hours}, ${r.attendance.vacation_type_id || 'null'})" title="근태 수정"><i class="fas fa-pen"></i></button>` : '';
// 주말+0h → 근태 행 숨김 (주말로 표시)
if (r.is_holiday && r.attendance.total_work_hours === 0) {
// 주말 표시만, 근태 행 생략
} else {
attendLine = `<div class="mc-daily-row mc-attend-row" id="attend-${r.date}">근태관리: <strong>${r.attendance.total_work_hours}h</strong> <span>(${escHtml(r.attendance.attendance_type)}${vacInfo})</span>${editBtn}</div>`;
}
} else if (r.status !== 'holiday') {
const addBtn = currentMode === 'detail' ? `<button class="mc-edit-btn" onclick="editAttendance('${r.date}', 0, null)" title="근태 입력"><i class="fas fa-plus"></i></button>` : '';
attendLine = `<div class="mc-daily-row mc-attend-row" id="attend-${r.date}" style="color:#9ca3af">근태관리: 미입력${addBtn}</div>`;
}
if (r.status === 'mismatch' && r.hours_diff) {
if (r.hours_diff && r.hours_diff !== 0) {
const sign = r.hours_diff > 0 ? '+' : '';
diffLine = `<div class="mc-daily-diff"><i class="fas fa-thumbtack"></i> 차이: ${sign}${r.hours_diff}h</div>`;
}
@@ -620,15 +627,7 @@ function escHtml(s) {
return (s || '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
}
function showToast(msg, type) {
if (window.showToast) { window.showToast(msg, type); return; }
const c = document.getElementById('toastContainer');
const t = document.createElement('div');
t.className = `toast toast-${type || 'info'}`;
t.textContent = msg;
c.appendChild(t);
setTimeout(() => t.remove(), 3000);
}
// showToast — tkfb-core.js의 전역 showToast 사용 (재정의 불필요)
// ===== Inline Attendance Edit (detail mode) =====
function getAttendanceTypeId(hours, vacTypeId) {

View File

@@ -164,7 +164,7 @@
<script src="/static/js/tkfb-core.js?v=2026033108"></script>
<script src="/js/api-base.js?v=2026031701"></script>
<script src="/js/monthly-comparison.js?v=2026040107"></script>
<script src="/js/monthly-comparison.js?v=2026040108"></script>
<script>initAuth();</script>
</body>
</html>