- Todo CRUD 기능 구현 (TodoController, TodoModel) - 서버 기반 공통 네비게이션 시스템 구축 - 모든 웹 페이지에 통일된 네비게이션 적용 - Todo 테이블 행 클릭으로 편집 모달 직접 접근 기능 - 네비게이션 메뉴 서버 설정 및 폴백 시스템 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1087 lines
54 KiB
HTML
1087 lines
54 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">
|
|
<title>업무일지</title>
|
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
|
<script src="https://unpkg.com/feather-icons"></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: var(--scrollbar-width, 16px);
|
|
}
|
|
|
|
.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="gradient-bg min-h-screen">
|
|
<!-- 네비게이션 메뉴 (동적으로 추가됨) -->
|
|
|
|
<div class="container mx-auto px-4 py-8">
|
|
<!-- 개발중 경고 메시지 -->
|
|
<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">
|
|
<svg class="w-5 h-5 text-orange-900 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"></path>
|
|
</svg>
|
|
<div>
|
|
<p class="text-white font-bold text-base">🚧 개발중인 기능입니다</p>
|
|
<p class="text-orange-100 text-sm font-medium">일부 기능이 정상적으로 동작하지 않을 수 있습니다.</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 통계 카드 -->
|
|
<div class="grid grid-cols-1 md:grid-cols-4 gap-6 mb-8 animate-slide-up">
|
|
<div class="glass-effect rounded-lg p-6 card-hover">
|
|
<div class="flex items-center">
|
|
<div class="p-3 bg-primary-500/20 rounded-lg">
|
|
<i data-feather="calendar" class="w-6 h-6 text-white"></i>
|
|
</div>
|
|
<div class="ml-4">
|
|
<p class="text-sm font-medium text-white/80">총 업무일수</p>
|
|
<p id="totalDays" class="text-2xl font-bold text-white">0</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="glass-effect rounded-lg p-6 card-hover">
|
|
<div class="flex items-center">
|
|
<div class="p-3 bg-success-500/20 rounded-lg">
|
|
<i data-feather="clock" class="w-6 h-6 text-white"></i>
|
|
</div>
|
|
<div class="ml-4">
|
|
<p class="text-sm font-medium text-white/80">총 근무시간</p>
|
|
<p id="totalHours" class="text-2xl font-bold text-white">0h</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="glass-effect rounded-lg p-6 card-hover">
|
|
<div class="flex items-center">
|
|
<div class="p-3 bg-warning-500/20 rounded-lg">
|
|
<i data-feather="zap" class="w-6 h-6 text-white"></i>
|
|
</div>
|
|
<div class="ml-4">
|
|
<p class="text-sm font-medium text-white/80">총 초과근무</p>
|
|
<p id="totalOT" class="text-2xl font-bold text-white">0h</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="glass-effect rounded-lg p-6 card-hover">
|
|
<div class="flex items-center">
|
|
<div class="p-3 bg-purple-500/20 rounded-lg">
|
|
<i data-feather="folder" class="w-6 h-6 text-white"></i>
|
|
</div>
|
|
<div class="ml-4">
|
|
<p class="text-sm font-medium text-white/80">진행중 프로젝트</p>
|
|
<p id="activeProjects" class="text-2xl font-bold text-white">0</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 필터 및 검색 -->
|
|
<div class="glass-effect rounded-lg mb-6 animate-slide-up">
|
|
<div class="p-6">
|
|
<div class="flex flex-col md:flex-row md:items-center md:justify-between space-y-4 md:space-y-0">
|
|
<div class="flex flex-col sm:flex-row space-y-2 sm:space-y-0 sm:space-x-4">
|
|
<div>
|
|
<label class="block text-sm font-medium text-white/80 mb-1">조회기간</label>
|
|
<div class="flex space-x-2">
|
|
<input type="date" id="startDate" class="bg-white/20 border border-white/30 rounded-md px-3 py-2 text-white placeholder-white/60 focus:outline-none focus:ring-2 focus:ring-white/50 focus:border-transparent text-sm">
|
|
<span class="flex items-center text-white/60">~</span>
|
|
<input type="date" id="endDate" class="bg-white/20 border border-white/30 rounded-md px-3 py-2 text-white placeholder-white/60 focus:outline-none focus:ring-2 focus:ring-white/50 focus:border-transparent text-sm">
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-white/80 mb-1">상태</label>
|
|
<select id="statusFilter" class="bg-white/20 border border-white/30 rounded-md px-3 py-2 text-white focus:outline-none focus:ring-2 focus:ring-white/50 focus:border-transparent">
|
|
<option value="">전체</option>
|
|
<option value="진행중">진행중</option>
|
|
<option value="완료">완료</option>
|
|
<option value="대기">대기</option>
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-white/80 mb-1">프로젝트</label>
|
|
<select id="projectFilter" class="bg-white/20 border border-white/30 rounded-md px-3 py-2 text-white focus:outline-none focus:ring-2 focus:ring-white/50 focus:border-transparent">
|
|
<option value="">전체</option>
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-white/80 mb-1">검색</label>
|
|
<input type="text" id="searchInput" placeholder="업무 내용 검색..." class="bg-white/20 border border-white/30 rounded-md px-3 py-2 text-white placeholder-white/60 focus:outline-none focus:ring-2 focus:ring-white/50 focus:border-transparent">
|
|
</div>
|
|
</div>
|
|
<div class="flex space-x-2">
|
|
<button id="clearFilterBtn" class="glass-effect hover:bg-white/30 text-white px-4 py-2 rounded-md flex items-center transition-colors">
|
|
<i data-feather="x" class="w-4 h-4 mr-2"></i>
|
|
필터 초기화
|
|
</button>
|
|
<button id="exportBtn" class="glass-effect hover:bg-white/30 text-white px-4 py-2 rounded-md flex items-center transition-colors">
|
|
<i data-feather="download" class="w-4 h-4 mr-2"></i>
|
|
엑셀 다운로드
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 데이터 테이블 -->
|
|
<div class="glass-effect rounded-lg overflow-hidden animate-slide-up custom-scrollbar">
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full divide-y divide-white/20">
|
|
<thead class="bg-white/10">
|
|
<tr>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-white/80 uppercase tracking-wider cursor-pointer hover:bg-white/20 transition-colors" data-sort="pdate">
|
|
날짜 <i data-feather="chevron-down" class="w-4 h-4 inline ml-1"></i>
|
|
</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-white/80 uppercase tracking-wider cursor-pointer hover:bg-white/20 transition-colors" data-sort="status">
|
|
상태 <i data-feather="chevron-down" class="w-4 h-4 inline ml-1"></i>
|
|
</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-white/80 uppercase tracking-wider cursor-pointer hover:bg-white/20 transition-colors" data-sort="projectName">
|
|
프로젝트명 <i data-feather="chevron-down" class="w-4 h-4 inline ml-1"></i>
|
|
</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-white/80 uppercase tracking-wider cursor-pointer hover:bg-white/20 transition-colors" data-sort="requestpart">
|
|
요청부서 <i data-feather="chevron-down" class="w-4 h-4 inline ml-1"></i>
|
|
</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-white/80 uppercase tracking-wider cursor-pointer hover:bg-white/20 transition-colors" data-sort="package">
|
|
패키지 <i data-feather="chevron-down" class="w-4 h-4 inline ml-1"></i>
|
|
</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-white/80 uppercase tracking-wider cursor-pointer hover:bg-white/20 transition-colors" data-sort="type">
|
|
타입 <i data-feather="chevron-down" class="w-4 h-4 inline ml-1"></i>
|
|
</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-white/80 uppercase tracking-wider cursor-pointer hover:bg-white/20 transition-colors" data-sort="process">
|
|
프로세스 <i data-feather="chevron-down" class="w-4 h-4 inline ml-1"></i>
|
|
</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-white/80 uppercase tracking-wider">업무내용</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-white/80 uppercase tracking-wider cursor-pointer hover:bg-white/20 transition-colors" data-sort="hrs">
|
|
근무시간 <i data-feather="chevron-down" class="w-4 h-4 inline ml-1"></i>
|
|
</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-white/80 uppercase tracking-wider cursor-pointer hover:bg-white/20 transition-colors" data-sort="ot">
|
|
초과근무 <i data-feather="chevron-down" class="w-4 h-4 inline ml-1"></i>
|
|
</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-white/80 uppercase tracking-wider">초과근무 시간</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="jobTableBody" class="divide-y divide-white/10">
|
|
<!-- 데이터가 여기에 동적으로 로드됩니다 -->
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- 로딩 상태 -->
|
|
<div id="loadingState" class="hidden p-8 text-center">
|
|
<div class="inline-flex items-center">
|
|
<svg class="animate-spin -ml-1 mr-3 h-5 w-5 text-white" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
|
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
|
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
|
|
</svg>
|
|
<span class="text-white/80">데이터를 불러오는 중...</span>
|
|
</div>
|
|
</div>
|
|
<!-- 빈 상태 -->
|
|
<div id="emptyState" class="hidden p-8 text-center">
|
|
<i data-feather="inbox" class="w-12 h-12 text-white/60 mx-auto mb-4"></i>
|
|
<p class="text-white/70">업무일지 데이터가 없습니다.</p>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<!-- 페이지네이션 -->
|
|
<div id="pagination" class="mt-6 flex items-center justify-between glass-effect rounded-lg p-4">
|
|
<div class="flex items-center space-x-2">
|
|
<span class="text-sm text-white/80">페이지당 행 수:</span>
|
|
<select id="pageSize" class="bg-white/20 border border-white/30 rounded-md px-2 py-1 text-sm text-white">
|
|
<option value="10">10</option>
|
|
<option value="25" selected>25</option>
|
|
<option value="50">50</option>
|
|
<option value="100">100</option>
|
|
</select>
|
|
</div>
|
|
<div class="flex items-center space-x-2">
|
|
<button id="prevPage" class="px-3 py-1 border border-white/30 rounded-md text-sm text-white hover:bg-white/20 transition-colors disabled:opacity-50 disabled:cursor-not-allowed">
|
|
이전
|
|
</button>
|
|
<span id="pageInfo" class="text-sm text-white/80">1 / 1</span>
|
|
<button id="nextPage" class="px-3 py-1 border border-white/30 rounded-md text-sm text-white hover:bg-white/20 transition-colors disabled:opacity-50 disabled:cursor-not-allowed">
|
|
다음
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 상세 모달 -->
|
|
<div id="detailModal" class="fixed inset-0 bg-gray-600 bg-opacity-50 overflow-y-auto h-full w-full hidden z-50">
|
|
<div class="relative top-20 mx-auto p-5 border w-11/12 md:w-3/4 lg:w-1/2 shadow-lg rounded-md bg-white">
|
|
<div class="mt-3">
|
|
<div class="flex items-center justify-between mb-4">
|
|
<h3 class="text-lg font-medium text-gray-900">업무 상세정보</h3>
|
|
<button id="closeModal" class="text-gray-400 hover:text-gray-600">
|
|
<i data-feather="x" class="w-6 h-6"></i>
|
|
</button>
|
|
</div>
|
|
<div id="modalContent" class="space-y-4">
|
|
<!-- 모달 내용이 여기에 동적으로 로드됩니다 -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
/**
|
|
* 공통 네비게이션 컴포넌트
|
|
*/
|
|
class CommonNavigation {
|
|
constructor(currentPage = '') {
|
|
this.currentPage = currentPage;
|
|
this.menuItems = [];
|
|
this.init();
|
|
}
|
|
|
|
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.innerHTML = this.getNavigationHTML();
|
|
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">
|
|
<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">
|
|
${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">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div id="mobile-menu" class="md:hidden hidden border-t border-white/10 pt-4 pb-4">
|
|
${visibleItems.map(item => this.getMobileMenuItemHTML(item)).join('')}
|
|
</div>
|
|
</div>
|
|
`;
|
|
}
|
|
|
|
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="${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="${item.icon}"></path>
|
|
</svg>
|
|
${item.title}
|
|
</a>
|
|
`;
|
|
}
|
|
|
|
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="${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="${item.icon}"></path>
|
|
</svg>
|
|
${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');
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
function initNavigation(currentPage = '') {
|
|
if (document.readyState === 'loading') {
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
new CommonNavigation(currentPage);
|
|
});
|
|
} else {
|
|
new CommonNavigation(currentPage);
|
|
}
|
|
}
|
|
|
|
// 전역 변수
|
|
let jobData = [];
|
|
let filteredData = [];
|
|
let currentPage = 1;
|
|
let pageSize = 25;
|
|
let sortColumn = 'pdate';
|
|
let sortDirection = 'desc';
|
|
|
|
// 초기화
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// 네비게이션 초기화
|
|
initNavigation('jobreport');
|
|
initializeApp();
|
|
loadJobData();
|
|
});
|
|
|
|
function initializeApp() {
|
|
// 현재 날짜 표시
|
|
const now = new Date();
|
|
document.getElementById('currentDate').textContent = now.toLocaleDateString('ko-KR', {
|
|
year: 'numeric',
|
|
month: 'long',
|
|
day: 'numeric',
|
|
weekday: 'long'
|
|
});
|
|
|
|
// 조회기간 기본값 설정 (이번 달)
|
|
const currentMonth = new Date(now.getFullYear(), now.getMonth(), 1);
|
|
const lastDayOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0);
|
|
|
|
document.getElementById('startDate').value = currentMonth.toISOString().split('T')[0];
|
|
document.getElementById('endDate').value = lastDayOfMonth.toISOString().split('T')[0];
|
|
|
|
// 이벤트 리스너 등록
|
|
document.getElementById('refreshBtn').addEventListener('click', loadJobData);
|
|
document.getElementById('startDate').addEventListener('change', loadJobData);
|
|
document.getElementById('endDate').addEventListener('change', loadJobData);
|
|
document.getElementById('statusFilter').addEventListener('change', filterData);
|
|
document.getElementById('projectFilter').addEventListener('change', filterData);
|
|
document.getElementById('searchInput').addEventListener('input', filterData);
|
|
document.getElementById('clearFilterBtn').addEventListener('click', clearFilters);
|
|
document.getElementById('pageSize').addEventListener('change', function() {
|
|
pageSize = parseInt(this.value);
|
|
currentPage = 1;
|
|
renderTable();
|
|
});
|
|
document.getElementById('prevPage').addEventListener('click', function() {
|
|
if (currentPage > 1) {
|
|
currentPage--;
|
|
renderTable();
|
|
}
|
|
});
|
|
document.getElementById('nextPage').addEventListener('click', function() {
|
|
const maxPage = Math.ceil(filteredData.length / pageSize);
|
|
if (currentPage < maxPage) {
|
|
currentPage++;
|
|
renderTable();
|
|
}
|
|
});
|
|
document.getElementById('exportBtn').addEventListener('click', exportToExcel);
|
|
document.getElementById('closeModal').addEventListener('click', closeModal);
|
|
|
|
// 정렬 이벤트 리스너
|
|
document.querySelectorAll('[data-sort]').forEach(th => {
|
|
th.addEventListener('click', function() {
|
|
const column = this.getAttribute('data-sort');
|
|
if (sortColumn === column) {
|
|
sortDirection = sortDirection === 'asc' ? 'desc' : 'asc';
|
|
} else {
|
|
sortColumn = column;
|
|
sortDirection = 'asc';
|
|
}
|
|
sortData();
|
|
renderTable();
|
|
});
|
|
});
|
|
|
|
// 모달 외부 클릭 시 닫기
|
|
document.getElementById('detailModal').addEventListener('click', function(e) {
|
|
if (e.target === this) {
|
|
closeModal();
|
|
}
|
|
});
|
|
|
|
// Feather 아이콘 초기화
|
|
feather.replace();
|
|
}
|
|
|
|
async function loadJobData() {
|
|
showLoading(true);
|
|
try {
|
|
// 조회기간 파라미터 가져오기
|
|
const startDate = document.getElementById('startDate').value;
|
|
const endDate = document.getElementById('endDate').value;
|
|
|
|
// API URL 구성
|
|
let url = '/DashBoard/GetJobData';
|
|
const params = new URLSearchParams();
|
|
if (startDate) params.append('startDate', startDate);
|
|
if (endDate) params.append('endDate', endDate);
|
|
|
|
if (params.toString()) {
|
|
url += '?' + params.toString();
|
|
}
|
|
|
|
const response = await fetch(url);
|
|
if (!response.ok) {
|
|
throw new Error('데이터를 불러오는데 실패했습니다.');
|
|
}
|
|
jobData = await response.json();
|
|
filteredData = [...jobData];
|
|
|
|
updateStatistics();
|
|
updateProjectFilter();
|
|
sortData();
|
|
renderTable();
|
|
// 확장된 행들 닫기
|
|
closeAllExpandedRows();
|
|
} catch (error) {
|
|
console.error('Error loading job data:', error);
|
|
showError('데이터를 불러오는데 실패했습니다: ' + error.message);
|
|
} finally {
|
|
showLoading(false);
|
|
}
|
|
}
|
|
|
|
function updateStatistics() {
|
|
const totalDays = new Set(jobData.map(item => item.pdate)).size;
|
|
const totalHours = jobData.reduce((sum, item) => sum + (parseFloat(item.hrs) || 0), 0);
|
|
const totalOT = jobData.reduce((sum, item) => sum + (parseFloat(item.ot) || 0), 0);
|
|
const activeProjects = new Set(jobData.filter(item => item.status === '진행중').map(item => item.projectName)).size;
|
|
|
|
document.getElementById('totalDays').textContent = totalDays;
|
|
document.getElementById('totalHours').textContent = totalHours.toFixed(1) + 'h';
|
|
document.getElementById('totalOT').textContent = totalOT.toFixed(1) + 'h';
|
|
document.getElementById('activeProjects').textContent = activeProjects;
|
|
}
|
|
|
|
function updateProjectFilter() {
|
|
const projectSelect = document.getElementById('projectFilter');
|
|
const projects = [...new Set(jobData.map(item => item.projectName).filter(Boolean))];
|
|
|
|
// 기존 옵션 제거 (전체 옵션 제외)
|
|
while (projectSelect.children.length > 1) {
|
|
projectSelect.removeChild(projectSelect.lastChild);
|
|
}
|
|
|
|
// 새 옵션 추가
|
|
projects.forEach(project => {
|
|
const option = document.createElement('option');
|
|
option.value = project;
|
|
option.textContent = project;
|
|
projectSelect.appendChild(option);
|
|
});
|
|
}
|
|
|
|
function filterData() {
|
|
const statusFilter = document.getElementById('statusFilter').value;
|
|
const projectFilter = document.getElementById('projectFilter').value;
|
|
const searchTerm = document.getElementById('searchInput').value.toLowerCase();
|
|
|
|
filteredData = jobData.filter(item => {
|
|
const statusMatch = !statusFilter || item.status === statusFilter;
|
|
const projectMatch = !projectFilter || item.projectName === projectFilter;
|
|
const searchMatch = !searchTerm ||
|
|
(item.description && item.description.toLowerCase().includes(searchTerm)) ||
|
|
(item.projectName && item.projectName.toLowerCase().includes(searchTerm)) ||
|
|
(item.requestpart && item.requestpart.toLowerCase().includes(searchTerm));
|
|
|
|
return statusMatch && projectMatch && searchMatch;
|
|
});
|
|
|
|
currentPage = 1;
|
|
sortData();
|
|
renderTable();
|
|
}
|
|
|
|
function sortData() {
|
|
filteredData.sort((a, b) => {
|
|
let aVal = a[sortColumn];
|
|
let bVal = b[sortColumn];
|
|
|
|
// 날짜 정렬
|
|
if (sortColumn === 'pdate') {
|
|
aVal = new Date(aVal);
|
|
bVal = new Date(bVal);
|
|
}
|
|
// 숫자 정렬
|
|
else if (['hrs', 'ot'].includes(sortColumn)) {
|
|
aVal = parseFloat(aVal) || 0;
|
|
bVal = parseFloat(bVal) || 0;
|
|
}
|
|
// 문자열 정렬
|
|
else {
|
|
aVal = (aVal || '').toString().toLowerCase();
|
|
bVal = (bVal || '').toString().toLowerCase();
|
|
}
|
|
|
|
if (aVal < bVal) return sortDirection === 'asc' ? -1 : 1;
|
|
if (aVal > bVal) return sortDirection === 'asc' ? 1 : -1;
|
|
return 0;
|
|
});
|
|
}
|
|
|
|
function renderTable() {
|
|
const tbody = document.getElementById('jobTableBody');
|
|
const startIndex = (currentPage - 1) * pageSize;
|
|
const endIndex = startIndex + pageSize;
|
|
const pageData = filteredData.slice(startIndex, endIndex);
|
|
|
|
if (pageData.length === 0) {
|
|
showEmptyState();
|
|
return;
|
|
}
|
|
|
|
hideEmptyState();
|
|
tbody.innerHTML = '';
|
|
|
|
pageData.forEach((item, index) => {
|
|
const row = document.createElement('tr');
|
|
row.className = 'hover:bg-white/10 cursor-pointer transition-colors';
|
|
row.setAttribute('data-item-id', item.idx || index);
|
|
row.addEventListener('click', () => toggleRowDetail(item, row));
|
|
|
|
const statusColor = getStatusColor(item.status);
|
|
const otTime = item.otStart && item.otEnd ?
|
|
`${item.otStart} ~ ${item.otEnd}` : '-';
|
|
|
|
row.innerHTML = `
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-white">
|
|
<div class="flex items-center">
|
|
<i data-feather="chevron-right" class="w-4 h-4 mr-2 text-white/60 expand-icon"></i>
|
|
${formatDate(item.pdate)}
|
|
</div>
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap">
|
|
<span class="inline-flex px-2 py-1 text-xs font-semibold rounded-full ${statusColor}">
|
|
${item.status || '-'}
|
|
</span>
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-white">
|
|
${item.projectName || '-'}
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-white">
|
|
${item.requestpart || '-'}
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-white">
|
|
${item.package || '-'}
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-white">
|
|
${item.type || '-'}
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-white">
|
|
${item.process || '-'}
|
|
</td>
|
|
<td class="px-6 py-4 text-sm text-white">
|
|
<div class="max-w-xs truncate cursor-pointer hover:text-white/80 hover:underline"
|
|
title="${item.description || ''}"
|
|
onclick="event.stopPropagation(); showDetailModal(${JSON.stringify(item).replace(/"/g, '"')})">
|
|
${item.description || '-'}
|
|
</div>
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-white">
|
|
${item.hrs ? parseFloat(item.hrs).toFixed(1) + 'h' : '-'}
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-white">
|
|
${item.ot ? parseFloat(item.ot).toFixed(1) + 'h' : '-'}
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-white">
|
|
${otTime}
|
|
</td>
|
|
`;
|
|
|
|
tbody.appendChild(row);
|
|
|
|
// 확장 행 추가 (숨겨진 상태)
|
|
const expandRow = document.createElement('tr');
|
|
expandRow.className = 'hidden expand-row';
|
|
expandRow.setAttribute('data-parent-id', item.idx || index);
|
|
expandRow.innerHTML = `
|
|
<td colspan="11" class="px-6 py-4 bg-gray-50 border-t border-gray-200">
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-2">업무내용</label>
|
|
<div class="bg-white rounded-lg p-4 cursor-pointer hover:bg-gray-100 transition-colors border"
|
|
onclick="showDetailModal(${JSON.stringify(item).replace(/"/g, '"')})">
|
|
<p class="text-sm text-gray-900 whitespace-pre-wrap">${item.description || '-'}</p>
|
|
<div class="mt-2 text-xs text-gray-500 flex items-center">
|
|
<i data-feather="maximize-2" class="w-4 h-4 mr-1"></i>
|
|
클릭하여 전체 내용 보기
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
`;
|
|
|
|
tbody.appendChild(expandRow);
|
|
});
|
|
|
|
updatePagination();
|
|
feather.replace();
|
|
}
|
|
|
|
function getStatusColor(status) {
|
|
switch (status) {
|
|
case '진행 중': return 'bg-blue-100 text-blue-800';
|
|
case '진행 완료': return 'bg-green-100 text-green-800';
|
|
case '대기': return 'bg-yellow-100 text-yellow-800';
|
|
default: return 'bg-gray-100 text-gray-800';
|
|
}
|
|
}
|
|
|
|
function formatDate(dateString) {
|
|
if (!dateString) return '-';
|
|
const date = new Date(dateString);
|
|
return date.toLocaleDateString('ko-KR');
|
|
}
|
|
|
|
function updatePagination() {
|
|
const maxPage = Math.ceil(filteredData.length / pageSize);
|
|
const startItem = (currentPage - 1) * pageSize + 1;
|
|
const endItem = Math.min(currentPage * pageSize, filteredData.length);
|
|
|
|
document.getElementById('pageInfo').textContent = `${currentPage} / ${maxPage}`;
|
|
document.getElementById('prevPage').disabled = currentPage <= 1;
|
|
document.getElementById('nextPage').disabled = currentPage >= maxPage;
|
|
}
|
|
|
|
function showDetailModal(item) {
|
|
// 문자열로 전달된 경우 JSON 파싱
|
|
if (typeof item === 'string') {
|
|
try {
|
|
item = JSON.parse(item);
|
|
} catch (e) {
|
|
console.error('Error parsing item:', e);
|
|
return;
|
|
}
|
|
}
|
|
|
|
const modal = document.getElementById('detailModal');
|
|
const content = document.getElementById('modalContent');
|
|
|
|
content.innerHTML = `
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">날짜</label>
|
|
<p class="mt-1 text-sm text-gray-900">${formatDate(item.pdate)}</p>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">상태</label>
|
|
<p class="mt-1">
|
|
<span class="inline-flex px-2 py-1 text-xs font-semibold rounded-full ${getStatusColor(item.status)}">
|
|
${item.status || '-'}
|
|
</span>
|
|
</p>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">프로젝트명</label>
|
|
<p class="mt-1 text-sm text-gray-900">${item.projectName || '-'}</p>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">요청부서</label>
|
|
<p class="mt-1 text-sm text-gray-900">${item.requestpart || '-'}</p>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">패키지</label>
|
|
<p class="mt-1 text-sm text-gray-900">${item.package || '-'}</p>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">타입</label>
|
|
<p class="mt-1 text-sm text-gray-900">${item.type || '-'}</p>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">프로세스</label>
|
|
<p class="mt-1 text-sm text-gray-900">${item.process || '-'}</p>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">근무시간</label>
|
|
<p class="mt-1 text-sm text-gray-900">${item.hrs ? parseFloat(item.hrs).toFixed(1) + 'h' : '-'}</p>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">초과근무</label>
|
|
<p class="mt-1 text-sm text-gray-900">${item.ot ? parseFloat(item.ot).toFixed(1) + 'h' : '-'}</p>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">초과근무 시간</label>
|
|
<p class="mt-1 text-sm text-gray-900">${item.otStart && item.otEnd ? `${item.otStart} ~ ${item.otEnd}` : '-'}</p>
|
|
</div>
|
|
</div>
|
|
<div class="mt-4">
|
|
<label class="block text-sm font-medium text-gray-700">업무내용</label>
|
|
<p class="mt-1 text-sm text-gray-900 whitespace-pre-wrap">${item.description || '-'}</p>
|
|
</div>
|
|
`;
|
|
|
|
modal.classList.remove('hidden');
|
|
feather.replace();
|
|
}
|
|
|
|
function closeModal() {
|
|
document.getElementById('detailModal').classList.add('hidden');
|
|
}
|
|
|
|
function showSelectedJobDetail(item) {
|
|
const detailContainer = document.getElementById('selectedJobDetail');
|
|
const contentContainer = document.getElementById('selectedJobContent');
|
|
|
|
// 기존 선택된 행의 스타일 제거
|
|
document.querySelectorAll('#jobTableBody tr').forEach(row => {
|
|
row.classList.remove('bg-blue-50', 'border-l-4', 'border-blue-500');
|
|
});
|
|
|
|
// 현재 행에 선택 스타일 적용
|
|
const currentRow = event.target.closest('tr');
|
|
if (currentRow) {
|
|
currentRow.classList.add('bg-blue-50', 'border-l-4', 'border-blue-500');
|
|
}
|
|
|
|
contentContainer.innerHTML = `
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">날짜</label>
|
|
<p class="mt-1 text-sm text-gray-900">${formatDate(item.pdate)}</p>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">상태</label>
|
|
<p class="mt-1">
|
|
<span class="inline-flex px-2 py-1 text-xs font-semibold rounded-full ${getStatusColor(item.status)}">
|
|
${item.status || '-'}
|
|
</span>
|
|
</p>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">프로젝트명</label>
|
|
<p class="mt-1 text-sm text-gray-900">${item.projectName || '-'}</p>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">요청부서</label>
|
|
<p class="mt-1 text-sm text-gray-900">${item.requestpart || '-'}</p>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">패키지</label>
|
|
<p class="mt-1 text-sm text-gray-900">${item.package || '-'}</p>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">타입</label>
|
|
<p class="mt-1 text-sm text-gray-900">${item.type || '-'}</p>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">프로세스</label>
|
|
<p class="mt-1 text-sm text-gray-900">${item.process || '-'}</p>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">근무시간</label>
|
|
<p class="mt-1 text-sm text-gray-900">${item.hrs ? parseFloat(item.hrs).toFixed(1) + 'h' : '-'}</p>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">초과근무</label>
|
|
<p class="mt-1 text-sm text-gray-900">${item.ot ? parseFloat(item.ot).toFixed(1) + 'h' : '-'}</p>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">초과근무 시간</label>
|
|
<p class="mt-1 text-sm text-gray-900">${item.otStart && item.otEnd ? `${item.otStart} ~ ${item.otEnd}` : '-'}</p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-2">업무내용</label>
|
|
<div class="bg-gray-50 rounded-lg p-4 cursor-pointer hover:bg-gray-100 transition-colors"
|
|
onclick="showDetailModal(${JSON.stringify(item).replace(/"/g, '"')})">
|
|
<p class="text-sm text-gray-900 whitespace-pre-wrap">${item.description || '-'}</p>
|
|
<div class="mt-2 text-xs text-gray-500 flex items-center">
|
|
<i data-feather="maximize-2" class="w-4 h-4 mr-1"></i>
|
|
클릭하여 전체 내용 보기
|
|
</div>
|
|
</div>
|
|
</div>
|
|
`;
|
|
|
|
detailContainer.classList.remove('hidden');
|
|
feather.replace();
|
|
|
|
// 부드러운 스크롤로 상세 내용으로 이동
|
|
detailContainer.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
|
}
|
|
|
|
function toggleRowDetail(item, row) {
|
|
const itemId = item.idx || row.getAttribute('data-item-id');
|
|
const expandRow = document.querySelector(`tr[data-parent-id="${itemId}"]`);
|
|
const expandIcon = row.querySelector('.expand-icon');
|
|
|
|
if (expandRow.classList.contains('hidden')) {
|
|
// 확장
|
|
expandRow.classList.remove('hidden');
|
|
expandIcon.setAttribute('data-feather', 'chevron-down');
|
|
row.classList.add('bg-blue-50');
|
|
} else {
|
|
// 축소
|
|
expandRow.classList.add('hidden');
|
|
expandIcon.setAttribute('data-feather', 'chevron-right');
|
|
row.classList.remove('bg-blue-50');
|
|
}
|
|
|
|
// 아이콘 업데이트
|
|
feather.replace();
|
|
}
|
|
|
|
function closeAllExpandedRows() {
|
|
document.querySelectorAll('.expand-row').forEach(row => {
|
|
row.classList.add('hidden');
|
|
});
|
|
|
|
document.querySelectorAll('#jobTableBody tr').forEach(row => {
|
|
if (!row.classList.contains('expand-row')) {
|
|
row.classList.remove('bg-blue-50');
|
|
const icon = row.querySelector('.expand-icon');
|
|
if (icon) {
|
|
icon.setAttribute('data-feather', 'chevron-right');
|
|
}
|
|
}
|
|
});
|
|
|
|
feather.replace();
|
|
}
|
|
|
|
function showLoading(show) {
|
|
const loadingState = document.getElementById('loadingState');
|
|
const tableBody = document.getElementById('jobTableBody');
|
|
|
|
if (show) {
|
|
loadingState.classList.remove('hidden');
|
|
tableBody.style.display = 'none';
|
|
} else {
|
|
loadingState.classList.add('hidden');
|
|
tableBody.style.display = 'table-row-group';
|
|
}
|
|
}
|
|
|
|
function showEmptyState() {
|
|
document.getElementById('emptyState').classList.remove('hidden');
|
|
document.getElementById('jobTableBody').style.display = 'none';
|
|
}
|
|
|
|
function hideEmptyState() {
|
|
document.getElementById('emptyState').classList.add('hidden');
|
|
document.getElementById('jobTableBody').style.display = 'table-row-group';
|
|
}
|
|
|
|
function showError(message) {
|
|
// 간단한 에러 알림 (실제 구현에서는 더 나은 알림 시스템 사용)
|
|
alert(message);
|
|
}
|
|
|
|
function clearFilters() {
|
|
// 조회기간을 이번 달로 초기화
|
|
const now = new Date();
|
|
const currentMonth = new Date(now.getFullYear(), now.getMonth(), 1);
|
|
const lastDayOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0);
|
|
|
|
document.getElementById('startDate').value = currentMonth.toISOString().split('T')[0];
|
|
document.getElementById('endDate').value = lastDayOfMonth.toISOString().split('T')[0];
|
|
|
|
// 다른 필터들 초기화
|
|
document.getElementById('statusFilter').value = '';
|
|
document.getElementById('projectFilter').value = '';
|
|
document.getElementById('searchInput').value = '';
|
|
|
|
// 서버에서 새로운 데이터 가져오기
|
|
loadJobData();
|
|
// 확장된 행들 닫기
|
|
closeAllExpandedRows();
|
|
}
|
|
|
|
function exportToExcel() {
|
|
if (filteredData.length === 0) {
|
|
alert('내보낼 데이터가 없습니다.');
|
|
return;
|
|
}
|
|
|
|
// 조회기간 정보 가져오기
|
|
const startDate = document.getElementById('startDate').value;
|
|
const endDate = document.getElementById('endDate').value;
|
|
const periodText = startDate && endDate ? `_${startDate}_${endDate}` : '';
|
|
|
|
// CSV 형식으로 데이터 변환
|
|
const headers = ['날짜', '상태', '프로젝트명', '요청부서', '패키지', '타입', '프로세스', '업무내용', '근무시간', '초과근무', '초과근무시작', '초과근무종료'];
|
|
const csvContent = [
|
|
headers.join(','),
|
|
...filteredData.map(item => [
|
|
formatDate(item.pdate),
|
|
item.status || '',
|
|
item.projectName || '',
|
|
item.requestpart || '',
|
|
item.package || '',
|
|
item.type || '',
|
|
item.process || '',
|
|
`"${(item.description || '').replace(/"/g, '""')}"`,
|
|
item.hrs || '',
|
|
item.ot || '',
|
|
item.otStart || '',
|
|
item.otEnd || ''
|
|
].join(','))
|
|
].join('\n');
|
|
|
|
// 파일 다운로드
|
|
const blob = new Blob(['\ufeff' + csvContent], { type: 'text/csv;charset=utf-8;' });
|
|
const link = document.createElement('a');
|
|
const url = URL.createObjectURL(blob);
|
|
link.setAttribute('href', url);
|
|
link.setAttribute('download', `업무일지${periodText}_${new Date().toISOString().split('T')[0]}.csv`);
|
|
link.style.visibility = 'hidden';
|
|
document.body.appendChild(link);
|
|
link.click();
|
|
document.body.removeChild(link);
|
|
}
|
|
</script>
|
|
</body>
|
|
</html> |