ot집계표에 %추가
This commit is contained in:
@@ -141,7 +141,8 @@
|
||||
<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>
|
||||
@@ -205,7 +206,18 @@
|
||||
<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-2 gap-4">
|
||||
<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">
|
||||
@@ -282,7 +294,18 @@
|
||||
<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-2 gap-4">
|
||||
<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">
|
||||
@@ -461,8 +484,11 @@
|
||||
|
||||
if (todos && todos.length > 0) {
|
||||
todos.forEach(todo => {
|
||||
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 flagText = todo.flag ? '고정' : '일반';
|
||||
|
||||
const seqnoClass = getSeqnoClass(todo.seqno);
|
||||
const seqnoText = getSeqnoText(todo.seqno);
|
||||
@@ -473,9 +499,14 @@
|
||||
|
||||
tableRows += `
|
||||
<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 || '일반'}
|
||||
${flagText}
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-6 py-4 text-white">${todo.title || '제목 없음'}</td>
|
||||
@@ -501,7 +532,7 @@
|
||||
} else {
|
||||
tableRows = `
|
||||
<tr>
|
||||
<td colspan="6" class="px-6 py-8 text-center text-white/50">
|
||||
<td colspan="8" class="px-6 py-8 text-center text-white/50">
|
||||
등록된 할일이 없습니다
|
||||
</td>
|
||||
</tr>
|
||||
@@ -531,6 +562,126 @@
|
||||
}
|
||||
}
|
||||
|
||||
// 상태 클래스 반환
|
||||
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`;
|
||||
}
|
||||
}
|
||||
|
||||
// 편집 모달에서 상태 업데이트 (바로 서버에 반영)
|
||||
function updateTodoStatus(status) {
|
||||
if (!currentEditId) return;
|
||||
|
||||
const formData = {
|
||||
idx: currentEditId,
|
||||
title: document.getElementById('editTodoTitle').value,
|
||||
remark: document.getElementById('editTodoRemark').value,
|
||||
expire: document.getElementById('editTodoExpire').value || null,
|
||||
seqno: parseInt(document.getElementById('editTodoSeqno').value),
|
||||
flag: document.getElementById('editTodoFlag').checked,
|
||||
request: document.getElementById('editTodoRequest').value || null,
|
||||
status: status
|
||||
};
|
||||
|
||||
if (!formData.remark.trim()) {
|
||||
showError('할일 내용을 입력해주세요.');
|
||||
return;
|
||||
}
|
||||
|
||||
showLoading();
|
||||
fetch('/Todo/UpdateTodo', {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(formData)
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.Success) {
|
||||
// 목록 새로고침
|
||||
loadTodos();
|
||||
// 모달 닫기
|
||||
hideEditModal();
|
||||
showSuccess(`상태가 '${getStatusText(status)}'(으)로 변경되었습니다.`);
|
||||
} else {
|
||||
showError(data.Message || '상태 변경에 실패했습니다.');
|
||||
}
|
||||
hideLoading();
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('상태 변경 중 오류:', error);
|
||||
showError('서버 연결에 실패했습니다.');
|
||||
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`;
|
||||
}
|
||||
}
|
||||
|
||||
// 새 할일 추가
|
||||
function addTodo() {
|
||||
const formData = {
|
||||
@@ -539,7 +690,8 @@
|
||||
expire: document.getElementById('todoExpire').value || null,
|
||||
seqno: parseInt(document.getElementById('todoSeqno').value),
|
||||
flag: document.getElementById('todoFlag').checked,
|
||||
request: document.getElementById('todoRequest').value || null
|
||||
request: document.getElementById('todoRequest').value || null,
|
||||
status: document.getElementById('todoStatus').value
|
||||
};
|
||||
|
||||
if (!formData.remark.trim()) {
|
||||
@@ -589,6 +741,7 @@
|
||||
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) {
|
||||
@@ -620,7 +773,8 @@
|
||||
expire: document.getElementById('editTodoExpire').value || null,
|
||||
seqno: parseInt(document.getElementById('editTodoSeqno').value),
|
||||
flag: document.getElementById('editTodoFlag').checked,
|
||||
request: document.getElementById('editTodoRequest').value || null
|
||||
request: document.getElementById('editTodoRequest').value || null,
|
||||
status: document.getElementById('editTodoStatus').value
|
||||
};
|
||||
|
||||
if (!formData.remark.trim()) {
|
||||
|
||||
Reference in New Issue
Block a user