feat: TBM 빠른 작업 배너 추가 (페이지 권한 기반)

- 대시보드에 TBM 관리 빠른 작업 카드 추가
- 페이지 접근 권한 기반으로 표시/숨김 처리
- 오렌지 그라데이션 배경으로 시각적 구분
- checkTbmPageAccess() 함수로 사용자 권한 확인

🤖 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:52:00 +09:00
parent 480206912b
commit 67e9c0886d
2 changed files with 50 additions and 4 deletions

View File

@@ -96,7 +96,10 @@ async function initializeDashboard() {
// 관리자 권한 확인
checkAdminAccess();
// TBM 페이지 접근 권한 확인
checkTbmPageAccess();
console.log('✅ 모던 대시보드 초기화 완료');
}
@@ -697,12 +700,12 @@ function checkAdminAccess() {
const adminElements = document.querySelectorAll('.admin-only');
const isFullAdmin = currentUser && ['admin', 'system'].includes(currentUser.access_level);
const isGroupLeader = currentUser && currentUser.access_level === 'group_leader';
console.log(`🔐 권한 확인: 사용자=${currentUser?.username}, 역할=${currentUser.access_level}, 전체관리자=${isFullAdmin}, 그룹리더=${isGroupLeader}`);
adminElements.forEach(element => {
const href = element.getAttribute('href');
// 작업 분석: 전체 관리자만 접근 가능
if (href && href.includes('work-analysis.html')) {
if (isFullAdmin) {
@@ -736,6 +739,40 @@ function checkAdminAccess() {
});
}
// ========== TBM 페이지 접근 권한 확인 ========== //
async function checkTbmPageAccess() {
try {
if (!currentUser || !currentUser.user_id) {
console.log('⚠️ TBM 페이지 권한 확인: 사용자 정보 없음');
return;
}
console.log('🛠️ TBM 페이지 권한 확인 중...');
// 사용자의 페이지 접근 권한 조회
const response = await window.apiCall(`/users/${currentUser.user_id}/page-access`);
if (response && response.success) {
const pageAccess = response.data?.pageAccess || [];
// 'tbm' 페이지 접근 권한 확인
const tbmPage = pageAccess.find(p => p.page_key === 'tbm');
const tbmQuickAction = document.getElementById('tbmQuickAction');
if (tbmPage && tbmPage.can_access && tbmQuickAction) {
tbmQuickAction.style.display = 'block';
console.log('✅ TBM 페이지 접근 권한 있음 - 빠른 작업 버튼 표시');
} else {
console.log('❌ TBM 페이지 접근 권한 없음 - 빠른 작업 버튼 숨김');
}
} else {
console.log('⚠️ TBM 페이지 권한 확인 실패');
}
} catch (error) {
console.error('❌ TBM 페이지 권한 확인 오류:', error);
}
}
// ========== 상태 표시 ========== //
function showLoadingState() {
const loadingHTML = `

View File

@@ -37,6 +37,15 @@
</div>
<div class="card-body">
<div class="quick-actions-grid-full">
<!-- TBM 관리 (페이지 권한 체크) -->
<a href="/pages/work/tbm.html" class="quick-action-card" id="tbmQuickAction" style="display: none; background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); color: white;">
<div class="action-content">
<h3 style="color: white;">🛠️ TBM 관리</h3>
<p style="color: rgba(255, 255, 255, 0.9);">아침 안전 회의 및 팀 구성을 관리합니다</p>
</div>
<div class="action-arrow" style="color: white;"></div>
</a>
<a href="/pages/work/report-create.html" class="quick-action-card">
<div class="action-content">
<h3>작업 보고서 작성</h3>