feat: 5장 사진 지원 및 엑셀 내보내기 UI 개선
- 신고 및 완료 사진 5장 지원 (photo_path3, photo_path4, photo_path5 추가) - 엑셀 일일 리포트 개선: - 사진 5장 모두 한 행에 일렬 배치 (A, C, E, G, I 열) - 상태별 색상 구분 (지연중: 빨강, 진행중: 노랑, 완료: 진한 초록) - 우선순위 기반 정렬 (지연중 → 진행중 → 완료됨) - 프로젝트 현황 통계 박스 UI 개선 (색상 구분) - 프론트엔드 모든 페이지 5장 사진 표시 (flex-wrap 레이아웃) - 관리함, 수신함, 현황판, 신고내용 확인 페이지 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -271,17 +271,17 @@
|
||||
</div>
|
||||
|
||||
<form id="reportForm" class="space-y-4">
|
||||
<!-- 사진 업로드 (선택사항, 최대 2장) -->
|
||||
<!-- 사진 업로드 (선택사항, 최대 5장) -->
|
||||
<div class="space-y-3">
|
||||
<div class="flex items-center justify-between">
|
||||
<label class="text-sm font-medium text-gray-700">
|
||||
📸 사진 첨부
|
||||
</label>
|
||||
<span class="text-xs text-gray-500 bg-gray-100 px-2 py-1 rounded-full">
|
||||
선택사항 • 최대 2장
|
||||
선택사항 • 최대 5장
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- 사진 미리보기 영역 -->
|
||||
<div id="photoPreviewContainer" class="grid grid-cols-2 gap-2 mb-3" style="display: none;">
|
||||
<!-- 첫 번째 사진 -->
|
||||
@@ -298,6 +298,27 @@
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
<!-- 세 번째 사진 -->
|
||||
<div id="photo3Container" class="relative hidden">
|
||||
<img id="previewImg3" class="w-full h-24 object-cover rounded-xl border-2 border-gray-200">
|
||||
<button type="button" onclick="removePhoto(2)" class="absolute -top-1 -right-1 w-6 h-6 bg-red-500 text-white rounded-full text-xs hover:bg-red-600 flex items-center justify-center shadow-lg">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
<!-- 네 번째 사진 -->
|
||||
<div id="photo4Container" class="relative hidden">
|
||||
<img id="previewImg4" class="w-full h-24 object-cover rounded-xl border-2 border-gray-200">
|
||||
<button type="button" onclick="removePhoto(3)" class="absolute -top-1 -right-1 w-6 h-6 bg-red-500 text-white rounded-full text-xs hover:bg-red-600 flex items-center justify-center shadow-lg">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
<!-- 다섯 번째 사진 -->
|
||||
<div id="photo5Container" class="relative hidden">
|
||||
<img id="previewImg5" class="w-full h-24 object-cover rounded-xl border-2 border-gray-200">
|
||||
<button type="button" onclick="removePhoto(4)" class="absolute -top-1 -right-1 w-6 h-6 bg-red-500 text-white rounded-full text-xs hover:bg-red-600 flex items-center justify-center shadow-lg">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 업로드 버튼들 -->
|
||||
@@ -329,7 +350,7 @@
|
||||
|
||||
<!-- 현재 상태 표시 -->
|
||||
<div class="text-center mt-2">
|
||||
<p class="text-sm text-gray-500" id="photoUploadText">사진 추가 (0/2)</p>
|
||||
<p class="text-sm text-gray-500" id="photoUploadText">사진 추가 (0/5)</p>
|
||||
</div>
|
||||
|
||||
<!-- 숨겨진 입력 필드들 -->
|
||||
@@ -880,23 +901,23 @@
|
||||
// 사진 업로드 처리 함수
|
||||
async function handlePhotoUpload(files) {
|
||||
const filesArray = Array.from(files);
|
||||
|
||||
|
||||
// 현재 사진 개수 확인
|
||||
if (currentPhotos.length >= 2) {
|
||||
alert('최대 2장까지 업로드 가능합니다.');
|
||||
if (currentPhotos.length >= 5) {
|
||||
alert('최대 5장까지 업로드 가능합니다.');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// 추가 가능한 개수만큼만 처리
|
||||
const availableSlots = 2 - currentPhotos.length;
|
||||
const availableSlots = 5 - currentPhotos.length;
|
||||
const filesToProcess = filesArray.slice(0, availableSlots);
|
||||
|
||||
|
||||
// 로딩 표시
|
||||
showUploadProgress(true);
|
||||
|
||||
|
||||
try {
|
||||
for (const file of filesToProcess) {
|
||||
if (currentPhotos.length >= 2) break;
|
||||
if (currentPhotos.length >= 5) break;
|
||||
|
||||
// 원본 파일 크기 확인
|
||||
const originalSize = file.size;
|
||||
@@ -923,18 +944,18 @@
|
||||
const cameraBtn = document.getElementById('cameraUpload');
|
||||
const galleryBtn = document.getElementById('galleryUpload');
|
||||
const uploadText = document.getElementById('photoUploadText');
|
||||
|
||||
|
||||
if (show) {
|
||||
cameraBtn.classList.add('opacity-50', 'cursor-not-allowed');
|
||||
galleryBtn.classList.add('opacity-50', 'cursor-not-allowed');
|
||||
uploadText.innerHTML = '<i class="fas fa-spinner fa-spin mr-2"></i>이미지 처리 중...';
|
||||
uploadText.classList.add('text-blue-600');
|
||||
} else {
|
||||
if (currentPhotos.length < 2) {
|
||||
if (currentPhotos.length < 5) {
|
||||
cameraBtn.classList.remove('opacity-50', 'cursor-not-allowed');
|
||||
galleryBtn.classList.remove('opacity-50', 'cursor-not-allowed');
|
||||
}
|
||||
uploadText.textContent = `사진 추가 (${currentPhotos.length}/2)`;
|
||||
uploadText.textContent = `사진 추가 (${currentPhotos.length}/5)`;
|
||||
uploadText.classList.remove('text-blue-600');
|
||||
}
|
||||
}
|
||||
@@ -964,43 +985,37 @@
|
||||
// 사진 미리보기 업데이트
|
||||
function updatePhotoPreview() {
|
||||
const container = document.getElementById('photoPreviewContainer');
|
||||
const photo1Container = document.getElementById('photo1Container');
|
||||
const photo2Container = document.getElementById('photo2Container');
|
||||
const uploadText = document.getElementById('photoUploadText');
|
||||
const cameraUpload = document.getElementById('cameraUpload');
|
||||
const galleryUpload = document.getElementById('galleryUpload');
|
||||
|
||||
|
||||
// 텍스트 업데이트
|
||||
uploadText.textContent = `사진 추가 (${currentPhotos.length}/2)`;
|
||||
|
||||
// 첫 번째 사진
|
||||
if (currentPhotos[0]) {
|
||||
document.getElementById('previewImg1').src = currentPhotos[0];
|
||||
photo1Container.classList.remove('hidden');
|
||||
container.style.display = 'grid';
|
||||
} else {
|
||||
photo1Container.classList.add('hidden');
|
||||
uploadText.textContent = `사진 추가 (${currentPhotos.length}/5)`;
|
||||
|
||||
// 모든 사진 미리보기 업데이트 (최대 5장)
|
||||
for (let i = 0; i < 5; i++) {
|
||||
const photoContainer = document.getElementById(`photo${i + 1}Container`);
|
||||
const previewImg = document.getElementById(`previewImg${i + 1}`);
|
||||
|
||||
if (currentPhotos[i]) {
|
||||
previewImg.src = currentPhotos[i];
|
||||
photoContainer.classList.remove('hidden');
|
||||
container.style.display = 'grid';
|
||||
} else {
|
||||
photoContainer.classList.add('hidden');
|
||||
}
|
||||
}
|
||||
|
||||
// 두 번째 사진
|
||||
if (currentPhotos[1]) {
|
||||
document.getElementById('previewImg2').src = currentPhotos[1];
|
||||
photo2Container.classList.remove('hidden');
|
||||
container.style.display = 'grid';
|
||||
} else {
|
||||
photo2Container.classList.add('hidden');
|
||||
}
|
||||
|
||||
|
||||
// 미리보기 컨테이너 표시/숨김
|
||||
if (currentPhotos.length === 0) {
|
||||
container.style.display = 'none';
|
||||
}
|
||||
|
||||
// 2장이 모두 업로드되면 업로드 버튼 스타일 변경
|
||||
if (currentPhotos.length >= 2) {
|
||||
|
||||
// 5장이 모두 업로드되면 업로드 버튼 스타일 변경
|
||||
if (currentPhotos.length >= 5) {
|
||||
cameraUpload.classList.add('opacity-50', 'cursor-not-allowed');
|
||||
galleryUpload.classList.add('opacity-50', 'cursor-not-allowed');
|
||||
uploadText.textContent = '최대 2장 업로드 완료';
|
||||
uploadText.textContent = '최대 5장 업로드 완료';
|
||||
uploadText.classList.add('text-green-600', 'font-medium');
|
||||
} else {
|
||||
cameraUpload.classList.remove('opacity-50', 'cursor-not-allowed');
|
||||
|
||||
@@ -710,27 +710,31 @@
|
||||
incoming_defect: '입고자재 불량',
|
||||
inspection_miss: '검사미스'
|
||||
};
|
||||
|
||||
|
||||
const categoryColors = {
|
||||
material_missing: 'bg-yellow-100 text-yellow-700 border-yellow-300',
|
||||
design_error: 'bg-blue-100 text-blue-700 border-blue-300',
|
||||
incoming_defect: 'bg-red-100 text-red-700 border-red-300',
|
||||
inspection_miss: 'bg-purple-100 text-purple-700 border-purple-300'
|
||||
};
|
||||
|
||||
|
||||
const div = document.createElement('div');
|
||||
// 검토 완료 상태에 따른 스타일링
|
||||
const baseClasses = 'rounded-lg transition-colors border-l-4 mb-4';
|
||||
const statusClasses = isCompleted
|
||||
? 'bg-gray-100 opacity-75'
|
||||
const statusClasses = isCompleted
|
||||
? 'bg-gray-100 opacity-75'
|
||||
: 'bg-gray-50 hover:bg-gray-100';
|
||||
const borderColor = categoryColors[issue.category]?.split(' ')[2] || 'border-gray-300';
|
||||
div.className = `${baseClasses} ${statusClasses} ${borderColor}`;
|
||||
|
||||
|
||||
const dateStr = DateUtils.formatKST(issue.report_date, true);
|
||||
const relativeTime = DateUtils.getRelativeTime(issue.report_date);
|
||||
const projectInfo = getProjectInfo(issue.project_id || issue.projectId);
|
||||
|
||||
|
||||
// 수정/삭제 권한 확인 (본인이 등록한 부적합만)
|
||||
const canEdit = issue.reporter_id === currentUser.id;
|
||||
const canDelete = issue.reporter_id === currentUser.id || currentUser.role === 'admin';
|
||||
|
||||
div.innerHTML = `
|
||||
<!-- 프로젝트 정보 및 상태 (오른쪽 상단) -->
|
||||
<div class="flex justify-between items-start p-2 pb-0">
|
||||
@@ -741,49 +745,77 @@
|
||||
<i class="fas fa-folder-open mr-1"></i>${projectInfo}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- 기존 내용 -->
|
||||
<div class="flex gap-3 p-3 pt-1">
|
||||
<!-- 사진들 -->
|
||||
<div class="flex gap-1 flex-shrink-0">
|
||||
${issue.photo_path ?
|
||||
`<img src="${issue.photo_path}" class="w-20 h-20 object-cover rounded shadow-sm cursor-pointer" onclick="showImageModal('${issue.photo_path}')">` : ''
|
||||
}
|
||||
${issue.photo_path2 ?
|
||||
`<img src="${issue.photo_path2}" class="w-20 h-20 object-cover rounded shadow-sm cursor-pointer" onclick="showImageModal('${issue.photo_path2}')">` : ''
|
||||
}
|
||||
${!issue.photo_path && !issue.photo_path2 ?
|
||||
`<div class="w-20 h-20 bg-gray-200 rounded flex items-center justify-center">
|
||||
<i class="fas fa-image text-gray-400"></i>
|
||||
</div>` : ''
|
||||
}
|
||||
<div class="flex gap-1 flex-shrink-0 flex-wrap max-w-md">
|
||||
${(() => {
|
||||
const photos = [
|
||||
issue.photo_path,
|
||||
issue.photo_path2,
|
||||
issue.photo_path3,
|
||||
issue.photo_path4,
|
||||
issue.photo_path5
|
||||
].filter(p => p);
|
||||
|
||||
if (photos.length === 0) {
|
||||
return `
|
||||
<div class="w-20 h-20 bg-gray-200 rounded flex items-center justify-center">
|
||||
<i class="fas fa-image text-gray-400"></i>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
return photos.map(path => `
|
||||
<img src="${path}" class="w-20 h-20 object-cover rounded shadow-sm cursor-pointer" onclick="showImageModal('${path}')">
|
||||
`).join('');
|
||||
})()}
|
||||
</div>
|
||||
|
||||
|
||||
<!-- 내용 -->
|
||||
<div class="flex-1 min-w-0">
|
||||
<div class="flex items-start justify-between mb-2">
|
||||
<span class="px-2 py-1 rounded-full text-xs font-medium ${categoryColors[issue.category] || 'bg-gray-100 text-gray-700'}">
|
||||
${categoryNames[issue.category] || issue.category}
|
||||
</span>
|
||||
${issue.work_hours ?
|
||||
${issue.work_hours ?
|
||||
`<span class="text-sm text-green-600 font-medium">
|
||||
<i class="fas fa-clock mr-1"></i>${issue.work_hours}시간
|
||||
</span>` :
|
||||
</span>` :
|
||||
'<span class="text-sm text-gray-400">시간 미입력</span>'
|
||||
}
|
||||
</div>
|
||||
|
||||
|
||||
<p class="text-gray-800 mb-2 line-clamp-2">${issue.description}</p>
|
||||
|
||||
<div class="flex items-center gap-4 text-sm text-gray-500">
|
||||
<span><i class="fas fa-user mr-1"></i>${issue.reporter?.full_name || issue.reporter?.username || '알 수 없음'}</span>
|
||||
<span><i class="fas fa-calendar mr-1"></i>${dateStr}</span>
|
||||
<span class="text-xs text-gray-400">${relativeTime}</span>
|
||||
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="flex items-center gap-4 text-sm text-gray-500">
|
||||
<span><i class="fas fa-user mr-1"></i>${issue.reporter?.full_name || issue.reporter?.username || '알 수 없음'}</span>
|
||||
<span><i class="fas fa-calendar mr-1"></i>${dateStr}</span>
|
||||
<span class="text-xs text-gray-400">${relativeTime}</span>
|
||||
</div>
|
||||
|
||||
<!-- 수정/삭제 버튼 -->
|
||||
${(canEdit || canDelete) ? `
|
||||
<div class="flex gap-2">
|
||||
${canEdit ? `
|
||||
<button onclick='showEditModal(${JSON.stringify(issue).replace(/'/g, "'")})' class="px-3 py-1 text-xs bg-blue-500 text-white rounded hover:bg-blue-600 transition-colors">
|
||||
<i class="fas fa-edit mr-1"></i>수정
|
||||
</button>
|
||||
` : ''}
|
||||
${canDelete ? `
|
||||
<button onclick="confirmDelete(${issue.id})" class="px-3 py-1 text-xs bg-red-500 text-white rounded hover:bg-red-600 transition-colors">
|
||||
<i class="fas fa-trash mr-1"></i>삭제
|
||||
</button>
|
||||
` : ''}
|
||||
</div>
|
||||
` : ''}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
|
||||
return div;
|
||||
}
|
||||
|
||||
@@ -920,7 +952,151 @@
|
||||
localStorage.removeItem('currentUser');
|
||||
window.location.href = 'index.html';
|
||||
}
|
||||
|
||||
|
||||
// 수정 모달 표시
|
||||
function showEditModal(issue) {
|
||||
const categoryNames = {
|
||||
material_missing: '자재누락',
|
||||
design_error: '설계미스',
|
||||
incoming_defect: '입고자재 불량',
|
||||
inspection_miss: '검사미스'
|
||||
};
|
||||
|
||||
const modal = document.createElement('div');
|
||||
modal.className = 'fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4';
|
||||
modal.onclick = (e) => {
|
||||
if (e.target === modal) modal.remove();
|
||||
};
|
||||
|
||||
modal.innerHTML = `
|
||||
<div class="bg-white rounded-lg p-6 w-full max-w-2xl max-h-[90vh] overflow-y-auto">
|
||||
<div class="flex justify-between items-center mb-4">
|
||||
<h3 class="text-lg font-semibold">부적합 수정</h3>
|
||||
<button onclick="this.closest('.fixed').remove()" class="text-gray-400 hover:text-gray-600">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<form id="editIssueForm" class="space-y-4">
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">카테고리</label>
|
||||
<select id="editCategory" class="w-full px-3 py-2 border border-gray-300 rounded-lg" required>
|
||||
<option value="material_missing" ${issue.category === 'material_missing' ? 'selected' : ''}>자재누락</option>
|
||||
<option value="design_error" ${issue.category === 'design_error' ? 'selected' : ''}>설계미스</option>
|
||||
<option value="incoming_defect" ${issue.category === 'incoming_defect' ? 'selected' : ''}>입고자재 불량</option>
|
||||
<option value="inspection_miss" ${issue.category === 'inspection_miss' ? 'selected' : ''}>검사미스</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">프로젝트</label>
|
||||
<select id="editProject" class="w-full px-3 py-2 border border-gray-300 rounded-lg" required>
|
||||
${projects.map(p => `
|
||||
<option value="${p.id}" ${p.id === issue.project_id ? 'selected' : ''}>
|
||||
${p.job_no} / ${p.project_name}
|
||||
</option>
|
||||
`).join('')}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">내용</label>
|
||||
<textarea id="editDescription" class="w-full px-3 py-2 border border-gray-300 rounded-lg" rows="4" required>${issue.description || ''}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="flex gap-2 pt-4">
|
||||
<button type="button" onclick="this.closest('.fixed').remove()"
|
||||
class="flex-1 px-4 py-2 border border-gray-300 rounded-lg hover:bg-gray-50">
|
||||
취소
|
||||
</button>
|
||||
<button type="submit" class="flex-1 px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600">
|
||||
수정
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
`;
|
||||
|
||||
document.body.appendChild(modal);
|
||||
|
||||
// 폼 제출 이벤트 처리
|
||||
document.getElementById('editIssueForm').addEventListener('submit', async (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
const updateData = {
|
||||
category: document.getElementById('editCategory').value,
|
||||
description: document.getElementById('editDescription').value,
|
||||
project_id: parseInt(document.getElementById('editProject').value)
|
||||
};
|
||||
|
||||
try {
|
||||
await IssuesAPI.update(issue.id, updateData);
|
||||
alert('수정되었습니다.');
|
||||
modal.remove();
|
||||
// 목록 새로고침
|
||||
await loadIssues();
|
||||
} catch (error) {
|
||||
console.error('수정 실패:', error);
|
||||
alert('수정에 실패했습니다: ' + error.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 삭제 확인 다이얼로그
|
||||
function confirmDelete(issueId) {
|
||||
const modal = document.createElement('div');
|
||||
modal.className = 'fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50';
|
||||
modal.onclick = (e) => {
|
||||
if (e.target === modal) modal.remove();
|
||||
};
|
||||
|
||||
modal.innerHTML = `
|
||||
<div class="bg-white rounded-lg p-6 w-96 max-w-md mx-4">
|
||||
<div class="text-center mb-4">
|
||||
<div class="mx-auto flex items-center justify-center h-12 w-12 rounded-full bg-red-100 mb-4">
|
||||
<i class="fas fa-exclamation-triangle text-red-600 text-xl"></i>
|
||||
</div>
|
||||
<h3 class="text-lg font-semibold mb-2">부적합 삭제</h3>
|
||||
<p class="text-sm text-gray-600">
|
||||
이 부적합 사항을 삭제하시겠습니까?<br>
|
||||
삭제된 데이터는 로그로 보관되지만 복구할 수 없습니다.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="flex gap-2">
|
||||
<button onclick="this.closest('.fixed').remove()"
|
||||
class="flex-1 px-4 py-2 border border-gray-300 rounded-lg hover:bg-gray-50">
|
||||
취소
|
||||
</button>
|
||||
<button onclick="handleDelete(${issueId})"
|
||||
class="flex-1 px-4 py-2 bg-red-500 text-white rounded-lg hover:bg-red-600">
|
||||
삭제
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
document.body.appendChild(modal);
|
||||
}
|
||||
|
||||
// 삭제 처리
|
||||
async function handleDelete(issueId) {
|
||||
try {
|
||||
await IssuesAPI.delete(issueId);
|
||||
alert('삭제되었습니다.');
|
||||
|
||||
// 모달 닫기
|
||||
const modal = document.querySelector('.fixed');
|
||||
if (modal) modal.remove();
|
||||
|
||||
// 목록 새로고침
|
||||
await loadIssues();
|
||||
} catch (error) {
|
||||
console.error('삭제 실패:', error);
|
||||
alert('삭제에 실패했습니다: ' + error.message);
|
||||
}
|
||||
}
|
||||
|
||||
// 네비게이션은 공통 헤더에서 처리됨
|
||||
|
||||
// API 스크립트 동적 로딩
|
||||
|
||||
@@ -977,33 +977,34 @@
|
||||
<i class="fas fa-camera text-blue-500 mr-2"></i>
|
||||
<span class="text-gray-600 font-medium text-sm">이미지</span>
|
||||
</div>
|
||||
<div class="flex gap-3 justify-center">
|
||||
${issue.photo_path ? `
|
||||
<div class="relative w-40 h-40 rounded-lg border-2 border-blue-200 overflow-hidden cursor-pointer hover:shadow-lg hover:scale-105 transition-all duration-200" onclick="openPhotoModal('${issue.photo_path}')">
|
||||
<img src="${issue.photo_path}" alt="부적합 사진 1" class="w-full h-full object-cover" onerror="this.style.display='none'; this.nextElementSibling.style.display='flex';">
|
||||
<div class="absolute inset-0 bg-gradient-to-br from-blue-50 to-blue-100 flex items-center justify-center" style="display: none;">
|
||||
<i class="fas fa-image text-blue-500 text-2xl"></i>
|
||||
<div class="flex flex-wrap gap-3 justify-center">
|
||||
${(() => {
|
||||
const photos = [
|
||||
issue.photo_path,
|
||||
issue.photo_path2,
|
||||
issue.photo_path3,
|
||||
issue.photo_path4,
|
||||
issue.photo_path5
|
||||
].filter(p => p);
|
||||
|
||||
if (photos.length === 0) {
|
||||
return `
|
||||
<div class="w-40 h-40 bg-gradient-to-br from-gray-50 to-gray-100 rounded-lg border-2 border-gray-200 flex items-center justify-center">
|
||||
<i class="fas fa-image text-gray-400 text-2xl opacity-50"></i>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
return photos.map((path, idx) => `
|
||||
<div class="relative w-40 h-40 rounded-lg border-2 border-blue-200 overflow-hidden cursor-pointer hover:shadow-lg hover:scale-105 transition-all duration-200" onclick="openPhotoModal('${path}')">
|
||||
<img src="${path}" alt="부적합 사진 ${idx + 1}" class="w-full h-full object-cover" onerror="this.style.display='none'; this.nextElementSibling.style.display='flex';">
|
||||
<div class="absolute inset-0 bg-gradient-to-br from-blue-50 to-blue-100 flex items-center justify-center" style="display: none;">
|
||||
<i class="fas fa-image text-blue-500 text-2xl"></i>
|
||||
</div>
|
||||
<div class="absolute -top-1 -right-1 w-4 h-4 bg-green-500 rounded-full border-2 border-white"></div>
|
||||
</div>
|
||||
<div class="absolute -top-1 -right-1 w-4 h-4 bg-green-500 rounded-full border-2 border-white"></div>
|
||||
</div>
|
||||
` : `
|
||||
<div class="w-40 h-40 bg-gradient-to-br from-gray-50 to-gray-100 rounded-lg border-2 border-gray-200 flex items-center justify-center">
|
||||
<i class="fas fa-image text-gray-400 text-2xl opacity-50"></i>
|
||||
</div>
|
||||
`}
|
||||
${issue.photo_path2 ? `
|
||||
<div class="relative w-40 h-40 rounded-lg border-2 border-blue-200 overflow-hidden cursor-pointer hover:shadow-lg hover:scale-105 transition-all duration-200" onclick="openPhotoModal('${issue.photo_path2}')">
|
||||
<img src="${issue.photo_path2}" alt="부적합 사진 2" class="w-full h-full object-cover" onerror="this.style.display='none'; this.nextElementSibling.style.display='flex';">
|
||||
<div class="absolute inset-0 bg-gradient-to-br from-blue-50 to-blue-100 flex items-center justify-center" style="display: none;">
|
||||
<i class="fas fa-image text-blue-500 text-2xl"></i>
|
||||
</div>
|
||||
<div class="absolute -top-1 -right-1 w-4 h-4 bg-green-500 rounded-full border-2 border-white"></div>
|
||||
</div>
|
||||
` : `
|
||||
<div class="w-40 h-40 bg-gradient-to-br from-gray-50 to-gray-100 rounded-lg border-2 border-gray-200 flex items-center justify-center">
|
||||
<i class="fas fa-image text-gray-400 text-2xl opacity-50"></i>
|
||||
</div>
|
||||
`}
|
||||
`).join('');
|
||||
})()}
|
||||
</div>
|
||||
|
||||
<!-- 완료 반려 내용 표시 -->
|
||||
|
||||
@@ -795,7 +795,7 @@
|
||||
const timeAgo = getTimeAgo(reportDate);
|
||||
|
||||
// 사진 정보 처리
|
||||
const photoCount = [issue.photo_path, issue.photo_path2].filter(Boolean).length;
|
||||
const photoCount = [issue.photo_path, issue.photo_path2, issue.photo_path3, issue.photo_path4, issue.photo_path5].filter(Boolean).length;
|
||||
const photoInfo = photoCount > 0 ? `사진 ${photoCount}장` : '사진 없음';
|
||||
|
||||
return `
|
||||
@@ -856,8 +856,10 @@
|
||||
<!-- 사진 미리보기 -->
|
||||
${photoCount > 0 ? `
|
||||
<div class="photo-gallery">
|
||||
${issue.photo_path ? `<img src="${issue.photo_path}" class="photo-preview" onclick="openPhotoModal('${issue.photo_path}')" alt="첨부 사진 1">` : ''}
|
||||
${issue.photo_path2 ? `<img src="${issue.photo_path2}" class="photo-preview" onclick="openPhotoModal('${issue.photo_path2}')" alt="첨부 사진 2">` : ''}
|
||||
${[issue.photo_path, issue.photo_path2, issue.photo_path3, issue.photo_path4, issue.photo_path5]
|
||||
.filter(Boolean)
|
||||
.map((path, idx) => `<img src="${path}" class="photo-preview" onclick="openPhotoModal('${path}')" alt="첨부 사진 ${idx + 1}">`)
|
||||
.join('')}
|
||||
</div>
|
||||
` : ''}
|
||||
|
||||
|
||||
@@ -851,10 +851,27 @@
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">업로드 사진</label>
|
||||
<div class="flex gap-2">
|
||||
${issue.photo_path ? `<img src="${issue.photo_path}" class="w-20 h-20 object-cover rounded-lg cursor-pointer border-2 border-gray-200 hover:border-blue-400 transition-colors" onclick="openPhotoModal('${issue.photo_path}')" alt="업로드 사진 1">` : '<div class="w-20 h-20 bg-gray-100 rounded-lg flex items-center justify-center text-gray-400 text-xs border-2 border-dashed border-gray-300">사진 없음</div>'}
|
||||
${issue.photo_path2 ? `<img src="${issue.photo_path2}" class="w-20 h-20 object-cover rounded-lg cursor-pointer border-2 border-gray-200 hover:border-blue-400 transition-colors" onclick="openPhotoModal('${issue.photo_path2}')" alt="업로드 사진 2">` : '<div class="w-20 h-20 bg-gray-100 rounded-lg flex items-center justify-center text-gray-400 text-xs border-2 border-dashed border-gray-300">사진 없음</div>'}
|
||||
</div>
|
||||
${(() => {
|
||||
const photos = [
|
||||
issue.photo_path,
|
||||
issue.photo_path2,
|
||||
issue.photo_path3,
|
||||
issue.photo_path4,
|
||||
issue.photo_path5
|
||||
].filter(p => p);
|
||||
|
||||
if (photos.length === 0) {
|
||||
return '<div class="w-20 h-20 bg-gray-100 rounded-lg flex items-center justify-center text-gray-400 text-xs border-2 border-dashed border-gray-300">사진 없음</div>';
|
||||
}
|
||||
|
||||
return `
|
||||
<div class="flex flex-wrap gap-2">
|
||||
${photos.map((path, idx) => `
|
||||
<img src="${path}" class="w-20 h-20 object-cover rounded-lg cursor-pointer border-2 border-gray-200 hover:border-blue-400 transition-colors" onclick="openPhotoModal('${path}')" alt="업로드 사진 ${idx + 1}">
|
||||
`).join('')}
|
||||
</div>
|
||||
`;
|
||||
})()}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -903,11 +920,27 @@
|
||||
<div class="space-y-3">
|
||||
<div>
|
||||
<label class="text-xs text-purple-600 font-medium">완료 사진</label>
|
||||
${issue.completion_photo_path ? `
|
||||
<div class="mt-1">
|
||||
<img src="${issue.completion_photo_path}" class="w-24 h-24 object-cover rounded-lg cursor-pointer border-2 border-purple-200 hover:border-purple-400 transition-colors" onclick="openPhotoModal('${issue.completion_photo_path}')" alt="완료 사진">
|
||||
</div>
|
||||
` : '<p class="text-xs text-gray-500 mt-1">완료 사진 없음</p>'}
|
||||
${(() => {
|
||||
const photos = [
|
||||
issue.completion_photo_path,
|
||||
issue.completion_photo_path2,
|
||||
issue.completion_photo_path3,
|
||||
issue.completion_photo_path4,
|
||||
issue.completion_photo_path5
|
||||
].filter(p => p);
|
||||
|
||||
if (photos.length === 0) {
|
||||
return '<p class="text-xs text-gray-500 mt-1">완료 사진 없음</p>';
|
||||
}
|
||||
|
||||
return `
|
||||
<div class="mt-1 flex flex-wrap gap-2">
|
||||
${photos.map(path => `
|
||||
<img src="${path}" class="w-20 h-20 object-cover rounded-lg cursor-pointer border-2 border-purple-200 hover:border-purple-400 transition-colors" onclick="openPhotoModal('${path}')" alt="완료 사진">
|
||||
`).join('')}
|
||||
</div>
|
||||
`;
|
||||
})()}
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-xs text-purple-600 font-medium">완료 코멘트</label>
|
||||
@@ -1015,20 +1048,27 @@
|
||||
<!-- 완료 사진 -->
|
||||
<div>
|
||||
<label class="text-xs text-green-600 font-medium">완료 사진</label>
|
||||
${issue.completion_photo_path ?
|
||||
(issue.completion_photo_path.toLowerCase().endsWith('.heic') ?
|
||||
`<div class="mt-1 flex items-center space-x-2">
|
||||
<div class="w-16 h-16 bg-green-100 rounded-lg flex items-center justify-center border border-green-200">
|
||||
<i class="fas fa-image text-green-500"></i>
|
||||
</div>
|
||||
<a href="${issue.completion_photo_path}" download class="text-xs text-blue-500 hover:text-blue-700 underline">HEIC 다운로드</a>
|
||||
</div>` :
|
||||
`<div class="mt-1">
|
||||
<img src="${issue.completion_photo_path}" class="w-16 h-16 object-cover rounded-lg cursor-pointer border-2 border-green-200 hover:border-green-400 transition-colors" onclick="openPhotoModal('${issue.completion_photo_path}')" alt="완료 사진">
|
||||
</div>`
|
||||
) :
|
||||
'<p class="text-xs text-gray-500 mt-1">완료 사진 없음</p>'
|
||||
}
|
||||
${(() => {
|
||||
const photos = [
|
||||
issue.completion_photo_path,
|
||||
issue.completion_photo_path2,
|
||||
issue.completion_photo_path3,
|
||||
issue.completion_photo_path4,
|
||||
issue.completion_photo_path5
|
||||
].filter(p => p);
|
||||
|
||||
if (photos.length === 0) {
|
||||
return '<p class="text-xs text-gray-500 mt-1">완료 사진 없음</p>';
|
||||
}
|
||||
|
||||
return `
|
||||
<div class="mt-1 flex flex-wrap gap-2">
|
||||
${photos.map(path => `
|
||||
<img src="${path}" class="w-16 h-16 object-cover rounded-lg cursor-pointer border-2 border-green-200 hover:border-green-400 transition-colors" onclick="openPhotoModal('${path}')" alt="완료 사진">
|
||||
`).join('')}
|
||||
</div>
|
||||
`;
|
||||
})()}
|
||||
</div>
|
||||
<!-- 완료 코멘트 -->
|
||||
<div>
|
||||
@@ -1052,10 +1092,27 @@
|
||||
<i class="fas fa-camera text-gray-500 mr-2"></i>
|
||||
업로드 사진
|
||||
</h4>
|
||||
<div class="flex gap-2">
|
||||
${issue.photo_path ? `<img src="${issue.photo_path}" class="w-20 h-20 object-cover rounded-lg cursor-pointer border-2 border-gray-200" onclick="openPhotoModal('${issue.photo_path}')" alt="업로드 사진 1">` : '<div class="w-20 h-20 bg-gray-100 rounded-lg flex items-center justify-center text-gray-400 text-xs">사진 없음</div>'}
|
||||
${issue.photo_path2 ? `<img src="${issue.photo_path2}" class="w-20 h-20 object-cover rounded-lg cursor-pointer border-2 border-gray-200" onclick="openPhotoModal('${issue.photo_path2}')" alt="업로드 사진 2">` : '<div class="w-20 h-20 bg-gray-100 rounded-lg flex items-center justify-center text-gray-400 text-xs">사진 없음</div>'}
|
||||
</div>
|
||||
${(() => {
|
||||
const photos = [
|
||||
issue.photo_path,
|
||||
issue.photo_path2,
|
||||
issue.photo_path3,
|
||||
issue.photo_path4,
|
||||
issue.photo_path5
|
||||
].filter(p => p);
|
||||
|
||||
if (photos.length === 0) {
|
||||
return '<div class="w-20 h-20 bg-gray-100 rounded-lg flex items-center justify-center text-gray-400 text-xs">사진 없음</div>';
|
||||
}
|
||||
|
||||
return `
|
||||
<div class="flex flex-wrap gap-2">
|
||||
${photos.map((path, idx) => `
|
||||
<img src="${path}" class="w-20 h-20 object-cover rounded-lg cursor-pointer border-2 border-gray-200" onclick="openPhotoModal('${path}')" alt="업로드 사진 ${idx + 1}">
|
||||
`).join('')}
|
||||
</div>
|
||||
`;
|
||||
})()}
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
@@ -1402,10 +1459,27 @@
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">업로드 사진</label>
|
||||
<div class="flex gap-2">
|
||||
${issue.photo_path ? `<img src="${issue.photo_path}" class="w-20 h-20 object-cover rounded cursor-pointer" onclick="openPhotoModal('${issue.photo_path}')" alt="업로드 사진 1">` : '<div class="w-20 h-20 bg-gray-200 rounded flex items-center justify-center text-gray-500 text-xs">없음</div>'}
|
||||
${issue.photo_path2 ? `<img src="${issue.photo_path2}" class="w-20 h-20 object-cover rounded cursor-pointer" onclick="openPhotoModal('${issue.photo_path2}')" alt="업로드 사진 2">` : '<div class="w-20 h-20 bg-gray-200 rounded flex items-center justify-center text-gray-500 text-xs">없음</div>'}
|
||||
</div>
|
||||
${(() => {
|
||||
const photos = [
|
||||
issue.photo_path,
|
||||
issue.photo_path2,
|
||||
issue.photo_path3,
|
||||
issue.photo_path4,
|
||||
issue.photo_path5
|
||||
].filter(p => p);
|
||||
|
||||
if (photos.length === 0) {
|
||||
return '<div class="w-20 h-20 bg-gray-200 rounded flex items-center justify-center text-gray-500 text-xs">없음</div>';
|
||||
}
|
||||
|
||||
return `
|
||||
<div class="flex flex-wrap gap-2">
|
||||
${photos.map((path, idx) => `
|
||||
<img src="${path}" class="w-20 h-20 object-cover rounded cursor-pointer border-2 border-gray-300 hover:border-blue-400 transition-colors" onclick="openPhotoModal('${path}')" alt="업로드 사진 ${idx + 1}">
|
||||
`).join('')}
|
||||
</div>
|
||||
`;
|
||||
})()}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1454,13 +1528,37 @@
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">완료 사진</label>
|
||||
<div class="flex items-center gap-3">
|
||||
${issue.completion_photo_path ?
|
||||
`<img src="${issue.completion_photo_path}" class="w-20 h-20 object-cover rounded cursor-pointer" onclick="openPhotoModal('${issue.completion_photo_path}')" alt="완료 사진">` :
|
||||
'<div class="w-20 h-20 bg-gray-200 rounded flex items-center justify-center text-gray-500 text-xs">없음</div>'
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">완료 사진 (최대 5장)</label>
|
||||
|
||||
<!-- 기존 완료 사진 표시 -->
|
||||
${(() => {
|
||||
const photos = [
|
||||
issue.completion_photo_path,
|
||||
issue.completion_photo_path2,
|
||||
issue.completion_photo_path3,
|
||||
issue.completion_photo_path4,
|
||||
issue.completion_photo_path5
|
||||
].filter(p => p);
|
||||
|
||||
if (photos.length > 0) {
|
||||
return `
|
||||
<div class="mb-3">
|
||||
<p class="text-xs text-gray-600 mb-2">현재 완료 사진 (${photos.length}장)</p>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
${photos.map(path => `
|
||||
<img src="${path}" class="w-16 h-16 object-cover rounded cursor-pointer border-2 border-gray-300 hover:border-blue-400 transition-colors" onclick="openPhotoModal('${path}')" alt="완료 사진">
|
||||
`).join('')}
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
<input type="file" id="modal_completion_photo" accept="image/*" class="flex-1 text-sm">
|
||||
return '';
|
||||
})()}
|
||||
|
||||
<!-- 사진 업로드 (최대 5장) -->
|
||||
<div class="space-y-2">
|
||||
<input type="file" id="modal_completion_photo" accept="image/*" multiple class="block w-full text-sm text-gray-500 file:mr-4 file:py-2 file:px-4 file:rounded-lg file:border-0 file:text-sm file:font-semibold file:bg-blue-50 file:text-blue-700 hover:file:bg-blue-100">
|
||||
<p class="text-xs text-gray-500">※ 최대 5장까지 업로드 가능합니다. 새로운 사진을 업로드하면 기존 사진을 모두 교체합니다.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1488,11 +1586,20 @@
|
||||
}
|
||||
});
|
||||
|
||||
// 완료 사진 처리
|
||||
const photoFile = document.getElementById('modal_completion_photo').files[0];
|
||||
if (photoFile) {
|
||||
const base64 = await fileToBase64(photoFile);
|
||||
updates.completion_photo = base64;
|
||||
// 완료 사진 처리 (최대 5장)
|
||||
const photoInput = document.getElementById('modal_completion_photo');
|
||||
const photoFiles = photoInput.files;
|
||||
|
||||
if (photoFiles && photoFiles.length > 0) {
|
||||
const maxPhotos = Math.min(photoFiles.length, 5);
|
||||
|
||||
for (let i = 0; i < maxPhotos; i++) {
|
||||
const base64 = await fileToBase64(photoFiles[i]);
|
||||
const fieldName = i === 0 ? 'completion_photo' : `completion_photo${i + 1}`;
|
||||
updates[fieldName] = base64;
|
||||
}
|
||||
|
||||
console.log(`📸 ${maxPhotos}장의 완료 사진 처리 완료`);
|
||||
}
|
||||
|
||||
console.log('Modal sending updates:', updates);
|
||||
@@ -1869,10 +1976,27 @@
|
||||
|
||||
<div class="bg-gray-50 p-4 rounded-lg">
|
||||
<h4 class="font-semibold text-gray-800 mb-3">업로드 사진</h4>
|
||||
<div class="flex gap-2">
|
||||
${issue.photo_path ? `<img src="${issue.photo_path}" class="w-20 h-20 object-cover rounded-lg cursor-pointer border-2 border-gray-200" onclick="openPhotoModal('${issue.photo_path}')" alt="업로드 사진 1">` : '<div class="w-20 h-20 bg-gray-100 rounded-lg flex items-center justify-center text-gray-400 text-xs">사진 없음</div>'}
|
||||
${issue.photo_path2 ? `<img src="${issue.photo_path2}" class="w-20 h-20 object-cover rounded-lg cursor-pointer border-2 border-gray-200" onclick="openPhotoModal('${issue.photo_path2}')" alt="업로드 사진 2">` : '<div class="w-20 h-20 bg-gray-100 rounded-lg flex items-center justify-center text-gray-400 text-xs">사진 없음</div>'}
|
||||
</div>
|
||||
${(() => {
|
||||
const photos = [
|
||||
issue.photo_path,
|
||||
issue.photo_path2,
|
||||
issue.photo_path3,
|
||||
issue.photo_path4,
|
||||
issue.photo_path5
|
||||
].filter(p => p);
|
||||
|
||||
if (photos.length === 0) {
|
||||
return '<div class="w-20 h-20 bg-gray-100 rounded-lg flex items-center justify-center text-gray-400 text-xs">사진 없음</div>';
|
||||
}
|
||||
|
||||
return `
|
||||
<div class="flex flex-wrap gap-2">
|
||||
${photos.map((path, idx) => `
|
||||
<img src="${path}" class="w-20 h-20 object-cover rounded-lg cursor-pointer border-2 border-gray-200 hover:border-blue-400 transition-colors" onclick="openPhotoModal('${path}')" alt="업로드 사진 ${idx + 1}">
|
||||
`).join('')}
|
||||
</div>
|
||||
`;
|
||||
})()}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1923,32 +2047,57 @@
|
||||
<h4 class="font-semibold text-purple-800 mb-3">완료 신청 정보</h4>
|
||||
<div class="space-y-3">
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">완료 사진</label>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">완료 사진 (최대 5장)</label>
|
||||
<div class="space-y-3">
|
||||
${issue.completion_photo_path ? `
|
||||
<div class="flex items-center space-x-3">
|
||||
<img src="${issue.completion_photo_path}" class="w-24 h-24 object-cover rounded-lg cursor-pointer border-2 border-purple-200 hover:border-purple-400 transition-colors" onclick="openPhotoModal('${issue.completion_photo_path}')" alt="현재 완료 사진">
|
||||
<div class="flex-1">
|
||||
<p class="text-sm text-gray-600 mb-1">현재 완료 사진</p>
|
||||
<p class="text-xs text-gray-500">클릭하면 크게 볼 수 있습니다</p>
|
||||
</div>
|
||||
</div>
|
||||
` : `
|
||||
<div class="flex items-center justify-center w-24 h-24 bg-gray-100 border-2 border-dashed border-gray-300 rounded-lg">
|
||||
<div class="text-center">
|
||||
<i class="fas fa-camera text-gray-400 text-lg mb-1"></i>
|
||||
<p class="text-xs text-gray-500">사진 없음</p>
|
||||
</div>
|
||||
</div>
|
||||
`}
|
||||
${(() => {
|
||||
const photos = [
|
||||
issue.completion_photo_path,
|
||||
issue.completion_photo_path2,
|
||||
issue.completion_photo_path3,
|
||||
issue.completion_photo_path4,
|
||||
issue.completion_photo_path5
|
||||
].filter(p => p);
|
||||
|
||||
if (photos.length > 0) {
|
||||
return `
|
||||
<div class="mb-3">
|
||||
<p class="text-xs text-gray-600 mb-2">현재 완료 사진 (${photos.length}장)</p>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
${photos.map(path => `
|
||||
<img src="${path}" class="w-20 h-20 object-cover rounded-lg cursor-pointer border-2 border-purple-200 hover:border-purple-400 transition-colors" onclick="openPhotoModal('${path}')" alt="완료 사진">
|
||||
`).join('')}
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
} else {
|
||||
return `
|
||||
<div class="flex items-center justify-center w-24 h-24 bg-gray-100 border-2 border-dashed border-gray-300 rounded-lg mb-3">
|
||||
<div class="text-center">
|
||||
<i class="fas fa-camera text-gray-400 text-lg mb-1"></i>
|
||||
<p class="text-xs text-gray-500">사진 없음</p>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
})()}
|
||||
<div class="flex items-center space-x-2">
|
||||
<input type="file" id="edit-completion-photo-${issue.id}" accept="image/*" class="hidden">
|
||||
<input type="file" id="edit-completion-photo-${issue.id}" accept="image/*" multiple class="hidden">
|
||||
<button type="button" onclick="document.getElementById('edit-completion-photo-${issue.id}').click()" class="flex items-center px-4 py-2 bg-purple-500 text-white rounded-lg hover:bg-purple-600 transition-colors text-sm">
|
||||
<i class="fas fa-upload mr-2"></i>
|
||||
${issue.completion_photo_path ? '사진 교체' : '사진 업로드'}
|
||||
${(() => {
|
||||
const photoCount = [
|
||||
issue.completion_photo_path,
|
||||
issue.completion_photo_path2,
|
||||
issue.completion_photo_path3,
|
||||
issue.completion_photo_path4,
|
||||
issue.completion_photo_path5
|
||||
].filter(p => p).length;
|
||||
return photoCount > 0 ? '사진 교체' : '사진 업로드';
|
||||
})()}
|
||||
</button>
|
||||
<span id="photo-filename-${issue.id}" class="text-sm text-gray-600"></span>
|
||||
</div>
|
||||
<p class="text-xs text-gray-500">※ 최대 5장까지 업로드 가능합니다. 새로운 사진을 업로드하면 기존 사진을 모두 교체합니다.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
@@ -1995,8 +2144,9 @@
|
||||
|
||||
if (fileInput && filenameSpan) {
|
||||
fileInput.addEventListener('change', function(e) {
|
||||
if (e.target.files && e.target.files[0]) {
|
||||
filenameSpan.textContent = e.target.files[0].name;
|
||||
if (e.target.files && e.target.files.length > 0) {
|
||||
const fileCount = Math.min(e.target.files.length, 5);
|
||||
filenameSpan.textContent = `${fileCount}개 파일 선택됨`;
|
||||
filenameSpan.className = 'text-sm text-green-600 font-medium';
|
||||
} else {
|
||||
filenameSpan.textContent = '';
|
||||
@@ -2038,31 +2188,38 @@
|
||||
// 완료 신청 정보 (완료 대기 상태일 때만)
|
||||
const completionCommentElement = document.getElementById(`edit-completion-comment-${issueId}`);
|
||||
const completionPhotoElement = document.getElementById(`edit-completion-photo-${issueId}`);
|
||||
|
||||
|
||||
let completionComment = null;
|
||||
let completionPhoto = null;
|
||||
|
||||
const completionPhotos = {}; // 완료 사진들을 저장할 객체
|
||||
|
||||
if (completionCommentElement) {
|
||||
completionComment = completionCommentElement.value.trim();
|
||||
}
|
||||
|
||||
if (completionPhotoElement && completionPhotoElement.files[0]) {
|
||||
|
||||
// 완료 사진 처리 (최대 5장)
|
||||
if (completionPhotoElement && completionPhotoElement.files.length > 0) {
|
||||
try {
|
||||
const file = completionPhotoElement.files[0];
|
||||
console.log('🔍 업로드할 파일 정보:', {
|
||||
name: file.name,
|
||||
size: file.size,
|
||||
type: file.type,
|
||||
lastModified: file.lastModified
|
||||
});
|
||||
|
||||
const base64 = await fileToBase64(file);
|
||||
console.log('🔍 Base64 변환 완료 - 전체 길이:', base64.length);
|
||||
console.log('🔍 Base64 헤더:', base64.substring(0, 50));
|
||||
|
||||
completionPhoto = base64.split(',')[1]; // Base64 데이터만 추출
|
||||
console.log('🔍 헤더 제거 후 길이:', completionPhoto.length);
|
||||
console.log('🔍 전송할 Base64 시작 부분:', completionPhoto.substring(0, 50));
|
||||
const files = completionPhotoElement.files;
|
||||
const maxPhotos = Math.min(files.length, 5);
|
||||
|
||||
console.log(`🔍 총 ${maxPhotos}개의 완료 사진 업로드 시작`);
|
||||
|
||||
for (let i = 0; i < maxPhotos; i++) {
|
||||
const file = files[i];
|
||||
console.log(`🔍 파일 ${i + 1} 정보:`, {
|
||||
name: file.name,
|
||||
size: file.size,
|
||||
type: file.type
|
||||
});
|
||||
|
||||
const base64 = await fileToBase64(file);
|
||||
const base64Data = base64.split(',')[1]; // Base64 데이터만 추출
|
||||
|
||||
const fieldName = i === 0 ? 'completion_photo' : `completion_photo${i + 1}`;
|
||||
completionPhotos[fieldName] = base64Data;
|
||||
|
||||
console.log(`✅ 파일 ${i + 1} 변환 완료 (${fieldName})`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('파일 변환 오류:', error);
|
||||
alert('완료 사진 업로드 중 오류가 발생했습니다.');
|
||||
@@ -2091,8 +2248,9 @@
|
||||
if (completionComment !== null) {
|
||||
requestBody.completion_comment = completionComment || null;
|
||||
}
|
||||
if (completionPhoto !== null) {
|
||||
requestBody.completion_photo = completionPhoto;
|
||||
// 완료 사진들 추가 (최대 5장)
|
||||
for (const [key, value] of Object.entries(completionPhotos)) {
|
||||
requestBody[key] = value;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
@@ -4,39 +4,47 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>일일보고서 - 작업보고서</title>
|
||||
|
||||
|
||||
<!-- Tailwind CSS -->
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
|
||||
|
||||
<!-- Font Awesome -->
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||
|
||||
|
||||
<!-- Custom Styles -->
|
||||
<style>
|
||||
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
|
||||
|
||||
|
||||
body {
|
||||
font-family: 'Inter', sans-serif;
|
||||
}
|
||||
|
||||
|
||||
.report-card {
|
||||
transition: all 0.2s ease;
|
||||
border-left: 4px solid transparent;
|
||||
}
|
||||
|
||||
|
||||
.report-card:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
|
||||
border-left-color: #10b981;
|
||||
}
|
||||
|
||||
|
||||
.stats-card {
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
|
||||
.stats-card:hover {
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.issue-row {
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.issue-row:hover {
|
||||
background-color: #f9fafb;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="bg-gray-50 min-h-screen">
|
||||
@@ -52,12 +60,12 @@
|
||||
<i class="fas fa-file-excel text-green-500 mr-3"></i>
|
||||
일일보고서
|
||||
</h1>
|
||||
<p class="text-gray-600 mt-1">품질팀용 관리함 데이터를 엑셀 형태로 내보내세요</p>
|
||||
<p class="text-gray-600 mt-1">프로젝트별 진행중/완료 항목을 엑셀로 내보내세요</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 프로젝트 선택 및 생성 -->
|
||||
<!-- 프로젝트 선택 -->
|
||||
<div class="bg-white rounded-xl shadow-sm p-6 mb-6">
|
||||
<div class="space-y-6">
|
||||
<!-- 프로젝트 선택 -->
|
||||
@@ -70,48 +78,74 @@
|
||||
</select>
|
||||
<p class="text-sm text-gray-500 mt-2">
|
||||
<i class="fas fa-info-circle mr-1"></i>
|
||||
선택한 프로젝트의 관리함 데이터만 포함됩니다.
|
||||
진행 중인 항목 + 완료되고 한번도 추출 안된 항목이 포함됩니다.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- 생성 버튼 -->
|
||||
<!-- 버튼 -->
|
||||
<div class="flex items-center space-x-4">
|
||||
<button id="generateReportBtn"
|
||||
onclick="generateDailyReport()"
|
||||
class="px-6 py-3 bg-green-600 text-white font-medium rounded-lg hover:bg-green-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
disabled>
|
||||
<i class="fas fa-download mr-2"></i>일일보고서 생성
|
||||
<button id="previewBtn"
|
||||
onclick="loadPreview()"
|
||||
class="px-6 py-3 bg-blue-600 text-white font-medium rounded-lg hover:bg-blue-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed hidden">
|
||||
<i class="fas fa-eye mr-2"></i>미리보기
|
||||
</button>
|
||||
<button id="previewStatsBtn"
|
||||
onclick="toggleStatsPreview()"
|
||||
class="px-6 py-3 bg-blue-600 text-white font-medium rounded-lg hover:bg-blue-700 transition-colors hidden">
|
||||
<i class="fas fa-chart-bar mr-2"></i>통계 미리보기
|
||||
<button id="generateReportBtn"
|
||||
onclick="generateDailyReport()"
|
||||
class="px-6 py-3 bg-green-600 text-white font-medium rounded-lg hover:bg-green-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed hidden">
|
||||
<i class="fas fa-download mr-2"></i>일일보고서 생성
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 프로젝트 통계 미리보기 -->
|
||||
<div id="projectStatsCard" class="bg-white rounded-xl shadow-sm p-6 mb-6 hidden">
|
||||
<h2 class="text-xl font-semibold text-gray-900 mb-4">
|
||||
<i class="fas fa-chart-bar text-blue-500 mr-2"></i>프로젝트 현황 미리보기
|
||||
</h2>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
|
||||
<div class="stats-card bg-blue-50 p-4 rounded-lg text-center">
|
||||
<div class="text-3xl font-bold text-blue-600 mb-1" id="reportTotalCount">0</div>
|
||||
<div class="text-sm text-blue-700 font-medium">총 신고 수량</div>
|
||||
<!-- 미리보기 섹션 -->
|
||||
<div id="previewSection" class="hidden">
|
||||
<!-- 통계 카드 -->
|
||||
<div class="bg-white rounded-xl shadow-sm p-6 mb-6">
|
||||
<h2 class="text-xl font-semibold text-gray-900 mb-4">
|
||||
<i class="fas fa-chart-bar text-blue-500 mr-2"></i>추출 항목 통계
|
||||
</h2>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
|
||||
<div class="stats-card bg-blue-50 p-4 rounded-lg text-center">
|
||||
<div class="text-3xl font-bold text-blue-600 mb-1" id="previewTotalCount">0</div>
|
||||
<div class="text-sm text-blue-700 font-medium">총 추출 수량</div>
|
||||
</div>
|
||||
<div class="stats-card bg-orange-50 p-4 rounded-lg text-center">
|
||||
<div class="text-3xl font-bold text-orange-600 mb-1" id="previewInProgressCount">0</div>
|
||||
<div class="text-sm text-orange-700 font-medium">진행 중</div>
|
||||
</div>
|
||||
<div class="stats-card bg-green-50 p-4 rounded-lg text-center">
|
||||
<div class="text-3xl font-bold text-green-600 mb-1" id="previewCompletedCount">0</div>
|
||||
<div class="text-sm text-green-700 font-medium">완료 (미추출)</div>
|
||||
</div>
|
||||
<div class="stats-card bg-red-50 p-4 rounded-lg text-center">
|
||||
<div class="text-3xl font-bold text-red-600 mb-1" id="previewDelayedCount">0</div>
|
||||
<div class="text-sm text-red-700 font-medium">지연 중</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stats-card bg-orange-50 p-4 rounded-lg text-center">
|
||||
<div class="text-3xl font-bold text-orange-600 mb-1" id="reportManagementCount">0</div>
|
||||
<div class="text-sm text-orange-700 font-medium">관리처리 현황</div>
|
||||
</div>
|
||||
<div class="stats-card bg-green-50 p-4 rounded-lg text-center">
|
||||
<div class="text-3xl font-bold text-green-600 mb-1" id="reportCompletedCount">0</div>
|
||||
<div class="text-sm text-green-700 font-medium">완료 현황</div>
|
||||
</div>
|
||||
<div class="stats-card bg-red-50 p-4 rounded-lg text-center">
|
||||
<div class="text-3xl font-bold text-red-600 mb-1" id="reportDelayedCount">0</div>
|
||||
<div class="text-sm text-red-700 font-medium">지연 중</div>
|
||||
</div>
|
||||
|
||||
<!-- 항목 목록 -->
|
||||
<div class="bg-white rounded-xl shadow-sm p-6">
|
||||
<h2 class="text-xl font-semibold text-gray-900 mb-4">
|
||||
<i class="fas fa-list text-gray-500 mr-2"></i>추출될 항목 목록
|
||||
</h2>
|
||||
<div class="overflow-x-auto">
|
||||
<table class="w-full">
|
||||
<thead class="bg-gray-50">
|
||||
<tr class="border-b">
|
||||
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">No</th>
|
||||
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">부적합명</th>
|
||||
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">상태</th>
|
||||
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">추출이력</th>
|
||||
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">담당부서</th>
|
||||
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">신고일</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="previewTableBody" class="divide-y divide-gray-200">
|
||||
<!-- 동적으로 채워짐 -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -119,7 +153,7 @@
|
||||
<!-- 포함 항목 안내 -->
|
||||
<div class="bg-white rounded-xl shadow-sm p-6 mb-6">
|
||||
<h2 class="text-xl font-semibold text-gray-900 mb-4">
|
||||
<i class="fas fa-list-check text-gray-500 mr-2"></i>보고서 포함 항목
|
||||
<i class="fas fa-list-check text-gray-500 mr-2"></i>보고서 포함 항목 안내
|
||||
</h2>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
<div class="report-card bg-blue-50 p-4 rounded-lg">
|
||||
@@ -127,35 +161,21 @@
|
||||
<i class="fas fa-check-circle text-blue-500 mr-2"></i>
|
||||
<span class="font-medium text-blue-800">진행 중 항목</span>
|
||||
</div>
|
||||
<p class="text-sm text-blue-600">무조건 포함됩니다</p>
|
||||
<p class="text-sm text-blue-600">모든 진행 중인 항목이 포함됩니다 (추출 이력과 무관)</p>
|
||||
</div>
|
||||
<div class="report-card bg-green-50 p-4 rounded-lg">
|
||||
<div class="flex items-center mb-2">
|
||||
<i class="fas fa-check-circle text-green-500 mr-2"></i>
|
||||
<span class="font-medium text-green-800">완료됨 항목</span>
|
||||
</div>
|
||||
<p class="text-sm text-green-600">첫 내보내기에만 포함, 이후 자동 제외</p>
|
||||
<p class="text-sm text-green-600">한번도 추출 안된 완료 항목만 포함, 이후 자동 제외</p>
|
||||
</div>
|
||||
<div class="report-card bg-yellow-50 p-4 rounded-lg">
|
||||
<div class="flex items-center mb-2">
|
||||
<i class="fas fa-info-circle text-yellow-500 mr-2"></i>
|
||||
<span class="font-medium text-yellow-800">프로젝트 통계</span>
|
||||
<span class="font-medium text-yellow-800">추출 이력 기록</span>
|
||||
</div>
|
||||
<p class="text-sm text-yellow-600">상단에 요약 정보 포함</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 최근 생성된 보고서 -->
|
||||
<div class="bg-white rounded-xl shadow-sm p-6">
|
||||
<h2 class="text-xl font-semibold text-gray-900 mb-4">
|
||||
<i class="fas fa-history text-gray-500 mr-2"></i>최근 생성된 일일보고서
|
||||
</h2>
|
||||
<div id="recentReports" class="space-y-3">
|
||||
<div class="text-center py-8 text-gray-500">
|
||||
<i class="fas fa-file-excel text-4xl mb-3 opacity-50"></i>
|
||||
<p>아직 생성된 일일보고서가 없습니다.</p>
|
||||
<p class="text-sm">프로젝트를 선택하고 보고서를 생성해보세요!</p>
|
||||
<p class="text-sm text-yellow-600">추출 시 자동으로 이력이 기록됩니다</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -170,11 +190,12 @@
|
||||
<script>
|
||||
let projects = [];
|
||||
let selectedProjectId = null;
|
||||
let previewData = null;
|
||||
|
||||
// 페이지 초기화
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
console.log('일일보고서 페이지 로드 시작');
|
||||
|
||||
|
||||
// AuthManager 로드 대기
|
||||
const checkAuthManager = async () => {
|
||||
if (window.authManager) {
|
||||
@@ -188,7 +209,7 @@
|
||||
|
||||
// 프로젝트 목록 로드
|
||||
await loadProjects();
|
||||
|
||||
|
||||
// 공통 헤더 초기화
|
||||
try {
|
||||
const user = JSON.parse(localStorage.getItem('currentUser') || '{}');
|
||||
@@ -198,7 +219,7 @@
|
||||
} catch (headerError) {
|
||||
console.error('공통 헤더 초기화 오류:', headerError);
|
||||
}
|
||||
|
||||
|
||||
console.log('일일보고서 페이지 로드 완료');
|
||||
} catch (error) {
|
||||
console.error('페이지 초기화 오류:', error);
|
||||
@@ -214,7 +235,7 @@
|
||||
async function loadProjects() {
|
||||
try {
|
||||
const apiUrl = window.API_BASE_URL || 'http://localhost:16080/api';
|
||||
|
||||
|
||||
const response = await fetch(`${apiUrl}/projects/`, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${localStorage.getItem('access_token')}`
|
||||
@@ -235,14 +256,14 @@
|
||||
// 프로젝트 선택 옵션 채우기
|
||||
function populateProjectSelect() {
|
||||
const select = document.getElementById('reportProjectSelect');
|
||||
|
||||
|
||||
if (!select) {
|
||||
console.error('reportProjectSelect 요소를 찾을 수 없습니다!');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
select.innerHTML = '<option value="">프로젝트를 선택하세요</option>';
|
||||
|
||||
|
||||
projects.forEach(project => {
|
||||
const option = document.createElement('option');
|
||||
option.value = project.id;
|
||||
@@ -255,50 +276,136 @@
|
||||
document.addEventListener('change', async function(e) {
|
||||
if (e.target.id === 'reportProjectSelect') {
|
||||
selectedProjectId = e.target.value;
|
||||
const previewBtn = document.getElementById('previewBtn');
|
||||
const generateBtn = document.getElementById('generateReportBtn');
|
||||
const previewBtn = document.getElementById('previewStatsBtn');
|
||||
|
||||
const previewSection = document.getElementById('previewSection');
|
||||
|
||||
if (selectedProjectId) {
|
||||
generateBtn.disabled = false;
|
||||
previewBtn.classList.remove('hidden');
|
||||
await loadProjectStats(selectedProjectId);
|
||||
generateBtn.classList.remove('hidden');
|
||||
previewSection.classList.add('hidden');
|
||||
previewData = null;
|
||||
} else {
|
||||
generateBtn.disabled = true;
|
||||
previewBtn.classList.add('hidden');
|
||||
document.getElementById('projectStatsCard').classList.add('hidden');
|
||||
generateBtn.classList.add('hidden');
|
||||
previewSection.classList.add('hidden');
|
||||
previewData = null;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 프로젝트 통계 로드
|
||||
async function loadProjectStats(projectId) {
|
||||
// 미리보기 로드
|
||||
async function loadPreview() {
|
||||
if (!selectedProjectId) {
|
||||
alert('프로젝트를 선택해주세요.');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const apiUrl = window.API_BASE_URL || 'http://localhost:16080/api';
|
||||
const response = await fetch(`${apiUrl}/management/stats?project_id=${projectId}`, {
|
||||
const response = await fetch(`${apiUrl}/reports/daily-preview?project_id=${selectedProjectId}`, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${localStorage.getItem('access_token')}`
|
||||
}
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
const stats = await response.json();
|
||||
|
||||
document.getElementById('reportTotalCount').textContent = stats.total_count || 0;
|
||||
document.getElementById('reportManagementCount').textContent = stats.management_count || 0;
|
||||
document.getElementById('reportCompletedCount').textContent = stats.completed_count || 0;
|
||||
document.getElementById('reportDelayedCount').textContent = stats.delayed_count || 0;
|
||||
previewData = await response.json();
|
||||
displayPreview(previewData);
|
||||
} else {
|
||||
console.error('프로젝트 통계 로드 실패:', response.status);
|
||||
alert('미리보기 로드에 실패했습니다.');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('프로젝트 통계 로드 오류:', error);
|
||||
console.error('미리보기 로드 오류:', error);
|
||||
alert('미리보기 로드 중 오류가 발생했습니다.');
|
||||
}
|
||||
}
|
||||
|
||||
// 통계 미리보기 토글
|
||||
function toggleStatsPreview() {
|
||||
const statsCard = document.getElementById('projectStatsCard');
|
||||
statsCard.classList.toggle('hidden');
|
||||
// 미리보기 표시
|
||||
function displayPreview(data) {
|
||||
// 통계 업데이트
|
||||
const inProgressCount = data.issues.filter(i => i.review_status === 'in_progress').length;
|
||||
const completedCount = data.issues.filter(i => i.review_status === 'completed').length;
|
||||
|
||||
document.getElementById('previewTotalCount').textContent = data.total_issues;
|
||||
document.getElementById('previewInProgressCount').textContent = inProgressCount;
|
||||
document.getElementById('previewCompletedCount').textContent = completedCount;
|
||||
document.getElementById('previewDelayedCount').textContent = data.stats.delayed_count;
|
||||
|
||||
// 테이블 업데이트
|
||||
const tbody = document.getElementById('previewTableBody');
|
||||
tbody.innerHTML = '';
|
||||
|
||||
data.issues.forEach(issue => {
|
||||
const row = document.createElement('tr');
|
||||
row.className = 'issue-row';
|
||||
|
||||
const statusBadge = getStatusBadge(issue);
|
||||
const exportBadge = getExportBadge(issue);
|
||||
const department = getDepartmentText(issue.responsible_department);
|
||||
const reportDate = issue.report_date ? new Date(issue.report_date).toLocaleDateString('ko-KR') : '-';
|
||||
|
||||
row.innerHTML = `
|
||||
<td class="px-4 py-3 text-sm text-gray-900">${issue.project_sequence_no || issue.id}</td>
|
||||
<td class="px-4 py-3 text-sm text-gray-900">${issue.final_description || issue.description || '-'}</td>
|
||||
<td class="px-4 py-3 text-sm">${statusBadge}</td>
|
||||
<td class="px-4 py-3 text-sm">${exportBadge}</td>
|
||||
<td class="px-4 py-3 text-sm text-gray-900">${department}</td>
|
||||
<td class="px-4 py-3 text-sm text-gray-500">${reportDate}</td>
|
||||
`;
|
||||
|
||||
tbody.appendChild(row);
|
||||
});
|
||||
|
||||
// 미리보기 섹션 표시
|
||||
document.getElementById('previewSection').classList.remove('hidden');
|
||||
}
|
||||
|
||||
// 상태 배지 (지연/진행중/완료 구분)
|
||||
function getStatusBadge(issue) {
|
||||
// 완료됨
|
||||
if (issue.review_status === 'completed') {
|
||||
return '<span class="px-2 py-1 text-xs font-medium bg-green-100 text-green-800 rounded">완료됨</span>';
|
||||
}
|
||||
|
||||
// 진행 중인 경우 지연 여부 확인
|
||||
if (issue.review_status === 'in_progress') {
|
||||
if (issue.expected_completion_date) {
|
||||
const today = new Date();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
const expectedDate = new Date(issue.expected_completion_date);
|
||||
expectedDate.setHours(0, 0, 0, 0);
|
||||
|
||||
if (expectedDate < today) {
|
||||
return '<span class="px-2 py-1 text-xs font-medium bg-red-100 text-red-800 rounded">지연중</span>';
|
||||
}
|
||||
}
|
||||
return '<span class="px-2 py-1 text-xs font-medium bg-orange-100 text-orange-800 rounded">진행중</span>';
|
||||
}
|
||||
|
||||
return '<span class="px-2 py-1 text-xs font-medium bg-gray-100 text-gray-800 rounded">' + (issue.review_status || '-') + '</span>';
|
||||
}
|
||||
|
||||
// 추출 이력 배지
|
||||
function getExportBadge(issue) {
|
||||
if (issue.last_exported_at) {
|
||||
const exportDate = new Date(issue.last_exported_at).toLocaleDateString('ko-KR');
|
||||
return `<span class="px-2 py-1 text-xs font-medium bg-blue-100 text-blue-800 rounded">추출됨 (${issue.export_count || 1}회)</span>`;
|
||||
} else {
|
||||
return '<span class="px-2 py-1 text-xs font-medium bg-gray-100 text-gray-800 rounded">미추출</span>';
|
||||
}
|
||||
}
|
||||
|
||||
// 부서명 변환
|
||||
function getDepartmentText(department) {
|
||||
const map = {
|
||||
'production': '생산',
|
||||
'quality': '품질',
|
||||
'purchasing': '구매',
|
||||
'design': '설계',
|
||||
'sales': '영업'
|
||||
};
|
||||
return map[department] || '-';
|
||||
}
|
||||
|
||||
// 일일보고서 생성
|
||||
@@ -308,6 +415,12 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// 미리보기 데이터가 있고 항목이 0개인 경우
|
||||
if (previewData && previewData.total_issues === 0) {
|
||||
alert('추출할 항목이 없습니다.');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const button = document.getElementById('generateReportBtn');
|
||||
const originalText = button.innerHTML;
|
||||
@@ -332,20 +445,25 @@
|
||||
const a = document.createElement('a');
|
||||
a.style.display = 'none';
|
||||
a.href = url;
|
||||
|
||||
// 파일명 생성 (프로젝트명_일일보고서_날짜.xlsx)
|
||||
|
||||
// 파일명 생성
|
||||
const project = projects.find(p => p.id == selectedProjectId);
|
||||
const today = new Date().toISOString().split('T')[0];
|
||||
a.download = `${project.name}_일일보고서_${today}.xlsx`;
|
||||
|
||||
a.download = `${project.project_name}_일일보고서_${today}.xlsx`;
|
||||
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
window.URL.revokeObjectURL(url);
|
||||
document.body.removeChild(a);
|
||||
|
||||
// 성공 메시지 표시
|
||||
|
||||
// 성공 메시지
|
||||
showSuccessMessage('일일보고서가 성공적으로 생성되었습니다!');
|
||||
|
||||
|
||||
// 미리보기 새로고침
|
||||
if (previewData) {
|
||||
setTimeout(() => loadPreview(), 1000);
|
||||
}
|
||||
|
||||
} else {
|
||||
const error = await response.text();
|
||||
console.error('보고서 생성 실패:', error);
|
||||
@@ -371,9 +489,9 @@
|
||||
<span>${message}</span>
|
||||
</div>
|
||||
`;
|
||||
|
||||
|
||||
document.body.appendChild(successDiv);
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
successDiv.remove();
|
||||
}, 3000);
|
||||
|
||||
@@ -190,13 +190,16 @@ const AuthAPI = {
|
||||
// Issues API
|
||||
const IssuesAPI = {
|
||||
create: async (issueData) => {
|
||||
// photos 배열 처리 (최대 2장)
|
||||
// photos 배열 처리 (최대 5장)
|
||||
const dataToSend = {
|
||||
category: issueData.category,
|
||||
description: issueData.description,
|
||||
project_id: issueData.project_id,
|
||||
photo: issueData.photos && issueData.photos.length > 0 ? issueData.photos[0] : null,
|
||||
photo2: issueData.photos && issueData.photos.length > 1 ? issueData.photos[1] : null
|
||||
photo2: issueData.photos && issueData.photos.length > 1 ? issueData.photos[1] : null,
|
||||
photo3: issueData.photos && issueData.photos.length > 2 ? issueData.photos[2] : null,
|
||||
photo4: issueData.photos && issueData.photos.length > 3 ? issueData.photos[3] : null,
|
||||
photo5: issueData.photos && issueData.photos.length > 4 ? issueData.photos[4] : null
|
||||
};
|
||||
|
||||
return apiRequest('/issues/', {
|
||||
|
||||
@@ -35,7 +35,7 @@ class CommonHeader {
|
||||
},
|
||||
{
|
||||
id: 'issues_view',
|
||||
title: '부적합 조회',
|
||||
title: '신고내용조회',
|
||||
icon: 'fas fa-search',
|
||||
url: '/issue-view.html',
|
||||
pageName: 'issues_view',
|
||||
|
||||
Reference in New Issue
Block a user