function selectChange(callSiteScript = true) {
var val = $('#select-year').val();
if (val == "user") {
$('#input-from').parent().show();
$('#input-to').parent().show();
$('#button-show').show();
} else {
$('#input-from').parent().hide();
$('#input-to').parent().hide();
$('#button-show').hide();
$('#input-from').val(val + '-01-01');
$('#input-to').val(val + '-12-31');
if (callSiteScript && (typeof siteScript === 'function'))
siteScript();
}
}
function initYear() {
var year = findGetParameter('year');
if (year === null) year = new Date().getFullYear();
$('#select-year').html('');
$('#select-year').val(year);
selectChange(false);
}
var firstCall = true;
var rows = [];
var today;
async function drawTable () {
//setLoading(true, 'loading');
window.setTimeout(function () {
var list = '';
rows.forEach(function (entry) {
if (entry == null) {
//tbody += '
';
// ZEILE 1
// Name
row.content += '
' + (entry['canceled'] == 1 ? '' : '') + entry['name'] + (entry['canceled'] == 1 ? '' : '') + '
';
// ZEILE 2
row.content += '
';
// Number
row.content += '
' + ((entry['number'] != null) ? ('# ' + entry['number']) : '') + '
';
// Club
row.content += '
' + ((club != null) ? club['kurz'] : '') + '
';
// Special
row.content += '
' + entry['special'] + '
';
// Icons
var icons = [];
if (entry['info'] != '')
icons.push('
');
if ((entry['meldung'] != '') && (dateTo >= today) && (entry['meldungOffen'] == '1')) {
var color = '';
if (entry['meldungSchluss'] != null) {
var ms = parseDate(entry['meldungSchluss']);
var diff = Math.round((ms - today) / 86400000);
if ((ms >= today) && (diff < 7))
color = ' color-red2-dark';
}
icons.push('
');
}
if (entry['bericht'] != '')
icons.push('
');
if (entry['canceled'] == '1') {
icons.push('
');
} else if (regattaResults[entry['id']]) {
icons.push('
');
}
row.content += '
' + icons.join(' ') + '
';
row.content += '
';
// ZEILE 3
row.content += '
';
// Date
if (entry['length'] < 1) {
if (formatDate('d.m', dateFrom) == '01.01') {
row.content += '
Datum noch unklar
';
} else {
row.content += '
' + formatDate("d.m.Y", dateFrom) + ' - Datum nicht final
';
}
} else {
row.content += '
' + formatDate("d.m.Y", dateFrom) + ' - ' + formatDate("d.m.Y", dateTo) + '
';
}
// RLF
row.content += '
' + parseFloat(entry['rlf']).toFixed(2) + '
';
row.content += '
';
rows.push(row);
}
if (!heute) {
rows.push(null);
}
drawTable();
} else {
$('#p-count').html('Keine Regatten gefunden!');
$('#div-regattas').hide();
$('#input-search').parent().hide();
}
hideLoader();
}