From 2aa398b1f05ac769af915b211df2df96f7d3e2a8 Mon Sep 17 00:00:00 2001 From: stephan Date: Thu, 9 Jul 2026 12:20:08 -0400 Subject: [PATCH] Implement collapsible sections for global batch assignments, enhance styles, and increment version code to 4.72.781 This commit introduces collapsible sections for global batch assignments in the user interface, improving organization and user experience. The CSS is updated to style these sections, including headers and content areas, while the JavaScript is modified to handle the toggling functionality. Additionally, the version code is incremented to 4.72.781 to reflect these changes. --- css/style.css | 31 ++++++++++++-- js/v2/bib-assignments.js | 87 ++++++++++++++++++++++++++++++++++++---- php/inc_fx_promoteur.php | 49 ++++++++++++++++------ php/inc_settings.php | 2 +- 4 files changed, 145 insertions(+), 24 deletions(-) diff --git a/css/style.css b/css/style.css index ee84c79..335c31f 100644 --- a/css/style.css +++ b/css/style.css @@ -1394,12 +1394,37 @@ ul.ms1-menu-compte li a:hover, ul.ms1-menu-compte li a:active { flex-wrap:wrap; } .bib-global-batch__body{ - margin-top:12px; - padding-top:12px; - border-top:1px solid #d8e3ef; + margin-top:0; + padding-top:0; + border-top:none; + display:flex; + flex-direction:column; + gap:10px; } .bib-global-batch__section{ margin-bottom:0; + border:1px solid #c5d9f5; + border-radius:8px; + overflow:hidden; + background:#fff; +} +.bib-global-batch__section-header{ + margin:0; + padding:8px 10px; + cursor:pointer; + user-select:none; +} +.bib-global-batch__section-header .epr-header-label{ + font-size:13px; + font-weight:700; +} +.bib-global-batch__section-header .btn-aide-bib{ + color:#fff; +} +.bib-global-batch__section-content{ + padding:10px 12px; + border-top:1px solid #c5d9f5; + background:#f8fbfe; } .bib-global-batch__section-title{ font-size:1rem; diff --git a/js/v2/bib-assignments.js b/js/v2/bib-assignments.js index 6ac51bb..cfb65d5 100644 --- a/js/v2/bib-assignments.js +++ b/js/v2/bib-assignments.js @@ -621,8 +621,7 @@ } if (toolId === 'global_batch') { - updateGlobalBatchAnalysis(); - updateGlobalBatchGeneratedAnalysis(); + /* Sections repliées à l'arrivée — analyse au déploiement d'une section. */ } bibSyncToolNavBadges(toolId); @@ -640,8 +639,7 @@ initModuleBibTippy(document.getElementById('bib-tool-detail')); if (toolId === 'global_batch') { - updateGlobalBatchAnalysis(); - updateGlobalBatchGeneratedAnalysis(); + /* Sections repliées à l'arrivée — analyse au déploiement d'une section. */ } } @@ -717,8 +715,6 @@ body.classList.remove('bib-ui-hidden'); } bibGlobalBatchSetToggleState(toggle, true); - updateGlobalBatchAnalysis(); - updateGlobalBatchGeneratedAnalysis(); } function bibSetGlobalBatchInfo(infoEl, text, state) { @@ -1558,7 +1554,8 @@ } let collapsed = block.classList.toggle('is-collapsed'); btnToggle.setAttribute('aria-expanded', collapsed ? 'false' : 'true'); - let hdr = block.querySelector('.bib-anomaly-block-header'); + let hdr = block.querySelector('.bib-anomaly-block-header') + || block.querySelector('.bib-global-batch__section-header'); if (hdr) { hdr.setAttribute('aria-expanded', collapsed ? 'false' : 'true'); } @@ -1576,6 +1573,50 @@ } } + function bibCollapseGlobalBatchSection(section) { + if (!section || section.classList.contains('is-collapsed')) { + return; + } + + var btnToggle = section.querySelector('.epr-block-toggle'); + if (btnToggle) { + bibToggleCollapsibleBlock(section, btnToggle); + } else { + section.classList.add('is-collapsed'); + var hdr = section.querySelector('.bib-global-batch__section-header'); + if (hdr) { + hdr.setAttribute('aria-expanded', 'false'); + } + } + } + + function bibToggleGlobalBatchSection(section, btnToggle) { + if (!section || !btnToggle) { + return; + } + + var willExpand = section.classList.contains('is-collapsed'); + var panel = bibGetGlobalBatchPanel(); + + if (willExpand && panel) { + panel.querySelectorAll('.bib-global-batch__section').forEach(function (other) { + if (other !== section) { + bibCollapseGlobalBatchSection(other); + } + }); + } + + bibToggleCollapsibleBlock(section, btnToggle); + + if (!section.classList.contains('is-collapsed')) { + if (section.classList.contains('bib-global-batch--existing')) { + updateGlobalBatchAnalysis(); + } else if (section.classList.contains('bib-global-batch--generated')) { + updateGlobalBatchGeneratedAnalysis(); + } + } + } + moduleBib.addEventListener('click', function (e) { if (e.target.closest('.btn-aide-bib, .bib-aide-trigger, .btn-aide-trad, .btn-doc-trigger, .btn-admin-doc, .btn-trad-admin, .ms1-trad-link')) { return; @@ -1592,11 +1633,31 @@ return; } + let globalBatchHdr = e.target.closest('.bib-global-batch__section-header'); + if (globalBatchHdr && moduleBib.contains(globalBatchHdr) + && !e.target.closest('.epr-block-toggle, .btn-aide-bib, .bib-aide-trigger, .btn-aide-trad, .btn-trad-admin')) { + e.preventDefault(); + let globalBatchSection = globalBatchHdr.closest('.bib-global-batch__section'); + let globalBatchBtn = globalBatchHdr.querySelector('.epr-block-toggle'); + if (globalBatchSection && globalBatchBtn) { + bibToggleGlobalBatchSection(globalBatchSection, globalBatchBtn); + } + return; + } + let btnToggle = e.target.closest('.epr-block-toggle'); if (!btnToggle || !moduleBib.contains(btnToggle)) { return; } + let globalBatchSection = btnToggle.closest('.bib-global-batch__section'); + if (globalBatchSection && bibGetGlobalBatchPanel() + && bibGetGlobalBatchPanel().contains(globalBatchSection)) { + e.preventDefault(); + bibToggleGlobalBatchSection(globalBatchSection, btnToggle); + return; + } + let anomalyBlock = btnToggle.closest('.bib-anomaly-block'); if (anomalyBlock) { e.preventDefault(); @@ -1627,6 +1688,18 @@ if (e.key !== 'Enter' && e.key !== ' ') { return; } + + let globalBatchHdr = e.target.closest('.bib-global-batch__section-header'); + if (globalBatchHdr && moduleBib.contains(globalBatchHdr)) { + e.preventDefault(); + let globalBatchSection = globalBatchHdr.closest('.bib-global-batch__section'); + let globalBatchBtn = globalBatchHdr.querySelector('.epr-block-toggle'); + if (globalBatchSection && globalBatchBtn) { + bibToggleGlobalBatchSection(globalBatchSection, globalBatchBtn); + } + return; + } + let anomalyHdr = e.target.closest('.bib-anomaly-block-header'); if (!anomalyHdr || !moduleBib.contains(anomalyHdr)) { return; diff --git a/php/inc_fx_promoteur.php b/php/inc_fx_promoteur.php index 3533ad0..5428328 100644 --- a/php/inc_fx_promoteur.php +++ b/php/inc_fx_promoteur.php @@ -4568,6 +4568,35 @@ function renderBibGlobalBatchPanelShell($int_eve_id, $tabEpreuves, $strLangue) { return ob_get_clean(); } +/** + * MSIN-4443 — En-tête repliable d'une section assignation globale. + */ +function fxBibGlobalBatchSectionOpen($strMode, $strTitleClef, $strLangue = 'fr') { + $strMode = preg_replace('/[^a-z_]/', '', (string)$strMode); + ob_start(); + ?> + '; +} + /** * MSIN-4436 — Bloc assignation avec séquences existantes. */ @@ -4592,11 +4621,9 @@ function renderBibGlobalBatchPanelExisting($int_eve_id, $tabEpreuves, $strLangue } ob_start(); - ?> -
-

+ echo fxBibGlobalBatchSectionOpen('existing', 'bib_v4_global_batch_existing_title', $strLangue); - + if (count($tabSolo) < 2) { ?>

@@ -4680,9 +4707,9 @@ function renderBibGlobalBatchPanelExisting($int_eve_id, $tabEpreuves, $strLangue - -
- -
-

@@ -4775,8 +4801,8 @@ function renderBibGlobalBatchPanelGenerated($int_eve_id, $tabEpreuves, $strLangu -
'; - } echo $strGenerated; } ?> diff --git a/php/inc_settings.php b/php/inc_settings.php index f64d9e8..ab65353 100644 --- a/php/inc_settings.php +++ b/php/inc_settings.php @@ -7,7 +7,7 @@ * Constantes * * **************/ -define('_VERSION_CODE', '4.72.780'); +define('_VERSION_CODE', '4.72.781'); define('_DATE_CODE', '2026-07-09'); //MSIN-4290 define('QR_SECRET_KEY', 'ms1_qr_2026_cle_secrete_longue_et_fixe');