diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index b9d84580..5cc53b14 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -7,6 +7,7 @@ use App\Models\Tenants\Department; use App\Models\User; use App\Observers\FileObserver; +use App\Services\ApprovalService; use App\Services\SidebarMenuService; use Illuminate\Database\Eloquent\Relations\Relation; use Illuminate\Support\Facades\Cache; @@ -56,10 +57,33 @@ public function boot(): void $menuService = app(SidebarMenuService::class); $menusBySection = $menuService->getMenusBySection(); + // 결재 뱃지 건수 + $menuBadges = ['byRoute' => [], 'byUrl' => []]; + if (auth()->check()) { + try { + $counts = app(ApprovalService::class)->getBadgeCounts(auth()->id()); + $menuBadges = [ + 'byRoute' => [ + 'approvals.pending' => $counts['pending'], + 'approvals.drafts' => $counts['draft'], + 'approvals.references' => $counts['reference_unread'], + ], + 'byUrl' => [ + '/approval-mgmt/pending' => $counts['pending'], + '/approval-mgmt/drafts' => $counts['draft'], + '/approval-mgmt/references' => $counts['reference_unread'], + ], + ]; + } catch (\Throwable $e) { + // 테이블 미존재 등 예외 무시 + } + } + $view->with([ 'mainMenus' => $menusBySection['main'], 'toolsMenus' => $menusBySection['tools'], 'labsMenus' => $menusBySection['labs'], + 'menuBadges' => $menuBadges, ]); }); } diff --git a/resources/views/partials/header.blade.php b/resources/views/partials/header.blade.php index 76179166..e98af713 100644 --- a/resources/views/partials/header.blade.php +++ b/resources/views/partials/header.blade.php @@ -95,12 +95,31 @@ class="flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium rounded-lg bo - - + +
+ + + {{-- 드롭다운 --}} + +
@@ -149,15 +168,124 @@ class="flex items-center gap-1 lg:gap-2 p-1.5 lg:px-3 lg:py-2 text-sm font-mediu @push('scripts')