/* ===== 부적합 현황 (Nonconformity List) ===== */ const CATEGORY_TYPE = 'nonconformity'; const STATUS_LABELS = { reported: '신고', received: '접수', in_progress: '처리중', completed: '완료', closed: '종료' }; const STATUS_BADGE = { reported: 'badge-blue', received: 'badge-orange', in_progress: 'badge-purple', completed: 'badge-green', closed: 'badge-gray' }; function getReportUrl() { const h = location.hostname; if (h.includes('technicalkorea.net')) return 'https://tkreport.technicalkorea.net/pages/safety/issue-report.html?type=nonconformity'; return location.protocol + '//' + h + ':30180/pages/safety/issue-report.html?type=nonconformity'; } function getIssueDetailUrl(reportId) { const h = location.hostname; if (h.includes('technicalkorea.net')) return `https://tkreport.technicalkorea.net/pages/safety/issue-detail.html?id=${reportId}&from=nonconformity`; return `${location.protocol}//${h}:30180/pages/safety/issue-detail.html?id=${reportId}&from=nonconformity`; } async function loadStats() { try { const data = await api(`/work-issues/stats/summary?category_type=${CATEGORY_TYPE}`); if (data.success && data.data) { document.getElementById('statReported').textContent = data.data.reported || 0; document.getElementById('statReceived').textContent = data.data.received || 0; document.getElementById('statProgress').textContent = data.data.in_progress || 0; document.getElementById('statCompleted').textContent = data.data.completed || 0; } } catch { document.getElementById('statsGrid').style.display = 'none'; } } async function loadIssues() { const params = new URLSearchParams(); params.append('category_type', CATEGORY_TYPE); const status = document.getElementById('filterStatus').value; const startDate = document.getElementById('filterStartDate').value; const endDate = document.getElementById('filterEndDate').value; if (status) params.append('status', status); if (startDate) params.append('start_date', startDate); if (endDate) params.append('end_date', endDate); try { const data = await api(`/work-issues?${params.toString()}`); if (data.success) renderIssues(data.data || []); } catch { document.getElementById('issueList').innerHTML = '
등록된 부적합 신고가 없습니다
새로운 부적합을 신고하려면 \'부적합 신고\' 버튼을 클릭하세요.