feat: [approvals] 결재 알림 뱃지 시스템 구현

- 사이드바: 결재 대기/기안함/참조함 메뉴에 빨간 뱃지 표시
- 헤더: 알림 벨 클릭 시 결재 대기 목록 드롭다운 표시
- 드롭다운: 제목/기안자/양식/긴급 여부/일시 표시, 클릭 시 상세 이동
- 뱃지 건수 60초 자동 갱신 (API: /api/admin/approvals/badge-counts)
This commit is contained in:
김보곤
2026-02-28 15:08:42 +09:00
parent 9d939a6a6a
commit d1911265f4
2 changed files with 164 additions and 12 deletions

View File

@@ -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,
]);
});
}