Files
tk-factory-services/system1-factory/web/pages/safety/checklist-manage.html
Hyungi Ahn 4388628788 refactor: TBM/작업보고 코드 통합 및 API 쿼리 버그 수정
- 공통 유틸리티 추출 (common/utils.js, common/base-state.js)
- TBM 모바일 인라인 JS/CSS 외부 파일로 분리 (tbm-mobile.js, tbm-mobile.css)
- 미사용 코드 삭제 (index.js, work-report-*.js 등 5개 파일)
- TBM/작업보고 state.js, utils.js를 공통 모듈 기반으로 전환
- 작업보고서 SSO 인증 호환 수정 (token/user 함수)
- tbmModel.js: incomplete-reports 쿼리에서 users→sso_users 조인 수정, leader_name 조인 추가
- docker-compose.yml: system1-web 볼륨 마운트 추가
- 모바일 인계(handover) 기능 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 07:51:24 +09:00

636 lines
15 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-FB</title>
<link rel="stylesheet" href="/css/design-system.css">
<link rel="stylesheet" href="/css/common.css">
<style>
.page-container {
max-width: 1200px;
margin: 0 auto;
padding: 1rem;
}
.page-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 1.5rem;
flex-wrap: wrap;
gap: 1rem;
}
.page-title {
font-size: 1.5rem;
font-weight: 700;
color: var(--text-primary, #111827);
margin: 0;
}
/* 탭 메뉴 */
.tab-menu {
display: flex;
gap: 0.5rem;
border-bottom: 2px solid #e5e7eb;
margin-bottom: 1.5rem;
flex-wrap: wrap;
}
.tab-btn {
padding: 0.75rem 1.5rem;
background: none;
border: none;
border-bottom: 3px solid transparent;
cursor: pointer;
font-size: 0.95rem;
font-weight: 500;
color: #6b7280;
transition: all 0.2s;
margin-bottom: -2px;
}
.tab-btn:hover {
color: #3b82f6;
}
.tab-btn.active {
color: #3b82f6;
border-bottom-color: #3b82f6;
font-weight: 600;
}
.tab-content {
display: none;
}
.tab-content.active {
display: block;
}
/* 체크리스트 카드 */
.checklist-group {
background: white;
border-radius: 12px;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
margin-bottom: 1rem;
overflow: hidden;
}
.group-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem 1.25rem;
background: #f9fafb;
border-bottom: 1px solid #e5e7eb;
}
.group-title {
display: flex;
align-items: center;
gap: 0.75rem;
font-weight: 600;
color: #374151;
}
.group-icon {
font-size: 1.25rem;
}
.group-count {
background: #e5e7eb;
color: #6b7280;
font-size: 0.75rem;
padding: 0.25rem 0.5rem;
border-radius: 10px;
}
.checklist-items {
padding: 0;
}
.checklist-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.875rem 1.25rem;
border-bottom: 1px solid #f3f4f6;
}
.checklist-item:last-child {
border-bottom: none;
}
.item-info {
flex: 1;
}
.item-name {
font-weight: 500;
color: #111827;
margin-bottom: 0.25rem;
}
.item-meta {
display: flex;
gap: 0.75rem;
font-size: 0.8rem;
color: #6b7280;
}
.item-badge {
padding: 0.125rem 0.5rem;
border-radius: 4px;
font-size: 0.7rem;
font-weight: 500;
}
.badge-required {
background: #fee2e2;
color: #dc2626;
}
.badge-optional {
background: #e5e7eb;
color: #6b7280;
}
.item-actions {
display: flex;
gap: 0.5rem;
}
.btn-icon {
width: 32px;
height: 32px;
display: flex;
align-items: center;
justify-content: center;
border: none;
border-radius: 6px;
cursor: pointer;
transition: all 0.2s;
}
.btn-edit {
background: #eff6ff;
color: #3b82f6;
}
.btn-edit:hover {
background: #dbeafe;
}
.btn-delete {
background: #fef2f2;
color: #dc2626;
}
.btn-delete:hover {
background: #fee2e2;
}
/* 필터/검색 */
.filter-bar {
display: flex;
gap: 1rem;
margin-bottom: 1.5rem;
flex-wrap: wrap;
}
.filter-select {
padding: 0.5rem 1rem;
border: 1px solid #e5e7eb;
border-radius: 6px;
font-size: 0.9rem;
min-width: 150px;
}
/* 모달 */
.modal-overlay {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.5);
z-index: 1000;
justify-content: center;
align-items: center;
padding: 1rem;
}
.modal-container {
background: white;
border-radius: 16px;
width: 100%;
max-width: 500px;
max-height: 90vh;
overflow: hidden;
display: flex;
flex-direction: column;
}
.modal-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1.25rem 1.5rem;
border-bottom: 1px solid #e5e7eb;
}
.modal-title {
font-size: 1.125rem;
font-weight: 600;
margin: 0;
}
.modal-close {
background: none;
border: none;
font-size: 1.5rem;
color: #6b7280;
cursor: pointer;
padding: 0;
}
.modal-body {
padding: 1.5rem;
overflow-y: auto;
}
.modal-footer {
display: flex;
justify-content: flex-end;
gap: 0.75rem;
padding: 1rem 1.5rem;
border-top: 1px solid #e5e7eb;
background: #f9fafb;
}
.form-group {
margin-bottom: 1.25rem;
}
.form-label {
display: block;
font-weight: 500;
color: #374151;
margin-bottom: 0.5rem;
}
.form-input, .form-select, .form-textarea {
width: 100%;
padding: 0.75rem;
border: 1px solid #d1d5db;
border-radius: 8px;
font-size: 0.95rem;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
outline: none;
border-color: #3b82f6;
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.form-textarea {
min-height: 80px;
resize: vertical;
}
.form-radio-group {
display: flex;
gap: 1rem;
flex-wrap: wrap;
}
.form-radio {
display: flex;
align-items: center;
gap: 0.5rem;
cursor: pointer;
}
.form-radio input {
width: 18px;
height: 18px;
cursor: pointer;
}
.form-checkbox {
display: flex;
align-items: center;
gap: 0.5rem;
cursor: pointer;
}
.form-checkbox input {
width: 18px;
height: 18px;
cursor: pointer;
}
.conditional-fields {
display: none;
margin-top: 1rem;
padding: 1rem;
background: #f9fafb;
border-radius: 8px;
}
.conditional-fields.show {
display: block;
}
.btn-primary {
padding: 0.75rem 1.5rem;
background: #3b82f6;
color: white;
border: none;
border-radius: 8px;
font-weight: 500;
cursor: pointer;
}
.btn-primary:hover {
background: #2563eb;
}
.btn-secondary {
padding: 0.75rem 1.5rem;
background: #e5e7eb;
color: #374151;
border: none;
border-radius: 8px;
font-weight: 500;
cursor: pointer;
}
.btn-secondary:hover {
background: #d1d5db;
}
.empty-state {
text-align: center;
padding: 3rem 1rem;
color: #9ca3af;
}
.empty-state-icon {
font-size: 3rem;
margin-bottom: 1rem;
}
/* 인라인 추가 행 */
.inline-add-row {
display: flex;
gap: 0.5rem;
padding: 0.75rem 1.25rem;
background: #f9fafb;
border-top: 1px dashed #e5e7eb;
align-items: center;
}
.inline-add-input {
flex: 1;
padding: 0.5rem 0.75rem;
border: 1px solid #d1d5db;
border-radius: 6px;
font-size: 0.9rem;
}
.inline-add-input:focus {
outline: none;
border-color: #3b82f6;
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}
.inline-add-btn {
padding: 0.5rem 1rem;
background: #3b82f6;
color: white;
border: none;
border-radius: 6px;
font-weight: 500;
cursor: pointer;
white-space: nowrap;
}
.inline-add-btn:hover {
background: #2563eb;
}
.inline-add-select {
padding: 0.5rem;
border: 1px solid #d1d5db;
border-radius: 6px;
font-size: 0.85rem;
max-width: 160px;
}
.inline-add-standalone {
background: white;
border-radius: 12px;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
margin-bottom: 1rem;
overflow: hidden;
}
.inline-add-standalone .inline-add-row {
border-top: none;
}
/* 날씨 아이콘 */
.weather-icon {
display: inline-flex;
align-items: center;
gap: 0.5rem;
}
.weather-icon.rain::before { content: '[rain]'; }
.weather-icon.snow::before { content: '[snow]'; }
.weather-icon.heat::before { content: '[heat]'; }
.weather-icon.cold::before { content: '[cold]'; }
.weather-icon.wind::before { content: '[wind]'; }
.weather-icon.fog::before { content: '[fog]'; }
.weather-icon.dust::before { content: '[dust]'; }
.weather-icon.clear::before { content: '[clear]'; }
@media (max-width: 768px) {
.checklist-item {
flex-direction: column;
align-items: flex-start;
gap: 0.75rem;
}
.item-actions {
width: 100%;
justify-content: flex-end;
}
}
</style>
</head>
<body>
<div id="navbar-container"></div>
<div class="page-container">
<div class="page-header">
<h1 class="page-title">안전 체크리스트 관리</h1>
</div>
<!-- 탭 메뉴 -->
<div class="tab-menu">
<button class="tab-btn active" data-tab="basic" onclick="switchTab('basic')">
기본 사항
</button>
<button class="tab-btn" data-tab="weather" onclick="switchTab('weather')">
날씨별
</button>
<button class="tab-btn" data-tab="task" onclick="switchTab('task')">
작업별
</button>
</div>
<!-- 기본 사항 탭 -->
<div id="basicTab" class="tab-content active">
<div id="basicChecklistContainer">
<!-- 동적 생성 -->
</div>
</div>
<!-- 날씨별 탭 -->
<div id="weatherTab" class="tab-content">
<div class="filter-bar">
<select id="weatherFilter" class="filter-select" onchange="filterByWeather()">
<option value="">모든 날씨 조건</option>
</select>
</div>
<div id="weatherChecklistContainer">
<!-- 동적 생성 -->
</div>
</div>
<!-- 작업별 탭 -->
<div id="taskTab" class="tab-content">
<div class="filter-bar">
<select id="workTypeFilter" class="filter-select" onchange="filterByWorkType()">
<option value="">공정 선택</option>
</select>
<select id="taskFilter" class="filter-select" onchange="filterByTask()">
<option value="">작업 선택</option>
</select>
</div>
<div id="taskChecklistContainer">
<!-- 동적 생성 -->
</div>
</div>
</div>
<!-- 추가/수정 모달 -->
<div id="checkModal" class="modal-overlay">
<div class="modal-container">
<div class="modal-header">
<h2 class="modal-title" id="modalTitle">체크 항목 추가</h2>
<button class="modal-close" onclick="closeModal()">&times;</button>
</div>
<div class="modal-body">
<form id="checkForm">
<input type="hidden" id="checkId">
<div class="form-group">
<label class="form-label">유형</label>
<div class="form-radio-group">
<label class="form-radio">
<input type="radio" name="checkType" value="basic" checked onchange="toggleConditionalFields()">
<span>기본</span>
</label>
<label class="form-radio">
<input type="radio" name="checkType" value="weather" onchange="toggleConditionalFields()">
<span>날씨별</span>
</label>
<label class="form-radio">
<input type="radio" name="checkType" value="task" onchange="toggleConditionalFields()">
<span>작업별</span>
</label>
</div>
</div>
<!-- 기본 유형: 카테고리 선택 -->
<div id="basicFields" class="conditional-fields show">
<div class="form-group">
<label class="form-label">카테고리</label>
<select id="checkCategory" class="form-select">
<option value="PPE">PPE (개인보호장비)</option>
<option value="EQUIPMENT">EQUIPMENT (장비점검)</option>
<option value="ENVIRONMENT">ENVIRONMENT (작업환경)</option>
<option value="EMERGENCY">EMERGENCY (비상대응)</option>
</select>
</div>
</div>
<!-- 날씨별 유형: 날씨 조건 선택 -->
<div id="weatherFields" class="conditional-fields">
<div class="form-group">
<label class="form-label">날씨 조건</label>
<select id="weatherCondition" class="form-select">
<!-- 동적 로드 -->
</select>
</div>
</div>
<!-- 작업별 유형: 공정/작업 선택 -->
<div id="taskFields" class="conditional-fields">
<div class="form-group">
<label class="form-label">공정</label>
<select id="modalWorkType" class="form-select" onchange="loadModalTasks()">
<option value="">공정 선택</option>
</select>
</div>
<div class="form-group">
<label class="form-label">작업</label>
<select id="modalTask" class="form-select">
<option value="">작업 선택</option>
</select>
</div>
</div>
<div class="form-group">
<label class="form-label">체크 항목</label>
<input type="text" id="checkItem" class="form-input" placeholder="예: 안전모 착용 확인" required>
</div>
<div class="form-group">
<label class="form-label">설명 (선택)</label>
<textarea id="checkDescription" class="form-textarea" placeholder="항목에 대한 상세 설명"></textarea>
</div>
<div class="form-group">
<label class="form-checkbox">
<input type="checkbox" id="isRequired" checked>
<span>필수 체크 항목</span>
</label>
</div>
<div class="form-group">
<label class="form-label">표시 순서</label>
<input type="number" id="displayOrder" class="form-input" value="0" min="0">
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn-secondary" onclick="closeModal()">취소</button>
<button type="button" class="btn-primary" onclick="saveCheck()">저장</button>
</div>
</div>
</div>
<script src="/js/api-base.js?v=2"></script>
<script src="/js/app-init.js?v=9" defer></script>
<script src="https://instant.page/5.2.0" type="module"></script>
<script type="module" src="/js/safety-checklist-manage.js"></script>
</body>
</html>