IMSIN-4425mplement quantity management enhancements in bib assignments and increment version code to 4.72.740
This commit introduces new JavaScript functions for managing quantity data in the bib assignments, including `bibApplyQteData` for updating UI elements and `bibSaveQte` for handling quantity submissions via AJAX. Additionally, the PHP file is updated to render a new panel for anomalies, improving the overall functionality and user experience. The version code is incremented to reflect these changes, ensuring proper versioning in the application.
This commit is contained in:
@ -679,6 +679,114 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
// MSIN-4379 — Mise à jour affichage quantités (panneau gestion + pastille en-tête).
|
||||
function bibApplyQteData(data) {
|
||||
if (!data || typeof data !== 'object') {
|
||||
return;
|
||||
}
|
||||
|
||||
Object.keys(data).forEach(function (eprId) {
|
||||
if (eprId === 'total') {
|
||||
return;
|
||||
}
|
||||
|
||||
let row = data[eprId];
|
||||
if (!row) {
|
||||
return;
|
||||
}
|
||||
|
||||
let elOrigine = document.getElementById('qte_origine_' + eprId);
|
||||
let elAjustement = document.getElementById('qte_ajustement_' + eprId);
|
||||
let elCourante = document.getElementById('qte_courante_' + eprId);
|
||||
let elInscrits = document.getElementById('qte_inscrits_' + eprId);
|
||||
let elCheckin = document.getElementById('qte_checkin_' + eprId);
|
||||
let elRestante = document.getElementById('qte_restante_' + eprId);
|
||||
|
||||
if (elOrigine) {
|
||||
elOrigine.textContent = row.qte_origine;
|
||||
}
|
||||
if (elAjustement) {
|
||||
elAjustement.textContent = row.qte_ajustement;
|
||||
}
|
||||
if (elCourante) {
|
||||
elCourante.textContent = row.qte_courante;
|
||||
}
|
||||
if (elInscrits) {
|
||||
elInscrits.textContent = row.qte_inscrits;
|
||||
}
|
||||
if (elCheckin) {
|
||||
elCheckin.textContent = row.qte_checkin;
|
||||
}
|
||||
if (elRestante) {
|
||||
elRestante.value = row.qte_restante;
|
||||
}
|
||||
|
||||
let dispoBadge = document.querySelector(
|
||||
'.epr-row[data-epr-id="' + eprId + '"] .epr-header-summary--dispo'
|
||||
);
|
||||
if (dispoBadge && row.qte_restante !== undefined) {
|
||||
let labelParts = dispoBadge.textContent.split(':');
|
||||
let label = labelParts.length > 1 ? labelParts[0].trim() : '';
|
||||
dispoBadge.textContent = label + ' : ' + row.qte_restante;
|
||||
}
|
||||
|
||||
let btnQte = document.querySelector(
|
||||
'.epr-gestion-panel[data-epr-id="' + eprId + '"] .btn_qte'
|
||||
);
|
||||
if (btnQte) {
|
||||
btnQte.setAttribute('data-qte_initiale', row.qte_restante);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function bibSaveQte(btn) {
|
||||
let eprId = btn.getAttribute('data-epr_id');
|
||||
if (!eprId) {
|
||||
return;
|
||||
}
|
||||
|
||||
let input = document.getElementById('qte_restante_' + eprId);
|
||||
if (!input) {
|
||||
return;
|
||||
}
|
||||
|
||||
let intQte = parseInt(input.value, 10);
|
||||
if (isNaN(intQte) || intQte < 0) {
|
||||
alert(bibJs('err-generic'));
|
||||
return;
|
||||
}
|
||||
|
||||
bibLoaderShow();
|
||||
fetch('/ajax_promoteur.php', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
credentials: 'same-origin',
|
||||
body:
|
||||
'a=qte'
|
||||
+ '&epr_id=' + encodeURIComponent(eprId)
|
||||
+ '&qte=' + encodeURIComponent(intQte)
|
||||
+ '&lang=' + encodeURIComponent(moduleBib.dataset.lang || 'fr')
|
||||
})
|
||||
.then(function (res) {
|
||||
return res.json();
|
||||
})
|
||||
.then(function (result) {
|
||||
if (result && result.state === 'success' && result.data) {
|
||||
bibApplyQteData(result.data);
|
||||
return;
|
||||
}
|
||||
alert(bibJs('err-generic'));
|
||||
})
|
||||
.catch(function () {
|
||||
alert(bibJs('server-error'));
|
||||
})
|
||||
.finally(function () {
|
||||
bibLoaderHide();
|
||||
});
|
||||
}
|
||||
|
||||
// MSIN-4379 — Réduire / développer les blocs gestion et assignation (en-tête seul visible).
|
||||
moduleBib.addEventListener('click', function (e) {
|
||||
let btnToggle = e.target.closest('.epr-block-toggle');
|
||||
@ -1590,6 +1698,13 @@
|
||||
|
||||
moduleBib.addEventListener('click', function (e) {
|
||||
|
||||
let btnQte = e.target.closest('.btn_qte');
|
||||
if (btnQte && moduleBib.contains(btnQte)) {
|
||||
e.preventDefault();
|
||||
bibSaveQte(btnQte);
|
||||
return;
|
||||
}
|
||||
|
||||
let btnGotoAssign = e.target.closest('.bib-anomaly-goto-assign');
|
||||
if (btnGotoAssign) {
|
||||
e.preventDefault();
|
||||
|
||||
@ -4052,7 +4052,7 @@ function fxShowBibTool4($str_code, $int_eve_id, $strLangue){
|
||||
<div id="module-bib" class="epr-wrapper" data-csrf-token="<?php echo fxBibEsc(fxBibCsrfToken()); ?>" data-lang="<?php echo fxBibEsc($strLangue); ?>" data-eve-id="<?php echo (int)$int_eve_id; ?>"<?php echo fxBibModuleJsDataAttrs(); ?><?php echo fxAdminTextEditModeActive() ? ' data-bib-trad="1"' : ''; ?>>
|
||||
|
||||
<div id="bib-anomalies-mount">
|
||||
<?php echo renderBibAnomaliesPanel((int)$int_eve_id, $strLangue); ?>
|
||||
<?php echo renderBibAnomaliesPanelShell((int)$int_eve_id, $strLangue); ?>
|
||||
</div>
|
||||
|
||||
<?php echo renderBibGlobalBatchPanel((int)$int_eve_id, $tabEpreuves, $tabBibAssignments, $strLangue); ?>
|
||||
@ -4264,18 +4264,29 @@ function fxBibSqlIsBibDuplicateAnomaly($strEprIdExpr, $strBibNumExpr) {
|
||||
function fxInfosBibRange($epr_id = 0, $epr_bib_id = 0){
|
||||
global $objDatabase, $vDomaine;
|
||||
|
||||
$where = [];
|
||||
static $memCache = [];
|
||||
|
||||
if ((int)$epr_id > 0) {
|
||||
$where[] = "b.epr_id = " . intval($epr_id);
|
||||
$epr_id = (int)$epr_id;
|
||||
$epr_bib_id = (int)$epr_bib_id;
|
||||
$strCacheKey = $epr_id . ':' . $epr_bib_id;
|
||||
|
||||
if (array_key_exists($strCacheKey, $memCache)) {
|
||||
return $memCache[$strCacheKey];
|
||||
}
|
||||
|
||||
if ((int)$epr_bib_id > 0) {
|
||||
$where[] = "b.epr_bib_id = " . intval($epr_bib_id);
|
||||
$where = [];
|
||||
|
||||
if ($epr_id > 0) {
|
||||
$where[] = "b.epr_id = " . $epr_id;
|
||||
}
|
||||
|
||||
if ($epr_bib_id > 0) {
|
||||
$where[] = "b.epr_bib_id = " . $epr_bib_id;
|
||||
}
|
||||
|
||||
if (empty($where)) {
|
||||
return [];
|
||||
$memCache[$strCacheKey] = [];
|
||||
return $memCache[$strCacheKey];
|
||||
}
|
||||
|
||||
$where_sql = implode(' AND ', $where);
|
||||
@ -4394,7 +4405,10 @@ function fxInfosBibRange($epr_id = 0, $epr_bib_id = 0){
|
||||
ORDER BY b.epr_bib_start
|
||||
";
|
||||
|
||||
return $objDatabase->fxGetResults($sqlBibStats);
|
||||
$tabResult = $objDatabase->fxGetResults($sqlBibStats);
|
||||
$memCache[$strCacheKey] = is_array($tabResult) ? $tabResult : [];
|
||||
|
||||
return $memCache[$strCacheKey];
|
||||
}
|
||||
|
||||
/** MSIN-4379 — Libellé court épreuve pour le dashboard anomalies. */
|
||||
@ -4817,6 +4831,49 @@ function fxBibAnomalyTotalCount(array $tabAnomalies) {
|
||||
return $intTotal;
|
||||
}
|
||||
|
||||
/**
|
||||
* MSIN-4436 — Coquille anomalies au chargement page (détail via AJAX).
|
||||
* Évite 4 requêtes lourdes avant le premier affichage des épreuves.
|
||||
*/
|
||||
function renderBibAnomaliesPanelShell($int_eve_id, $strLangue = 'fr') {
|
||||
global $vDomaine;
|
||||
|
||||
$int_eve_id = (int)$int_eve_id;
|
||||
$strWait = fxBibTexte('bib_v4_js_loader_wait', 0);
|
||||
if ($strWait === '' || $strWait === 'bib_v4_js_loader_wait') {
|
||||
$strWait = ($strLangue === 'en') ? 'Loading...' : 'Chargement...';
|
||||
}
|
||||
$strRunnerSrc = $vDomaine . '/images/ms1-runner-loader.gif?v=' . _VERSION_CODE;
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
<div id="bib-anomalies-panel"
|
||||
class="bib-anomalies-panel epr-block is-collapsed"
|
||||
data-eve-id="<?php echo $int_eve_id; ?>"
|
||||
data-bib-anomalies-deferred="1">
|
||||
<div class="epr-header bib-anomalies-header">
|
||||
<span class="epr-header-label bib-anomalies-header-label">
|
||||
<?php echo fxBibEsc(fxBibTexte('bib_v4_anomalies_title', 0)); ?>
|
||||
<?php echo fxBibAideButton('bib_v4_anomalies_title'); ?>
|
||||
<span class="bib-anomalies-count badge badge-secondary" aria-busy="true">…</span>
|
||||
</span>
|
||||
<?php echo fxBibBlockCollapseToggle($strLangue, true); ?>
|
||||
</div>
|
||||
<div class="epr-content bib-anomalies-content">
|
||||
<div class="ms1-loader ms1-loader--inline" role="status" aria-live="polite" aria-busy="true">
|
||||
<img class="ms1-loader__runner"
|
||||
src="<?php echo fxBibEsc($strRunnerSrc); ?>"
|
||||
alt=""
|
||||
role="presentation"
|
||||
decoding="async">
|
||||
<span class="ms1-loader__label"><?php echo fxBibEsc($strWait); ?></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
/** MSIN-4379 — Panneau dashboard anomalies (HTML). */
|
||||
function renderBibAnomaliesPanel($int_eve_id, $strLangue = 'fr', $tabAnomalies = null) {
|
||||
$int_eve_id = (int)$int_eve_id;
|
||||
@ -5320,6 +5377,8 @@ function fxAssignAutoBibForParticipant($epr_id, $par_id) {
|
||||
function fxInfosBibEpreuve($epr_id){
|
||||
global $objDatabase;
|
||||
|
||||
static $memCache = [];
|
||||
|
||||
$epr_id = intval($epr_id);
|
||||
|
||||
if ($epr_id <= 0) {
|
||||
@ -5330,6 +5389,10 @@ function fxInfosBibEpreuve($epr_id){
|
||||
];
|
||||
}
|
||||
|
||||
if (isset($memCache[$epr_id])) {
|
||||
return $memCache[$epr_id];
|
||||
}
|
||||
|
||||
$sqlEpreuve = "
|
||||
SELECT epr_equipe, epr_bib_team_mode
|
||||
FROM inscriptions_epreuves
|
||||
@ -5379,6 +5442,8 @@ function fxInfosBibEpreuve($epr_id){
|
||||
'a_assigner' => fxCountBatchAssignUnits($epr_id)
|
||||
];
|
||||
|
||||
$memCache[$epr_id] = $info;
|
||||
|
||||
return $info;
|
||||
}
|
||||
function renderBibRanges($tabBibRanges, $epr_id = 0, $mode = 'assign') {
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
* Constantes *
|
||||
*
|
||||
**************/
|
||||
define('_VERSION_CODE', '4.72.739');
|
||||
define('_VERSION_CODE', '4.72.740');
|
||||
define('_DATE_CODE', '2026-07-08');
|
||||
//MSIN-4290
|
||||
define('QR_SECRET_KEY', 'ms1_qr_2026_cle_secrete_longue_et_fixe');
|
||||
|
||||
Reference in New Issue
Block a user