diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..b007321 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,25 @@ +{ + "sqltools.connections": [ + { + "mysqlOptions": { + "authProtocol": "default", + "enableSsl": "Disabled" + }, + "ssh": "Enabled", + "previewLimit": 50, + "server": "localhost", + "port": 3306, + "sshOptions": { + "port": 7822, + "host": "104.254.182.111", + "username": "devinscription", + "password": "M-G7+[NdA34H" + }, + "driver": "MariaDB", + "name": "astral(dev) ms1inscription", + "username": "devinscription_bd", + "password": "x$@_v0-l_I((", + "database": "devinscription_preprod" + } + ] +} \ No newline at end of file diff --git a/ajax_bib_range.php b/ajax_bib_range.php index 7a2e7a4..60fba08 100644 --- a/ajax_bib_range.php +++ b/ajax_bib_range.php @@ -394,7 +394,7 @@ if ($action == 'batch_go') { $nextBib = fxGetNextAvailableBib($epr_id, $tabRanges); $simu = fxProcessBatchAssignments($epr_id, $participants, $tabRanges, 'simulation'); - $summary = fxBuildBatchSummaryFromRanges($tabRangesInfos, $participants); + $summary = fxBuildBatchSummaryFromRanges($tabRangesInfos, $participants, $epr_id); $info = "{$summary['nb_dispo']} disponibles / {$summary['nb_participants']} à assigner → manque {$summary['nb_manque']}"; // ===================== @@ -451,7 +451,7 @@ if ($action == 'batch_apply') { return in_array((int)$r['epr_bib_id'], $ids); }); - $summary = fxBuildBatchSummaryFromRanges($tabRangesInfos, $participants); + $summary = fxBuildBatchSummaryFromRanges($tabRangesInfos, $participants, $epr_id); $assigned = count($exec); $total = count($participants); diff --git a/inc_footer_scripts.php b/inc_footer_scripts.php index 9c876dd..62c64ec 100644 --- a/inc_footer_scripts.php +++ b/inc_footer_scripts.php @@ -2039,7 +2039,12 @@ if ($strLangue == 'fr') { if (totalEl) totalEl.textContent = data.info.total; if (avecEl) avecEl.textContent = data.info.avec_bib; syncBibUiState(row); - let sansBib = parseInt(data.info.sans_bib || 0, 10); + let sansBib = parseInt( + (data.info.a_assigner !== undefined && data.info.a_assigner !== null) + ? data.info.a_assigner + : (data.info.sans_bib || 0), + 10 + ); if (isNaN(sansBib)) sansBib = 0; let isResetMode = row.dataset.mode === 'reset'; let message = ''; @@ -2332,6 +2337,23 @@ if ($strLangue == 'fr') { let container = btnView.closest('.epr-block'); + // Vérifier si une vue est déjà ouverte + let existing = document.querySelector('.epr-row-view'); + + // Toggle : si c'est le même œil qui a ouvert la vue, on la ferme et on s'arrête + if (existing + && existing.dataset.eprId === epr_id + && existing.dataset.rangeId === range_id + ) { + existing.remove(); + return; + } + + // Un autre œil a été cliqué : fermer la vue précédente avant d'ouvrir la nouvelle + if (existing) { + existing.remove(); + } + fetch('/ajax_bib_range.php', { method: 'POST', headers: { @@ -2360,14 +2382,17 @@ if ($strLangue == 'fr') { let row = btnView.closest('.epr-row'); -// 1. Supprimer toute vue existante - let existing = document.querySelector('.epr-row-view'); - if (existing) { - existing.remove(); - } - -// 2. Injecter sous la bonne ligne + // Injecter la nouvelle vue sous la ligne du bouton cliqué, + // en mémorisant epr_id et range_id pour le toggle suivant row.insertAdjacentHTML('afterend', data.html); + + // Stocker les identifiants sur la vue injectée pour pouvoir détecter + // le 2e clic sur le même œil + let newView = row.nextElementSibling; + if (newView && newView.classList.contains('epr-row-view')) { + newView.dataset.eprId = epr_id; + newView.dataset.rangeId = range_id; + } }); return; diff --git a/php/inc_fx_promoteur.php b/php/inc_fx_promoteur.php index de7fa5a..40886f0 100644 --- a/php/inc_fx_promoteur.php +++ b/php/inc_fx_promoteur.php @@ -2550,8 +2550,8 @@ function fxUpdateQuantites($intEpreuve, $intQuantite, $strLangue) { } -// v2 -function renderBatchConfig($tabBibAssignments, $strLangue = 'fr') { +// v2 — options d'ordre batch (table bib_assignements) +function renderBatchConfig($tabBibAssignments, $strLangue = 'fr', $isTeamEpreuve = false) { ob_start(); ?> @@ -2562,7 +2562,13 @@ function renderBatchConfig($tabBibAssignments, $strLangue = 'fr') {