feat(safety): needs attention card on dashboard
Add a "Needs Attention" card above the orders table that surfaces: - Import errors count (click → ERROR filter) - Unmapped SKUs count (click → Missing SKUs page) - Uninvoiced orders >3 days (click → UNINVOICED filter) Shows green "Totul in ordine" when all metrics are zero. Backend: add uninvoiced_old count to get_orders() and unresolved_skus from get_dashboard_stats() to dashboard/orders API response. Cache-bust: style.css?v=21, dashboard.js?v=29 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -301,6 +301,24 @@ async function loadDashOrders() {
|
||||
if (el('cntNef')) el('cntNef').textContent = c.nefacturate || c.uninvoiced || 0;
|
||||
if (el('cntCanc')) el('cntCanc').textContent = c.cancelled || 0;
|
||||
|
||||
// Attention card
|
||||
const attnEl = document.getElementById('attentionCard');
|
||||
if (attnEl) {
|
||||
const errors = c.error || 0;
|
||||
const unmapped = c.unresolved_skus || 0;
|
||||
const uninvOld = c.uninvoiced_old || 0;
|
||||
|
||||
if (errors === 0 && unmapped === 0 && uninvOld === 0) {
|
||||
attnEl.innerHTML = '<div class="attention-card attention-ok"><i class="bi bi-check-circle"></i> Totul in ordine</div>';
|
||||
} else {
|
||||
let items = [];
|
||||
if (errors > 0) items.push(`<span class="attention-item attention-error" onclick="document.querySelector('.filter-pill[data-status=ERROR]')?.click()"><i class="bi bi-exclamation-triangle"></i> ${errors} erori import</span>`);
|
||||
if (unmapped > 0) items.push(`<span class="attention-item attention-warning" onclick="window.location='${window.ROOT_PATH||''}/missing-skus'"><i class="bi bi-puzzle"></i> ${unmapped} SKU-uri nemapate</span>`);
|
||||
if (uninvOld > 0) items.push(`<span class="attention-item attention-warning" onclick="document.querySelector('.filter-pill[data-status=UNINVOICED]')?.click()"><i class="bi bi-receipt"></i> ${uninvOld} nefacturate >3 zile</span>`);
|
||||
attnEl.innerHTML = '<div class="attention-card attention-alert">' + items.join('') + '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
const tbody = document.getElementById('dashOrdersBody');
|
||||
const orders = data.orders || [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user