fix: [leaves] 휴가관리 삭제/영구삭제 함수 누락 수정

This commit is contained in:
김보곤
2026-03-04 23:09:14 +09:00
parent d431fc3637
commit 74d406fceb

View File

@@ -756,6 +756,50 @@ function cancelLeave(id) {
.catch(() => showToast('네트워크 오류가 발생했습니다.', 'error'));
}
function deleteLeave(id) {
if (!confirm('삭제하시겠습니까?')) return;
fetch('{{ url("/api/admin/hr/leaves") }}/' + id, {
method: 'DELETE',
headers: {
'Accept': 'application/json',
'X-CSRF-TOKEN': '{{ csrf_token() }}'
}
})
.then(r => r.json())
.then(res => {
if (res.success) {
refreshTable();
showToast(res.message, 'success');
} else {
showToast(res.message || '삭제 실패', 'error');
}
})
.catch(() => showToast('네트워크 오류가 발생했습니다.', 'error'));
}
function forceDeleteLeave(id) {
if (!confirm('영구 삭제하시겠습니까?\n이 작업은 되돌릴 수 없으며, 연결된 결재 기록도 함께 삭제됩니다.')) return;
fetch('{{ url("/api/admin/hr/leaves") }}/' + id + '?force=1', {
method: 'DELETE',
headers: {
'Accept': 'application/json',
'X-CSRF-TOKEN': '{{ csrf_token() }}'
}
})
.then(r => r.json())
.then(res => {
if (res.success) {
refreshTable();
showToast(res.message, 'success');
} else {
showToast(res.message || '영구 삭제 실패', 'error');
}
})
.catch(() => showToast('네트워크 오류가 발생했습니다.', 'error'));
}
// ===== 토스트 =====
function showToast(message, type) {
if (typeof window.showToastNotification === 'function') {