From ee1a2d6633ea887f79e8e55a156bd53a1a354869 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Sat, 28 Feb 2026 15:16:54 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20[approvals]=20=EC=82=AC=EC=9D=B4?= =?UTF-8?q?=EB=93=9C=EB=B0=94=20=EA=B2=B0=EC=9E=AC=20=EB=B1=83=EC=A7=80=20?= =?UTF-8?q?=EC=83=89=EC=83=81=20=ED=95=A8=EB=B3=84=20=EC=B0=A8=EB=B3=84?= =?UTF-8?q?=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 결재함: 빨간색(#ef4444), 기안함: 파란색(#3b82f6), 참조함: 초록색(#10b981) - 뱃지 데이터에 color 속성 추가, menu-item에서 inline style로 적용 --- app/Providers/AppServiceProvider.php | 12 ++++++------ .../views/components/sidebar/menu-item.blade.php | 13 ++++++++++--- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index f85e665b..b51c6926 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -64,14 +64,14 @@ public function boot(): void $counts = app(ApprovalService::class)->getBadgeCounts(auth()->id()); $menuBadges = [ 'byRoute' => [ - 'approvals.pending' => $counts['pending'], - 'approvals.drafts' => $counts['draft'], - 'approvals.references' => $counts['reference_unread'], + 'approvals.pending' => ['count' => $counts['pending'], 'color' => '#ef4444'], + 'approvals.drafts' => ['count' => $counts['draft'], 'color' => '#3b82f6'], + 'approvals.references' => ['count' => $counts['reference_unread'], 'color' => '#10b981'], ], 'byUrl' => [ - '/approval-mgmt/pending' => $counts['pending'], - '/approval-mgmt/drafts' => $counts['draft'], - '/approval-mgmt/references' => $counts['reference_unread'], + '/approval-mgmt/pending' => ['count' => $counts['pending'], 'color' => '#ef4444'], + '/approval-mgmt/drafts' => ['count' => $counts['draft'], 'color' => '#3b82f6'], + '/approval-mgmt/references' => ['count' => $counts['reference_unread'], 'color' => '#10b981'], ], ]; } catch (\Throwable $e) { diff --git a/resources/views/components/sidebar/menu-item.blade.php b/resources/views/components/sidebar/menu-item.blade.php index 474ae49f..7d366d08 100644 --- a/resources/views/components/sidebar/menu-item.blade.php +++ b/resources/views/components/sidebar/menu-item.blade.php @@ -24,14 +24,20 @@ // 메뉴 뱃지 확인 (라우트명 또는 URL 기준) $badgeCount = 0; + $badgeColor = '#ef4444'; if (isset($menuBadges)) { + $badge = null; // 라우트명으로 찾기 if ($routeName && isset($menuBadges['byRoute'][$routeName])) { - $badgeCount = $menuBadges['byRoute'][$routeName]; + $badge = $menuBadges['byRoute'][$routeName]; } // URL로 찾기 elseif ($menu->url && isset($menuBadges['byUrl'][$menu->url])) { - $badgeCount = $menuBadges['byUrl'][$menu->url]; + $badge = $menuBadges['byUrl'][$menu->url]; + } + if ($badge) { + $badgeCount = is_array($badge) ? ($badge['count'] ?? 0) : $badge; + $badgeColor = is_array($badge) ? ($badge['color'] ?? '#ef4444') : '#ef4444'; } } @endphp @@ -48,7 +54,8 @@ class="flex items-center gap-2 px-3 py-2 rounded-lg text-sm {{ $activeClass }}" @endif {{ $menu->name }} @if($badgeCount > 0) - + {{ $badgeCount > 99 ? '99+' : $badgeCount }} @endif