Files
breadcrumb-the-shire/modules/helpdesk/lib/Module/Helpdesk/Providers/HelpdeskLayoutProvider.php
fs cae66e5361 feat(helpdesk): add team workload dashboard with per-agent metrics
New standalone page (helpdesk/team) showing support agent workload
aggregated from BC tickets. KPI bar (open, unassigned, avg age, resolved),
per-agent table sorted by open tickets, period selector (30/90/180/365d).
Global OData query via getTicketsForTeam() without customer filter.
New permission helpdesk.team-workload.view with admin role assignment.
Includes 6 PHPUnit tests for buildTeamWorkloadDashboard().

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 18:46:54 +02:00

34 lines
1.2 KiB
PHP

<?php
namespace MintyPHP\Module\Helpdesk\Providers;
use MintyPHP\App\AppContainer;
use MintyPHP\App\Module\Contracts\LayoutContextProvider;
use MintyPHP\Service\Access\AuthorizationService;
final class HelpdeskLayoutProvider implements LayoutContextProvider
{
public function provide(array $session, AppContainer $container): array
{
$userId = (int) ($session['user']['id'] ?? 0);
if ($userId <= 0) {
return ['helpdesk.nav' => ['can_manage_settings' => false]];
}
try {
$authorizationService = $container->get(AuthorizationService::class);
$actorContext = ['actor_user_id' => $userId];
$canManageSettings = $authorizationService->authorize('helpdesk.settings.manage', $actorContext)->isAllowed();
$canViewTeam = $authorizationService->authorize('helpdesk.team-workload.view', $actorContext)->isAllowed();
} catch (\Throwable) {
$canManageSettings = false;
$canViewTeam = false;
}
return ['helpdesk.nav' => [
'can_manage_settings' => $canManageSettings,
'can_view_team' => $canViewTeam,
]];
}
}