fix(tkpurchase): 협력업체 포탈 활성 일정 전체 표시로 변경
오늘 날짜 범위 필터 제거 → 마감/취소되지 않은 모든 일정 표시. 체크인 날짜 제한도 상태 기반 검증으로 변경하여 일정 기간 외에도 체크인 가능. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
</div>
|
||||
<div class="flex-1">
|
||||
<h2 class="text-lg font-semibold text-emerald-800" id="welcomeCompanyName">-</h2>
|
||||
<p class="text-sm text-emerald-600">오늘의 작업 일정을 확인하세요.</p>
|
||||
<p class="text-sm text-emerald-600">작업 일정을 확인하세요.</p>
|
||||
</div>
|
||||
<a href="/partner-history.html" class="flex items-center gap-1 px-3 py-2 bg-white text-emerald-700 rounded-lg text-sm hover:bg-emerald-100 border border-emerald-200 flex-shrink-0">
|
||||
<i class="fas fa-history"></i><span class="hidden sm:inline">작업 이력</span>
|
||||
@@ -82,7 +82,7 @@
|
||||
</div>
|
||||
|
||||
<script src="/static/js/tkpurchase-core.js?v=20260313b"></script>
|
||||
<script src="/static/js/tkpurchase-partner-portal.js?v=20260313a"></script>
|
||||
<script src="/static/js/tkpurchase-partner-portal.js?v=20260313b"></script>
|
||||
<script>initPartnerPortal();</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -25,7 +25,7 @@ async function loadMyCheckins() {
|
||||
const list = r.data || [];
|
||||
portalCheckins = {};
|
||||
list.forEach(c => {
|
||||
if (c.schedule_id) portalCheckins[c.schedule_id] = c;
|
||||
if (c.schedule_id && !portalCheckins[c.schedule_id]) portalCheckins[c.schedule_id] = c;
|
||||
});
|
||||
} catch(e) {
|
||||
console.warn('Load checkins error:', e);
|
||||
@@ -91,7 +91,7 @@ async function renderScheduleCards() {
|
||||
} else {
|
||||
requestCardsEl.classList.add('hidden');
|
||||
workRequestFormEl.classList.remove('hidden');
|
||||
workRequestFormEl.querySelector('p').textContent = '오늘 예정된 작업 일정이 없습니다. 작업이 필요하시면 아래에서 신청해주세요.';
|
||||
workRequestFormEl.querySelector('p').textContent = '등록된 작업 일정이 없습니다. 작업이 필요하시면 아래에서 신청해주세요.';
|
||||
}
|
||||
// 기본 날짜 설정
|
||||
const today = new Date().toISOString().substring(0, 10);
|
||||
@@ -104,22 +104,32 @@ async function renderScheduleCards() {
|
||||
requestCardsEl.classList.add('hidden');
|
||||
workRequestFormEl.classList.add('hidden');
|
||||
|
||||
const today = new Date().toISOString().substring(0, 10);
|
||||
|
||||
container.innerHTML = portalSchedules.map(s => {
|
||||
const checkin = portalCheckins[s.id];
|
||||
const isCheckedIn = checkin && !checkin.check_out_time;
|
||||
const isCheckedOut = checkin && checkin.check_out_time;
|
||||
const sStart = s.start_date ? s.start_date.substring(0, 10) : '';
|
||||
const sEnd = s.end_date ? s.end_date.substring(0, 10) : '';
|
||||
const isToday = sStart <= today && sEnd >= today;
|
||||
|
||||
// 2-step indicators
|
||||
const step1Class = checkin ? 'text-emerald-600' : 'text-gray-400';
|
||||
const step2Class = isCheckedOut ? 'text-emerald-600' : 'text-gray-400';
|
||||
|
||||
return `<div class="bg-white rounded-xl shadow-sm overflow-hidden">
|
||||
const dateBadge = isToday
|
||||
? `<span class="text-xs text-white bg-emerald-500 px-2 py-0.5 rounded-full font-medium">오늘</span>`
|
||||
: `<span class="text-xs text-gray-500">${formatDate(s.start_date) === formatDate(s.end_date) ? formatDate(s.start_date) : formatDate(s.start_date) + ' ~ ' + formatDate(s.end_date)}</span>`;
|
||||
|
||||
return `<div class="bg-white rounded-xl shadow-sm overflow-hidden ${!isToday ? 'border border-gray-200' : ''}">
|
||||
<!-- 일정 정보 -->
|
||||
<div class="p-5 border-b">
|
||||
<div class="flex items-center justify-between mb-2">
|
||||
<h3 class="text-base font-semibold text-gray-800">${escapeHtml(s.workplace_name || '작업장 미지정')}</h3>
|
||||
<span class="text-xs text-gray-500">${formatDate(s.start_date) === formatDate(s.end_date) ? formatDate(s.start_date) : formatDate(s.start_date) + ' ~ ' + formatDate(s.end_date)}</span>
|
||||
${dateBadge}
|
||||
</div>
|
||||
${!isToday ? `<div class="text-xs text-gray-400 mb-1"><i class="fas fa-calendar-alt mr-1"></i>${formatDate(s.start_date)}${formatDate(s.start_date) !== formatDate(s.end_date) ? ' ~ ' + formatDate(s.end_date) : ''}</div>` : ''}
|
||||
${s.work_description ? `<p class="text-sm text-gray-600 mb-2">${escapeHtml(s.work_description)}</p>` : ''}
|
||||
<div class="flex gap-4 text-xs text-gray-500">
|
||||
<span><i class="fas fa-users mr-1"></i>예상 ${s.expected_workers || 0}명</span>
|
||||
|
||||
Reference in New Issue
Block a user