Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
32ea581437 | ||
|
|
16ccbca2af | ||
|
|
3fd9beae1e | ||
|
|
01d0ae96f9 | ||
|
|
c211817f78 | ||
|
|
9ff0b96837 | ||
|
|
7a3413b339 | ||
|
|
72ff731694 | ||
|
|
3959b208b5 | ||
|
|
7b500bf67d | ||
|
|
5c8c9db1de | ||
|
|
fa526b11a8 | ||
|
|
2dc2225263 | ||
|
|
fcf9dc9a20 | ||
|
|
203c2534eb | ||
|
|
730dd9112f | ||
|
|
13ceef37d9 | ||
|
|
54852f4383 | ||
|
|
8808d12bf1 | ||
|
|
c6d5450b0e | ||
|
|
15cbe15651 | ||
|
|
cb8a1817ae | ||
|
|
be98511957 |
@@ -27,6 +27,11 @@ $(window).on('load',function(){
|
||||
hideLoader();
|
||||
})
|
||||
|
||||
//Generating Cookies
|
||||
function createCookie(e, t, n) {if (n) {var o = new Date;o.setTime(o.getTime() + n * 365 * 24 * 3600 * 1e3);var r = "; expires=" + o.toGMTString()} else var r = "";document.cookie = e + "=" + t + r + "; path=/"}
|
||||
function readCookie(e) {for (var t = e + "=", n = document.cookie.split(";"), o = 0; o < n.length; o++) {for (var r = n[o];" " == r.charAt(0);) r = r.substring(1, r.length);if (0 == r.indexOf(t)) return r.substring(t.length, r.length)}return null}
|
||||
function eraseCookie(e) {createCookie(e, "", -1)}
|
||||
|
||||
$(document).ready(function(){
|
||||
'use strict'
|
||||
|
||||
@@ -187,11 +192,6 @@ $(document).ready(function(){
|
||||
return false;
|
||||
});
|
||||
|
||||
//Generating Cookies
|
||||
function createCookie(e, t, n) {if (n) {var o = new Date;o.setTime(o.getTime() + n * 365 * 24 * 3600 * 1e3);var r = "; expires=" + o.toGMTString()} else var r = "";document.cookie = e + "=" + t + r + "; path=/"}
|
||||
function readCookie(e) {for (var t = e + "=", n = document.cookie.split(";"), o = 0; o < n.length; o++) {for (var r = n[o];" " == r.charAt(0);) r = r.substring(1, r.length);if (0 == r.indexOf(t)) return r.substring(t.length, r.length)}return null}
|
||||
function eraseCookie(e) {createCookie(e, "", -1)}
|
||||
|
||||
//Disabling & Enabling Dark Transitions in Dark Mode to Speed up Performance.
|
||||
function allowTransitions(){$('body').find('#transitions-remove').remove();}
|
||||
function removeTransitions(){$('body').append('<style id="transitions-remove">.btn, .header, #footer-bar, .menu-box, .menu-active{transition:all 0ms ease!important;}</style>'); setTimeout(function(){allowTransitions();},10);}
|
||||
|
||||
@@ -417,29 +417,31 @@ function dbSettingsSet(key, value) {
|
||||
}
|
||||
}
|
||||
|
||||
async function updateSyncStatus() { // TODO
|
||||
// var syncStatus = document.getElementById('syncstatus');
|
||||
// var lastSync = await dbGetData('update_times', 'last_sync');
|
||||
// lastSync = new Date(lastSync.time * 1000);
|
||||
// var now = new Date();
|
||||
// var diff = Math.round((now - lastSync) / 1000);
|
||||
// var txt = '';
|
||||
//
|
||||
// if (diff < 30) { // 30 sec
|
||||
// txt = 'jetzt';
|
||||
// } else if (diff < 3600) { // 60 min
|
||||
// diff = Math.round(diff / 60);
|
||||
// txt = 'vor ' + diff + ' ' + (diff == 1 ? 'Minute' : 'Minuten');
|
||||
// } else if (diff < 86400) { // 24 std
|
||||
// diff = Math.round(diff / 3600);
|
||||
// txt = 'vor ' + diff + ' ' + (diff == 1 ? 'Stunde' : 'Stunden');
|
||||
// } else {
|
||||
// diff = Math.round(diff / 86400);
|
||||
// txt = 'vor ' + diff + ' ' + (diff == 1 ? 'Tag' : 'Tagen');
|
||||
// }
|
||||
//
|
||||
// var btn = '<a href="#" onclick="setLoading(true); sync(); return false;"><i class="fas fa-sync"></i> Sync</a>';
|
||||
// syncStatus.innerHTML = 'Zuletzt aktualisiert: ' + txt + btn;
|
||||
async function updateSyncStatus() {
|
||||
var lastSync = await dbGetData('update_times', 'last_sync');
|
||||
lastSync = new Date(lastSync.time * 1000);
|
||||
if (lastSync > 0) {
|
||||
var now = new Date();
|
||||
var diff = Math.round((now - lastSync) / 1000);
|
||||
var txt = '';
|
||||
|
||||
if (diff < 30) { // 30 sec
|
||||
txt = 'jetzt';
|
||||
} else if (diff < 3600) { // 60 min
|
||||
diff = Math.round(diff / 60);
|
||||
txt = 'vor ' + diff + ' ' + (diff == 1 ? 'Minute' : 'Minuten');
|
||||
} else if (diff < 86400) { // 24 std
|
||||
diff = Math.round(diff / 3600);
|
||||
txt = 'vor ' + diff + ' ' + (diff == 1 ? 'Stunde' : 'Stunden');
|
||||
} else {
|
||||
diff = Math.round(diff / 86400);
|
||||
txt = 'vor ' + diff + ' ' + (diff == 1 ? 'Tag' : 'Tagen');
|
||||
}
|
||||
} else {
|
||||
var txt = 'nie';
|
||||
}
|
||||
|
||||
$('#syncstatus').html('Zuletzt aktualisiert: ' + txt);
|
||||
}
|
||||
|
||||
async function runPageScript() {
|
||||
@@ -460,16 +462,14 @@ async function runPageScript() {
|
||||
dbSettingsSet('myregattas_' + BOATCLASS, plannings);
|
||||
}
|
||||
}
|
||||
if (typeof updateSyncStatusTimer == 'undefined') { // TODO
|
||||
// var syncStatus = document.getElementById('syncstatus');
|
||||
if (typeof updateSyncStatusTimer == 'undefined') {
|
||||
if (canUseLocalDB) {
|
||||
updateSyncStatusTimer = window.setInterval(updateSyncStatus, 10000);
|
||||
} else {
|
||||
// syncStatus.innerHTML = 'Keine Offline-Nutzung möglich.';
|
||||
$('#syncstatus').html('Keine Offline-Nutzung möglich.');
|
||||
$('#i-sync').parent().hide();
|
||||
updateSyncStatusTimer = null;
|
||||
}
|
||||
// syncStatus.style.display = 'block';
|
||||
}
|
||||
|
||||
if (typeof siteScript === 'function') {
|
||||
@@ -483,6 +483,7 @@ function sync() {
|
||||
if (!canUseLocalDB) return false;
|
||||
if (syncInProgress > 0) return false;
|
||||
|
||||
return new Promise(function(resolve) {
|
||||
var now = Math.floor(Date.now() / 1000);
|
||||
|
||||
db.transaction('update_times').objectStore('update_times').getAll().onsuccess = function (event) {
|
||||
@@ -513,6 +514,7 @@ function sync() {
|
||||
}
|
||||
removeSyncInfoToPreloader();
|
||||
runPageScript();
|
||||
resolve();
|
||||
}
|
||||
}, 100);
|
||||
|
||||
@@ -524,7 +526,6 @@ function sync() {
|
||||
getJSON(QUERY_URL + 'get_clubs?changed-after=' + localTimes['clubs'], function (code, data) {
|
||||
if (code == 200) {
|
||||
var os = db.transaction('clubs', 'readwrite').objectStore('clubs');
|
||||
log(data);
|
||||
data.data.forEach(function (entry) {
|
||||
os.put(entry);
|
||||
});
|
||||
@@ -539,12 +540,14 @@ function sync() {
|
||||
var osUpdateTimes = db.transaction('update_times', 'readwrite').objectStore('update_times');
|
||||
osUpdateTimes.put({ table: 'clubs', time: serverTimes['clubs'] });
|
||||
syncInProgress --;
|
||||
log('clubs synced, remaining:', syncInProgress);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
log("Something went wrong (HTTP " + code + ")");
|
||||
log("clubs: Something went wrong (HTTP " + code + ")");
|
||||
syncOkay = false;
|
||||
syncInProgress --;
|
||||
log('clubs failed, remaining:', syncInProgress);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -556,7 +559,6 @@ function sync() {
|
||||
getJSON(QUERY_URL + 'get_boats?changed-after=' + localTimes['boats'], function (code, data) {
|
||||
if (code == 200) {
|
||||
var os = db.transaction('boats', 'readwrite').objectStore('boats');
|
||||
log(data);
|
||||
data.data.forEach(function (entry) {
|
||||
os.put(entry);
|
||||
});
|
||||
@@ -571,12 +573,14 @@ function sync() {
|
||||
var osUpdateTimes = db.transaction('update_times', 'readwrite').objectStore('update_times');
|
||||
osUpdateTimes.put({ table: 'boats', time: serverTimes['boats'] });
|
||||
syncInProgress --;
|
||||
log('boats synced, remaining:', syncInProgress);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
log("Something went wrong (HTTP " + code + ")");
|
||||
log("boats: Something went wrong (HTTP " + code + ")");
|
||||
syncOkay = false;
|
||||
syncInProgress --;
|
||||
log('boats failed, remaining:', syncInProgress);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -588,7 +592,6 @@ function sync() {
|
||||
getJSON(QUERY_URL + 'get_sailors?changed-after=' + localTimes['sailors'], function (code, data) {
|
||||
if (code == 200) {
|
||||
var os = db.transaction('sailors', 'readwrite').objectStore('sailors');
|
||||
log(data);
|
||||
data.data.forEach(function (entry) {
|
||||
os.put(entry);
|
||||
});
|
||||
@@ -603,12 +606,14 @@ function sync() {
|
||||
var osUpdateTimes = db.transaction('update_times', 'readwrite').objectStore('update_times');
|
||||
osUpdateTimes.put({ table: 'sailors', time: serverTimes['sailors'] });
|
||||
syncInProgress --;
|
||||
log('sailors synced, remaining:', syncInProgress);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
log("Something went wrong (HTTP " + code + ")");
|
||||
log("sailors: Something went wrong (HTTP " + code + ")");
|
||||
syncOkay = false;
|
||||
syncInProgress --;
|
||||
log('sailors failed, remaining:', syncInProgress);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -620,7 +625,6 @@ function sync() {
|
||||
getJSON(QUERY_URL + 'get_regattas?changed-after=' + localTimes['regattas'], function (code, data) {
|
||||
if (code == 200) {
|
||||
var os = db.transaction('regattas', 'readwrite').objectStore('regattas');
|
||||
log(data);
|
||||
data.data.forEach(function (entry) {
|
||||
os.put(entry);
|
||||
});
|
||||
@@ -651,12 +655,14 @@ function sync() {
|
||||
var osUpdateTimes = db.transaction('update_times', 'readwrite').objectStore('update_times');
|
||||
osUpdateTimes.put({ table: 'regattas', time: serverTimes['regattas'] });
|
||||
syncInProgress --;
|
||||
log('regattas synced, remaining:', syncInProgress);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
log("Something went wrong (HTTP " + code + ")");
|
||||
log("regattas: Something went wrong (HTTP " + code + ")");
|
||||
syncOkay = false;
|
||||
syncInProgress --;
|
||||
log('regattas failed, remaining:', syncInProgress);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -668,7 +674,6 @@ function sync() {
|
||||
getJSON(QUERY_URL + 'get_results?changed-after=' + localTimes['results'], function (code, data) {
|
||||
if (code == 200) {
|
||||
var os = db.transaction('results', 'readwrite').objectStore('results');
|
||||
log(data);
|
||||
data.data.forEach(function (entry) {
|
||||
os.put(entry);
|
||||
});
|
||||
@@ -683,12 +688,14 @@ function sync() {
|
||||
var osUpdateTimes = db.transaction('update_times', 'readwrite').objectStore('update_times');
|
||||
osUpdateTimes.put({ table: 'results', time: serverTimes['results'] });
|
||||
syncInProgress --;
|
||||
log('results synced, remaining:', syncInProgress);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
log("Something went wrong (HTTP " + code + ")");
|
||||
log("results: Something went wrong (HTTP " + code + ")");
|
||||
syncOkay = false;
|
||||
syncInProgress --;
|
||||
log('results failed, remaining:', syncInProgress);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -700,7 +707,6 @@ function sync() {
|
||||
getJSON(QUERY_URL + 'get_plannings?changed-after=' + localTimes['plannings'], function (code, data) {
|
||||
if (code == 200) {
|
||||
var os = db.transaction('plannings', 'readwrite').objectStore('plannings');
|
||||
log(data);
|
||||
data.data.forEach(function (entry) {
|
||||
os.put(entry);
|
||||
});
|
||||
@@ -715,12 +721,14 @@ function sync() {
|
||||
var osUpdateTimes = db.transaction('update_times', 'readwrite').objectStore('update_times');
|
||||
osUpdateTimes.put({ table: 'plannings', time: serverTimes['plannings'] });
|
||||
syncInProgress --;
|
||||
log('plannings synced, remaining:', syncInProgress);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
log("Something went wrong (HTTP " + code + ")");
|
||||
log("plannings: Something went wrong (HTTP " + code + ")");
|
||||
syncOkay = false;
|
||||
syncInProgress --;
|
||||
log('plannings failed, remaining:', syncInProgress);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -733,7 +741,6 @@ function sync() {
|
||||
getJSON(QUERY_URL + 'get_trim_boats?changed-after=' + localTimes['trim_boats'], function (code, data) {
|
||||
if (code == 200) {
|
||||
var os = db.transaction('trim_boats', 'readwrite').objectStore('trim_boats');
|
||||
log(data);
|
||||
data.data.forEach(function (entry) {
|
||||
os.put(entry);
|
||||
});
|
||||
@@ -748,12 +755,14 @@ function sync() {
|
||||
var osUpdateTimes = db.transaction('update_times', 'readwrite').objectStore('update_times');
|
||||
osUpdateTimes.put({ table: 'trim_boats', time: serverTimes['trim_boats'] });
|
||||
syncInProgress --;
|
||||
log('trim_boats synced, remaining:', syncInProgress);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
log("Something went wrong (HTTP " + code + ")");
|
||||
log("trim_boats: Something went wrong (HTTP " + code + ")");
|
||||
syncOkay = false;
|
||||
syncInProgress --;
|
||||
log('trim_boats failed, remaining:', syncInProgress);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -765,7 +774,6 @@ function sync() {
|
||||
getJSON(QUERY_URL + 'get_trim_users?changed-after=' + localTimes['trim_users'], function (code, data) {
|
||||
if (code == 200) {
|
||||
var os = db.transaction('trim_users', 'readwrite').objectStore('trim_users');
|
||||
log(data);
|
||||
data.data.forEach(function (entry) {
|
||||
os.put(entry);
|
||||
});
|
||||
@@ -780,12 +788,14 @@ function sync() {
|
||||
var osUpdateTimes = db.transaction('update_times', 'readwrite').objectStore('update_times');
|
||||
osUpdateTimes.put({ table: 'trim_users', time: serverTimes['trim_users'] });
|
||||
syncInProgress --;
|
||||
log('trim_users synced, remaining:', syncInProgress);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
log("Something went wrong (HTTP " + code + ")");
|
||||
log("trim_users: Something went wrong (HTTP " + code + ")");
|
||||
syncOkay = false;
|
||||
syncInProgress --;
|
||||
log('trim_users failed, remaining:', syncInProgress);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -797,7 +807,6 @@ function sync() {
|
||||
getJSON(QUERY_URL + 'get_trim_trims?changed-after=' + localTimes['trim_trims'], function (code, data) {
|
||||
if (code == 200) {
|
||||
var os = db.transaction('trim_trims', 'readwrite').objectStore('trim_trims');
|
||||
log(data);
|
||||
data.data.forEach(function (entry) {
|
||||
os.put(entry);
|
||||
});
|
||||
@@ -812,12 +821,14 @@ function sync() {
|
||||
var osUpdateTimes = db.transaction('update_times', 'readwrite').objectStore('update_times');
|
||||
osUpdateTimes.put({ table: 'trim_trims', time: serverTimes['trim_trims'] });
|
||||
syncInProgress --;
|
||||
log('trim_trims synced, remaining:', syncInProgress);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
log("Something went wrong (HTTP " + code + ")");
|
||||
log("trim_trims: Something went wrong (HTTP " + code + ")");
|
||||
syncOkay = false;
|
||||
syncInProgress --;
|
||||
log('trim_trims failed, remaining:', syncInProgress);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -833,7 +844,6 @@ function sync() {
|
||||
getJSON(QUERY_URL + 'get_news?changed-after=' + localTimes['news'], function (code, data) {
|
||||
if (code == 200) {
|
||||
var os = db.transaction('news', 'readwrite').objectStore('news');
|
||||
log(data);
|
||||
data.data.forEach(function (entry) {
|
||||
os.put(entry);
|
||||
});
|
||||
@@ -848,12 +858,14 @@ function sync() {
|
||||
var osUpdateTimes = db.transaction('update_times', 'readwrite').objectStore('update_times');
|
||||
osUpdateTimes.put({ table: 'news', time: serverTimes['news'] });
|
||||
syncInProgress --;
|
||||
log('news synced, remaining:', syncInProgress);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
log("Something went wrong (HTTP " + code + ")");
|
||||
log("news: Something went wrong (HTTP " + code + ")");
|
||||
syncOkay = false;
|
||||
syncInProgress --;
|
||||
log('news failed, remaining:', syncInProgress);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -865,7 +877,6 @@ function sync() {
|
||||
getJSON(QUERY_URL + 'get_users?changed-after=' + localTimes['users'], function (code, data) {
|
||||
if (code == 200) {
|
||||
var os = db.transaction('users', 'readwrite').objectStore('users');
|
||||
log(data);
|
||||
data.data.forEach(function (entry) {
|
||||
os.put(entry);
|
||||
});
|
||||
@@ -880,12 +891,14 @@ function sync() {
|
||||
var osUpdateTimes = db.transaction('update_times', 'readwrite').objectStore('update_times');
|
||||
osUpdateTimes.put({ table: 'users', time: serverTimes['users'] });
|
||||
syncInProgress --;
|
||||
log('users synced, remaining:', syncInProgress);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
log("Something went wrong (HTTP " + code + ")");
|
||||
log("users: Something went wrong (HTTP " + code + ")");
|
||||
syncOkay = false;
|
||||
syncInProgress --;
|
||||
log('users failed, remaining:', syncInProgress);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -899,6 +912,7 @@ function sync() {
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function checkSync() {
|
||||
@@ -917,7 +931,9 @@ function initDatabase() {
|
||||
if (window.indexedDB) {
|
||||
var request = window.indexedDB.open('regatten_app_db_' + BOATCLASS, DB_VERSION);
|
||||
request.onerror = function (event) {
|
||||
log("Cannot open DB: " + event.target.errorCode);
|
||||
log("Cannot open DB: " + event.target);
|
||||
|
||||
if (typeof onDatabaseLoaded == 'function') onDatabaseLoaded();
|
||||
|
||||
runPageScript();
|
||||
};
|
||||
@@ -935,7 +951,7 @@ function initDatabase() {
|
||||
}
|
||||
|
||||
db.onerror = function (event) {
|
||||
log("DB Error: " + event.target.errorCode);
|
||||
log("DB Error: " + event.target);
|
||||
};
|
||||
|
||||
canUseLocalDB = true;
|
||||
@@ -1034,6 +1050,8 @@ function initDatabase() {
|
||||
osUpdateTimes.put({ table: 'last_sync', time: 0 });
|
||||
}
|
||||
} else {
|
||||
if (typeof onDatabaseLoaded == 'function') onDatabaseLoaded();
|
||||
|
||||
runPageScript();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -470,6 +470,20 @@ var onServiceWorkerLoaded = function() {
|
||||
}
|
||||
|
||||
var onDatabaseLoaded = function() {
|
||||
if (!canUseLocalDB && !$('#menu-welcome').hasClass('menu-active')) {
|
||||
function NoDbWarningOk() {
|
||||
createCookie('regatten_nodb_banner', true, 1);
|
||||
$('#menu-nodb-warning').hideMenu();
|
||||
}
|
||||
function showNoDbWarning() {
|
||||
if (!readCookie('regatten_nodb_banner')) {
|
||||
$('#menu-nodb-warning').showMenu();
|
||||
}
|
||||
}
|
||||
$('#menu-nodb-warning-okay').click(NoDbWarningOk);
|
||||
showNoDbWarning();
|
||||
}
|
||||
|
||||
onServiceWorkerLoaded();
|
||||
initPushSettings();
|
||||
|
||||
|
||||
13
server/content/go2url.php
Normal file
13
server/content/go2url.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
$sp['title'] = 'Umleitung - Regatten.net ' . $_CLASS['name'];
|
||||
|
||||
// Title
|
||||
$content = '<h1>Umleitung</h1>';
|
||||
$content .= '<p>Wir leiten Dich in Kürze zur gewünschten Website weiter</p>';
|
||||
|
||||
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-title']);
|
||||
|
||||
$sp['scripts'] .= $scripts->load('go2url');
|
||||
|
||||
?>
|
||||
@@ -1,21 +1,31 @@
|
||||
<?php
|
||||
|
||||
// TODO: Create site
|
||||
$sp['title'] = 'Saison-Planung bearbeiten - Regatten.net ' . $_CLASS['name'];
|
||||
$sp['backbutton'] = 'planning';
|
||||
$sp['activenav'] = 5;
|
||||
|
||||
$sp['title'] = 'Seite noch nicht unterstuuml;tzt - Regatten.net ' . $_CLASS['name'];
|
||||
$sp['backbutton'] = true;
|
||||
// Title, Inputs
|
||||
$content = "<h1>Saison-Planung bearbeiten</h1>";
|
||||
$content .= $tpl->load('select', ['html-id' => 'select-year', 'placeholder' => 'Jahr', 'css-class' => 'mt-3 mb-0']);
|
||||
|
||||
$content = $tpl->load('error', ['404', 'Seite existiert noch nicht']);
|
||||
$content .= '<p>';
|
||||
$content .= 'Du kannst die Saison-Planung momentan leider noch nicht in der App bearbeiten.<br>';
|
||||
$content .= 'Bis diese Funktion implementiert wurde, erstelle Deine Saison-Planung bitte auf <a target="_blank" href="https://regatten.net/' . BOATCLASS . '/planning_edit">unserer Website</a>.<br>';
|
||||
$content .= 'Deine Saison-Planung wird dann automatisch synchronisiert und ist dann auch in dieser App verfügbar.<br>';
|
||||
$content .= 'Wir arbeiten daran, dass Du Deine Saison-Planung bald auch in der App bearbeiten kannst.<br>';
|
||||
$content .= '</p>';
|
||||
$content .= $tpl->load('button', ['Zur Website', 'https://regatten.net/' . BOATCLASS, 'css-class' => 'mb-3']);
|
||||
$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]);
|
||||
|
||||
$sp['output'] = $tpl->load('card', [$content, 'css-class' => 'text-center pt-3']);
|
||||
// Regattas
|
||||
$content = '<p id="p-count" class="mb-0"></p>';
|
||||
$content .= $tpl->load('input', ['html-id' => 'input-search', 'placeholder' => 'Suche', 'type' => 'text', 'css-class' => 'mt-2']);
|
||||
$content .= '<div id="div-regattas" class="ranking-detail-list mb-0"></div>';
|
||||
|
||||
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-regattas']);
|
||||
|
||||
// Menu
|
||||
$items = $tpl->load('menu/item-switch', ['In die Saison-Planung aufnehmen', 'html-id' => 'switch-planning-include', 'icon' => 'fa-check']);
|
||||
$items .= $tpl->load('menu/item-simple', ['', '#', 'html-id' => 'item-steuermann']);
|
||||
$sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-edit', 'title' => 'Regatta bearbeiten', 'height' => 320]);
|
||||
|
||||
// Select sailor
|
||||
$items = $tpl->load('input', ['html-id' => 'input-edit-search', 'placeholder' => 'Suche', 'type' => 'text']);
|
||||
$sp['menus'] .= $tpl->load('menu/modal', [$items, 'html-id' => 'menu-sailor', 'height' => 500, 'width' => 350]);
|
||||
|
||||
$sp['scripts'] .= $scripts->load('planning_edit');
|
||||
|
||||
?>
|
||||
|
||||
@@ -291,6 +291,21 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="menu-nodb-warning" class="menu menu-box-bottom menu-box-detached rounded-m" data-height="500">
|
||||
<div class="menu-title"><h1>Warnung</h1><p class="color-highlight">Datenbank nicht unterstützt</p><a href="#" class="close-menu"><i class="fa fa-times"></i></a></div>
|
||||
<div class="divider divider-margins mb-n2"></div>
|
||||
<div class="content bottom-0">
|
||||
<p>
|
||||
Das Speichern der benötigten Daten wird von Deinem Gerät nicht unterstützt.<br>
|
||||
Da deshalb die Daten jedesmal direkt vom Server geladen werden müssen, kannst Du die App nicht offline nutzen.<br>
|
||||
Das Nachladen kann außerdem gerade bei großen Datenmengen (wie Ranglisten) sehr lange dauern.
|
||||
Wir empfehlen Dir daher, auf diesem Gerät unsere normale Website zu benutzen. Diese ist auch für Mobil-Geräte optimiert.
|
||||
</p>
|
||||
<a class="btn btn-m mt-2 btn-full bg-highlight text-uppercase font-900" href="https://regatten.net/">Zur Website</a>
|
||||
<a id="menu-nodb-warning-okay" class="btn btn-m mt-2 mb-3 btn-full bg-highlight text-uppercase font-900" href="#">Nicht erneut anzeigen</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="menu-update">
|
||||
<div class="content bottom-0">
|
||||
<p class="text-center mt-5"><i class="fa fa-sync-alt fa-7x color-highlight fa-spin"></i></p>
|
||||
|
||||
@@ -27,7 +27,8 @@
|
||||
<?php include(__DIR__ . '/headerfooter.php'); ?>
|
||||
|
||||
<!--start of page content, add your stuff here-->
|
||||
<div class="page-content header-clear-medium">
|
||||
<div class="page-content header-clear">
|
||||
<div id="syncstatus" class="text-right mr-2 mb-1">Zuletzt aktualisiert: nie</div>
|
||||
<?php echo $sp['output']; ?>
|
||||
</div>
|
||||
<!--end of page content, off canvas elements here-->
|
||||
|
||||
12
server/scripts/go2url.js
Normal file
12
server/scripts/go2url.js
Normal file
@@ -0,0 +1,12 @@
|
||||
var siteScript = function() {
|
||||
hideLoader();
|
||||
setTimeout(function() {
|
||||
var url = findGetParameter('url');
|
||||
if (url === null) {
|
||||
$('#card-title').find('p').html('Wir konnten Dich leider nicht umleiten.<br><a href="' + LINK_PRE + 'index">Hier kommst Du zurück zur Startseite</a>');
|
||||
} else {
|
||||
showLoader();
|
||||
location.href = url;
|
||||
}
|
||||
}, 2000);
|
||||
}
|
||||
@@ -50,7 +50,7 @@ var siteScript = async function() {
|
||||
// Your next
|
||||
var planningsDB = await dbGetDataIndex('plannings', 'user', user.id);
|
||||
var minDate = getToday();
|
||||
minDate.setDate(minDate.getDate() - 1);
|
||||
minDate.setDate(minDate.getDate());
|
||||
var maxDate = getToday();
|
||||
maxDate.setDate(maxDate.getDate() + 28);
|
||||
var regattas = await dbGetRegattasRange(minDate, maxDate);
|
||||
@@ -166,7 +166,7 @@ var siteScript = async function() {
|
||||
|
||||
// Next
|
||||
var minDate = getToday();
|
||||
minDate.setDate(minDate.getDate() - 1);
|
||||
minDate.setDate(minDate.getDate());
|
||||
var maxDate = getToday();
|
||||
maxDate.setDate(maxDate.getDate() + 14);
|
||||
var regattas = await dbGetRegattasRange(minDate, maxDate);
|
||||
|
||||
@@ -18,13 +18,13 @@ async function planningSwitchChanged() {
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
if (xhr.status == 401) {
|
||||
console.log('authentification failed');
|
||||
log('authentification failed');
|
||||
toastError('Authentifizierung fehlgeschlagen. Versuche es erneut.');
|
||||
} else if (xhr.status == 0) {
|
||||
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um den Status zu ändern');
|
||||
} else {
|
||||
console.log('Login: unbekannter Fehler', status, error);
|
||||
console.log(xhr);
|
||||
log('Login: unbekannter Fehler', status, error);
|
||||
log(xhr);
|
||||
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
||||
}
|
||||
$('#menu-status').hideMenu();
|
||||
@@ -35,8 +35,6 @@ async function planningSwitchChanged() {
|
||||
hideLoader();
|
||||
}
|
||||
});
|
||||
console.log(id, gemeldet, bezahlt);
|
||||
hideLoader();
|
||||
}
|
||||
|
||||
async function planningEditStatus(id) {
|
||||
|
||||
473
server/scripts/planning_edit.js
Normal file
473
server/scripts/planning_edit.js
Normal file
@@ -0,0 +1,473 @@
|
||||
async function planningSwitchChanged() {
|
||||
showLoader();
|
||||
var id = $('#switch-planning-include').data('regatta');
|
||||
var include = $('#switch-planning-include').prop('checked');
|
||||
var auth = {
|
||||
id: localStorage.getItem('auth_id'),
|
||||
hash: localStorage.getItem('auth_hash')
|
||||
}
|
||||
if (include) {
|
||||
// add to planning
|
||||
$.ajax({
|
||||
url: QUERY_URL + 'planning_add',
|
||||
method: 'POST',
|
||||
data: {
|
||||
auth: auth,
|
||||
regatta: id
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
if (xhr.status == 401) {
|
||||
log('authentification failed');
|
||||
toastError('Authentifizierung fehlgeschlagen. Versuche es erneut.');
|
||||
} else if (xhr.status == 0) {
|
||||
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um die Änderungen zu speichern');
|
||||
} else {
|
||||
log('planning_add: unbekannter Fehler', status, error);
|
||||
log(xhr);
|
||||
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
||||
}
|
||||
$('#menu-edit').hideMenu();
|
||||
hideLoader();
|
||||
},
|
||||
success: async function (data, status, xhr) {
|
||||
await sync();
|
||||
planningEdit(id);
|
||||
hideLoader();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// remove from planning
|
||||
$.ajax({
|
||||
url: QUERY_URL + 'planning_remove',
|
||||
method: 'POST',
|
||||
data: {
|
||||
auth: auth,
|
||||
regatta: id
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
if (xhr.status == 401) {
|
||||
log('authentification failed');
|
||||
toastError('Authentifizierung fehlgeschlagen. Versuche es erneut.');
|
||||
} else if (xhr.status == 0) {
|
||||
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um die Änderungen zu speichern');
|
||||
} else {
|
||||
log('planning_remove: unbekannter Fehler', status, error);
|
||||
log(xhr);
|
||||
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
||||
}
|
||||
$('#menu-edit').hideMenu();
|
||||
hideLoader();
|
||||
},
|
||||
success: async function (data, status, xhr) {
|
||||
await sync();
|
||||
planningEdit(id);
|
||||
hideLoader();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var sailorIsSteuermann;
|
||||
var sailors = [];
|
||||
|
||||
async function sailorSelected(sid) {
|
||||
$('#menu-sailor').hideMenu();
|
||||
showLoader();
|
||||
var rid = $('#switch-planning-include').data('regatta');
|
||||
var action = (sailorIsSteuermann ? 'planning_set_steuermann' : 'planning_add_crew');
|
||||
// add sailor
|
||||
var auth = {
|
||||
id: localStorage.getItem('auth_id'),
|
||||
hash: localStorage.getItem('auth_hash')
|
||||
}
|
||||
$.ajax({
|
||||
url: QUERY_URL + action,
|
||||
method: 'POST',
|
||||
data: {
|
||||
auth: auth,
|
||||
regatta: rid,
|
||||
sailor: sid
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
if (xhr.status == 401) {
|
||||
log('authentification failed');
|
||||
toastError('Authentifizierung fehlgeschlagen. Versuche es erneut.');
|
||||
} else if (xhr.status == 0) {
|
||||
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um die Änderungen zu speichern');
|
||||
} else {
|
||||
log(action + ': unbekannter Fehler', status, error);
|
||||
log(xhr);
|
||||
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
||||
}
|
||||
hideLoader();
|
||||
},
|
||||
success: async function (data, status, xhr) {
|
||||
await sync();
|
||||
planningEdit(rid);
|
||||
hideLoader();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function sailorsSearch() {
|
||||
$('.item-sailor-search').remove();
|
||||
if (sailorIsSteuermann) {
|
||||
var item = '<a class="item-sailor-search" onclick="sailorSelected(null)">';
|
||||
item += '<span style="font-style:italic;">noch unklar</span>';
|
||||
item += '<i class="fa fa-angle-right"></i>';
|
||||
item += '</a>';
|
||||
$('#menu-sailor').find('.content').find('.list-group').append(item);
|
||||
}
|
||||
if ($('#input-edit-search').val().length >= 3) {
|
||||
sailors.forEach(function (entry) {
|
||||
if (search($('#input-edit-search').val(), entry.keywords)) {
|
||||
$('#menu-sailor').find('.content').find('.list-group').append(entry.content);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
var item = '<p class="item-sailor-search">Gib mindestens 3 Zeichen ein</p>';
|
||||
$('#menu-sailor').find('.content').find('.list-group').append(item);
|
||||
}
|
||||
}
|
||||
|
||||
async function initSailors() {
|
||||
sailors = [];
|
||||
var dbSailors = await dbGetData('sailors');
|
||||
dbSailors.sort(function(a,b){
|
||||
return a.name.localeCompare(b.name);
|
||||
});
|
||||
for (s in dbSailors) {
|
||||
var item = '<a class="item-sailor-search" onclick="sailorSelected(' + dbSailors[s].id + ')">';
|
||||
item += '<span>' + dbSailors[s].name + '</span>';
|
||||
item += '<i class="fa fa-angle-right"></i>';
|
||||
item += '</a>';
|
||||
sailors.push({
|
||||
keywords: [dbSailors[s].name],
|
||||
content: item
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function planningChangeCrew(sid = null) {
|
||||
if (sid !== null) {
|
||||
showLoader();
|
||||
var rid = $('#switch-planning-include').data('regatta');
|
||||
// remove sailor
|
||||
var auth = {
|
||||
id: localStorage.getItem('auth_id'),
|
||||
hash: localStorage.getItem('auth_hash')
|
||||
}
|
||||
$.ajax({
|
||||
url: QUERY_URL + 'planning_remove_crew',
|
||||
method: 'POST',
|
||||
data: {
|
||||
auth: auth,
|
||||
regatta: rid,
|
||||
sailor: sid
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
if (xhr.status == 401) {
|
||||
log('authentification failed');
|
||||
toastError('Authentifizierung fehlgeschlagen. Versuche es erneut.');
|
||||
} else if (xhr.status == 0) {
|
||||
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um die Änderungen zu speichern');
|
||||
} else {
|
||||
log('planning_remove_crew: unbekannter Fehler', status, error);
|
||||
log(xhr);
|
||||
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
||||
}
|
||||
$('#menu-edit').hideMenu();
|
||||
hideLoader();
|
||||
},
|
||||
success: async function (data, status, xhr) {
|
||||
await sync();
|
||||
planningEdit(rid);
|
||||
hideLoader();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
sailorIsSteuermann = false;
|
||||
$('#input-edit-search').val('').trigger('focusin').trigger('focusout');
|
||||
sailorsSearch();
|
||||
$('#menu-edit').hideMenu();
|
||||
$('#menu-sailor').find('.menu-title').find('h1').text('Crew hinzufügen');
|
||||
$('#menu-sailor').showMenu();
|
||||
$('#input-edit-search').focus();
|
||||
}
|
||||
}
|
||||
|
||||
async function planningChangeSteuermann() {
|
||||
sailorIsSteuermann = true;
|
||||
$('#input-edit-search').val('').trigger('focusin').trigger('focusout');
|
||||
sailorsSearch();
|
||||
$('#menu-edit').hideMenu();
|
||||
$('#menu-sailor').find('.menu-title').find('h1').text('Steuermann/-frau bearbeiten');
|
||||
$('#menu-sailor').showMenu();
|
||||
$('#input-edit-search').focus();
|
||||
}
|
||||
|
||||
async function planningEdit(id) {
|
||||
var regatta = await dbGetData('regattas', id);
|
||||
|
||||
$('#menu-edit').find('.menu-title').find('p').text(regatta.name);
|
||||
|
||||
var plannings = await dbGetDataIndex('plannings', 'regatta', regatta['id']);
|
||||
var planning = null;
|
||||
if (isLoggedIn()) {
|
||||
for (i in plannings) {
|
||||
if (plannings[i]['user'] == USER_ID) {
|
||||
planning = plannings[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$('#switch-planning-include').data('regatta', id);
|
||||
if (planning !== null) {
|
||||
$('#switch-planning-include').prop('checked', true);
|
||||
$('#item-steuermann').show();
|
||||
if (planning.steuermann !== null) {
|
||||
$('#item-steuermann').find('span').text('Am Steuer: ' + (await dbGetData('sailors', planning.steuermann)).name);
|
||||
} else {
|
||||
$('#item-steuermann').find('span').html('Am Steuer: <font style="font-style:italic;">noch unklar</font>');
|
||||
}
|
||||
$('.item-crew').remove();
|
||||
var crew = planning.crew.split(',');
|
||||
for (c in crew) {
|
||||
var sailor = await dbGetData('sailors', crew[c]);
|
||||
if (sailor !== null) {
|
||||
var item = '<a class="item-crew" onclick="planningChangeCrew(' + sailor.id + ')">';
|
||||
item += '<span>' + sailor.name + '</span>';
|
||||
item += '<i class="fa fa-angle-right"></i>';
|
||||
item += '</a>';
|
||||
$('#menu-edit').find('.content').find('.list-group').append(item);
|
||||
}
|
||||
}
|
||||
var item = '<a class="item-crew" onclick="planningChangeCrew()">';
|
||||
item += '<span style="font-style:italic;">Weiteren Segler hinzufügen</span>';
|
||||
item += '<i class="fa fa-angle-right"></i>';
|
||||
item += '</a>';
|
||||
$('#menu-edit').find('.content').find('.list-group').append(item);
|
||||
} else {
|
||||
$('#switch-planning-include').prop('checked', false);
|
||||
$('#item-steuermann').hide();
|
||||
$('.item-crew').remove();
|
||||
}
|
||||
$('#menu-edit').showMenu();
|
||||
}
|
||||
|
||||
function selectChange() {
|
||||
var val = $('#select-year').val();
|
||||
|
||||
if (typeof siteScript === 'function') {
|
||||
history.replaceState(null, '', '?year=' + val);
|
||||
siteScript();
|
||||
}
|
||||
}
|
||||
|
||||
function initYear() {
|
||||
var year = findGetParameter('year');
|
||||
if (year === null) year = new Date().getFullYear();
|
||||
|
||||
$('#select-year').html('<option value="' + year + '">' + year + '</option>');
|
||||
$('#select-year').val(year);
|
||||
}
|
||||
|
||||
var firstCall = true;
|
||||
var rows = [];
|
||||
var today;
|
||||
|
||||
async function drawList () {
|
||||
window.setTimeout(function () {
|
||||
var list = '';
|
||||
rows.forEach(function (entry) {
|
||||
if (entry == null) {
|
||||
list += '<div><div align="center" class="color-highlight"><b>Heute ist der ' + formatDate('d.m.Y', today) + '</b></div></div>';
|
||||
} else if (search($('#input-search').val(), entry.keywords)) {
|
||||
list += entry.content;
|
||||
}
|
||||
});
|
||||
$('#div-regattas').html(list);
|
||||
}, 0);
|
||||
}
|
||||
|
||||
var siteScript = async function() {
|
||||
if (!isLoggedIn()) {
|
||||
location.href = LINK_PRE + 'planning';
|
||||
return;
|
||||
}
|
||||
|
||||
if (firstCall) {
|
||||
firstCall = false;
|
||||
initYear();
|
||||
$('#select-year').change(selectChange);
|
||||
$('#input-search').on('input', drawList);
|
||||
$('#switch-planning-include').parent().parent().click(planningSwitchChanged);
|
||||
$('#item-steuermann').click(planningChangeSteuermann);
|
||||
$('#input-edit-search').on('input', sailorsSearch);
|
||||
initSailors();
|
||||
}
|
||||
|
||||
today = getToday();
|
||||
|
||||
var selectedYear = $('#select-year').val();
|
||||
var minDate = parseDate(selectedYear + '-01-01');
|
||||
var maxDate = parseDate(selectedYear + '-12-31');
|
||||
var regattas = await dbGetRegattasRange(minDate, maxDate);
|
||||
var plannings = await dbGetDataIndex('plannings', 'user', USER_ID);
|
||||
for (var i = regattas.length - 1; i >= 0; i --) {
|
||||
var entry = regattas[i];
|
||||
var okay = false;
|
||||
for (p in plannings) {
|
||||
if (plannings[p].regatta == entry.id) {
|
||||
regattas[i].planning = plannings[p];
|
||||
okay = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!okay) {
|
||||
regattas[i].planning = null;
|
||||
}
|
||||
}
|
||||
|
||||
var years = await dbGetData('years');
|
||||
years.sort(function (a, b) {
|
||||
if (a['year'] > b['year']) return -1;
|
||||
if (a['year'] < b['year']) return 1;
|
||||
return 0;
|
||||
});
|
||||
var options = '';
|
||||
for (id in years) {
|
||||
var year = years[id]['year'];
|
||||
options += '<option value="' + year + '">' + year + '</option>';
|
||||
}
|
||||
$('#select-year').html(options);
|
||||
$('#select-year').val(selectedYear);
|
||||
|
||||
var count = regattas.length;
|
||||
if (count > 0) {
|
||||
if (count == 1) {
|
||||
$('#p-count').html('Es wurde 1 Regatta gefunden!');
|
||||
} else {
|
||||
$('#p-count').html('Es wurden ' + count + ' Regatten gefunden!');
|
||||
}
|
||||
$('#div-regattas').show();
|
||||
$('#input-search').parent().show();
|
||||
|
||||
var heute = false;
|
||||
|
||||
rows = [];
|
||||
|
||||
for (id in regattas) {
|
||||
var entry = regattas[id];
|
||||
var club = null;
|
||||
if (entry['club'] != null)
|
||||
club = await dbGetData('clubs', entry['club']);
|
||||
if (entry.planning !== null) {
|
||||
if (entry.planning.steuermann !== null) {
|
||||
entry.planning.steuermann = (await dbGetData('sailors', entry.planning.steuermann)).name;
|
||||
}
|
||||
var crewString = entry.planning.crew.split(',');
|
||||
entry.planning.crew = [];
|
||||
for (c in crewString) {
|
||||
var sailor = await dbGetData('sailors', crewString[c]);
|
||||
if (sailor !== null) {
|
||||
entry.planning.crew.push(sailor.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var dateFrom = entry['dateFrom'];
|
||||
var dateTo = entry['dateTo'];
|
||||
|
||||
var row = { keywords: [], content: '' };
|
||||
row.keywords.push(entry['name']);
|
||||
if (entry['number'] != null) row.keywords.push(entry['number']);
|
||||
if (club != null) row.keywords.push(club['kurz'], club['name']);
|
||||
|
||||
if (!heute && (today <= dateFrom)) {
|
||||
rows.push(null);
|
||||
heute = true;
|
||||
}
|
||||
|
||||
if (entry.planning !== null) {
|
||||
row.content += '<div onclick="planningEdit(' + entry['id'] + ');">';
|
||||
} else {
|
||||
row.content += '<div onclick="planningEdit(' + entry['id'] + ');" style="opacity:0.5;">';
|
||||
}
|
||||
|
||||
// ZEILE 1
|
||||
// Name
|
||||
row.content += '<div><b>' + (entry['canceled'] == 1 ? '<s>' : '') + entry['name'] + (entry['canceled'] == 1 ? '</s>' : '') + '</b></div>';
|
||||
|
||||
// ZEILE 2
|
||||
row.content += '<div>';
|
||||
|
||||
// Number
|
||||
row.content += '<div>' + ((entry['number'] != null) ? ('# ' + entry['number']) : '') + '</div>';
|
||||
|
||||
// Special
|
||||
row.content += '<div>' + entry['special'] + '</div>';
|
||||
|
||||
// Club
|
||||
row.content += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
|
||||
|
||||
row.content += '</div>';
|
||||
|
||||
// ZEILE 3
|
||||
row.content += '<div>';
|
||||
|
||||
// Date
|
||||
if (entry['length'] < 1) {
|
||||
if (formatDate('d.m', dateFrom) == '01.01') {
|
||||
row.content += '<div><font class="color-red2-dark">Datum noch unklar</font></div>';
|
||||
} else {
|
||||
row.content += '<div>' + formatDate("d.m.Y", dateFrom) + ' - <font class="color-red2-dark">Datum nicht final</font></div>';
|
||||
}
|
||||
} else {
|
||||
row.content += '<div>' + formatDate("d.m.Y", dateFrom) + ' - ' + formatDate("d.m.Y", dateTo) + '</div>';
|
||||
}
|
||||
|
||||
// RLF
|
||||
row.content += '<div>' + parseFloat(entry['rlf']).toFixed(2) + '</div>';
|
||||
|
||||
row.content += '</div>';
|
||||
|
||||
if (entry.planning !== null) {
|
||||
// ZEILE 4
|
||||
row.content += '<div></div>';
|
||||
|
||||
// ZEILE 5
|
||||
row.content += '<div>';
|
||||
row.content += '<div>' + (entry.planning.steuermann !== null ? entry.planning.steuermann : 'noch unklar') + '</div>';
|
||||
row.content += '</div>';
|
||||
|
||||
// ZEILE 6...
|
||||
for (var i in entry.planning.crew) {
|
||||
row.content += '<div>';
|
||||
row.content += '<div>' + entry.planning.crew[i] + '</div>';
|
||||
row.content += '</div>';
|
||||
}
|
||||
} else {
|
||||
row.content += '<div>Du planst nicht, hierhin zu fahren</div>';
|
||||
}
|
||||
|
||||
row.content += '</div>';
|
||||
|
||||
rows.push(row);
|
||||
}
|
||||
|
||||
if (!heute) {
|
||||
rows.push(null);
|
||||
}
|
||||
|
||||
drawList();
|
||||
|
||||
} else {
|
||||
$('#p-count').html('Keine Regatten gefunden!');
|
||||
$('#div-regattas').hide();
|
||||
$('#input-search').parent().hide();
|
||||
}
|
||||
|
||||
hideLoader();
|
||||
}
|
||||
@@ -83,12 +83,6 @@ var siteScript = async function() {
|
||||
regattas.splice(i, 1);
|
||||
}
|
||||
}
|
||||
var regattaResults = [];
|
||||
for (id in regattas) {
|
||||
var entry = regattas[id];
|
||||
var results = await dbGetDataIndex('results', 'regatta', entry['id']);
|
||||
regattaResults[entry['id']] = (results.length > 0);
|
||||
}
|
||||
|
||||
var years = await dbGetData('years');
|
||||
years.sort(function (a, b) {
|
||||
@@ -194,7 +188,7 @@ var siteScript = async function() {
|
||||
|
||||
// ZEILE 5
|
||||
row.content += '<div>';
|
||||
row.content += '<div>' + entry.planning.steuermann + '</div>';
|
||||
row.content += '<div>' + (entry.planning.steuermann !== null ? entry.planning.steuermann : 'noch unklar') + '</div>';
|
||||
row.content += '</div>';
|
||||
|
||||
// ZEILE 6...
|
||||
@@ -205,72 +199,7 @@ var siteScript = async function() {
|
||||
}
|
||||
|
||||
row.content += '</div>';
|
||||
/*
|
||||
// ZEILE 2
|
||||
row.content += '<div>';
|
||||
|
||||
// Number
|
||||
row.content += '<div>' + ((entry['number'] != null) ? ('# ' + entry['number']) : '') + '</div>';
|
||||
|
||||
// Club
|
||||
row.content += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
|
||||
|
||||
// Special
|
||||
row.content += '<div>' + entry['special'] + '</div>';
|
||||
|
||||
// Icons
|
||||
var icons = [];
|
||||
if (entry['info'] != '')
|
||||
icons.push('<i class="fas fa-info"></i>');
|
||||
if ((entry['meldung'] != '') && (dateTo >= today) && (entry['meldungOffen'] == '1')) {
|
||||
var color = '';
|
||||
if (entry['meldungSchluss'] != null) {
|
||||
var ms = 0;
|
||||
if (entry['meldungEarly'] != null) {
|
||||
ms = parseDate(entry['meldungEarly']);
|
||||
}
|
||||
if (ms < today) {
|
||||
ms = parseDate(entry['meldungSchluss']);
|
||||
}
|
||||
var diff = Math.round((ms - today) / 86400000);
|
||||
if (ms < today) {
|
||||
color = ' color-red2-dark';
|
||||
} else if (diff < 7) {
|
||||
color = ' color-yellow2-dark';
|
||||
}
|
||||
}
|
||||
icons.push('<i class="fas fa-file-signature' + color + '"></i>');
|
||||
}
|
||||
if (entry['bericht'] != '')
|
||||
icons.push('<i class="fas fa-book"></i>');
|
||||
if (entry['canceled'] == '1') {
|
||||
icons.push('<i class="fas fa-times color-red2-dark"></i>');
|
||||
} else if (regattaResults[entry['id']]) {
|
||||
icons.push('<i class="fas fa-poll"></i>');
|
||||
}
|
||||
row.content += '<div class="color-green2-dark">' + icons.join(' ') + '</div>';
|
||||
|
||||
row.content += '</div>';
|
||||
|
||||
// ZEILE 3
|
||||
row.content += '<div>';
|
||||
|
||||
// Date
|
||||
if (entry['length'] < 1) {
|
||||
if (formatDate('d.m', dateFrom) == '01.01') {
|
||||
row.content += '<div><font class="color-red2-dark">Datum noch unklar</font></div>';
|
||||
} else {
|
||||
row.content += '<div>' + formatDate("d.m.Y", dateFrom) + ' - <font class="color-red2-dark">Datum nicht final</font></div>';
|
||||
}
|
||||
} else {
|
||||
row.content += '<div>' + formatDate("d.m.Y", dateFrom) + ' - ' + formatDate("d.m.Y", dateTo) + '</div>';
|
||||
}
|
||||
|
||||
// RLF
|
||||
row.content += '<div>' + parseFloat(entry['rlf']).toFixed(2) + '</div>';
|
||||
|
||||
row.content += '</div></div>';
|
||||
*/
|
||||
rows.push(row);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
define('PWA_VERSION', '1.9');
|
||||
define('PWA_VERSION', '1.10.3');
|
||||
|
||||
?>
|
||||
|
||||
@@ -229,6 +229,7 @@ self.addEventListener('push', async function(event) {
|
||||
case 'meldeschluss':
|
||||
if (await dbSettingsGet('notify_channel_<?php echo BOATCLASS; ?>_meldeschluss')) {
|
||||
if (await isMyRegatta(getEntry(data, 'id', ''))) okay = true;
|
||||
// TODO: only if not already registered
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user