diff --git a/frontend/issues-management.html b/frontend/issues-management.html index 6071939..f91c5a5 100644 --- a/frontend/issues-management.html +++ b/frontend/issues-management.html @@ -145,55 +145,29 @@ - +
-
- -
+
+ +
- -
- - -
- - -
- - -
- - -
- - -
- - -
- - + +
+ +
@@ -283,6 +257,7 @@ let filteredIssues = []; let selectedIssues = new Set(); let currentIssueId = null; + let currentTab = 'in_progress'; // 기본값: 진행 중 // API 로드 후 초기화 함수 async function initializeManagement() { @@ -343,12 +318,7 @@ // 부적합 목록 로드 (관리자는 모든 부적합 조회) async function loadIssues() { try { - let endpoint = '/api/issues/'; - - // 관리자인 경우 전체 부적합 조회 API 사용 - if (currentUser.role === 'admin') { - endpoint = '/api/issues/admin/all'; - } + let endpoint = '/api/issues/admin/all'; const response = await fetch(endpoint, { headers: { @@ -358,7 +328,11 @@ }); if (response.ok) { - issues = await response.json(); + const allIssues = await response.json(); + // 관리함에서는 진행 중(in_progress)과 완료됨(completed) 상태만 표시 + issues = allIssues.filter(issue => + issue.review_status === 'in_progress' || issue.review_status === 'completed' + ); filterIssues(); updateStatistics(); } else { @@ -370,25 +344,35 @@ } } + // 탭 전환 함수 + function switchTab(tab) { + currentTab = tab; + + // 탭 버튼 스타일 업데이트 + const inProgressTab = document.getElementById('inProgressTab'); + const completedTab = document.getElementById('completedTab'); + + if (tab === 'in_progress') { + inProgressTab.className = 'flex-1 px-4 py-2 text-sm font-medium rounded-md transition-colors duration-200 bg-blue-500 text-white'; + completedTab.className = 'flex-1 px-4 py-2 text-sm font-medium rounded-md transition-colors duration-200 text-gray-600 hover:text-gray-900'; + } else { + inProgressTab.className = 'flex-1 px-4 py-2 text-sm font-medium rounded-md transition-colors duration-200 text-gray-600 hover:text-gray-900'; + completedTab.className = 'flex-1 px-4 py-2 text-sm font-medium rounded-md transition-colors duration-200 bg-green-500 text-white'; + } + + filterIssues(); + } + // 필터링 및 표시 함수들 function filterIssues() { const projectFilter = document.getElementById('projectFilter').value; - const statusFilter = document.getElementById('statusFilter').value; - const priorityFilter = document.getElementById('priorityFilter').value; - const assigneeFilter = document.getElementById('assigneeFilter').value; - const searchInput = document.getElementById('searchInput').value.toLowerCase(); filteredIssues = issues.filter(issue => { - if (projectFilter && issue.project_id != projectFilter) return false; - if (statusFilter && issue.status !== statusFilter) return false; - if (priorityFilter && issue.priority !== priorityFilter) return false; - if (assigneeFilter === 'unassigned' && issue.assignee_id) return false; - if (assigneeFilter && assigneeFilter !== 'unassigned' && issue.assignee_id != assigneeFilter) return false; + // 현재 탭에 따른 상태 필터링 + if (issue.review_status !== currentTab) return false; - if (searchInput) { - const searchText = `${issue.description} ${issue.reporter?.username || ''}`.toLowerCase(); - if (!searchText.includes(searchInput)) return false; - } + // 프로젝트 필터링 + if (projectFilter && issue.project_id != projectFilter) return false; return true; });