refactor: 프론트엔드 유틸리티 함수 통합 (showToast, waitForApi, generateUUID)

- api-base.js에 4개 전역 유틸리티 추가 (showToast, formatDate, waitForApi, generateUUID)
- 24개 파일에서 중복 정의 제거 (-932줄)
- showToast: 18곳 중복 → 1곳 통합 (자동 컨테이너/스타일 생성)
- waitForApi/waitForApiConfig/waitForApiCall: 5곳 → 1곳 통합
- generateUUID: tbm.js 중복 제거
- tbm/utils.js, workplace-management/utils.js: window 재정의 제거

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-02-25 08:45:55 +09:00
parent 64e3c1227d
commit 4581cddbc0
24 changed files with 112 additions and 932 deletions

View File

@@ -806,35 +806,7 @@ function showErrorState() {
}
}
// ========== 토스트 알림 ========== //
function showToast(message, type = 'info', duration = 3000) {
if (!elements.toastContainer) return;
const toast = document.createElement('div');
toast.className = `toast ${type}`;
const iconMap = {
success: '✅',
error: '❌',
warning: '⚠️',
info: ''
};
toast.innerHTML = `
<div class="toast-icon">${iconMap[type] || ''}</div>
<div class="toast-message">${message}</div>
<button class="toast-close" onclick="this.parentElement.remove()">×</button>
`;
elements.toastContainer.appendChild(toast);
// 자동 제거
setTimeout(() => {
if (toast.parentElement) {
toast.remove();
}
}, duration);
}
// showToast → api-base.js 전역 사용
// ========== 작업자 관련 액션 함수들 ========== //
function openWorkerModal(workerId, workerName) {
@@ -1388,7 +1360,6 @@ async function handleModalVacation(vacationType) {
// ========== 전역 함수 (HTML에서 호출) ========== //
window.loadDashboardData = loadDashboardData;
window.showToast = showToast;
window.updateSummaryCards = updateSummaryCards;
window.displayWorkers = displayWorkers;
window.openWorkerModal = openWorkerModal;