feat(helpdesk): add customer engagement analytics page [skip ci]

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>
This commit is contained in:
aminovfariz
2026-06-25 10:30:05 +02:00
parent 2924407450
commit 14da36e83a
16 changed files with 1150 additions and 46 deletions

View File

@@ -3133,4 +3133,77 @@
vertical-align: middle;
color: var(--app-muted, #6c757d);
}
/* --- Customer analytics --- */
.helpdesk-analytics-toolbar {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: calc(var(--app-spacing) * 0.5);
margin-bottom: calc(var(--app-spacing) * 0.75);
}
.helpdesk-analytics-threshold-note {
margin: 0;
font-size: var(--text-sm, 0.875rem);
color: var(--app-muted, #6c757d);
}
/* Stat tiles here are read-only (rendered as <div>), so suppress the link affordances. */
.helpdesk-analytics-tile {
cursor: default;
}
.helpdesk-analytics-tile:hover {
box-shadow: none;
}
.helpdesk-analytics-block {
margin-top: calc(var(--app-spacing) * 1.5);
}
.helpdesk-analytics-block-header {
margin-bottom: calc(var(--app-spacing) * 0.5);
}
.helpdesk-analytics-block-header h2 {
margin: 0;
font-size: var(--text-lg, 1.125rem);
}
.helpdesk-analytics-block-header .muted {
margin: 0.15rem 0 0;
font-size: var(--text-sm, 0.875rem);
color: var(--app-muted, #6c757d);
}
.helpdesk-analytics-table {
width: 100%;
border-collapse: collapse;
}
.helpdesk-analytics-table th,
.helpdesk-analytics-table td {
padding: 0.5rem 0.75rem;
border-bottom: 1px solid var(--app-border, #dee2e6);
text-align: left;
vertical-align: middle;
}
.helpdesk-analytics-table th.num,
.helpdesk-analytics-table td.num {
text-align: right;
white-space: nowrap;
}
.helpdesk-analytics-cust-no {
color: var(--app-muted, #6c757d);
font-size: var(--text-sm, 0.875rem);
}
.helpdesk-analytics-never {
color: var(--app-muted, #6c757d);
font-style: italic;
}
}