✨ 주요 기능 추가: - 다중 이미지 업로드 지원 (최대 5개) - 체크리스트 완료 시 자동 사라짐 기능 - 캘린더 상세 모달에서 다중 이미지 표시 - Todo 변환 시 기존 이미지 보존 및 새 이미지 추가 🔧 백엔드 수정: - Todo 모델: image_url → image_urls (JSON 배열) - API 엔드포인트: 다중 이미지 직렬화/역직렬화 - 새 엔드포인트: POST /todos/{id}/add-image (이미지 추가) - 데이터베이스 마이그레이션 스크립트 추가 🎨 프론트엔드 개선: - 대시보드: 실제 API 데이터 연동, 다중 이미지 표시 - 업로드 모달: 다중 파일 선택, 실시간 미리보기, 5개 제한 - 체크리스트: 완료 시 1.5초 후 자동 제거, 토스트 메시지 - 캘린더 모달: 2x2 그리드 이미지 표시, 클릭 확대 - Todo 변환: 기존 이미지 + 새 이미지 합치기 🐛 버그 수정: - currentPhoto 변수 오류 해결 - 이미지 표시 문제 (단일 → 다중 지원) - 완료 처리 로컬/백엔드 동기화 - 새로고침 시 완료 항목 재출현 문제
605 lines
26 KiB
HTML
605 lines
26 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="ko">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>체크리스트 - 기한 없는 일들</title>
|
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
|
<style>
|
|
:root {
|
|
--primary: #3b82f6; /* 하늘색 */
|
|
--primary-dark: #2563eb; /* 진한 하늘색 */
|
|
--success: #10b981; /* 초록색 */
|
|
--warning: #f59e0b; /* 주황색 */
|
|
--danger: #ef4444; /* 빨간색 */
|
|
--gray-50: #f9fafb; /* 연한 회색 */
|
|
--gray-100: #f3f4f6; /* 회색 */
|
|
--gray-200: #e5e7eb; /* 중간 회색 */
|
|
--gray-300: #d1d5db; /* 진한 회색 */
|
|
}
|
|
|
|
body {
|
|
background-color: var(--gray-50);
|
|
}
|
|
|
|
.btn-primary {
|
|
background-color: var(--primary);
|
|
color: white;
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.btn-primary:hover {
|
|
background-color: var(--primary-dark);
|
|
transform: translateY(-1px);
|
|
box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
|
|
}
|
|
|
|
.btn-success {
|
|
background-color: var(--success);
|
|
color: white;
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.btn-success:hover {
|
|
background-color: #059669;
|
|
transform: translateY(-1px);
|
|
box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
|
|
}
|
|
|
|
.checklist-item {
|
|
background: white;
|
|
border-radius: 0.75rem;
|
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.checklist-item:hover {
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
}
|
|
|
|
.checklist-item.completed {
|
|
opacity: 0.7;
|
|
background-color: #f9fafb;
|
|
}
|
|
|
|
.checklist-item.completed .item-content {
|
|
text-decoration: line-through;
|
|
color: #6b7280;
|
|
}
|
|
|
|
.checkbox-custom {
|
|
width: 20px;
|
|
height: 20px;
|
|
border: 2px solid #d1d5db;
|
|
border-radius: 4px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
cursor: pointer;
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.checkbox-custom.checked {
|
|
background-color: #10b981;
|
|
border-color: #10b981;
|
|
color: white;
|
|
}
|
|
|
|
.checkbox-custom:hover {
|
|
border-color: #10b981;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="min-h-screen">
|
|
<!-- 헤더 -->
|
|
<header class="bg-white shadow-sm border-b">
|
|
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
|
<div class="flex justify-between items-center h-16">
|
|
<div class="flex items-center">
|
|
<button onclick="goBack()" class="mr-4 text-gray-500 hover:text-gray-700">
|
|
<i class="fas fa-arrow-left text-xl"></i>
|
|
</button>
|
|
<i class="fas fa-check-square text-2xl text-green-500 mr-3"></i>
|
|
<h1 class="text-xl font-semibold text-gray-800">체크리스트</h1>
|
|
<span class="ml-3 text-sm text-gray-500">기한 없는 일들</span>
|
|
</div>
|
|
|
|
<div class="flex items-center space-x-4">
|
|
<button onclick="goToDashboard()" class="text-blue-600 hover:text-blue-800 font-medium">
|
|
<i class="fas fa-chart-line mr-1"></i>대시보드
|
|
</button>
|
|
<span class="text-sm text-gray-600" id="currentUser"></span>
|
|
<button onclick="logout()" class="text-gray-500 hover:text-gray-700">
|
|
<i class="fas fa-sign-out-alt"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<!-- 메인 컨텐츠 -->
|
|
<main class="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
|
|
<!-- 페이지 설명 -->
|
|
<div class="bg-green-50 rounded-xl p-6 mb-8">
|
|
<div class="flex items-center mb-4">
|
|
<i class="fas fa-check-square text-2xl text-green-600 mr-3"></i>
|
|
<h2 class="text-xl font-semibold text-green-900">체크리스트 관리</h2>
|
|
</div>
|
|
<p class="text-green-800 mb-4">
|
|
기한이 없는 일들을 관리합니다. 언제든 할 수 있는 일들을 체크해나가세요.
|
|
</p>
|
|
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 text-sm">
|
|
<div class="bg-white rounded-lg p-3">
|
|
<div class="font-medium text-green-900 mb-1">📝 할 일</div>
|
|
<div class="text-green-700">아직 완료하지 않은 일들</div>
|
|
</div>
|
|
<div class="bg-white rounded-lg p-3">
|
|
<div class="font-medium text-green-900 mb-1">✅ 완료</div>
|
|
<div class="text-green-700">완료한 일들</div>
|
|
</div>
|
|
<div class="bg-white rounded-lg p-3">
|
|
<div class="font-medium text-green-900 mb-1">📊 진행률</div>
|
|
<div class="text-green-700" id="progressText">0% 완료</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 진행률 표시 -->
|
|
<div class="bg-white rounded-xl shadow-sm p-6 mb-6">
|
|
<div class="flex items-center justify-between mb-4">
|
|
<h3 class="text-lg font-semibold text-gray-800">
|
|
<i class="fas fa-chart-line text-green-500 mr-2"></i>전체 진행률
|
|
</h3>
|
|
<div class="text-sm text-gray-600">
|
|
<span id="completedCount">0</span> / <span id="totalCount">0</span> 완료
|
|
</div>
|
|
</div>
|
|
<div class="w-full bg-gray-200 rounded-full h-3">
|
|
<div id="progressBar" class="bg-green-500 h-3 rounded-full transition-all duration-300" style="width: 0%"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 필터 및 정렬 -->
|
|
<div class="bg-white rounded-xl shadow-sm p-6 mb-6">
|
|
<div class="flex flex-col md:flex-row justify-between items-start md:items-center gap-4">
|
|
<div class="flex space-x-1 bg-gray-100 rounded-lg p-1">
|
|
<button onclick="filterChecklist('all')" class="filter-tab active px-4 py-2 rounded text-sm font-medium">전체</button>
|
|
<button onclick="filterChecklist('active')" class="filter-tab px-4 py-2 rounded text-sm font-medium">할 일</button>
|
|
<button onclick="filterChecklist('completed')" class="filter-tab px-4 py-2 rounded text-sm font-medium">완료</button>
|
|
</div>
|
|
|
|
<div class="flex items-center space-x-3">
|
|
<label class="text-sm text-gray-600">정렬:</label>
|
|
<select id="sortBy" class="border border-gray-300 rounded-lg px-3 py-1 text-sm">
|
|
<option value="created_at">등록일 순</option>
|
|
<option value="completed_at">완료일 순</option>
|
|
<option value="alphabetical">가나다 순</option>
|
|
</select>
|
|
<button onclick="clearCompleted()" class="text-sm text-red-600 hover:text-red-800">
|
|
<i class="fas fa-trash mr-1"></i>완료된 항목 삭제
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 체크리스트 목록 -->
|
|
<div class="bg-white rounded-xl shadow-sm">
|
|
<div class="p-6 border-b">
|
|
<h3 class="text-lg font-semibold text-gray-800">
|
|
<i class="fas fa-list text-green-500 mr-2"></i>체크리스트 목록
|
|
</h3>
|
|
</div>
|
|
|
|
<div id="checklistList" class="divide-y divide-gray-100">
|
|
<!-- 체크리스트 항목들이 여기에 동적으로 추가됩니다 -->
|
|
</div>
|
|
|
|
<div id="emptyState" class="p-12 text-center text-gray-500">
|
|
<i class="fas fa-check-square text-4xl mb-4 opacity-50"></i>
|
|
<p>아직 체크리스트 항목이 없습니다.</p>
|
|
<p class="text-sm">메인 페이지에서 기한 없는 항목을 등록해보세요!</p>
|
|
<button onclick="goBack()" class="mt-4 btn-success px-6 py-2 rounded-lg">
|
|
<i class="fas fa-arrow-left mr-2"></i>메인으로 돌아가기
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
</div>
|
|
|
|
<!-- JavaScript -->
|
|
<script src="static/js/auth.js"></script>
|
|
<script>
|
|
let checklistItems = [];
|
|
|
|
// 페이지 초기화
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
checkAuthStatus();
|
|
loadChecklistItems();
|
|
});
|
|
|
|
// 뒤로 가기
|
|
function goBack() {
|
|
window.location.href = 'index.html';
|
|
}
|
|
|
|
// 체크리스트 항목 로드
|
|
async function loadChecklistItems() {
|
|
try {
|
|
// API에서 체크리스트 카테고리 항목들만 가져오기
|
|
const items = await TodoAPI.getTodos(null, 'checklist');
|
|
console.log('🔍 체크리스트 API 응답 데이터:', items);
|
|
|
|
// 각 항목의 이미지 데이터 확인
|
|
items.forEach((item, index) => {
|
|
console.log(`📋 체크리스트 항목 ${index + 1}:`, {
|
|
id: item.id,
|
|
title: item.title,
|
|
image_urls: item.image_urls,
|
|
image_urls_type: typeof item.image_urls,
|
|
image_urls_length: item.image_urls ? item.image_urls.length : 'null'
|
|
});
|
|
});
|
|
|
|
checklistItems = items;
|
|
} catch (error) {
|
|
console.error('체크리스트 항목 로드 실패:', error);
|
|
checklistItems = [];
|
|
}
|
|
|
|
renderChecklistItems(checklistItems);
|
|
updateProgress();
|
|
}
|
|
|
|
// 체크리스트 항목 렌더링
|
|
function renderChecklistItems(items) {
|
|
const checklistList = document.getElementById('checklistList');
|
|
const emptyState = document.getElementById('emptyState');
|
|
|
|
if (items.length === 0) {
|
|
checklistList.innerHTML = '';
|
|
emptyState.classList.remove('hidden');
|
|
return;
|
|
}
|
|
|
|
emptyState.classList.add('hidden');
|
|
|
|
checklistList.innerHTML = items.map(item => `
|
|
<div class="checklist-item p-6 ${item.completed ? 'completed' : ''}">
|
|
<div class="flex items-start space-x-4">
|
|
<!-- 체크박스 -->
|
|
<div class="flex-shrink-0 mt-1">
|
|
<div class="checkbox-custom ${item.completed ? 'checked' : ''}" onclick="toggleComplete('${item.id}')">
|
|
${item.completed ? '<i class="fas fa-check text-xs"></i>' : ''}
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 사진 (있는 경우) -->
|
|
${item.image_urls && item.image_urls.length > 0 ? `
|
|
<div class="flex-shrink-0">
|
|
<div class="flex space-x-2">
|
|
${item.image_urls.slice(0, 3).map(url => `
|
|
<img src="${url}" class="w-16 h-16 object-cover rounded-lg" alt="첨부 사진">
|
|
`).join('')}
|
|
${item.image_urls.length > 3 ? `
|
|
<div class="w-16 h-16 bg-gray-100 rounded-lg flex items-center justify-center">
|
|
<span class="text-xs text-gray-500">+${item.image_urls.length - 3}</span>
|
|
</div>
|
|
` : ''}
|
|
</div>
|
|
</div>
|
|
` : ''}
|
|
|
|
<!-- 내용 -->
|
|
<div class="flex-1 min-w-0">
|
|
<h4 class="item-content text-gray-900 font-medium mb-2">${item.title}</h4>
|
|
<div class="flex items-center space-x-4 text-sm text-gray-500">
|
|
<span>
|
|
<i class="fas fa-clock mr-1"></i>등록: ${formatDate(item.created_at)}
|
|
</span>
|
|
${item.completed && item.completed_at ? `
|
|
<span class="text-green-600">
|
|
<i class="fas fa-check mr-1"></i>완료: ${formatDate(item.completed_at)}
|
|
</span>
|
|
` : ''}
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 액션 버튼 -->
|
|
<div class="flex-shrink-0 flex space-x-2">
|
|
<!-- 카테고리 변경 버튼 -->
|
|
<div class="relative">
|
|
<button onclick="showCategoryMenu('${item.id}')" class="text-gray-400 hover:text-purple-500" title="카테고리 변경">
|
|
<i class="fas fa-exchange-alt"></i>
|
|
</button>
|
|
<div id="categoryMenu-${item.id}" class="hidden absolute right-0 mt-2 w-48 bg-white rounded-lg shadow-lg border z-10">
|
|
<div class="py-2">
|
|
<button onclick="changeCategory('${item.id}', 'todo')" class="w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-blue-50 hover:text-blue-600">
|
|
<i class="fas fa-calendar-day mr-2 text-blue-500"></i>Todo로 변경
|
|
</button>
|
|
<button onclick="changeCategory('${item.id}', 'calendar')" class="w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-orange-50 hover:text-orange-600">
|
|
<i class="fas fa-calendar-times mr-2 text-orange-500"></i>캘린더로 변경
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<button onclick="editChecklist('${item.id}')" class="text-gray-400 hover:text-blue-500" title="수정하기">
|
|
<i class="fas fa-edit"></i>
|
|
</button>
|
|
<button onclick="deleteChecklist('${item.id}')" class="text-gray-400 hover:text-red-500" title="삭제하기">
|
|
<i class="fas fa-trash"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
`).join('');
|
|
}
|
|
|
|
// 완료 상태 토글
|
|
function toggleComplete(id) {
|
|
const item = checklistItems.find(item => item.id === id);
|
|
if (item) {
|
|
if (!item.completed) {
|
|
// 완료 처리 - 애니메이션 후 제거
|
|
item.completed = true;
|
|
item.completed_at = new Date().toISOString().split('T')[0];
|
|
|
|
// 즉시 완료 상태로 렌더링
|
|
renderChecklistItems(checklistItems);
|
|
updateProgress();
|
|
|
|
// 1.5초 후 항목 제거
|
|
setTimeout(() => {
|
|
const itemIndex = checklistItems.findIndex(i => i.id === id);
|
|
if (itemIndex !== -1) {
|
|
checklistItems.splice(itemIndex, 1);
|
|
renderChecklistItems(checklistItems);
|
|
updateProgress();
|
|
|
|
// 완료 메시지 표시
|
|
showCompletionToast('항목이 완료되었습니다! 🎉');
|
|
}
|
|
}, 1500);
|
|
|
|
// API 호출하여 상태 업데이트
|
|
updateTodoStatus(id, 'completed');
|
|
console.log('체크리스트 완료 처리:', id);
|
|
} else {
|
|
// 완료 취소는 허용하지 않음 (이미 완료된 항목은 제거되므로)
|
|
console.log('완료된 항목은 취소할 수 없습니다.');
|
|
}
|
|
}
|
|
}
|
|
|
|
// Todo 상태 업데이트 (API 호출)
|
|
async function updateTodoStatus(id, status) {
|
|
try {
|
|
const token = localStorage.getItem('authToken');
|
|
if (!token) {
|
|
console.error('인증 토큰이 없습니다!');
|
|
return;
|
|
}
|
|
|
|
const response = await fetch(`http://localhost:9000/api/todos/${id}`, {
|
|
method: 'PUT',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
'Authorization': `Bearer ${token}`
|
|
},
|
|
body: JSON.stringify({ status: status })
|
|
});
|
|
|
|
if (!response.ok) {
|
|
throw new Error(`HTTP error! status: ${response.status}`);
|
|
}
|
|
|
|
console.log(`Todo ${id} 상태가 ${status}로 업데이트되었습니다.`);
|
|
} catch (error) {
|
|
console.error('Todo 상태 업데이트 실패:', error);
|
|
}
|
|
}
|
|
|
|
// 완료 토스트 메시지 표시
|
|
function showCompletionToast(message) {
|
|
// 기존 토스트가 있으면 제거
|
|
const existingToast = document.getElementById('completionToast');
|
|
if (existingToast) {
|
|
existingToast.remove();
|
|
}
|
|
|
|
// 새 토스트 생성
|
|
const toast = document.createElement('div');
|
|
toast.id = 'completionToast';
|
|
toast.className = 'fixed top-4 right-4 bg-green-500 text-white px-6 py-3 rounded-lg shadow-lg z-50 transform transition-all duration-300 translate-x-full';
|
|
toast.innerHTML = `
|
|
<div class="flex items-center space-x-2">
|
|
<i class="fas fa-check-circle"></i>
|
|
<span>${message}</span>
|
|
</div>
|
|
`;
|
|
|
|
document.body.appendChild(toast);
|
|
|
|
// 애니메이션으로 나타나기
|
|
setTimeout(() => {
|
|
toast.classList.remove('translate-x-full');
|
|
}, 100);
|
|
|
|
// 3초 후 사라지기
|
|
setTimeout(() => {
|
|
toast.classList.add('translate-x-full');
|
|
setTimeout(() => {
|
|
if (toast.parentNode) {
|
|
toast.remove();
|
|
}
|
|
}, 300);
|
|
}, 3000);
|
|
}
|
|
|
|
// 진행률 업데이트
|
|
function updateProgress() {
|
|
const total = checklistItems.length;
|
|
const completed = checklistItems.filter(item => item.completed).length;
|
|
const percentage = total > 0 ? Math.round((completed / total) * 100) : 0;
|
|
|
|
document.getElementById('totalCount').textContent = total;
|
|
document.getElementById('completedCount').textContent = completed;
|
|
document.getElementById('progressText').textContent = `${percentage}% 완료`;
|
|
document.getElementById('progressBar').style.width = `${percentage}%`;
|
|
}
|
|
|
|
// 완료된 항목 삭제
|
|
function clearCompleted() {
|
|
if (confirm('완료된 모든 항목을 삭제하시겠습니까?')) {
|
|
checklistItems = checklistItems.filter(item => !item.completed);
|
|
renderChecklistItems(checklistItems);
|
|
updateProgress();
|
|
|
|
// TODO: API 호출하여 완료된 항목들 삭제
|
|
console.log('완료된 항목들 삭제');
|
|
}
|
|
}
|
|
|
|
// 체크리스트 편집
|
|
function editChecklist(id) {
|
|
console.log('체크리스트 편집:', id);
|
|
// TODO: 편집 모달 또는 페이지로 이동
|
|
}
|
|
|
|
// 체크리스트 삭제
|
|
function deleteChecklist(id) {
|
|
if (confirm('이 항목을 삭제하시겠습니까?')) {
|
|
checklistItems = checklistItems.filter(item => item.id !== id);
|
|
renderChecklistItems(checklistItems);
|
|
updateProgress();
|
|
|
|
// TODO: API 호출하여 항목 삭제
|
|
console.log('체크리스트 삭제:', id);
|
|
}
|
|
}
|
|
|
|
// 날짜 포맷팅
|
|
function formatDate(dateString) {
|
|
if (!dateString) return '날짜 없음';
|
|
const date = new Date(dateString);
|
|
if (isNaN(date.getTime())) return '날짜 없음';
|
|
return date.toLocaleDateString('ko-KR');
|
|
}
|
|
|
|
// 필터링
|
|
function filterChecklist(filter) {
|
|
let filteredItems = checklistItems;
|
|
|
|
if (filter === 'active') {
|
|
filteredItems = checklistItems.filter(item => !item.completed);
|
|
} else if (filter === 'completed') {
|
|
filteredItems = checklistItems.filter(item => item.completed);
|
|
}
|
|
|
|
renderChecklistItems(filteredItems);
|
|
|
|
// 필터 탭 활성화 상태 업데이트
|
|
document.querySelectorAll('.filter-tab').forEach(tab => {
|
|
tab.classList.remove('active');
|
|
});
|
|
event.target.classList.add('active');
|
|
|
|
console.log('필터:', filter);
|
|
}
|
|
|
|
// 카테고리 메뉴 표시/숨김
|
|
function showCategoryMenu(itemId) {
|
|
// 다른 메뉴들 숨기기
|
|
document.querySelectorAll('[id^="categoryMenu-"]').forEach(menu => {
|
|
if (menu.id !== `categoryMenu-${itemId}`) {
|
|
menu.classList.add('hidden');
|
|
}
|
|
});
|
|
|
|
// 해당 메뉴 토글
|
|
const menu = document.getElementById(`categoryMenu-${itemId}`);
|
|
if (menu) {
|
|
menu.classList.toggle('hidden');
|
|
}
|
|
}
|
|
|
|
// 카테고리 변경
|
|
async function changeCategory(itemId, newCategory) {
|
|
try {
|
|
// 날짜 입력 받기 (todo나 calendar인 경우)
|
|
let dueDate = null;
|
|
if (newCategory === 'todo' || newCategory === 'calendar') {
|
|
const dateInput = prompt(
|
|
newCategory === 'todo' ?
|
|
'시작 날짜를 입력하세요 (YYYY-MM-DD):' :
|
|
'마감 날짜를 입력하세요 (YYYY-MM-DD):'
|
|
);
|
|
|
|
if (!dateInput) {
|
|
return; // 취소
|
|
}
|
|
|
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(dateInput)) {
|
|
alert('올바른 날짜 형식을 입력해주세요 (YYYY-MM-DD)');
|
|
return;
|
|
}
|
|
|
|
dueDate = dateInput + 'T09:00:00Z';
|
|
}
|
|
|
|
// API 호출하여 카테고리 변경
|
|
const updateData = {
|
|
category: newCategory
|
|
};
|
|
|
|
if (dueDate) {
|
|
updateData.due_date = dueDate;
|
|
}
|
|
|
|
await TodoAPI.updateTodo(itemId, updateData);
|
|
|
|
// 성공 메시지
|
|
const categoryNames = {
|
|
'todo': 'Todo',
|
|
'calendar': '캘린더'
|
|
};
|
|
|
|
alert(`항목이 ${categoryNames[newCategory]}로 이동되었습니다!`);
|
|
|
|
// 메뉴 숨기기
|
|
document.getElementById(`categoryMenu-${itemId}`).classList.add('hidden');
|
|
|
|
// 페이지 새로고침하여 변경된 항목 제거
|
|
await loadChecklistItems();
|
|
|
|
} catch (error) {
|
|
console.error('카테고리 변경 실패:', error);
|
|
alert('카테고리 변경에 실패했습니다.');
|
|
}
|
|
}
|
|
|
|
// 대시보드로 이동
|
|
function goToDashboard() {
|
|
window.location.href = 'dashboard.html';
|
|
}
|
|
|
|
// 전역 함수 등록
|
|
window.goToDashboard = goToDashboard;
|
|
window.showCategoryMenu = showCategoryMenu;
|
|
window.changeCategory = changeCategory;
|
|
|
|
// 문서 클릭 시 메뉴 숨기기
|
|
document.addEventListener('click', (e) => {
|
|
if (!e.target.closest('.relative')) {
|
|
document.querySelectorAll('[id^="categoryMenu-"]').forEach(menu => {
|
|
menu.classList.add('hidden');
|
|
});
|
|
}
|
|
});
|
|
</script>
|
|
<script src="static/js/api.js?v=20250921110800"></script>
|
|
<script src="static/js/auth.js?v=20250921110800"></script>
|
|
</body>
|
|
</html>
|