Files
tk-factory-services/system1-factory/web/pages/safety/report.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

779 lines
24 KiB
HTML

<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>신고 | (주)테크니컬코리아</title>
<link rel="stylesheet" href="/css/design-system.css">
<link rel="stylesheet" href="/css/common.css?v=2">
<link rel="stylesheet" href="/css/project-management.css?v=3">
<link rel="icon" type="image/png" href="/img/favicon.png">
<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>
<style>
/* 스텝 인디케이터 */
.step-indicator {
display: flex;
justify-content: center;
align-items: center;
gap: 0;
margin-bottom: 2rem;
padding: 1.5rem;
background: white;
border-radius: 0.75rem;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.step {
display: flex;
align-items: center;
gap: 0.5rem;
color: #9ca3af;
font-size: 0.875rem;
}
.step-connector {
width: 60px;
height: 2px;
background: #e5e7eb;
margin: 0 1rem;
}
.step.active .step-connector,
.step.completed .step-connector {
background: #3b82f6;
}
.step.active {
color: #3b82f6;
}
.step.completed {
color: #10b981;
}
.step-number {
width: 32px;
height: 32px;
border-radius: 50%;
background: #f3f4f6;
border: 2px solid #e5e7eb;
display: flex;
align-items: center;
justify-content: center;
font-weight: 600;
font-size: 0.875rem;
}
.step.active .step-number {
background: #3b82f6;
border-color: #3b82f6;
color: white;
}
.step.completed .step-number {
background: #10b981;
border-color: #10b981;
color: white;
}
.step-text {
font-weight: 500;
}
/* 폼 섹션 */
.form-section {
background: white;
border-radius: 0.75rem;
padding: 1.5rem;
margin-bottom: 1.5rem;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.form-section-title {
font-size: 1rem;
font-weight: 600;
color: #1f2937;
margin-bottom: 1.25rem;
padding-bottom: 0.75rem;
border-bottom: 1px solid #e5e7eb;
display: flex;
align-items: center;
gap: 0.5rem;
}
.form-section-title .section-number {
width: 24px;
height: 24px;
background: #3b82f6;
color: white;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 0.75rem;
font-weight: 700;
}
/* 지도 컨테이너 */
.map-container {
position: relative;
background: #f9fafb;
border: 1px solid #e5e7eb;
border-radius: 0.5rem;
overflow: hidden;
}
#issueMapCanvas {
display: block;
cursor: crosshair;
}
.selected-location-info {
margin-top: 1rem;
padding: 1rem;
background: #eff6ff;
border: 1px solid #bfdbfe;
border-radius: 0.5rem;
color: #1e40af;
font-weight: 500;
}
.selected-location-info.empty {
background: #f9fafb;
border-color: #e5e7eb;
color: #6b7280;
text-align: center;
}
.custom-location-toggle {
margin-top: 1rem;
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.75rem;
background: #f9fafb;
border-radius: 0.5rem;
}
.custom-location-toggle input[type="checkbox"] {
width: 18px;
height: 18px;
accent-color: #3b82f6;
}
.custom-location-input {
margin-top: 0.75rem;
display: none;
}
.custom-location-input.visible {
display: block;
}
.custom-location-input input {
width: 100%;
padding: 0.75rem 1rem;
border: 1px solid #d1d5db;
border-radius: 0.5rem;
font-size: 0.875rem;
}
.custom-location-input input:focus {
outline: none;
border-color: #3b82f6;
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
/* 유형 선택 버튼 */
.type-buttons {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 1rem;
}
.type-btn {
padding: 1.5rem;
border: 2px solid #e5e7eb;
border-radius: 0.75rem;
background: white;
cursor: pointer;
transition: all 0.2s;
text-align: center;
}
.type-btn:hover {
border-color: #d1d5db;
background: #f9fafb;
}
.type-btn.selected {
border-color: #3b82f6;
background: #eff6ff;
}
.type-btn.nonconformity.selected {
border-color: #f97316;
background: #fff7ed;
}
.type-btn.safety.selected {
border-color: #ef4444;
background: #fef2f2;
}
.type-btn-icon {
font-size: 2rem;
margin-bottom: 0.5rem;
}
.type-btn-title {
font-size: 1rem;
font-weight: 600;
color: #1f2937;
margin-bottom: 0.25rem;
}
.type-btn-desc {
font-size: 0.8rem;
color: #6b7280;
}
/* 카테고리 선택 */
#categoryContainer {
margin-top: 1.5rem;
padding-top: 1.5rem;
border-top: 1px solid #e5e7eb;
}
.category-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
gap: 0.75rem;
}
.category-btn {
padding: 1rem;
border: 1px solid #e5e7eb;
border-radius: 0.5rem;
background: white;
cursor: pointer;
transition: all 0.2s;
text-align: center;
font-size: 0.875rem;
font-weight: 500;
}
.category-btn:hover {
border-color: #3b82f6;
background: #f9fafb;
}
.category-btn.selected {
border-color: #3b82f6;
background: #eff6ff;
color: #1d4ed8;
}
/* 항목 선택 */
.item-grid {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
}
.item-btn {
padding: 0.625rem 1rem;
border: 1px solid #e5e7eb;
border-radius: 9999px;
background: white;
cursor: pointer;
transition: all 0.2s;
font-size: 0.875rem;
}
.item-btn:hover {
border-color: #3b82f6;
background: #f9fafb;
}
.item-btn.selected {
border-color: #3b82f6;
background: #3b82f6;
color: white;
}
.item-btn[data-severity="critical"].selected {
background: #ef4444;
border-color: #ef4444;
}
.item-btn[data-severity="high"].selected {
background: #f97316;
border-color: #f97316;
}
.item-btn.custom-input-btn {
border-style: dashed;
color: #6b7280;
}
.item-btn.custom-input-btn:hover {
border-color: #3b82f6;
color: #3b82f6;
}
.item-btn.custom-input-btn.selected {
border-style: solid;
background: #dbeafe;
color: #1d4ed8;
}
/* 직접 입력 영역 */
.custom-item-input {
margin-top: 1rem;
padding: 1rem;
background: #f0f9ff;
border: 1px solid #bae6fd;
border-radius: 0.5rem;
display: flex;
gap: 0.5rem;
align-items: center;
}
.custom-item-input input {
flex: 1;
padding: 0.625rem 0.875rem;
border: 1px solid #d1d5db;
border-radius: 0.375rem;
font-size: 0.875rem;
}
.custom-item-input input:focus {
outline: none;
border-color: #3b82f6;
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.btn-confirm-custom {
padding: 0.625rem 1rem;
background: #3b82f6;
color: white;
border: none;
border-radius: 0.375rem;
font-size: 0.875rem;
font-weight: 500;
cursor: pointer;
}
.btn-confirm-custom:hover {
background: #2563eb;
}
.btn-cancel-custom {
padding: 0.625rem 1rem;
background: white;
color: #4b5563;
border: 1px solid #d1d5db;
border-radius: 0.375rem;
font-size: 0.875rem;
cursor: pointer;
}
.btn-cancel-custom:hover {
background: #f9fafb;
}
/* 사진 업로드 */
.photo-upload-grid {
display: grid;
grid-template-columns: repeat(5, 1fr);
gap: 0.75rem;
}
.photo-slot {
aspect-ratio: 1;
border: 2px dashed #d1d5db;
border-radius: 0.5rem;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.2s;
position: relative;
overflow: hidden;
background: #f9fafb;
}
.photo-slot:hover {
border-color: #3b82f6;
background: #eff6ff;
}
.photo-slot.has-photo {
border-style: solid;
border-color: #10b981;
}
.photo-slot img {
width: 100%;
height: 100%;
object-fit: cover;
}
.photo-slot .add-icon {
font-size: 1.5rem;
color: #9ca3af;
}
.photo-slot .remove-btn {
position: absolute;
top: 4px;
right: 4px;
width: 24px;
height: 24px;
border-radius: 50%;
background: #ef4444;
color: white;
border: none;
cursor: pointer;
display: none;
align-items: center;
justify-content: center;
font-size: 14px;
}
.photo-slot.has-photo .remove-btn {
display: flex;
}
.photo-slot.has-photo .add-icon {
display: none;
}
/* 추가 설명 */
.additional-textarea {
width: 100%;
min-height: 100px;
padding: 0.75rem 1rem;
border: 1px solid #d1d5db;
border-radius: 0.5rem;
font-size: 0.875rem;
resize: vertical;
font-family: inherit;
}
.additional-textarea:focus {
outline: none;
border-color: #3b82f6;
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
/* 제출 버튼 */
.form-actions {
display: flex;
justify-content: flex-end;
gap: 0.75rem;
margin-top: 1.5rem;
}
.btn-submit {
padding: 0.875rem 2rem;
background: #3b82f6;
color: white;
border: none;
border-radius: 0.5rem;
font-size: 0.9375rem;
font-weight: 600;
cursor: pointer;
transition: all 0.2s;
}
.btn-submit:hover {
background: #2563eb;
}
.btn-submit:disabled {
background: #9ca3af;
cursor: not-allowed;
}
.btn-cancel {
padding: 0.875rem 1.5rem;
background: white;
color: #4b5563;
border: 1px solid #d1d5db;
border-radius: 0.5rem;
font-size: 0.9375rem;
font-weight: 500;
cursor: pointer;
}
.btn-cancel:hover {
background: #f9fafb;
}
/* 작업 선택 모달 */
.work-selection-modal {
display: none;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
z-index: 1000;
align-items: center;
justify-content: center;
}
.work-selection-modal.visible {
display: flex;
}
.work-selection-content {
background: white;
padding: 1.5rem;
border-radius: 0.75rem;
max-width: 500px;
width: 90%;
box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}
.work-selection-title {
font-size: 1.125rem;
font-weight: 600;
margin-bottom: 1rem;
}
.work-option {
padding: 1rem;
border: 1px solid #e5e7eb;
border-radius: 0.5rem;
margin-bottom: 0.75rem;
cursor: pointer;
transition: all 0.2s;
}
.work-option:hover {
border-color: #3b82f6;
background: #eff6ff;
}
.work-option-title {
font-weight: 600;
margin-bottom: 0.25rem;
}
.work-option-desc {
font-size: 0.875rem;
color: #6b7280;
}
/* 반응형 */
@media (max-width: 768px) {
.type-buttons {
grid-template-columns: 1fr;
}
.photo-upload-grid {
grid-template-columns: repeat(3, 1fr);
}
.step-indicator {
flex-wrap: wrap;
justify-content: center;
gap: 0.5rem;
}
.step-connector {
display: none;
}
.step-text {
display: none;
}
}
</style>
</head>
<body>
<div class="work-report-container">
<div id="navbar-container"></div>
<main class="work-report-main">
<div class="dashboard-main">
<div class="page-header">
<div class="page-title-section">
<h1 class="page-title">신고</h1>
<p class="page-description">작업 중 발견된 부적합 사항 또는 안전 문제를 신고합니다.</p>
</div>
</div>
<!-- 단계 표시 -->
<div class="step-indicator">
<div class="step active" data-step="1">
<span class="step-number">1</span>
<span class="step-text">위치 선택</span>
</div>
<div class="step-connector"></div>
<div class="step" data-step="2">
<span class="step-number">2</span>
<span class="step-text">유형 선택</span>
</div>
<div class="step-connector"></div>
<div class="step" data-step="3">
<span class="step-number">3</span>
<span class="step-text">항목 선택</span>
</div>
<div class="step-connector"></div>
<div class="step" data-step="4">
<span class="step-number">4</span>
<span class="step-text">사진/설명</span>
</div>
</div>
<!-- Step 1: 위치 선택 -->
<div class="form-section" id="step1Section">
<h2 class="form-section-title">
<span class="section-number">1</span>
발생 위치 선택
</h2>
<div class="form-group">
<label class="form-label">공장 선택</label>
<select id="factorySelect" class="form-control">
<option value="">공장을 선택하세요</option>
</select>
</div>
<div class="map-container">
<canvas id="issueMapCanvas"></canvas>
</div>
<div class="selected-location-info empty" id="selectedLocationInfo">
지도에서 작업장을 클릭하여 위치를 선택하세요
</div>
<div class="custom-location-toggle">
<input type="checkbox" id="useCustomLocation">
<label for="useCustomLocation">지도에 없는 위치 직접 입력</label>
</div>
<div class="custom-location-input" id="customLocationInput">
<input type="text" id="customLocation" placeholder="위치를 입력하세요 (예: 야적장 입구, 주차장 등)">
</div>
</div>
<!-- Step 2: 문제 유형 선택 -->
<div class="form-section" id="step2Section">
<h2 class="form-section-title">
<span class="section-number">2</span>
문제 유형 선택
</h2>
<div class="type-buttons">
<div class="type-btn nonconformity" data-type="nonconformity">
<div class="type-btn-icon">&#128203;</div>
<div class="type-btn-title">부적합 사항</div>
<div class="type-btn-desc">자재, 설계, 검사 관련 문제</div>
</div>
<div class="type-btn safety" data-type="safety">
<div class="type-btn-icon">&#9888;</div>
<div class="type-btn-title">안전 문제</div>
<div class="type-btn-desc">보호구, 위험구역, 안전수칙 관련</div>
</div>
</div>
<div id="categoryContainer" style="display: none;">
<label class="form-label">세부 카테고리</label>
<div class="category-grid" id="categoryGrid"></div>
</div>
</div>
<!-- Step 3: 신고 항목 선택 -->
<div class="form-section" id="step3Section">
<h2 class="form-section-title">
<span class="section-number">3</span>
신고 항목 선택
</h2>
<p style="color: #6b7280; margin-bottom: 1rem; font-size: 0.875rem;">해당하는 항목을 선택하거나 직접 입력하세요.</p>
<div class="item-grid" id="itemGrid">
<p style="color: #9ca3af;">먼저 카테고리를 선택하세요</p>
</div>
<!-- 직접 입력 영역 -->
<div class="custom-item-input" id="customItemInput" style="display: none;">
<input type="text" id="customItemName" placeholder="신고 항목을 직접 입력하세요..." maxlength="100">
<button type="button" class="btn-confirm-custom" onclick="confirmCustomItem()">확인</button>
<button type="button" class="btn-cancel-custom" onclick="cancelCustomItem()">취소</button>
</div>
</div>
<!-- Step 4: 사진 및 추가 설명 -->
<div class="form-section" id="step4Section">
<h2 class="form-section-title">
<span class="section-number">4</span>
사진 및 추가 설명
</h2>
<div class="form-group">
<label class="form-label">사진 첨부 (최대 5장)</label>
<div class="photo-upload-grid">
<div class="photo-slot" data-index="0">
<span class="add-icon">+</span>
<button class="remove-btn" type="button">&times;</button>
</div>
<div class="photo-slot" data-index="1">
<span class="add-icon">+</span>
<button class="remove-btn" type="button">&times;</button>
</div>
<div class="photo-slot" data-index="2">
<span class="add-icon">+</span>
<button class="remove-btn" type="button">&times;</button>
</div>
<div class="photo-slot" data-index="3">
<span class="add-icon">+</span>
<button class="remove-btn" type="button">&times;</button>
</div>
<div class="photo-slot" data-index="4">
<span class="add-icon">+</span>
<button class="remove-btn" type="button">&times;</button>
</div>
</div>
<input type="file" id="photoInput" accept="image/*" capture="environment" style="display: none;">
</div>
<div class="form-group">
<label class="form-label" for="additionalDescription">추가 설명 (선택)</label>
<textarea id="additionalDescription" class="additional-textarea" placeholder="추가로 설명이 필요한 내용을 입력하세요..."></textarea>
</div>
</div>
<!-- 제출 버튼 -->
<div class="form-actions">
<button type="button" class="btn-cancel" onclick="history.back()">취소</button>
<button type="button" class="btn-submit" id="submitBtn" onclick="submitReport()">신고 제출</button>
</div>
</div>
</main>
<!-- 작업 선택 모달 -->
<div class="work-selection-modal" id="workSelectionModal">
<div class="work-selection-content">
<h3 class="work-selection-title">작업 선택</h3>
<p style="margin-bottom: 1rem; color: #6b7280; font-size: 0.875rem;">이 위치에 등록된 작업이 있습니다. 연결할 작업을 선택하세요.</p>
<div id="workOptionsList"></div>
<button type="button" onclick="closeWorkModal()" style="width: 100%; padding: 0.75rem; margin-top: 0.5rem; background: #f3f4f6; border: none; border-radius: 0.5rem; cursor: pointer; font-size: 0.875rem;">
작업 연결 없이 진행
</button>
</div>
</div>
</div>
<script src="/js/issue-report.js?v=2"></script>
</body>
</html>