- 각 HTML 파일에서 machine 프록시를 전역 변수로 한 번만 초기화 - 매 함수 호출마다 hostObjects.machine 접근하던 오버헤드 제거 - 네비게이션 클릭 시 콘솔 로그 추가 (디버깅용) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
948 lines
48 KiB
HTML
948 lines
48 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="ko">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
|
|
<meta http-equiv="Pragma" content="no-cache">
|
|
<meta http-equiv="Expires" content="0">
|
|
<meta name="version" content="v1.0-20250127">
|
|
<title>할일 관리 - {title}</title>
|
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
<script>
|
|
tailwind.config = {
|
|
theme: {
|
|
extend: {
|
|
colors: {
|
|
primary: {
|
|
50: '#eff6ff',
|
|
100: '#dbeafe',
|
|
200: '#bfdbfe',
|
|
300: '#93c5fd',
|
|
400: '#60a5fa',
|
|
500: '#3b82f6',
|
|
600: '#2563eb',
|
|
700: '#1d4ed8',
|
|
800: '#1e40af',
|
|
900: '#1e3a8a',
|
|
},
|
|
success: {
|
|
50: '#f0fdf4',
|
|
100: '#dcfce7',
|
|
200: '#bbf7d0',
|
|
300: '#86efac',
|
|
400: '#4ade80',
|
|
500: '#22c55e',
|
|
600: '#16a34a',
|
|
700: '#15803d',
|
|
800: '#166534',
|
|
900: '#14532d',
|
|
},
|
|
warning: {
|
|
50: '#fffbeb',
|
|
100: '#fef3c7',
|
|
200: '#fde68a',
|
|
300: '#fcd34d',
|
|
400: '#fbbf24',
|
|
500: '#f59e0b',
|
|
600: '#d97706',
|
|
700: '#b45309',
|
|
800: '#92400e',
|
|
900: '#78350f',
|
|
},
|
|
danger: {
|
|
50: '#fef2f2',
|
|
100: '#fee2e2',
|
|
200: '#fecaca',
|
|
300: '#fca5a5',
|
|
400: '#f87171',
|
|
500: '#ef4444',
|
|
600: '#dc2626',
|
|
700: '#b91c1c',
|
|
800: '#991b1b',
|
|
900: '#7f1d1d',
|
|
}
|
|
},
|
|
animation: {
|
|
'fade-in': 'fadeIn 0.5s ease-in-out',
|
|
'slide-up': 'slideUp 0.3s ease-out',
|
|
'pulse-slow': 'pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite',
|
|
},
|
|
keyframes: {
|
|
fadeIn: {
|
|
'0%': { opacity: '0' },
|
|
'100%': { opacity: '1' },
|
|
},
|
|
slideUp: {
|
|
'0%': { transform: 'translateY(10px)', opacity: '0' },
|
|
'100%': { transform: 'translateY(0)', opacity: '1' },
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
<style>
|
|
.glass-effect {
|
|
background: rgba(255, 255, 255, 0.25);
|
|
backdrop-filter: blur(10px);
|
|
border: 1px solid rgba(255, 255, 255, 0.18);
|
|
}
|
|
.gradient-bg {
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
}
|
|
.card-hover {
|
|
transition: all 0.3s ease;
|
|
}
|
|
.card-hover:hover {
|
|
transform: translateY(-5px);
|
|
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
|
}
|
|
|
|
.custom-scrollbar::-webkit-scrollbar {
|
|
width: 8px;
|
|
}
|
|
|
|
.custom-scrollbar::-webkit-scrollbar-track {
|
|
background: rgba(255, 255, 255, 0.1);
|
|
border-radius: 8px;
|
|
}
|
|
|
|
.custom-scrollbar::-webkit-scrollbar-thumb {
|
|
background: rgba(255, 255, 255, 0.3);
|
|
border-radius: 8px;
|
|
border: 2px solid rgba(255, 255, 255, 0.1);
|
|
}
|
|
|
|
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
|
|
background: rgba(255, 255, 255, 0.5);
|
|
}
|
|
</style>
|
|
</head>
|
|
<body class="bg-gradient-to-br from-blue-900 via-purple-900 to-indigo-900 min-h-screen text-white">
|
|
<div class="container mx-auto px-4 py-8">
|
|
<!-- 할일 목록 -->
|
|
<div class="glass-effect rounded-2xl overflow-hidden animate-slide-up">
|
|
<div class="px-6 py-4 border-b border-white/10 flex items-center justify-between">
|
|
<h2 class="text-xl font-semibold text-white flex items-center">
|
|
<svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path>
|
|
</svg>
|
|
내 할일 목록
|
|
</h2>
|
|
<button onclick="showAddTodoModal()" class="bg-primary-500 hover:bg-primary-600 text-white px-4 py-2 rounded-lg transition-colors flex items-center text-sm">
|
|
<svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"></path>
|
|
</svg>
|
|
새 할일 추가
|
|
</button>
|
|
</div>
|
|
|
|
<!-- 탭 메뉴 -->
|
|
<div class="px-6 py-2 border-b border-white/10">
|
|
<div class="flex space-x-1 bg-white/5 rounded-lg p-1">
|
|
<button id="activeTab" onclick="switchTab('active')" class="flex-1 px-4 py-2 text-sm font-medium rounded-md transition-all duration-200 text-white bg-white/20 shadow-sm">
|
|
<div class="flex items-center justify-center space-x-2">
|
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"></path>
|
|
</svg>
|
|
<span>진행중인 할일</span>
|
|
<span id="activeCount" class="px-2 py-0.5 text-xs bg-primary-500/30 text-primary-200 rounded-full">0</span>
|
|
</div>
|
|
</button>
|
|
<button id="completedTab" onclick="switchTab('completed')" class="flex-1 px-4 py-2 text-sm font-medium rounded-md transition-all duration-200 text-white/60 hover:text-white hover:bg-white/10">
|
|
<div class="flex items-center justify-center space-x-2">
|
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
|
</svg>
|
|
<span>완료된 할일</span>
|
|
<span id="completedCount" class="px-2 py-0.5 text-xs bg-success-500/30 text-success-200 rounded-full">0</span>
|
|
</div>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 진행중인 할일 테이블 -->
|
|
<div id="activeTabContent" class="overflow-x-auto">
|
|
<table class="w-full">
|
|
<thead class="bg-white/10">
|
|
<tr>
|
|
<th class="px-6 py-4 text-left text-xs font-medium text-white/70 uppercase tracking-wider">진행상태</th>
|
|
<th class="px-6 py-4 text-left text-xs font-medium text-white/70 uppercase tracking-wider">플래그</th>
|
|
<th class="px-6 py-4 text-left text-xs font-medium text-white/70 uppercase tracking-wider">제목</th>
|
|
<th class="px-6 py-4 text-left text-xs font-medium text-white/70 uppercase tracking-wider">내용</th>
|
|
<th class="px-6 py-4 text-left text-xs font-medium text-white/70 uppercase tracking-wider">요청자</th>
|
|
<th class="px-6 py-4 text-left text-xs font-medium text-white/70 uppercase tracking-wider">중요도</th>
|
|
<th class="px-6 py-4 text-left text-xs font-medium text-white/70 uppercase tracking-wider">만료일</th>
|
|
<th class="px-6 py-4 text-left text-xs font-medium text-white/70 uppercase tracking-wider">작업</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="activeTable" class="divide-y divide-white/10">
|
|
<!-- 진행중인 할일이 여기에 표시됩니다 -->
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<!-- 완료된 할일 테이블 -->
|
|
<div id="completedTabContent" class="overflow-x-auto hidden">
|
|
<table class="w-full">
|
|
<thead class="bg-white/10">
|
|
<tr>
|
|
<th class="px-6 py-4 text-left text-xs font-medium text-white/70 uppercase tracking-wider">진행상태</th>
|
|
<th class="px-6 py-4 text-left text-xs font-medium text-white/70 uppercase tracking-wider">플래그</th>
|
|
<th class="px-6 py-4 text-left text-xs font-medium text-white/70 uppercase tracking-wider">제목</th>
|
|
<th class="px-6 py-4 text-left text-xs font-medium text-white/70 uppercase tracking-wider">내용</th>
|
|
<th class="px-6 py-4 text-left text-xs font-medium text-white/70 uppercase tracking-wider">요청자</th>
|
|
<th class="px-6 py-4 text-left text-xs font-medium text-white/70 uppercase tracking-wider">중요도</th>
|
|
<th class="px-6 py-4 text-left text-xs font-medium text-white/70 uppercase tracking-wider">만료일</th>
|
|
<th class="px-6 py-4 text-left text-xs font-medium text-white/70 uppercase tracking-wider">완료일</th>
|
|
<th class="px-6 py-4 text-left text-xs font-medium text-white/70 uppercase tracking-wider">작업</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="completedTable" class="divide-y divide-white/10">
|
|
<!-- 완료된 할일이 여기에 표시됩니다 -->
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 로딩 인디케이터 -->
|
|
<div id="loadingIndicator" class="fixed top-4 right-4 bg-white/20 backdrop-blur-sm rounded-full px-4 py-2 text-white text-sm hidden">
|
|
<div class="flex items-center">
|
|
<div class="animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"></div>
|
|
처리 중...
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 새 할일 추가 모달 -->
|
|
<div id="addTodoModal" class="fixed inset-0 bg-black/50 backdrop-blur-sm hidden z-50">
|
|
<div class="flex items-center justify-center min-h-screen p-4">
|
|
<div class="glass-effect rounded-2xl w-full max-w-2xl animate-slide-up">
|
|
<!-- 모달 헤더 -->
|
|
<div class="px-6 py-4 border-b border-white/10 flex items-center justify-between">
|
|
<h2 class="text-xl font-semibold text-white flex items-center">
|
|
<svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"></path>
|
|
</svg>
|
|
새 할일 추가
|
|
</h2>
|
|
<button onclick="hideAddTodoModal()" class="text-white/70 hover:text-white transition-colors">
|
|
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
|
|
<!-- 모달 내용 -->
|
|
<div class="p-6">
|
|
<form id="todoForm" class="space-y-4">
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
<div>
|
|
<label class="block text-white/70 text-sm font-medium mb-2">제목 (선택사항)</label>
|
|
<input type="text" id="todoTitle" class="w-full bg-white/20 backdrop-blur-sm border border-white/30 rounded-lg px-4 py-2 text-white placeholder-white/50 focus:outline-none focus:ring-2 focus:ring-primary-400 transition-all" placeholder="할일 제목을 입력하세요">
|
|
</div>
|
|
<div>
|
|
<label class="block text-white/70 text-sm font-medium mb-2">만료일 (선택사항)</label>
|
|
<input type="date" id="todoExpire" class="w-full bg-white/20 backdrop-blur-sm border border-white/30 rounded-lg px-4 py-2 text-white focus:outline-none focus:ring-2 focus:ring-primary-400 transition-all">
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<label class="block text-white/70 text-sm font-medium mb-2">내용 *</label>
|
|
<textarea id="todoRemark" rows="3" class="w-full bg-white/20 backdrop-blur-sm border border-white/30 rounded-lg px-4 py-2 text-white placeholder-white/50 focus:outline-none focus:ring-2 focus:ring-primary-400 transition-all" placeholder="할일 내용을 입력하세요 (필수)" required></textarea>
|
|
</div>
|
|
<div>
|
|
<label class="block text-white/70 text-sm font-medium mb-2">요청자</label>
|
|
<input type="text" id="todoRequest" class="w-full bg-white/20 backdrop-blur-sm border border-white/30 rounded-lg px-4 py-2 text-white placeholder-white/50 focus:outline-none focus:ring-2 focus:ring-primary-400 transition-all" placeholder="업무 요청자를 입력하세요">
|
|
</div>
|
|
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
|
<div>
|
|
<label class="block text-white/70 text-sm font-medium mb-2">진행상태</label>
|
|
<input type="hidden" id="todoStatus" value="0">
|
|
<div class="flex flex-wrap gap-2">
|
|
<button type="button" onclick="setNewTodoStatus('0')" id="newStatusBtn0" class="px-3 py-1 rounded-lg text-xs font-medium bg-gray-500/20 text-gray-300 border border-gray-500/30 transition-all">대기</button>
|
|
<button type="button" onclick="setNewTodoStatus('1')" id="newStatusBtn1" class="px-3 py-1 rounded-lg text-xs font-medium bg-white/10 text-white/50 border border-white/20 hover:bg-primary-500/20 hover:text-primary-300 transition-all">진행</button>
|
|
<button type="button" onclick="setNewTodoStatus('3')" id="newStatusBtn3" class="px-3 py-1 rounded-lg text-xs font-medium bg-white/10 text-white/50 border border-white/20 hover:bg-warning-500/20 hover:text-warning-300 transition-all">보류</button>
|
|
<button type="button" onclick="setNewTodoStatus('2')" id="newStatusBtn2" class="px-3 py-1 rounded-lg text-xs font-medium bg-white/10 text-white/50 border border-white/20 hover:bg-danger-500/20 hover:text-danger-300 transition-all">취소</button>
|
|
<button type="button" onclick="setNewTodoStatus('5')" id="newStatusBtn5" class="px-3 py-1 rounded-lg text-xs font-medium bg-white/10 text-white/50 border border-white/20 hover:bg-success-500/20 hover:text-success-300 transition-all">완료</button>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<label class="block text-white/70 text-sm font-medium mb-2">중요도</label>
|
|
<select id="todoSeqno" class="w-full bg-white/20 backdrop-blur-sm border border-white/30 rounded-lg px-4 py-2 text-white focus:outline-none focus:ring-2 focus:ring-primary-400 transition-all">
|
|
<option value="0">보통</option>
|
|
<option value="1">중요</option>
|
|
<option value="2">매우 중요</option>
|
|
<option value="3">긴급</option>
|
|
</select>
|
|
</div>
|
|
<div class="flex items-end">
|
|
<label class="flex items-center text-white/70 text-sm font-medium">
|
|
<input type="checkbox" id="todoFlag" class="mr-2 text-primary-500 focus:ring-primary-400 focus:ring-offset-0 rounded">
|
|
플래그 (상단 고정)
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<!-- 모달 푸터 -->
|
|
<div class="px-6 py-4 border-t border-white/10 flex justify-end space-x-3">
|
|
<button type="button" onclick="hideAddTodoModal()" class="bg-white/20 hover:bg-white/30 text-white px-4 py-2 rounded-lg transition-colors">
|
|
취소
|
|
</button>
|
|
<button type="submit" form="todoForm" class="bg-primary-500 hover:bg-primary-600 text-white px-6 py-2 rounded-lg transition-colors flex items-center">
|
|
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"></path>
|
|
</svg>
|
|
추가
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 수정 모달 -->
|
|
<div id="editModal" class="fixed inset-0 bg-black/50 backdrop-blur-sm hidden z-50">
|
|
<div class="flex items-center justify-center min-h-screen p-4">
|
|
<div class="glass-effect rounded-2xl w-full max-w-2xl animate-slide-up">
|
|
<!-- 모달 헤더 -->
|
|
<div class="px-6 py-4 border-b border-white/10 flex items-center justify-between">
|
|
<h2 class="text-xl font-semibold text-white flex items-center">
|
|
<svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"></path>
|
|
</svg>
|
|
할일 수정
|
|
</h2>
|
|
<button onclick="hideEditModal()" class="text-white/70 hover:text-white transition-colors">
|
|
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
|
|
<!-- 모달 내용 -->
|
|
<div class="p-6">
|
|
<form id="editTodoForm" class="space-y-4">
|
|
<input type="hidden" id="editTodoId">
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
<div>
|
|
<label class="block text-white/70 text-sm font-medium mb-2">제목 (선택사항)</label>
|
|
<input type="text" id="editTodoTitle" class="w-full bg-white/20 backdrop-blur-sm border border-white/30 rounded-lg px-4 py-2 text-white placeholder-white/50 focus:outline-none focus:ring-2 focus:ring-primary-400 transition-all" placeholder="할일 제목을 입력하세요">
|
|
</div>
|
|
<div>
|
|
<label class="block text-white/70 text-sm font-medium mb-2">만료일 (선택사항)</label>
|
|
<input type="date" id="editTodoExpire" class="w-full bg-white/20 backdrop-blur-sm border border-white/30 rounded-lg px-4 py-2 text-white focus:outline-none focus:ring-2 focus:ring-primary-400 transition-all">
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<label class="block text-white/70 text-sm font-medium mb-2">내용 *</label>
|
|
<textarea id="editTodoRemark" rows="3" class="w-full bg-white/20 backdrop-blur-sm border border-white/30 rounded-lg px-4 py-2 text-white placeholder-white/50 focus:outline-none focus:ring-2 focus:ring-primary-400 transition-all" placeholder="할일 내용을 입력하세요 (필수)" required></textarea>
|
|
</div>
|
|
<div>
|
|
<label class="block text-white/70 text-sm font-medium mb-2">요청자</label>
|
|
<input type="text" id="editTodoRequest" class="w-full bg-white/20 backdrop-blur-sm border border-white/30 rounded-lg px-4 py-2 text-white placeholder-white/50 focus:outline-none focus:ring-2 focus:ring-primary-400 transition-all" placeholder="업무 요청자를 입력하세요">
|
|
</div>
|
|
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
|
<div>
|
|
<label class="block text-white/70 text-sm font-medium mb-2">진행상태</label>
|
|
<input type="hidden" id="editTodoStatus" value="0">
|
|
<div class="flex flex-wrap gap-2">
|
|
<button type="button" onclick="updateTodoStatus('0')" id="editStatusBtn0" class="px-3 py-1 rounded-lg text-xs font-medium bg-white/10 text-white/50 border border-white/20 hover:bg-gray-500/20 hover:text-gray-300 transition-all">대기</button>
|
|
<button type="button" onclick="updateTodoStatus('1')" id="editStatusBtn1" class="px-3 py-1 rounded-lg text-xs font-medium bg-white/10 text-white/50 border border-white/20 hover:bg-primary-500/20 hover:text-primary-300 transition-all">진행</button>
|
|
<button type="button" onclick="updateTodoStatus('3')" id="editStatusBtn3" class="px-3 py-1 rounded-lg text-xs font-medium bg-white/10 text-white/50 border border-white/20 hover:bg-warning-500/20 hover:text-warning-300 transition-all">보류</button>
|
|
<button type="button" onclick="updateTodoStatus('2')" id="editStatusBtn2" class="px-3 py-1 rounded-lg text-xs font-medium bg-white/10 text-white/50 border border-white/20 hover:bg-danger-500/20 hover:text-danger-300 transition-all">취소</button>
|
|
<button type="button" onclick="updateTodoStatus('5')" id="editStatusBtn5" class="px-3 py-1 rounded-lg text-xs font-medium bg-white/10 text-white/50 border border-white/20 hover:bg-success-500/20 hover:text-success-300 transition-all">완료</button>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<label class="block text-white/70 text-sm font-medium mb-2">중요도</label>
|
|
<select id="editTodoSeqno" class="w-full bg-white/20 backdrop-blur-sm border border-white/30 rounded-lg px-4 py-2 text-white focus:outline-none focus:ring-2 focus:ring-primary-400 transition-all">
|
|
<option value="0">보통</option>
|
|
<option value="1">중요</option>
|
|
<option value="2">매우 중요</option>
|
|
<option value="3">긴급</option>
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label class="flex items-center text-white/70 text-sm font-medium mt-6">
|
|
<input type="checkbox" id="editTodoFlag" class="mr-2 text-primary-500 focus:ring-primary-400 focus:ring-offset-0 rounded">
|
|
플래그 (상단 고정)
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<!-- 모달 푸터 -->
|
|
<div class="px-6 py-4 border-t border-white/10 flex justify-end space-x-3">
|
|
<button onclick="hideEditModal()" class="bg-white/20 hover:bg-white/30 text-white px-4 py-2 rounded-lg transition-colors">
|
|
취소
|
|
</button>
|
|
<button onclick="updateTodo()" class="bg-primary-500 hover:bg-primary-600 text-white px-6 py-2 rounded-lg transition-colors">
|
|
수정
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 공통 네비게이션 -->
|
|
<script src="/js/common-navigation.js"></script>
|
|
|
|
<script>
|
|
// Todo 관련 함수들
|
|
let currentEditId = null;
|
|
|
|
// 비동기 프록시 캐싱 (한 번만 초기화)
|
|
const machine = window.chrome.webview.hostObjects.machine;
|
|
|
|
// 할일 목록 로드
|
|
async function loadTodos() {
|
|
showLoading();
|
|
try {
|
|
const jsonStr = await machine.Todo_GetTodos();
|
|
const data = JSON.parse(jsonStr);
|
|
|
|
if (data.Success) {
|
|
displayTodos(data.Data || []);
|
|
} else {
|
|
showError(data.Message || '할일 목록을 불러올 수 없습니다.');
|
|
}
|
|
} catch (error) {
|
|
console.error('할일 목록 로드 중 오류:', error);
|
|
showError('서버 연결에 실패했습니다.');
|
|
} finally {
|
|
hideLoading();
|
|
}
|
|
}
|
|
|
|
// 할일 목록 표시 (탭별로 분리)
|
|
function displayTodos(todos) {
|
|
if (!todos || todos.length === 0) {
|
|
displayEmptyTodos();
|
|
return;
|
|
}
|
|
|
|
// 완료(5)와 진행중(0,1,2,3) 할일 분리
|
|
const activeTodos = todos.filter(todo => (todo.status || '0') !== '5');
|
|
const completedTodos = todos.filter(todo => (todo.status || '0') === '5');
|
|
|
|
// 각 탭에 표시
|
|
displayActiveTodos(activeTodos);
|
|
displayCompletedTodos(completedTodos);
|
|
|
|
// 카운트 업데이트
|
|
document.getElementById('activeCount').textContent = activeTodos.length;
|
|
document.getElementById('completedCount').textContent = completedTodos.length;
|
|
}
|
|
|
|
// 진행중인 할일 표시
|
|
function displayActiveTodos(todos) {
|
|
const tableBody = document.getElementById('activeTable');
|
|
let tableRows = '';
|
|
|
|
if (todos && todos.length > 0) {
|
|
todos.forEach(todo => {
|
|
tableRows += generateTodoRow(todo, false); // 완료일 컬럼 제외
|
|
});
|
|
} else {
|
|
tableRows = `
|
|
<tr>
|
|
<td colspan="8" class="px-6 py-8 text-center text-white/50">
|
|
진행중인 할일이 없습니다
|
|
</td>
|
|
</tr>
|
|
`;
|
|
}
|
|
|
|
tableBody.innerHTML = tableRows;
|
|
}
|
|
|
|
// 완료된 할일 표시
|
|
function displayCompletedTodos(todos) {
|
|
const tableBody = document.getElementById('completedTable');
|
|
let tableRows = '';
|
|
|
|
if (todos && todos.length > 0) {
|
|
todos.forEach(todo => {
|
|
tableRows += generateTodoRow(todo, true); // 완료일 컬럼 포함
|
|
});
|
|
} else {
|
|
tableRows = `
|
|
<tr>
|
|
<td colspan="9" class="px-6 py-8 text-center text-white/50">
|
|
완료된 할일이 없습니다
|
|
</td>
|
|
</tr>
|
|
`;
|
|
}
|
|
|
|
tableBody.innerHTML = tableRows;
|
|
}
|
|
|
|
// 할일 행 생성 (공통 함수)
|
|
function generateTodoRow(todo, includeOkdate = false) {
|
|
const statusClass = getStatusClass(todo.status);
|
|
const statusText = getStatusText(todo.status);
|
|
|
|
const flagClass = todo.flag ? 'bg-warning-500/20 text-warning-300' : 'bg-white/10 text-white/50';
|
|
const flagText = todo.flag ? '고정' : '일반';
|
|
|
|
const seqnoClass = getSeqnoClass(todo.seqno);
|
|
const seqnoText = getSeqnoText(todo.seqno);
|
|
|
|
const expireText = todo.expire ? new Date(todo.expire).toLocaleDateString('ko-KR') : '-';
|
|
const isExpired = todo.expire && new Date(todo.expire) < new Date();
|
|
const expireClass = isExpired ? 'text-danger-400' : 'text-white/80';
|
|
|
|
const okdateText = todo.okdate ? new Date(todo.okdate).toLocaleDateString('ko-KR') : '-';
|
|
const okdateClass = todo.okdate ? 'text-success-400' : 'text-white/80';
|
|
|
|
return `
|
|
<tr class="hover:bg-white/5 transition-colors cursor-pointer" onclick="editTodo(${todo.idx})">
|
|
<td class="px-6 py-4 whitespace-nowrap">
|
|
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${statusClass}">
|
|
${statusText}
|
|
</span>
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap">
|
|
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${flagClass}">
|
|
${flagText}
|
|
</span>
|
|
</td>
|
|
<td class="px-6 py-4 text-white">${todo.title || '제목 없음'}</td>
|
|
<td class="px-6 py-4 text-white/80 max-w-xs truncate">${todo.remark || ''}</td>
|
|
<td class="px-6 py-4 text-white/80">${todo.request || '-'}</td>
|
|
<td class="px-6 py-4 whitespace-nowrap">
|
|
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${seqnoClass}">
|
|
${seqnoText}
|
|
</span>
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap ${expireClass}">${expireText}</td>
|
|
${includeOkdate ? `<td class="px-6 py-4 whitespace-nowrap ${okdateClass}">${okdateText}</td>` : ''}
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm" onclick="event.stopPropagation();">
|
|
<button onclick="editTodo(${todo.idx})" class="text-primary-400 hover:text-primary-300 mr-3 transition-colors">
|
|
수정
|
|
</button>
|
|
<button onclick="deleteTodo(${todo.idx})" class="text-danger-400 hover:text-danger-300 transition-colors">
|
|
삭제
|
|
</button>
|
|
</td>
|
|
</tr>
|
|
`;
|
|
}
|
|
|
|
// 빈 할일 목록 표시
|
|
function displayEmptyTodos() {
|
|
document.getElementById('activeTable').innerHTML = `
|
|
<tr>
|
|
<td colspan="8" class="px-6 py-8 text-center text-white/50">
|
|
진행중인 할일이 없습니다
|
|
</td>
|
|
</tr>
|
|
`;
|
|
document.getElementById('completedTable').innerHTML = `
|
|
<tr>
|
|
<td colspan="9" class="px-6 py-8 text-center text-white/50">
|
|
완료된 할일이 없습니다
|
|
</td>
|
|
</tr>
|
|
`;
|
|
document.getElementById('activeCount').textContent = '0';
|
|
document.getElementById('completedCount').textContent = '0';
|
|
}
|
|
|
|
// 중요도 클래스 반환
|
|
function getSeqnoClass(seqno) {
|
|
switch(seqno) {
|
|
case 1: return 'bg-primary-500/20 text-primary-300';
|
|
case 2: return 'bg-warning-500/20 text-warning-300';
|
|
case 3: return 'bg-danger-500/20 text-danger-300';
|
|
default: return 'bg-white/10 text-white/50';
|
|
}
|
|
}
|
|
|
|
// 중요도 텍스트 반환
|
|
function getSeqnoText(seqno) {
|
|
switch(seqno) {
|
|
case 1: return '중요';
|
|
case 2: return '매우 중요';
|
|
case 3: return '긴급';
|
|
default: return '보통';
|
|
}
|
|
}
|
|
|
|
// 상태 클래스 반환
|
|
function getStatusClass(status) {
|
|
switch(status) {
|
|
case '0': return 'bg-gray-500/20 text-gray-300';
|
|
case '1': return 'bg-primary-500/20 text-primary-300';
|
|
case '2': return 'bg-danger-500/20 text-danger-300';
|
|
case '3': return 'bg-warning-500/20 text-warning-300';
|
|
case '5': return 'bg-success-500/20 text-success-300';
|
|
default: return 'bg-white/10 text-white/50';
|
|
}
|
|
}
|
|
|
|
// 상태 텍스트 반환
|
|
function getStatusText(status) {
|
|
switch(status) {
|
|
case '0': return '대기';
|
|
case '1': return '진행';
|
|
case '2': return '취소';
|
|
case '3': return '보류';
|
|
case '5': return '완료';
|
|
default: return '대기';
|
|
}
|
|
}
|
|
|
|
// 새 할일 추가시 상태 설정
|
|
function setNewTodoStatus(status) {
|
|
const statusInput = document.getElementById('todoStatus');
|
|
if (statusInput) {
|
|
statusInput.value = status;
|
|
}
|
|
|
|
// 모든 버튼 초기화
|
|
['0', '1', '2', '3', '5'].forEach(s => {
|
|
const btn = document.getElementById(`newStatusBtn${s}`);
|
|
if (btn) {
|
|
btn.className = 'px-3 py-1 rounded-lg text-xs font-medium bg-white/10 text-white/50 border border-white/20 hover:bg-white/20 transition-all';
|
|
}
|
|
});
|
|
|
|
// 선택된 버튼 활성화
|
|
const selectedBtn = document.getElementById(`newStatusBtn${status}`);
|
|
if (selectedBtn) {
|
|
const statusClass = getStatusClass(status).replace('bg-', 'bg-').replace('text-', 'text-');
|
|
const borderClass = statusClass.replace('bg-', 'border-').replace('text-', 'border-').replace('/20', '/30');
|
|
selectedBtn.className = `px-3 py-1 rounded-lg text-xs font-medium ${statusClass} ${borderClass} transition-all`;
|
|
}
|
|
}
|
|
|
|
// 편집 모달에서 상태 업데이트 (바로 서버에 반영)
|
|
async function updateTodoStatus(status) {
|
|
if (!currentEditId) return;
|
|
|
|
const title = document.getElementById('editTodoTitle').value;
|
|
const remark = document.getElementById('editTodoRemark').value;
|
|
const expire = document.getElementById('editTodoExpire').value || null;
|
|
const seqno = parseInt(document.getElementById('editTodoSeqno').value);
|
|
const flag = document.getElementById('editTodoFlag').checked;
|
|
const request = document.getElementById('editTodoRequest').value || null;
|
|
|
|
if (!remark.trim()) {
|
|
showError('할일 내용을 입력해주세요.');
|
|
return;
|
|
}
|
|
|
|
showLoading();
|
|
try {
|
|
const jsonStr = await machine.Todo_UpdateTodo(currentEditId, title, remark, expire, seqno, flag, request, status);
|
|
const data = JSON.parse(jsonStr);
|
|
|
|
if (data.Success) {
|
|
// 목록 새로고침
|
|
loadTodos();
|
|
// 모달 닫기
|
|
hideEditModal();
|
|
// 현재 탭 상태 유지
|
|
setTimeout(() => {
|
|
if (typeof maintainCurrentTab === 'function') {
|
|
maintainCurrentTab();
|
|
}
|
|
}, 100);
|
|
showSuccess(`상태가 '${getStatusText(status)}'(으)로 변경되었습니다.`);
|
|
} else {
|
|
showError(data.Message || '상태 변경에 실패했습니다.');
|
|
}
|
|
} catch (error) {
|
|
console.error('상태 변경 중 오류:', error);
|
|
showError('서버 연결에 실패했습니다.');
|
|
} finally {
|
|
hideLoading();
|
|
}
|
|
}
|
|
|
|
// 편집 모달에서 상태 버튼 표시 설정
|
|
function setEditTodoStatus(status) {
|
|
const statusInput = document.getElementById('editTodoStatus');
|
|
if (statusInput) {
|
|
statusInput.value = status;
|
|
}
|
|
|
|
// 모든 버튼 초기화
|
|
['0', '1', '2', '3', '5'].forEach(s => {
|
|
const btn = document.getElementById(`editStatusBtn${s}`);
|
|
if (btn) {
|
|
btn.className = 'px-3 py-1 rounded-lg text-xs font-medium bg-white/10 text-white/50 border border-white/20 hover:bg-white/20 transition-all';
|
|
}
|
|
});
|
|
|
|
// 선택된 버튼 활성화
|
|
const selectedBtn = document.getElementById(`editStatusBtn${status}`);
|
|
if (selectedBtn) {
|
|
const statusClass = getStatusClass(status).replace('bg-', 'bg-').replace('text-', 'text-');
|
|
const borderClass = statusClass.replace('bg-', 'border-').replace('text-', 'border-').replace('/20', '/30');
|
|
selectedBtn.className = `px-3 py-1 rounded-lg text-xs font-medium ${statusClass} ${borderClass} transition-all`;
|
|
}
|
|
}
|
|
|
|
// 새 할일 추가
|
|
async function addTodo() {
|
|
const title = document.getElementById('todoTitle').value;
|
|
const remark = document.getElementById('todoRemark').value;
|
|
const expire = document.getElementById('todoExpire').value || null;
|
|
const seqno = parseInt(document.getElementById('todoSeqno').value);
|
|
const flag = document.getElementById('todoFlag').checked;
|
|
const request = document.getElementById('todoRequest').value || null;
|
|
const status = document.getElementById('todoStatus').value;
|
|
|
|
if (!remark.trim()) {
|
|
showError('할일 내용을 입력해주세요.');
|
|
return;
|
|
}
|
|
|
|
showLoading();
|
|
try {
|
|
const jsonStr = await machine.Todo_CreateTodo(title, remark, expire, seqno, flag, request, status);
|
|
const data = JSON.parse(jsonStr);
|
|
|
|
if (data.Success) {
|
|
hideAddTodoModal();
|
|
loadTodos();
|
|
// 현재 탭 상태 유지
|
|
setTimeout(() => {
|
|
if (typeof maintainCurrentTab === 'function') {
|
|
maintainCurrentTab();
|
|
}
|
|
}, 100);
|
|
showSuccess(data.Message || '할일이 추가되었습니다.');
|
|
} else {
|
|
showError(data.Message || '할일 추가에 실패했습니다.');
|
|
}
|
|
} catch (error) {
|
|
console.error('할일 추가 중 오류:', error);
|
|
showError('서버 연결에 실패했습니다.');
|
|
} finally {
|
|
hideLoading();
|
|
}
|
|
}
|
|
|
|
// 할일 수정 모달 표시
|
|
async function editTodo(id) {
|
|
currentEditId = id;
|
|
showLoading();
|
|
|
|
try {
|
|
const jsonStr = await machine.Todo_GetTodo(id);
|
|
const data = JSON.parse(jsonStr);
|
|
|
|
if (data.Success && data.Data) {
|
|
const todo = data.Data;
|
|
document.getElementById('editTodoId').value = todo.idx;
|
|
document.getElementById('editTodoTitle').value = todo.title || '';
|
|
document.getElementById('editTodoRemark').value = todo.remark || '';
|
|
document.getElementById('editTodoSeqno').value = todo.seqno || 0;
|
|
document.getElementById('editTodoFlag').checked = todo.flag || false;
|
|
document.getElementById('editTodoRequest').value = todo.request || '';
|
|
setEditTodoStatus(todo.status || '0');
|
|
|
|
// 날짜 포맷 변환
|
|
if (todo.expire) {
|
|
const expireDate = new Date(todo.expire);
|
|
document.getElementById('editTodoExpire').value = expireDate.toISOString().split('T')[0];
|
|
} else {
|
|
document.getElementById('editTodoExpire').value = '';
|
|
}
|
|
|
|
showEditModal();
|
|
} else {
|
|
showError(data.Message || '할일 정보를 불러올 수 없습니다.');
|
|
}
|
|
} catch (error) {
|
|
console.error('할일 조회 중 오류:', error);
|
|
showError('서버 연결에 실패했습니다.');
|
|
} finally {
|
|
hideLoading();
|
|
}
|
|
}
|
|
|
|
// 할일 수정
|
|
async function updateTodo() {
|
|
const title = document.getElementById('editTodoTitle').value;
|
|
const remark = document.getElementById('editTodoRemark').value;
|
|
const expire = document.getElementById('editTodoExpire').value || null;
|
|
const seqno = parseInt(document.getElementById('editTodoSeqno').value);
|
|
const flag = document.getElementById('editTodoFlag').checked;
|
|
const request = document.getElementById('editTodoRequest').value || null;
|
|
const status = document.getElementById('editTodoStatus').value;
|
|
|
|
if (!remark.trim()) {
|
|
showError('할일 내용을 입력해주세요.');
|
|
return;
|
|
}
|
|
|
|
showLoading();
|
|
try {
|
|
const jsonStr = await machine.Todo_UpdateTodo(currentEditId, title, remark, expire, seqno, flag, request, status);
|
|
const data = JSON.parse(jsonStr);
|
|
|
|
if (data.Success) {
|
|
hideEditModal();
|
|
loadTodos();
|
|
// 현재 탭 상태 유지
|
|
setTimeout(() => {
|
|
if (typeof maintainCurrentTab === 'function') {
|
|
maintainCurrentTab();
|
|
}
|
|
}, 100);
|
|
showSuccess(data.Message || '할일이 수정되었습니다.');
|
|
} else {
|
|
showError(data.Message || '할일 수정에 실패했습니다.');
|
|
}
|
|
} catch (error) {
|
|
console.error('할일 수정 중 오류:', error);
|
|
showError('서버 연결에 실패했습니다.');
|
|
} finally {
|
|
hideLoading();
|
|
}
|
|
}
|
|
|
|
// 할일 삭제
|
|
async function deleteTodo(id) {
|
|
if (!confirm('정말로 이 할일을 삭제하시겠습니까?')) {
|
|
return;
|
|
}
|
|
|
|
showLoading();
|
|
try {
|
|
const jsonStr = await machine.Todo_DeleteTodo(id);
|
|
const data = JSON.parse(jsonStr);
|
|
|
|
if (data.Success) {
|
|
loadTodos();
|
|
// 현재 탭 상태 유지
|
|
setTimeout(() => {
|
|
if (typeof maintainCurrentTab === 'function') {
|
|
maintainCurrentTab();
|
|
}
|
|
}, 100);
|
|
showSuccess(data.Message || '할일이 삭제되었습니다.');
|
|
} else {
|
|
showError(data.Message || '할일 삭제에 실패했습니다.');
|
|
}
|
|
} catch (error) {
|
|
console.error('할일 삭제 중 오류:', error);
|
|
showError('서버 연결에 실패했습니다.');
|
|
} finally {
|
|
hideLoading();
|
|
}
|
|
}
|
|
|
|
// 새 할일 추가 모달 표시/숨기기
|
|
function showAddTodoModal() {
|
|
document.getElementById('addTodoModal').classList.remove('hidden');
|
|
// 폼 초기화
|
|
document.getElementById('todoForm').reset();
|
|
}
|
|
|
|
function hideAddTodoModal() {
|
|
document.getElementById('addTodoModal').classList.add('hidden');
|
|
}
|
|
|
|
// 수정 모달 표시/숨기기
|
|
function showEditModal() {
|
|
document.getElementById('editModal').classList.remove('hidden');
|
|
}
|
|
|
|
function hideEditModal() {
|
|
document.getElementById('editModal').classList.add('hidden');
|
|
currentEditId = null;
|
|
}
|
|
|
|
// 유틸리티 함수들
|
|
function showLoading() {
|
|
document.getElementById('loadingIndicator').classList.remove('hidden');
|
|
}
|
|
|
|
function hideLoading() {
|
|
document.getElementById('loadingIndicator').classList.add('hidden');
|
|
}
|
|
|
|
function showError(message) {
|
|
alert('오류: ' + message);
|
|
}
|
|
|
|
function showSuccess(message) {
|
|
alert('성공: ' + message);
|
|
}
|
|
|
|
// 이벤트 리스너 등록
|
|
document.getElementById('todoForm').addEventListener('submit', function(e) {
|
|
e.preventDefault();
|
|
addTodo();
|
|
});
|
|
|
|
// ESC 키로 모달 닫기
|
|
document.addEventListener('keydown', function(event) {
|
|
if (event.key === 'Escape') {
|
|
hideAddTodoModal();
|
|
hideEditModal();
|
|
}
|
|
});
|
|
|
|
// 새 할일 추가 모달 외부 클릭으로 닫기
|
|
document.getElementById('addTodoModal').addEventListener('click', function(event) {
|
|
if (event.target === this) {
|
|
hideAddTodoModal();
|
|
}
|
|
});
|
|
|
|
// 수정 모달 외부 클릭으로 닫기
|
|
document.getElementById('editModal').addEventListener('click', function(event) {
|
|
if (event.target === this) {
|
|
hideEditModal();
|
|
}
|
|
});
|
|
|
|
// 탭 전환 기능
|
|
let currentTab = 'active';
|
|
|
|
function switchTab(tabName) {
|
|
// 이전 탭 버튼 스타일 제거
|
|
document.getElementById('activeTab').className = 'flex-1 px-4 py-2 text-sm font-medium rounded-md transition-all duration-200 text-white/60 hover:text-white hover:bg-white/10';
|
|
document.getElementById('completedTab').className = 'flex-1 px-4 py-2 text-sm font-medium rounded-md transition-all duration-200 text-white/60 hover:text-white hover:bg-white/10';
|
|
|
|
// 이전 탭 컨텐츠 숨기기
|
|
document.getElementById('activeTabContent').classList.add('hidden');
|
|
document.getElementById('completedTabContent').classList.add('hidden');
|
|
|
|
// 선택된 탭 버튼 활성화
|
|
if (tabName === 'active') {
|
|
document.getElementById('activeTab').className = 'flex-1 px-4 py-2 text-sm font-medium rounded-md transition-all duration-200 text-white bg-white/20 shadow-sm';
|
|
document.getElementById('activeTabContent').classList.remove('hidden');
|
|
} else {
|
|
document.getElementById('completedTab').className = 'flex-1 px-4 py-2 text-sm font-medium rounded-md transition-all duration-200 text-white bg-white/20 shadow-sm';
|
|
document.getElementById('completedTabContent').classList.remove('hidden');
|
|
}
|
|
|
|
currentTab = tabName;
|
|
}
|
|
|
|
// 할일 상태 변경 후 현재 탭 유지
|
|
function maintainCurrentTab() {
|
|
switchTab(currentTab);
|
|
}
|
|
|
|
|
|
// 페이지 초기화
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
initNavigation('todo');
|
|
loadTodos();
|
|
switchTab('active'); // 기본적으로 진행중 탭 선택
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |