diff --git a/views/DashboardView.php b/views/DashboardView.php index 2db7bed..4417744 100644 --- a/views/DashboardView.php +++ b/views/DashboardView.php @@ -120,7 +120,6 @@ include __DIR__ . '/layout_header.php'; ?>
[ # ]
@@ -133,7 +132,6 @@ include __DIR__ . '/layout_header.php';
[ ! ]
@@ -146,7 +144,6 @@ include __DIR__ . '/layout_header.php';
[ @ ]
@@ -171,7 +168,6 @@ include __DIR__ . '/layout_header.php';
[ OK ]
@@ -334,7 +330,8 @@ include __DIR__ . '/layout_header.php'; function makeDonut(canvasId, data, colorMap) { var ctx = document.getElementById(canvasId); - if (!ctx || !data.length) return; + if (!ctx) return; + if (!data.length) { showChartEmptyState(ctx); return; } ctx.title = 'Click a segment to filter the ticket list'; return new Chart(ctx, { type: 'doughnut', @@ -365,9 +362,22 @@ include __DIR__ . '/layout_header.php'; }); } + function showChartEmptyState(canvas) { + canvas.style.display = 'none'; + var wrap = canvas.parentElement; + if (wrap && !wrap.querySelector('.lt-chart-empty')) { + var msg = document.createElement('div'); + msg.className = 'lt-chart-empty'; + msg.style.cssText = 'display:flex;align-items:center;justify-content:center;height:100%;color:var(--text-muted);font-size:0.75rem'; + msg.textContent = 'No data for current filters'; + wrap.appendChild(msg); + } + } + function makeBar(canvasId, data) { var ctx = document.getElementById(canvasId); - if (!ctx || !data.length) return; + if (!ctx) return; + if (!data.length) { showChartEmptyState(ctx); return; } ctx.title = 'Click a bar to filter the ticket list'; return new Chart(ctx, { type: 'bar', @@ -1226,7 +1236,6 @@ window.TICKET_STATUSES =