fix(helpdesk): remove contracts KPI section from support dashboard

The Contracts & products KPI tiles (active contracts, monthly volume,
support hours, next invoicing) distract from the ticket-focused support
view. Contract data remains available in the dedicated Sales tab.

Removes: section HTML, skeleton placeholder, JS render function + call.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-05 22:01:50 +02:00
parent bdeb2b9970
commit d6835d3b7b
2 changed files with 0 additions and 103 deletions

View File

@@ -417,70 +417,6 @@ function init(container) {
return html;
}
function renderSupportContractKpis(contracts) {
const entries = Array.isArray(contracts) ? contracts : [];
const wrapper = document.getElementById('support-contract-kpis-wrapper');
if (!wrapper) return;
if (entries.length === 0) {
wrapper.hidden = true;
return;
}
const amountFmt = new Intl.NumberFormat(undefined, {
style: 'currency',
currency: 'EUR',
maximumFractionDigits: 0,
});
const activeCount = entries.filter(c => String(c.state || '').toLowerCase() !== 'ended').length;
const totalVolume = entries.reduce((sum, c) => sum + Number(c.total_payoff_amount ?? 0), 0);
const totalSupportHours = entries.reduce((sum, c) => sum + Number(c.support_hours ?? 0), 0);
// Find nearest next invoicing
const now = Date.now();
let nearestInvoicing = null;
for (const c of entries) {
const raw = String(c.next_invoicing_date || '').trim();
if (!raw || raw.startsWith('0001-01-01')) continue;
const date = new Date(raw);
if (!Number.isNaN(date.getTime()) && date.getTime() > now) {
if (!nearestInvoicing || date < nearestInvoicing) nearestInvoicing = date;
}
}
setText('support-kpi-active-contracts', activeCount);
const totalContracts = entries.length;
if (totalContracts > activeCount) {
setHtml('support-kpi-active-contracts-trend',
`<span class="helpdesk-kpi-trend-neutral">${esc(t('of {total} total').replace('{total}', totalContracts))}</span>`);
}
setText('support-kpi-monthly-volume', amountFmt.format(totalVolume));
if (totalSupportHours > 0) {
setText('support-kpi-support-hours',
(Number.isInteger(totalSupportHours) ? totalSupportHours : totalSupportHours.toFixed(1)) + 'h');
} else {
setText('support-kpi-support-hours', '—');
}
if (nearestInvoicing) {
setText('support-kpi-next-invoicing', nearestInvoicing.toLocaleDateString());
const daysUntil = Math.ceil((nearestInvoicing.getTime() - now) / 86400000);
if (daysUntil >= 0) {
const cls = daysUntil <= 7 ? 'helpdesk-kpi-trend-negative'
: daysUntil <= 30 ? 'helpdesk-kpi-trend-neutral'
: 'helpdesk-kpi-trend-positive';
setHtml('support-kpi-next-invoicing-trend',
`<span class="${cls}">${esc(t('in {days} days').replace('{days}', daysUntil))}</span>`);
}
} else {
setText('support-kpi-next-invoicing', '—');
}
wrapper.hidden = false;
}
function contractTypeLabel(productType) {
return String(productType || '').trim() || '—';
@@ -925,9 +861,6 @@ function init(container) {
ageHintEl.innerHTML = `<span class="helpdesk-kpi-trend-negative">${criticalTickets} ${t('critical')}</span>`;
}
// Contract KPIs (second row)
const contracts = Array.isArray(result.contracts) ? result.contracts : [];
renderSupportContractKpis(contracts);
// Recommendations + escalations merged — only show section when there are entries
const recommendationsWrapper = document.getElementById('support-recommendations-wrapper');