From 84c38e3641841a7ef3760ae8b0a499b2caaec8e8 Mon Sep 17 00:00:00 2001 From: Claude Agent Date: Thu, 2 Apr 2026 13:01:50 +0000 Subject: [PATCH] =?UTF-8?q?style(ui):=20design=20polish=20+=20replace=20CU?= =?UTF-8?q?I=20badge=20with=20+RO/=E2=88=92RO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6 design review fixes: diff summary badge in modal header, PF indicator, eFactura risk icon (octagon vs triangle for colorblind), aria labels, extract .denom-mismatch CSS class, remove dead .addr-table CSS. Replace vague "Corectat" badge with directional +RO (green, prefix added) or −RO (orange, prefix removed). Kit items show "Kit" badge instead of price match dot. Cache-bust shared.js v24, style.css v31. Co-Authored-By: Claude Opus 4.6 (1M context) --- api/app/static/css/style.css | 31 +++++++--------- api/app/static/js/shared.js | 72 ++++++++++++++++++++++++++++-------- api/app/templates/base.html | 4 +- 3 files changed, 72 insertions(+), 35 deletions(-) diff --git a/api/app/static/css/style.css b/api/app/static/css/style.css index 622883c..45f61c3 100644 --- a/api/app/static/css/style.css +++ b/api/app/static/css/style.css @@ -1229,26 +1229,21 @@ tr.mapping-deleted td { flex-shrink: 0; filter: drop-shadow(0 0 3px rgba(202,138,4,0.3)); } -.addr-table { width: 100%; border-collapse: collapse; font-size: 13px; } -.addr-table th { - font-family: var(--font-display); - font-size: 12px; - font-weight: 500; - text-transform: uppercase; - color: var(--text-muted); - padding: 6px 8px; - text-align: left; +.addr-line .bi-exclamation-octagon { + color: var(--error-text); + flex-shrink: 0; + filter: drop-shadow(0 0 3px rgba(220,38,38,0.3)); } -.addr-table td { padding: 8px; vertical-align: top; font-family: var(--font-body); } -.addr-mismatch { background: var(--warning-light) !important; } -.addr-efactura-risk { background: var(--error-light) !important; } -.addr-label { - font-family: var(--font-display); - font-size: 11px; +/* Denomination mismatch alert */ +.denom-mismatch { + background: var(--warning-light); + padding: 8px 12px; + border-radius: var(--card-radius); +} +.denom-mismatch-title { + font-size: 12px; + color: var(--warning-text); font-weight: 500; - text-transform: uppercase; - color: var(--text-secondary); - margin-bottom: 4px; } /* Mobile address cards */ .addr-card { border: 1px solid var(--border); border-radius: var(--card-radius); margin-bottom: 8px; overflow: hidden; } diff --git a/api/app/static/js/shared.js b/api/app/static/js/shared.js index 460cb7f..e65890e 100644 --- a/api/app/static/js/shared.js +++ b/api/app/static/js/shared.js @@ -517,15 +517,20 @@ async function renderOrderDetailModal(orderNumber, opts) { if (priceCheckEl) priceCheckEl.innerHTML = ''; const reconEl = document.getElementById('detailInvoiceRecon'); if (reconEl) { reconEl.innerHTML = ''; reconEl.style.display = 'none'; } + // Remove diff badge from previous render + const prevDiffBadge = document.querySelector('.diff-badge'); + if (prevDiffBadge) prevDiffBadge.remove(); // Reset compact header elements const partenerRoa = document.getElementById('detailPartenerRoa'); if (partenerRoa) { partenerRoa.style.display = 'none'; partenerRoa.textContent = ''; } const cuiGomag = document.getElementById('detailCuiGomag'); if (cuiGomag) cuiGomag.style.display = 'none'; const cuiRoa = document.getElementById('detailCuiRoa'); - if (cuiRoa) cuiRoa.style.display = 'none'; - const anafArea = document.getElementById('detailPartnerAnafArea'); - if (anafArea) anafArea.innerHTML = ''; + if (cuiRoa) { + cuiRoa.style.display = 'none'; + // Restore original structure (may have been replaced by PF indicator) + cuiRoa.innerHTML = 'CUI: '; + } const denomMismatch = document.getElementById('detailDenomMismatch'); if (denomMismatch) { denomMismatch.style.display = 'none'; denomMismatch.innerHTML = ''; } const addressBlock = document.getElementById('detailAddressBlock'); @@ -693,7 +698,10 @@ async function renderOrderDetailModal(orderNumber, opts) { const priceInfo = { pret_roa: item.pret_roa, match: item.price_match }; const pretRoaHtml = priceInfo.pret_roa != null ? fmtNum(priceInfo.pret_roa) : '–'; let matchDot, rowStyle; - if (priceInfo.pret_roa == null && priceInfo.match == null) { + if (item.kit) { + matchDot = 'Kit'; + rowStyle = ''; + } else if (priceInfo.pret_roa == null && priceInfo.match == null) { matchDot = ''; rowStyle = ''; } else if (priceInfo.match === false) { @@ -895,10 +903,16 @@ function _renderHeaderInfo(order) { document.getElementById('detailCuiRoaVal').textContent = pi.cod_fiscal_roa || '\u2014'; cuiRoaEl.style.display = ''; - // CUI correction badge + // CUI correction badge: +RO (added prefix) or −RO (removed prefix) let cuiCorrHtml = ''; - if (pi.anaf_cod_fiscal_adjusted) { - cuiCorrHtml = ' Corectat'; + if (pi.anaf_cod_fiscal_adjusted && pi.cod_fiscal_gomag && pi.cod_fiscal_roa) { + const gomagHasRO = /^RO\s*/i.test(pi.cod_fiscal_gomag); + const roaHasRO = /^RO\s*/i.test(pi.cod_fiscal_roa); + if (!gomagHasRO && roaHasRO) { + cuiCorrHtml = ' +RO'; + } else if (gomagHasRO && !roaHasRO) { + cuiCorrHtml = ' −RO'; + } } // ANAF badge @@ -906,15 +920,24 @@ function _renderHeaderInfo(order) { if (anafArea) { let anafBadge; if (pi.anaf_platitor_tva === 1) { - anafBadge = 'Platitor TVA'; + anafBadge = 'Platitor TVA'; } else if (pi.anaf_platitor_tva === 0) { - anafBadge = 'Neplatitor TVA'; + anafBadge = 'Neplatitor TVA'; } else { - anafBadge = '?'; + anafBadge = '?'; } anafArea.innerHTML = cuiCorrHtml + ' ' + anafBadge; } } + } else { + // PF indicator — show muted text in CUI area + const cuiRoaEl = document.getElementById('detailCuiRoa'); + if (cuiRoaEl) { + document.getElementById('detailCuiRoaVal').textContent = ''; + document.getElementById('detailPartnerAnafArea').innerHTML = ''; + cuiRoaEl.innerHTML = 'Persoana fizica'; + cuiRoaEl.style.display = ''; + } } // ERROR orders: muted dashes for ROA fields @@ -927,8 +950,8 @@ function _renderHeaderInfo(order) { if (isPJ && pi.anaf_denumire_mismatch && pi.denumire_anaf) { const denomEl = document.getElementById('detailDenomMismatch'); if (denomEl) { - denomEl.innerHTML = `
- Denumire diferita
+ denomEl.innerHTML = `
+ Denumire diferita
GoMag: ${esc(order.customer_name || '')}
ANAF: ${esc(pi.denumire_anaf)}
`; @@ -952,11 +975,11 @@ function _renderHeaderInfo(order) { const escaped = esc(text); let icon = ''; if (matchIcon === 'match') { - icon = ' '; + icon = ' '; } else if (matchIcon === 'mismatch') { - icon = ' '; + icon = ' '; } else if (matchIcon === 'risk') { - icon = ' '; + icon = ' '; } return `
${label} @@ -989,4 +1012,23 @@ function _renderHeaderInfo(order) { } addressLines.innerHTML = html; + + // Diff summary badge in modal header + let diffCount = 0; + if (isPJ && pi.anaf_denumire_mismatch) diffCount++; + if (order.price_check && order.price_check.mismatches > 0) diffCount += order.price_check.mismatches; + if (addr) { + if (addr.livrare_roa && !addrMatch(addr.livrare_gomag, addr.livrare_roa)) diffCount++; + if (addr.facturare_roa && !addrMatch(addr.facturare_gomag, addr.facturare_roa)) diffCount++; + } + const orderNumEl = document.getElementById('detailOrderNumber'); + if (orderNumEl && diffCount > 0) { + const existing = orderNumEl.querySelector('.diff-badge'); + if (existing) existing.remove(); + const badge = document.createElement('span'); + badge.className = 'diff-badge badge ms-2'; + badge.style.cssText = 'background:var(--warning-light);color:var(--warning-text);font-size:11px;vertical-align:middle'; + badge.textContent = diffCount + ' diferente'; + orderNumEl.parentNode.insertBefore(badge, orderNumEl.nextSibling); + } } diff --git a/api/app/templates/base.html b/api/app/templates/base.html index c4e7cab..ddc9b87 100644 --- a/api/app/templates/base.html +++ b/api/app/templates/base.html @@ -19,7 +19,7 @@ {% set rp = request.scope.get('root_path', '') %} - + @@ -161,7 +161,7 @@ - +