MSIN-4459 — Refactor participant list to display individual entries per participant, excluding certain roles. Update SQL queries for improved data retrieval and modify CSS for new styling conventions. Increment version code to 4.72.839.

This commit is contained in:
2026-07-20 12:26:32 -04:00
parent afac2f175e
commit f7057bd7cb
4 changed files with 50 additions and 196 deletions

View File

@ -4075,55 +4075,18 @@ a.ms1-trad-link.btn-aide-trad{
line-height:1.35;
}
.inscr-gestion-list-mates{
list-style:none;
margin:2px 0 0;
padding:2px 0 0 10px;
border-left:3px solid #c5d8f0;
width:100%;
}
.inscr-gestion-list-mates__item{
font-size:12px;
font-weight:500;
color:#495057;
line-height:1.4;
padding:2px 0;
}
.inscr-gestion-list-mates__row{
display:flex;
align-items:center;
justify-content:space-between;
gap:8px;
width:100%;
}
.inscr-gestion-list-mates__link{
color:inherit;
text-decoration:none;
display:inline-block;
min-width:0;
flex:1 1 auto;
}
.inscr-gestion-list-mates__link:hover{
color:#004085;
text-decoration:underline;
}
.inscr-gestion-list-mates__role{
color:#6c757d;
font-weight:400;
}
.inscr-gestion-list-mates__bib{
flex:0 0 auto;
}
.inscr-gestion-list-mates__bib .inscr-gestion-list-bib-wrap,
.inscr-gestion-list-mates__bib .inscr-gestion-bib-pill{
.inscr-gestion-list-item__role{
font-size:11px;
font-weight:600;
color:#6c757d;
text-transform:uppercase;
letter-spacing:.02em;
line-height:1.3;
}
.inscr-gestion-list-item--teammate .inscr-gestion-list-item__who{
padding-left:10px;
border-left:3px solid #c5d8f0;
}
/* MSIN-4405 — la pastille de cause se colle au bord droit de la cellule du nom */

View File

@ -988,65 +988,20 @@ function fxInscrGestionFetchRows($intEveId, $arrReq) {
global $objDatabase;
$strWhere = fxInscrGestionBuildWhere($intEveId, $arrReq);
// MSIN-4459 — pec_nom_equipe pour affichage du nom d'équipe en liste (1 ligne = 1 commande).
// MSIN-4459 — 1 ligne = 1 participant (coéquipiers dans les memes colonnes).
// Exclut rol_id 3/4 (benevole / autre) comme le promoteur.
$sql = 'SELECT p.no_bib, p.no_bib_remis, p.no_bib_remis_date, p.no_bib_remis_par, p.par_statut_course, p.par_id, p.par_equipe,'
. ' p.par_prenom, p.par_nom, e.pec_id_original, e.epr_id, e.eve_id, e.pec_id, e.is_cancelled, e.pec_actif, p.rol_id,'
. ' e.no_commande, e.no_panier, e.no_equipe, e.pec_equipe, e.pec_nom_equipe'
. ' FROM resultats_epreuves_commandees e, resultats_participants p'
. ' WHERE ' . $strWhere . ' AND p.pec_id = e.pec_id_original'
. ' GROUP BY e.pec_id_original'
. ' ORDER BY p.par_nom, p.par_prenom';
. ' WHERE ' . $strWhere
. ' AND p.pec_id = e.pec_id_original'
. ' AND p.rol_id NOT IN (3, 4)'
. ' ORDER BY p.par_nom, p.par_prenom, p.par_id';
return $objDatabase->fxGetResults($sql);
}
/**
* MSIN-4459 — Membres d'équipe pour enrichir la liste (sous le capitaine).
* Une requête batch par page ; exclut rol_id 3/4 (comme promoteur).
*
* @param array $arrPecIds pec_id_original
* @return array map pec_id => liste de participants (capitaine en premier si present)
*/
function fxInscrGestionFetchTeamMembersByPecs($arrPecIds) {
global $objDatabase;
$arrIds = array();
if (is_array($arrPecIds)) {
foreach ($arrPecIds as $intPec) {
$intPec = intval($intPec);
if ($intPec > 0) {
$arrIds[$intPec] = $intPec;
}
}
}
if (count($arrIds) === 0) {
return array();
}
$sql = 'SELECT pec_id, par_id, par_nom, par_prenom, rol_id, no_bib, no_bib_remis, par_statut_course'
. ' FROM resultats_participants'
. ' WHERE pec_id IN (' . implode(',', $arrIds) . ')'
. ' AND rol_id NOT IN (3, 4)'
. ' ORDER BY pec_id, CASE WHEN rol_id = 1 THEN 0 ELSE 1 END, par_nom, par_prenom';
$tab = $objDatabase->fxGetResults($sql);
$map = array();
if (!is_array($tab) || count($tab) === 0) {
return $map;
}
$intNb = count($tab);
for ($i = 1; $i <= $intNb; $i++) {
$intPec = intval($tab[$i]['pec_id']);
if (!isset($map[$intPec])) {
$map[$intPec] = array();
}
$map[$intPec][] = $tab[$i];
}
return $map;
}
function fxInscrGestionFetchRowByPec($intPecId, $intEveId, $intParId = 0) {
global $objDatabase;
@ -2175,10 +2130,10 @@ function fxInscrGestionRenderList($intEveId, $strLangue, $strBaseUrl, $arrReq) {
echo '<div class="inscr-gestion-form-field inscr-gestion-form-field--actions">';
echo '<div class="inscr-gestion-form-actions">';
echo '<a class="btn btn-secondary btn-sm rounded-0" href="' . fxInscrGestionEsc(fxInscrGestionSearchResetUrl($strBaseUrl, $intEveId)) . '">'
. fxInscrGestionEsc(fxInscrGestionT('inscr_gestion_reset_search')) . '</a>';
echo '<button class="btn btn-primary btn-sm rounded-0" type="submit" name="btn_recherche" value="1">'
. fxInscrGestionEsc(fxInscrGestionT('txt_recherche')) . '</button>';
echo '<a class="btn btn-secondary btn-sm rounded-0" href="' . fxInscrGestionEsc(fxInscrGestionSearchResetUrl($strBaseUrl, $intEveId)) . '">'
. fxInscrGestionEsc(fxInscrGestionT('inscr_gestion_reset_search')) . '</a>';
echo '</div></div>';
echo '</div></form></div></details>';
@ -2270,60 +2225,26 @@ function fxInscrGestionRenderList($intEveId, $strLangue, $strBaseUrl, $arrReq) {
$strRemisLabel = fxInscrGestionT('promoteur_bib_enregistre');
$strBibOkLabel = fxInscrGestionT('inscr_gestion_bib_ok');
$strTeammateLabel = fxInscrGestionT('inscr_gestion_list_teammate');
// MSIN-4459 — Membres d'équipe de la page courante (1 requête batch).
$arrTeamPecs = array();
for ($jTeam = $intStart; $jTeam <= $intEnd; $jTeam++) {
if (!empty($tabRows[$jTeam]) && intval($tabRows[$jTeam]['pec_equipe']) === 1) {
$arrTeamPecs[] = (int)$tabRows[$jTeam]['pec_id_original'];
}
$strCaptainLabel = trim(fxInscrGestionT('participant-titre-capitaine'));
if ($strCaptainLabel === '') {
$strCaptainLabel = ($strLangue === 'en') ? 'Captain' : 'Capitaine';
}
$tabTeamMembersByPec = fxInscrGestionFetchTeamMembersByPecs($arrTeamPecs);
for ($j = $intStart; $j <= $intEnd; $j++) {
$row = $tabRows[$j];
$blnEquipe = (intval($row['pec_equipe']) === 1);
$intPecId = (int)$row['pec_id_original'];
$tabMates = array();
$strTeamName = '';
$strTeamNo = '';
// MSIN-4459 — Ligne parente = capitaine ; coéquipiers en sous-liste.
if ($blnEquipe) {
$strTeamName = trim(fxUnescape(isset($row['pec_nom_equipe']) ? $row['pec_nom_equipe'] : ''));
$strTeamNo = trim(fxUnescape(isset($row['no_equipe']) ? $row['no_equipe'] : ''));
$tabMembers = isset($tabTeamMembersByPec[$intPecId]) ? $tabTeamMembersByPec[$intPecId] : array();
$arrCaptain = null;
foreach ($tabMembers as $arrMem) {
if ((int)$arrMem['rol_id'] === 1 && $arrCaptain === null) {
$arrCaptain = $arrMem;
} else {
$tabMates[] = $arrMem;
}
}
if ($arrCaptain !== null) {
$row['par_nom'] = $arrCaptain['par_nom'];
$row['par_prenom'] = $arrCaptain['par_prenom'];
$row['par_id'] = $arrCaptain['par_id'];
$row['no_bib'] = isset($arrCaptain['no_bib']) ? $arrCaptain['no_bib'] : '';
$row['no_bib_remis'] = $arrCaptain['no_bib_remis'];
$row['par_statut_course'] = $arrCaptain['par_statut_course'];
$row['rol_id'] = 1;
} else {
// Pas de capitaine : garder la ligne GROUP BY ; exclure ce par_id des mates.
$intMainPar = (int)$row['par_id'];
$tabMates = array();
foreach ($tabMembers as $arrMem) {
if ((int)$arrMem['par_id'] !== $intMainPar) {
$tabMates[] = $arrMem;
}
}
}
}
$intParId = (int)$row['par_id'];
// MSIN-4459 — Fiche cible le bon participant (capitaine ou coéquipier).
$strTeamName = $blnEquipe
? trim(fxUnescape(isset($row['pec_nom_equipe']) ? $row['pec_nom_equipe'] : ''))
: '';
$strTeamNo = $blnEquipe
? trim(fxUnescape(isset($row['no_equipe']) ? $row['no_equipe'] : ''))
: '';
$blnCapitaine = $blnEquipe && ((int)$row['rol_id'] === 1);
$blnCoequipier = $blnEquipe && !$blnCapitaine;
// MSIN-4459 — Fiche cible ce participant (capitaine ou coéquipier).
$strFicheUrl = fxInscrGestionBuildUrl($strBaseUrl, $intEveId, $arrReq, array(
'pec_id' => $intPecId,
'par_id' => $intParId,
@ -2346,6 +2267,9 @@ function fxInscrGestionRenderList($intEveId, $strLangue, $strBaseUrl, $arrReq) {
isset($row['par_statut_course']) ? $row['par_statut_course'] : ''
);
$strCardClass = 'inscr-gestion-list-item';
if ($blnCoequipier) {
$strCardClass .= ' inscr-gestion-list-item--teammate';
}
$strCancelBadge = '';
if ($row['is_cancelled'] == '1') {
// MSIN-4405 — Cause derivee en lecture seule (aucune ecriture en base).
@ -2357,59 +2281,23 @@ function fxInscrGestionRenderList($intEveId, $strLangue, $strBaseUrl, $arrReq) {
$blnRemis = (intval($row['no_bib_remis']) === 1);
// MSIN-4448 — Ligne en div : cellules nav (lien) vs dossard/remis editables.
// MSIN-4448 / MSIN-4459 — 1 participant = 1 ligne, memes colonnes.
echo '<div class="' . $strCardClass . '">';
// MSIN-4459 — Bloc nom : capitaine (no équipe) + nom d'équipe + coéquipiers.
echo '<div class="inscr-gestion-list-item__who">';
echo '<a class="inscr-gestion-list-item__name" href="' . $strFicheHref . '">'
. fxInscrGestionEsc($strName) . $strCancelBadge . '</a>';
if ($blnCapitaine) {
echo '<span class="inscr-gestion-list-item__role">'
. fxInscrGestionEsc($strCaptainLabel) . '</span>';
} elseif ($blnCoequipier) {
echo '<span class="inscr-gestion-list-item__role">'
. fxInscrGestionEsc($strTeammateLabel) . '</span>';
}
if ($blnEquipe && $strTeamName !== '') {
echo '<span class="inscr-gestion-list-item__team">'
. fxInscrGestionEsc(sprintf(fxInscrGestionT('inscr_gestion_list_team_name'), $strTeamName))
. '</span>';
}
if ($blnEquipe && count($tabMates) > 0) {
$strBibColLabel = fxInscrGestionT('inscr_gestion_col_dossard');
echo '<ul class="inscr-gestion-list-mates">';
foreach ($tabMates as $arrMate) {
$intMateParId = (int)$arrMate['par_id'];
$strMateName = fxUnescape($arrMate['par_nom']) . ', ' . fxUnescape($arrMate['par_prenom']);
if ($strTeamNo !== '') {
$strMateName .= ' (' . $strTeamNo . ')';
}
$strMateBib = fxInscrGestionBibDisplay(array(
'no_bib' => isset($arrMate['no_bib']) ? $arrMate['no_bib'] : '',
'epr_id' => $row['epr_id'],
));
$strMateFicheUrl = fxInscrGestionBuildUrl($strBaseUrl, $intEveId, $arrReq, array(
'pec_id' => $intPecId,
'par_id' => $intMateParId,
'pg' => $intPage,
));
$strMateFicheHref = fxInscrGestionEsc($strMateFicheUrl);
echo '<li class="inscr-gestion-list-mates__item">';
echo '<div class="inscr-gestion-list-mates__row">';
echo '<a class="inscr-gestion-list-mates__link" href="' . $strMateFicheHref . '">';
echo '<span class="inscr-gestion-list-mates__role">'
. fxInscrGestionEsc($strTeammateLabel) . '</span> ';
echo fxInscrGestionEsc($strMateName);
echo '</a>';
echo '<span class="inscr-gestion-list-mates__bib">';
fxInscrGestionRenderListBibControl(array(
'bib' => $strMateBib,
'par_id' => $intMateParId,
'eve_id' => (int)$row['eve_id'],
'epr_id' => (int)$row['epr_id'],
'pec_id' => $intPecId,
'can_bib' => $blnCanBib,
'ok_label' => $strBibOkLabel,
'col_label' => $strBibColLabel,
));
echo '</span>';
echo '</div></li>';
}
echo '</ul>';
}
echo '</div>';
echo '<a class="inscr-gestion-list-item__race" href="' . $strFicheHref . '" title="'
. fxInscrGestionEsc($strRace) . '">' . fxInscrGestionEsc($strRace) . '</a>';

View File

@ -7,7 +7,7 @@
* Constantes *
*
**************/
define('_VERSION_CODE', '4.72.838');
define('_VERSION_CODE', '4.72.839');
define('_DATE_CODE', '2026-07-20');
//MSIN-4290
define('QR_SECRET_KEY', 'ms1_qr_2026_cle_secrete_longue_et_fixe');

View File

@ -1,4 +1,4 @@
-- MSIN-4459 — Liste inscriptions : équipe + dossard individuel (≠ no_equipe)
-- MSIN-4459 — Liste inscriptions : 1 ligne / participant ; dossard ≠ no_equipe
-- Prérequis : aucun
-- Idempotent (DELETE + INSERT). Compte.php (contexte AJAX / fiche gestion).
@ -10,7 +10,8 @@ WHERE info_prg = 'compte.php'
'inscr_gestion_list_team_no',
'inscr_gestion_list_team_no_label',
'inscr_gestion_list_team_name_label',
'inscr_gestion_rech_bib_equipe'
'inscr_gestion_rech_bib_equipe',
'inscr_gestion_col_dossard'
);
INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_description, info_trie, info_actif, info_option1, info_option2, info_option3, info_creation) VALUES
@ -23,4 +24,6 @@ INSERT INTO info (info_clef, info_langue, info_texte, info_aide, info_prg, info_
('inscr_gestion_list_team_name_label', 'fr', 'Nom d\'équipe', '', 'compte.php', '', 0, 1, '', '', '', NOW()),
('inscr_gestion_list_team_name_label', 'en', 'Team name', '', 'compte.php', '', 0, 1, '', '', '', NOW()),
('inscr_gestion_rech_bib_equipe', 'fr', 'Dossard', '', 'compte.php', '', 0, 1, '', '', '', NOW()),
('inscr_gestion_rech_bib_equipe', 'en', 'Bib', '', 'compte.php', '', 0, 1, '', '', '', NOW());
('inscr_gestion_rech_bib_equipe', 'en', 'Bib', '', 'compte.php', '', 0, 1, '', '', '', NOW()),
('inscr_gestion_col_dossard', 'fr', 'Dossard', '', 'compte.php', '', 0, 1, '', '', '', NOW()),
('inscr_gestion_col_dossard', 'en', 'Bib', '', 'compte.php', '', 0, 1, '', '', '', NOW());