MSIN-4467 — Implement new workspace architecture for bib management, including preparation, production, and operations sections. Update CSS for improved layout and styling of workspace elements. Increment version code to 4.72.843.
This commit is contained in:
@ -498,8 +498,54 @@
|
||||
|
||||
// MSIN-4440 — Grille outils : un panneau de détail, contenu déplacé depuis #bib-tool-store.
|
||||
var bibActiveTool = null;
|
||||
// MSIN-4467 — Espace principal : préparation, production, opérations ou réglages.
|
||||
var bibActiveWorkspace = 'preparation';
|
||||
var bibToolContentSlots = {};
|
||||
|
||||
function bibSetWorkspace(workspaceId, options) {
|
||||
options = options || {};
|
||||
if (!workspaceId) {
|
||||
return;
|
||||
}
|
||||
|
||||
var panel = moduleBib.querySelector('[data-bib-workspace-panel="' + workspaceId + '"]');
|
||||
if (!panel) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (options.keepTool !== true) {
|
||||
bibCloseTool();
|
||||
}
|
||||
|
||||
bibActiveWorkspace = workspaceId;
|
||||
moduleBib.querySelectorAll('.bib-workspace-tab').forEach(function (tab) {
|
||||
var active = tab.getAttribute('data-bib-workspace') === workspaceId;
|
||||
tab.classList.toggle('is-active', active);
|
||||
tab.setAttribute('aria-selected', active ? 'true' : 'false');
|
||||
});
|
||||
moduleBib.querySelectorAll('[data-bib-workspace-panel]').forEach(function (workspacePanel) {
|
||||
workspacePanel.classList.toggle(
|
||||
'bib-ui-hidden',
|
||||
workspacePanel.getAttribute('data-bib-workspace-panel') !== workspaceId
|
||||
);
|
||||
});
|
||||
|
||||
var races = document.getElementById('bib-preparation-races');
|
||||
if (races) {
|
||||
races.classList.toggle('bib-ui-hidden', workspaceId !== 'preparation');
|
||||
}
|
||||
}
|
||||
|
||||
function bibWorkspaceForTool(toolId) {
|
||||
if (toolId === 'event_config') {
|
||||
return 'settings';
|
||||
}
|
||||
if (toolId === 'anomalies' || toolId === 'dist_print') {
|
||||
return 'operations';
|
||||
}
|
||||
return 'preparation';
|
||||
}
|
||||
|
||||
function bibGetToolPanel(toolId) {
|
||||
return document.querySelector('#bib-tool-store [data-bib-tool="' + toolId + '"]');
|
||||
}
|
||||
@ -718,6 +764,11 @@
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
var workspaceId = bibWorkspaceForTool(toolId);
|
||||
if (bibActiveWorkspace !== workspaceId) {
|
||||
bibSetWorkspace(workspaceId, { keepTool: true });
|
||||
}
|
||||
|
||||
if (bibActiveTool === toolId) {
|
||||
bibCloseTool();
|
||||
return Promise.resolve();
|
||||
@ -1918,6 +1969,12 @@
|
||||
if (e.key !== 'Enter' && e.key !== ' ') {
|
||||
return;
|
||||
}
|
||||
var workspaceTab = e.target.closest('.bib-workspace-tab[role="tab"]');
|
||||
if (workspaceTab && moduleBib.contains(workspaceTab)) {
|
||||
e.preventDefault();
|
||||
bibSetWorkspace(workspaceTab.getAttribute('data-bib-workspace'));
|
||||
return;
|
||||
}
|
||||
var toolBtn = e.target.closest('.bib-tool-btn[role="button"]');
|
||||
if (!toolBtn || !moduleBib.contains(toolBtn)) {
|
||||
return;
|
||||
@ -1927,6 +1984,16 @@
|
||||
});
|
||||
|
||||
moduleBib.addEventListener('click', function (e) {
|
||||
var workspaceTab = e.target.closest('.bib-workspace-tab');
|
||||
if (workspaceTab && moduleBib.contains(workspaceTab)) {
|
||||
if (e.target.closest('.btn-aide-trad, .btn-trad-admin, .ms1-trad-link')) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
bibSetWorkspace(workspaceTab.getAttribute('data-bib-workspace'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.target.closest('.btn-global-batch-complete-reload')) {
|
||||
e.preventDefault();
|
||||
location.reload();
|
||||
@ -2124,22 +2191,71 @@
|
||||
return parseInt(row.dataset.bibAAssigner || '0', 10) || 0;
|
||||
}
|
||||
|
||||
function bibRefreshPreparationOverview() {
|
||||
var rows = Array.from(moduleBib.querySelectorAll('.epr-row[data-epr-id]'));
|
||||
var total = 0;
|
||||
var assigned = 0;
|
||||
var pending = 0;
|
||||
|
||||
rows.forEach(function (raceRow) {
|
||||
total += parseInt((raceRow.querySelector('.bib-race-summary-total') || {}).textContent || '0', 10) || 0;
|
||||
assigned += parseInt((raceRow.querySelector('.bib-race-summary-assigned') || {}).textContent || '0', 10) || 0;
|
||||
pending += parseInt((raceRow.querySelector('.bib-race-summary-pending') || {}).textContent || '0', 10) || 0;
|
||||
});
|
||||
|
||||
var values = {
|
||||
bib_v5_stat_races: rows.length,
|
||||
bib_v5_stat_registered: total,
|
||||
bib_v5_stat_assigned: assigned,
|
||||
bib_v5_stat_pending: pending
|
||||
};
|
||||
Object.keys(values).forEach(function (key) {
|
||||
var el = moduleBib.querySelector('[data-bib-overview-stat="' + key + '"]');
|
||||
if (el) {
|
||||
el.textContent = values[key];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function bibSyncRaceSummaryStatus(row) {
|
||||
if (!row) return;
|
||||
var pendingEl = row.querySelector('.bib-race-summary-pending');
|
||||
var rangesEl = row.querySelector('.bib-race-summary-ranges');
|
||||
var statusEl = row.querySelector('.bib-race-summary__status');
|
||||
var pending = parseInt(pendingEl ? pendingEl.textContent : '0', 10) || 0;
|
||||
var ranges = parseInt(rangesEl ? rangesEl.textContent : '0', 10) || 0;
|
||||
var ready = pending === 0 && ranges > 0;
|
||||
|
||||
if (statusEl) {
|
||||
statusEl.classList.toggle('is-ready', ready);
|
||||
statusEl.textContent = statusEl.getAttribute(ready ? 'data-label-ready' : 'data-label-incomplete') || '';
|
||||
}
|
||||
bibRefreshPreparationOverview();
|
||||
}
|
||||
|
||||
function bibSyncEprBibStats(row, info) {
|
||||
if (!row || !info) return;
|
||||
|
||||
if (info.total !== undefined) {
|
||||
let totalEl = row.querySelector('.bib-total');
|
||||
if (totalEl) totalEl.textContent = info.total;
|
||||
let summaryTotal = row.querySelector('.bib-race-summary-total');
|
||||
if (summaryTotal) summaryTotal.textContent = info.total;
|
||||
}
|
||||
if (info.avec_bib !== undefined) {
|
||||
let avecEl = row.querySelector('.bib-avec');
|
||||
if (avecEl) avecEl.textContent = info.avec_bib;
|
||||
let summaryAssigned = row.querySelector('.bib-race-summary-assigned');
|
||||
if (summaryAssigned) summaryAssigned.textContent = info.avec_bib;
|
||||
}
|
||||
|
||||
let pending = (info.a_assigner !== undefined && info.a_assigner !== null)
|
||||
? info.a_assigner
|
||||
: (info.sans_bib || 0);
|
||||
row.dataset.bibAAssigner = String(parseInt(pending, 10) || 0);
|
||||
let summaryPending = row.querySelector('.bib-race-summary-pending');
|
||||
if (summaryPending) summaryPending.textContent = parseInt(pending, 10) || 0;
|
||||
bibSyncRaceSummaryStatus(row);
|
||||
}
|
||||
|
||||
function bibAlertAutoPendingBibs(row) {
|
||||
@ -2267,6 +2383,45 @@
|
||||
}
|
||||
|
||||
// MSIN-4379 — Réduire / développer les blocs gestion, assignation et sections anomalies.
|
||||
function bibSetRaceRowExpanded(row, expanded) {
|
||||
if (!row) {
|
||||
return;
|
||||
}
|
||||
row.classList.toggle('is-expanded', expanded);
|
||||
var summary = row.querySelector('.bib-race-summary');
|
||||
var button = row.querySelector('.bib-race-toggle');
|
||||
if (summary) {
|
||||
summary.setAttribute('aria-expanded', expanded ? 'true' : 'false');
|
||||
}
|
||||
if (button) {
|
||||
var label = button.getAttribute(expanded ? 'data-label-collapse' : 'data-label-expand') || '';
|
||||
if (label) {
|
||||
button.setAttribute('aria-label', label);
|
||||
button.setAttribute('title', label);
|
||||
}
|
||||
var icon = button.querySelector('.fa');
|
||||
if (icon) {
|
||||
icon.classList.toggle('fa-chevron-up', expanded);
|
||||
icon.classList.toggle('fa-chevron-down', !expanded);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function bibToggleRaceRow(row) {
|
||||
if (!row) {
|
||||
return;
|
||||
}
|
||||
var willExpand = !row.classList.contains('is-expanded');
|
||||
if (willExpand) {
|
||||
moduleBib.querySelectorAll('.epr-row.is-expanded').forEach(function (otherRow) {
|
||||
if (otherRow !== row) {
|
||||
bibSetRaceRowExpanded(otherRow, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
bibSetRaceRowExpanded(row, willExpand);
|
||||
}
|
||||
|
||||
function bibToggleCollapsibleBlock(block, btnToggle) {
|
||||
if (!block || !btnToggle) {
|
||||
return;
|
||||
@ -2341,6 +2496,16 @@
|
||||
return;
|
||||
}
|
||||
|
||||
let raceSummary = e.target.closest('.bib-race-summary');
|
||||
if (raceSummary && moduleBib.contains(raceSummary)) {
|
||||
if (e.target.closest('a, input, select, textarea, button:not(.bib-race-toggle)')) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
bibToggleRaceRow(raceSummary.closest('.epr-row'));
|
||||
return;
|
||||
}
|
||||
|
||||
let anomalyHdr = e.target.closest('.bib-anomaly-block-header');
|
||||
if (anomalyHdr && moduleBib.contains(anomalyHdr) && !e.target.closest('.epr-block-toggle')) {
|
||||
e.preventDefault();
|
||||
@ -2407,6 +2572,16 @@
|
||||
return;
|
||||
}
|
||||
|
||||
let raceSummary = e.target.closest('.bib-race-summary');
|
||||
if (raceSummary && moduleBib.contains(raceSummary)) {
|
||||
if (e.target !== raceSummary && !e.target.closest('.bib-race-toggle')) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
bibToggleRaceRow(raceSummary.closest('.epr-row'));
|
||||
return;
|
||||
}
|
||||
|
||||
let globalBatchHdr = e.target.closest('.bib-global-batch__section-header');
|
||||
if (globalBatchHdr && moduleBib.contains(globalBatchHdr)) {
|
||||
e.preventDefault();
|
||||
@ -2527,6 +2702,19 @@
|
||||
}
|
||||
if (el) {
|
||||
el.classList.toggle('bib-ui-hidden', !show);
|
||||
if (el.classList.contains('epr-action-reset-group')) {
|
||||
let advanced = el.closest('.bib-advanced-actions');
|
||||
if (advanced) {
|
||||
advanced.classList.toggle('bib-ui-hidden', !show);
|
||||
}
|
||||
}
|
||||
if (el.classList.contains('epr-action-batch-group')
|
||||
|| el.classList.contains('epr-action-auto-group')) {
|
||||
let method = el.closest('.bib-assignment-method');
|
||||
if (method) {
|
||||
method.classList.toggle('bib-ui-hidden', !show);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2598,6 +2786,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
bibSetWorkspace(bibWorkspaceForTool(toolId), { keepTool: true });
|
||||
bibOpenTool(toolId).then(function () {
|
||||
let detail = document.getElementById('bib-tool-detail');
|
||||
if (detail) {
|
||||
@ -2799,6 +2988,19 @@
|
||||
summaries.innerHTML = opts.summaryHtml;
|
||||
}
|
||||
}
|
||||
if (typeof opts.seqCount !== 'undefined') {
|
||||
let summaryRanges = row.querySelector('.bib-race-summary-ranges');
|
||||
if (summaryRanges) {
|
||||
summaryRanges.textContent = parseInt(opts.seqCount, 10) || 0;
|
||||
}
|
||||
let productionRanges = moduleBib.querySelector(
|
||||
'.bib-production-category[data-epr-id="' + row.dataset.eprId + '"] .bib-production-range-count'
|
||||
);
|
||||
if (productionRanges) {
|
||||
productionRanges.textContent = parseInt(opts.seqCount, 10) || 0;
|
||||
}
|
||||
bibSyncRaceSummaryStatus(row);
|
||||
}
|
||||
if (typeof opts.autoActive !== 'undefined') {
|
||||
let blnAuto = !!opts.autoActive && opts.autoActive !== '0' && opts.autoActive !== 0;
|
||||
row.dataset.autoActive = blnAuto ? '1' : '0';
|
||||
@ -2824,6 +3026,9 @@
|
||||
if (data && data.summary_html != null) {
|
||||
opts.summaryHtml = data.summary_html;
|
||||
}
|
||||
if (data && typeof data.seq_count !== 'undefined') {
|
||||
opts.seqCount = data.seq_count;
|
||||
}
|
||||
if (data && typeof data.auto_active !== 'undefined') {
|
||||
opts.autoActive = data.auto_active;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user