diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php
index 2d148c76..5ed1910c 100644
--- a/app/Providers/AppServiceProvider.php
+++ b/app/Providers/AppServiceProvider.php
@@ -64,5 +64,18 @@ public function boot(): void
'favoriteMenuIds' => $menuService->getFavoriteMenuIds(),
]);
});
+
+ // 테넌트 콘솔 사이드바에 해당 테넌트의 메뉴 데이터 전달
+ View::composer('partials.tenant-console-sidebar', function ($view) {
+ $tenantId = $view->getData()['consoleTenantId'] ?? request()->route('tenantId');
+ if ($tenantId) {
+ $menuService = app(SidebarMenuService::class);
+ $menusBySection = $menuService->getTenantMenusBySection((int) $tenantId);
+
+ $view->with([
+ 'tenantMainMenus' => $menusBySection['main'],
+ ]);
+ }
+ });
}
}
diff --git a/app/Services/SidebarMenuService.php b/app/Services/SidebarMenuService.php
index 0b51a208..505cb0bf 100644
--- a/app/Services/SidebarMenuService.php
+++ b/app/Services/SidebarMenuService.php
@@ -131,6 +131,35 @@ public function getMenusBySection(?User $user = null): array
];
}
+ /**
+ * 특정 테넌트의 전체 메뉴 트리 조회 (권한 필터 없음, 관리 콘솔용)
+ */
+ public function getTenantMenuTree(int $tenantId): Collection
+ {
+ $allMenus = Menu::withoutGlobalScopes()
+ ->where('tenant_id', $tenantId)
+ ->where('is_active', true)
+ ->where('hidden', false)
+ ->orderBy('sort_order')
+ ->get();
+
+ return $this->buildMenuTree($allMenus);
+ }
+
+ /**
+ * 특정 테넌트의 섹션별 메뉴 조회 (관리 콘솔용)
+ */
+ public function getTenantMenusBySection(int $tenantId): array
+ {
+ $menuTree = $this->getTenantMenuTree($tenantId);
+
+ return [
+ 'main' => $menuTree->filter(fn ($m) => $m->getSection() === 'main')->values(),
+ 'tools' => $menuTree->filter(fn ($m) => $m->getSection() === 'tools')->values(),
+ 'labs' => $menuTree->filter(fn ($m) => $m->getSection() === 'labs')->values(),
+ ];
+ }
+
/**
* 메뉴 트리 구성
*/
diff --git a/public/js/context-menu.js b/public/js/context-menu.js
index 5d351b14..6ed7723d 100644
--- a/public/js/context-menu.js
+++ b/public/js/context-menu.js
@@ -121,8 +121,11 @@ class ContextMenu {
window.location.href = `/tenants/${id}/edit`;
break;
case 'switch-tenant':
- if (typeof openTenantConsole === 'function') {
- openTenantConsole(id, name);
+ {
+ const w = 1400, h = 900;
+ const l = (screen.width - w) / 2, t = (screen.height - h) / 2;
+ window.open(`/tenant-console/${id}`, `tenant_${id}`,
+ `width=${w},height=${h},left=${l},top=${t},resizable=yes,scrollbars=yes`);
}
break;
case 'view-user':
diff --git a/resources/views/components/context-menu.blade.php b/resources/views/components/context-menu.blade.php
index 315908bb..f5bd7c5e 100644
--- a/resources/views/components/context-menu.blade.php
+++ b/resources/views/components/context-menu.blade.php
@@ -28,11 +28,12 @@ class="w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-100 flex i
{{-- 사용자 관련 메뉴 --}}
diff --git a/resources/views/partials/tenant-console-sidebar.blade.php b/resources/views/partials/tenant-console-sidebar.blade.php
index d3c83351..aaa9afd0 100644
--- a/resources/views/partials/tenant-console-sidebar.blade.php
+++ b/resources/views/partials/tenant-console-sidebar.blade.php
@@ -1,51 +1,8 @@
-{{-- 테넌트 콘솔 전용 사이드바 (메인 사이드바 스타일 통일) --}}
+{{-- 테넌트 콘솔 전용 사이드바 (DB 기반 메뉴 시스템) --}}
@php
$tenantId = $consoleTenantId ?? 0;
- $currentUrl = request()->url();
$baseUrl = "/tenant-console/{$tenantId}";
-
- $menuGroups = [
- [
- 'title' => '권한 관리',
- 'icon' => 'ri-shield-keyhole-line',
- 'items' => [
- ['name' => '권한 관리', 'url' => "{$baseUrl}/permissions", 'icon' => 'ri-key-2-line'],
- ['name' => '역할 관리', 'url' => "{$baseUrl}/roles", 'icon' => 'ri-user-settings-line'],
- ['name' => '역할-권한 매핑', 'url' => "{$baseUrl}/role-permissions", 'icon' => 'ri-links-line'],
- ['name' => '부서-권한 매핑', 'url' => "{$baseUrl}/department-permissions", 'icon' => 'ri-building-2-line'],
- ['name' => '사용자-권한 매핑', 'url' => "{$baseUrl}/user-permissions", 'icon' => 'ri-user-star-line'],
- ],
- ],
- [
- 'title' => '시스템 관리',
- 'icon' => 'ri-settings-3-line',
- 'items' => [
- ['name' => 'AI 설정', 'url' => "{$baseUrl}/system/ai-config", 'icon' => 'ri-robot-line'],
- ['name' => '휴일 관리', 'url' => "{$baseUrl}/system/holidays", 'icon' => 'ri-calendar-event-line'],
- ['name' => '시스템 알림', 'url' => "{$baseUrl}/system/alerts", 'icon' => 'ri-notification-3-line'],
- ['name' => '공통코드', 'url' => "{$baseUrl}/common-codes", 'icon' => 'ri-code-s-slash-line'],
- ['name' => '카테고리', 'url' => "{$baseUrl}/categories", 'icon' => 'ri-node-tree'],
- ['name' => '감사 로그', 'url' => "{$baseUrl}/audit-logs", 'icon' => 'ri-file-list-3-line'],
- ],
- ],
- [
- 'title' => '생산관리',
- 'icon' => 'ri-instance-line',
- 'items' => [
- ['name' => '품목관리', 'url' => "{$baseUrl}/production/items", 'icon' => 'ri-box-3-line'],
- ['name' => '품목필드', 'url' => "{$baseUrl}/production/item-fields", 'icon' => 'ri-list-settings-line'],
- ['name' => '견적수식', 'url' => "{$baseUrl}/production/quote-formulas", 'icon' => 'ri-calculator-line'],
- ['name' => '카테고리', 'url' => "{$baseUrl}/production/categories", 'icon' => 'ri-node-tree'],
- ],
- ],
- [
- 'title' => '게시판관리',
- 'icon' => 'ri-article-line',
- 'items' => [
- ['name' => '게시판 목록', 'url' => "{$baseUrl}/boards", 'icon' => 'ri-layout-grid-line'],
- ],
- ],
- ];
+ $menus = $tenantMainMenus ?? collect();
@endphp
+
\ No newline at end of file