feat: add one-click nudge system with popover, throttling, and email notifications (Story 3.2)

Add NudgeController with 1-hour throttling per declaration, NudgePopover component
on declarations index and dashboard, shadcn-vue popover primitives, and per-declaration
nudge tracking. Owners/managers can nudge assigned workers with one click.
Includes 10 feature tests covering authorization, throttling, and cache invalidation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-26 11:26:22 +01:00
parent 1ab3cfc445
commit c7ecbd0ee7
15 changed files with 808 additions and 6 deletions

View File

@@ -34,6 +34,7 @@ class DashboardController extends Controller
'workspaceName' => null,
'roleLabel' => null,
'isWorker' => false,
'canNudge' => false,
'declarationsUrl' => null,
'clientsUrl' => null,
'viewAllAlertsUrl' => null,
@@ -50,6 +51,7 @@ class DashboardController extends Controller
abort(404);
}
$isWorker = $workspaceUser->role->is(WorkspaceUserRole::Worker);
$cacheKey = "dashboard:{$workspace->id}:{$user->id}";
$dashboardData = Cache::remember($cacheKey, 300, function () use ($workspace, $user, $workspaceUser) {
@@ -106,11 +108,11 @@ class DashboardController extends Controller
'statusLabel' => DeclarationStatus::labels()[$d->status->value] ?? $d->status->value,
'dueDate' => $d->due_date?->format('Y-m-d'),
'showUrl' => route('declarations.show', $d),
'nudgeUrl' => ! $isWorker ? route('declarations.nudge', $d) : null,
])
->all();
$roleLabel = $this->roleLabels()[$workspaceUser->role->value] ?? $workspaceUser->role->value;
$isWorker = $workspaceUser->role->is(WorkspaceUserRole::Worker);
$assigneeParam = $isWorker ? ['assignee' => $user->id] : [];
@@ -150,6 +152,7 @@ class DashboardController extends Controller
'workspaceName' => $workspace->name,
'roleLabel' => $roleLabel,
'isWorker' => $isWorker,
'canNudge' => ! $isWorker,
'declarationsUrl' => route('declarations.index'),
'clientsUrl' => route('clients.index'),
'viewAllAlertsUrl' => route('declarations.index', ['filter' => 'alerts']),