diff --git a/app/Services/MenuService.php b/app/Services/MenuService.php index 3746bb44..f2822b91 100644 --- a/app/Services/MenuService.php +++ b/app/Services/MenuService.php @@ -162,7 +162,7 @@ private function buildChildren(Menu $parent, Collection $allMenus): Collection } /** - * 부모 메뉴 목록 조회 (드롭다운용) + * 부모 메뉴 목록 조회 (드롭다운용) - 트리 구조 순서로 정렬, depth 정보 포함 */ public function getParentMenus(?int $tenantId = null): Collection { @@ -171,7 +171,7 @@ public function getParentMenus(?int $tenantId = null): Collection $query = Menu::query() ->where('is_active', true) ->orderBy('sort_order') - ->orderBy('name'); + ->orderBy('id'); if ($tenantId) { // 특정 테넌트 선택 시: 해당 테넌트의 메뉴만 @@ -181,7 +181,10 @@ public function getParentMenus(?int $tenantId = null): Collection $query->whereNull('tenant_id'); } - return $query->get(); + $allMenus = $query->get(); + + // 트리 구조로 정렬 (depth 정보 포함) + return $this->flattenMenuTree($allMenus); } /** @@ -523,15 +526,18 @@ private function compactSiblings(?int $parentId): void } /** - * 글로벌 부모 메뉴 목록 조회 (드롭다운용) + * 글로벌 부모 메뉴 목록 조회 (드롭다운용) - 트리 구조 순서로 정렬, depth 정보 포함 */ public function getGlobalParentMenus(): Collection { - return GlobalMenu::query() + $allMenus = GlobalMenu::query() ->where('is_active', true) ->orderBy('sort_order') - ->orderBy('name') + ->orderBy('id') ->get(); + + // 트리 구조로 정렬 (depth 정보 포함) + return $this->flattenMenuTree($allMenus); } /** diff --git a/resources/views/menus/create.blade.php b/resources/views/menus/create.blade.php index 2c2c5623..a4ebbe5e 100644 --- a/resources/views/menus/create.blade.php +++ b/resources/views/menus/create.blade.php @@ -6,7 +6,10 @@
-

📋 메뉴 생성

+

+ + 메뉴 생성 +

← 목록으로 @@ -26,7 +29,9 @@ class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"> @foreach($parentMenus as $parent) - + @endforeach
@@ -55,9 +60,39 @@ class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none foc - +
+
+ +
+ +
+ +
+

사용 가능한 아이콘 (클릭하여 선택)

+
+ @php + $sampleIcons = [ + 'home', 'folder', 'chart-bar', 'calendar', 'building', + 'users', 'user-group', 'menu', 'shield-check', 'key', + 'cog', 'beaker', 'code', 'document-text', 'clipboard-list', + 'cube', 'collection', 'tag', 'database', 'terminal', + 'server', 'adjustments', 'sparkles', 'lightning-bolt', 'puzzle', 'external-link', + ]; + @endphp + @foreach($sampleIcons as $iconKey) + + @endforeach +
+
@@ -114,11 +149,11 @@ class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none foc

확장 옵션

-