feat: [approvals] 사이드바 결재 뱃지 색상 함별 차별화

- 결재함: 빨간색(#ef4444), 기안함: 파란색(#3b82f6), 참조함: 초록색(#10b981)
- 뱃지 데이터에 color 속성 추가, menu-item에서 inline style로 적용
This commit is contained in:
김보곤
2026-02-28 15:16:54 +09:00
parent 215aa2bec4
commit ee1a2d6633
2 changed files with 16 additions and 9 deletions

View File

@@ -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
<span class="sidebar-text flex-1">{{ $menu->name }}</span>
@if($badgeCount > 0)
<span class="sidebar-text inline-flex items-center justify-center min-w-[1.25rem] h-5 px-1.5 text-xs font-bold text-white bg-red-500 rounded-full">
<span class="sidebar-text inline-flex items-center justify-center min-w-[1.25rem] h-5 px-1.5 text-xs font-bold text-white rounded-full"
style="background-color: {{ $badgeColor }};">
{{ $badgeCount > 99 ? '99+' : $badgeCount }}
</span>
@endif