Files
tk-factory-services/tksafety/web/training.html
Hyungi Ahn 0de9d5bb48 feat(sso): 인앱 브라우저 SSO 토큰 릴레이 — 카톡 WebView 쿠키 미공유 해결
카카오톡 인앱 WebView는 서브도메인 간 쿠키를 공유하지 않아
tkds에서 로그인 후 tkfb로 리다이렉트 시 인증이 풀리는 문제.

- sso-relay.js: URL hash의 _sso= 토큰을 로컬 쿠키+localStorage로 설정
- gateway dashboard: 로그인 후 redirect URL에 #_sso=<token> 추가
- 전 서비스 HTML: core JS 직전에 sso-relay.js 로드 (81개 파일)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 15:44:02 +09:00

223 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/tksafety.css">
</head>
<body>
<!-- Header -->
<header class="bg-blue-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">
<button id="mobileMenuBtn" onclick="toggleMobileMenu()" class="lg:hidden text-blue-200 hover:text-white">
<i class="fas fa-bars text-xl"></i>
</button>
<i class="fas fa-shield-alt text-xl text-blue-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-blue-600 rounded-full flex items-center justify-center text-sm font-semibold">-</div>
<button onclick="doLogout()" class="text-blue-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-5 mb-5">
<h2 class="text-base font-semibold text-gray-800 mb-4"><i class="fas fa-chalkboard-teacher text-blue-500 mr-2"></i>안전교육 대기 (승인된 신청)</h2>
<div class="overflow-x-auto">
<table class="visit-table">
<thead>
<tr>
<th>업체</th>
<th class="text-center">인원</th>
<th>작업장</th>
<th>방문일</th>
<th class="hide-mobile">방문시간</th>
<th>목적</th>
<th class="text-right">관리</th>
</tr>
</thead>
<tbody id="pendingTrainingBody">
<tr><td colspan="7" class="text-center text-gray-400 py-8">로딩 중...</td></tr>
</tbody>
</table>
</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-history text-blue-500 mr-2"></i>교육 완료 이력</h2>
<div class="overflow-x-auto">
<table class="visit-table">
<thead>
<tr>
<th>교육일</th>
<th>업체</th>
<th class="text-center">인원</th>
<th>교육시간</th>
<th class="hide-mobile">교육내용</th>
<th>교육자</th>
<th class="text-right">관리</th>
</tr>
</thead>
<tbody id="completedTrainingBody">
<tr><td colspan="7" class="text-center text-gray-400 py-8">로딩 중...</td></tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- 교육 실시 모달 -->
<div id="trainingModal" class="hidden modal-overlay" onclick="if(event.target===this)closeTrainingModal()">
<div class="modal-content p-6" style="max-width: 32rem;">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-semibold">안전교육 실시</h3>
<button onclick="closeTrainingModal()" class="text-gray-400 hover:text-gray-600"><i class="fas fa-times"></i></button>
</div>
<div id="trainingRequestInfo" class="bg-gray-50 rounded-lg p-3 mb-4 text-sm"></div>
<form id="trainingForm">
<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="trainingDate" 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="time" id="trainingStartTime" 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">종료시간</label>
<input type="time" id="trainingEndTime" class="input-field w-full px-3 py-2 rounded-lg text-sm">
</div>
<div class="col-span-2">
<label class="block text-xs font-medium text-gray-600 mb-1">교육 내용</label>
<textarea id="trainingTopics" class="input-field w-full px-3 py-2 rounded-lg text-sm" rows="3" placeholder="교육 내용을 입력하세요"></textarea>
</div>
</div>
<!-- 서명 패드 -->
<div class="mt-4">
<label class="block text-xs font-medium text-gray-600 mb-1">교육자 서명</label>
<div class="border rounded-lg overflow-hidden bg-white" style="touch-action: none;">
<canvas id="signatureCanvas" width="460" height="150" class="w-full cursor-crosshair"></canvas>
</div>
<div class="flex justify-end mt-1">
<button type="button" onclick="clearSignature()" class="text-xs text-gray-500 hover:text-gray-700">
<i class="fas fa-eraser mr-1"></i>서명 지우기
</button>
</div>
</div>
<div class="flex justify-end mt-4 gap-2">
<button type="button" onclick="closeTrainingModal()" class="px-4 py-2 border rounded-lg text-sm hover:bg-gray-50">취소</button>
<button type="submit" class="px-4 py-2 bg-blue-600 text-white rounded-lg text-sm hover:bg-blue-700">
<i class="fas fa-check mr-1"></i>교육 완료
</button>
</div>
</form>
</div>
</div>
<!-- 출입 신청 수정 모달 -->
<div id="editRequestModal" class="hidden modal-overlay" onclick="if(event.target===this)closeEditRequestModal()">
<div class="modal-content p-6" style="max-width: 32rem;">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-semibold">출입 신청 수정</h3>
<button onclick="closeEditRequestModal()" class="text-gray-400 hover:text-gray-600"><i class="fas fa-times"></i></button>
</div>
<form id="editRequestForm">
<input type="hidden" id="editRequestId">
<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="text" id="editReqCompany" 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="number" id="editReqCount" class="input-field w-full px-3 py-2 rounded-lg text-sm" min="1" 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="editReqDate" 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="time" id="editReqTime" class="input-field w-full px-3 py-2 rounded-lg text-sm" required>
</div>
<div class="col-span-2">
<label class="block text-xs font-medium text-gray-600 mb-1">비고</label>
<textarea id="editReqNotes" class="input-field w-full px-3 py-2 rounded-lg text-sm" rows="2"></textarea>
</div>
</div>
<div class="flex justify-end mt-4 gap-2">
<button type="button" onclick="closeEditRequestModal()" class="px-4 py-2 border rounded-lg text-sm hover:bg-gray-50">취소</button>
<button type="submit" class="px-4 py-2 bg-blue-600 text-white rounded-lg text-sm hover:bg-blue-700">
<i class="fas fa-save mr-1"></i>저장
</button>
</div>
</form>
</div>
</div>
<!-- 교육 기록 수정 모달 -->
<div id="editTrainingModal" class="hidden modal-overlay" onclick="if(event.target===this)closeEditTrainingModal()">
<div class="modal-content p-6" style="max-width: 32rem;">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-semibold">교육 기록 수정</h3>
<button onclick="closeEditTrainingModal()" class="text-gray-400 hover:text-gray-600"><i class="fas fa-times"></i></button>
</div>
<form id="editTrainingForm">
<input type="hidden" id="editTrainingId">
<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="editTrainDate" 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="time" id="editTrainStartTime" 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">종료시간</label>
<input type="time" id="editTrainEndTime" class="input-field w-full px-3 py-2 rounded-lg text-sm">
</div>
<div class="col-span-2">
<label class="block text-xs font-medium text-gray-600 mb-1">교육 내용</label>
<textarea id="editTrainTopics" class="input-field w-full px-3 py-2 rounded-lg text-sm" rows="3"></textarea>
</div>
</div>
<div class="flex justify-end mt-4 gap-2">
<button type="button" onclick="closeEditTrainingModal()" class="px-4 py-2 border rounded-lg text-sm hover:bg-gray-50">취소</button>
<button type="submit" class="px-4 py-2 bg-blue-600 text-white rounded-lg text-sm hover:bg-blue-700">
<i class="fas fa-save mr-1"></i>저장
</button>
</div>
</form>
</div>
</div>
<script src="/static/js/sso-relay.js?v=20260401"></script>
<script src="/static/js/tksafety-core.js?v=2026040101"></script>
<script src="/static/js/tksafety-training.js"></script>
<script>initTrainingPage();</script>
</body>
</html>