Todo 관리 시스템 및 공통 네비게이션 구현
- Todo CRUD 기능 구현 (TodoController, TodoModel) - 서버 기반 공통 네비게이션 시스템 구축 - 모든 웹 페이지에 통일된 네비게이션 적용 - Todo 테이블 행 클릭으로 편집 모달 직접 접근 기능 - 네비게이션 메뉴 서버 설정 및 폴백 시스템 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -125,20 +125,6 @@
|
||||
<!-- 네비게이션 메뉴 (동적으로 추가됨) -->
|
||||
|
||||
<div class="container mx-auto px-4 py-8">
|
||||
<!-- 헤더 -->
|
||||
<div class="text-center mb-8 animate-fade-in">
|
||||
<h1 class="text-4xl font-bold text-white mb-2">업무일지</h1>
|
||||
<div class="flex justify-center items-center space-x-4">
|
||||
<button id="refreshBtn" class="glass-effect text-white px-4 py-2 rounded-lg flex items-center hover:bg-white/30 transition-colors">
|
||||
<i data-feather="refresh-cw" class="w-4 h-4 mr-2"></i>
|
||||
새로고침
|
||||
</button>
|
||||
<div class="text-white/80">
|
||||
<span id="currentDate"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 개발중 경고 메시지 -->
|
||||
<div class="bg-orange-500 rounded-lg p-4 mb-6 border-l-4 border-orange-700 animate-slide-up shadow-lg">
|
||||
<div class="flex items-center">
|
||||
@@ -349,50 +335,78 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// 공통 네비게이션 컴포넌트
|
||||
/**
|
||||
* 공통 네비게이션 컴포넌트
|
||||
*/
|
||||
class CommonNavigation {
|
||||
constructor(currentPage = '') {
|
||||
this.currentPage = currentPage;
|
||||
this.menuItems = [];
|
||||
this.init();
|
||||
}
|
||||
|
||||
init() {
|
||||
this.createNavigation();
|
||||
this.addEventListeners();
|
||||
async init() {
|
||||
try {
|
||||
await this.loadMenuItems();
|
||||
this.createNavigation();
|
||||
this.addEventListeners();
|
||||
} catch (error) {
|
||||
console.error('Navigation initialization failed:', error);
|
||||
this.createFallbackNavigation();
|
||||
}
|
||||
}
|
||||
|
||||
async loadMenuItems() {
|
||||
try {
|
||||
const response = await fetch('/Common/GetNavigationMenu');
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
const data = await response.json();
|
||||
|
||||
if (data.Success && data.Data) {
|
||||
this.menuItems = data.Data;
|
||||
} else {
|
||||
throw new Error(data.Message || 'Failed to load menu items');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load navigation menu:', error);
|
||||
this.menuItems = this.getDefaultMenuItems();
|
||||
}
|
||||
}
|
||||
|
||||
getDefaultMenuItems() {
|
||||
return [
|
||||
{ key: 'dashboard', title: '대시보드', url: '/Dashboard/', icon: 'M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2H5a2 2 0 00-2-2z M8 5a2 2 0 012-2h4a2 2 0 012 2v2H8V5z', isVisible: true, sortOrder: 1 },
|
||||
{ key: 'common', title: '공용코드', url: '/Common', icon: 'M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z', isVisible: true, sortOrder: 2 },
|
||||
{ key: 'jobreport', title: '업무일지', url: '/Jobreport/', icon: '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', isVisible: true, sortOrder: 3 },
|
||||
{ key: 'kuntae', title: '근태관리', url: '/Kuntae/', icon: 'M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z', isVisible: true, sortOrder: 4 },
|
||||
{ key: 'todo', title: '할일관리', url: '/Todo/', icon: '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 2M12 12l2 2 4-4', isVisible: true, sortOrder: 5 }
|
||||
];
|
||||
}
|
||||
|
||||
createNavigation() {
|
||||
const nav = document.createElement('nav');
|
||||
nav.className = 'glass-effect border-b border-white/10';
|
||||
nav.style.cssText = `
|
||||
background: rgba(255, 255, 255, 0.25);
|
||||
backdrop-filter: blur(10px);
|
||||
border: 1px solid rgba(255, 255, 255, 0.18);
|
||||
`;
|
||||
nav.innerHTML = this.getNavigationHTML();
|
||||
|
||||
// body의 첫 번째 자식으로 추가
|
||||
document.body.insertBefore(nav, document.body.firstChild);
|
||||
}
|
||||
|
||||
createFallbackNavigation() {
|
||||
this.createNavigation();
|
||||
}
|
||||
|
||||
getNavigationHTML() {
|
||||
const visibleItems = this.menuItems.filter(item => item.isVisible).sort((a, b) => a.sortOrder - b.sortOrder);
|
||||
return `
|
||||
<div class="container mx-auto px-4" style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);">
|
||||
<div class="container mx-auto px-4">
|
||||
<div class="flex items-center justify-between h-16">
|
||||
<!-- 로고/타이틀 -->
|
||||
<div class="flex items-center">
|
||||
<h2 class="text-xl font-bold text-white">GroupWare</h2>
|
||||
</div>
|
||||
|
||||
<!-- 메뉴 -->
|
||||
<div class="hidden md:flex items-center space-x-8">
|
||||
${this.getMenuItemHTML('dashboard', '/Dashboard/', '대시보드', 'M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2H5a2 2 0 00-2-2z M8 5a2 2 0 012-2h4a2 2 0 012 2v2H8V5z')}
|
||||
${this.getMenuItemHTML('common', '/Common', '공용코드', 'M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z')}
|
||||
${this.getMenuItemHTML('jobreport', '/Jobreport/', '업무일지', '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')}
|
||||
${this.getMenuItemHTML('kuntae', '/Kuntae/', '근태관리', 'M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z')}
|
||||
${visibleItems.map(item => this.getMenuItemHTML(item)).join('')}
|
||||
</div>
|
||||
|
||||
<!-- 모바일 메뉴 버튼 -->
|
||||
<div class="md:hidden">
|
||||
<button id="mobile-menu-button" class="text-white/80 hover:text-white transition-colors p-2">
|
||||
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
@@ -401,51 +415,42 @@
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 모바일 메뉴 -->
|
||||
<div id="mobile-menu" class="md:hidden hidden border-t border-white/10 pt-4 pb-4">
|
||||
${this.getMobileMenuItemHTML('dashboard', '/Dashboard/', '대시보드', 'M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2H5a2 2 0 00-2-2z M8 5a2 2 0 012-2h4a2 2 0 012 2v2H8V5z')}
|
||||
${this.getMobileMenuItemHTML('common', '/Common', '공용코드', 'M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z')}
|
||||
${this.getMobileMenuItemHTML('jobreport', '/Jobreport/', '업무일지', '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')}
|
||||
${this.getMobileMenuItemHTML('kuntae', '/Kuntae/', '근태관리', 'M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z')}
|
||||
${visibleItems.map(item => this.getMobileMenuItemHTML(item)).join('')}
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
getMenuItemHTML(pageKey, href, text, svgPath) {
|
||||
const isActive = this.currentPage === pageKey;
|
||||
getMenuItemHTML(item) {
|
||||
const isActive = this.currentPage === item.key;
|
||||
const activeClass = isActive ? 'text-white bg-white/20' : 'text-white/80 hover:text-white hover:bg-white/10';
|
||||
|
||||
return `
|
||||
<a href="${href}" class="${activeClass} transition-colors px-3 py-2 rounded-lg">
|
||||
<a href="${item.url}" class="${activeClass} transition-colors px-3 py-2 rounded-lg">
|
||||
<svg class="w-4 h-4 inline mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="${svgPath}"></path>
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="${item.icon}"></path>
|
||||
</svg>
|
||||
${text}
|
||||
${item.title}
|
||||
</a>
|
||||
`;
|
||||
}
|
||||
|
||||
getMobileMenuItemHTML(pageKey, href, text, svgPath) {
|
||||
const isActive = this.currentPage === pageKey;
|
||||
getMobileMenuItemHTML(item) {
|
||||
const isActive = this.currentPage === item.key;
|
||||
const activeClass = isActive ? 'text-white bg-white/20' : 'text-white/80 hover:text-white hover:bg-white/10';
|
||||
|
||||
return `
|
||||
<a href="${href}" class="block ${activeClass} transition-colors px-3 py-2 rounded-lg mb-2">
|
||||
<a href="${item.url}" class="block ${activeClass} transition-colors px-3 py-2 rounded-lg mb-2">
|
||||
<svg class="w-4 h-4 inline mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="${svgPath}"></path>
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="${item.icon}"></path>
|
||||
</svg>
|
||||
${text}
|
||||
${item.title}
|
||||
</a>
|
||||
`;
|
||||
}
|
||||
|
||||
addEventListeners() {
|
||||
// 모바일 메뉴 토글
|
||||
const mobileMenuButton = document.getElementById('mobile-menu-button');
|
||||
const mobileMenu = document.getElementById('mobile-menu');
|
||||
|
||||
if (mobileMenuButton && mobileMenu) {
|
||||
mobileMenuButton.addEventListener('click', function() {
|
||||
mobileMenu.classList.toggle('hidden');
|
||||
@@ -454,9 +459,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
// 전역 함수로 내비게이션 초기화
|
||||
function initNavigation(currentPage = '') {
|
||||
// DOM이 로드된 후에 실행
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
new CommonNavigation(currentPage);
|
||||
|
||||
Reference in New Issue
Block a user