Implement contextual return functionality for bib management and enhance UI interactions
This commit introduces several enhancements related to the bib management system, specifically focusing on contextual return paths from various panels. New functions are added to encode and decode return URLs, allowing users to navigate back to specific sections (e.g., anomalies, quantity summary) seamlessly. Additionally, JavaScript functions are updated to manage UI interactions, such as expanding panels based on URL parameters. The overall user experience is improved by ensuring that the correct panels are focused and displayed upon return. This change is part of the ongoing efforts to enhance the bib assignment management system (MSIN-4436).
This commit is contained in:
@ -1072,19 +1072,84 @@
|
||||
return row.querySelectorAll('.batch-select-range:checked').length;
|
||||
}
|
||||
|
||||
/** MSIN-4436 — Développe un bloc repliable #module-bib. */
|
||||
function bibExpandBlock(block) {
|
||||
if (!block || !block.classList.contains('is-collapsed')) {
|
||||
return;
|
||||
}
|
||||
|
||||
block.classList.remove('is-collapsed');
|
||||
let btn = block.querySelector('.epr-block-toggle');
|
||||
if (btn) {
|
||||
btn.setAttribute('aria-expanded', 'true');
|
||||
let label = btn.getAttribute('data-label-collapse') || '';
|
||||
if (label) {
|
||||
btn.setAttribute('aria-label', label);
|
||||
btn.setAttribute('title', label);
|
||||
}
|
||||
let icon = btn.querySelector('.fa');
|
||||
if (icon) {
|
||||
icon.classList.add('fa-chevron-up');
|
||||
icon.classList.remove('fa-chevron-down');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let bibFocusApplied = false;
|
||||
|
||||
/** MSIN-4436 — Retour depuis fiche inscription : rouvrir le panneau ciblé. */
|
||||
function bibApplyFocusFromUrlOnce() {
|
||||
if (bibFocusApplied) {
|
||||
return;
|
||||
}
|
||||
|
||||
let focus = new URLSearchParams(window.location.search).get('bib_focus');
|
||||
if (!focus) {
|
||||
return;
|
||||
}
|
||||
|
||||
bibFocusApplied = true;
|
||||
|
||||
let panelId = null;
|
||||
if (focus === 'anomalies') {
|
||||
panelId = 'bib-anomalies-panel';
|
||||
} else if (focus === 'qty_summary') {
|
||||
panelId = 'bib-qty-summary-panel';
|
||||
} else if (focus === 'event_config') {
|
||||
panelId = 'bib-event-config-panel';
|
||||
}
|
||||
|
||||
if (!panelId) {
|
||||
return;
|
||||
}
|
||||
|
||||
let panel = document.getElementById(panelId);
|
||||
if (!panel) {
|
||||
return;
|
||||
}
|
||||
|
||||
bibExpandBlock(panel);
|
||||
|
||||
if (focus === 'qty_summary' && panel.getAttribute('data-bib-qty-summary-deferred') === '1') {
|
||||
refreshBibQtySummaryPanel();
|
||||
}
|
||||
|
||||
panel.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||
}
|
||||
|
||||
/** MSIN-4379 — Rafraîchit le dashboard anomalies (chien de garde). */
|
||||
function refreshBibAnomaliesPanel() {
|
||||
let mount = document.getElementById('bib-anomalies-mount');
|
||||
if (!mount || !moduleBib) {
|
||||
return;
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
let eveId = moduleBib.dataset.eveId || '';
|
||||
if (!eveId) {
|
||||
return;
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
bibFetch('/ajax_bib_range.php', {
|
||||
return bibFetch('/ajax_bib_range.php', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
@ -2868,7 +2933,11 @@
|
||||
|
||||
// MSIN-4436 — Anomalies : coquille légère au chargement, détail en AJAX.
|
||||
if (document.querySelector('#bib-anomalies-panel[data-bib-anomalies-deferred="1"]')) {
|
||||
refreshBibAnomaliesPanel();
|
||||
refreshBibAnomaliesPanel().then(function () {
|
||||
bibApplyFocusFromUrlOnce();
|
||||
});
|
||||
} else {
|
||||
bibApplyFocusFromUrlOnce();
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user