Files
TK-FB-Project/web-ui/components/navbar.html
Hyungi Ahn 70630b380a feat: 작업자-계정 통합 및 연차/출근 관리 시스템 구축
모든 작업자가 개인 계정으로 로그인하여 본인의 연차와 출근 기록을 확인할 수 있는 시스템을 구축했습니다.

주요 기능:
- 작업자-계정 1:1 통합 (기존 작업자 자동 계정 생성)
- 연차 관리 시스템 (연도별 잔액 관리)
- 출근 기록 시스템 (일일 근태 기록)
- 나의 대시보드 페이지 (개인 정보 조회)

데이터베이스:
- workers 테이블에 salary, base_annual_leave 컬럼 추가
- work_attendance_types, vacation_types 테이블 생성
- daily_attendance_records 테이블 생성
- worker_vacation_balance 테이블 생성
- 기존 작업자 자동 계정 생성 (username: 이름 기반)
- Guest 역할 추가

백엔드 API:
- 한글→영문 변환 유틸리티 (hangulToRoman.js)
- UserRoutes에 개인 정보 조회 API 추가
  - GET /api/users/me (내 정보)
  - GET /api/users/me/attendance-records (출근 기록)
  - GET /api/users/me/vacation-balance (연차 잔액)
  - GET /api/users/me/work-reports (작업 보고서)
  - GET /api/users/me/monthly-stats (월별 통계)

프론트엔드:
- 나의 대시보드 페이지 (my-dashboard.html)
- 연차 정보 위젯 (총/사용/잔여)
- 월별 출근 캘린더
- 근무 시간 통계
- 최근 작업 보고서 목록
- 네비게이션 바에 "나의 대시보드" 메뉴 추가

배포 시 주의사항:
- 마이그레이션 실행 필요
- 자동 생성된 계정 초기 비밀번호: 1234
- 작업자들에게 첫 로그인 후 비밀번호 변경 안내 필요

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

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-19 09:49:48 +09:00

470 lines
8.9 KiB
HTML

<!-- components/navbar.html -->
<!-- 프로필 드롭다운이 추가된 개선된 네비게이션바 -->
<nav class="navbar">
<div class="navbar-brand">
<img src="/img/logo.png" alt="로고" class="logo-small">
<div class="brand-content">
<span class="brand-text">테크니컬코리아</span>
<span class="brand-subtitle">생산팀 포털</span>
</div>
</div>
<div class="navbar-center">
<div class="current-time" id="current-time"></div>
</div>
<div class="navbar-menu">
<!-- 프로필 드롭다운 추가 -->
<div class="profile-dropdown">
<div class="user-info" id="user-info-dropdown">
<div class="user-avatar">👤</div>
<div class="user-details">
<span class="user-name" id="user-name">사용자</span>
<span class="user-role" id="user-role">작업자</span>
</div>
<span class="dropdown-arrow"></span>
</div>
<!-- 드롭다운 메뉴 -->
<div class="dropdown-menu" id="profile-dropdown-menu">
<div class="dropdown-header">
<div class="dropdown-user-name" id="dropdown-user-fullname">사용자</div>
<div class="dropdown-user-id" id="dropdown-user-id">@username</div>
</div>
<div class="dropdown-divider"></div>
<a href="/pages/profile/my-dashboard.html" class="dropdown-item">
<span class="dropdown-icon">📊</span>
나의 대시보드
</a>
<a href="/pages/profile/my-profile.html" class="dropdown-item">
<span class="dropdown-icon">👤</span>
내 프로필
</a>
<a href="/pages/profile/change-password.html" class="dropdown-item">
<span class="dropdown-icon">🔐</span>
비밀번호 변경
</a>
<a href="/pages/profile/admin-settings.html" class="dropdown-item admin-only">
<span class="dropdown-icon">⚙️</span>
관리자 설정
</a>
<div class="dropdown-divider"></div>
<button class="dropdown-item logout-item" id="dropdown-logout">
<span class="dropdown-icon">🚪</span>
로그아웃
</button>
</div>
</div>
<div class="navbar-buttons">
<button class="nav-btn dashboard-btn" title="대시보드">
🏠 대시보드
</button>
<button class="nav-btn system-btn" title="시스템 관리자" id="systemBtn" style="display: none;">
🔧 시스템
</button>
</div>
</div>
</nav>
<style>
.navbar {
background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
padding: 0.75rem 1.5rem;
color: white;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
gap: 1rem;
box-shadow: 0 0.25rem 0.75rem rgba(0,0,0,0.15);
font-family: 'Malgun Gothic', sans-serif;
position: sticky;
top: 0;
z-index: 1000;
min-height: 4rem;
}
.navbar-brand {
display: flex;
align-items: center;
gap: 0.75rem;
min-width: 0;
flex-shrink: 0;
}
.logo-small {
height: 2.5rem;
width: auto;
border-radius: 0.375rem;
flex-shrink: 0;
}
.brand-content {
display: flex;
flex-direction: column;
min-width: 0;
}
.brand-text {
font-size: 1.125rem;
font-weight: 700;
line-height: 1.2;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.brand-subtitle {
font-size: 0.75rem;
opacity: 0.9;
font-weight: 400;
white-space: nowrap;
}
.navbar-center {
display: flex;
align-items: center;
flex: 0 1 auto;
justify-content: center;
min-width: 0;
}
.current-time {
font-size: 0.875rem;
font-weight: 500;
padding: 0.5rem 1rem;
background: rgba(255,255,255,0.1);
border-radius: 1.25rem;
backdrop-filter: blur(10px);
border: 1px solid rgba(255,255,255,0.2);
white-space: nowrap;
}
.navbar-menu {
display: flex;
align-items: center;
gap: 1.25rem;
flex-shrink: 1;
flex-wrap: nowrap;
justify-content: flex-end;
min-width: 0;
}
/* 프로필 드롭다운 스타일 */
.profile-dropdown {
position: relative;
}
.user-info {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.5rem 1rem;
background: rgba(255,255,255,0.1);
border-radius: 1.5625rem;
backdrop-filter: blur(10px);
border: 1px solid rgba(255,255,255,0.2);
cursor: pointer;
transition: all 0.3s ease;
min-width: 0;
max-width: 15rem;
flex-shrink: 0;
}
.user-info:hover {
background: rgba(255,255,255,0.2);
transform: translateY(-1px);
}
.user-info.active {
background: rgba(255,255,255,0.25);
box-shadow: 0 0 0 0.1875rem rgba(255,255,255,0.2);
}
.dropdown-arrow {
font-size: 0.625rem;
margin-left: 0.25rem;
transition: transform 0.3s ease;
flex-shrink: 0;
}
.user-info.active .dropdown-arrow {
transform: rotate(180deg);
}
.user-avatar {
width: 2.25rem;
height: 2.25rem;
background: rgba(255,255,255,0.2);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 1.125rem;
flex-shrink: 0;
}
.user-details {
display: flex;
flex-direction: column;
align-items: flex-start;
min-width: 0;
}
.user-name {
font-weight: 600;
font-size: 0.875rem;
line-height: 1.2;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 100%;
}
.user-role {
font-size: 0.6875rem;
opacity: 0.8;
font-weight: 400;
white-space: nowrap;
}
/* 드롭다운 메뉴 */
.dropdown-menu {
position: absolute;
top: calc(100% + 0.5rem);
right: 0;
background: white;
border-radius: 0.75rem;
box-shadow: 0 0.5rem 1.5rem rgba(0,0,0,0.15);
min-width: 15rem;
max-width: 20rem;
opacity: 0;
visibility: hidden;
transform: translateY(-0.625rem);
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
overflow: hidden;
}
.dropdown-menu.show {
opacity: 1;
visibility: visible;
transform: translateY(0);
}
.dropdown-header {
padding: 16px 20px;
background: #f5f5f5;
border-bottom: 1px solid #e0e0e0;
}
.dropdown-user-name {
font-weight: 600;
color: #333;
font-size: 1rem;
margin-bottom: 4px;
}
.dropdown-user-id {
font-size: 0.85rem;
color: #666;
}
.dropdown-divider {
height: 1px;
background: #e0e0e0;
margin: 0;
}
.dropdown-item {
display: flex;
align-items: center;
gap: 12px;
padding: 12px 20px;
color: #333;
text-decoration: none;
transition: background 0.2s ease;
border: none;
background: none;
width: 100%;
text-align: left;
font-size: 0.9rem;
cursor: pointer;
font-family: inherit;
}
.dropdown-item:hover {
background: #f5f5f5;
}
.dropdown-item:active {
background: #e0e0e0;
}
.dropdown-icon {
font-size: 1.1rem;
width: 24px;
text-align: center;
}
.logout-item {
color: #f44336;
}
.logout-item:hover {
background: #ffebee;
}
/* 버튼 스타일 */
.navbar-buttons {
display: flex;
gap: 0.75rem;
flex-wrap: wrap;
}
.nav-btn {
padding: 0.5rem 1rem;
border: none;
border-radius: 1.25rem;
font-size: 0.8125rem;
font-weight: 500;
cursor: pointer;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
display: flex;
align-items: center;
gap: 0.375rem;
font-family: inherit;
white-space: nowrap;
}
.dashboard-btn {
background: rgba(255,255,255,0.15);
color: white;
border: 1px solid rgba(255,255,255,0.3);
}
.dashboard-btn:hover {
background: rgba(255,255,255,0.25);
transform: translateY(-0.0625rem);
box-shadow: 0 0.25rem 0.5rem rgba(0,0,0,0.1);
}
.system-btn {
background: linear-gradient(135deg, #9c27b0 0%, #673ab7 100%);
color: white;
border: 1px solid rgba(255,255,255,0.3);
box-shadow: 0 0.125rem 0.5rem rgba(156,39,176,0.3);
}
.system-btn:hover {
background: linear-gradient(135deg, #8e24aa 0%, #5e35b1 100%);
transform: translateY(-0.0625rem);
box-shadow: 0 0.25rem 0.75rem rgba(156,39,176,0.4);
}
/* 반응형 디자인 */
@media (max-width: 1200px) {
.navbar {
justify-content: space-between;
}
.navbar-center {
display: none;
}
}
@media (max-width: 768px) {
.navbar {
padding: 0.625rem 1rem;
gap: 0.75rem;
}
.navbar-brand {
gap: 0.5rem;
flex: 0 0 auto;
}
.brand-text {
font-size: 1rem;
}
.brand-subtitle {
font-size: 0.6875rem;
}
.navbar-menu {
gap: 0.75rem;
flex-wrap: wrap;
}
.navbar-buttons {
gap: 0.5rem;
}
.nav-btn {
padding: 0.4rem 0.75rem;
font-size: 0.75rem;
}
.user-info {
max-width: 12rem;
}
.dropdown-menu {
right: 0;
min-width: 12rem;
}
}
@media (max-width: 640px) {
.brand-content {
display: none;
}
.navbar-center {
display: none;
}
.navbar-buttons .nav-btn {
font-size: 0;
padding: 0.5rem;
gap: 0;
}
.navbar-buttons .nav-btn::before {
content: attr(title);
font-size: 1.125rem;
}
.user-details {
display: none;
}
.dropdown-arrow {
display: none;
}
.user-info {
padding: 0.5rem;
}
}
@media (max-width: 480px) {
.navbar {
padding: 0.5rem 0.75rem;
}
.logo-small {
height: 2rem;
}
.navbar-buttons {
gap: 0.375rem;
}
.dropdown-menu {
right: -0.5rem;
min-width: 10rem;
}
}
</style>