feat: TBM 시스템 구축 및 페이지 권한 관리 기능 추가

## 주요 변경사항

### 1. TBM (Tool Box Meeting) 시스템 구축
- **데이터베이스 스키마** (5개 테이블 생성)
  - tbm_sessions: TBM 세션 관리
  - tbm_team_assignments: 팀 구성 관리
  - tbm_safety_checks: 안전 체크리스트 마스터 (17개 항목)
  - tbm_safety_records: 안전 체크 기록
  - team_handovers: 작업 인계 관리

- **API 엔드포인트** (17개)
  - TBM 세션 CRUD
  - 팀 구성 관리
  - 안전 체크리스트
  - 작업 인계
  - 통계 및 리포트

- **프론트엔드**
  - TBM 관리 페이지 (/pages/work/tbm.html)
  - 모달 기반 UI (세션 생성, 팀 구성, 안전 체크)

### 2. 페이지 권한 관리 시스템
- 페이지별 접근 권한 설정 기능
- 관리자 페이지 (/pages/admin/page-access.html)
- 사용자별 페이지 권한 부여/회수
- TBM 페이지 등록 및 권한 연동

### 3. 네비게이션 role 표시 버그 수정
- load-navbar.js: case-insensitive role 매칭 적용
- JWT의 "Admin" role이 "관리자"로 정상 표시
- admin-only 메뉴 항목 정상 표시

### 4. 대시보드 개선
- 작업 현황 테이블 가독성 향상
- 고대비 색상 및 명확한 구분선 적용
- 이모지 제거 및 SVG 아이콘 적용

### 5. 문서화
- TBM 배포 가이드 작성 (docs/TBM_DEPLOYMENT_GUIDE.md)
- 데이터베이스 스키마 상세 기록
- 배포 절차 및 체크리스트 제공

## 기술 스택
- Backend: Node.js, Express, MySQL
- Frontend: Vanilla JavaScript, HTML5, CSS3
- Database: MySQL (InnoDB)

## 파일 변경사항

### 신규 파일
- api.hyungi.net/db/migrations/20260120000000_create_tbm_system.js
- api.hyungi.net/db/migrations/20260120000001_add_tbm_page.js
- api.hyungi.net/models/tbmModel.js
- api.hyungi.net/models/pageAccessModel.js
- api.hyungi.net/controllers/tbmController.js
- api.hyungi.net/controllers/pageAccessController.js
- api.hyungi.net/routes/tbmRoutes.js
- web-ui/pages/work/tbm.html
- web-ui/pages/admin/page-access.html
- web-ui/js/page-access-management.js
- docs/TBM_DEPLOYMENT_GUIDE.md

### 수정 파일
- api.hyungi.net/config/routes.js (TBM 라우트 추가)
- web-ui/js/load-navbar.js (role 매칭 버그 수정)
- web-ui/pages/admin/workers.html (HTML 구조 수정)
- web-ui/pages/dashboard.html (이모지 제거)
- web-ui/css/design-system.css (색상 팔레트 추가)
- web-ui/css/modern-dashboard.css (가독성 개선)
- web-ui/js/modern-dashboard.js (SVG 아이콘 적용)

## 배포 시 주의사항
⚠️ 본 서버 배포 시 반드시 마이그레이션 실행 필요:
```bash
npm run db:migrate
```

상세한 배포 절차는 docs/TBM_DEPLOYMENT_GUIDE.md 참조

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-01-20 15:38:17 +09:00
parent 0ec099b493
commit 4d0c4c0801
18 changed files with 3321 additions and 107 deletions

View File

@@ -58,6 +58,28 @@
--info-500: #03a9f4;
--info-700: #0288d1;
/* 따뜻한 중성 색상 (베이지/크림) */
--warm-50: #fafaf9; /* 매우 밝은 크림 */
--warm-100: #f5f5f4; /* 밝은 크림 */
--warm-200: #e7e5e4; /* 베이지 */
--warm-300: #d6d3d1; /* 중간 베이지 */
--warm-400: #a8a29e; /* 진한 베이지 */
--warm-500: #78716c; /* 그레이 베이지 */
/* 부드러운 작업 상태 색상 (눈이 편한 톤) */
--status-success-bg: #dcfce7; /* 부드러운 초록 배경 */
--status-success-text: #16a34a; /* 부드러운 초록 텍스트 */
--status-info-bg: #e0f2fe; /* 부드러운 하늘색 배경 */
--status-info-text: #0284c7; /* 부드러운 하늘색 텍스트 */
--status-warning-bg: #fef3c7; /* 부드러운 노랑 배경 */
--status-warning-text: #ca8a04; /* 부드러운 노랑 텍스트 */
--status-error-bg: #fee2e2; /* 부드러운 빨강 배경 */
--status-error-text: #dc2626; /* 부드러운 빨강 텍스트 */
--status-critical-bg: #fecaca; /* 진한 빨강 배경 */
--status-critical-text: #b91c1c; /* 진한 빨강 텍스트 */
--status-vacation-bg: #fed7aa; /* 부드러운 주황 배경 */
--status-vacation-text: #ea580c; /* 부드러운 주황 텍스트 */
/* 배경 색상 */
--bg-primary: #ffffff;
--bg-secondary: #f8fafc;

View File

@@ -1965,3 +1965,364 @@
color: #6b7280;
width: 100%;
}
/* ========== 작업 현황 테이블 ========== */
.work-status-table-container {
background: white;
border-radius: var(--radius-lg);
overflow: hidden;
border: 1px solid #d1d5db;
box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.05);
}
.work-status-table {
width: 100%;
border-collapse: collapse;
background: white;
}
.work-status-table thead {
background: #f9fafb;
border-bottom: 2px solid #d1d5db;
}
.work-status-table th {
padding: 1rem 1.25rem;
text-align: left;
font-weight: 600;
color: #374151;
font-size: 0.875rem;
letter-spacing: 0.025em;
text-transform: uppercase;
border-right: 1px solid #e5e7eb;
}
.work-status-table th:last-child {
border-right: none;
}
.work-status-table tbody tr {
background: white;
border-bottom: 1px solid #e5e7eb;
transition: var(--transition-fast);
}
.work-status-table tbody tr:nth-child(even) {
background: #fafafa;
}
.work-status-table tbody tr:hover {
background: #f3f4f6;
}
.work-status-table tbody tr:last-child {
border-bottom: none;
}
.work-status-table td {
padding: 1rem 1.25rem;
font-size: 0.9375rem;
line-height: 1.5;
vertical-align: middle;
border-right: 1px solid #f3f4f6;
color: #1f2937;
}
.work-status-table td:last-child {
border-right: none;
}
/* 로딩 상태 */
.work-status-table .loading-state {
text-align: center;
padding: var(--space-12);
color: var(--text-tertiary);
}
.work-status-table .loading-state .spinner {
margin: 0 auto var(--space-4);
}
/* 작업자 정보 셀 */
.worker-info {
display: flex;
align-items: center;
gap: 0.75rem;
}
.worker-avatar {
width: 36px;
height: 36px;
border-radius: var(--radius-full);
background: linear-gradient(135deg, #3b82f6, #2563eb);
color: white;
display: flex;
align-items: center;
justify-content: center;
font-weight: 600;
font-size: 0.875rem;
flex-shrink: 0;
}
.worker-details {
display: flex;
flex-direction: column;
gap: 0.25rem;
}
.worker-name {
font-weight: 600;
color: #111827;
font-size: 0.9375rem;
line-height: 1.2;
}
.worker-job {
font-size: 0.8125rem;
color: #6b7280;
line-height: 1.2;
}
/* 상태 배지 */
.worker-status {
white-space: nowrap;
}
.status-badge {
display: inline-flex;
align-items: center;
gap: 0.5rem;
padding: 0.5rem 0.875rem;
border-radius: 0.375rem;
font-size: 0.875rem;
font-weight: 600;
white-space: nowrap;
border: 1px solid;
}
.status-badge .status-icon {
width: 16px;
height: 16px;
flex-shrink: 0;
}
.status-badge.status-success {
background: #dcfce7;
color: #166534;
border-color: #86efac;
}
.status-badge.status-info {
background: #dbeafe;
color: #1e40af;
border-color: #93c5fd;
}
.status-badge.status-warning {
background: #fef3c7;
color: #92400e;
border-color: #fde047;
}
.status-badge.status-error {
background: #fee2e2;
color: #991b1b;
border-color: #fca5a5;
}
.status-badge.status-critical {
background: #fecaca;
color: #7f1d1d;
border-color: #f87171;
}
.status-badge.status-vacation {
background: #fed7aa;
color: #9a3412;
border-color: #fdba74;
}
.status-badge.status-incomplete {
background: #f3f4f6;
color: #374151;
border-color: #d1d5db;
}
.status-badge.status-overtime {
background: #e0e7ff;
color: #3730a3;
border-color: #a5b4fc;
}
/* 작업시간 셀 */
.worker-hours {
white-space: nowrap;
}
.hours-value {
font-weight: 600;
color: #111827;
font-size: 1rem;
}
.hours-value.hours-warning {
color: #dc2626;
font-weight: 700;
}
/* 작업건수 셀 */
.worker-tasks {
white-space: nowrap;
}
.tasks-summary {
display: flex;
flex-direction: column;
gap: 0.25rem;
}
.task-count {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 0.875rem;
}
.task-label {
color: #6b7280;
font-weight: 500;
}
.task-value {
color: #111827;
font-weight: 600;
}
.task-count.task-error .task-label {
color: #dc2626;
}
.task-count.task-error .task-value {
color: #991b1b;
font-weight: 700;
}
/* 액션 버튼 */
.worker-actions {
white-space: nowrap;
}
.action-buttons {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
}
.action-btn {
display: inline-flex;
align-items: center;
gap: 0.375rem;
padding: 0.5rem 0.875rem;
border-radius: 0.375rem;
font-size: 0.875rem;
font-weight: 600;
border: 1px solid;
cursor: pointer;
transition: all 0.15s ease;
white-space: nowrap;
}
.action-btn svg {
width: 14px;
height: 14px;
flex-shrink: 0;
}
.action-btn.btn-edit {
background: #3b82f6;
color: white;
border-color: #3b82f6;
}
.action-btn.btn-edit:hover {
background: #2563eb;
border-color: #2563eb;
transform: translateY(-1px);
box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}
.action-btn.btn-vacation {
background: white;
color: #ea580c;
border-color: #ea580c;
}
.action-btn.btn-vacation:hover {
background: #ea580c;
color: white;
}
.action-btn.btn-confirm {
background: white;
color: #16a34a;
border-color: #16a34a;
}
.action-btn.btn-confirm:hover {
background: #16a34a;
color: white;
}
/* 반응형 디자인 */
@media (max-width: 768px) {
.work-status-table {
display: block;
}
.work-status-table thead {
display: none;
}
.work-status-table tbody,
.work-status-table tr,
.work-status-table td {
display: block;
width: 100%;
}
.work-status-table tr {
margin-bottom: 1rem;
border: 2px solid #d1d5db;
border-radius: 0.5rem;
padding: 1rem;
background: white;
}
.work-status-table td {
padding: var(--space-3) 0;
border-bottom: 1px solid var(--warm-100);
}
.work-status-table td:last-child {
border-bottom: none;
}
.work-status-table td::before {
content: attr(data-label);
font-weight: var(--font-semibold);
display: block;
margin-bottom: var(--space-2);
color: var(--text-secondary);
font-size: var(--text-sm);
text-transform: uppercase;
}
.worker-actions {
flex-direction: column;
}
.action-btn {
width: 100%;
text-align: center;
}
}

View File

@@ -34,6 +34,9 @@ function processNavbarDom(doc) {
* @param {string} userRole - 현재 사용자의 역할
*/
function filterMenuByRole(doc, userRole) {
// 대소문자 구분 없이 처리
const userRoleLower = (userRole || '').toLowerCase();
const selectors = [
{ role: 'admin', selector: '.admin-only' },
{ role: 'system', selector: '.system-only' },
@@ -41,7 +44,7 @@ function filterMenuByRole(doc, userRole) {
];
selectors.forEach(({ role, selector }) => {
if (userRole !== role && userRole !== 'system') {
if (userRoleLower !== role && userRoleLower !== 'system') {
doc.querySelectorAll(selector).forEach(el => el.remove());
}
});
@@ -54,7 +57,9 @@ function filterMenuByRole(doc, userRole) {
*/
function populateUserInfo(doc, user) {
const displayName = user.name || user.username;
const roleName = ROLE_NAMES[user.role] || ROLE_NAMES.default;
// 대소문자 구분 없이 처리
const roleLower = (user.role || '').toLowerCase();
const roleName = ROLE_NAMES[roleLower] || ROLE_NAMES.default;
const elements = {
'userName': displayName,

View File

@@ -287,100 +287,143 @@ function updateSummaryCard(element, value, unit) {
}
}
// ========== SVG 아이콘 정의 ========== //
const SVG_ICONS = {
complete: `<svg class="status-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="20 6 9 17 4 12"></polyline>
</svg>`,
overtime: `<svg class="status-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"></circle>
<polyline points="12 6 12 12 16 14"></polyline>
</svg>`,
vacation: `<svg class="status-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"></path>
<circle cx="12" cy="10" r="3"></circle>
</svg>`,
partial: `<svg class="status-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M12 2v20M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"></path>
</svg>`,
incomplete: `<svg class="status-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"></circle>
<line x1="15" y1="9" x2="9" y2="15"></line>
<line x1="9" y1="9" x2="15" y2="15"></line>
</svg>`,
warning: `<svg class="status-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path>
<line x1="12" y1="9" x2="12" y2="13"></line>
<line x1="12" y1="17" x2="12.01" y2="17"></line>
</svg>`
};
// ========== 작업 현황 표시 (작업자 중심) ========== //
function displayWorkStatus() {
if (!elements.workStatusContainer) return;
const tableBody = document.getElementById('workStatusTableBody');
if (!tableBody) return;
// 모든 작업자 데이터 가져오기 (작업이 없는 작업자도 포함)
const allWorkers = workersData || [];
if (allWorkers.length === 0) {
elements.workStatusContainer.innerHTML = `
<div class="empty-state">
<div class="empty-icon">👥</div>
<h3>등록된 작업자가 없습니다</h3>
<p>시스템에 작업자가 등록되어 있지 않습니다.</p>
</div>
tableBody.innerHTML = `
<tr>
<td colspan="5" class="empty-state">
<p>등록된 작업자가 없습니다</p>
</td>
</tr>
`;
return;
}
// 작업자별 상황 분석
const workerStatusList = allWorkers.map(worker => {
const todayWork = workData.filter(w => w.worker_id === worker.worker_id);
const totalHours = todayWork.reduce((sum, w) => sum + parseFloat(w.work_hours || 0), 0);
// 휴가/연차 제외한 실제 작업시간 계산
const actualWorkHours = todayWork
.filter(w => w.project_id !== 13) // 연차/휴무 프로젝트 제외
.reduce((sum, w) => sum + parseFloat(w.work_hours || 0), 0);
const hasError = todayWork.some(w => w.work_status_id === 2);
// 정규 작업과 에러 작업 건수 분리
const regularWorkCount = todayWork.filter(w => w.project_id !== 13 && w.work_status_id !== 2).length;
const errorWorkCount = todayWork.filter(w => w.project_id !== 13 && w.work_status_id === 2).length;
// 상태 판단 로직 (개선된 버전)
let status = 'incomplete';
let statusText = '미입력';
let statusBadge = '미입력';
let statusClass = 'incomplete';
let vacationType = null;
// 휴가 처리된 경우 확인 (프로젝트 ID 13 = "연차/휴무" 또는 설명에 휴가 키워드)
const hasVacationRecord = todayWork.some(w =>
const hasVacationRecord = todayWork.some(w =>
w.project_id === 13 || // 연차/휴무 프로젝트
(w.description && (
w.description.includes('연차') ||
w.description.includes('반차') ||
w.description.includes('연차') ||
w.description.includes('반차') ||
w.description.includes('휴가')
))
);
// 연차/휴무 프로젝트의 시간 계산
const vacationHours = todayWork
.filter(w => w.project_id === 13)
.reduce((sum, w) => sum + parseFloat(w.work_hours || 0), 0);
if (totalHours > 12) {
status = 'overtime-warning';
statusText = '초과근무 확인필요';
statusBadge = '확인필요';
statusClass = 'warning';
} else if (hasVacationRecord && vacationHours > 0) {
// 연차/휴무 시간에 따른 상태 결정
if (vacationHours === 8) {
status = 'vacation-full';
statusText = '연차';
statusBadge = '연차';
statusClass = 'vacation';
} else if (vacationHours === 6) {
status = 'vacation-half-half';
statusText = '조퇴';
statusBadge = '조퇴';
statusClass = 'vacation';
} else if (vacationHours === 4) {
status = 'vacation-half';
statusText = '반차';
statusBadge = '반차';
statusClass = 'vacation';
} else if (vacationHours === 2) {
status = 'vacation-quarter';
statusText = '반반차';
statusBadge = '반반차';
statusClass = 'vacation';
}
} else if (totalHours > 8) {
// 8시간 초과 - 연장근로
status = 'overtime';
statusText = '연장근로';
statusBadge = '연장근로';
statusClass = 'overtime';
} else if (totalHours === 8) {
// 정확히 8시간 - 정시근로
status = 'complete';
statusText = '정시근로';
statusBadge = '정시근로';
statusClass = 'success';
} else if (totalHours > 0) {
// 0시간 초과 8시간 미만 - 부분 입력
status = 'partial';
statusText = '부분 입력';
statusBadge = '부분입력';
statusClass = 'info';
// 휴가 처리 필요 여부 판단
if (totalHours === 0) {
vacationType = 'full';
@@ -394,9 +437,10 @@ function displayWorkStatus() {
status = 'incomplete';
statusText = '미입력';
statusBadge = '미입력';
statusClass = 'incomplete';
vacationType = 'full';
}
return {
...worker,
todayWork,
@@ -408,79 +452,92 @@ function displayWorkStatus() {
status,
statusText,
statusBadge,
statusClass,
vacationType
};
});
elements.workStatusContainer.innerHTML = `
<div class="worker-status-list">
<div class="worker-status-header">
<div class="header-title">
<h3>작업자별 현황</h3>
<span class="header-date">${selectedDate}</span>
</div>
<div class="status-legend">
<span class="legend-item legend-complete">정시근로</span>
<span class="legend-item legend-overtime">연장근로</span>
<span class="legend-item legend-vacation">휴가</span>
<span class="legend-item legend-partial">부분입력</span>
<span class="legend-item legend-incomplete">미입력</span>
</div>
</div>
<div class="worker-status-rows">
${workerStatusList.map(worker => `
<div class="worker-status-row ${worker.status}" data-worker-id="${worker.worker_id}">
<div class="worker-basic-info">
<div class="worker-avatar">
<span>${worker.worker_name.charAt(0)}</span>
</div>
<div class="worker-details">
<h4 class="worker-name">${worker.worker_name}</h4>
<p class="worker-job">${worker.job_type || '작업자'}</p>
</div>
</div>
<div class="worker-status-indicator">
<span class="status-badge status-${worker.status}">${worker.statusBadge}</span>
</div>
<div class="worker-stats-inline">
<div class="stat-item">
<span class="stat-label">작업시간</span>
<span class="stat-value ${worker.actualWorkHours > 12 ? 'warning' : ''}">${worker.actualWorkHours.toFixed(1)}h</span>
</div>
<div class="stat-item">
<span class="stat-label">정규</span>
<span class="stat-value">${worker.regularWorkCount}건</span>
</div>
${worker.errorWorkCount > 0 ? `
<div class="stat-item error">
<span class="stat-label">에러</span>
<span class="stat-value">${worker.errorWorkCount}건</span>
</div>
` : ''}
</div>
<div class="worker-actions-inline">
<button class="btn btn-sm btn-primary worker-edit-btn" onclick="openWorkerModal(${worker.worker_id}, '${worker.worker_name}')">
작업입력
</button>
${worker.vacationType ? `
<button class="btn btn-sm btn-secondary vacation-btn" onclick="handleVacation(${worker.worker_id}, '${worker.vacationType}')">
${worker.vacationType === 'full' ? '연차처리' : worker.vacationType === 'half' ? '반차처리' : '반반차처리'}
</button>
` : ''}
${worker.status === 'overtime-warning' ? `
<button class="btn btn-sm btn-warning confirm-overtime-btn" onclick="confirmOvertime(${worker.worker_id})">
정상확인
</button>
` : ''}
</div>
// 테이블 행 렌더링
tableBody.innerHTML = workerStatusList.map(worker => {
// 상태에 따른 SVG 아이콘 선택
let iconKey = 'incomplete';
if (worker.status === 'overtime-warning') iconKey = 'warning';
else if (worker.status.startsWith('vacation')) iconKey = 'vacation';
else if (worker.status === 'overtime') iconKey = 'overtime';
else if (worker.status === 'complete') iconKey = 'complete';
else if (worker.status === 'partial') iconKey = 'partial';
return `
<tr data-worker-id="${worker.worker_id}">
<td data-label="작업자" class="worker-info">
<div class="worker-avatar">
<span>${worker.worker_name.charAt(0)}</span>
</div>
`).join('')}
</div>
</div>
`;
<div class="worker-details">
<div class="worker-name">${worker.worker_name}</div>
<div class="worker-job">${worker.job_type || '작업자'}</div>
</div>
</td>
<td data-label="상태" class="worker-status">
<span class="status-badge status-${worker.statusClass}">
${SVG_ICONS[iconKey]}
<span class="status-text">${worker.statusBadge}</span>
</span>
</td>
<td data-label="작업시간" class="worker-hours">
<span class="hours-value ${worker.actualWorkHours > 12 ? 'hours-warning' : ''}">${worker.actualWorkHours.toFixed(1)}h</span>
</td>
<td data-label="작업건수" class="worker-tasks">
<div class="tasks-summary">
<span class="task-count">
<span class="task-label">정규:</span>
<span class="task-value">${worker.regularWorkCount}건</span>
</span>
${worker.errorWorkCount > 0 ? `
<span class="task-count task-error">
<span class="task-label">에러:</span>
<span class="task-value">${worker.errorWorkCount}건</span>
</span>
` : ''}
</div>
</td>
<td data-label="액션" class="worker-actions">
<div class="action-buttons">
<button class="action-btn btn-edit" onclick="openWorkerModal(${worker.worker_id}, '${worker.worker_name}')" title="작업입력">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path>
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path>
</svg>
<span class="action-text">작업입력</span>
</button>
${worker.vacationType ? `
<button class="action-btn btn-vacation" onclick="handleVacation(${worker.worker_id}, '${worker.vacationType}')" title="${worker.vacationType === 'full' ? '연차처리' : worker.vacationType === 'half' ? '반차처리' : '반반차처리'}">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect>
<line x1="16" y1="2" x2="16" y2="6"></line>
<line x1="8" y1="2" x2="8" y2="6"></line>
<line x1="3" y1="10" x2="21" y2="10"></line>
</svg>
<span class="action-text">${worker.vacationType === 'full' ? '연차' : worker.vacationType === 'half' ? '반차' : '반반차'}</span>
</button>
` : ''}
${worker.status === 'overtime-warning' ? `
<button class="action-btn btn-confirm" onclick="confirmOvertime(${worker.worker_id})" title="정상확인">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="20 6 9 17 4 12"></polyline>
</svg>
<span class="action-text">정상확인</span>
</button>
` : ''}
</div>
</td>
</tr>
`;
}).join('');
}
function groupWorkDataByProject() {

View File

@@ -0,0 +1,338 @@
// page-access-management.js - 페이지 권한 관리
// 전역 변수
let allUsers = [];
let allPages = [];
let currentUserId = null;
let currentFilter = 'all';
// DOM이 로드되면 초기화
document.addEventListener('DOMContentLoaded', async () => {
console.log('🚀 페이지 권한 관리 시스템 초기화');
// API 함수가 로드될 때까지 대기
let retryCount = 0;
while (!window.apiCall && retryCount < 50) {
await new Promise(resolve => setTimeout(resolve, 100));
retryCount++;
}
if (!window.apiCall) {
showToast('시스템을 초기화할 수 없습니다. 페이지를 새로고침해주세요.', 'error');
return;
}
// 이벤트 리스너 설정
setupEventListeners();
// 데이터 로드
await loadInitialData();
});
// 이벤트 리스너 설정
function setupEventListeners() {
// 필터 버튼
document.querySelectorAll('.filter-btn').forEach(btn => {
btn.addEventListener('click', (e) => {
document.querySelectorAll('.filter-btn').forEach(b => b.classList.remove('active'));
e.target.classList.add('active');
currentFilter = e.target.dataset.filter;
filterUsers();
});
});
// 저장 버튼
const saveBtn = document.getElementById('savePageAccessBtn');
if (saveBtn) {
saveBtn.addEventListener('click', savePageAccess);
}
}
// 초기 데이터 로드
async function loadInitialData() {
try {
// 페이지 목록 로드
const pagesResponse = await window.apiCall('/pages');
if (pagesResponse && pagesResponse.success) {
allPages = pagesResponse.data;
console.log('✅ 페이지 목록 로드:', allPages.length + '개');
}
// 사용자 목록 로드 - 계정이 있는 작업자만
const workersResponse = await window.apiCall('/workers?limit=1000');
if (workersResponse) {
const workers = Array.isArray(workersResponse) ? workersResponse : (workersResponse.data || []);
// user_id가 있고 활성 상태인 작업자만 필터링
const usersWithAccounts = workers.filter(w => w.user_id && w.is_active);
// 각 사용자의 페이지 권한 수 조회
allUsers = await Promise.all(usersWithAccounts.map(async (worker) => {
try {
const accessResponse = await window.apiCall(`/users/${worker.user_id}/page-access`);
const grantedPagesCount = accessResponse && accessResponse.success
? accessResponse.data.pageAccess.filter(p => p.can_access).length
: 0;
return {
user_id: worker.user_id,
username: worker.username || 'N/A',
name: worker.name || worker.worker_name,
role_name: worker.role_name || 'User',
worker_name: worker.worker_name,
worker_id: worker.worker_id,
granted_pages_count: grantedPagesCount
};
} catch (error) {
console.error(`권한 조회 오류 (user_id: ${worker.user_id}):`, error);
return {
...worker,
granted_pages_count: 0
};
}
}));
console.log('✅ 사용자 목록 로드:', allUsers.length + '명');
displayUsers();
}
} catch (error) {
console.error('❌ 데이터 로드 오류:', error);
showToast('데이터를 불러오는 중 오류가 발생했습니다.', 'error');
}
}
// 사용자 목록 표시
function displayUsers() {
const tbody = document.getElementById('usersTableBody');
const emptyState = document.getElementById('emptyState');
if (allUsers.length === 0) {
tbody.innerHTML = '';
emptyState.style.display = 'block';
return;
}
emptyState.style.display = 'none';
const filteredUsers = filterUsersByStatus();
if (filteredUsers.length === 0) {
tbody.innerHTML = `
<tr>
<td colspan="6" style="text-align: center; padding: 2rem; color: #6b7280;">
<p>필터 조건에 맞는 사용자가 없습니다.</p>
</td>
</tr>
`;
return;
}
tbody.innerHTML = filteredUsers.map(user => `
<tr>
<td>
<div style="display: flex; align-items: center; gap: 0.5rem;">
<div style="width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, #3b82f6, #2563eb); color: white; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.875rem;">
${(user.name || user.username).charAt(0)}
</div>
<span style="font-weight: 600;">${user.name || user.username}</span>
</div>
</td>
<td>${user.username}</td>
<td>
<span class="badge ${user.role_name === 'Admin' ? 'badge-warning' : 'badge-info'}">
${user.role_name}
</span>
</td>
<td>${user.worker_name || '-'}</td>
<td>
<span style="font-weight: 600; color: ${user.granted_pages_count > 0 ? '#16a34a' : '#6b7280'};">
${user.granted_pages_count}
</span>
<span style="color: #9ca3af;"> / ${allPages.length}개</span>
</td>
<td>
<button class="btn btn-sm btn-primary" onclick="openPageAccessModal(${user.user_id})">
권한 설정
</button>
</td>
</tr>
`).join('');
}
// 사용자 필터링
function filterUsersByStatus() {
if (currentFilter === 'all') {
return allUsers;
} else if (currentFilter === 'with-access') {
return allUsers.filter(u => u.granted_pages_count > 0);
} else if (currentFilter === 'no-access') {
return allUsers.filter(u => u.granted_pages_count === 0);
}
return allUsers;
}
function filterUsers() {
displayUsers();
}
// 페이지 권한 설정 모달 열기
async function openPageAccessModal(userId) {
currentUserId = userId;
const user = allUsers.find(u => u.user_id === userId);
if (!user) {
showToast('사용자 정보를 찾을 수 없습니다.', 'error');
return;
}
// 모달 열기
document.getElementById('pageAccessModal').style.display = 'flex';
document.body.style.overflow = 'hidden';
// 사용자 정보 표시
document.getElementById('modalUserInitial').textContent = (user.name || user.username).charAt(0);
document.getElementById('modalUserName').textContent = user.name || user.username;
document.getElementById('modalUsername').textContent = user.username;
document.getElementById('modalWorkerName').textContent = user.worker_name || '작업자 정보 없음';
// 페이지 목록 로드
try {
const response = await window.apiCall(`/users/${userId}/page-access`);
if (response && response.success) {
const pageAccess = response.data.pageAccess;
renderPageList(pageAccess);
} else {
showToast('페이지 권한 정보를 불러올 수 없습니다.', 'error');
}
} catch (error) {
console.error('페이지 권한 조회 오류:', error);
showToast('페이지 권한 정보를 불러오는 중 오류가 발생했습니다.', 'error');
}
}
// 페이지 목록 렌더링
function renderPageList(pageAccess) {
const container = document.getElementById('pageListContainer');
// 카테고리별로 그룹화
const grouped = {};
pageAccess.forEach(page => {
const category = page.category || 'common';
if (!grouped[category]) {
grouped[category] = [];
}
grouped[category].push(page);
});
const categoryNames = {
'dashboard': '대시보드',
'management': '관리',
'common': '공통',
'admin': '관리자',
'work': '작업',
'guest': '게스트'
};
container.innerHTML = Object.keys(grouped).map(category => `
<div style="margin-bottom: 1rem;">
<div style="font-weight: 600; font-size: 0.875rem; color: #6b7280; padding: 0.5rem; background: #f9fafb; border-radius: 0.375rem; margin-bottom: 0.5rem;">
${categoryNames[category] || category}
</div>
${grouped[category].map(page => `
<div style="padding: 0.75rem; border-bottom: 1px solid #f3f4f6; display: flex; align-items: center; justify-content: space-between;">
<label style="display: flex; align-items: center; gap: 0.75rem; cursor: pointer; flex: 1;">
<input
type="checkbox"
class="page-checkbox"
data-page-id="${page.page_id}"
${page.can_access || page.is_default ? 'checked' : ''}
${page.is_default ? 'disabled' : ''}
style="width: 18px; height: 18px; cursor: pointer;"
/>
<div style="flex: 1;">
<div style="font-weight: 500; color: #111827;">${page.page_name}</div>
<div style="font-size: 0.75rem; color: #9ca3af;">${page.page_path}</div>
</div>
</label>
${page.is_default ? '<span style="font-size: 0.75rem; color: #16a34a; font-weight: 600;">기본 권한</span>' : ''}
</div>
`).join('')}
</div>
`).join('');
}
// 페이지 권한 저장
async function savePageAccess() {
if (!currentUserId) return;
const checkboxes = document.querySelectorAll('.page-checkbox:not([disabled]):checked');
const pageIds = Array.from(checkboxes).map(cb => parseInt(cb.dataset.pageId));
try {
document.getElementById('savePageAccessBtn').disabled = true;
document.getElementById('savePageAccessBtn').textContent = '저장 중...';
const response = await window.apiCall(
`/users/${currentUserId}/page-access`,
'POST',
{ pageIds, canAccess: true }
);
if (response && response.success) {
showToast('페이지 권한이 저장되었습니다.', 'success');
closePageAccessModal();
await loadInitialData(); // 목록 새로고침
} else {
throw new Error(response.error || '저장에 실패했습니다.');
}
} catch (error) {
console.error('페이지 권한 저장 오류:', error);
showToast('페이지 권한 저장 중 오류가 발생했습니다.', 'error');
} finally {
document.getElementById('savePageAccessBtn').disabled = false;
document.getElementById('savePageAccessBtn').textContent = '저장';
}
}
// 모달 닫기
function closePageAccessModal() {
document.getElementById('pageAccessModal').style.display = 'none';
document.body.style.overflow = 'auto';
currentUserId = null;
}
// 토스트 알림
function showToast(message, type = 'info', duration = 3000) {
const container = document.getElementById('toastContainer');
if (!container) return;
const toast = document.createElement('div');
toast.className = `toast ${type}`;
const iconMap = {
success: '✅',
error: '❌',
warning: '⚠️',
info: ''
};
toast.innerHTML = `
<div class="toast-icon">${iconMap[type] || ''}</div>
<div class="toast-message">${message}</div>
<button class="toast-close" onclick="this.parentElement.remove()">×</button>
`;
container.appendChild(toast);
setTimeout(() => {
if (toast.parentElement) {
toast.remove();
}
}, duration);
}
// 전역 함수로 export
window.openPageAccessModal = openPageAccessModal;
window.closePageAccessModal = closePageAccessModal;

View File

@@ -0,0 +1,140 @@
<!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=1">
<link rel="stylesheet" href="/css/admin-settings.css?v=1">
<link rel="icon" type="image/png" href="/img/favicon.png">
<script type="module" src="/js/auth-check.js" defer></script>
</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">
<span class="title-icon">🔐</span>
페이지 접근 권한 관리
</h1>
<p class="page-description">작업자에게 특정 페이지 접근 권한을 부여하거나 회수합니다</p>
</div>
</div>
<!-- 사용자 목록 섹션 -->
<div class="settings-section">
<div class="section-header">
<h2 class="section-title">
<span class="section-icon">👥</span>
사용자 목록
</h2>
<div class="filter-buttons">
<button class="filter-btn active" data-filter="all">전체</button>
<button class="filter-btn" data-filter="with-access">권한 있음</button>
<button class="filter-btn" data-filter="no-access">권한 없음</button>
</div>
</div>
<div class="users-container">
<div class="users-table-container">
<table class="users-table">
<thead>
<tr>
<th>사용자명</th>
<th>아이디</th>
<th>역할</th>
<th>작업자</th>
<th>접근 가능 페이지</th>
<th>관리</th>
</tr>
</thead>
<tbody id="usersTableBody">
<tr>
<td colspan="6" style="text-align: center; padding: 2rem;">
<div class="spinner"></div>
<p>사용자 목록을 불러오는 중...</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="empty-state" id="emptyState" style="display: none;">
<div class="empty-icon">👥</div>
<h3>등록된 사용자가 없습니다</h3>
<p>권한을 부여할 사용자 계정이 없습니다.</p>
</div>
</div>
</div>
</div>
</main>
</div>
<!-- 페이지 권한 설정 모달 -->
<div id="pageAccessModal" class="modal-overlay" style="display: none;">
<div class="modal-container" style="max-width: 700px;">
<div class="modal-header">
<h2 id="modalTitle">페이지 권한 설정</h2>
<button class="modal-close-btn" onclick="closePageAccessModal()">×</button>
</div>
<div class="modal-body">
<div class="user-info-section" style="background: #f9fafb; padding: 1rem; border-radius: 0.5rem; margin-bottom: 1.5rem;">
<div style="display: flex; align-items: center; gap: 0.75rem;">
<div style="width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, #3b82f6, #2563eb); color: white; display: flex; align-items: center; justify-content: center; font-weight: 600;">
<span id="modalUserInitial">-</span>
</div>
<div>
<div style="font-weight: 600; font-size: 1rem; color: #111827;" id="modalUserName">사용자명</div>
<div style="font-size: 0.875rem; color: #6b7280;">
<span id="modalUsername">username</span>
<span style="margin: 0 0.5rem;"></span>
<span id="modalWorkerName">작업자</span>
</div>
</div>
</div>
</div>
<div class="page-access-list">
<h3 style="font-size: 1rem; font-weight: 600; color: #374151; margin-bottom: 1rem;">
접근 가능 페이지 선택
</h3>
<div id="pageListContainer" style="max-height: 400px; overflow-y: auto; border: 1px solid #e5e7eb; border-radius: 0.5rem; padding: 0.5rem;">
<div style="text-align: center; padding: 2rem; color: #6b7280;">
<div class="spinner" style="margin: 0 auto 0.5rem;"></div>
페이지 목록을 불러오는 중...
</div>
</div>
</div>
<div style="margin-top: 1.5rem; padding: 1rem; background: #fffbeb; border: 1px solid #fde047; border-radius: 0.5rem;">
<p style="margin: 0; font-size: 0.875rem; color: #92400e;">
<strong>💡 참고:</strong> Admin 및 System Admin은 모든 페이지에 자동으로 접근할 수 있습니다.
</p>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" onclick="closePageAccessModal()">취소</button>
<button type="button" class="btn btn-primary" id="savePageAccessBtn">저장</button>
</div>
</div>
</div>
<!-- 토스트 알림 -->
<div class="toast-container" id="toastContainer"></div>
<!-- JavaScript -->
<script type="module" src="/js/api-config.js?v=13"></script>
<script type="module" src="/js/load-navbar.js?v=4"></script>
<script src="/js/page-access-management.js?v=1"></script>
</body>
</html>

View File

@@ -109,6 +109,7 @@
</button>
</div>
</div>
</div>
</main>
<!-- 작업자 추가/수정 모달 -->
@@ -211,8 +212,7 @@
</button>
</div>
</div>
</div>
</main>
</div>
</div>
<script type="module" src="/js/load-navbar.js?v=5"></script>

View File

@@ -33,12 +33,11 @@
<section class="quick-actions-section">
<div class="card">
<div class="card-header">
<h2 class="card-title">빠른 작업</h2>
<h2 class="card-title">빠른 작업</h2>
</div>
<div class="card-body">
<div class="quick-actions-grid-full">
<a href="/pages/work/report-create.html" class="quick-action-card">
<div class="action-icon-large">📝</div>
<div class="action-content">
<h3>작업 보고서 작성</h3>
<p>오늘의 작업 내용을 입력하고 관리합니다</p>
@@ -47,7 +46,6 @@
</a>
<a href="/pages/work/report-view.html" class="quick-action-card">
<div class="action-icon-large">📋</div>
<div class="action-content">
<h3>작업 현황 확인</h3>
<p>팀원들의 작업 현황을 실시간으로 조회합니다</p>
@@ -56,7 +54,6 @@
</a>
<a href="/pages/work/analysis.html" class="quick-action-card admin-only">
<div class="action-icon-large">📈</div>
<div class="action-content">
<h3>작업 분석</h3>
<p>작업 효율성 및 통계를 분석합니다</p>
@@ -65,7 +62,6 @@
</a>
<a href="/pages/admin/index.html" class="quick-action-card admin-only">
<div class="action-icon-large">🔧</div>
<div class="action-content">
<h3>작업 관리</h3>
<p>작업자 및 프로젝트를 관리합니다</p>
@@ -82,22 +78,36 @@
<div class="card">
<div class="card-header">
<div class="flex justify-between items-center">
<h2 class="card-title">📊 오늘의 작업 현황</h2>
<h2 class="card-title">오늘의 작업 현황</h2>
<div class="date-selector">
<input type="date" id="selectedDate" class="date-input">
<button class="btn btn-primary btn-sm" id="refreshBtn">
<span>🔄</span>
새로고침
</button>
</div>
</div>
</div>
<div class="card-body">
<div class="work-status-container-enhanced" id="workStatusContainer">
<div class="loading-state">
<div class="spinner"></div>
<p>작업 현황을 불러오는 중...</p>
</div>
<div class="work-status-table-container">
<table class="work-status-table">
<thead>
<tr>
<th>작업자</th>
<th>상태</th>
<th>작업시간</th>
<th>작업건수</th>
<th>액션</th>
</tr>
</thead>
<tbody id="workStatusTableBody">
<tr>
<td colspan="5" class="loading-state">
<div class="spinner"></div>
<p>작업 현황을 불러오는 중...</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>

236
web-ui/pages/work/tbm.html Normal file
View File

@@ -0,0 +1,236 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>TBM 관리 | (주)테크니컬코리아</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/auth-check.js?v=1" defer></script>
<script type="module" src="/js/api-config.js?v=3"></script>
</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">
<span class="title-icon">🛠️</span>
TBM (Tool Box Meeting) 관리
</h1>
<p class="page-description">아침 안전 회의 및 팀 구성 관리</p>
</div>
<div class="page-actions">
<input type="date" id="tbmDate" class="form-control" style="display: inline-block; width: auto;">
<button class="btn btn-secondary" onclick="loadTodayTbm()">
<span class="btn-icon">📅</span>
오늘
</button>
<button class="btn btn-primary" onclick="openNewTbmModal()">
<span class="btn-icon"></span>
새 TBM 시작
</button>
</div>
</div>
<!-- TBM 세션 목록 -->
<div class="projects-section">
<div class="section-header">
<h2 class="section-title">TBM 세션 목록</h2>
<div class="project-stats">
<span class="stat-item">
<span class="stat-icon">📋</span>
<span id="totalSessions">0</span>
</span>
<span class="stat-item" style="color: #16a34a;">
<span class="stat-icon"></span>
완료 <span id="completedSessions">0</span>
</span>
</div>
</div>
<div class="projects-grid" id="tbmSessionsGrid">
<!-- TBM 세션 카드들이 여기에 동적으로 생성됩니다 -->
</div>
<!-- Empty State -->
<div class="empty-state" id="emptyState" style="display: none;">
<div class="empty-icon">🛠️</div>
<h3>등록된 TBM 세션이 없습니다.</h3>
<p>\"새 TBM 시작\" 버튼을 눌러 오늘의 TBM을 시작해보세요.</p>
<button class="btn btn-primary" onclick="openNewTbmModal()">
첫 TBM 시작하기
</button>
</div>
</div>
</div>
</main>
<!-- TBM 생성/수정 모달 -->
<div id="tbmModal" class="modal-overlay" style="display: none;">
<div class="modal-container" style="max-width: 800px;">
<div class="modal-header">
<h2 id="modalTitle">새 TBM 시작</h2>
<button class="modal-close-btn" onclick="closeTbmModal()">×</button>
</div>
<div class="modal-body">
<form id="tbmForm" onsubmit="event.preventDefault(); saveTbmSession();">
<input type="hidden" id="sessionId">
<div class="form-row">
<div class="form-group">
<label class="form-label">TBM 날짜 *</label>
<input type="date" id="sessionDate" class="form-control" required>
</div>
<div class="form-group">
<label class="form-label">팀장 *</label>
<select id="leaderId" class="form-control" required>
<option value="">팀장 선택...</option>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group">
<label class="form-label">프로젝트</label>
<select id="projectId" class="form-control">
<option value="">프로젝트 선택...</option>
</select>
</div>
<div class="form-group">
<label class="form-label">작업 장소</label>
<input type="text" id="workLocation" class="form-control" placeholder="작업 현장 위치">
</div>
</div>
<div class="form-group">
<label class="form-label">작업 내용</label>
<textarea id="workDescription" class="form-control" rows="3" placeholder="오늘 진행할 작업 내용을 입력하세요"></textarea>
</div>
<div class="form-group">
<label class="form-label">안전 관련 특이사항</label>
<textarea id="safetyNotes" class="form-control" rows="2" placeholder="안전 주의사항이나 특이사항"></textarea>
</div>
<div class="form-group">
<label class="form-label">시작 시간</label>
<input type="time" id="startTime" class="form-control">
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" onclick="closeTbmModal()">취소</button>
<button type="button" class="btn btn-primary" onclick="saveTbmSession()">
💾 저장 및 팀 구성하기
</button>
</div>
</div>
</div>
<!-- 팀 구성 모달 -->
<div id="teamModal" class="modal-overlay" style="display: none;">
<div class="modal-container" style="max-width: 900px;">
<div class="modal-header">
<h2>팀 구성</h2>
<button class="modal-close-btn" onclick="closeTeamModal()">×</button>
</div>
<div class="modal-body">
<div class="section-header" style="margin-bottom: 1rem;">
<h3 style="font-size: 1rem; font-weight: 600;">작업자 선택</h3>
<div>
<button class="btn btn-sm btn-secondary" onclick="selectAllWorkers()">전체 선택</button>
<button class="btn btn-sm btn-secondary" onclick="deselectAllWorkers()">전체 해제</button>
</div>
</div>
<div id="workerSelectionGrid" style="display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.75rem; max-height: 400px; overflow-y: auto; padding: 0.5rem; border: 1px solid #e5e7eb; border-radius: 0.5rem;">
<!-- 작업자 체크박스 목록이 여기에 생성됩니다 -->
</div>
<div style="margin-top: 1.5rem;">
<h3 style="font-size: 1rem; font-weight: 600; margin-bottom: 0.75rem;">선택된 팀원 <span id="selectedCount">0</span></h3>
<div id="selectedWorkersList" style="display: flex; flex-wrap: wrap; gap: 0.5rem; min-height: 50px; padding: 0.75rem; background: #f9fafb; border-radius: 0.5rem;">
<p style="margin: 0; color: #9ca3af; font-size: 0.875rem;">작업자를 선택해주세요</p>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" onclick="closeTeamModal()">취소</button>
<button type="button" class="btn btn-primary" onclick="saveTeamComposition()">
👥 팀 구성 완료
</button>
</div>
</div>
</div>
<!-- 안전 체크리스트 모달 -->
<div id="safetyModal" class="modal-overlay" style="display: none;">
<div class="modal-container" style="max-width: 700px;">
<div class="modal-header">
<h2>안전 체크리스트</h2>
<button class="modal-close-btn" onclick="closeSafetyModal()">×</button>
</div>
<div class="modal-body">
<div id="safetyChecklistContainer" style="max-height: 500px; overflow-y: auto;">
<!-- 안전 체크리스트가 여기에 생성됩니다 -->
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" onclick="closeSafetyModal()">취소</button>
<button type="button" class="btn btn-primary" onclick="saveSafetyChecklist()">
✅ 안전 체크 완료
</button>
</div>
</div>
</div>
<!-- TBM 완료 모달 -->
<div id="completeModal" class="modal-overlay" style="display: none;">
<div class="modal-container" style="max-width: 500px;">
<div class="modal-header">
<h2>TBM 완료</h2>
<button class="modal-close-btn" onclick="closeCompleteModal()">×</button>
</div>
<div class="modal-body">
<p style="margin-bottom: 1rem;">이 TBM 세션을 완료 처리하시겠습니까?</p>
<p style="color: #6b7280; font-size: 0.875rem;">완료 후에는 수정할 수 없습니다.</p>
<div class="form-group" style="margin-top: 1.5rem;">
<label class="form-label">종료 시간</label>
<input type="time" id="endTime" class="form-control">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" onclick="closeCompleteModal()">취소</button>
<button type="button" class="btn btn-primary" onclick="completeTbmSession()">
✅ 완료
</button>
</div>
</div>
</div>
<!-- 토스트 알림 -->
<div class="toast-container" id="toastContainer"></div>
</div>
<script type="module" src="/js/load-navbar.js?v=5"></script>
<script type="module" src="/js/tbm.js?v=1"></script>
</body>
</html>