2026-02-05 21:03:38 +09:00

144 lines
6.9 KiB
PHP

@php
$roles = session('admin_ctx.role_names', []);
$menu = [
[
'title' => '대시보드',
'items' => [
['label' => '대시보드', 'route' => 'admin.home'],
],
],
[
'title' => '콘솔 관리',
'items' => [
['label' => '내 정보', 'route' => 'admin.me'],
['label' => '관리자 계정 관리', 'route' => 'admin.admins.index' ,'roles' => ['super_admin']],
],
],
[
'title' => '알림/메시지',
'items' => [
['label' => '관리자 SMS 발송', 'route' => 'admin.sms.send','roles' => ['super_admin','finance','product','support']],
['label' => 'SMS 발송 이력', 'route' => 'admin.sms.logs','roles' => ['super_admin','finance','product','support']],
['label' => '알림 템플릿', 'route' => 'admin.templates.index','roles' => ['super_admin','finance','product','support']],
],
],
[
'title' => '고객지원',
'items' => [
['label' => '공지사항', 'route' => 'admin.notice.index','roles' => ['super_admin','support']],
['label' => '1:1 문의', 'route' => 'admin.inquiry.index','roles' => ['super_admin','support']],
['label' => 'FAQ 코드 관리', 'route' => 'admin.faqcodes.index','roles' => ['super_admin','support']],
['label' => 'QnA 코드 관리', 'route' => 'admin.qnacodes.index','roles' => ['super_admin','support']],
],
],
[
'title' => '상품권 관리',
'items' => [
['label' => '상품 리스트', 'route' => 'admin.products.index','roles' => ['super_admin','product']],
['label' => '상품 등록', 'route' => 'admin.products.create','roles' => ['super_admin','product']],
['label' => '판매 코드 관리', 'route' => 'admin.sale-codes.index','roles' => ['super_admin','product']],
['label' => '핀 번호 관리', 'route' => 'admin.pins.index','roles' => ['super_admin','product']],
['label' => '메인 노출 관리', 'route' => 'admin.exposure.index','roles' => ['super_admin','product']],
['label' => '결제 수수료/정책', 'route' => 'admin.fees.index','roles' => ['super_admin','product']],
],
],
[
'title' => '매입/정산',
'items' => [
['label' => '핀 매입 현황(출금)', 'route' => 'admin.buyback.index','roles' => ['super_admin','finance']],
['label' => '출금 요청 관리', 'route' => 'admin.withdraw.index','roles' => ['super_admin','finance']],
['label' => '정산 리포트', 'route' => 'admin.settlement.index','roles' => ['super_admin','finance']],
],
],
[
'title' => '거래/매출',
'items' => [
['label' => '상품권 거래 장부', 'route' => 'admin.ledger.index','roles' => ['super_admin','finance']],
['label' => '매출 리포트', 'route' => 'admin.sales.index','roles' => ['super_admin','finance']],
['label' => '환불/취소 내역', 'route' => 'admin.refunds.index','roles' => ['super_admin','finance']],
],
],
[
'title' => '회원/정책',
'items' => [
['label' => '회원 관리', 'route' => 'admin.members.index','roles' => ['super_admin','support']],
['label' => '회원가입 필터 설정', 'route' => 'admin.signup-filter.index','roles' => ['super_admin','support']],
['label' => '블랙리스트/제재', 'route' => 'admin.sanctions.index','roles' => ['super_admin','support']],
['label' => '마케팅 수신동의', 'route' => 'admin.marketing.index','roles' => ['super_admin','support']],
],
],
[
'title' => '시스템 로그',
'items' => [
['label' => '로그인 로그', 'route' => 'admin.logs.login','roles' => ['super_admin','finance','product','support']],
['label' => '다날 인증 로그', 'route' => 'admin.logs.danal','roles' => ['super_admin','finance','product','support']],
['label' => '결제 로그', 'route' => 'admin.logs.pay','roles' => ['super_admin','finance','product','support']],
['label' => '기타 로그', 'route' => 'admin.logs.misc','roles' => ['super_admin','finance','product','support']],
['label' => '관리자 활동 로그', 'route' => 'admin.logs.audit','roles' => ['super_admin','finance','product','support']],
],
],
];
$roleNames = (array) data_get(session('admin_ctx', []), 'role_names', []);
$isSuper = in_array('super_admin', $roleNames, true);
@endphp
<nav class="a-nav">
@foreach($menu as $group)
@php
// 그룹 아이템 필터링 (roles 체크 + route 존재 여부는 아래에서 disabled로 처리)
$visibleItems = [];
foreach (($group['items'] ?? []) as $it) {
$need = $it['roles'] ?? null;
// roles 미지정: 전체 노출
if ($need === null) {
$visibleItems[] = $it;
continue;
}
// super_admin: 무조건 통과
if ($isSuper) {
$visibleItems[] = $it;
continue;
}
// roles 배열과 교집합이 있으면 노출
if (is_array($need) && !empty(array_intersect($need, $roleNames))) {
$visibleItems[] = $it;
}
}
@endphp
@if(!empty($visibleItems))
<div class="a-nav__group">
<div class="a-nav__title">{{ $group['title'] }}</div>
@foreach($visibleItems as $it)
@php
$routeName = (string)($it['route'] ?? '');
$has = $routeName !== '' ? \Illuminate\Support\Facades\Route::has($routeName) : false;
// index면 admin.admins.* 전체를 active로 잡아줌
$base = $routeName !== '' ? preg_replace('/\.index$/', '', $routeName) : '';
$isActive = $has && $base !== '' ? request()->routeIs($base . '.*') || request()->routeIs($base) : false;
@endphp
@if($has)
<a class="a-nav__item {{ $isActive ? 'is-active' : '' }}" href="{{ route($routeName) }}">
<span class="a-nav__dot" aria-hidden="true"></span>
<span class="a-nav__label">{{ $it['label'] }}</span>
</a>
@else
<span class="a-nav__item is-disabled" title="준비중">
<span class="a-nav__dot" aria-hidden="true"></span>
<span class="a-nav__label">{{ $it['label'] }}</span>
</span>
@endif
@endforeach
</div>
@endif
@endforeach
</nav>