107 lines
4.9 KiB
PHP
107 lines
4.9 KiB
PHP
<!-- top start -->
|
|
<style>
|
|
/* dropdown 크기 및 스크롤 개선 */
|
|
#noticeList {
|
|
max-height: 300px;
|
|
overflow-y: auto;
|
|
}
|
|
</style>
|
|
<nav class="navbar navbar-expand-lg fixed-top" style="background-color:#E7E7E7; border-top:1px solid darkgray; border-bottom:1px solid darkgray;">
|
|
<div class="container-fluid">
|
|
<nav class="nav"><a class="navbar-brand" href="/admin">DBMS 관리</a></nav>
|
|
<ul class="nav justify-content-center">
|
|
<li class="nav-item"><?= view_cell("\App\Cells\SearchCell::client", []) ?></li>
|
|
<li class="nav-item">
|
|
<?= form_open("/admin/search", ['method' => 'GET', 'class' => 'd-flex gap-2']) ?>
|
|
<input type="text" name="keyword" placeholder="고객명/IP/서버명/기타 검색" id="search_keyword" class="form-control" />
|
|
<button type="submit" class="btn btn-default border border-dark"><?= ICONS['SEARCH'] ?></button>
|
|
<?= form_close(); ?>
|
|
</li>
|
|
<li class="nav-item" style="background-color:white; margin-left:20px; font-size:12px;">
|
|
<!-- 🔔 공지 영역 -->
|
|
<ul class="navbar-nav ms-auto">
|
|
<li class="nav-item dropdown">
|
|
<a class="nav-link dropdown-toggle" href="#" id="noticeDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
|
🔔 공지사항 <span id="notice-count" class="badge bg-danger">0</span>
|
|
</a>
|
|
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="noticeDropdown" id="noticeList">
|
|
<li class="dropdown-item text-muted">불러오는 중...</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<!-- 🔔 공지 영역 -->
|
|
</li>
|
|
<li class="nav-item" style="background-color:white; margin-left:20px; font-size:12px;">
|
|
📋:클립보드COPY , 📌:실서비스서버 , ✔️:대체서버->실서비스서버 교체 , 🔄:대체서버등록 , <?= ICONS['MONTH'] ?>:월비용 , <?= ICONS['ONETIME'] ?>:일회성<BR>
|
|
<?= ICONS['SERVER_ITEM_SWITCH'] ?>:스위치 , <?= ICONS['SERVER_ITEM_IP'] ?>:IP , <?= ICONS['SERVER_ITEM_OS'] ?>:OS , <?= ICONS['SERVER_ITEM_SOFTWARE'] ?>:소프트웨어 , <?= ICONS['SERVER_ITEM_CS'] ?>:CS ,
|
|
<?= ICONS['SERVER_ITEM_CPU'] ?>:CPU , <?= ICONS['SERVER_ITEM_RAM'] ?>:RAM , <?= ICONS['SERVER_ITEM_DISK'] ?>:DISK
|
|
</li>
|
|
</ul>
|
|
<ul class="nav justify-content-end">
|
|
<li class="nav-item">
|
|
<?php if ($viewDatas['isLoggedIn']): ?>
|
|
<div class="btn-group">
|
|
<button type="button" class="btn btn-outline-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
|
|
<b><?= ICONS['LOGIN'] . $viewDatas['myAuthName'] ?></b>
|
|
</button>
|
|
<ul class="dropdown-menu dropdown-menu-end">
|
|
<li><?= form_label(
|
|
ICONS['SETUP'] . "정보수정",
|
|
"modify",
|
|
[
|
|
"class" => "dropdown-item form-label-sm",
|
|
"data-src" => "/admin/user/profile/" . $viewDatas['myAuthUID'],
|
|
"data-bs-toggle" => "modal",
|
|
"data-bs-target" => "#modal_action_form"
|
|
]
|
|
) ?></li>
|
|
<li>
|
|
<hr class="dropdown-divider">
|
|
</li>
|
|
<li><a class="dropdown-item" href="<?= URLS['LOGOUT'] ?>"><?= ICONS['LOGOUT'] ?>Logout</a></li>
|
|
</ul>
|
|
</div>
|
|
<?php else: ?>
|
|
<a class="nav-link dropdown-toggle" href="<?= URLS['LOGIN'] ?>" role="button"><?= ICONS['LOGIN'] ?>Login</a>
|
|
<?php endif ?>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</nav>
|
|
<script>
|
|
//전체검색용
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
const params = new URLSearchParams(location.search);
|
|
const keyword = params.get('keyword');
|
|
if (keyword)
|
|
document.querySelector('input[name="keyword"]').value = keyword;
|
|
});
|
|
//공지사항용
|
|
document.addEventListener("DOMContentLoaded", function() {
|
|
async function loadNotices() {
|
|
try {
|
|
const res = await fetch("/admin/board/latest");
|
|
const notices = await res.json();
|
|
const notice_list = document.getElementById("noticeList");
|
|
const notice_count = document.getElementById("notice-count");
|
|
notice_list.innerHTML = "";
|
|
if (notices.length === 0) {
|
|
notice_list.innerHTML = '<li class="dropdown-item text-muted">공지 없음</li>';
|
|
return;
|
|
}
|
|
notice_count.innerHTML = notices.length;
|
|
notices.forEach(n => {
|
|
const item = document.createElement("li");
|
|
item.classList.add("dropdown-item");
|
|
item.innerHTML = `<small class="text-muted">[${n.created_at.date.replace(/\.\d+$/, '')}]</small> ${n.title}<br>`;
|
|
notice_list.appendChild(item);
|
|
});
|
|
} catch (err) {
|
|
console.error("공지 불러오기 실패:", err);
|
|
}
|
|
}
|
|
loadNotices(); // 최초 로드
|
|
setInterval(loadNotices, 10000); // 10초마다 갱신
|
|
});
|
|
</script>
|
|
<!-- top end -->
|