Implement quantity summary panel and global configuration settings for bib assignments (MSIN-4424)

This commit introduces a new AJAX action for retrieving a summary of quantities related to bib assignments, enhancing event management capabilities. A collapsible configuration panel is added for global settings, allowing users to manage bib assignment options more effectively. The CSS is updated to style the new elements, and relevant database entries are created to support the new features. The version code is incremented to 4.72.751 to reflect these changes.
This commit is contained in:
2026-07-08 10:26:52 -04:00
parent 70f4dac177
commit 5184544d6f
6 changed files with 590 additions and 42 deletions

View File

@ -920,6 +920,12 @@
icon.classList.toggle('fa-chevron-up', !collapsed);
icon.classList.toggle('fa-chevron-down', collapsed);
}
// MSIN-4424 — Sommaire quantités : chargement à la première ouverture.
if (!collapsed && block.id === 'bib-qty-summary-panel'
&& block.getAttribute('data-bib-qty-summary-deferred') === '1') {
refreshBibQtySummaryPanel();
}
});
// ============================================================
@ -1065,6 +1071,64 @@
});
}
/** MSIN-4424 — Rafraîchit le sommaire des quantités (si déjà chargé ou ouverture). */
function refreshBibQtySummaryPanel() {
let mount = document.getElementById('bib-qty-summary-mount');
if (!mount || !moduleBib) {
return;
}
let panel = document.getElementById('bib-qty-summary-panel');
let blnDeferred = panel && panel.getAttribute('data-bib-qty-summary-deferred') === '1';
let blnLoaded = panel && panel.getAttribute('data-bib-qty-summary-loaded') === '1';
if (!blnDeferred && !blnLoaded) {
return;
}
let eveId = moduleBib.dataset.eveId || '';
if (!eveId) {
return;
}
let blnWasExpanded = panel && !panel.classList.contains('is-collapsed');
bibFetch('/ajax_bib_range.php', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: 'action=qty_summary&eve_id=' + encodeURIComponent(eveId) + bibAjaxLangSuffix()
}, { loader: false })
.then(function (res) { return res.json(); })
.then(function (data) {
if (!data.success || !data.html) {
return;
}
mount.innerHTML = data.html;
initModuleBibTippy(mount);
if (blnWasExpanded) {
let newPanel = document.getElementById('bib-qty-summary-panel');
if (newPanel) {
newPanel.classList.remove('is-collapsed');
let btn = newPanel.querySelector('.epr-block-toggle');
if (btn) {
btn.setAttribute('aria-expanded', 'true');
let icon = btn.querySelector('.fa');
if (icon) {
icon.classList.remove('fa-chevron-down');
icon.classList.add('fa-chevron-up');
}
}
}
}
});
}
function bibQtySummaryShouldRefresh() {
let panel = document.getElementById('bib-qty-summary-panel');
return panel && panel.getAttribute('data-bib-qty-summary-loaded') === '1';
}
function setBibContainerHtml(row, html, opts) {
opts = opts || {};
let container = getBibContainer(row);
@ -1084,6 +1148,9 @@
if (!opts.skipAnomalies) {
refreshBibAnomaliesPanel();
}
if (!opts.skipQtySummary && bibQtySummaryShouldRefresh()) {
refreshBibQtySummaryPanel();
}
return container;
}
@ -2746,6 +2813,10 @@
mount.innerHTML = data.anomalies_html;
initModuleBibTippy(mount);
}
if (bibQtySummaryShouldRefresh()) {
refreshBibQtySummaryPanel();
}
})
.catch(function () {
chkAllowInterEpr.checked = !chkAllowInterEpr.checked;