ot집계표에 %추가
This commit is contained in:
@@ -95,9 +95,9 @@ namespace Project.Web.Controllers
|
||||
string uid = FCOMMON.info.Login.no;
|
||||
|
||||
var sql = @"
|
||||
SELECT TOP 5 * FROM EETGW_Todo
|
||||
SELECT * FROM EETGW_Todo
|
||||
WHERE gcode = @gcode AND uid = @uid
|
||||
AND (expire IS NULL OR CAST(expire AS DATE) >= CAST(GETDATE() AS DATE))
|
||||
and isnull(status,'0') not in ('2','3','5')
|
||||
ORDER BY flag DESC, seqno DESC, expire ASC, wdate ASC";
|
||||
|
||||
var todos = DBM.Query<TodoModel>(sql, new { gcode = gcode, uid = uid });
|
||||
|
||||
@@ -53,6 +53,16 @@ namespace Project.Web.Model
|
||||
/// </summary>
|
||||
public string request { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 상태
|
||||
/// 0: 대기
|
||||
/// 1: 진행
|
||||
/// 2: 취소
|
||||
/// 3: 보류
|
||||
/// 5: 완료
|
||||
/// </summary>
|
||||
public char status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 자료생성자id
|
||||
/// 로그인된 사용자id로 자동셋팅
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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