Files
tk-factory-services/tkpurchase/web/schedule.html
Hyungi Ahn b5b0fa1728 feat: 작업일정 기간 기반 + 프로젝트 연결
- partner_schedules: work_date → start_date/end_date 기간 기반으로 변경
- project_id 컬럼 추가 (projects 테이블 연결, 선택사항)
- 프로젝트 조회 API 추가 (GET /projects/active)
- 일정 조회 시 기간 겹침 조건으로 필터링
- 체크인 시 기간 내 검증 추가
- 프론트엔드: 시작일/종료일 입력 + 프로젝트 선택 드롭다운
- 마이그레이션 SQL 포함 (scripts/migration-schedule-daterange.sql)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 08:18:53 +09:00

219 lines
13 KiB
HTML

<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<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=20260312">
</head>
<body>
<!-- Header -->
<header class="bg-emerald-700 text-white sticky top-0 z-50">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between items-center h-14">
<div class="flex items-center gap-3">
<i class="fas fa-truck text-xl text-emerald-200"></i>
<h1 class="text-lg font-semibold">TK 구매관리</h1>
</div>
<div class="flex items-center gap-4">
<div id="headerUserName" class="text-sm font-medium hidden sm:block">-</div>
<div id="headerUserAvatar" class="w-8 h-8 bg-emerald-600 rounded-full flex items-center justify-center text-sm font-semibold">-</div>
<button onclick="doLogout()" class="text-emerald-200 hover:text-white" title="로그아웃"><i class="fas fa-sign-out-alt"></i></button>
</div>
</div>
</div>
</header>
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4 fade-in">
<div class="flex gap-6">
<!-- Sidebar Nav -->
<nav id="sideNav" class="hidden lg:flex flex-col gap-1 w-48 flex-shrink-0 pt-2"></nav>
<!-- Main -->
<div class="flex-1 min-w-0">
<!-- 필터 및 추가 버튼 -->
<div class="bg-white rounded-xl shadow-sm p-4 mb-5">
<div class="flex flex-wrap items-end gap-3">
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">업체 검색</label>
<input type="text" id="filterCompany" class="input-field px-3 py-2 rounded-lg text-sm" placeholder="업체명">
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">시작일</label>
<input type="date" id="filterDateFrom" class="input-field px-3 py-2 rounded-lg text-sm">
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">종료일</label>
<input type="date" id="filterDateTo" class="input-field px-3 py-2 rounded-lg text-sm">
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">상태</label>
<select id="filterStatus" class="input-field px-3 py-2 rounded-lg text-sm">
<option value="">전체</option>
<option value="scheduled">예정</option>
<option value="in_progress">진행중</option>
<option value="completed">완료</option>
<option value="cancelled">취소</option>
</select>
</div>
<button onclick="loadSchedules()" class="px-4 py-2 bg-gray-100 text-gray-700 rounded-lg text-sm hover:bg-gray-200">
<i class="fas fa-search mr-1"></i>조회
</button>
<div class="flex-1"></div>
<button onclick="openAddSchedule()" class="px-4 py-2 bg-emerald-600 text-white rounded-lg text-sm hover:bg-emerald-700 font-medium">
<i class="fas fa-plus mr-1"></i>일정 등록
</button>
</div>
</div>
<!-- 테이블 -->
<div class="bg-white rounded-xl shadow-sm p-5">
<h2 class="text-base font-semibold text-gray-800 mb-4">
<i class="fas fa-calendar-alt text-blue-500 mr-2"></i>작업일정 목록
</h2>
<div class="overflow-x-auto">
<table class="visit-table">
<thead>
<tr>
<th>업체</th>
<th>기간</th>
<th>프로젝트</th>
<th>작업내용</th>
<th class="hide-mobile">작업장</th>
<th class="text-center">예상인원</th>
<th>상태</th>
<th class="text-right">관리</th>
</tr>
</thead>
<tbody id="scheduleTableBody">
<tr><td colspan="8" class="text-center text-gray-400 py-8">로딩 중...</td></tr>
</tbody>
</table>
</div>
<div id="schedulePagination" class="flex justify-center items-center gap-2 mt-4"></div>
</div>
</div>
</div>
</div>
<!-- 등록 모달 -->
<div id="addScheduleModal" class="hidden modal-overlay" onclick="if(event.target===this)closeAddSchedule()">
<div class="modal-content p-6">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-semibold">일정 등록</h3>
<button onclick="closeAddSchedule()" class="text-gray-400 hover:text-gray-600"><i class="fas fa-times"></i></button>
</div>
<form id="addScheduleForm" onsubmit="submitAddSchedule(event)">
<div class="space-y-3">
<div class="relative">
<label class="block text-xs font-medium text-gray-600 mb-1">업체 <span class="text-red-400">*</span></label>
<input type="text" id="addCompanySearch" class="input-field w-full px-3 py-2 rounded-lg text-sm" placeholder="업체명 검색..." autocomplete="off">
<input type="hidden" id="addCompanyId">
<div id="addCompanyDropdown" class="hidden absolute z-10 w-full mt-1 bg-white border rounded-lg shadow-lg max-h-48 overflow-y-auto"></div>
</div>
<div class="grid grid-cols-2 gap-3">
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">시작일 <span class="text-red-400">*</span></label>
<input type="date" id="addStartDate" class="input-field w-full px-3 py-2 rounded-lg text-sm" required>
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">종료일 <span class="text-red-400">*</span></label>
<input type="date" id="addEndDate" class="input-field w-full px-3 py-2 rounded-lg text-sm" required>
</div>
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">프로젝트</label>
<select id="addProject" class="input-field w-full px-3 py-2 rounded-lg text-sm">
<option value="">선택 안함</option>
</select>
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">작업내용</label>
<textarea id="addWorkDescription" rows="3" class="input-field w-full px-3 py-2 rounded-lg text-sm" placeholder="작업 내용"></textarea>
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">작업장</label>
<input type="text" id="addWorkplaceName" class="input-field w-full px-3 py-2 rounded-lg text-sm" placeholder="작업 장소">
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">예상인원</label>
<input type="number" id="addExpectedWorkers" min="0" value="0" class="input-field w-full px-3 py-2 rounded-lg text-sm">
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">비고</label>
<textarea id="addNotes" rows="2" class="input-field w-full px-3 py-2 rounded-lg text-sm" placeholder="추가 사항"></textarea>
</div>
</div>
<div class="flex justify-end mt-4 gap-2">
<button type="button" onclick="closeAddSchedule()" class="px-4 py-2 border rounded-lg text-sm hover:bg-gray-50">취소</button>
<button type="submit" class="px-4 py-2 bg-emerald-600 text-white rounded-lg text-sm hover:bg-emerald-700">등록</button>
</div>
</form>
</div>
</div>
<!-- 수정 모달 -->
<div id="editScheduleModal" class="hidden modal-overlay" onclick="if(event.target===this)closeEditSchedule()">
<div class="modal-content p-6">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-semibold">일정 수정</h3>
<button onclick="closeEditSchedule()" class="text-gray-400 hover:text-gray-600"><i class="fas fa-times"></i></button>
</div>
<form id="editScheduleForm" onsubmit="submitEditSchedule(event)">
<input type="hidden" id="editScheduleId">
<div class="space-y-3">
<div class="relative">
<label class="block text-xs font-medium text-gray-600 mb-1">업체 <span class="text-red-400">*</span></label>
<input type="text" id="editCompanySearch" class="input-field w-full px-3 py-2 rounded-lg text-sm" placeholder="업체명 검색..." autocomplete="off">
<input type="hidden" id="editCompanyId">
<div id="editCompanyDropdown" class="hidden absolute z-10 w-full mt-1 bg-white border rounded-lg shadow-lg max-h-48 overflow-y-auto"></div>
</div>
<div class="grid grid-cols-2 gap-3">
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">시작일 <span class="text-red-400">*</span></label>
<input type="date" id="editStartDate" class="input-field w-full px-3 py-2 rounded-lg text-sm" required>
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">종료일 <span class="text-red-400">*</span></label>
<input type="date" id="editEndDate" class="input-field w-full px-3 py-2 rounded-lg text-sm" required>
</div>
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">프로젝트</label>
<select id="editProject" class="input-field w-full px-3 py-2 rounded-lg text-sm">
<option value="">선택 안함</option>
</select>
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">작업내용</label>
<textarea id="editWorkDescription" rows="3" class="input-field w-full px-3 py-2 rounded-lg text-sm"></textarea>
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">작업장</label>
<input type="text" id="editWorkplaceName" class="input-field w-full px-3 py-2 rounded-lg text-sm">
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">예상인원</label>
<input type="number" id="editExpectedWorkers" min="0" class="input-field w-full px-3 py-2 rounded-lg text-sm">
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">비고</label>
<textarea id="editNotes" rows="2" class="input-field w-full px-3 py-2 rounded-lg text-sm"></textarea>
</div>
</div>
<div class="flex justify-end mt-4 gap-2">
<button type="button" onclick="closeEditSchedule()" class="px-4 py-2 border rounded-lg text-sm hover:bg-gray-50">취소</button>
<button type="submit" class="px-4 py-2 bg-emerald-600 text-white rounded-lg text-sm hover:bg-emerald-700">저장</button>
</div>
</form>
</div>
</div>
<script src="/static/js/tkpurchase-core.js?v=20260312"></script>
<script src="/static/js/tkpurchase-schedule.js?v=20260312"></script>
<script>initSchedulePage();</script>
</body>
</html>