From 0c1501f08b772bd0236504ece0db8d4fc30f69a5 Mon Sep 17 00:00:00 2001 From: hskwon Date: Fri, 19 Dec 2025 12:58:37 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=A9=94=EB=89=B4=20=EA=B4=80=EB=A6=AC?= =?UTF-8?q?=20UI=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 부모메뉴 선택 시 트리 구조 순서 + 인덴트 적용 - 아이콘 선택 UI를 이모지에서 Heroicons SVG로 변경 - 확장 옵션 기본 펼침 상태로 변경 --- app/Services/MenuService.php | 18 ++++-- resources/views/menus/create.blade.php | 80 ++++++++++++++++++++--- resources/views/menus/edit.blade.php | 87 +++++++++++++++++++++++--- 3 files changed, 164 insertions(+), 21 deletions(-) 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

확장 옵션

-