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.
This commit is contained in:
2026-06-18 09:33:26 -04:00
parent d0db73624e
commit 2fb6db9bd4
3 changed files with 49 additions and 15 deletions

View File

@ -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{

View File

@ -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);

View File

@ -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 '<span class="bib-auto-badge bib-auto-badge--row badge badge-bib-auto-seq"'
. fxBibTippyAttr('bib_v4_auto_badge')
. '>'
. fxBibEsc(fxBibTexte('bib_v4_auto_badge', 0))
. '</span>';
}
/** 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
</button>
<?php echo fxBibAideButton('bib_v4_auto', 'auto', false); ?>
<?php echo fxBibBtnAideSegmentClose('bib_v4_auto'); ?>
<?php echo fxBibActionGroupOpen('epr-auto-badge-wrap ml-1', $blnAutoActive); ?>
<?php echo fxBibBtnAideSegmentOpen('epr-btn-aide-segment--badge'); ?>
<span class="bib-auto-badge badge badge-bib-auto"><?php fxBibTexte('bib_v4_auto_badge', 1); ?></span>
<?php echo fxBibAideButton('bib_v4_auto_badge', 'auto', false); ?>
<?php echo fxBibBtnAideSegmentClose('bib_v4_auto_badge'); ?>
<?php echo fxBibActionGroupClose(); ?>
<?php echo fxBibActionGroupClose(); ?>
</div>
@ -3515,7 +3525,7 @@ if ($teamMode <= 0) {
<div class="epr-header-start">
<?php echo fxBibBlockHeader('bib_v4_assign_title', 'bib_v4_assign_doc'); ?>
<span class="epr-header-summaries">
<?php echo fxBibAssignHeaderSummary(count($tabBibStats), $blnAutoActive); ?>
<?php echo fxBibAssignHeaderSummary(count($tabBibStats)); ?>
</span>
</div>
<?php echo fxBibBlockCollapseToggle($strLangue, true); ?>
@ -4099,6 +4109,9 @@ $mem_dispo = max(0, $nb_total - $nb_utilises);
<div class="bib-dispo" data-dispo="<?php echo $mem_dispo; ?>"><?php echo $mem_dispo; ?></div>
</div>
<div class="epr-col-batch">
<?php echo fxBibRenderRangeAutoBadge($range, $mode); ?>
<div class="batch-checkbox" style="text-align:center;">
<?php
@ -4140,6 +4153,7 @@ if (
<?php } ?>
</div>
</div>
</div>