diff --git a/server/content/regatta_plan.php b/server/content/regatta_plan.php
index 85a23df..34165a1 100644
--- a/server/content/regatta_plan.php
+++ b/server/content/regatta_plan.php
@@ -1,19 +1,31 @@
';
+ $content .= '
';
- $content = $tpl->load('error', ['404', 'Seite existiert noch nicht']);
- $content .= '';
- $content .= 'Die gesuchte Seite ist leider noch nicht verfügbar.
';
- $content .= 'Wir arbeiten daran, sie schnellstmöglich zur Verfügung zu stellen.
';
- $content .= 'Wie wäre es mit der Homepage?';
+ $sp['output'] .= $tpl->load('card', [$content]);
+
+ // Plannings
+ $content = '
';
+ $thead = '| Benutzer | Steuermann/-frau | Crew |
';
+ $content .= $tpl->load('table', [$thead, 'html-id' => 'table-plannings', 'css-class' => 'mb-0 text-nowrap']);
+
+ $sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-plannings']);
+
+ // Info
+ $content = 'Du planst, hier hinzufahren, aber stehst nicht auf dieser Liste?
';
+ $content .= 'Das kannst Du ändern! ';
+ $content .= 'Erstelle einfach hier Deine eigene Saison-Planung.';
+ $content .= 'Melde Dich an oder registriere Dich kostenlos und erstelle Deine eigene Saison-Planung.';
$content .= '
';
- $content .= $tpl->load('button', ['Zur Startseite', LINK_PRE . 'index', 'css-class' => 'mb-3']);
- $content .= $tpl->load('button', ['Kontakt', LINK_PRE . 'contact']);
- $sp['output'] = $tpl->load('card', [$content, 'css-class' => 'text-center pt-3']);
+ $sp['output'] .= $tpl->load('card', [$content]);
+
+ $sp['scripts'] .= $scripts->load('regatta_plan');
?>
\ No newline at end of file
diff --git a/server/content/result.php b/server/content/result.php
index 8b63561..b27c01f 100644
--- a/server/content/result.php
+++ b/server/content/result.php
@@ -2,6 +2,7 @@
$sp['title'] = 'Ergebnisse - Regatten.net ' . $_CLASS['name'];
$sp['backbutton'] = true;
+ $sp['activenav'] = 2;
// Title, Inputs
$content = '';
diff --git a/server/scripts/regatta_plan.js b/server/scripts/regatta_plan.js
new file mode 100644
index 0000000..24a3afc
--- /dev/null
+++ b/server/scripts/regatta_plan.js
@@ -0,0 +1,65 @@
+var siteScript = async function() {
+ 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));
+ }
+
+ var plannings = await dbGetDataIndex('plannings', 'regatta', regatta.id);
+ if (plannings.length > 0) {
+ $('#table-plannings').show();
+ $('#p-info').hide();
+ var tbody = '';
+ for (var p in plannings) {
+ var planning = plannings[p];
+
+ tbody += '';
+
+ tbody += '| ' + (await dbGetData('users', planning.user)).username + ' | ';
+
+ if (planning.steuermann != null) {
+ tbody += '' + (await dbGetData('users', planning.user)).username + ' | ';
+ } else {
+ tbody += '(noch unklar) | ';
+ }
+
+ var crew = [];
+ var cr = planning.crew.split(',');
+ for (c in cr) {
+ var s = await dbGetData('sailors', cr[c]);
+ if (s != null) crew.push(s.name);
+ }
+ tbody += '' + crew.join(' ') + ' | ';
+
+ tbody += '
';
+ }
+ $('#table-plannings').find('tbody').html(tbody);
+ } else {
+ $('#p-info').text('Niemand plant bisher, hier hinzufahren!');
+ $('#p-info').show();
+ $('#table-plannings').hide();
+ }
+
+ hideLoader();
+}
\ No newline at end of file