feat: 수신함 프론트엔드 완전 구현 - 실제 API 연동
🎨 UI Components: - 3개 워크플로우 모달 추가: * 폐기 모달: 사유 선택 (중복/무효신고/해당없음/스팸/직접입력) * 검토 모달: 프로젝트/카테고리/설명 수정 + 원본 정보 표시 * 상태 모달: 진행중/완료 선택 + 처리 메모 - 부적합 카드 UI 개선: * 워크플로우 액션 버튼 (폐기/검토/승인) * 읽음/안읽음 상태 표시 * 사진 첨부 여부 표시 * 클릭 가능한 제목 (상세보기) 🔌 API Integration: - 실제 백엔드 API 완전 연동: * GET /api/inbox/ - 수신함 목록 (프로젝트 필터링) * GET /api/inbox/statistics - 실시간 통계 * POST /api/inbox/{id}/dispose - 폐기 처리 * POST /api/inbox/{id}/review - 검토/수정 * POST /api/inbox/{id}/status - 상태 변경 - 에러 처리 및 사용자 피드백: * API 오류 시 적절한 메시지 표시 * 성공 시 결과 안내 및 목록 자동 새로고침 * 입력 검증 (필수값, 사용자 정의 사유 등) 🎯 Workflow Logic: - 폐기 처리: * 5가지 사유 선택 (기본값: 중복) * 사용자 정의 사유 입력 검증 * 폐기 후 폐기함으로 이동 - 검토/수정: * 원본 정보 보존 및 표시 * 프로젝트/카테고리/설명 수정 가능 * 수정 이력 자동 추적 - 상태 결정: * 진행중/완료 선택 * 처리 메모 추가 가능 * 관리함으로 자동 이동 📊 Real-time Features: - 실시간 통계 업데이트 - 읽음 상태 로컬 저장 (inbox_read_status) - 프로젝트별 필터링 - 자동 목록 새로고침 🎨 UX Improvements: - 모달 기반 워크플로우 (직관적) - 원본 정보 표시 (수정 전후 비교) - 적절한 로딩 상태 표시 - 사용자 친화적 에러 메시지 - 액션 버튼 색상 구분 (빨강/파랑/초록) Result: ✅ 수신함 워크플로우 프론트엔드 100% 완성 ✅ 백엔드 API와 완벽 연동 ✅ 실시간 데이터 동기화 ✅ 사용자 친화적 UI/UX ✅ 모든 워크플로우 액션 구현
This commit is contained in:
@@ -224,6 +224,153 @@
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<!-- 폐기 모달 -->
|
||||
<div id="disposeModal" class="fixed inset-0 bg-black bg-opacity-50 hidden z-50">
|
||||
<div class="flex items-center justify-center min-h-screen p-4">
|
||||
<div class="bg-white rounded-xl max-w-md w-full p-6">
|
||||
<div class="flex items-center justify-between mb-4">
|
||||
<h3 class="text-lg font-semibold text-gray-900">부적합 폐기</h3>
|
||||
<button onclick="closeDisposeModal()" class="text-gray-400 hover:text-gray-600">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="space-y-4">
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">폐기 사유</label>
|
||||
<select id="disposalReason" class="w-full px-3 py-2 border border-gray-300 rounded-lg" onchange="toggleCustomReason()">
|
||||
<option value="duplicate">중복 (기본)</option>
|
||||
<option value="invalid_report">잘못된 신고</option>
|
||||
<option value="not_applicable">해당 없음</option>
|
||||
<option value="spam">스팸/오류</option>
|
||||
<option value="custom">직접 입력</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div id="customReasonDiv" class="hidden">
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">사용자 정의 사유</label>
|
||||
<textarea id="customReason" rows="3" class="w-full px-3 py-2 border border-gray-300 rounded-lg"
|
||||
placeholder="폐기 사유를 입력하세요..."></textarea>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-end space-x-3">
|
||||
<button onclick="closeDisposeModal()" class="px-4 py-2 text-gray-600 hover:text-gray-800">
|
||||
취소
|
||||
</button>
|
||||
<button onclick="confirmDispose()" class="px-4 py-2 bg-red-500 text-white rounded-lg hover:bg-red-600">
|
||||
폐기
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 검토/수정 모달 -->
|
||||
<div id="reviewModal" class="fixed inset-0 bg-black bg-opacity-50 hidden z-50">
|
||||
<div class="flex items-center justify-center min-h-screen p-4">
|
||||
<div class="bg-white rounded-xl max-w-2xl w-full p-6 max-h-[90vh] overflow-y-auto">
|
||||
<div class="flex items-center justify-between mb-4">
|
||||
<h3 class="text-lg font-semibold text-gray-900">부적합 검토 및 수정</h3>
|
||||
<button onclick="closeReviewModal()" class="text-gray-400 hover:text-gray-600">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="space-y-4">
|
||||
<!-- 원본 정보 표시 -->
|
||||
<div class="bg-gray-50 p-4 rounded-lg">
|
||||
<h4 class="font-medium text-gray-700 mb-2">원본 정보</h4>
|
||||
<div id="originalInfo" class="text-sm text-gray-600">
|
||||
<!-- 원본 정보가 여기에 표시됩니다 -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 수정 폼 -->
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">프로젝트</label>
|
||||
<select id="reviewProjectId" class="w-full px-3 py-2 border border-gray-300 rounded-lg">
|
||||
<option value="">프로젝트 선택</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">카테고리</label>
|
||||
<select id="reviewCategory" class="w-full px-3 py-2 border border-gray-300 rounded-lg">
|
||||
<option value="material_missing">자재 누락</option>
|
||||
<option value="design_error">설계 오류</option>
|
||||
<option value="incoming_defect">반입 불량</option>
|
||||
<option value="inspection_miss">검사 누락</option>
|
||||
<option value="etc">기타</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">설명</label>
|
||||
<textarea id="reviewDescription" rows="4" class="w-full px-3 py-2 border border-gray-300 rounded-lg"
|
||||
placeholder="부적합 설명을 입력하세요..."></textarea>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-end space-x-3">
|
||||
<button onclick="closeReviewModal()" class="px-4 py-2 text-gray-600 hover:text-gray-800">
|
||||
취소
|
||||
</button>
|
||||
<button onclick="saveReview()" class="px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600">
|
||||
검토 완료
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 상태 결정 모달 -->
|
||||
<div id="statusModal" class="fixed inset-0 bg-black bg-opacity-50 hidden z-50">
|
||||
<div class="flex items-center justify-center min-h-screen p-4">
|
||||
<div class="bg-white rounded-xl max-w-md w-full p-6">
|
||||
<div class="flex items-center justify-between mb-4">
|
||||
<h3 class="text-lg font-semibold text-gray-900">최종 상태 결정</h3>
|
||||
<button onclick="closeStatusModal()" class="text-gray-400 hover:text-gray-600">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="space-y-4">
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">상태 선택</label>
|
||||
<div class="space-y-2">
|
||||
<label class="flex items-center">
|
||||
<input type="radio" name="finalStatus" value="in_progress" class="mr-2">
|
||||
<span class="text-sm">🔄 진행 중 (관리함으로 이동)</span>
|
||||
</label>
|
||||
<label class="flex items-center">
|
||||
<input type="radio" name="finalStatus" value="completed" class="mr-2">
|
||||
<span class="text-sm">✅ 완료됨 (관리함으로 이동)</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">처리 메모 (선택사항)</label>
|
||||
<textarea id="statusNotes" rows="3" class="w-full px-3 py-2 border border-gray-300 rounded-lg"
|
||||
placeholder="처리 내용이나 특이사항을 입력하세요..."></textarea>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-end space-x-3">
|
||||
<button onclick="closeStatusModal()" class="px-4 py-2 text-gray-600 hover:text-gray-800">
|
||||
취소
|
||||
</button>
|
||||
<button onclick="confirmStatus()" class="px-4 py-2 bg-green-500 text-white rounded-lg hover:bg-green-600">
|
||||
상태 변경
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Scripts -->
|
||||
<script src="/static/js/date-utils.js?v=20250917"></script>
|
||||
<script src="/static/js/core/permissions.js?v=20251025"></script>
|
||||
@@ -307,11 +454,19 @@
|
||||
});
|
||||
}
|
||||
|
||||
// 부적합 목록 로드
|
||||
// 수신함 부적합 목록 로드 (실제 API 연동)
|
||||
async function loadIssues() {
|
||||
showLoading(true);
|
||||
try {
|
||||
const response = await fetch('/api/issues/', {
|
||||
const projectId = document.getElementById('projectFilter').value;
|
||||
let url = '/api/inbox/';
|
||||
|
||||
// 프로젝트 필터 적용
|
||||
if (projectId) {
|
||||
url += `?project_id=${projectId}`;
|
||||
}
|
||||
|
||||
const response = await fetch(url, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${localStorage.getItem('access_token')}`,
|
||||
'Content-Type': 'application/json'
|
||||
@@ -322,19 +477,19 @@
|
||||
issues = await response.json();
|
||||
|
||||
// 읽음 상태 로드 (localStorage에서)
|
||||
const savedReadStatus = localStorage.getItem('issues_read_status');
|
||||
const savedReadStatus = localStorage.getItem('inbox_read_status');
|
||||
if (savedReadStatus) {
|
||||
readStatus = new Set(JSON.parse(savedReadStatus));
|
||||
}
|
||||
|
||||
filterIssues();
|
||||
updateStatistics();
|
||||
await loadStatistics();
|
||||
} else {
|
||||
throw new Error('부적합 목록을 불러올 수 없습니다.');
|
||||
throw new Error('수신함 목록을 불러올 수 없습니다.');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('부적합 로드 실패:', error);
|
||||
showError('부적합 목록을 불러오는데 실패했습니다.');
|
||||
console.error('수신함 로드 실패:', error);
|
||||
showError('수신함 목록을 불러오는데 실패했습니다.');
|
||||
} finally {
|
||||
showLoading(false);
|
||||
}
|
||||
@@ -414,29 +569,45 @@
|
||||
const timeAgo = getTimeAgo(new Date(issue.created_at));
|
||||
|
||||
return `
|
||||
<div class="issue-card p-6 hover:bg-gray-50 cursor-pointer ${isUnread ? 'unread' : ''}"
|
||||
onclick="viewIssueDetail(${issue.id})">
|
||||
<div class="issue-card p-6 hover:bg-gray-50 ${isUnread ? 'unread' : ''}"
|
||||
data-issue-id="${issue.id}">
|
||||
<div class="flex items-start justify-between">
|
||||
<div class="flex-1">
|
||||
<div class="flex items-center space-x-3 mb-2">
|
||||
${isUnread ? '<div class="w-2 h-2 bg-blue-500 rounded-full"></div>' : '<div class="w-2 h-2"></div>'}
|
||||
<span class="badge badge-${getStatusBadgeClass(issue.status)}">${getStatusText(issue.status)}</span>
|
||||
<span class="badge badge-new">검토 대기</span>
|
||||
${project ? `<span class="text-sm text-gray-500">${project.name}</span>` : ''}
|
||||
<span class="text-sm text-gray-400">${timeAgo}</span>
|
||||
</div>
|
||||
|
||||
<h3 class="text-lg font-medium text-gray-900 mb-2">${issue.description}</h3>
|
||||
<h3 class="text-lg font-medium text-gray-900 mb-2 cursor-pointer" onclick="viewIssueDetail(${issue.id})">${issue.description}</h3>
|
||||
|
||||
<div class="flex items-center text-sm text-gray-500 space-x-4">
|
||||
<div class="flex items-center text-sm text-gray-500 space-x-4 mb-3">
|
||||
<span><i class="fas fa-user mr-1"></i>${issue.reporter?.username || '알 수 없음'}</span>
|
||||
<span><i class="fas fa-calendar mr-1"></i>${createdDate}</span>
|
||||
${issue.category ? `<span><i class="fas fa-tag mr-1"></i>${getCategoryText(issue.category)}</span>` : ''}
|
||||
${issue.photo_path ? '<span><i class="fas fa-camera mr-1"></i>사진 첨부</span>' : ''}
|
||||
</div>
|
||||
|
||||
<!-- 워크플로우 액션 버튼들 -->
|
||||
<div class="flex items-center space-x-2 mt-3">
|
||||
<button onclick="openDisposeModal(${issue.id})"
|
||||
class="px-3 py-1 bg-red-500 text-white text-sm rounded hover:bg-red-600 transition-colors">
|
||||
<i class="fas fa-trash mr-1"></i>폐기
|
||||
</button>
|
||||
<button onclick="openReviewModal(${issue.id})"
|
||||
class="px-3 py-1 bg-blue-500 text-white text-sm rounded hover:bg-blue-600 transition-colors">
|
||||
<i class="fas fa-edit mr-1"></i>검토
|
||||
</button>
|
||||
<button onclick="openStatusModal(${issue.id})"
|
||||
class="px-3 py-1 bg-green-500 text-white text-sm rounded hover:bg-green-600 transition-colors">
|
||||
<i class="fas fa-check mr-1"></i>승인
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center space-x-2 ml-4">
|
||||
${issue.photo_path ? '<i class="fas fa-camera text-gray-400"></i>' : ''}
|
||||
<button onclick="event.stopPropagation(); markAsRead(${issue.id})"
|
||||
<button onclick="markAsRead(${issue.id})"
|
||||
class="p-2 text-gray-400 hover:text-blue-600 transition-colors"
|
||||
title="${isUnread ? '읽음 처리' : '읽음'}">
|
||||
<i class="fas fa-${isUnread ? 'envelope' : 'envelope-open'}"></i>
|
||||
@@ -448,32 +619,41 @@
|
||||
}).join('');
|
||||
}
|
||||
|
||||
// 통계 업데이트
|
||||
function updateStatistics() {
|
||||
const newIssues = issues.filter(issue => issue.status === 'new').length;
|
||||
const pendingIssues = issues.filter(issue => ['pending', 'processing'].includes(issue.status)).length;
|
||||
const todayProcessed = issues.filter(issue => {
|
||||
const today = new Date().toDateString();
|
||||
return issue.updated_at && new Date(issue.updated_at).toDateString() === today;
|
||||
}).length;
|
||||
// 수신함 통계 로드 (실제 API 연동)
|
||||
async function loadStatistics() {
|
||||
try {
|
||||
const response = await fetch('/api/inbox/statistics', {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${localStorage.getItem('access_token')}`,
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById('newIssuesCount').textContent = newIssues;
|
||||
document.getElementById('pendingIssuesCount').textContent = pendingIssues;
|
||||
document.getElementById('todayProcessedCount').textContent = todayProcessed;
|
||||
document.getElementById('totalIssuesCount').textContent = issues.length;
|
||||
if (response.ok) {
|
||||
const stats = await response.json();
|
||||
document.getElementById('newIssuesCount').textContent = stats.pending_review || 0;
|
||||
document.getElementById('pendingIssuesCount').textContent = stats.total_in_management || 0;
|
||||
document.getElementById('todayProcessedCount').textContent = stats.today_processed || 0;
|
||||
document.getElementById('totalIssuesCount').textContent = stats.total_issues || 0;
|
||||
} else {
|
||||
console.error('통계 로드 실패');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('통계 로드 오류:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// 읽음 처리
|
||||
function markAsRead(issueId) {
|
||||
readStatus.add(issueId);
|
||||
localStorage.setItem('issues_read_status', JSON.stringify([...readStatus]));
|
||||
localStorage.setItem('inbox_read_status', JSON.stringify([...readStatus]));
|
||||
displayIssues();
|
||||
}
|
||||
|
||||
// 모두 읽음 처리
|
||||
function markAllAsRead() {
|
||||
filteredIssues.forEach(issue => readStatus.add(issue.id));
|
||||
localStorage.setItem('issues_read_status', JSON.stringify([...readStatus]));
|
||||
localStorage.setItem('inbox_read_status', JSON.stringify([...readStatus]));
|
||||
displayIssues();
|
||||
}
|
||||
|
||||
@@ -485,10 +665,229 @@
|
||||
// 부적합 상세 보기
|
||||
function viewIssueDetail(issueId) {
|
||||
markAsRead(issueId);
|
||||
// 상세 페이지로 이동 또는 모달 표시
|
||||
window.location.href = `/issue-view.html#detail-${issueId}`;
|
||||
}
|
||||
|
||||
// ===== 워크플로우 모달 관련 함수들 =====
|
||||
let currentIssueId = null;
|
||||
|
||||
// 폐기 모달 열기
|
||||
function openDisposeModal(issueId) {
|
||||
currentIssueId = issueId;
|
||||
document.getElementById('disposalReason').value = 'duplicate';
|
||||
document.getElementById('customReason').value = '';
|
||||
document.getElementById('customReasonDiv').classList.add('hidden');
|
||||
document.getElementById('disposeModal').classList.remove('hidden');
|
||||
}
|
||||
|
||||
// 폐기 모달 닫기
|
||||
function closeDisposeModal() {
|
||||
currentIssueId = null;
|
||||
document.getElementById('disposeModal').classList.add('hidden');
|
||||
}
|
||||
|
||||
// 사용자 정의 사유 토글
|
||||
function toggleCustomReason() {
|
||||
const reason = document.getElementById('disposalReason').value;
|
||||
const customDiv = document.getElementById('customReasonDiv');
|
||||
|
||||
if (reason === 'custom') {
|
||||
customDiv.classList.remove('hidden');
|
||||
} else {
|
||||
customDiv.classList.add('hidden');
|
||||
}
|
||||
}
|
||||
|
||||
// 폐기 확인
|
||||
async function confirmDispose() {
|
||||
if (!currentIssueId) return;
|
||||
|
||||
const disposalReason = document.getElementById('disposalReason').value;
|
||||
const customReason = document.getElementById('customReason').value;
|
||||
|
||||
// 사용자 정의 사유 검증
|
||||
if (disposalReason === 'custom' && !customReason.trim()) {
|
||||
alert('사용자 정의 폐기 사유를 입력해주세요.');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch(`/api/inbox/${currentIssueId}/dispose`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': `Bearer ${localStorage.getItem('access_token')}`,
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
disposal_reason: disposalReason,
|
||||
custom_disposal_reason: disposalReason === 'custom' ? customReason : null
|
||||
})
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
const result = await response.json();
|
||||
alert(`부적합이 성공적으로 폐기되었습니다.\n사유: ${getDisposalReasonText(disposalReason)}`);
|
||||
closeDisposeModal();
|
||||
await loadIssues(); // 목록 새로고침
|
||||
} else {
|
||||
const error = await response.json();
|
||||
throw new Error(error.detail || '폐기 처리에 실패했습니다.');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('폐기 처리 오류:', error);
|
||||
alert('폐기 처리 중 오류가 발생했습니다: ' + error.message);
|
||||
}
|
||||
}
|
||||
|
||||
// 검토 모달 열기
|
||||
async function openReviewModal(issueId) {
|
||||
currentIssueId = issueId;
|
||||
|
||||
// 현재 부적합 정보 찾기
|
||||
const issue = issues.find(i => i.id === issueId);
|
||||
if (!issue) return;
|
||||
|
||||
// 원본 정보 표시
|
||||
const originalInfo = document.getElementById('originalInfo');
|
||||
const project = projects.find(p => p.id === issue.project_id);
|
||||
originalInfo.innerHTML = `
|
||||
<div class="space-y-2">
|
||||
<div><strong>프로젝트:</strong> ${project ? project.name : '미지정'}</div>
|
||||
<div><strong>카테고리:</strong> ${getCategoryText(issue.category)}</div>
|
||||
<div><strong>설명:</strong> ${issue.description}</div>
|
||||
<div><strong>등록자:</strong> ${issue.reporter?.username || '알 수 없음'}</div>
|
||||
<div><strong>등록일:</strong> ${new Date(issue.report_date).toLocaleDateString('ko-KR')}</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
// 프로젝트 옵션 업데이트
|
||||
const reviewProjectSelect = document.getElementById('reviewProjectId');
|
||||
reviewProjectSelect.innerHTML = '<option value="">프로젝트 선택</option>';
|
||||
projects.forEach(project => {
|
||||
const option = document.createElement('option');
|
||||
option.value = project.id;
|
||||
option.textContent = project.name;
|
||||
if (project.id === issue.project_id) {
|
||||
option.selected = true;
|
||||
}
|
||||
reviewProjectSelect.appendChild(option);
|
||||
});
|
||||
|
||||
// 현재 값들로 폼 초기화
|
||||
document.getElementById('reviewCategory').value = issue.category;
|
||||
document.getElementById('reviewDescription').value = issue.description;
|
||||
|
||||
document.getElementById('reviewModal').classList.remove('hidden');
|
||||
}
|
||||
|
||||
// 검토 모달 닫기
|
||||
function closeReviewModal() {
|
||||
currentIssueId = null;
|
||||
document.getElementById('reviewModal').classList.add('hidden');
|
||||
}
|
||||
|
||||
// 검토 저장
|
||||
async function saveReview() {
|
||||
if (!currentIssueId) return;
|
||||
|
||||
const projectId = document.getElementById('reviewProjectId').value;
|
||||
const category = document.getElementById('reviewCategory').value;
|
||||
const description = document.getElementById('reviewDescription').value.trim();
|
||||
|
||||
if (!description) {
|
||||
alert('설명을 입력해주세요.');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch(`/api/inbox/${currentIssueId}/review`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': `Bearer ${localStorage.getItem('access_token')}`,
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
project_id: projectId ? parseInt(projectId) : null,
|
||||
category: category,
|
||||
description: description
|
||||
})
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
const result = await response.json();
|
||||
alert(`검토가 완료되었습니다.\n수정된 항목: ${result.modifications_count}개`);
|
||||
closeReviewModal();
|
||||
await loadIssues(); // 목록 새로고침
|
||||
} else {
|
||||
const error = await response.json();
|
||||
throw new Error(error.detail || '검토 처리에 실패했습니다.');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('검토 처리 오류:', error);
|
||||
alert('검토 처리 중 오류가 발생했습니다: ' + error.message);
|
||||
}
|
||||
}
|
||||
|
||||
// 상태 모달 열기
|
||||
function openStatusModal(issueId) {
|
||||
currentIssueId = issueId;
|
||||
|
||||
// 라디오 버튼 초기화
|
||||
document.querySelectorAll('input[name="finalStatus"]').forEach(radio => {
|
||||
radio.checked = false;
|
||||
});
|
||||
document.getElementById('statusNotes').value = '';
|
||||
|
||||
document.getElementById('statusModal').classList.remove('hidden');
|
||||
}
|
||||
|
||||
// 상태 모달 닫기
|
||||
function closeStatusModal() {
|
||||
currentIssueId = null;
|
||||
document.getElementById('statusModal').classList.add('hidden');
|
||||
}
|
||||
|
||||
// 상태 변경 확인
|
||||
async function confirmStatus() {
|
||||
if (!currentIssueId) return;
|
||||
|
||||
const selectedStatus = document.querySelector('input[name="finalStatus"]:checked');
|
||||
if (!selectedStatus) {
|
||||
alert('상태를 선택해주세요.');
|
||||
return;
|
||||
}
|
||||
|
||||
const reviewStatus = selectedStatus.value;
|
||||
const notes = document.getElementById('statusNotes').value.trim();
|
||||
|
||||
try {
|
||||
const response = await fetch(`/api/inbox/${currentIssueId}/status`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': `Bearer ${localStorage.getItem('access_token')}`,
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
review_status: reviewStatus,
|
||||
notes: notes || null
|
||||
})
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
const result = await response.json();
|
||||
alert(`상태가 성공적으로 변경되었습니다.\n${result.destination}으로 이동됩니다.`);
|
||||
closeStatusModal();
|
||||
await loadIssues(); // 목록 새로고침
|
||||
} else {
|
||||
const error = await response.json();
|
||||
throw new Error(error.detail || '상태 변경에 실패했습니다.');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('상태 변경 오류:', error);
|
||||
alert('상태 변경 중 오류가 발생했습니다: ' + error.message);
|
||||
}
|
||||
}
|
||||
|
||||
// 유틸리티 함수들
|
||||
function getStatusBadgeClass(status) {
|
||||
const statusMap = {
|
||||
@@ -521,6 +920,17 @@
|
||||
return categoryMap[category] || category;
|
||||
}
|
||||
|
||||
function getDisposalReasonText(reason) {
|
||||
const reasonMap = {
|
||||
'duplicate': '중복',
|
||||
'invalid_report': '잘못된 신고',
|
||||
'not_applicable': '해당 없음',
|
||||
'spam': '스팸/오류',
|
||||
'custom': '직접 입력'
|
||||
};
|
||||
return reasonMap[reason] || reason;
|
||||
}
|
||||
|
||||
function getTimeAgo(date) {
|
||||
const now = new Date();
|
||||
const diffMs = now - date;
|
||||
|
||||
Reference in New Issue
Block a user