New "Customer analytics" page under Monitoring: surfaces who is actively in contact vs. who has gone quiet, so the team can reach out before a customer slips away. - KPI tiles: total / active / no-contact / never-in-contact - "Customers without recent contact" — longest silence first - "Top customers by communication" — most ticket activity in the period - Configurable no-contact threshold (helpdesk settings, default 60 days) CustomerEngagementService aggregates the global ticket snapshot per customer (same single-pull model as RiskRadarService — no N+1 to BC). Last contact is the most recent ticket activity; silence beyond the threshold flags the customer. Revenue ranking deferred (BC OData exposes no per-customer ledger). All within modules/helpdesk/. Tests + PHPStan green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
160 lines
5.9 KiB
PHTML
160 lines
5.9 KiB
PHTML
<?php
|
|
|
|
$layoutNav = is_array($layoutNav ?? null) ? $layoutNav : [];
|
|
$helpdeskNav = is_array($layoutNav['helpdesk.nav'] ?? null) ? $layoutNav['helpdesk.nav'] : [];
|
|
$canViewDashboard = !empty($helpdeskNav['can_view_dashboard']);
|
|
$canManageSettings = !empty($helpdeskNav['can_manage_settings']);
|
|
$canViewTeam = !empty($helpdeskNav['can_view_team']);
|
|
$canViewRiskRadar = !empty($helpdeskNav['can_view_risk_radar']);
|
|
$canManageSoftwareProducts = !empty($helpdeskNav['can_manage_software_products']);
|
|
$canViewHandovers = !empty($helpdeskNav['can_view_handovers']);
|
|
$canViewUpdates = !empty($helpdeskNav['can_view_updates']);
|
|
|
|
$dashboardActive = navActive('helpdesk/dashboard', true);
|
|
$settingsActive = navActive('helpdesk/settings', true);
|
|
$teamActive = navActive('helpdesk/team', true);
|
|
$riskRadarActive = navActive('helpdesk/risk-radar', true);
|
|
$analyticsActive = navActive('helpdesk/analytics', true);
|
|
$domainsActive = navActive(['helpdesk/domains', 'helpdesk/domain'], true);
|
|
$softwareProductsActive = navActive('helpdesk/software-products', true);
|
|
$handoversActive = navActive('helpdesk/handovers', true);
|
|
$updatesActive = navActive('helpdesk/updates', true);
|
|
$customersActive = navActive('helpdesk', true);
|
|
if ($dashboardActive['isActive'] || $settingsActive['isActive'] || $teamActive['isActive'] || $riskRadarActive['isActive'] || $analyticsActive['isActive'] || $domainsActive['isActive'] || $softwareProductsActive['isActive'] || $handoversActive['isActive'] || $updatesActive['isActive']) {
|
|
$customersActive = ['class' => '', 'aria' => '', 'isActive' => false];
|
|
}
|
|
|
|
$helpdeskNavGroups = [
|
|
[
|
|
'key' => 'helpdesk-overview',
|
|
'label' => t('Overview'),
|
|
'icon' => 'bi-speedometer2',
|
|
'items' => [
|
|
[
|
|
'label' => t('Dashboard'),
|
|
'path' => 'helpdesk/dashboard',
|
|
'active' => $dashboardActive,
|
|
'visible' => $canViewDashboard,
|
|
],
|
|
],
|
|
],
|
|
[
|
|
'key' => 'helpdesk-lookup',
|
|
'label' => t('Lookup'),
|
|
'icon' => 'bi-search',
|
|
'items' => [
|
|
[
|
|
'label' => t('Customers'),
|
|
'path' => 'helpdesk',
|
|
'active' => $customersActive,
|
|
'visible' => true,
|
|
],
|
|
[
|
|
'label' => t('Domains'),
|
|
'path' => 'helpdesk/domains',
|
|
'active' => $domainsActive,
|
|
'visible' => true,
|
|
],
|
|
],
|
|
],
|
|
[
|
|
'key' => 'helpdesk-monitoring',
|
|
'label' => t('Monitoring'),
|
|
'icon' => 'bi-bar-chart-line',
|
|
'items' => [
|
|
[
|
|
'label' => t('Team workload'),
|
|
'path' => 'helpdesk/team',
|
|
'active' => $teamActive,
|
|
'visible' => $canViewTeam,
|
|
],
|
|
[
|
|
'label' => t('Risk radar'),
|
|
'path' => 'helpdesk/risk-radar',
|
|
'active' => $riskRadarActive,
|
|
'visible' => $canViewRiskRadar,
|
|
],
|
|
[
|
|
'label' => t('Customer analytics'),
|
|
'path' => 'helpdesk/analytics',
|
|
'active' => $analyticsActive,
|
|
'visible' => $canViewRiskRadar,
|
|
],
|
|
],
|
|
],
|
|
[
|
|
'key' => 'helpdesk-operations',
|
|
'label' => t('Operations'),
|
|
'icon' => 'bi-clipboard-check',
|
|
'items' => [
|
|
[
|
|
'label' => t('Handovers'),
|
|
'path' => 'helpdesk/handovers',
|
|
'active' => $handoversActive,
|
|
'visible' => $canViewHandovers,
|
|
],
|
|
[
|
|
'label' => t('Updates'),
|
|
'path' => 'helpdesk/updates',
|
|
'active' => $updatesActive,
|
|
'visible' => $canViewUpdates,
|
|
],
|
|
],
|
|
],
|
|
[
|
|
'key' => 'helpdesk-administration',
|
|
'label' => t('Administration'),
|
|
'icon' => 'bi-sliders',
|
|
'items' => [
|
|
[
|
|
'label' => t('Software products'),
|
|
'path' => 'helpdesk/software-products',
|
|
'active' => $softwareProductsActive,
|
|
'visible' => $canManageSoftwareProducts,
|
|
],
|
|
[
|
|
'label' => t('Settings'),
|
|
'path' => 'helpdesk/settings',
|
|
'active' => $settingsActive,
|
|
'visible' => $canManageSettings,
|
|
],
|
|
],
|
|
],
|
|
];
|
|
?>
|
|
<ul>
|
|
<?php foreach ($helpdeskNavGroups as $group):
|
|
$visibleItems = array_values(array_filter($group['items'], static fn (array $item): bool => !empty($item['visible'])));
|
|
if (!$visibleItems) {
|
|
continue;
|
|
}
|
|
$groupIsActive = false;
|
|
foreach ($visibleItems as $item) {
|
|
if (!empty(($item['active'] ?? [])['isActive'])) {
|
|
$groupIsActive = true;
|
|
break;
|
|
}
|
|
}
|
|
?>
|
|
<li class="app-sidebar-group app-sidebar-admin-group">
|
|
<details data-details-key="<?php e($group['key']); ?>"<?php if ($groupIsActive): ?> open<?php endif; ?>>
|
|
<summary>
|
|
<i class="bi <?php e($group['icon']); ?>"></i>
|
|
<span><?php e($group['label']); ?></span>
|
|
</summary>
|
|
<ul>
|
|
<?php foreach ($visibleItems as $item):
|
|
$active = $item['active'] ?? ['class' => '', 'aria' => ''];
|
|
?>
|
|
<li>
|
|
<a href="<?php e(lurl($item['path'])); ?>" class="<?php e($active['class'] ?? ''); ?>" <?php echo $active['aria'] ?? ''; // raw-html-ok: pre-built ARIA attribute from navActive() ?>>
|
|
<?php e($item['label']); ?>
|
|
</a>
|
|
</li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
</details>
|
|
</li>
|
|
<?php endforeach; ?>
|
|
</ul>
|