Enhance ChronoTrack API admin interface with registration choice support and improved race terminology
This commit updates the ChronoTrack API admin interface to incorporate support for registration choices, enhancing the functionality of race mapping. Terminology is refined throughout the interface, replacing "race" with "course" where appropriate to improve clarity. New functions are added to handle registration choices, ensuring a more comprehensive integration with the ChronoTrack API. Additionally, existing functions are modified to accommodate these changes, improving overall user experience and interaction.
This commit is contained in:
@ -155,11 +155,12 @@ function fxChronotrackApiAdminRenderRaceMapping($intEveId, $arrConfig, $strLangu
|
||||
|
||||
$strEditStyle = $blnHasSavedMapping ? ' style="display:none;"' : '';
|
||||
echo '<div id="ct_api_race_edit_wrap"' . $strEditStyle . '>';
|
||||
echo '<p class="small text-muted">ChronoTrack event ID : ' . intval($arrConfig['ct_event_id']) . '</p>';
|
||||
echo '<p class="small text-muted">ChronoTrack event ID : ' . intval($arrConfig['ct_event_id'])
|
||||
. ' — liste des <strong>choix d\'inscription</strong> (Registration Choices), comme dans CT Live.</p>';
|
||||
echo '<div id="ct_api_races_status" class="small mb-2"></div>';
|
||||
if (!$blnClosed) {
|
||||
echo '<button type="button" class="btn btn-outline-secondary btn-sm mb-2" id="ct_api_btn_reload_races">'
|
||||
. '<i class="fa fa-refresh" aria-hidden="true"></i> Charger les races ChronoTrack</button>';
|
||||
. '<i class="fa fa-refresh" aria-hidden="true"></i> Charger les courses ChronoTrack</button>';
|
||||
}
|
||||
echo '<table class="table table-sm table-bordered"><thead><tr><th>Épreuve MS1</th><th>Race ChronoTrack</th></tr></thead><tbody>';
|
||||
|
||||
@ -301,17 +302,20 @@ function fxChronotrackApiAdminRenderPageScript($intEveId, $arrConfig, $blnClosed
|
||||
return;
|
||||
}
|
||||
var $status = $('#ct_api_races_status');
|
||||
$status.removeClass('text-danger text-warning text-success').text('Chargement des races ChronoTrack…');
|
||||
$status.removeClass('text-danger text-warning text-success').text('Chargement des courses ChronoTrack…');
|
||||
$.post(strAjaxUrl, { a: 'list_races', eve_id: intEveId, ct_event_id: intLinkedCtEventId }, function (res) {
|
||||
if (!res || res.state !== 'ok') {
|
||||
$status.addClass('text-danger').text((res && res.message) ? res.message : 'Erreur chargement des races');
|
||||
$status.addClass('text-danger').text((res && res.message) ? res.message : 'Erreur chargement des courses');
|
||||
return;
|
||||
}
|
||||
var arrRaces = res.races || [];
|
||||
var strKind = res.kind || 'reg_choice';
|
||||
if (!arrRaces.length) {
|
||||
$status.addClass('text-warning').text((res.message) ? res.message : 'Aucune race ChronoTrack pour cet event.');
|
||||
$status.addClass('text-warning').text((res.message) ? res.message : 'Aucune course ChronoTrack pour cet event.');
|
||||
} else if (strKind === 'reg_choice') {
|
||||
$status.addClass('text-success').text(arrRaces.length + ' choix d\'inscription ChronoTrack chargé(s).');
|
||||
} else {
|
||||
$status.addClass('text-success').text(arrRaces.length + ' race(s) ChronoTrack chargée(s).');
|
||||
$status.addClass('text-success').text(arrRaces.length + ' course(s) ChronoTrack chargée(s).');
|
||||
}
|
||||
$('.ct-api-race-select').each(function () {
|
||||
var $sel = $(this);
|
||||
@ -319,8 +323,8 @@ function fxChronotrackApiAdminRenderPageScript($intEveId, $arrConfig, $blnClosed
|
||||
var intCurrent = tabMapCurrent[intEprId] || 0;
|
||||
$sel.find('option:not(:first)').remove();
|
||||
$.each(arrRaces, function (_, race) {
|
||||
var strText = race.label || race.name || 'Race';
|
||||
if (race.start_label) {
|
||||
var strText = race.label || race.name || 'Course';
|
||||
if (race.kind !== 'reg_choice' && race.start_label) {
|
||||
strText += ' · ' + race.start_label;
|
||||
}
|
||||
strText += ' (ID ' + race.ct_race_id + ')';
|
||||
|
||||
Reference in New Issue
Block a user