Special fields

This commit is contained in:
ostertun
2020-10-22 11:37:19 +02:00
parent e17f99d005
commit 4eb2970671
14 changed files with 137 additions and 32 deletions

View File

@@ -188,6 +188,9 @@ var siteScript = async function() {
list += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
// Special
if (regatta.special.substr(0, 1) == '#') {
regatta.special = '* ' + regatta.special.substr(1);
}
list += '<div>' + regatta['special'] + '</div>';
// Icons
@@ -287,6 +290,9 @@ var siteScript = async function() {
list += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
// Special
if (regatta.special.substr(0, 1) == '#') {
regatta.special = '* ' + regatta.special.substr(1);
}
list += '<div>' + regatta['special'] + '</div>';
// Icons
@@ -393,6 +399,9 @@ var siteScript = async function() {
list += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
// Special
if (regatta.special.substr(0, 1) == '#') {
regatta.special = '* ' + regatta.special.substr(1);
}
list += '<div>' + regatta['special'] + '</div>';
// Icons

View File

@@ -6,6 +6,20 @@ async function onRegattaClicked(id) {
var dateTo = parseDate(regatta['date']);
dateTo.setDate(dateTo.getDate() + Math.max(parseInt(regatta['length']) - 1, 0));
var specialFields = await dbGetClassProp('special-fields');
if (specialFields === null) specialFields = {};
if (regatta.special.substr(0, 1) == '#') {
regatta.special = regatta.special.substr(1);
if (typeof specialFields[regatta.special] !== 'undefined') {
$('#menu-item-special').text(specialFields[regatta.special]);
} else {
$('#menu-item-special').text('ERROR');
}
$('#menu-item-special').show();
} else {
$('#menu-item-special').hide();
}
var plannings = await dbGetDataIndex('plannings', 'regatta', regatta['id']);
var planning = null;
if (isLoggedIn()) {

View File

@@ -214,6 +214,9 @@ var siteScript = async function() {
row.content += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
// Special
if (entry.special.substr(0, 1) == '#') {
entry.special = '* ' + entry.special.substr(1);
}
row.content += '<div>' + entry['special'] + '</div>';
// Icons

View File

@@ -408,6 +408,9 @@ var siteScript = async function() {
row.content += '<div>' + ((entry['number'] != null) ? ('# ' + entry['number']) : '') + '</div>';
// Special
if (entry.special.substr(0, 1) == '#') {
entry.special = '* ' + entry.special.substr(1);
}
row.content += '<div>' + entry['special'] + '</div>';
// Club

View File

@@ -158,6 +158,9 @@ var siteScript = async function() {
row.content += '<div>' + ((entry['number'] != null) ? ('# ' + entry['number']) : '') + '</div>';
// Special
if (entry.special.substr(0, 1) == '#') {
entry.special = '* ' + entry.special.substr(1);
}
row.content += '<div>' + entry['special'] + '</div>';
// Club

View File

@@ -137,6 +137,7 @@ async function selectChange(callSiteScript = true) {
jugend = jugstrict = true;
break;
case 'idjm':
var youthGermanName = await dbGetClassProp('youth-german-name');
var beginn = null;
var regattas = await dbGetData('regattas');
regattas.sort(function(a,b){ return b.date.localeCompare(a.date); });
@@ -146,7 +147,7 @@ async function selectChange(callSiteScript = true) {
if ((date < parseDate('01.01.' + year)) || (date > parseDate('31.12.' + year))) {
continue;
}
if (regatta.name.indexOf(YOUTH_GERMAN_NAME) >= 0) {
if (regatta.name.indexOf(youthGermanName) >= 0) {
beginn = ((regatta.meldungSchluss != null) ? parseDate(regatta.meldungSchluss) : date);
break;
}
@@ -162,7 +163,7 @@ async function selectChange(callSiteScript = true) {
jugend = true;
jugstrict = false;
} else {
$('#div-rank').html('Keine ' + YOUTH_GERMAN_NAME + ' gefunden!');
$('#div-rank').html('Keine ' + youthGermanName + ' gefunden!');
$('#input-search').parent().hide();
return;
}

View File

@@ -109,6 +109,9 @@ var siteScript = async function() {
var heute = false;
rows = [];
var specialFields = await dbGetClassProp('special-fields');
if (specialFields === null) specialFields = {};
var specialShown = {};
for (id in regattas) {
var entry = regattas[id];
@@ -146,7 +149,16 @@ var siteScript = async function() {
row.content += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
// Special
row.content += '<div>' + entry['special'] + '</div>';
if (entry.special.substr(0, 1) == '#') {
entry.special = entry.special.substr(1);
if (typeof specialFields[entry.special] !== 'undefined') {
specialShown[entry.special] = specialFields[entry.special];
entry.special = '* ' + entry.special;
} else {
entry.special = 'ERROR';
}
}
row.content += '<div>' + entry.special + '</div>';
// Icons
var icons = [];
@@ -223,12 +235,24 @@ var siteScript = async function() {
rows.push(null);
}
if (Object.keys(specialShown).length > 0) {
var specialText = '';
for (key in specialShown) {
specialText += '* ' + key + ': ' + specialShown[key] + '<br>';
}
$('#card-special').find('p').html(specialText);
$('#card-special').show();
} else {
$('#card-special').hide();
}
drawList();
} else {
$('#p-count').html('Keine Regatten gefunden!');
$('#div-regattas').hide();
$('#input-search').parent().hide();
$('#card-special').hide();
}
hideLoader();