Implement reset all apply functionality for epreuve and update version code to 4.72.747

This commit introduces a new action, `reset_all_apply`, in the AJAX handler to reset all bib numbers for participants in a specified epreuve. It includes validation for locked ranges and updates the database accordingly. Additionally, new CSS styles are added for the reset button, and JavaScript functions are implemented to manage the button's state based on participant conditions. The version code is incremented to reflect these changes.
This commit is contained in:
2026-07-08 09:57:49 -04:00
parent 4cf2ef98d0
commit c2972aa015
6 changed files with 296 additions and 1 deletions

View File

@ -1544,6 +1544,33 @@
});
}
function bibSyncResetAllEprButton(row) {
if (!row) {
return;
}
let wrap = row.querySelector('.epr-identity-reset-all');
if (!wrap) {
return;
}
let avecBib = parseInt(bibQuery(row, '.bib-avec')?.textContent || '0', 10) || 0;
if (avecBib <= 0) {
wrap.classList.add('bib-ui-hidden');
return;
}
wrap.classList.remove('bib-ui-hidden');
let btn = wrap.querySelector('.btn-reset-all-epr');
if (!btn) {
return;
}
let hasLock = row.querySelector('.btn-bib-lock--closed') !== null;
btn.disabled = hasLock;
}
function syncBibUiState(row) {
if (!row) return;
@ -1599,6 +1626,7 @@
bibSetVisible('.epr-batch-order-wrap', showBatchReady && !modes.reset, row);
bibSetVisible('.epr-action-sim-group', showBatchReady && !modes.reset, row);
bibSetVisible('.epr-action-go-group', showBatchReady, row);
bibSyncResetAllEprButton(row);
}
function updateBatchAnalysis(row) {
@ -1903,12 +1931,65 @@
if (data.html) {
setBibContainerHtml(row, data.html);
bibSyncResetAllEprButton(row);
}
});
return;
}
// =====================
// MSIN-4436 — Réinitialiser tous les dossards (épreuve entière)
// =====================
let btnResetAllEpr = e.target.closest('.btn-reset-all-epr');
if (btnResetAllEpr) {
e.preventDefault();
let row = btnResetAllEpr.closest('.epr-row');
if (!row) {
return;
}
if (btnResetAllEpr.disabled) {
alert(bibJsConfirm('jsResetAllLocked'));
return;
}
if (row.querySelector('.btn-bib-lock--closed')) {
alert(bibJsConfirm('jsResetAllLocked'));
bibSyncResetAllEprButton(row);
return;
}
if (!confirm(bibJsConfirm('jsResetAllConfirm'))) {
return;
}
bibFetch('/ajax_bib_range.php', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body:
'action=reset_all_apply'
+ '&epr_id=' + encodeURIComponent(row.dataset.eprId)
+ bibAjaxLangSuffix()
})
.then(res => res.json())
.then(data => {
if (!data.success) {
alert(data.message || bibJs('jsErrGeneric'));
return;
}
bibAfterBatchGoSuccess(row, data, false);
});
return;
}
// =====================
// DELETE
// =====================