Files
tk-factory-services/system1-factory/web/static/js/shared-bottom-nav.js
Hyungi Ahn 39c333bb39 fix(nav): 하단 네비에서 TBM/작업보고 제거, 신고 추가
권한 차등 페이지(TBM, 작업보고)는 공통 하단 네비에 부적합.
신고(tkreport.technicalkorea.net) 링크로 대체.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 11:24:19 +09:00

40 lines
1.9 KiB
JavaScript

/**
* shared-bottom-nav.js — 하단 네비게이션 공유 컴포넌트
* 각 페이지에서 <script src="/static/js/shared-bottom-nav.js"></script> 로드하면 자동 생성
*/
(function() {
var SVG_ATTR = 'viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"';
var NAV_ITEMS = [
{
href: '/pages/dashboard-new.html',
label: '홈',
icon: '<svg ' + SVG_ATTR + '><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/><polyline points="9 22 9 12 15 12 15 22"/></svg>'
},
{
href: 'https://tkreport.technicalkorea.net/',
label: '신고',
icon: '<svg ' + SVG_ATTR + '><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"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>'
},
{
href: '/pages/purchase/request-mobile.html',
label: '소모품',
icon: '<svg ' + SVG_ATTR + '><path d="M6 2L3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z"/><line x1="3" y1="6" x2="21" y2="6"/><path d="M16 10a4 4 0 0 1-8 0"/></svg>'
},
{
href: '/pages/attendance/my-vacation-info.html',
label: '연차관리',
icon: '<svg ' + SVG_ATTR + '><rect x="3" y="4" width="18" height="18" rx="2" ry="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/><path d="M9 16l2 2 4-4"/></svg>'
}
];
var currentPath = location.pathname;
var nav = document.createElement('nav');
nav.className = 'm-bottom-nav';
nav.innerHTML = NAV_ITEMS.map(function(item) {
var active = currentPath === item.href ? ' active' : '';
return '<a href="' + item.href + '" class="m-nav-item' + active + '">'
+ item.icon + '<span class="m-nav-label">' + item.label + '</span></a>';
}).join('');
document.body.appendChild(nav);
})();