From 2fb6db9bd481c93dd533d149ad963668006fe617 Mon Sep 17 00:00:00 2001 From: stephan Date: Thu, 18 Jun 2026 09:33:26 -0400 Subject: [PATCH] Remove unused auto badge visibility logic and introduce new badge rendering function for active sequences This commit eliminates the visibility logic for the auto badge in the footer scripts, streamlining the code. Additionally, a new function, fxBibRenderRangeAutoBadge, is introduced to render the auto badge for active sequences, enhancing the display of sequence information. CSS styles are also added for the new badge, improving the visual presentation in the interface. No version code change is included in this update. --- css/style.css | 23 +++++++++++++++++++++++ inc_footer_scripts.php | 3 --- php/inc_fx_promoteur.php | 38 ++++++++++++++++++++++++++------------ 3 files changed, 49 insertions(+), 15 deletions(-) diff --git a/css/style.css b/css/style.css index 8b2ed53..a26bdc5 100644 --- a/css/style.css +++ b/css/style.css @@ -1549,6 +1549,25 @@ ul.ms1-menu-compte li a:hover, ul.ms1-menu-compte li a:active { color:#fff; } +.badge-bib-auto-seq{ + background-color:#28a745; + border:1px solid #218838; + color:#fff; + font-size:10px; + font-weight:600; + line-height:1.2; + padding:0.35em 0.5em; + white-space:nowrap; +} + +.bib-auto-badge--row{ + display:inline-block; +} + +.bib-container.batch-mode .bib-auto-badge--row{ + display:none; +} + .btn-bib-auto + .btn-aide-bib, .btn-aide-tone-auto, .btn-auto.btn-bib-auto + .btn-aide-bib{ @@ -1861,6 +1880,10 @@ a.ms1-trad-link.btn-aide-trad{ .epr-col-batch{ overflow:hidden; min-width:0; + display:flex; + align-items:center; + justify-content:center; + gap:4px; } .epr-line .btn-view-range{ diff --git a/inc_footer_scripts.php b/inc_footer_scripts.php index 0b3f01d..8b55227 100644 --- a/inc_footer_scripts.php +++ b/inc_footer_scripts.php @@ -2185,7 +2185,6 @@ if ($strLangue == 'fr') { } } - bibSetVisible('.epr-auto-badge-wrap', isActive, row); bibSetVisible('.epr-action-desactiver-group', isActive, row); } @@ -2300,8 +2299,6 @@ if ($strLangue == 'fr') { if (hasSequences) { syncAutoUiState(row, row.dataset.autoActive === '1'); - } else { - bibSetVisible('.epr-auto-badge-wrap', false, row); } bibSetVisible('.epr-add-range-row', !inAssignFlow && !modes.auto, row); diff --git a/php/inc_fx_promoteur.php b/php/inc_fx_promoteur.php index d2cb64e..cbae1a9 100644 --- a/php/inc_fx_promoteur.php +++ b/php/inc_fx_promoteur.php @@ -3037,8 +3037,8 @@ function fxBibGestionHeaderSummary($epr_id) { return fxBibHeaderSummaryBadge($strLabel . ' : ' . $intDispo, 'dispo'); } -/** Résumé assignation : nombre de séquences (+ auto si actif). */ -function fxBibAssignHeaderSummary($intSeqCount, $blnAutoActive = false) { +/** Résumé assignation : nombre de séquences. */ +function fxBibAssignHeaderSummary($intSeqCount) { $html = ''; $intSeqCount = (int)$intSeqCount; if ($intSeqCount > 0) { @@ -3051,12 +3051,28 @@ function fxBibAssignHeaderSummary($intSeqCount, $blnAutoActive = false) { } else { $html .= fxBibHeaderSummaryBadge(fxBibTexte('bib_v4_summary_seq_empty', 0), 'seq-empty'); } - if ($blnAutoActive) { - $html .= fxBibHeaderSummaryBadge(fxBibTexte('bib_v4_auto_badge', 0), 'auto'); - } return $html; } +/** Badge « Auto actif » sur une ligne de séquence (epr_bib_auto = 1). */ +function fxBibRenderRangeAutoBadge(array $range, $mode = 'assign') { + if ($mode !== 'assign') { + return ''; + } + if ((int)($range['epr_bib_id'] ?? 0) <= 0) { + return ''; + } + if ((int)($range['epr_bib_auto'] ?? 0) !== 1) { + return ''; + } + + return '' + . fxBibEsc(fxBibTexte('bib_v4_auto_badge', 0)) + . ''; +} + /** Pastilles épreuve (solo/équipe, inscrits, avec dossard) — bande bleue colonne gauche. */ function fxBibEpreuveHeaderSummaries($tabEpreuve, $infoBib) { $html = ''; @@ -3311,12 +3327,6 @@ function renderBibAssignActions($tabBibAssignments, $strLangue, $infoBib, $blnAu - - - - - - @@ -3515,7 +3525,7 @@ if ($teamMode <= 0) {
- +
@@ -4099,6 +4109,9 @@ $mem_dispo = max(0, $nb_total - $nb_utilises);
+
+ +
+