fix(tkpurchase): 일정 목록 미표시 버그 수정 — 캐시·타임존·페이지네이션

- API에 Cache-Control: no-store 미들웨어 추가 (304 캐시 문제 해결)
- toLocalDate() 유틸 추가, 전체 8개 JS의 toISOString 타임존 버그 수정
- scheduleModel.findAll에 total COUNT 추가, 컨트롤러에서 total 반환
- HTML 캐시 버스팅 ?v=2026031601

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-03-16 07:34:40 +09:00
parent 17f7c6f3b0
commit 54bb26dbd6
21 changed files with 79 additions and 59 deletions

View File

@@ -6,7 +6,7 @@
<title>계정 관리 - TK 구매관리</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link rel="stylesheet" href="/static/css/tkpurchase.css?v=2026031401">
<link rel="stylesheet" href="/static/css/tkpurchase.css?v=2026031601">
</head>
<body>
<!-- Header -->
@@ -133,8 +133,8 @@
</div>
</div>
<script src="/static/js/tkpurchase-core.js?v=2026031401"></script>
<script src="/static/js/tkpurchase-accounts.js?v=2026031401"></script>
<script src="/static/js/tkpurchase-core.js?v=2026031601"></script>
<script src="/static/js/tkpurchase-accounts.js?v=2026031601"></script>
<script>initAccountsPage();</script>
</body>
</html>

View File

@@ -6,7 +6,7 @@
<title>일용공 신청 - TK 구매관리</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link rel="stylesheet" href="/static/css/tkpurchase.css?v=2026031401">
<link rel="stylesheet" href="/static/css/tkpurchase.css?v=2026031601">
</head>
<body>
<!-- Header -->
@@ -148,8 +148,8 @@
</div>
</div>
<script src="/static/js/tkpurchase-core.js?v=2026031401"></script>
<script src="/static/js/tkpurchase-daylabor.js?v=2026031401"></script>
<script src="/static/js/tkpurchase-core.js?v=2026031601"></script>
<script src="/static/js/tkpurchase-daylabor.js?v=2026031601"></script>
<script>initDayLaborPage();</script>
</body>
</html>

View File

@@ -6,7 +6,7 @@
<title>대시보드 - TK 구매관리</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link rel="stylesheet" href="/static/css/tkpurchase.css?v=2026031401">
<link rel="stylesheet" href="/static/css/tkpurchase.css?v=2026031601">
</head>
<body>
<!-- Header -->
@@ -88,8 +88,8 @@
</div>
</div>
<script src="/static/js/tkpurchase-core.js?v=2026031401"></script>
<script src="/static/js/tkpurchase-dashboard.js?v=2026031401"></script>
<script src="/static/js/tkpurchase-core.js?v=2026031601"></script>
<script src="/static/js/tkpurchase-dashboard.js?v=2026031601"></script>
<script>initDashboard();</script>
</body>
</html>

View File

@@ -6,7 +6,7 @@
<title>작업 이력 - TK 구매관리</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link rel="stylesheet" href="/static/css/tkpurchase.css?v=2026031401">
<link rel="stylesheet" href="/static/css/tkpurchase.css?v=2026031601">
</head>
<body>
<!-- Header -->
@@ -61,8 +61,8 @@
<div id="historyPagination" class="mt-4 flex justify-center gap-2"></div>
</div>
<script src="/static/js/tkpurchase-core.js?v=2026031401"></script>
<script src="/static/js/tkpurchase-partner-history.js?v=2026031401"></script>
<script src="/static/js/tkpurchase-core.js?v=2026031601"></script>
<script src="/static/js/tkpurchase-partner-history.js?v=2026031601"></script>
<script>initPartnerHistory();</script>
</body>
</html>

View File

@@ -6,7 +6,7 @@
<title>협력업체 포털 - TK 구매관리</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link rel="stylesheet" href="/static/css/tkpurchase.css?v=2026031401">
<link rel="stylesheet" href="/static/css/tkpurchase.css?v=2026031601">
</head>
<body>
<!-- Header -->
@@ -81,8 +81,8 @@
</div>
</div>
<script src="/static/js/tkpurchase-core.js?v=2026031401"></script>
<script src="/static/js/tkpurchase-partner-portal.js?v=2026031401"></script>
<script src="/static/js/tkpurchase-core.js?v=2026031601"></script>
<script src="/static/js/tkpurchase-partner-portal.js?v=2026031601"></script>
<script>initPartnerPortal();</script>
</body>
</html>

View File

@@ -6,7 +6,7 @@
<title>협력업체 관리 - TK 구매관리</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link rel="stylesheet" href="/static/css/tkpurchase.css?v=2026031401">
<link rel="stylesheet" href="/static/css/tkpurchase.css?v=2026031601">
</head>
<body>
<!-- Header -->
@@ -294,8 +294,8 @@
</div>
</div>
<script src="/static/js/tkpurchase-core.js?v=2026031401"></script>
<script src="/static/js/tkpurchase-partner.js?v=2026031401"></script>
<script src="/static/js/tkpurchase-core.js?v=2026031601"></script>
<script src="/static/js/tkpurchase-partner.js?v=2026031601"></script>
<script>initPartnerPage();</script>
</body>
</html>

View File

@@ -6,7 +6,7 @@
<title>작업일정 - TK 구매관리</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link rel="stylesheet" href="/static/css/tkpurchase.css?v=2026031401">
<link rel="stylesheet" href="/static/css/tkpurchase.css?v=2026031601">
</head>
<body>
<!-- Header -->
@@ -275,8 +275,8 @@
</div>
</div>
<script src="/static/js/tkpurchase-core.js?v=2026031401"></script>
<script src="/static/js/tkpurchase-schedule.js?v=2026031401"></script>
<script src="/static/js/tkpurchase-core.js?v=2026031601"></script>
<script src="/static/js/tkpurchase-schedule.js?v=2026031601"></script>
<script>initSchedulePage();</script>
</body>
</html>

View File

@@ -104,7 +104,7 @@ function openAddAccount() {
// Default expiration: 1 year from now
const oneYear = new Date();
oneYear.setFullYear(oneYear.getFullYear() + 1);
document.getElementById('addExpiresAt').value = oneYear.toISOString().substring(0, 10);
document.getElementById('addExpiresAt').value = toLocalDate(oneYear);
document.getElementById('addAccountModal').classList.remove('hidden');
}

View File

@@ -61,6 +61,12 @@ function showToast(msg, type = 'success') {
/* ===== Escape ===== */
function escapeHtml(str) { if (!str) return ''; const d = document.createElement('div'); d.textContent = str; return d.innerHTML; }
/* ===== Local Date (timezone-safe) ===== */
function toLocalDate(d) {
if (!(d instanceof Date) || isNaN(d)) return '';
return `${d.getFullYear()}-${String(d.getMonth()+1).padStart(2,'0')}-${String(d.getDate()).padStart(2,'0')}`;
}
/* ===== Helpers ===== */
function formatDate(d) { if (!d) return ''; return String(d).substring(0, 10); }
function formatTime(d) { if (!d) return ''; return String(d).substring(11, 16); }

View File

@@ -65,7 +65,7 @@ async function loadTodaySchedules() {
} catch(e) { console.warn(e); }
}
function todayStr() { return new Date().toISOString().substring(0, 10); }
function todayStr() { return toLocalDate(new Date()); }
function initDashboard() {
if (!initAuth()) return;

View File

@@ -99,7 +99,7 @@ function openAddDayLabor() {
// Default to tomorrow
const tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
document.getElementById('addWorkDate').value = tomorrow.toISOString().substring(0, 10);
document.getElementById('addWorkDate').value = toLocalDate(tomorrow);
document.getElementById('addDayLaborModal').classList.remove('hidden');
}
@@ -167,7 +167,7 @@ function initDayLaborPage() {
// Set default date range to this month
const now = new Date();
const firstDay = new Date(now.getFullYear(), now.getMonth(), 1);
document.getElementById('filterDateFrom').value = firstDay.toISOString().substring(0, 10);
document.getElementById('filterDateTo').value = now.toISOString().substring(0, 10);
document.getElementById('filterDateFrom').value = toLocalDate(firstDay);
document.getElementById('filterDateTo').value = toLocalDate(now);
loadDayLabor();
}

View File

@@ -17,8 +17,8 @@ function initPartnerHistory() {
const today = new Date();
const thirtyDaysAgo = new Date(today);
thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30);
document.getElementById('filterDateTo').value = today.toISOString().substring(0, 10);
document.getElementById('filterDateFrom').value = thirtyDaysAgo.toISOString().substring(0, 10);
document.getElementById('filterDateTo').value = toLocalDate(today);
document.getElementById('filterDateFrom').value = toLocalDate(thirtyDaysAgo);
loadHistory();
}

View File

@@ -53,7 +53,7 @@ async function renderScheduleCards() {
const requestCardsEl = document.getElementById('requestCards');
const workRequestFormEl = document.getElementById('workRequestForm');
const today = new Date().toISOString().substring(0, 10);
const today = toLocalDate(new Date());
if (!portalSchedules.length) {
container.innerHTML = '';

View File

@@ -177,7 +177,7 @@ async function openAddSchedule() {
document.getElementById('addCompanyId').value = '';
const tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
const tomorrowStr = tomorrow.toISOString().substring(0, 10);
const tomorrowStr = toLocalDate(tomorrow);
document.getElementById('addStartDate').value = tomorrowStr;
document.getElementById('addEndDate').value = tomorrowStr;
await loadProjects();
@@ -446,8 +446,8 @@ function initSchedulePage() {
const now = new Date();
const firstDay = new Date(now.getFullYear(), now.getMonth(), 1);
const lastDay = new Date(now.getFullYear(), now.getMonth() + 1, 0);
document.getElementById('filterDateFrom').value = firstDay.toISOString().substring(0, 10);
document.getElementById('filterDateTo').value = lastDay.toISOString().substring(0, 10);
document.getElementById('filterDateFrom').value = toLocalDate(firstDay);
document.getElementById('filterDateTo').value = toLocalDate(lastDay);
// Setup autocomplete for both modals
setupCompanyAutocomplete('addCompanySearch', 'addCompanyDropdown', 'addCompanyId');

View File

@@ -140,8 +140,8 @@ function initSummaryPage() {
// 기본 기간: 이번 달
const now = new Date();
const firstDay = new Date(now.getFullYear(), now.getMonth(), 1);
document.getElementById('filterDateFrom').value = firstDay.toISOString().substring(0, 10);
document.getElementById('filterDateTo').value = now.toISOString().substring(0, 10);
document.getElementById('filterDateFrom').value = toLocalDate(firstDay);
document.getElementById('filterDateTo').value = toLocalDate(now);
loadCompaniesForFilter();
loadSchedulesForFilter();

View File

@@ -404,8 +404,8 @@ function initWorkReportPage() {
// Set default date range to this month
const now = new Date();
const firstDay = new Date(now.getFullYear(), now.getMonth(), 1);
document.getElementById('filterDateFrom').value = firstDay.toISOString().substring(0, 10);
document.getElementById('filterDateTo').value = now.toISOString().substring(0, 10);
document.getElementById('filterDateFrom').value = toLocalDate(firstDay);
document.getElementById('filterDateTo').value = toLocalDate(now);
loadCompaniesForFilter();
loadReports();

View File

@@ -6,7 +6,7 @@
<title>업무현황 종합 - TK 구매관리</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link rel="stylesheet" href="/static/css/tkpurchase.css?v=2026031401">
<link rel="stylesheet" href="/static/css/tkpurchase.css?v=2026031601">
</head>
<body>
<!-- Header -->
@@ -100,8 +100,8 @@
</div>
</div>
<script src="/static/js/tkpurchase-core.js?v=2026031401"></script>
<script src="/static/js/tkpurchase-workreport-summary.js?v=2026031401"></script>
<script src="/static/js/tkpurchase-core.js?v=2026031601"></script>
<script src="/static/js/tkpurchase-workreport-summary.js?v=2026031601"></script>
<script>initSummaryPage();</script>
</body>
</html>

View File

@@ -6,7 +6,7 @@
<title>업무현황 - TK 구매관리</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link rel="stylesheet" href="/static/css/tkpurchase.css?v=2026031401">
<link rel="stylesheet" href="/static/css/tkpurchase.css?v=2026031601">
</head>
<body>
<!-- Header -->
@@ -114,8 +114,8 @@
</div>
</div>
<script src="/static/js/tkpurchase-core.js?v=2026031401"></script>
<script src="/static/js/tkpurchase-workreport.js?v=2026031401"></script>
<script src="/static/js/tkpurchase-core.js?v=2026031601"></script>
<script src="/static/js/tkpurchase-workreport.js?v=2026031601"></script>
<script>initWorkReportPage();</script>
</body>
</html>