diff --git a/ajax_bib_range.php b/ajax_bib_range.php index e3d86fc..16c97b0 100644 --- a/ajax_bib_range.php +++ b/ajax_bib_range.php @@ -773,6 +773,37 @@ if ($action == 'save_auto_config') { exit; } +// MSIN-4379 — Dashboard anomalies (dossards en double, orphelins, etc.) +if ($action == 'anomalies') { + + if (!fxBibRequirePromoteurSession()) { + echo json_encode([ + 'success' => false, + 'message' => fxBibMsg('bib_v4_ajax_session_invalid') + ]); + exit; + } + + $int_eve_id = (int)($_POST['eve_id'] ?? $_GET['eve_id'] ?? 0); + + if ($int_eve_id <= 0) { + echo json_encode([ + 'success' => false, + 'message' => fxBibMsg('bib_v4_ajax_epr_invalid') + ]); + exit; + } + + $tabAnomalies = fxBibCollectAnomalies($int_eve_id, $strLangue); + + echo json_encode([ + 'success' => true, + 'count' => fxBibAnomalyTotalCount($tabAnomalies), + 'html' => renderBibAnomaliesPanel($int_eve_id, $strLangue, $tabAnomalies), + ]); + exit; +} + // ===================== // ACTION INVALIDE // ===================== diff --git a/css/style.css b/css/style.css index 68018e3..cec62e2 100644 --- a/css/style.css +++ b/css/style.css @@ -2157,3 +2157,102 @@ a.ms1-trad-link.btn-aide-trad{ .team-mode-option input[type="radio"]{ margin-top:2px; } + +/* MSIN-4379 — Dashboard anomalies dossards */ +.bib-tool-card-header{ + display:flex; + align-items:center; + justify-content:space-between; + gap:12px; + flex-wrap:wrap; +} + +.bib-tool-card-title{ + margin:0; +} + +.bib-anomalies-panel{ + margin-bottom:14px; + border:1px solid #ced4da; + border-radius:4px; + overflow:hidden; +} + +.bib-anomalies-panel--alert{ + border-color:#dc3545; +} + +.bib-anomalies-header{ + display:flex; + align-items:center; + justify-content:space-between; + gap:10px; +} + +.bib-anomalies-header-label{ + display:inline-flex; + align-items:center; + gap:8px; + flex-wrap:wrap; +} + +.bib-anomalies-count{ + font-size:12px; + font-weight:700; +} + +.bib-anomalies-content{ + background:#fff; +} + +.bib-anomaly-block{ + padding:10px 12px; + border-top:1px solid #e9ecef; +} + +.bib-anomaly-block:first-child{ + border-top:none; +} + +.bib-anomaly-block-title{ + display:flex; + align-items:center; + flex-wrap:wrap; + gap:8px; + margin:0 0 8px; + font-size:14px; + font-weight:700; + color:#212529; +} + +.bib-anomaly-list{ + margin:0; +} + +.bib-anomaly-item{ + padding:8px 10px; + margin-bottom:6px; + background:#f8f9fa; + border:1px solid #e9ecef; + border-radius:4px; + font-size:13px; +} + +.bib-anomaly-item:last-child{ + margin-bottom:0; +} + +.bib-anomaly-sublist{ + margin-top:4px; + padding-left:14px; + font-size:12px; + color:#495057; +} + +.bib-anomaly-detail{ + margin-top:4px; +} + +.bib-anomalies-empty{ + font-size:13px; +} diff --git a/inc_footer_scripts.php b/inc_footer_scripts.php index b6ecee3..fb04350 100644 --- a/inc_footer_scripts.php +++ b/inc_footer_scripts.php @@ -2167,6 +2167,35 @@ if ($strLangue == 'fr') { return row.querySelectorAll('.batch-select-range:checked').length; } + /** MSIN-4379 — Rafraîchit le dashboard anomalies (chien de garde). */ + function refreshBibAnomaliesPanel() { + let mount = document.getElementById('bib-anomalies-mount'); + if (!mount || !moduleBib) { + return; + } + + let eveId = moduleBib.dataset.eveId || ''; + if (!eveId) { + return; + } + + fetch('/ajax_bib_range.php', { + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded' + }, + body: 'action=anomalies&eve_id=' + encodeURIComponent(eveId) + bibAjaxLangSuffix() + }) + .then(function (res) { return res.json(); }) + .then(function (data) { + if (!data.success || !data.html) { + return; + } + mount.innerHTML = data.html; + initModuleBibTippy(mount); + }); + } + function setBibContainerHtml(row, html) { let container = getBibContainer(row); if (!container) return null; @@ -2181,6 +2210,7 @@ if ($strLangue == 'fr') { initModuleBibTippy(row); } syncBibUiState(row); + refreshBibAnomaliesPanel(); return container; } diff --git a/php/inc_fx_promoteur.php b/php/inc_fx_promoteur.php index 6ae7aac..62ba5ec 100644 --- a/php/inc_fx_promoteur.php +++ b/php/inc_fx_promoteur.php @@ -3543,11 +3543,15 @@ function fxShowBibTool4($str_code, $int_eve_id, $strLangue){ ?> -
+ +
+ + +