ot집계표에 %추가
This commit is contained in:
@@ -1070,6 +1070,112 @@
|
||||
alert(message); // 나중에 더 예쁜 toast나 modal로 변경 가능
|
||||
}
|
||||
|
||||
// Todo 목록 업데이트
|
||||
function updateTodoList() {
|
||||
showLoading();
|
||||
fetch('/Todo/GetUrgentTodos')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.Success && data.Data) {
|
||||
displayUrgentTodos(data.Data);
|
||||
} else {
|
||||
displayEmptyTodos();
|
||||
}
|
||||
hideLoading();
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('급한 할일 목록 업데이트 중 오류 발생:', error);
|
||||
displayEmptyTodos();
|
||||
hideLoading();
|
||||
});
|
||||
}
|
||||
|
||||
// 급한 할일 목록 표시
|
||||
function displayUrgentTodos(todos) {
|
||||
const todoContainer = document.getElementById('urgentTodoList');
|
||||
let todoItems = '';
|
||||
|
||||
if (todos && todos.length > 0) {
|
||||
todos.forEach(todo => {
|
||||
const statusClass = getTodoStatusClass(todo.status);
|
||||
const statusText = getTodoStatusText(todo.status);
|
||||
const seqnoClass = getTodoSeqnoClass(todo.seqno);
|
||||
const seqnoText = getTodoSeqnoText(todo.seqno);
|
||||
const flagIcon = todo.flag ? '📌 ' : '';
|
||||
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/60';
|
||||
|
||||
todoItems += `
|
||||
<div class="bg-white/10 rounded-lg p-4 hover:bg-white/15 transition-colors cursor-pointer" onclick="showTodoDetail(${todo.idx})">
|
||||
<div class="flex items-start justify-between mb-2">
|
||||
<div class="flex items-center space-x-2">
|
||||
<span class="inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${statusClass}">
|
||||
${statusText}
|
||||
</span>
|
||||
<span class="inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${seqnoClass}">
|
||||
${seqnoText}
|
||||
</span>
|
||||
</div>
|
||||
${expireText ? `<span class="text-xs ${expireClass}">${expireText}</span>` : ''}
|
||||
</div>
|
||||
<h4 class="text-white font-medium mb-1">${flagIcon}${todo.title || '제목 없음'}</h4>
|
||||
<p class="text-white/70 text-sm line-clamp-2">${todo.remark || ''}</p>
|
||||
${todo.request ? `<p class="text-white/50 text-xs mt-2">요청자: ${todo.request}</p>` : ''}
|
||||
</div>
|
||||
`;
|
||||
});
|
||||
} else {
|
||||
todoItems = `
|
||||
<div class="text-center text-white/50 py-8">
|
||||
<svg class="w-8 h-8 mx-auto mb-2 opacity-50" 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>
|
||||
급한 할일이 없습니다
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
todoContainer.innerHTML = todoItems;
|
||||
}
|
||||
|
||||
// 빈 할일 목록 표시
|
||||
function displayEmptyTodos() {
|
||||
const todoContainer = document.getElementById('urgentTodoList');
|
||||
todoContainer.innerHTML = `
|
||||
<div class="text-center text-white/50 py-8">
|
||||
<svg class="w-8 h-8 mx-auto mb-2 opacity-50" 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>
|
||||
급한 할일이 없습니다
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
// Todo 상태 클래스 반환
|
||||
function getTodoStatusClass(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';
|
||||
}
|
||||
}
|
||||
|
||||
// Todo 상태 텍스트 반환
|
||||
function getTodoStatusText(status) {
|
||||
switch(status) {
|
||||
case '0': return '대기';
|
||||
case '1': return '진행';
|
||||
case '2': return '취소';
|
||||
case '3': return '보류';
|
||||
case '5': return '완료';
|
||||
default: return '대기';
|
||||
}
|
||||
}
|
||||
|
||||
// 페이지 로드 시 데이터 업데이트
|
||||
updateLeaveCount();
|
||||
updateHolidayList();
|
||||
|
||||
Reference in New Issue
Block a user