diff --git a/frontend/issues-management.html b/frontend/issues-management.html index f91c5a5..e92225e 100644 --- a/frontend/issues-management.html +++ b/frontend/issues-management.html @@ -61,6 +61,77 @@ font-size: 0.75rem; font-weight: 500; } + + /* 날짜 그룹 스타일 */ + .date-group { + margin-bottom: 1.5rem; + } + + .date-header { + cursor: pointer; + transition: all 0.2s ease; + } + + .date-header:hover { + background-color: #f9fafb; + } + + /* 좌우 스크롤 가능한 이슈 테이블 */ + .issue-table-container { + overflow-x: auto; + border: 1px solid #e5e7eb; + border-radius: 0.5rem; + margin-top: 0.5rem; + } + + .issue-table { + min-width: 1200px; + width: 100%; + border-collapse: collapse; + } + + .issue-table th, + .issue-table td { + padding: 0.75rem; + text-align: left; + border-bottom: 1px solid #f3f4f6; + white-space: nowrap; + } + + .issue-table th { + background-color: #f9fafb; + font-weight: 600; + color: #374151; + font-size: 0.875rem; + } + + .issue-table tbody tr:hover { + background-color: #f9fafb; + } + + .issue-photo { + width: 60px; + height: 40px; + object-fit: cover; + border-radius: 0.375rem; + cursor: pointer; + } + + .issue-description { + max-width: 200px; + overflow: hidden; + text-overflow: ellipsis; + } + + .collapse-content { + max-height: 1000px; + overflow: hidden; + transition: max-height 0.3s ease-out; + } + + .collapse-content.collapsed { + max-height: 0; + } .badge-new { background: #dbeafe; color: #1e40af; } .badge-processing { background: #fef3c7; color: #92400e; } @@ -178,22 +249,16 @@

부적합 관리

-
-
- +
+
@@ -386,16 +451,10 @@ filteredIssues.sort((a, b) => { switch (sortOrder) { - case 'priority': - const priorityOrder = { 'high': 3, 'medium': 2, 'low': 1 }; - return (priorityOrder[b.priority] || 1) - (priorityOrder[a.priority] || 1); case 'newest': return new Date(b.report_date) - new Date(a.report_date); case 'oldest': return new Date(a.report_date) - new Date(b.report_date); - case 'status': - const statusOrder = { 'new': 4, 'processing': 3, 'pending': 2, 'completed': 1 }; - return (statusOrder[b.status] || 0) - (statusOrder[a.status] || 0); default: return new Date(b.report_date) - new Date(a.report_date); } @@ -414,52 +473,168 @@ emptyState.classList.add('hidden'); - container.innerHTML = filteredIssues.map(issue => { - const project = projects.find(p => p.id === issue.project_id); - const createdDate = new Date(issue.created_at).toLocaleDateString('ko-KR'); - const isSelected = selectedIssues.has(issue.id); + // 날짜별로 그룹화 + const groupedByDate = {}; + filteredIssues.forEach(issue => { + const date = new Date(issue.report_date).toLocaleDateString('ko-KR'); + if (!groupedByDate[date]) { + groupedByDate[date] = []; + } + groupedByDate[date].push(issue); + }); + + // 날짜별 그룹을 HTML로 생성 + const dateGroups = Object.keys(groupedByDate).map(date => { + const issues = groupedByDate[date]; + const groupId = `group-${date.replace(/\./g, '-')}`; return ` -
-
-
- - -
-
- ${getStatusText(issue.status)} - ${getPriorityBadge(issue.priority)} - ${project ? `${project.project_name}` : ''} -
- -

${issue.description}

- -
- ${issue.reporter?.username || '알 수 없음'} - ${createdDate} - ${issue.category ? `${getCategoryText(issue.category)}` : ''} -
-
+
+
+
+ +

${date}

+ (${issues.length}건)
- -
- - +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + ${issues.map(issue => createIssueRow(issue)).join('')} + +
No.프로젝트내용원인해결방안담당부서담당자조치예상일완료확인일확인자원인부서의견조치결과업로드 사진완료 사진
`; }).join(''); + + container.innerHTML = dateGroups; + } + + // 이슈 행 생성 함수 + function createIssueRow(issue) { + const project = projects.find(p => p.id === issue.project_id); + const statusText = issue.review_status === 'in_progress' ? '진행 중' : '완료됨'; + const statusClass = issue.review_status === 'in_progress' ? 'text-blue-600' : 'text-green-600'; + + return ` + + ${issue.project_sequence_no || '-'} + ${project ? project.project_name : '-'} + + ${issue.final_description || issue.description} + + ${getCategoryText(issue.final_category || issue.category)} + + ${issue.solution || '-'} + + ${getDepartmentText(issue.responsible_department) || '-'} + ${issue.responsible_person || '-'} + ${issue.expected_completion_date ? new Date(issue.expected_completion_date).toLocaleDateString('ko-KR') : '-'} + ${issue.actual_completion_date ? new Date(issue.actual_completion_date).toLocaleDateString('ko-KR') : '-'} + ${getReporterNames(issue)} + ${getDepartmentText(issue.cause_department) || '-'} + + ${issue.management_comment || '-'} + + ${statusText} + + ${issue.photo_path ? `업로드 사진` : '-'} + ${issue.photo_path2 ? `
업로드 사진 2` : ''} + + + ${issue.completion_photo_path ? `완료 사진` : '-'} + + + `; + } + + // 날짜 그룹 토글 함수 + function toggleDateGroup(groupId) { + const content = document.getElementById(groupId); + const icon = document.getElementById(`icon-${groupId}`); + + if (content.classList.contains('collapsed')) { + content.classList.remove('collapsed'); + icon.style.transform = 'rotate(0deg)'; + } else { + content.classList.add('collapsed'); + icon.style.transform = 'rotate(-90deg)'; + } + } + + // 유틸리티 함수들 + function getDepartmentText(department) { + const departments = { + 'production': '생산', + 'quality': '품질', + 'purchasing': '구매', + 'design': '설계', + 'sales': '영업' + }; + return departments[department] || department; + } + + function getReporterNames(issue) { + let names = [issue.reporter?.full_name || issue.reporter?.username || '알 수 없음']; + + if (issue.duplicate_reporters && issue.duplicate_reporters.length > 0) { + const duplicateNames = issue.duplicate_reporters.map(r => r.full_name || r.username); + names = names.concat(duplicateNames); + } + + return names.join(', '); + } + + function getCategoryText(category) { + const categories = { + 'quality': '품질', + 'safety': '안전', + 'environment': '환경', + 'process': '공정', + 'equipment': '장비', + 'material': '자재', + 'etc': '기타' + }; + return categories[category] || category; + } + + // 사진 모달 함수 + function openPhotoModal(photoPath) { + const modal = document.createElement('div'); + modal.className = 'fixed inset-0 bg-black bg-opacity-75 flex items-center justify-center z-50'; + modal.onclick = () => modal.remove(); + + modal.innerHTML = ` +
+ 확대된 사진 +
+ `; + + document.body.appendChild(modal); } // 통계 업데이트