/** * my-monthly-confirm.js — 작업자 월간 근무 확인 (모바일 캘린더) */ var DAYS_KR = ['일', '월', '화', '수', '목', '금', '토']; var currentYear, currentMonth; var isProcessing = false; var selectedCell = null; var currentConfStatus = null; // 현재 confirmation 상태 var pendingChanges = {}; // 수정 내역 { 'YYYY-MM-DD': { from: '반차', to: '정시', hours: 8 } } var loadedRecords = []; // 로드된 daily_records // ===== Init ===== document.addEventListener('DOMContentLoaded', function() { var now = new Date(); currentYear = now.getFullYear(); currentMonth = now.getMonth() + 1; var params = new URLSearchParams(location.search); if (params.get('year')) currentYear = parseInt(params.get('year')); if (params.get('month')) currentMonth = parseInt(params.get('month')); setTimeout(function() { var user = typeof getCurrentUser === 'function' ? getCurrentUser() : window.currentUser; if (!user) return; window._mmcUser = user; updateMonthLabel(); loadData(); }, 500); }); function updateMonthLabel() { document.getElementById('monthLabel').textContent = currentYear + '년 ' + currentMonth + '월'; } function changeMonth(delta) { currentMonth += delta; if (currentMonth > 12) { currentMonth = 1; currentYear++; } if (currentMonth < 1) { currentMonth = 12; currentYear--; } selectedCell = null; updateMonthLabel(); loadData(); } // ===== Data Load ===== async function loadData() { var calWrap = document.getElementById('tableWrap'); calWrap.innerHTML = '
'; try { var user = window._mmcUser || (typeof getCurrentUser === 'function' ? getCurrentUser() : null) || {}; var userId = user.user_id || user.id; var [recordsRes, balanceRes] = await Promise.all([ window.apiCall('/monthly-comparison/my-records?year=' + currentYear + '&month=' + currentMonth), window.apiCall('/vacation-balances/worker/' + userId + '/year/' + currentYear).catch(function() { return { success: true, data: [] }; }) ]); if (!recordsRes || !recordsRes.success) { calWrap.innerHTML = '데이터가 없습니다
네트워크 오류
해당 월 데이터가 없습니다