Files
tk-factory-services/tksafety/web/visit-management.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

193 lines
10 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="grid grid-cols-3 sm:grid-cols-6 gap-3 mb-5">
<div class="stat-card">
<div class="stat-value text-amber-600" id="statPending">0</div>
<div class="stat-label">대기중</div>
</div>
<div class="stat-card">
<div class="stat-value text-green-600" id="statApproved">0</div>
<div class="stat-label">승인됨</div>
</div>
<div class="stat-card">
<div class="stat-value text-red-600" id="statRejected">0</div>
<div class="stat-label">반려됨</div>
</div>
<div class="stat-card">
<div class="stat-value text-blue-600" id="statTrainingDone">0</div>
<div class="stat-label">교육완료</div>
</div>
<div class="stat-card">
<div class="stat-value text-blue-600" id="statCheckedIn">0</div>
<div class="stat-label">체크인</div>
</div>
<div class="stat-card">
<div class="stat-value text-gray-600" id="statCheckedOut">0</div>
<div class="stat-label">체크아웃</div>
</div>
</div>
<!-- 필터 -->
<div class="bg-white rounded-xl shadow-sm p-5 mb-5">
<div class="flex items-center justify-between mb-4">
<h2 class="text-base font-semibold text-gray-800"><i class="fas fa-clipboard-check text-blue-500 mr-2"></i>출입 신청 관리</h2>
</div>
<div class="flex flex-wrap items-end gap-3">
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">출입유형</label>
<select id="filterType" class="input-field px-3 py-2 rounded-lg text-sm">
<option value="">전체</option>
<option value="external">외부 방문</option>
<option value="internal">내부 출입</option>
</select>
</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="pending">대기중</option>
<option value="approved">승인됨</option>
<option value="rejected">반려됨</option>
<option value="training_completed">교육완료</option>
<option value="checked_in">체크인</option>
<option value="checked_out">체크아웃</option>
</select>
</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>
<button onclick="loadRequests()" class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 text-sm font-medium">
<i class="fas fa-search mr-1"></i>조회
</button>
</div>
</div>
<!-- 신청 목록 테이블 -->
<div class="bg-white rounded-xl shadow-sm p-5">
<div class="overflow-x-auto">
<table class="visit-table">
<thead>
<tr>
<th>유형</th>
<th>신청자</th>
<th>업체/이름</th>
<th class="text-center">인원</th>
<th>작업장</th>
<th>방문일</th>
<th class="hide-mobile">방문시간</th>
<th>목적</th>
<th>상태</th>
<th class="text-right">관리</th>
</tr>
</thead>
<tbody id="requestsTableBody">
<tr><td colspan="10" class="text-center text-gray-400 py-8">로딩 중...</td></tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- 승인 확인 모달 -->
<div id="approveModal" class="hidden modal-overlay" onclick="if(event.target===this)closeApproveModal()">
<div class="modal-content p-6">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-semibold">출입 승인</h3>
<button onclick="closeApproveModal()" class="text-gray-400 hover:text-gray-600"><i class="fas fa-times"></i></button>
</div>
<div id="approveDetail" class="mb-4 text-sm text-gray-600"></div>
<div class="flex justify-end gap-2">
<button onclick="closeApproveModal()" class="px-4 py-2 border rounded-lg text-sm hover:bg-gray-50">취소</button>
<button onclick="confirmApprove()" class="px-4 py-2 bg-green-600 text-white rounded-lg text-sm hover:bg-green-700">
<i class="fas fa-check mr-1"></i>승인
</button>
</div>
</div>
</div>
<!-- 반려 모달 -->
<div id="rejectModal" class="hidden modal-overlay" onclick="if(event.target===this)closeRejectModal()">
<div class="modal-content p-6">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-semibold">출입 반려</h3>
<button onclick="closeRejectModal()" class="text-gray-400 hover:text-gray-600"><i class="fas fa-times"></i></button>
</div>
<div id="rejectDetail" class="mb-4 text-sm text-gray-600"></div>
<div class="mb-4">
<label class="block text-xs font-medium text-gray-600 mb-1">반려 사유 <span class="text-red-400">*</span></label>
<textarea id="rejectionReason" class="input-field w-full px-3 py-2 rounded-lg text-sm" rows="3" placeholder="반려 사유를 입력해주세요" required></textarea>
</div>
<div class="flex justify-end gap-2">
<button onclick="closeRejectModal()" class="px-4 py-2 border rounded-lg text-sm hover:bg-gray-50">취소</button>
<button onclick="confirmReject()" class="px-4 py-2 bg-red-600 text-white rounded-lg text-sm hover:bg-red-700">
<i class="fas fa-times mr-1"></i>반려
</button>
</div>
</div>
</div>
<!-- 상세보기 모달 -->
<div id="detailModal" class="hidden modal-overlay" onclick="if(event.target===this)closeDetailModal()">
<div class="modal-content p-6">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-semibold">신청 상세</h3>
<button onclick="closeDetailModal()" class="text-gray-400 hover:text-gray-600"><i class="fas fa-times"></i></button>
</div>
<div id="detailContent" class="text-sm"></div>
<div class="flex justify-end mt-4">
<button onclick="closeDetailModal()" class="px-4 py-2 border rounded-lg text-sm hover:bg-gray-50">닫기</button>
</div>
</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-visit-management.js?v=2026031401"></script>
<script>initVisitManagementPage();</script>
</body>
</html>