diff --git a/ajax_bib_range.php b/ajax_bib_range.php index 82ce333..40bd0cd 100644 --- a/ajax_bib_range.php +++ b/ajax_bib_range.php @@ -568,10 +568,7 @@ if ($action == 'batch_global_simulate') { $intManque ); - $html = '
' - . '
' . fxBibEsc($info) . '
' - . implode('', $htmlParts) - . '
'; + $html = fxBibWrapGlobalSimView($info, implode('', $htmlParts)); echo json_encode([ 'success' => true, diff --git a/css/style.css b/css/style.css index 7bbff77..1128dea 100644 --- a/css/style.css +++ b/css/style.css @@ -1495,6 +1495,25 @@ ul.ms1-menu-compte li a:hover, ul.ms1-menu-compte li a:active { font-weight:600; margin-bottom:12px; } +.bib-global-sim-view__toolbar{ + display:flex; + align-items:center; + justify-content:space-between; + gap:12px; + flex-wrap:wrap; + margin-bottom:12px; + padding-bottom:10px; + border-bottom:1px solid #dee2e6; +} +.bib-global-sim-view__title{ + font-size:1rem; + font-weight:700; + margin:0; +} +/* Un seul Fermer en tête — pas les boutons par épreuve dans la simulation globale */ +.bib-global-sim-view .bib-global-sim-section .btn-close-view{ + display:none; +} .bib-global-sim-section{ margin-top:16px; padding-top:12px; diff --git a/js/v2/bib-assignments.js b/js/v2/bib-assignments.js index ecbea7a..4004d8f 100644 --- a/js/v2/bib-assignments.js +++ b/js/v2/bib-assignments.js @@ -386,6 +386,28 @@ } } + function bibRemoveGlobalSimViews() { + document.querySelectorAll('.bib-global-sim-view').forEach(function (el) { + el.remove(); + }); + } + + function bibInsertGlobalSimView(html) { + bibRemoveGlobalSimViews(); + + var detailBody = document.getElementById('bib-tool-detail-body'); + var anchor = bibGetGlobalBatchBody() || bibGetGlobalBatchPanel(); + + if (detailBody) { + detailBody.insertAdjacentHTML('beforeend', html); + return; + } + + if (anchor) { + anchor.insertAdjacentHTML('afterend', html); + } + } + // MSIN-4440 — Grille outils : un panneau de détail, contenu déplacé depuis #bib-tool-store. var bibActiveTool = null; var bibToolContentSlots = {}; @@ -484,6 +506,7 @@ bibActiveTool = null; bibSetActiveToolButton(null); bibSetToolDetailTitle(null); + bibRemoveGlobalSimViews(); var detail = document.getElementById('bib-tool-detail'); var detailBody = document.getElementById('bib-tool-detail-body'); @@ -617,6 +640,7 @@ bibRestoreToolContent(prevTool); bibInvalidateToolSlot(prevTool); } + bibRemoveGlobalSimViews(); return bibEnsureToolLoaded(toolId).then(function () { var panel = bibGetToolPanel(toolId); @@ -1309,15 +1333,7 @@ return; } - var existing = document.querySelector('.epr-row-view'); - if (existing) { - existing.remove(); - } - - var anchor = bibGetGlobalBatchBody() || bibGetGlobalBatchPanel(); - if (anchor) { - anchor.insertAdjacentHTML('afterend', data.html); - } + bibInsertGlobalSimView(data.html); }); return; @@ -1355,15 +1371,7 @@ return; } - var existing = document.querySelector('.epr-row-view'); - if (existing) { - existing.remove(); - } - - var anchor = bibGetGlobalBatchBody() || bibGetGlobalBatchPanel(); - if (anchor) { - anchor.insertAdjacentHTML('afterend', data.html); - } + bibInsertGlobalSimView(data.html); }); return; diff --git a/php/inc_fx_bib_global_generated.php b/php/inc_fx_bib_global_generated.php index b2316bd..a7533bc 100644 --- a/php/inc_fx_bib_global_generated.php +++ b/php/inc_fx_bib_global_generated.php @@ -423,10 +423,7 @@ function fxBibSimulateGlobalBatchGenerated($int_eve_id, $tabPlan, $strSort1, $st $intParticipants ); - $html = '
' - . '
' . fxBibEsc($info) . '
' - . implode('', $htmlParts) - . '
'; + $html = fxBibWrapGlobalSimView($info, implode('', $htmlParts), 'bib-global-sim-view--generated'); return [ 'success' => true, diff --git a/php/inc_fx_promoteur.php b/php/inc_fx_promoteur.php index 5428328..619db9d 100644 --- a/php/inc_fx_promoteur.php +++ b/php/inc_fx_promoteur.php @@ -4597,6 +4597,35 @@ function fxBibGlobalBatchSectionClose() { return ''; } +/** + * MSIN-4443 — Enveloppe résultats simulation assignation globale (bouton Fermer). + */ +function fxBibWrapGlobalSimView($strSummary, $strSectionsHtml, $strExtraClass = '') { + $strExtraClass = trim((string)$strExtraClass); + $strClass = 'epr-row-view bib-global-sim-view'; + if ($strExtraClass !== '') { + $strClass .= ' ' . preg_replace('/[^a-z0-9 _-]/', '', $strExtraClass); + } + + ob_start(); + ?> +
+
+ + + + + +
+
+ +
+