fix(helpdesk): default period to 30 days and show trend timeframe hint

Change default period from 90 to 30 days for a more current snapshot.
Add legend footnote: '↑↓ Trend basiert auf den letzten 30 Tagen'
so the user knows what the arrows refer to.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-05 21:15:05 +02:00
parent e659bd5bc5
commit daab2f4999
4 changed files with 20 additions and 9 deletions

View File

@@ -10,6 +10,7 @@ if (container) {
const labelQueue = container.dataset.labelQueue || 'Queue';
const labelTickets = container.dataset.labelTickets || 'Tickets';
const labelCritical = container.dataset.labelCritical || 'Critical (>48h open)';
const labelTrendHint = container.dataset.labelTrendHint || 'Trend based on last {days} days';
const ticketBaseUrl = container.dataset.ticketBaseUrl || '';
const debitorBaseUrl = container.dataset.debitorBaseUrl || '';
const labelTrendUp = container.dataset.labelTrendUp || 'Backlog growing';
@@ -24,7 +25,7 @@ if (container) {
const elRefresh = container.querySelector('button[name="team-refresh"]');
const periodSelector = document.getElementById('team-period-selector');
let currentPeriod = 90;
let currentPeriod = 30;
function showState(state) {
if (elLoading) elLoading.hidden = state !== 'loading';
@@ -323,12 +324,19 @@ if (container) {
// Legend
const hasCritical = members.some(m => m.critical_tickets > 0);
if (hasCritical) {
const hasTrend = visible.some(m => (m.trend_delta ?? 0) !== 0);
if (hasCritical || hasTrend) {
const legend = h('div', 'helpdesk-team-legend');
const item = h('span', 'helpdesk-team-legend-item');
item.appendChild(h('span', 'helpdesk-team-legend-dot helpdesk-team-legend-dot-warning'));
item.appendChild(h('span', '', labelCritical));
legend.appendChild(item);
if (hasCritical) {
const item = h('span', 'helpdesk-team-legend-item');
item.appendChild(h('span', 'helpdesk-team-legend-dot helpdesk-team-legend-dot-warning'));
item.appendChild(h('span', '', labelCritical));
legend.appendChild(item);
}
if (hasTrend) {
const hint = labelTrendHint.replace('{days}', String(currentPeriod));
legend.appendChild(h('span', 'helpdesk-team-legend-item', '↑↓ ' + hint));
}
elCurrentCards.appendChild(legend);
}
}