diff --git a/server/content/index.php b/server/content/index.php index 5f315b4..f826831 100644 --- a/server/content/index.php +++ b/server/content/index.php @@ -86,11 +86,12 @@ $items .= $tpl->load('menu/item-icon-badge', ['Meldeliste', '', 'html-id' => 'menu-item-entrylist', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-entrylist']); $items .= $tpl->load('menu/item-icon', ['Ergebnisse', '', 'html-id' => 'menu-item-results', 'icon' => 'fa-poll']); $items .= $tpl->load('menu/item-icon', ['Bericht', '', 'html-id' => 'menu-item-bericht', 'icon' => 'fa-book']); + $items .= $tpl->load('menu/item-icon', ['Fakten', '', 'html-id' => 'menu-item-facts', 'icon' => 'fa-list']); $items .= $tpl->load('menu/item-icon', ['Informationen', '', 'html-id' => 'menu-item-info', 'icon' => 'fa-info']); $items .= $tpl->load('menu/item-icon-badge', ['Meldung', '', 'html-id' => 'menu-item-meldung', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-meldung']); $items .= $tpl->load('menu/item-icon', ['offizielle Ergebnisse', '', 'html-id' => 'menu-item-oresults', 'icon' => 'fa-poll']); $items .= $tpl->load('menu/item-icon', ['Vereins-Website', '', 'html-id' => 'menu-item-clubwebsite', 'icon' => 'fa-globe']); - $sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-regatta', 'title' => 'Regatta-Details', 'height' => 320]); + $sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-regatta', 'title' => 'Regatta-Details', 'height' => 400]); // Favorites Menu $items = $tpl->load('menu/item-icon', ['Nicht mehr folgen', '#', 'html-id' => 'menu-item-unfollow', 'icon' => 'fa-heart', 'css-class' => ' border-0']); diff --git a/server/content/planning.php b/server/content/planning.php index 8a62b93..1b223cd 100644 --- a/server/content/planning.php +++ b/server/content/planning.php @@ -34,11 +34,12 @@ $items .= $tpl->load('menu/item-icon-badge', ['Meldeliste', '', 'html-id' => 'menu-item-entrylist', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-entrylist']); $items .= $tpl->load('menu/item-icon', ['Ergebnisse', '', 'html-id' => 'menu-item-results', 'icon' => 'fa-poll']); $items .= $tpl->load('menu/item-icon', ['Bericht', '', 'html-id' => 'menu-item-bericht', 'icon' => 'fa-book']); + $items .= $tpl->load('menu/item-icon', ['Fakten', '', 'html-id' => 'menu-item-facts', 'icon' => 'fa-list']); $items .= $tpl->load('menu/item-icon', ['Informationen', '', 'html-id' => 'menu-item-info', 'icon' => 'fa-info']); $items .= $tpl->load('menu/item-icon-badge', ['Meldung', '', 'html-id' => 'menu-item-meldung', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-meldung']); $items .= $tpl->load('menu/item-icon', ['offizielle Ergebnisse', '', 'html-id' => 'menu-item-oresults', 'icon' => 'fa-poll']); $items .= $tpl->load('menu/item-icon', ['Vereins-Website', '', 'html-id' => 'menu-item-clubwebsite', 'icon' => 'fa-globe']); - $sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-regatta', 'title' => 'Regatta-Details', 'height' => 320]); + $sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-regatta', 'title' => 'Regatta-Details', 'height' => 400]); // Menu Edit status $items = $tpl->load('menu/item-switch', ['Gemeldet', 'html-id' => 'switch-status-gemeldet', 'icon' => 'fa-file-signature']); diff --git a/server/content/planning_view.php b/server/content/planning_view.php index 0c00e6b..24b9f1a 100644 --- a/server/content/planning_view.php +++ b/server/content/planning_view.php @@ -26,11 +26,12 @@ $items .= $tpl->load('menu/item-icon-badge', ['Meldeliste', '', 'html-id' => 'menu-item-entrylist', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-entrylist']); $items .= $tpl->load('menu/item-icon', ['Ergebnisse', '', 'html-id' => 'menu-item-results', 'icon' => 'fa-poll']); $items .= $tpl->load('menu/item-icon', ['Bericht', '', 'html-id' => 'menu-item-bericht', 'icon' => 'fa-book']); + $items .= $tpl->load('menu/item-icon', ['Fakten', '', 'html-id' => 'menu-item-facts', 'icon' => 'fa-list']); $items .= $tpl->load('menu/item-icon', ['Informationen', '', 'html-id' => 'menu-item-info', 'icon' => 'fa-info']); $items .= $tpl->load('menu/item-icon-badge', ['Meldung', '', 'html-id' => 'menu-item-meldung', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-meldung']); $items .= $tpl->load('menu/item-icon', ['offizielle Ergebnisse', '', 'html-id' => 'menu-item-oresults', 'icon' => 'fa-poll']); $items .= $tpl->load('menu/item-icon', ['Vereins-Website', '', 'html-id' => 'menu-item-clubwebsite', 'icon' => 'fa-globe']); - $sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-regatta', 'title' => 'Regatta-Details', 'height' => 320]); + $sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-regatta', 'title' => 'Regatta-Details', 'height' => 400]); $sp['scripts'] .= $scripts->load('onRegattaClicked'); $sp['scripts'] .= $scripts->load('planning_view'); diff --git a/server/content/regatta_facts.php b/server/content/regatta_facts.php new file mode 100644 index 0000000..ddeb215 --- /dev/null +++ b/server/content/regatta_facts.php @@ -0,0 +1,49 @@ +'; + $content .= '
'; + + $sp['output'] .= $tpl->load('card', [$content]); + + // NO FACTS INFO + $content = 'Es sind keine Fakten zu dieser Veranstaltung hinterlegt. Bitte lies die Ausschreibung.
'; + $sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-nofactsinfo']); + + // Meldegeld + $content = 'Alle Angaben ohne Gewähr. Änderungen vorbehalten. Am Ende gilt, was in der Ausschreibung / Segelanweisung steht!
'; + $sp['output'] .= $tpl->load('card', [$content]); + + $sp['scripts'] .= $scripts->load('regatta_facts'); + +?> diff --git a/server/content/regattas.php b/server/content/regattas.php index 6179f28..465b908 100644 --- a/server/content/regattas.php +++ b/server/content/regattas.php @@ -30,11 +30,12 @@ $items .= $tpl->load('menu/item-icon-badge', ['Meldeliste', '', 'html-id' => 'menu-item-entrylist', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-entrylist']); $items .= $tpl->load('menu/item-icon', ['Ergebnisse', '', 'html-id' => 'menu-item-results', 'icon' => 'fa-poll']); $items .= $tpl->load('menu/item-icon', ['Bericht', '', 'html-id' => 'menu-item-bericht', 'icon' => 'fa-book']); + $items .= $tpl->load('menu/item-icon', ['Fakten', '', 'html-id' => 'menu-item-facts', 'icon' => 'fa-list']); $items .= $tpl->load('menu/item-icon', ['Informationen', '', 'html-id' => 'menu-item-info', 'icon' => 'fa-info']); $items .= $tpl->load('menu/item-icon-badge', ['Meldung', '', 'html-id' => 'menu-item-meldung', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-meldung']); $items .= $tpl->load('menu/item-icon', ['offizielle Ergebnisse', '', 'html-id' => 'menu-item-oresults', 'icon' => 'fa-poll']); $items .= $tpl->load('menu/item-icon', ['Vereins-Website', '', 'html-id' => 'menu-item-clubwebsite', 'icon' => 'fa-globe']); - $sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-regatta', 'title' => 'Regatta-Details', 'height' => 320]); + $sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-regatta', 'title' => 'Regatta-Details', 'height' => 400]); $sp['scripts'] .= $scripts->load('onRegattaClicked'); $sp['scripts'] .= $scripts->load('regattas'); diff --git a/server/scripts/onRegattaClicked.js b/server/scripts/onRegattaClicked.js index 704b908..72b6e5d 100644 --- a/server/scripts/onRegattaClicked.js +++ b/server/scripts/onRegattaClicked.js @@ -137,6 +137,14 @@ async function onRegattaClicked(id) { $('#menu-item-bericht').hide(); } + // Fakten + if ('facts' in regatta && regatta['facts'] != null) { + $('#menu-item-facts').show(); + $('#menu-item-facts').attr('href', LINK_PRE + 'regatta_facts?regatta=' + regatta['id']); + } else { + $('#menu-item-facts').hide(); + } + // Info if (regatta['info'] != '') { $('#menu-item-info').show(); diff --git a/server/scripts/regatta_facts.js b/server/scripts/regatta_facts.js new file mode 100644 index 0000000..90f8d11 --- /dev/null +++ b/server/scripts/regatta_facts.js @@ -0,0 +1,258 @@ +var siteScript = async function() { + $('#card-nofactsinfo').hide(); + $('#card-entryfee').hide(); + $('#card-races').hide(); + $('#card-races').find('p').remove(); + $('#card-races').find('table').remove(); + $('#card-times').hide(); + $('#card-camping').hide(); + $('#card-food').hide(); + $('#card-text').hide(); + + var regattaId = findGetParameter('regatta'); + if (regattaId == null) { + $('#h1-title').text('Regatta nicht gefunden'); + hideLoader(); + return; + } + var regatta = await dbGetData('regattas', regattaId); + if (regatta == null) { + $('#h1-title').text('Regatta nicht gefunden'); + hideLoader(); + return; + } + var dateFrom = parseDate(regatta['date']); + var dateTo = parseDate(regatta['date']); + dateTo.setDate(dateTo.getDate() + Math.max(parseInt(regatta['length']) - 1, 0)); + + $('#h1-title').text(regatta.name); + if (regatta.length < 1) { + if (formatDate('d.m', dateFrom) == '01.01') { + $('#p-title').html('Datum noch unklar'); + } else { + $('#p-title').html(formatDate('d.m.Y', dateFrom) + ' - Datum nicht final'); + } + } else { + $('#p-title').html(formatDate('d.m.Y', dateFrom) + ' - ' + formatDate('d.m.Y', dateTo)); + } + + if (regatta.facts != null) { + var facts = JSON.parse(regatta.facts); + + // Meldegeld + if ('entry' in facts && 'price' in facts.entry) { + $('#card-entryfee').show(); + var content = 'Meldegeld: ' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.entry.price)) + ''; + if ('early' in facts.entry) { + content += 'Anzahl Wettfahrten: ' + facts.races.cnt + '
'); + if ('days' in facts.races) { + var table = $('| ' + day + ' | ' + cnt + ' |
| Sollzeit | ' + facts.racetimes.sollzeit + ' min |
| Zeitlimit | ' + facts.racetimes.zeitlimit + ' min |
| Zielzeitfenster | ' + facts.racetimes.zielzeitfenster + ' min |
| Registrierung | |
| ' + day + ' | ' + content + ' |
| Vermessung | |
| ' + day + ' | ' + content + ' |
| Steuerleutebesprechung | |
| ' + day + ' | ' + time + ' |
| Erster Start | |
| ' + day + ' | ' + time + ' |
| Letzter Start | |
| ' + day + ' | ' + time + ' |