Compare commits
74 Commits
v_1.11.7
...
fix_expend
| Author | SHA1 | Date | |
|---|---|---|---|
| b63b4c6714 | |||
| 595c684e23 | |||
| 3c0c2a3f2e | |||
| ac9b5ef652 | |||
| 099fb6deb6 | |||
| f3e1620057 | |||
| b52eea79c2 | |||
| 8972d2d72a | |||
| 49ed27e58f | |||
| 9a5d90a703 | |||
| bceca97c98 | |||
| 52c6914d41 | |||
| 0a323be5bf | |||
| 2242cedfea | |||
| 69dcb13f50 | |||
| 5dc88a78a2 | |||
| a221c86431 | |||
| 839f668b08 | |||
| 8f597051dd | |||
| dd587f7603 | |||
| 0e501e8ba4 | |||
| 42e68e5511 | |||
| 2971fdd259 | |||
| 9360f0e943 | |||
| 47718318ef | |||
| bd4fc4c255 | |||
| 1ab0e9185f | |||
| 027abe5364 | |||
|
|
29f83814ee | ||
|
|
deb23a5f7f | ||
|
|
744be24410 | ||
|
|
633e39ce5d | ||
|
|
bd2aafe67c | ||
|
|
2e6eb25e68 | ||
|
|
dc2ead3a07 | ||
|
|
ccc8731394 | ||
|
|
6b89acf422 | ||
|
|
54ceae6ce0 | ||
|
|
fe02f8707b | ||
|
|
a6f0c8e0f5 | ||
|
|
fe90438cb3 | ||
|
|
8c4d2f00cd | ||
|
|
34ae418598 | ||
|
|
d59b384e1a | ||
|
|
25df9995dd | ||
|
|
12538aaa3f | ||
|
|
e087e137ff | ||
|
|
e5dc107a7d | ||
|
|
fefd3c8929 | ||
|
|
dcc5428615 | ||
|
|
a37cf0ea46 | ||
|
|
49f2923a97 | ||
|
|
b2c57839c4 | ||
|
|
eddf0f151b | ||
|
|
0dd83a47cb | ||
|
|
3c07c67a1a | ||
|
|
dd7d8731e8 | ||
|
|
2caf6c4339 | ||
|
|
866d3ab3c1 | ||
|
|
6b503eeae0 | ||
|
|
a88c8356c2 | ||
|
|
ba09698ece | ||
|
|
ea3ac5f329 | ||
|
|
abe412d8ed | ||
|
|
e25ca534ec | ||
|
|
4f01262eba | ||
|
|
314792b09e | ||
|
|
a9464c382b | ||
|
|
d204acd365 | ||
|
|
00dc405158 | ||
|
|
b87f557a62 | ||
|
|
689845d02a | ||
|
|
ae8aed446b | ||
|
|
c88a512ff8 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,3 +3,4 @@ server/config.php
|
||||
api/config.php
|
||||
.htaccess
|
||||
!.keepfolder
|
||||
.idea
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const DB_VERSION = 8;
|
||||
const DB_VERSION = 10;
|
||||
|
||||
const USER_ID = localStorage.getItem('auth_user');
|
||||
const USER_NAME = localStorage.getItem('auth_username');
|
||||
@@ -44,15 +44,17 @@ function search(string, fields) {
|
||||
var keywords = string.split(' ');
|
||||
for (kid in keywords) {
|
||||
var keyword = keywords[kid].toLowerCase();
|
||||
var found = false;
|
||||
for (fid in fields) {
|
||||
var field = fields[fid].toLowerCase();
|
||||
if (field.indexOf(keyword) >= 0) {
|
||||
found = true;
|
||||
break;
|
||||
if (keyword != '') {
|
||||
var found = false;
|
||||
for (fid in fields) {
|
||||
var field = fields[fid].toLowerCase();
|
||||
if (field.indexOf(keyword) >= 0) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) return false;
|
||||
}
|
||||
if (!found) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -163,6 +165,15 @@ function dbGetResultCalculated(regatta) {
|
||||
if (results.length > 0) {
|
||||
|
||||
var gemeldet = results.length;
|
||||
var started = [];
|
||||
for (var i = 0; i < regatta['races']; i++) {
|
||||
started[i] = 0;
|
||||
for (id in results) {
|
||||
if (results[id]['race' + (i + 1)] != 'DNC') {
|
||||
started[i]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (id in results) {
|
||||
results[id]['finished'] = false;
|
||||
@@ -179,24 +190,25 @@ function dbGetResultCalculated(regatta) {
|
||||
results[id]['texts'][i] = race;
|
||||
results[id]['finished'] = true;
|
||||
} else {
|
||||
var p1points = (regatta.a53 ? started[i] : gemeldet) + 1;
|
||||
switch (race.toUpperCase()) {
|
||||
// Nicht gestartet
|
||||
case 'DNC': results[id]['values'][i] = gemeldet + 1; copy[i] = gemeldet + 1; break; // Did not come
|
||||
case 'DNS': results[id]['values'][i] = gemeldet + 1; copy[i] = gemeldet + 1; break; // Did not started
|
||||
case 'DNS': results[id]['values'][i] = p1points; copy[i] = p1points; break; // Did not started
|
||||
// Startfehler
|
||||
case 'OCS': results[id]['values'][i] = gemeldet + 1; copy[i] = gemeldet + 1; break; // On course site
|
||||
case 'UFD': results[id]['values'][i] = gemeldet + 1; copy[i] = gemeldet + 1; break; // Uniform Flag Disqualified (disqu. nach 30.3)
|
||||
case 'BFD': results[id]['values'][i] = gemeldet + 1; copy[i] = gemeldet + 1; break; // Black Flag Disqualified (disqu. nach 30.4)
|
||||
case 'OCS': results[id]['values'][i] = p1points; copy[i] = p1points; break; // On course site
|
||||
case 'UFD': results[id]['values'][i] = p1points; copy[i] = p1points; break; // Uniform Flag Disqualified (disqu. nach 30.3)
|
||||
case 'BFD': results[id]['values'][i] = p1points; copy[i] = p1points; break; // Black Flag Disqualified (disqu. nach 30.4)
|
||||
// Nicht durch Ziel gegangen
|
||||
case 'DNF': results[id]['values'][i] = gemeldet + 1; copy[i] = gemeldet + 1; break; // Did not finish
|
||||
case 'RET': results[id]['values'][i] = gemeldet + 1; copy[i] = gemeldet + 1; break; // Retired (Aufgegeben)
|
||||
case 'RAF': results[id]['values'][i] = gemeldet + 1; copy[i] = gemeldet + 1; break; // Retired after finish
|
||||
case 'DNF': results[id]['values'][i] = p1points; copy[i] = p1points; break; // Did not finish
|
||||
case 'RET': results[id]['values'][i] = p1points; copy[i] = p1points; break; // Retired (Aufgegeben)
|
||||
case 'RAF': results[id]['values'][i] = p1points; copy[i] = p1points; break; // Retired after finish
|
||||
// Kursfehler
|
||||
case 'NSC': results[id]['values'][i] = gemeldet + 1; copy[i] = gemeldet + 1; break; // Not sailed course
|
||||
case 'NSC': results[id]['values'][i] = p1points; copy[i] = p1points; break; // Not sailed course
|
||||
// Disqualifizierun
|
||||
case 'DSQ': results[id]['values'][i] = gemeldet + 1; copy[i] = gemeldet + 1; break; // Disqualified
|
||||
case 'DNE': results[id]['values'][i] = gemeldet + 1; copy[i] = -1; break; // Disqualified, not excludable (disqu. kann nach 90.3(b) nicht gestrichen werden)
|
||||
case 'DGM': results[id]['values'][i] = gemeldet + 1; copy[i] = -2; break; // Disqualification Gross Missconduct (kann nach 69.1(b)(2) nicht gestr. werden, grobes Fehlverhalten)
|
||||
case 'DSQ': results[id]['values'][i] = p1points; copy[i] = p1points; break; // Disqualified
|
||||
case 'DNE': results[id]['values'][i] = p1points; copy[i] = -1; break; // Disqualified, not excludable (disqu. kann nach 90.3(b) nicht gestrichen werden)
|
||||
case 'DGM': results[id]['values'][i] = p1points; copy[i] = -2; break; // Disqualification Gross Missconduct (kann nach 69.1(b)(2) nicht gestr. werden, grobes Fehlverhalten)
|
||||
// Unbekannt
|
||||
default: results[id]['values'][i] = 0; copy[i] = 0; break;
|
||||
}
|
||||
@@ -224,9 +236,10 @@ function dbGetResultCalculated(regatta) {
|
||||
var netto = 0;
|
||||
for (var i = 0; i < regatta['races']; i ++) {
|
||||
brutto += results[id]['values_all'][i];
|
||||
if (copy[i] == -1) { results[id]['values'][i] = gemeldet + 1; }
|
||||
/*if (copy[i] == -1) { results[id]['values'][i] = gemeldet + 1; }
|
||||
else if (copy[i] == -2) { results[id]['values'][i] = gemeldet + 1; }
|
||||
else { results[id]['values'][i] = copy[i]; }
|
||||
else { results[id]['values'][i] = copy[i]; }*/
|
||||
if (copy[i] == 0) results[id]['values'][i] = 0;
|
||||
if (results[id]['values'][i] == 0) {
|
||||
results[id]['texts'][i] = '[' + results[id]['texts'][i] + ']';
|
||||
}
|
||||
@@ -258,7 +271,7 @@ function dbGetResultCalculated(regatta) {
|
||||
});
|
||||
}
|
||||
|
||||
function dbGetRanking(minDate, maxDate, maxAge, ageStrict, altM = 9, ageCrew = false) {
|
||||
function dbGetRanking(minDate, maxDate, maxAge, ageStrict, altM = 9, ageCrew = false, personMode = 0) {
|
||||
return new Promise(async function(resolve) {
|
||||
var rankNoResults = [];
|
||||
|
||||
@@ -288,6 +301,7 @@ function dbGetRanking(minDate, maxDate, maxAge, ageStrict, altM = 9, ageCrew = f
|
||||
// regatta has to have rlf
|
||||
if (regatta.rlf == 0) continue;
|
||||
|
||||
// get results
|
||||
var results = await dbGetDataIndex('results', 'regatta', regatta.id);
|
||||
if (results.length <= 0) {
|
||||
if (regatta.dateTo <= getToday()) {
|
||||
@@ -339,8 +353,10 @@ function dbGetRanking(minDate, maxDate, maxAge, ageStrict, altM = 9, ageCrew = f
|
||||
// check if crew is youth
|
||||
if ((maxAge != false) && ageCrew) {
|
||||
var crew = result.crew.split(',');
|
||||
crew.push(result.steuermann);
|
||||
var okay = true;
|
||||
for (var c in crew) {
|
||||
for (var ci in crew) {
|
||||
var c = crew[ci];
|
||||
if ((c == '') || !(c in sailorIds)) continue;
|
||||
var sailor = sailors[sailorIds[c]];
|
||||
if (((sailor.year != null) && (sailor.year < (formatDate('Y', date) - maxAge))) ||
|
||||
@@ -352,18 +368,42 @@ function dbGetRanking(minDate, maxDate, maxAge, ageStrict, altM = 9, ageCrew = f
|
||||
if (!okay) continue;
|
||||
}
|
||||
|
||||
sailors[sailorIds[result.steuermann]].regattas[regatta.id] = {
|
||||
regatta: regatta.id,
|
||||
boat: result.boat,
|
||||
crew: result.crew,
|
||||
place: result.place,
|
||||
fb: fb,
|
||||
rlp: result.rlp,
|
||||
used: 0,
|
||||
m: m
|
||||
};
|
||||
for (var j = 0; j < m; j ++) {
|
||||
sailors[sailorIds[result.steuermann]].tmp_rlp.push([regatta.id, result.rlp]);
|
||||
if (personMode == 0 || personMode == 2) { // add to helmsman
|
||||
sailors[sailorIds[result.steuermann]].regattas[regatta.id] = {
|
||||
regatta: regatta.id,
|
||||
boat: result.boat,
|
||||
helm: result.steuermann,
|
||||
crew: result.crew,
|
||||
place: result.place,
|
||||
fb: fb,
|
||||
rlp: result.rlp,
|
||||
used: 0,
|
||||
m: m
|
||||
};
|
||||
for (var j = 0; j < m; j ++) {
|
||||
sailors[sailorIds[result.steuermann]].tmp_rlp.push([regatta.id, result.rlp]);
|
||||
}
|
||||
}
|
||||
if (personMode == 1 || personMode == 2) { // add to crew
|
||||
var crew = result.crew.split(',');
|
||||
for (var ci in crew) {
|
||||
var c = crew[ci];
|
||||
if ((c == '') || !(c in sailorIds)) continue;
|
||||
sailors[sailorIds[c]].regattas[regatta.id] = {
|
||||
regatta: regatta.id,
|
||||
boat: result.boat,
|
||||
helm: result.steuermann,
|
||||
crew: result.crew,
|
||||
place: result.place,
|
||||
fb: fb,
|
||||
rlp: result.rlp,
|
||||
used: 0,
|
||||
m: m
|
||||
};
|
||||
for (var j = 0; j < m; j ++) {
|
||||
sailors[sailorIds[c]].tmp_rlp.push([regatta.id, result.rlp]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -411,8 +451,16 @@ function dbGetRanking(minDate, maxDate, maxAge, ageStrict, altM = 9, ageCrew = f
|
||||
return b.rlp - a.rlp;
|
||||
});
|
||||
|
||||
var lastPoints = 0;
|
||||
var lastRank = 1;
|
||||
for (var i = 0; i < sailors.length; i ++) {
|
||||
sailors[i].rank = (i + 1);
|
||||
if (lastPoints == sailors[i].rlp) {
|
||||
sailors[i].rank = lastRank;
|
||||
} else {
|
||||
sailors[i].rank = (i + 1);
|
||||
lastRank = (i + 1);
|
||||
lastPoints = sailors[i].rlp;
|
||||
}
|
||||
}
|
||||
|
||||
resolve([sailors, rankNoResults]);
|
||||
@@ -573,7 +621,7 @@ function sync() {
|
||||
localTimes[entry['table']] = entry['time'];
|
||||
});
|
||||
|
||||
syncInProgress = 13;
|
||||
syncInProgress = 15;
|
||||
var syncOkay = true;
|
||||
log("[db] Sync Start");
|
||||
$('#i-sync').addClass('fa-spin');
|
||||
@@ -962,8 +1010,68 @@ function sync() {
|
||||
syncInProgress --;
|
||||
}
|
||||
|
||||
// FOLLOWS
|
||||
getJSON(QUERY_URL + 'get_follows', function (code, data) {
|
||||
if (code == 200) {
|
||||
var os = db.transaction('follows', 'readwrite').objectStore('follows');
|
||||
data.data.forEach(function (entry) {
|
||||
os.put(entry);
|
||||
});
|
||||
os.openCursor().onsuccess = function (event) {
|
||||
var cursor = event.target.result;
|
||||
if (cursor) {
|
||||
if (!data.keys.includes(parseInt(cursor.key))) {
|
||||
os.delete(cursor.key);
|
||||
}
|
||||
cursor.continue();
|
||||
} else {
|
||||
syncInProgress --;
|
||||
log('[db] follows synced, remaining:', syncInProgress);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
log("[db] follows: Something went wrong (HTTP " + code + ")");
|
||||
syncOkay = false;
|
||||
syncInProgress --;
|
||||
log('[db] follows failed, remaining:', syncInProgress);
|
||||
}
|
||||
});
|
||||
|
||||
// EXPENDITURES
|
||||
if (localTimes['expenditures'] < serverTimes['expenditures']) {
|
||||
getJSON(QUERY_URL + 'get_expenditures?changed-after=' + localTimes['expenditures'], function (code, data) {
|
||||
if (code == 200) {
|
||||
var os = db.transaction('expenditures', 'readwrite').objectStore('expenditures');
|
||||
data.data.forEach(function (entry) {
|
||||
os.put(entry);
|
||||
});
|
||||
os.openCursor().onsuccess = function (event) {
|
||||
var cursor = event.target.result;
|
||||
if (cursor) {
|
||||
if (!data.keys.includes(parseInt(cursor.key))) {
|
||||
os.delete(cursor.key);
|
||||
}
|
||||
cursor.continue();
|
||||
} else {
|
||||
var osUpdateTimes = db.transaction('update_times', 'readwrite').objectStore('update_times');
|
||||
osUpdateTimes.put({ table: 'expenditures', time: serverTimes['expenditures'] });
|
||||
syncInProgress --;
|
||||
log('[db] expenditures synced, remaining:', syncInProgress);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
log("[db] expenditures: Something went wrong (HTTP " + code + ")");
|
||||
syncOkay = false;
|
||||
syncInProgress --;
|
||||
log('[db] expenditures failed, remaining:', syncInProgress);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
syncInProgress --;
|
||||
}
|
||||
|
||||
} else {
|
||||
syncInProgress -= 3;
|
||||
syncInProgress -= 5;
|
||||
}
|
||||
|
||||
// NEWS
|
||||
@@ -1190,6 +1298,19 @@ function initDatabase() {
|
||||
var osRankings = db.createObjectStore('rankings', { keyPath: 'id' });
|
||||
}
|
||||
|
||||
if ((oldVersion < 9) && (newVersion >= 9)) {
|
||||
log('[db] to version 9');
|
||||
var osFollows = db.createObjectStore('follows', { keyPath: 'id' });
|
||||
}
|
||||
|
||||
if ((oldVersion < 10) && (newVersion >= 10)) {
|
||||
log('[db] to version 10');
|
||||
var osExpenditures = db.createObjectStore('expenditures', { keyPath: 'id' });
|
||||
osExpenditures.createIndex('user', 'user', { unique: false });
|
||||
var osUpdateTimes = upgradeTransaction.objectStore('update_times');
|
||||
osUpdateTimes.add({ table: 'expenditures', time: 0 });
|
||||
}
|
||||
|
||||
// Force resync after db update
|
||||
if (oldVersion >= 1) {
|
||||
var osUpdateTimes = upgradeTransaction.objectStore('update_times');
|
||||
@@ -1206,7 +1327,30 @@ function initDatabase() {
|
||||
function resetDb() {
|
||||
if (canUseLocalDB) {
|
||||
showLoader();
|
||||
var osUpdateTimes = db.transaction('update_times', 'readwrite').objectStore('update_times');
|
||||
db.transaction('clubs', 'readwrite').objectStore('clubs').clear();
|
||||
db.transaction('boats', 'readwrite').objectStore('boats').clear();
|
||||
db.transaction('sailors', 'readwrite').objectStore('sailors').clear();
|
||||
db.transaction('regattas', 'readwrite').objectStore('regattas').clear();
|
||||
db.transaction('results', 'readwrite').objectStore('results').clear();
|
||||
db.transaction('plannings', 'readwrite').objectStore('plannings').clear();
|
||||
db.transaction('trim_boats', 'readwrite').objectStore('trim_boats').clear();
|
||||
db.transaction('trim_users', 'readwrite').objectStore('trim_users').clear();
|
||||
db.transaction('trim_trims', 'readwrite').objectStore('trim_trims').clear();
|
||||
db.transaction('users', 'readwrite').objectStore('users').clear();
|
||||
db.transaction('years', 'readwrite').objectStore('years').clear();
|
||||
db.transaction('news', 'readwrite').objectStore('news').clear();
|
||||
db.transaction('class', 'readwrite').objectStore('class').clear();
|
||||
db.transaction('rankings', 'readwrite').objectStore('rankings').clear();
|
||||
db.transaction('follows', 'readwrite').objectStore('follows').clear();
|
||||
db.transaction('expenditures', 'readwrite').objectStore('expenditures').clear();
|
||||
var ta = db.transaction('update_times', 'readwrite');
|
||||
ta.oncomplete = (event) => {
|
||||
log('[db] resetDb: Transaction complete');
|
||||
};
|
||||
ta.onerror = (event) => {
|
||||
log('[db] resetDb: Transaction failed');
|
||||
};
|
||||
var osUpdateTimes = ta.objectStore('update_times');
|
||||
osUpdateTimes.put({ table: 'last_sync', time: 1 });
|
||||
osUpdateTimes.put({ table: 'clubs', time: 0 });
|
||||
osUpdateTimes.put({ table: 'boats', time: 0 });
|
||||
@@ -1219,6 +1363,9 @@ function resetDb() {
|
||||
osUpdateTimes.put({ table: 'trim_trims', time: 0 });
|
||||
osUpdateTimes.put({ table: 'news', time: 0 });
|
||||
osUpdateTimes.put({ table: 'users', time: 0 });
|
||||
osUpdateTimes.put({ table: 'expenditures', time: 0 });
|
||||
osUpdateTimes.put({ table: 'loggedin', status: isLoggedIn() });
|
||||
ta.commit();
|
||||
log('[db] DB update times reset');
|
||||
hideLoader();
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
require_once(__DIR__ . '/../../server/config.php');
|
||||
require_once(__DIR__ . '/../../server/version.php');
|
||||
|
||||
// QUERY_URL changed in config.php (this is to update this file on client devices)
|
||||
|
||||
?>
|
||||
|
||||
const QUERY_URL = '<?php echo QUERY_URL; ?>';
|
||||
@@ -60,7 +62,11 @@ var badges = {
|
||||
news: {
|
||||
id: 'badge-more-news',
|
||||
cnt: 0
|
||||
}
|
||||
},
|
||||
expenditures: {
|
||||
id: 'badge-more-expenditures',
|
||||
cnt: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -155,51 +161,6 @@ function findGetParameter(parameterName) {
|
||||
return result;
|
||||
}
|
||||
|
||||
var signup = function() {
|
||||
log('[app] Signup');
|
||||
var username = $('#input-signup-username').val();
|
||||
var email = $('#input-signup-email').val();
|
||||
var password = $('#input-signup-password').val();
|
||||
if (username == '') { $('#input-signup-username').focus(); return; }
|
||||
if (email == '') { $('#input-signup-email').focus(); return; }
|
||||
if (password == '') { $('#input-signup-password').focus(); return; }
|
||||
log('[app] Signup: All fields okay');
|
||||
showLoader();
|
||||
$('#input-signup-username').val('').trigger('focusin').trigger('focusout');
|
||||
$('#input-signup-email').val('').trigger('focusin').trigger('focusout');
|
||||
$('#input-signup-password').val('').trigger('focusin').trigger('focusout');
|
||||
$.ajax({
|
||||
url: QUERY_URL + 'signup',
|
||||
method: 'POST',
|
||||
data: {
|
||||
username: username,
|
||||
email: email,
|
||||
password: password
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
log('[app] Signup: error:', xhr.status, status);
|
||||
if (xhr.status == 409) {
|
||||
toastError('Benutzername bereits vergeben');
|
||||
$('#input-signup-email').val(email).trigger('focusin').trigger('focusout');
|
||||
} else if (xhr.status == 0) {
|
||||
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um Dich anzumelden');
|
||||
$('#menu-signup').hideMenu();
|
||||
} else {
|
||||
log('[app] Signup: unbekannter Fehler', status, error);
|
||||
log(xhr);
|
||||
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
||||
}
|
||||
hideLoader();
|
||||
},
|
||||
success: function (data, status, xhr) {
|
||||
log('[app] Signup successful, logging in');
|
||||
$('#input-login-username').val(username);
|
||||
$('#input-login-password').val(password);
|
||||
login();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var login = function() {
|
||||
log('[app] Login');
|
||||
showLoader();
|
||||
@@ -359,7 +320,7 @@ function pushesSubscribe() {
|
||||
applicationServerKey: applicationServerKey
|
||||
})
|
||||
.then(async function(subscription) {
|
||||
log('[app] Subscription:', subscription);
|
||||
log('[app] Subscription:', JSON.stringify(subscription));
|
||||
if (await pushesUpdateServerSubscription(subscription, true)) {
|
||||
log('[app] Subscription: Sent to server, updating UI');
|
||||
dbSettingsSet('notify_endpoint_' + BOATCLASS, subscription.endpoint);
|
||||
@@ -385,7 +346,7 @@ function pushesUnSubscribe(silent = false) {
|
||||
log('[app] Unsubscribing');
|
||||
swRegistration.pushManager.getSubscription()
|
||||
.then(async function(subscription) {
|
||||
log('[app] Subscription:', subscription);
|
||||
log('[app] Subscription:', JSON.stringify(subscription));
|
||||
if (subscription) {
|
||||
if (await pushesUpdateServerSubscription(subscription, false)) {
|
||||
log('[app] Subscription: Removed from server');
|
||||
@@ -413,7 +374,7 @@ function pushesUnSubscribe(silent = false) {
|
||||
|
||||
function pushesUpdateServerSubscription(subscription, enabled) {
|
||||
return new Promise(function(resolve){
|
||||
log('[app] updateServer', enabled, subscription);
|
||||
log('[app] updateServer', enabled, JSON.stringify(subscription));
|
||||
$.ajax({
|
||||
url: QUERY_URL + (enabled ? 'add' : 'remove') + '_subscription',
|
||||
type: 'POST',
|
||||
@@ -516,7 +477,7 @@ function updatePushBadge() {
|
||||
var dbSub = await dbSettingsGet('notify_endpoint_' + BOATCLASS);
|
||||
var isSub = (subscription !== null);
|
||||
log('[app] DB Subscription:', dbSub);
|
||||
log('[app] Real Subscription:', subscription);
|
||||
log('[app] Real Subscription:', JSON.stringify(subscription));
|
||||
if (isSub) {
|
||||
$('#badge-pushes').removeClass('bg-red2-dark').addClass('bg-green2-dark').text('AN');
|
||||
if (dbSub === null) dbSettingsSet('notify_endpoint_' + BOATCLASS, subscription.endpoint);
|
||||
@@ -555,6 +516,24 @@ async function updateNewsBadge() {
|
||||
updateBadge('more/news', sum);
|
||||
}
|
||||
|
||||
async function updateExpendituresBadge() {
|
||||
let allExps = await dbGetData('expenditures');
|
||||
let sum = 0;
|
||||
for (let i in allExps) {
|
||||
let exp = allExps[i];
|
||||
if (exp.approved == 0) {
|
||||
if (exp.direction < 0 && exp.canceled == 0) sum++;
|
||||
if (exp.direction > 0 && exp.canceled == 1) sum++;
|
||||
}
|
||||
}
|
||||
updateBadge('more/expenditures', sum);
|
||||
}
|
||||
|
||||
function updateBadges() {
|
||||
updateNewsBadge();
|
||||
updateExpendituresBadge();
|
||||
}
|
||||
|
||||
var initRegatten = function() {
|
||||
showLoader();
|
||||
|
||||
@@ -611,11 +590,11 @@ var onDatabaseLoaded = function() {
|
||||
onServiceWorkerLoaded();
|
||||
initPushSettings();
|
||||
|
||||
updateNewsBadge();
|
||||
updateBadges();
|
||||
}
|
||||
|
||||
var onAfterSync = function() {
|
||||
updateNewsBadge();
|
||||
updateBadges();
|
||||
}
|
||||
|
||||
function sendErrorReport() {
|
||||
@@ -678,12 +657,21 @@ function ro_getLink(type, eventId, classId) {
|
||||
}
|
||||
return '';
|
||||
}
|
||||
function wfn_getLink(type, eventId, classId) {
|
||||
switch (type) {
|
||||
case 'entrylist':
|
||||
return 'https://wettfahrten.net/event/' + eventId + '/entrylist?class=' + classId;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
function extServiceGetLink(serviceName, type, eventId = '', classId = '') {
|
||||
switch (serviceName) {
|
||||
case 'm2s':
|
||||
return m2s_getLink(type, eventId, classId);
|
||||
case 'ro':
|
||||
return ro_getLink(type, eventId);
|
||||
return ro_getLink(type, eventId, classId);
|
||||
case 'wfn':
|
||||
return wfn_getLink(type, eventId, classId);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -144,6 +144,72 @@
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/*** EXPENDITURES LIST ***/
|
||||
.expenditures-list.display-border > div {
|
||||
border-bottom: 1px solid #dee2e6;
|
||||
}
|
||||
.expenditures-list > div {
|
||||
padding-top: 1rem;
|
||||
padding-bottom: 1rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.expenditures-list > div:last-child {
|
||||
border: 0;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.expenditures-list div {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.expenditures-list > div > div > div {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.expenditures-list > div > div:nth-child(1) > div:nth-child(1) {
|
||||
width: calc(75% - 1.5em);
|
||||
}
|
||||
.expenditures-list > div > div:nth-child(1) > div:nth-child(2) {
|
||||
width: 25%;
|
||||
text-align: right;
|
||||
}
|
||||
.expenditures-list > div > div:nth-child(1) > div:nth-child(3) {
|
||||
width: 1.5em;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.expenditures-list > div > div:nth-child(2) > div:nth-child(1) {
|
||||
width: 6em;
|
||||
}
|
||||
.expenditures-list > div > div:nth-child(2) > div:nth-child(2) {
|
||||
width: calc(70% - 6em);
|
||||
overflow-x: visible;
|
||||
}
|
||||
.expenditures-list > div > div:nth-child(2) > div:nth-child(3) {
|
||||
width: 30%;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.expenditures-list > div.sum {
|
||||
padding: 0;
|
||||
}
|
||||
.expenditures-list > div.sum > div:nth-child(1) {
|
||||
background: #dee2e6;
|
||||
height: 1px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
.expenditures-list > div.sum > div:nth-child(1) > div:nth-child(1) {
|
||||
background: #fff;
|
||||
width: initial;
|
||||
margin-top: -1em;
|
||||
padding: 0 .5em;
|
||||
}
|
||||
.theme-dark .expenditures-list > div.sum > div:nth-child(1) > div:nth-child(1) {
|
||||
background-color: #0f1117;
|
||||
}
|
||||
|
||||
/*** NORMAL LIST ***/
|
||||
.normal-list > div {
|
||||
padding-top: 1rem;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
$sp['title'] = 'Boote - Regatten.net ' . $_CLASS['name'];
|
||||
$sp['backbutton'] = 'index';
|
||||
$sp['activenav'] = 4;
|
||||
$sp['activenav'] = 5;
|
||||
|
||||
// Title
|
||||
$content = "<h1>Boote</h1>";
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
$sp['title'] = 'Vereine - Regatten.net ' . $_CLASS['name'];
|
||||
$sp['backbutton'] = 'index';
|
||||
$sp['activenav'] = 4;
|
||||
$sp['activenav'] = 5;
|
||||
|
||||
// Title
|
||||
$content = "<h1>Vereine</h1>";
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
<?php
|
||||
|
||||
|
||||
$sp['title'] = 'Kontakt - Regatten.net ' . $_CLASS['name'];
|
||||
$sp['backbutton'] = true;
|
||||
$sp['activenav'] = 5;
|
||||
|
||||
|
||||
// TITLE
|
||||
$content = '<h1>Kontakt</h1>';
|
||||
|
||||
|
||||
$sp['output'] .= $tpl->load('card', [$content]);
|
||||
|
||||
|
||||
// Info
|
||||
$content = '<p>';
|
||||
$content .= 'Du hast eine Frage? Du hast einen Fehler in unserer Software oder in den gespeicherten Daten gefunden? Du willst Regatten.net auch für Deine Bootsklasse nutzen?<br>';
|
||||
$content .= 'Egal was es ist, lass es uns wissen! Schreibe uns eine Mail an <a href="mailto:info@regatten.net">info@regatten.net</a> oder nutze einfach dieses Kontakt-Formular.<br>';
|
||||
$content .= 'Wir werden Deine Anfrage so schnell wie möglich bearbeiten.';
|
||||
$content .= '</p>';
|
||||
$content .= '<p>';
|
||||
$content .= 'Alternativ erreichst Du uns auch telefonisch unter <a href="tel:+4941039659768">+49 (0) 4103 965 976 8</a><br>';
|
||||
$content .= 'Mo-Fr: 7-20 Uhr<br>';
|
||||
$content .= 'Sa: 9-17 Uhr';
|
||||
$content .= '</p>';
|
||||
|
||||
//$content .= '<p>';
|
||||
//$content .= 'Alternativ erreichst Du uns auch telefonisch unter <a href="tel:+4941039659768">+49 (0) 4103 965 976 8</a><br>';
|
||||
//$content .= 'Mo-Fr: 7-20 Uhr<br>';
|
||||
//$content .= 'Sa: 9-17 Uhr';
|
||||
//$content .= '</p>';
|
||||
|
||||
$sp['output'] .= $tpl->load('card', [$content]);
|
||||
|
||||
|
||||
// Formular
|
||||
$content = '<h2>Kontakt-Formular</h2>';
|
||||
$content .= $tpl->load('input', ['html-id' => 'input-name', 'placeholder' => 'Dein Name', 'type' => 'text']);
|
||||
@@ -30,9 +30,9 @@
|
||||
$content .= $tpl->load('input', ['html-id' => 'input-subject', 'placeholder' => 'Betreff', 'type' => 'text']);
|
||||
$content .= $tpl->load('textarea', ['html-id' => 'input-message', 'placeholder' => 'Deine Nachricht']);
|
||||
$content .= $tpl->load('button', ['Senden', '#', 'html-id' => 'button-send']);
|
||||
|
||||
|
||||
$sp['output'] .= $tpl->load('card', [$content]);
|
||||
|
||||
|
||||
$sp['scripts'] .= $scripts->load('contact');
|
||||
|
||||
?>
|
||||
|
||||
?>
|
||||
|
||||
80
server/content/expenditures-user.php
Normal file
80
server/content/expenditures-user.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
$sp['title'] = 'Ausgaben-Verwaltung - Regatten.net ' . $_CLASS['name'];
|
||||
$sp['backbutton'] = 'expenditures';
|
||||
$sp['activenav'] = 5;
|
||||
|
||||
// Title
|
||||
$content = "<h1>Ausgaben-Verwaltung</h1>";
|
||||
$content .= '<p id="p-username" class="mb-1"></p>';
|
||||
$content .= $tpl->load('button', ['<i class="fas fa-plus"></i> Neue Ausgabe', '#', 'html-id' => 'button-add', 'css-class' => 'mt-3 mb-2']);
|
||||
$content .= $tpl->load('button', ['<i class="fas fa-plus"></i> Neuer Geldtransfer', '#', 'html-id' => 'button-add-transfer', 'css-class' => 'mt-3 mb-0']);
|
||||
|
||||
$sp['output'] .= $tpl->load('card', [$content, 'css-class' => 'show-loggedin']);
|
||||
|
||||
// Not loggedin
|
||||
$content = '<h1>Ausgaben-Verwaltung</h1>';
|
||||
$content .= '<p>Um die Ausgaben-Verwaltung nutzen zu können, musst Du angemeldet sein.<br><a href="#" data-menu="menu-login">Melde Dich hier an</a> oder <a href="https://regatten.net/#signup">registriere Dich jetzt kostenlos</a>.</p>';
|
||||
|
||||
$sp['output'] .= $tpl->load('card', [$content, 'css-class' => 'show-notloggedin']);
|
||||
|
||||
// List
|
||||
$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-list" class="expenditures-list mb-0"></div>';
|
||||
|
||||
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-list', 'css-class' => 'show-loggedin']);
|
||||
|
||||
// Pagination
|
||||
$sp['output'] .= $tpl->load('pagination', ['html-id' => 'pagination', 'css-class' => 'show-loggedin']);
|
||||
|
||||
// Legend
|
||||
$content = '<p>';
|
||||
$content .= '<i class="fas fa-check"></i> genehmigt<br>';
|
||||
$content .= '<i class="fas fa-times"></i> storniert<br>';
|
||||
$content .= '<i class="fas fa-hourglass-half"></i> wartet auf Zustimmung von <span class="span-username"></span><br>';
|
||||
$content .= '<i class="fas fa-exclamation"></i> wartet auf Deine Zustimmung';
|
||||
$content .= '</p>';
|
||||
|
||||
$sp['output'] .= $tpl->load('card', [$content, 'css-class' => 'show-loggedin']);
|
||||
|
||||
// Menu
|
||||
$items = $tpl->load('menu/item-icon', ['Akzeptieren', '#', 'html-id' => 'menu-item-approve', 'icon' => 'fa-check']);
|
||||
$items .= $tpl->load('menu/item-icon', ['Ablehnen', '#', 'html-id' => 'menu-item-decline', 'icon' => 'fa-times']);
|
||||
$items .= $tpl->load('menu/item-icon', ['Stornieren', '#', 'html-id' => 'menu-item-cancel', 'icon' => 'fa-times']);
|
||||
$sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-expenditure', 'title' => 'Ausgabe', 'height' => 200]);
|
||||
|
||||
// Menu Add
|
||||
$items = $tpl->load('menu/item-simple', ['bezahlt von: ', '#', 'html-id' => 'item-add-user-from']);
|
||||
$items .= $tpl->load('input', ['html-id' => 'input-add-date', 'placeholder' => 'Datum des Transfers', 'type' => 'date', 'css-class' => 'mt-3']);
|
||||
$items .= $tpl->load('input', ['html-id' => 'input-add-amount', 'placeholder' => 'Betrag in Euro', 'type' => 'number" min="0.01" step="0.01']);
|
||||
$options = '<option value="entryfee">Meldegeld</option>';
|
||||
$options .= '<option value="camping">Camping</option>';
|
||||
$options .= '<option value="food">Essen</option>';
|
||||
$options .= '<option value="other">andere</option>';
|
||||
$items .= $tpl->load('select', ['html-id' => 'select-add-purpose', 'placeholder' => 'Verwendung', 'options' => $options]);
|
||||
$items .= $tpl->load('input', ['html-id' => 'input-add-regatta-name', 'placeholder' => 'Name der Regatta (optional)', 'type' => 'text']);
|
||||
$items .= $tpl->load('input', ['html-id' => 'input-add-purpose-text', 'placeholder' => 'Verwendungszweck (optional)', 'type' => 'text']);
|
||||
$items .= '<p style="line-height: normal; margin-bottom: 0;">Für wen wurde das Geld ausgegeben? (z.B. Du und Dein Segelpartner)<br>Hinweis: Der angegebene Betrag wird durch die Personen geteilt, die Du hier auswählst.</p>';
|
||||
$items .= $tpl->load('menu/item-simple', ['<span style="font-style:italic;">Weiteren Benutzer hinzufügen</span>', '#', 'html-id' => 'item-add-user-to']);
|
||||
$items .= $tpl->load('button', ['Speichern', '#', 'html-id' => 'button-add-save', 'css-class' => 'mb-3']);
|
||||
$sp['menus'] .= $tpl->load('menu/modal', [$items, 'html-id' => 'menu-add', 'title' => 'Neue Ausgabe', 'height' => '90vh', 'width' => '90vw']);
|
||||
|
||||
// Menu Add Transfer
|
||||
$items = $tpl->load('menu/item-switch', ['Geld bekommen', 'html-id' => 'switch-add-transfer-received', 'icon' => 'fa-arrow-left']);
|
||||
$items .= $tpl->load('menu/item-simple', ['von: <font style="font-style:italic;">bitte auswählen</font>', '#', 'html-id' => 'item-add-transfer-user']);
|
||||
$items .= $tpl->load('input', ['html-id' => 'input-add-transfer-date', 'placeholder' => 'Datum des Transfers', 'type' => 'date', 'css-class' => 'mt-3']);
|
||||
$items .= $tpl->load('input', ['html-id' => 'input-add-transfer-amount', 'placeholder' => 'Betrag in Euro', 'type' => 'number" min="0.01" step="0.01']);
|
||||
$items .= $tpl->load('input', ['html-id' => 'input-add-transfer-purpose-text', 'placeholder' => 'Verwendungszweck (optional)', 'type' => 'text']);
|
||||
$items .= $tpl->load('button', ['Speichern', '#', 'html-id' => 'button-add-transfer-save']);
|
||||
$sp['menus'] .= $tpl->load('menu/modal', [$items, 'html-id' => 'menu-add-transfer', 'title' => 'Neuer Geldtransfer', 'height' => 470, 'width' => '90vw']);
|
||||
|
||||
// Select user
|
||||
$items = $tpl->load('input', ['html-id' => 'input-user-search', 'placeholder' => 'Suche...', 'type' => 'text']);
|
||||
$sp['menus'] .= $tpl->load('menu/modal', [$items, 'html-id' => 'menu-select-user', 'title' => 'Benutzer auswählen', 'height' => 500, 'width' => '90vw']);
|
||||
|
||||
$sp['scripts'] .= $scripts->load('pagination', ['pageChange', 'page', 'pageCount', 'pagination']);
|
||||
$sp['scripts'] .= $scripts->load('expenditures-add');
|
||||
$sp['scripts'] .= $scripts->load('expenditures-user');
|
||||
|
||||
?>
|
||||
63
server/content/expenditures.php
Normal file
63
server/content/expenditures.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
$sp['title'] = 'Ausgaben-Verwaltung - Regatten.net ' . $_CLASS['name'];
|
||||
$sp['backbutton'] = 'index';
|
||||
$sp['activenav'] = 5;
|
||||
|
||||
// Title
|
||||
$content = "<h1>Ausgaben-Verwaltung</h1>";
|
||||
$content .= $tpl->load('button', ['<i class="fas fa-plus"></i> Neue Ausgabe', '#', 'html-id' => 'button-add', 'css-class' => 'mt-3 mb-2']);
|
||||
$content .= $tpl->load('button', ['<i class="fas fa-plus"></i> Neuer Geldtransfer', '#', 'html-id' => 'button-add-transfer', 'css-class' => 'mt-3 mb-0']);
|
||||
|
||||
$sp['output'] .= $tpl->load('card', [$content, 'css-class' => 'show-loggedin']);
|
||||
|
||||
// Not loggedin
|
||||
$content = '<h1>Ausgaben-Verwaltung</h1>';
|
||||
$content .= '<p>Um die Ausgaben-Verwaltung nutzen zu können, musst Du angemeldet sein.<br><a href="#" data-menu="menu-login">Melde Dich hier an</a> oder <a href="https://regatten.net/#signup">registriere Dich jetzt kostenlos</a>.</p>';
|
||||
|
||||
$sp['output'] .= $tpl->load('card', [$content, 'css-class' => 'show-notloggedin']);
|
||||
|
||||
// List
|
||||
$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-list" class="normal-list mb-0"></div>';
|
||||
|
||||
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-list', 'css-class' => 'show-loggedin']);
|
||||
|
||||
// Pagination
|
||||
$sp['output'] .= $tpl->load('pagination', ['html-id' => 'pagination', 'css-class' => 'show-loggedin']);
|
||||
|
||||
// Menu Add
|
||||
$items = $tpl->load('menu/item-simple', ['bezahlt von: ', '#', 'html-id' => 'item-add-user-from']);
|
||||
$items .= $tpl->load('input', ['html-id' => 'input-add-date', 'placeholder' => 'Datum des Transfers', 'type' => 'date', 'css-class' => 'mt-3']);
|
||||
$items .= $tpl->load('input', ['html-id' => 'input-add-amount', 'placeholder' => 'Betrag in Euro', 'type' => 'number" min="0.01" step="0.01']);
|
||||
$options = '<option value="entryfee">Meldegeld</option>';
|
||||
$options .= '<option value="camping">Camping</option>';
|
||||
$options .= '<option value="food">Essen</option>';
|
||||
$options .= '<option value="other">andere</option>';
|
||||
$items .= $tpl->load('select', ['html-id' => 'select-add-purpose', 'placeholder' => 'Verwendung', 'options' => $options]);
|
||||
$items .= $tpl->load('input', ['html-id' => 'input-add-regatta-name', 'placeholder' => 'Name der Regatta (optional)', 'type' => 'text']);
|
||||
$items .= $tpl->load('input', ['html-id' => 'input-add-purpose-text', 'placeholder' => 'Verwendungszweck (optional)', 'type' => 'text']);
|
||||
$items .= '<p style="line-height: normal; margin-bottom: 0;">Für wen wurde das Geld ausgegeben? (z.B. Du und Dein Segelpartner)<br>Hinweis: Der angegebene Betrag wird durch die Personen geteilt, die Du hier auswählst.</p>';
|
||||
$items .= $tpl->load('menu/item-simple', ['<span style="font-style:italic;">Weiteren Benutzer hinzufügen</span>', '#', 'html-id' => 'item-add-user-to']);
|
||||
$items .= $tpl->load('button', ['Speichern', '#', 'html-id' => 'button-add-save', 'css-class' => 'mb-3']);
|
||||
$sp['menus'] .= $tpl->load('menu/modal', [$items, 'html-id' => 'menu-add', 'title' => 'Neue Ausgabe', 'height' => '90vh', 'width' => '90vw']);
|
||||
|
||||
// Menu Add Transfer
|
||||
$items = $tpl->load('menu/item-switch', ['Geld bekommen', 'html-id' => 'switch-add-transfer-received', 'icon' => 'fa-arrow-left']);
|
||||
$items .= $tpl->load('menu/item-simple', ['von: <font style="font-style:italic;">bitte auswählen</font>', '#', 'html-id' => 'item-add-transfer-user']);
|
||||
$items .= $tpl->load('input', ['html-id' => 'input-add-transfer-date', 'placeholder' => 'Datum des Transfers', 'type' => 'date', 'css-class' => 'mt-3']);
|
||||
$items .= $tpl->load('input', ['html-id' => 'input-add-transfer-amount', 'placeholder' => 'Betrag in Euro', 'type' => 'number" min="0.01" step="0.01']);
|
||||
$items .= $tpl->load('input', ['html-id' => 'input-add-transfer-purpose-text', 'placeholder' => 'Verwendungszweck (optional)', 'type' => 'text']);
|
||||
$items .= $tpl->load('button', ['Speichern', '#', 'html-id' => 'button-add-transfer-save']);
|
||||
$sp['menus'] .= $tpl->load('menu/modal', [$items, 'html-id' => 'menu-add-transfer', 'title' => 'Neuer Geldtransfer', 'height' => 470, 'width' => '90vw']);
|
||||
|
||||
// Select user
|
||||
$items = $tpl->load('input', ['html-id' => 'input-user-search', 'placeholder' => 'Suche...', 'type' => 'text']);
|
||||
$sp['menus'] .= $tpl->load('menu/modal', [$items, 'html-id' => 'menu-select-user', 'title' => 'Benutzer auswählen', 'height' => 500, 'width' => '90vw']);
|
||||
|
||||
$sp['scripts'] .= $scripts->load('pagination', ['pageChange', 'page', 'pageCount', 'pagination']);
|
||||
$sp['scripts'] .= $scripts->load('expenditures-add');
|
||||
$sp['scripts'] .= $scripts->load('expenditures');
|
||||
|
||||
?>
|
||||
@@ -32,7 +32,7 @@
|
||||
$content = '<h2>Nicht angemeldet</h2>';
|
||||
$content .= '<p class="mt-3">';
|
||||
$content .= 'Um alle Funktionen dieser Seite nutzen zu können, <a href="#" data-menu="menu-login">logge Dich bitte ein</a>.<br>';
|
||||
$content .= 'Solltest Du noch kein Benutzerkonto haben, kannst Du Dich kostenlos <a href="#" data-menu="menu-signup">registrieren</a>.';
|
||||
$content .= 'Solltest Du noch kein Benutzerkonto haben, kannst Du Dich kostenlos <a href="https://regatten.net/#signup">registrieren</a>.';
|
||||
$content .= '</p>';
|
||||
|
||||
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-notloggedin']);
|
||||
@@ -72,10 +72,10 @@
|
||||
$content .= '<p>Du willst alle Regatta-Termine in deinem Kalender, aber nicht alles abtippen?<br>Kein Problem! Abonniere einfach unseren ics-Kalender.</p>';
|
||||
$content .= '<p><b>Nur die Regatten, zu denen Du gehst?</b><br>Auch kein Problem! ';
|
||||
$content .= '<font class="show-loggedin">Erstelle einfach eine <a href="' . LINK_PRE . 'planning">Saison-Planung</a> und abonniere Deinen persönlichen Kalender.</font>';
|
||||
$content .= '<font class="show-notloggedin"><a href="#" data-menu="menu-signup">Registriere Dich einfach kostenlos</a>, erstelle eine Saison-Planung und wir erstellen Dir einen persönlichen Kalender.</font>';
|
||||
$content .= '<font class="show-notloggedin"><a href="https://regatten.net/#signup">Registriere Dich einfach kostenlos</a>, erstelle eine Saison-Planung und wir erstellen Dir einen persönlichen Kalender.</font>';
|
||||
$content .= '</p>';
|
||||
$content .= $tpl->load('button', ['<i class="fas fa-calendar-alt"></i> Regatta-Kalender', 'https://regatten.net/client/calendar/' . BOATCLASS . '/everything.ics', 'css-class' => 'mb-2']);
|
||||
$content .= $tpl->load('button', ['<i class="fas fa-calendar-alt"></i> Kalender für <font class="replace-username"></font>', 'https://regatten.net/client/calendar/' . BOATCLASS . '/user_%USERID%.ics', 'css-class' => 'show-loggedin replace-userid-href']);
|
||||
$content .= $tpl->load('button', ['<i class="fas fa-calendar-alt"></i> Regatta-Kalender', 'https://ranglisten.net/client/calendar/' . BOATCLASS . '/everything.ics', 'css-class' => 'mb-2']);
|
||||
$content .= $tpl->load('button', ['<i class="fas fa-calendar-alt"></i> Kalender für <font class="replace-username"></font>', 'https://ranglisten.net/client/calendar/' . BOATCLASS . '/user_%USERID%.ics', 'css-class' => 'show-loggedin replace-userid-href']);
|
||||
|
||||
$sp['output'] .= $tpl->load('card', [$content]);
|
||||
|
||||
@@ -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']);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
$sp['title'] = 'Saison-Planung - Regatten.net ' . $_CLASS['name'];
|
||||
$sp['backbutton'] = 'index';
|
||||
$sp['activenav'] = 5;
|
||||
$sp['activenav'] = 4;
|
||||
|
||||
// Title
|
||||
$content = '<h1>Saison-Planung</h1>';
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
// Not loggedin
|
||||
$content = '<h1>Saison-Planung</h1>';
|
||||
$content .= '<p>Um Deine Saison-Planung zu sehen, musst Du angemeldet sein.<br><a href="#" data-menu="menu-login">Melde Dich hier an</a> oder <a href="#" data-menu="menu-signup">registriere Dich jetzt kostenlos</a>.</p>';
|
||||
$content .= '<p>Um Deine Saison-Planung zu sehen, musst Du angemeldet sein.<br><a href="#" data-menu="menu-login">Melde Dich hier an</a> oder <a href="https://regatten.net/#signup">registriere Dich jetzt kostenlos</a>.</p>';
|
||||
|
||||
$sp['output'] .= $tpl->load('card', [$content, 'css-class' => 'show-notloggedin']);
|
||||
|
||||
@@ -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']);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
$sp['title'] = 'Saison-Planung bearbeiten - Regatten.net ' . $_CLASS['name'];
|
||||
$sp['backbutton'] = true;
|
||||
$sp['activenav'] = 5;
|
||||
$sp['activenav'] = 4;
|
||||
|
||||
// Title, Inputs
|
||||
$content = "<h1>Saison-Planung bearbeiten</h1>";
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
$sp['title'] = 'Saison-Planungen - Regatten.net ' . $_CLASS['name'];
|
||||
$sp['backbutton'] = true;
|
||||
$sp['activenav'] = 5;
|
||||
$sp['activenav'] = 4;
|
||||
|
||||
// Title
|
||||
$content = '<h1>Saison-Planungen</h1>';
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
// Not loggedin
|
||||
$content = '<h1>Saison-Planungen</h1>';
|
||||
$content .= '<p>Um die Saison-Planungen anderer zu sehen, musst Du angemeldet sein.<br><a href="#" data-menu="menu-login">Melde Dich hier an</a> oder <a href="#" data-menu="menu-signup">registriere Dich jetzt kostenlos</a>.</p>';
|
||||
$content .= '<p>Um die Saison-Planungen anderer zu sehen, musst Du angemeldet sein.<br><a href="#" data-menu="menu-login">Melde Dich hier an</a> oder <a href="https://regatten.net/#signup">registriere Dich jetzt kostenlos</a>.</p>';
|
||||
|
||||
$sp['output'] .= $tpl->load('card', [$content, 'css-class' => 'show-notloggedin']);
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
$sp['title'] = 'Saison-Planung - Regatten.net ' . $_CLASS['name'];
|
||||
$sp['backbutton'] = true;
|
||||
$sp['activenav'] = 5;
|
||||
$sp['activenav'] = 4;
|
||||
|
||||
// Title
|
||||
$content = '<h1>Saison-Planung</h1>';
|
||||
@@ -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');
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
$content .= $tpl->load('input', ['html-id' => 'input-maxage', 'placeholder' => 'max. Alter (leer = nicht prüfen)', 'type' => 'number']);
|
||||
$content .= $tpl->load('checkbox', ['html-id' => 'input-agestrict', 'placeholder' => 'unb. Jahrgänge ausschließen']);
|
||||
$content .= $tpl->load('checkbox', ['html-id' => 'input-agecrew', 'placeholder' => 'Crew auch prüfen']);
|
||||
$content .= $tpl->load('button', ['Anzeigen', '#', 'html-id' => 'button-show']);
|
||||
$content .= $tpl->load('select', ['html-id' => 'select-personmode', 'placeholder' => 'nach', 'css-class' => 'mt-3 mb-0']);
|
||||
$content .= $tpl->load('button', ['Anzeigen', '#', 'html-id' => 'button-show', 'css-class' => 'mt-3']);
|
||||
|
||||
$sp['output'] .= $tpl->load('card', [$content]);
|
||||
|
||||
|
||||
49
server/content/regatta_facts.php
Normal file
49
server/content/regatta_facts.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
$sp['title'] = 'Fakten - Regatten.net ' . $_CLASS['name'];
|
||||
$sp['backbutton'] = true;
|
||||
$sp['activenav'] = 2;
|
||||
|
||||
// Title, Inputs
|
||||
$content = '<h1 id="h1-title"></h1>';
|
||||
$content .= '<p id="p-title"></p>';
|
||||
|
||||
$sp['output'] .= $tpl->load('card', [$content]);
|
||||
|
||||
// NO FACTS INFO
|
||||
$content = '<p>Es sind keine Fakten zu dieser Veranstaltung hinterlegt. Bitte lies die Ausschreibung.</p>';
|
||||
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-nofactsinfo']);
|
||||
|
||||
// Meldegeld
|
||||
$content = '<h2>Meldegeld</h2>';
|
||||
$content .= '<p></p>';
|
||||
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-entryfee']);
|
||||
|
||||
// Wettfahrten
|
||||
$content = '<h2>Wettfahrten</h2>';
|
||||
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-races']);
|
||||
|
||||
// Zeitplan
|
||||
$content = '<h2>Zeitplan</h2>';
|
||||
$content .= $tpl->load('table', ['css-class' => 'mb-0 text-nowrap']);
|
||||
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-times']);
|
||||
|
||||
// Camping
|
||||
$content = '<h2>Camping</h2>';
|
||||
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-camping']);
|
||||
|
||||
// Verpflegung
|
||||
$content = '<h2>Verpflegung</h2>';
|
||||
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-food']);
|
||||
|
||||
// Weitere Infos
|
||||
$content = '<h2>Weitere Informationen</h2><p></p>';
|
||||
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-text']);
|
||||
|
||||
// Disclaimer
|
||||
$content = '<p><i>Alle Angaben ohne Gewähr. Änderungen vorbehalten. Am Ende gilt, was in der Ausschreibung / Segelanweisung steht!</i></p>';
|
||||
$sp['output'] .= $tpl->load('card', [$content]);
|
||||
|
||||
$sp['scripts'] .= $scripts->load('regatta_facts');
|
||||
|
||||
?>
|
||||
@@ -21,7 +21,7 @@
|
||||
$content = '<p>Du planst, hier hinzufahren, aber stehst nicht auf dieser Liste?<br>';
|
||||
$content .= 'Das kannst Du ändern! ';
|
||||
$content .= '<font class="show-loggedin">Erstelle einfach <a href="' . LINK_PRE . 'planning">hier</a> Deine eigene Saison-Planung.</font>';
|
||||
$content .= '<font class="show-notloggedin"><a href="#" data-menu="menu-login">Melde Dich an</a> oder <a href="#" data-menu="menu-signup">registriere Dich kostenlos</a> und erstelle Deine eigene Saison-Planung.</font>';
|
||||
$content .= '<font class="show-notloggedin"><a href="#" data-menu="menu-login">Melde Dich an</a> oder <a href="https://regatten.net/#signup">registriere Dich kostenlos</a> und erstelle Deine eigene Saison-Planung.</font>';
|
||||
$content .= '</p>';
|
||||
|
||||
$sp['output'] .= $tpl->load('card', [$content]);
|
||||
|
||||
@@ -14,6 +14,11 @@
|
||||
|
||||
$sp['output'] .= $tpl->load('card', [$content]);
|
||||
|
||||
// To today
|
||||
$content = $tpl->load('button', ['<i class="fas fa-arrow-down"></i> Heute <i class="fas fa-arrow-down"></i>', '#', 'html-id' => 'button-totoday']);
|
||||
|
||||
$sp['output'] .= $tpl->load('card', [$content]);
|
||||
|
||||
// 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']);
|
||||
@@ -30,11 +35,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');
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
$sp['title'] = 'Segler - Regatten.net ' . $_CLASS['name'];
|
||||
$sp['backbutton'] = 'index';
|
||||
$sp['activenav'] = 4;
|
||||
$sp['activenav'] = 5;
|
||||
|
||||
// Title
|
||||
$content = "<h1>Segler</h1>";
|
||||
|
||||
@@ -15,6 +15,6 @@
|
||||
<a href="<?php echo LINK_PRE; ?>index"<?php if ($sp['activenav'] == 1) echo ' class="active-nav"'; ?>><i class="fa fa-home"></i><span>Start</span></a>
|
||||
<a href="<?php echo LINK_PRE; ?>regattas"<?php if ($sp['activenav'] == 2) echo ' class="active-nav"'; ?>><i class="fa fa-flag-checkered"></i><span>Regatten</span></a>
|
||||
<a href="<?php echo LINK_PRE; ?>rank"<?php if ($sp['activenav'] == 3) echo ' class="active-nav"'; ?>><i class="fa fa-trophy"></i><span>Ranglisten</span></a>
|
||||
<a href="#" data-menu="menu-lists"<?php if ($sp['activenav'] == 4) echo ' class="active-nav"'; ?>><i class="fa fa-list"></i><span>Listen</span></a>
|
||||
<a href="<?php echo LINK_PRE; ?>planning"<?php if ($sp['activenav'] == 4) echo ' class="active-nav"'; ?>><i class="fa fa-calendar-alt"></i><span>Planung</span></a>
|
||||
<a href="#" data-menu="menu-more"<?php if ($sp['activenav'] == 5) echo ' class="active-nav"'; ?>><i class="fa fa-ellipsis-h"></i><span>Mehr</span><em id="badge-footer-more" class="badge bg-highlight"></em></a>
|
||||
</div>
|
||||
@@ -57,7 +57,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="menu-more" class="menu menu-box-bottom menu-box-detached rounded-m" data-menu-height="360" >
|
||||
<div id="menu-more" class="menu menu-box-bottom menu-box-detached rounded-m" data-menu-height="410" >
|
||||
<div class="menu-title"><h1>Mehr</h1><p class="color-highlight"> </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">
|
||||
@@ -68,11 +68,12 @@
|
||||
<span id="badge-more-news" class="badge bg-highlight color-white"></span>
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
<a href="<?php echo LINK_PRE; ?>planning">
|
||||
<i class="fa font-14 fa-calendar-alt rounded-s bg-highlight color-white"></i>
|
||||
<span>Saison-Planung</span>
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
<a href="<?php echo LINK_PRE; ?>expenditures" class="show-loggedin">
|
||||
<i class="fa font-14 fa-money-bill-wave rounded-s bg-highlight color-white"></i>
|
||||
<span>Ausgaben-Verwaltung</span>
|
||||
<span id="badge-more-expenditures" class="badge bg-highlight color-white"></span>
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
<a href="<?php echo LINK_PRE; ?>trim_list">
|
||||
<i class="fa font-14 fa-book rounded-s bg-highlight color-white"></i>
|
||||
<span>Trimm-Bücher</span>
|
||||
@@ -83,6 +84,11 @@
|
||||
<span>RLP-Rechner</span>
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
<a href="#" data-menu="menu-lists">
|
||||
<i class="fa font-14 fa-list rounded-s bg-highlight color-white"></i>
|
||||
<span>Listen</span>
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
<a href="<?php echo LINK_PRE; ?>contact" class="border-0">
|
||||
<i class="fa font-14 fa-phone rounded-s bg-highlight color-white"></i>
|
||||
<span>Kontakt</span>
|
||||
@@ -110,7 +116,7 @@
|
||||
<span>Login</span>
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
<a href="#" data-menu="menu-signup" class="show-notloggedin">
|
||||
<a href="https://regatten.net/#signup" class="show-notloggedin">
|
||||
<i class="fa font-14 fa-user-plus rounded-s bg-highlight color-white"></i>
|
||||
<span>Registrieren</span>
|
||||
<span class="badge bg-red2-dark color-white">FREE</span>
|
||||
@@ -266,28 +272,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="menu-signup" class="menu menu-box-top menu-box-detached rounded-m" data-menu-height="340">
|
||||
<div class="content bottom-0">
|
||||
<h1 class="text-center mt-5 font-900">Registrieren</h1>
|
||||
<div class="input-style input-style-2 has-icon input-required">
|
||||
<i class="input-icon fa fa-user color-theme"></i>
|
||||
<span class="color-highlight">Benutzername</span>
|
||||
<input id="input-signup-username" class="form-control" type="name" placeholder="Benutzername" />
|
||||
</div>
|
||||
<div class="input-style input-style-2 has-icon input-required">
|
||||
<i class="input-icon fa fa-envelope color-theme"></i>
|
||||
<span class="color-highlight">Email</span>
|
||||
<input id="input-signup-email" class="form-control" type="email" placeholder="Email" />
|
||||
</div>
|
||||
<div class="input-style input-style-2 has-icon input-required">
|
||||
<i class="input-icon fa fa-lock color-theme"></i>
|
||||
<span class="color-highlight">Passwort</span>
|
||||
<input id="input-signup-password" class="form-control" type="password" placeholder="Passwort" />
|
||||
</div>
|
||||
<a class="btn btn-m mt-2 mb-2 btn-full bg-green2-dark text-uppercase font-900" href="#" onclick="signup();">Registrieren</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="menu-welcome" class="menu menu-box-bottom" style="height: 70vh">
|
||||
<div class="content bottom-0">
|
||||
<h1 class="text-center font-900">Willkommen</h1>
|
||||
@@ -300,9 +284,6 @@
|
||||
<p>
|
||||
Mehr Informationen findest Du <a href="https://info.ostertun.net/regatten/beta">hier</a>.
|
||||
</p>
|
||||
<p>
|
||||
Mit der Nutzung dieser App erklärst Du Dich außerdem damit einverstanden, dass wir Cookies einsetzen.
|
||||
</p>
|
||||
<a id="menu-welcome-a-okay" class="btn btn-m mt-2 mb-3 btn-full bg-green2-dark text-uppercase font-900" href="#">Alles klar</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -317,7 +298,7 @@
|
||||
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 class="btn btn-m mt-2 btn-full bg-highlight text-uppercase font-900" href="https://ranglisten.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>
|
||||
|
||||
338
server/scripts/expenditures-add.js
Normal file
338
server/scripts/expenditures-add.js
Normal file
@@ -0,0 +1,338 @@
|
||||
let users = [];
|
||||
let known = [];
|
||||
let userSelectedCallback = null;
|
||||
let excludeUsers = {};
|
||||
|
||||
function userSelected(id) {
|
||||
if (typeof userSelectedCallback === 'function') {
|
||||
userSelectedCallback(id);
|
||||
}
|
||||
}
|
||||
|
||||
async function usersSearch() {
|
||||
$('.item-user-search').remove();
|
||||
if ($('#input-user-search').val().length == 0) {
|
||||
known.forEach(function (entry) {
|
||||
if (!(entry.id in excludeUsers)) {
|
||||
$('#menu-select-user').find('.content').find('.list-group').append(entry.content);
|
||||
}
|
||||
});
|
||||
}
|
||||
if ($('#input-user-search').val().length >= 3) {
|
||||
let cnt = 0;
|
||||
users.forEach(function (entry) {
|
||||
if (!(entry.id in excludeUsers) && search($('#input-user-search').val(), entry.keywords)) {
|
||||
$('#menu-select-user').find('.content').find('.list-group').append(entry.content);
|
||||
cnt++;
|
||||
}
|
||||
});
|
||||
if (cnt == 0) {
|
||||
let item = '<p class="item-user-search">Keine Benutzer gefunden.</p>';
|
||||
$('#menu-select-user').find('.content').find('.list-group').append(item);
|
||||
}
|
||||
} else {
|
||||
let item = '<p class="item-user-search">Zum Suchen mindestens 3 Zeichen eingeben</p>';
|
||||
$('#menu-select-user').find('.content').find('.list-group').append(item);
|
||||
}
|
||||
}
|
||||
|
||||
function addRemoveToUser(userid) {
|
||||
$('.item-user-to[data-userid=' + userid + ']').remove();
|
||||
}
|
||||
|
||||
async function expendituresInitModals() {
|
||||
$('#button-add-save').click(function () {
|
||||
showLoader();
|
||||
const jqUserFrom = $('#item-add-user-from');
|
||||
const userFrom = jqUserFrom.data('userid');
|
||||
const jqDate = $('#input-add-date');
|
||||
const purposeDate = jqDate.val();
|
||||
if (purposeDate == '') {
|
||||
hideLoader();
|
||||
toastError('Es wurde kein Datum ausgewählt!');
|
||||
jqDate.focus();
|
||||
return;
|
||||
}
|
||||
const jqAmount = $('#input-add-amount');
|
||||
const amount = jqAmount.val();
|
||||
if (amount == '') {
|
||||
hideLoader();
|
||||
toastError('Es wurde kein Betrag ausgewählt!');
|
||||
jqAmount.focus();
|
||||
return;
|
||||
}
|
||||
const purpose = $('#select-add-purpose').val();
|
||||
const regattaName = $('#input-add-regatta-name').val();
|
||||
const purposeText = $('#input-add-purpose-text').val();
|
||||
let usersTo = [];
|
||||
$('.item-user-to[data-userid]').each(function (index) {
|
||||
usersTo.push($(this).data('userid'));
|
||||
});
|
||||
let auth = {
|
||||
id: localStorage.getItem('auth_id'),
|
||||
hash: localStorage.getItem('auth_hash')
|
||||
}
|
||||
$.ajax({
|
||||
url: QUERY_URL + 'expenditures_add',
|
||||
method: 'POST',
|
||||
data: {
|
||||
auth: auth,
|
||||
user_from: userFrom,
|
||||
date: purposeDate,
|
||||
amount: Math.round(parseFloat(amount) * 100),
|
||||
purpose: purpose,
|
||||
regatta_name: regattaName,
|
||||
purpose_text: purposeText,
|
||||
users_to: usersTo
|
||||
},
|
||||
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 Ausgabe zu speichern');
|
||||
} else {
|
||||
log('expenditures_add: 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();
|
||||
updateExpendituresBadge();
|
||||
$('#menu-add').hideMenu();
|
||||
hideLoader();
|
||||
toastOk('Ausgabe gespeichert. Betrag wurde durch ' + data.count + ' Personen geteilt.');
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#item-add-user-from').click(async function () {
|
||||
excludeUsers = {};
|
||||
$('#input-user-search').val('').trigger('focusin').trigger('focusout');
|
||||
usersSearch();
|
||||
userSelectedCallback = async function (userid) {
|
||||
$('#item-add-user-from').data('userid', userid).find('span').html('bezahlt von: ' + (await dbGetData('users', userid)).username);
|
||||
$('#menu-select-user').hideMenu();
|
||||
$('#menu-add').showMenu();
|
||||
}
|
||||
$('#menu-add').hideMenu();
|
||||
$('#menu-select-user').showMenu();
|
||||
$('#input-user-search').focus();
|
||||
});
|
||||
$('#item-add-user-to').click(async function () {
|
||||
excludeUsers = {};
|
||||
$('.item-user-to[data-userid]').each(function (index) {
|
||||
excludeUsers[$(this).data('userid')] = true;
|
||||
});
|
||||
$('#input-user-search').val('').trigger('focusin').trigger('focusout');
|
||||
usersSearch();
|
||||
userSelectedCallback = async function (userid) {
|
||||
let item = '<a class="item-user-to" data-userid="' + userid + '" onclick="addRemoveToUser(' + userid + ')">';
|
||||
item += '<span>' + (await dbGetData('users', userid)).username + '</span>';
|
||||
item += '<i class="fa fa-times"></i>';
|
||||
item += '</a>';
|
||||
$('#item-add-user-to').before(item);
|
||||
$('#menu-select-user').hideMenu();
|
||||
$('#menu-add').showMenu();
|
||||
}
|
||||
$('#menu-add').hideMenu();
|
||||
$('#menu-select-user').showMenu();
|
||||
$('#input-user-search').focus();
|
||||
});
|
||||
|
||||
$('#button-add-transfer-save').click(function () {
|
||||
showLoader();
|
||||
const jqUser = $('#item-add-transfer-user');
|
||||
const selectedUser = jqUser.data('userid');
|
||||
if (selectedUser == 0) {
|
||||
hideLoader();
|
||||
toastError('Es wurde keine Person ausgewählt!');
|
||||
return;
|
||||
}
|
||||
const jqDate = $('#input-add-transfer-date');
|
||||
const selectedDate = jqDate.val();
|
||||
if (selectedDate == '') {
|
||||
hideLoader();
|
||||
toastError('Es wurde kein Datum ausgewählt!');
|
||||
jqDate.focus();
|
||||
return;
|
||||
}
|
||||
const jqAmount = $('#input-add-transfer-amount');
|
||||
const selectedAmount = jqAmount.val();
|
||||
if (selectedAmount == '') {
|
||||
hideLoader();
|
||||
toastError('Es wurde kein Betrag ausgewählt!');
|
||||
jqAmount.focus();
|
||||
return;
|
||||
}
|
||||
const jqPurposeText = $('#input-add-transfer-purpose-text');
|
||||
const selectedPurposeText = jqPurposeText.val();
|
||||
const jqSwitch = $('#switch-add-transfer-received');
|
||||
const direction = jqSwitch.prop('checked');
|
||||
let auth = {
|
||||
id: localStorage.getItem('auth_id'),
|
||||
hash: localStorage.getItem('auth_hash')
|
||||
}
|
||||
$.ajax({
|
||||
url: QUERY_URL + 'expenditures_add_transfer',
|
||||
method: 'POST',
|
||||
data: {
|
||||
auth: auth,
|
||||
direction: direction ? 1 : -1,
|
||||
userid: selectedUser,
|
||||
date: selectedDate,
|
||||
amount: Math.round(parseFloat(selectedAmount) * 100),
|
||||
purpose_text: selectedPurposeText
|
||||
},
|
||||
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 den Geldtransfer zu speichern');
|
||||
} else {
|
||||
log('expenditures_add_transfer: 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();
|
||||
updateExpendituresBadge();
|
||||
$('#menu-add-transfer').hideMenu();
|
||||
hideLoader();
|
||||
toastOk(direction ? 'Geldtransfer gespeichert. ' + (await dbGetData('users', selectedUser)).username + ' muss dies noch bestätigen' : 'Geldtransfer wurde gespeichert');
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#switch-add-transfer-received').parent().parent().click(async function () {
|
||||
const jqSwitch = $('#switch-add-transfer-received');
|
||||
const jqUser = $('#item-add-transfer-user');
|
||||
const direction = jqSwitch.prop('checked');
|
||||
jqSwitch.parent().prev().text(direction ? 'Geld gegeben' : 'Geld bekommen').prev().removeClass('fa-arrow-' + (direction ? 'left' : 'right')).addClass('fa-arrow-' + (direction ? 'right' : 'left'));
|
||||
const selectedUser = jqUser.data('userid');
|
||||
if (selectedUser == 0) {
|
||||
jqUser.find('span').html((direction ? 'an: ' : 'von: ') + '<font style="font-style:italic;">bitte auswählen</font>');
|
||||
} else {
|
||||
jqUser.find('span').text((direction ? 'an: ' : 'von: ') + (await dbGetData('users', selectedUser)).username);
|
||||
}
|
||||
});
|
||||
$('#item-add-transfer-user').click(async function () {
|
||||
excludeUsers = {};
|
||||
excludeUsers[USER_ID] = true;
|
||||
$('#input-user-search').val('').trigger('focusin').trigger('focusout');
|
||||
usersSearch();
|
||||
userSelectedCallback = async function (userid) {
|
||||
const direction = $('#switch-add-transfer-received').prop('checked');
|
||||
$('#item-add-transfer-user').data('userid', userid).find('span').html((direction ? 'an: ' : 'von: ') + (await dbGetData('users', userid)).username);
|
||||
$('#menu-select-user').hideMenu();
|
||||
$('#menu-add-transfer').showMenu();
|
||||
}
|
||||
$('#menu-add-transfer').hideMenu();
|
||||
$('#menu-select-user').showMenu();
|
||||
$('#input-user-search').focus();
|
||||
});
|
||||
|
||||
$('#input-user-search').on('input', usersSearch);
|
||||
|
||||
users = [];
|
||||
known = [];
|
||||
let itemMe = '<a class="item-user-search" onclick="userSelected(' + USER_ID + ')">';
|
||||
itemMe += '<span>ICH (' + USER_NAME + ')</span>';
|
||||
itemMe += '<i class="fa fa-angle-right"></i>';
|
||||
itemMe += '</a>';
|
||||
known.push({id: USER_ID, content: itemMe});
|
||||
let knownIds = {};
|
||||
let allExps = await dbGetData('expenditures');
|
||||
let expUsers = {};
|
||||
for (let i in allExps) {
|
||||
let exp = allExps[i];
|
||||
let eUId = exp.user;
|
||||
if (!(eUId in expUsers)) {
|
||||
expUsers[eUId] = {
|
||||
userId: eUId,
|
||||
username: (await dbGetData('users', eUId)).username,
|
||||
cnt: 0
|
||||
};
|
||||
}
|
||||
expUsers[eUId].cnt++;
|
||||
}
|
||||
expUsers = Object.values(expUsers);
|
||||
expUsers.sort(function (a, b) {
|
||||
return a.username.localeCompare(b.username);
|
||||
});
|
||||
for (let i in expUsers) {
|
||||
knownIds[expUsers[i].userId] = true;
|
||||
}
|
||||
const dbUsers = await dbGetData('users');
|
||||
dbUsers.sort(function (a, b) {
|
||||
return a.username.localeCompare(b.username);
|
||||
});
|
||||
for (let i in dbUsers) {
|
||||
let item = '<a class="item-user-search" onclick="userSelected(' + dbUsers[i].id + ')">';
|
||||
item += '<span>' + dbUsers[i].username + '</span>';
|
||||
item += '<i class="fa fa-angle-right"></i>';
|
||||
item += '</a>';
|
||||
users.push({
|
||||
keywords: [dbUsers[i].username],
|
||||
id: dbUsers[i].id,
|
||||
content: item
|
||||
});
|
||||
if (dbUsers[i].id in knownIds) known.push({id: dbUsers[i].id, content: item});
|
||||
}
|
||||
|
||||
$('#input-add-regatta-name').attr('list', 'list-regattas');
|
||||
let listRegattas = $('<datalist id="list-regattas">').appendTo('body');
|
||||
let plannings = await dbGetDataIndex('plannings', 'user', USER_ID);
|
||||
let regattas = [];
|
||||
for (let i in plannings) {
|
||||
let regatta = await dbGetData('regattas', plannings[i].regatta);
|
||||
regatta.year = formatDate('Y', parseDate(regatta.date));
|
||||
regattas.push(regatta);
|
||||
}
|
||||
regattas.sort(function (a, b) {
|
||||
if (a.year != b.year) return b.year - a.year;
|
||||
return a.name.localeCompare(b.name);
|
||||
});
|
||||
for (let i in regattas) {
|
||||
$('<option>').attr('value', regattas[i].name).appendTo(listRegattas);
|
||||
}
|
||||
}
|
||||
|
||||
async function expendituresShowAdd(defaultUser = 0) {
|
||||
$('#item-add-user-from').data('userid', USER_ID).find('span').html('bezahlt von: ' + USER_NAME);
|
||||
$('#input-add-date').val(formatDate('Y-m-d')).trigger('focusin');
|
||||
$('#input-add-amount').val('');
|
||||
$('#select-add-purpose').val('entryfee');
|
||||
$('#input-add-regatta-name').val('');
|
||||
$('#input-add-purpose-text').val('');
|
||||
$('.item-user-to').remove();
|
||||
let item = '<a class="item-user-to" data-userid="' + USER_ID + '" onclick="addRemoveToUser(' + USER_ID + ')">';
|
||||
item += '<span>' + USER_NAME + '</span>';
|
||||
item += '<i class="fa fa-times"></i>';
|
||||
item += '</a>';
|
||||
$('#item-add-user-to').before(item);
|
||||
if (defaultUser > 0) {
|
||||
item = '<a class="item-user-to" data-userid="' + defaultUser + '" onclick="addRemoveToUser(' + defaultUser + ')">';
|
||||
item += '<span>' + (await dbGetData('users', defaultUser)).username + '</span>';
|
||||
item += '<i class="fa fa-times"></i>';
|
||||
item += '</a>';
|
||||
$('#item-add-user-to').before(item);
|
||||
}
|
||||
$('#menu-add').showMenu();
|
||||
}
|
||||
|
||||
async function expendituresShowAddTransfer(defaultUser = 0, defaultDirection = true, defaultAmount = '') {
|
||||
$('#switch-add-transfer-received').prop('checked', defaultDirection).parent().prev().text(defaultDirection ? 'Geld gegeben' : 'Geld bekommen').prev().removeClass(defaultDirection ? 'fa-arrow-left' : 'fa-arrow-right').addClass(defaultDirection ? 'fa-arrow-right' : 'fa-arrow-left');
|
||||
if (defaultUser == 0) {
|
||||
$('#item-add-transfer-user').data('userid', 0).find('span').html((defaultDirection ? 'an: ' : 'von: ') + '<font style="font-style:italic;">bitte auswählen</font>');
|
||||
} else {
|
||||
$('#item-add-transfer-user').data('userid', defaultUser).find('span').html((defaultDirection ? 'an: ' : 'von: ') + (await dbGetData('users', defaultUser)).username);
|
||||
}
|
||||
$('#input-add-transfer-date').val(formatDate('Y-m-d')).trigger('focusin');
|
||||
$('#input-add-transfer-amount').val(defaultAmount).trigger('focusin').trigger('focusout');
|
||||
$('#input-add-transfer-purpose-text').val('');
|
||||
$('#menu-add-transfer').showMenu();
|
||||
}
|
||||
326
server/scripts/expenditures-user.js
Normal file
326
server/scripts/expenditures-user.js
Normal file
@@ -0,0 +1,326 @@
|
||||
let firstCall = true;
|
||||
let rows = [];
|
||||
let displayed = [];
|
||||
let page = 1;
|
||||
let pageCount = 0;
|
||||
const showCount = 25;
|
||||
let sumsDisplayed = true;
|
||||
|
||||
function createPurpose(exp) {
|
||||
let purpose = '';
|
||||
let extraText = ': ';
|
||||
switch (exp.purpose) {
|
||||
case 'transfer': purpose = 'Geldtransfer'; break;
|
||||
case 'entryfee': purpose = 'Meldegeld'; break;
|
||||
case 'camping': purpose = 'Camping'; break;
|
||||
case 'food': purpose = 'Essen'; break;
|
||||
case 'other': extraText = ''; break;
|
||||
}
|
||||
if (exp.purpose_text != '') {
|
||||
purpose += extraText + exp.purpose_text;
|
||||
}
|
||||
return purpose;
|
||||
}
|
||||
|
||||
async function onListClicked(id) {
|
||||
let exp = await dbGetData('expenditures', id);
|
||||
console.log(exp);
|
||||
|
||||
$('#menu-expenditure').find('.menu-title').find('p').text(createPurpose(exp) + ' (' + (exp.direction * exp.amount / 100).toFixed(2) + ' €)');
|
||||
|
||||
if (exp.approved == 0 && (exp.direction < 0) == (exp.canceled == 0)) {
|
||||
$('#menu-item-approve').show();
|
||||
$('#menu-item-approve').attr('onclick', 'expenditureAction("approve", ' + exp['id'] + ', "' + (exp.canceled == 1 ? 'Stornierung' : 'Ausgabe') + ' genehmigt")');
|
||||
$('#menu-item-approve').find('span').text(exp.canceled == 1 ? 'Storno akzeptieren' : 'Akzeptieren');
|
||||
$('#menu-item-decline').show();
|
||||
$('#menu-item-decline').attr('onclick', 'expenditureAction("decline", ' + exp['id'] + ', "Ausgabe ' + (exp.canceled == 1 ? 'erneut angefragt' : 'abgelehnt') + '")');
|
||||
$('#menu-item-decline').find('span').text(exp.canceled == 1 ? 'Erneut anfragen' : 'Ablehnen');
|
||||
} else {
|
||||
$('#menu-item-approve').hide();
|
||||
$('#menu-item-decline').hide();
|
||||
}
|
||||
|
||||
if (exp.canceled == 0 && (exp.approved == 1 || exp.direction > 0)) {
|
||||
$('#menu-item-cancel').show();
|
||||
$('#menu-item-cancel').attr('onclick', 'expenditureAction("cancel", ' + exp['id'] + ', "' + (exp.direction > 0 ? 'Ausgabe storniert' : 'Stornierung beantragt') + '")');
|
||||
} else {
|
||||
$('#menu-item-cancel').hide();
|
||||
}
|
||||
|
||||
$('#menu-expenditure').showMenu();
|
||||
$('#menu-expenditure').scrollTop(0);
|
||||
}
|
||||
|
||||
function expenditureAction(action, expId, successStr) {
|
||||
$('#menu-expenditure').hideMenu();
|
||||
showLoader();
|
||||
let auth = {
|
||||
id: localStorage.getItem('auth_id'),
|
||||
hash: localStorage.getItem('auth_hash')
|
||||
}
|
||||
$.ajax({
|
||||
url: QUERY_URL + 'expenditure_' + action,
|
||||
method: 'POST',
|
||||
data: {
|
||||
auth: auth,
|
||||
expenditure: expId
|
||||
},
|
||||
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 Ausgabe zu stornieren.');
|
||||
} else {
|
||||
log('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();
|
||||
updateExpendituresBadge();
|
||||
hideLoader();
|
||||
toastOk(successStr);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function pageChange() {
|
||||
$('#p-count')[0].scrollIntoView({ behavior: "smooth" });
|
||||
drawList();
|
||||
}
|
||||
|
||||
async function drawList() {
|
||||
window.setTimeout(function () {
|
||||
let list = '';
|
||||
|
||||
if (displayed.length > 0) {
|
||||
let offset = (page - 1) * (sumsDisplayed ? showCount * 2 : showCount);
|
||||
let count = (page == pageCount ? (displayed.length - offset) : (sumsDisplayed ? showCount * 2 + 1 : showCount));
|
||||
|
||||
for (i = 0; i < count; i ++) {
|
||||
list += displayed[i + offset];
|
||||
}
|
||||
} else {
|
||||
list = '<div><div>Keine Ergebnisse, die der Suche entsprechen</div></div>';
|
||||
}
|
||||
|
||||
$('#div-list').html(list);
|
||||
}, 0);
|
||||
}
|
||||
|
||||
async function reSearch() {
|
||||
window.setTimeout(function () {
|
||||
displayed = [];
|
||||
rows.forEach(function (entry) {
|
||||
if (search($('#input-search').val(), entry.keywords)) {
|
||||
displayed.push(entry.content);
|
||||
}
|
||||
});
|
||||
sumsDisplayed = displayed.length == rows.length;
|
||||
$('#div-list').toggleClass('display-border', !sumsDisplayed);
|
||||
pageCount = Math.ceil((displayed.length - (sumsDisplayed ? 1 : 0)) / (sumsDisplayed ? showCount * 2 : showCount));
|
||||
if ((page < 1) || (page > pageCount)) {
|
||||
if (page < 1) {
|
||||
page = 1;
|
||||
} else {
|
||||
page = pageCount;
|
||||
}
|
||||
}
|
||||
drawPagination();
|
||||
drawList();
|
||||
}, 0);
|
||||
}
|
||||
|
||||
function cancelCause(cancel_cause) {
|
||||
switch (cancel_cause) {
|
||||
case 'not approved':
|
||||
return 'nicht genehmigt';
|
||||
case 'canceled':
|
||||
return 'storniert';
|
||||
}
|
||||
return 'unbekannter Grund';
|
||||
}
|
||||
|
||||
let siteScript = async function() {
|
||||
if (!isLoggedIn()) {
|
||||
hideLoader();
|
||||
return;
|
||||
}
|
||||
|
||||
userid = findGetParameter('user');
|
||||
let user = null;
|
||||
if (userid !== null) {
|
||||
user = await dbGetData('users', userid);
|
||||
}
|
||||
if (user === null) {
|
||||
location.href = LINK_PRE + 'expenditures';
|
||||
return;
|
||||
}
|
||||
|
||||
$('#p-username').text(user.username);
|
||||
$('.span-username').text(user.username);
|
||||
|
||||
if (firstCall) {
|
||||
firstCall = false;
|
||||
initPagination();
|
||||
$('#input-search').on('input', reSearch);
|
||||
$('#button-add').click((e) => expendituresShowAdd(userid));
|
||||
$('#button-add-transfer').click((e) => expendituresShowAddTransfer(userid));
|
||||
expendituresInitModals();
|
||||
}
|
||||
|
||||
let exps = await dbGetDataIndex('expenditures', 'user', user.id);
|
||||
exps.sort(function (a, b) {
|
||||
return a.created - b.created;
|
||||
});
|
||||
|
||||
let sum = 0;
|
||||
for (i in exps) {
|
||||
let exp = exps[i];
|
||||
if (exp.canceled == 0) {
|
||||
sum += exp.direction * exp.amount;
|
||||
}
|
||||
exps[i].sum = sum;
|
||||
exps[i].purpose_html = createPurpose(exp);
|
||||
exps[i].purpose_date = formatDate("d.m.Y", parseDate(exp.purpose_date));
|
||||
}
|
||||
|
||||
let sumText = '';
|
||||
let sumButton = '';
|
||||
if (sum == 0) {
|
||||
sumText = 'Du und ' + user.username + ' seid quitt.';
|
||||
} else if (sum > 0) {
|
||||
sumText = user.username + ' schuldet Dir noch ' + (sum / 100).toFixed(2) + ' €.';
|
||||
sumButton = ' <a href="#" onclick="expendituresShowAddTransfer(' + user.id + ', false, ' + (sum/100) + '); return false;">Ausgleichen</a>';
|
||||
} else {
|
||||
sumText = 'Du schuldest ' + user.username + ' noch ' + (-sum / 100).toFixed(2) + ' €.';
|
||||
sumButton = ' <a href="#" onclick="expendituresShowAddTransfer(' + user.id + ', true, ' + (-sum/100) + '); return false;">Ausgleichen</a>';
|
||||
}
|
||||
|
||||
results = exps.reverse();
|
||||
|
||||
// TODO: open approvals
|
||||
|
||||
let count = results.length;
|
||||
if (count > 0) {
|
||||
$('#p-count').text(sumText);
|
||||
$('#p-count').html($('#p-count').html() + sumButton);
|
||||
$('#div-list').show();
|
||||
$('#input-search').parent().show();
|
||||
|
||||
rows = [];
|
||||
|
||||
for (id in results) {
|
||||
let entry = results[id];
|
||||
|
||||
let rowSum = { keywords: [], content: '' };
|
||||
|
||||
rowSum.content += '<div class="sum">';
|
||||
|
||||
// ZEILE SUM
|
||||
rowSum.content += '<div>';
|
||||
|
||||
// sum
|
||||
rowSum.content += '<div>';
|
||||
if (entry.sum < 0) rowSum.content += '<font style="color:red;">';
|
||||
rowSum.content += (entry.sum / 100).toFixed(2);
|
||||
if (entry.sum < 0) rowSum.content += '</font>';
|
||||
rowSum.content += ' €</div>';
|
||||
|
||||
rowSum.content += '</div></div>';
|
||||
|
||||
rows.push(rowSum);
|
||||
|
||||
|
||||
let row = { keywords: [], content: '' };
|
||||
|
||||
row.keywords.push((entry.amount / 100).toFixed(2));
|
||||
row.keywords.push(entry.purpose_html);
|
||||
row.keywords.push(entry.purpose_date);
|
||||
row.keywords.push(entry.regatta_name);
|
||||
|
||||
row.content += '<div onclick="onListClicked(' + entry.id + ');" style="';
|
||||
if (entry.canceled == 1) {
|
||||
row.content += 'opacity:0.5;';
|
||||
}
|
||||
if (entry.approved == 0) {
|
||||
row.content += 'font-style:italic;';
|
||||
}
|
||||
row.content += '">';
|
||||
|
||||
// ZEILE 1
|
||||
row.content += '<div>';
|
||||
|
||||
// purpose
|
||||
row.content += '<div' + ((entry.canceled == 1) ? ' style="text-decoration: line-through;"' : '') + '>' + entry.purpose_html + '</div>';
|
||||
|
||||
// amount
|
||||
row.content += '<div>';
|
||||
if (entry.canceled == 1) row.content += '(';
|
||||
if (entry.direction < 0) row.content += '<font style="color:red;">';
|
||||
row.content += (entry.direction * entry.amount / 100).toFixed(2);
|
||||
if (entry.direction < 0) row.content += '</font>';
|
||||
if (entry.canceled == 1) row.content += ')';
|
||||
row.content += ' €</div>';
|
||||
|
||||
// icons
|
||||
if (entry.approved == 1) {
|
||||
if (entry.canceled == 1) {
|
||||
row.content += '<div><i class="fas fa-times"></i></div>';
|
||||
} else {
|
||||
row.content += '<div><i class="fas fa-check"></i></div>';
|
||||
}
|
||||
} else if ((entry.direction < 0) == (entry.canceled == 1)) {
|
||||
row.content += '<div><i class="fas fa-hourglass-half"></i></div>';
|
||||
} else {
|
||||
row.content += '<div><i class="fas fa-exclamation fa-blink"></i></div>';
|
||||
}
|
||||
|
||||
row.content += '</div>';
|
||||
|
||||
// ZEILE 2
|
||||
row.content += '<div>';
|
||||
|
||||
// date
|
||||
row.content += '<div>' + entry.purpose_date + '</div>';
|
||||
|
||||
// regatta
|
||||
row.content += '<div>' + entry.regatta_name + '</div>';
|
||||
|
||||
// cancel_cause
|
||||
row.content += '<div>' + (entry.canceled == 1 ? cancelCause(entry.cancel_cause) : '') + '</div>';
|
||||
|
||||
row.content += '</div></div>';
|
||||
|
||||
rows.push(row);
|
||||
}
|
||||
|
||||
let rowSum = { keywords: [], content: '' };
|
||||
|
||||
rowSum.content += '<div class="sum">';
|
||||
|
||||
// ZEILE SUM
|
||||
rowSum.content += '<div>';
|
||||
|
||||
// sum
|
||||
rowSum.content += '<div>';
|
||||
rowSum.content += (0).toFixed(2);
|
||||
rowSum.content += ' €</div>';
|
||||
|
||||
rowSum.content += '</div></div>';
|
||||
|
||||
rows.push(rowSum);
|
||||
|
||||
reSearch();
|
||||
|
||||
} else {
|
||||
$('#p-count').html('Keine Ausgaben gefunden!');
|
||||
$('#div-list').hide();
|
||||
$('#input-search').parent().hide();
|
||||
}
|
||||
|
||||
hideLoader();
|
||||
}
|
||||
149
server/scripts/expenditures.js
Normal file
149
server/scripts/expenditures.js
Normal file
@@ -0,0 +1,149 @@
|
||||
var firstCall = true;
|
||||
var rows = [];
|
||||
var displayed = [];
|
||||
var page = 1;
|
||||
var pageCount = 0;
|
||||
const showCount = 25;
|
||||
|
||||
async function onListClicked(id) {
|
||||
window.location = LINK_PRE + 'expenditures-user?user=' + id;
|
||||
}
|
||||
|
||||
function pageChange() {
|
||||
$('#p-count')[0].scrollIntoView({ behavior: "smooth" });
|
||||
drawList();
|
||||
}
|
||||
|
||||
async function drawList() {
|
||||
window.setTimeout(function () {
|
||||
var list = '';
|
||||
|
||||
if (displayed.length > 0) {
|
||||
var offset = (page - 1) * showCount;
|
||||
var count = (page == pageCount ? (displayed.length % showCount) : showCount);
|
||||
if (count == 0) count = showCount;
|
||||
|
||||
for (i = 0; i < count; i ++) {
|
||||
list += displayed[i + offset];
|
||||
}
|
||||
} else {
|
||||
list = '<div><div>Keine Ergebnisse, die der Suche entsprechen</div></div>';
|
||||
}
|
||||
|
||||
$('#div-list').html(list);
|
||||
}, 0);
|
||||
}
|
||||
|
||||
async function reSearch() {
|
||||
window.setTimeout(function () {
|
||||
displayed = [];
|
||||
rows.forEach(function (entry) {
|
||||
if (search($('#input-search').val(), entry.keywords)) {
|
||||
displayed.push(entry.content);
|
||||
}
|
||||
});
|
||||
pageCount = Math.ceil(displayed.length / showCount);
|
||||
if ((page < 1) || (page > pageCount)) {
|
||||
if (page < 1) {
|
||||
page = 1;
|
||||
} else {
|
||||
page = pageCount;
|
||||
}
|
||||
}
|
||||
drawPagination();
|
||||
drawList();
|
||||
}, 0);
|
||||
}
|
||||
|
||||
var siteScript = async function() {
|
||||
if (!isLoggedIn()) {
|
||||
hideLoader();
|
||||
return;
|
||||
}
|
||||
|
||||
if (firstCall) {
|
||||
firstCall = false;
|
||||
initPagination();
|
||||
$('#input-search').on('input', reSearch);
|
||||
$('#button-add').click((e) => expendituresShowAdd());
|
||||
$('#button-add-transfer').click((e) => expendituresShowAddTransfer());
|
||||
expendituresInitModals();
|
||||
}
|
||||
|
||||
let allExps = await dbGetData('expenditures');
|
||||
let expUsers = {};
|
||||
for (let i in allExps) {
|
||||
let exp = allExps[i];
|
||||
let eUId = exp.user;
|
||||
if (!(eUId in expUsers)) {
|
||||
expUsers[eUId] = {
|
||||
userId: eUId,
|
||||
username: (await dbGetData('users', eUId)).username,
|
||||
balance: 0,
|
||||
openApprovals: 0,
|
||||
cnt: 0
|
||||
};
|
||||
}
|
||||
if (exp.canceled == 0) {
|
||||
expUsers[eUId].balance += exp.direction * parseInt(exp.amount);
|
||||
}
|
||||
if (exp.approved == 0) {
|
||||
if (exp.direction < 0 && exp.canceled == 0) expUsers[eUId].openApprovals++;
|
||||
if (exp.direction > 0 && exp.canceled == 1) expUsers[eUId].openApprovals++;
|
||||
}
|
||||
expUsers[eUId].cnt++;
|
||||
}
|
||||
let results = Object.values(expUsers);
|
||||
|
||||
let count = results.length;
|
||||
if (count > 0) {
|
||||
$('#p-count').hide();
|
||||
$('#div-list').show();
|
||||
$('#input-search').parent().show();
|
||||
|
||||
results.sort(function (a, b) {
|
||||
return b.cnt - a.cnt;
|
||||
});
|
||||
|
||||
rows = [];
|
||||
|
||||
for (id in results) {
|
||||
var entry = results[id];
|
||||
|
||||
var row = { keywords: [], content: '' };
|
||||
row.keywords.push(entry.username);
|
||||
|
||||
row.content += '<div onclick="onListClicked(' + entry.userId + ');">';
|
||||
|
||||
// ZEILE 1
|
||||
// Username
|
||||
row.content += '<div><b>' + entry.username + '</b></div>';
|
||||
|
||||
// ZEILE 2
|
||||
row.content += '<div>';
|
||||
|
||||
// open approvals
|
||||
row.content += '<div>' + ((entry.openApprovals > 0) ? (entry.openApprovals + ' offene Genehmigung' + (entry.openApprovals > 1 ? 'en' : '')) : '') + '</div>';
|
||||
|
||||
// balance
|
||||
row.content += '<div>';
|
||||
if (entry.balance < 0) row.content += '<font style="color:red;">';
|
||||
row.content += (entry.balance / 100).toFixed(2);
|
||||
if (entry.balance < 0) row.content += '</font>';
|
||||
row.content += ' €</div>';
|
||||
|
||||
row.content += '</div></div>';
|
||||
|
||||
rows.push(row);
|
||||
}
|
||||
|
||||
reSearch();
|
||||
|
||||
} else {
|
||||
$('#p-count').show().html('Keine Ausgaben gefunden!');
|
||||
$('#div-list').hide();
|
||||
$('#input-search').parent().hide();
|
||||
}
|
||||
|
||||
hideLoader();
|
||||
}
|
||||
@@ -85,12 +85,10 @@ var siteScript = async function() {
|
||||
var user = await dbGetData('users', localStorage.getItem('auth_user'));
|
||||
|
||||
// Favorites
|
||||
var follows = await dbGetData('follows');
|
||||
var watched = [];
|
||||
for (var i = 1; i <= 5; i ++) {
|
||||
sailor_id = user['sailor' + i];
|
||||
if (sailor_id != null) {
|
||||
watched.push(await dbGetData('sailors', sailor_id));
|
||||
}
|
||||
for (var i in follows) {
|
||||
watched.push(await dbGetData('sailors', follows[i].sailor));
|
||||
}
|
||||
if (watched.length > 0) {
|
||||
var year = (new Date()).getFullYear();
|
||||
|
||||
@@ -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();
|
||||
@@ -151,10 +159,10 @@ async function onRegattaClicked(id) {
|
||||
$('#menu-item-meldung').show();
|
||||
$('#menu-item-meldung').attr('href', regatta['meldung']);
|
||||
$('#menu-item-meldung').attr('target', '_blank');
|
||||
if ((planning != null) && (planning['gemeldet'] == '1')) {
|
||||
/*if ((planning != null) && (planning['gemeldet'] == '1')) {
|
||||
$('#badge-regatta-meldung').text('schon gemeldet');
|
||||
$('#badge-regatta-meldung').addClass('bg-green2-dark').removeClass('bg-highlight bg-red2-dark bg-yellow2-dark');
|
||||
} else if (regatta['meldungOffen'] == '0') {
|
||||
} else*/ if (regatta['meldungOffen'] == '0') {
|
||||
$('#badge-regatta-meldung').text('geschlossen');
|
||||
$('#badge-regatta-meldung').addClass('bg-highlight').removeClass('bg-green2-dark bg-red2-dark bg-yellow2-dark');
|
||||
} else if (regatta['meldungSchluss'] != null) {
|
||||
|
||||
@@ -367,7 +367,7 @@ async function planningEdit(id) {
|
||||
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 += '<i class="fa fa-times"></i>';
|
||||
item += '</a>';
|
||||
$('#menu-edit').find('.content').find('.list-group').append(item);
|
||||
}
|
||||
|
||||
@@ -83,6 +83,7 @@ async function onRankingClicked(id) {
|
||||
|
||||
// ZEILE 5...
|
||||
var crew = entry.crew.split(',');
|
||||
crew.unshift(entry.helm);
|
||||
for (var c in crew) {
|
||||
var cr = await dbGetData('sailors', crew[c]);
|
||||
if (cr != null) {
|
||||
@@ -108,143 +109,154 @@ async function onRankingClicked(id) {
|
||||
|
||||
var rankings;
|
||||
|
||||
async function selectChange(callSiteScript = true) {
|
||||
var year = $('#select-year').val();
|
||||
if (year == "user") {
|
||||
$('#select-type').parent().hide();
|
||||
$('#input-from').trigger('focusin').trigger('focusout').parent().show();
|
||||
$('#input-to').trigger('focusin').trigger('focusout').parent().show();
|
||||
$('#input-altm').trigger('focusin').trigger('focusout').parent().show();
|
||||
$('#input-maxage').trigger('focusin').trigger('focusout').parent().show();
|
||||
$('#input-agestrict').parent().show();
|
||||
$('#input-agecrew').parent().show();
|
||||
$('#button-show').show();
|
||||
$('#card-special-ranks').hide();
|
||||
} else {
|
||||
year = parseInt(year);
|
||||
var type = $('#select-type').val();
|
||||
console.log('[rank] selected', year, type);
|
||||
$('#select-type').parent().show();
|
||||
$('#input-from').parent().hide();
|
||||
$('#input-to').parent().hide();
|
||||
$('#input-altm').parent().hide();
|
||||
$('#input-maxage').parent().hide();
|
||||
$('#input-agestrict').parent().hide();
|
||||
$('#input-agecrew').parent().hide();
|
||||
$('#button-show').hide();
|
||||
$('#card-special-ranks').hide(); // first hide, show only when there are special ranks
|
||||
function selectChange(callSiteScript = true) {
|
||||
return new Promise(async function (resolve) {
|
||||
var year = $('#select-year').val();
|
||||
if (year == "user") {
|
||||
$('#select-type').parent().hide();
|
||||
$('#input-from').trigger('focusin').trigger('focusout').parent().show();
|
||||
$('#input-to').trigger('focusin').trigger('focusout').parent().show();
|
||||
$('#input-altm').trigger('focusin').trigger('focusout').parent().show();
|
||||
$('#input-maxage').trigger('focusin').trigger('focusout').parent().show();
|
||||
$('#input-agestrict').parent().show();
|
||||
$('#input-agecrew').parent().show();
|
||||
$('#button-show').show();
|
||||
$('#card-special-ranks').hide();
|
||||
} else {
|
||||
year = parseInt(year);
|
||||
var type = $('#select-type').val();
|
||||
console.log('[rank] selected', year, type);
|
||||
$('#select-type').parent().show();
|
||||
$('#input-from').parent().hide();
|
||||
$('#input-to').parent().hide();
|
||||
$('#input-altm').parent().hide();
|
||||
$('#input-maxage').parent().hide();
|
||||
$('#input-agestrict').parent().hide();
|
||||
$('#input-agecrew').parent().hide();
|
||||
$('#button-show').hide();
|
||||
$('#card-special-ranks').hide(); // first hide, show only when there are special ranks
|
||||
|
||||
var rankingsShow = {};
|
||||
var options = '';
|
||||
for (var i in rankings) {
|
||||
if (rankings[i].year_from !== null && rankings[i].year_from > year) continue;
|
||||
if (rankings[i].year_to !== null && rankings[i].year_to < year) continue;
|
||||
var alias = rankings[i].alias;
|
||||
options += '<option value="' + alias + '">' + rankings[i].name + '</option>';
|
||||
rankingsShow[alias] = rankings[i];
|
||||
}
|
||||
$('#select-type').html(options);
|
||||
if (!(type in rankingsShow)) {
|
||||
console.log('[rank] selected type', type, 'not found for year', year, '. Using `year`');
|
||||
type = 'year';
|
||||
}
|
||||
$('#select-type').val(type).trigger('focusin').trigger('focusout');
|
||||
|
||||
// special ranks
|
||||
getJSON(QUERY_URL + 'get_special_rankings', function (code, data) {
|
||||
if (code == 200) {
|
||||
var specialRanks = [];
|
||||
for (var i in data.data) {
|
||||
var sr = data.data[i];
|
||||
if (sr.to < (year + '-01-01')) continue;
|
||||
if (sr.to > (year + '-12-31')) continue;
|
||||
specialRanks.push(sr);
|
||||
}
|
||||
if (specialRanks.length > 0) {
|
||||
var btns = '';
|
||||
for (var i in specialRanks) {
|
||||
var sr = specialRanks[i];
|
||||
var link = 'https://regatten.net/frame.php?class=' + BOATCLASS + '&site=special_rank&rank_id=' + sr.id;
|
||||
var name = sr.title;
|
||||
var cssclass = i > 0 ? ' mt-3' : '';
|
||||
btns += '<a class="btn btn-full rounded-s text-uppercase font-900 shadow-m bg-highlight' + cssclass + '" href="' + link + '">' + name + '</a>';
|
||||
}
|
||||
$('#card-special-ranks').find('.content').html(btns);
|
||||
$('#card-special-ranks').show();
|
||||
}
|
||||
} else {
|
||||
log("[rank] special_ranks: Something went wrong (HTTP " + code + ")");
|
||||
var rankingsShow = {};
|
||||
var options = '';
|
||||
for (var i in rankings) {
|
||||
if (rankings[i].year_from !== null && rankings[i].year_from > year) continue;
|
||||
if (rankings[i].year_to !== null && rankings[i].year_to < year) continue;
|
||||
var alias = rankings[i].alias;
|
||||
options += '<option value="' + alias + '">' + rankings[i].name + '</option>';
|
||||
rankingsShow[alias] = rankings[i];
|
||||
}
|
||||
});
|
||||
$('#select-type').html(options);
|
||||
if (!(type in rankingsShow)) {
|
||||
console.log('[rank] selected type', type, 'not found for year', year, '. Using `year`');
|
||||
type = 'year';
|
||||
}
|
||||
$('#select-type').val(type).trigger('focusin').trigger('focusout');
|
||||
|
||||
var from, to, altm, maxage, agestrict, agecrew;
|
||||
altm = 9; maxage = false; agestrict = false; agecrew = false;
|
||||
var r = rankingsShow[type];
|
||||
console.log('[rank] type', type, '=>', r);
|
||||
if (r.max_age !== null) {
|
||||
maxage = r.max_age;
|
||||
agestrict = r.age_strict == 1;
|
||||
agecrew = r.age_crew == 1;
|
||||
}
|
||||
if (r.alt_m !== null) {
|
||||
altm = r.alt_m;
|
||||
}
|
||||
switch (r.type) {
|
||||
case 'year':
|
||||
from = (year - 1) + '-12-01';
|
||||
to = year + '-11-30';
|
||||
break;
|
||||
case 'quali':
|
||||
// TODO: auslagern in function getRegattaBegin
|
||||
var beginn = null;
|
||||
var regattas = await dbGetData('regattas');
|
||||
regattas.sort(function(a,b){ return b.date.localeCompare(a.date); });
|
||||
for (var r in regattas) {
|
||||
var regatta = regattas[r];
|
||||
var date = parseDate(regatta.date);
|
||||
if ((date < parseDate('01.01.' + year)) || (date > parseDate('31.12.' + year))) {
|
||||
continue;
|
||||
// special ranks
|
||||
getJSON(QUERY_URL + 'get_special_rankings', function (code, data) {
|
||||
if (code == 200) {
|
||||
var specialRanks = [];
|
||||
for (var i in data.data) {
|
||||
var sr = data.data[i];
|
||||
if (sr.to < (year + '-01-01')) continue;
|
||||
if (sr.to > (year + '-12-31')) continue;
|
||||
specialRanks.push(sr);
|
||||
}
|
||||
if (regatta.name.indexOf(r.quali_search) >= 0) {
|
||||
beginn = ((regatta.meldungSchluss != null) ? parseDate(regatta.meldungSchluss) : date);
|
||||
break;
|
||||
if (specialRanks.length > 0) {
|
||||
var btns = '';
|
||||
for (var i in specialRanks) {
|
||||
var sr = specialRanks[i];
|
||||
var link = 'https://ranglisten.net/frame.php?class=' + BOATCLASS + '&site=special_rank&rank_id=' + sr.id;
|
||||
var name = sr.title;
|
||||
var cssclass = i > 0 ? ' mt-3' : '';
|
||||
btns += '<a class="btn btn-full rounded-s text-uppercase font-900 shadow-m bg-highlight' + cssclass + '" href="' + link + '">' + name + '</a>';
|
||||
}
|
||||
$('#card-special-ranks').find('.content').html(btns);
|
||||
$('#card-special-ranks').show();
|
||||
}
|
||||
}
|
||||
// END OF TODO
|
||||
if (beginn !== null) {
|
||||
from = new Date(beginn);
|
||||
from.setFullYear(from.getFullYear() - 1);
|
||||
from.setDate(from.getDate() - 13);
|
||||
from = formatDate('Y-m-d', from);
|
||||
to = new Date(beginn);
|
||||
to.setDate(to.getDate() - 14);
|
||||
to = formatDate('Y-m-d', to);
|
||||
} else {
|
||||
log("[rank] special_ranks: Something went wrong (HTTP " + code + ")");
|
||||
}
|
||||
});
|
||||
|
||||
var from, to, altm, maxage, agestrict, agecrew;
|
||||
altm = 9; maxage = false; agestrict = false; agecrew = false;
|
||||
var r = rankingsShow[type];
|
||||
console.log('[rank] type', type, '=>', r);
|
||||
if (r.max_age !== null) {
|
||||
maxage = r.max_age;
|
||||
agestrict = r.age_strict == 1;
|
||||
agecrew = r.age_crew == 1;
|
||||
}
|
||||
if (r.alt_m !== null) {
|
||||
altm = r.alt_m;
|
||||
}
|
||||
switch (r.type) {
|
||||
case 'year':
|
||||
from = (year - 1) + '-12-01';
|
||||
to = year + '-11-30';
|
||||
break; // TODO: bessere Fehlermeldung - keine Regatta gefunden
|
||||
}
|
||||
break;
|
||||
default: // TODO: bessere Fehlermeldung - tritt nur bei Fehlkonfiguration in DB auf
|
||||
from = (year - 1) + '-12-01';
|
||||
to = year + '-11-30';
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'year2':
|
||||
from = year + '-01-01';
|
||||
to = year + '-12-31';
|
||||
break;
|
||||
case 'quali':
|
||||
// TODO: auslagern in function getRegattaBegin
|
||||
var beginn = null;
|
||||
var regattas = await dbGetData('regattas');
|
||||
regattas.sort(function(a,b){ return b.date.localeCompare(a.date); });
|
||||
for (var ri in regattas) {
|
||||
var regatta = regattas[ri];
|
||||
var date = parseDate(regatta.date);
|
||||
if ((date < parseDate('01.01.' + year)) || (date > parseDate('31.12.' + year))) {
|
||||
continue;
|
||||
}
|
||||
if (regatta.name.toLowerCase().indexOf(r.quali_search.toLowerCase()) >= 0) {
|
||||
console.log('FOUND', regatta);
|
||||
beginn = ((regatta.meldungSchluss != null) ? parseDate(regatta.meldungSchluss) : date);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// END OF TODO
|
||||
if (beginn !== null) {
|
||||
from = new Date(beginn);
|
||||
from.setFullYear(from.getFullYear() - 1);
|
||||
from.setDate(from.getDate() - 13);
|
||||
from = formatDate('Y-m-d', from);
|
||||
to = new Date(beginn);
|
||||
to.setDate(to.getDate() - 14);
|
||||
to = formatDate('Y-m-d', to);
|
||||
} else {
|
||||
console.log('[rank] no regatta found');
|
||||
from = year + '-12-31'; // reverse => no regattas will be found => no ranking
|
||||
to = year + '-01-01';
|
||||
break; // TODO: bessere Fehlermeldung - keine Regatta gefunden
|
||||
}
|
||||
break;
|
||||
default: // TODO: bessere Fehlermeldung - tritt nur bei Fehlkonfiguration in DB auf
|
||||
from = (year - 1) + '-12-01';
|
||||
to = year + '-11-30';
|
||||
break;
|
||||
}
|
||||
|
||||
console.log('[rank] setting', from, to, altm, maxage, agestrict, agecrew);
|
||||
$('#input-from').val(from);
|
||||
$('#input-to').val(to);
|
||||
$('#input-altm').val(altm);
|
||||
$('#input-maxage').val(maxage == false ? '' : maxage);
|
||||
$('#input-agestrict').prop('checked', agestrict);
|
||||
$('#input-agecrew').prop('checked', agecrew);
|
||||
var personMode = $('#select-personmode').val();
|
||||
|
||||
if (callSiteScript && (typeof siteScript === 'function')) {
|
||||
history.replaceState(null, '', '?year=' + year + '&type=' + type);
|
||||
showLoader();
|
||||
siteScript();
|
||||
console.log('[rank] setting', from, to, altm, maxage, agestrict, agecrew);
|
||||
$('#input-from').val(from);
|
||||
$('#input-to').val(to);
|
||||
$('#input-altm').val(altm);
|
||||
$('#input-maxage').val(maxage == false ? '' : maxage);
|
||||
$('#input-agestrict').prop('checked', agestrict);
|
||||
$('#input-agecrew').prop('checked', agecrew);
|
||||
|
||||
if (callSiteScript && (typeof siteScript === 'function')) {
|
||||
history.replaceState(null, '', '?year=' + year + '&type=' + type + '&pm=' + personMode);
|
||||
showLoader();
|
||||
siteScript();
|
||||
}
|
||||
}
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
|
||||
function buttonShowPressed() {
|
||||
@@ -253,7 +265,7 @@ function buttonShowPressed() {
|
||||
if ($('#input-maxage').val() != '') additional += '&maxage=' + $('#input-maxage').val();
|
||||
if ($('#input-agestrict').prop('checked')) additional += '&agestrict=on';
|
||||
if ($('#input-agecrew').prop('checked')) additional += '&agecrew=on';
|
||||
history.replaceState(null, '', '?year=user&from=' + $('#input-from').val() + "&to=" + $('#input-to').val() + "&altm=" + $('#input-altm').val() + additional)
|
||||
history.replaceState(null, '', '?year=user&from=' + $('#input-from').val() + "&to=" + $('#input-to').val() + "&altm=" + $('#input-altm').val() + "&pm=" + $('#select-personmode').val() + additional)
|
||||
showLoader();
|
||||
siteScript();
|
||||
}
|
||||
@@ -263,8 +275,10 @@ function initSelects() {
|
||||
return new Promise(async function(resolve) {
|
||||
var year = findGetParameter('year');
|
||||
var type = findGetParameter('type');
|
||||
var personMode = parseInt(findGetParameter('pm'));
|
||||
if (year === null) year = new Date().getFullYear();
|
||||
if (type === null) type = 'year';
|
||||
if (isNaN(personMode) || personMode < 0 || personMode > 2) personMode = 0;
|
||||
|
||||
var years = await dbGetData('years');
|
||||
years.sort(function (a, b) {
|
||||
@@ -304,7 +318,13 @@ function initSelects() {
|
||||
$('#input-agecrew').prop('checked', agecrew !== null);
|
||||
}
|
||||
|
||||
selectChange(false);
|
||||
options = '<option value="0">Steuerleuten</option>';
|
||||
options += '<option value="1">Vorschotern</option>';
|
||||
options += '<option value="2">allen Seglern</option>';
|
||||
$('#select-personmode').html(options);
|
||||
$('#select-personmode').val(personMode);
|
||||
|
||||
await selectChange(false);
|
||||
|
||||
resolve();
|
||||
});
|
||||
@@ -341,6 +361,7 @@ var siteScript = async function() {
|
||||
await initSelects();
|
||||
$('#select-year').change(selectChange);
|
||||
$('#select-type').change(selectChange);
|
||||
$('#select-personmode').change(selectChange);
|
||||
$('#button-show').click(buttonShowPressed);
|
||||
$('#input-search').on('input', drawList);
|
||||
}
|
||||
@@ -351,8 +372,9 @@ var siteScript = async function() {
|
||||
var maxage = $('#input-maxage').val(); if (maxage == '') maxage = false; else maxage = parseInt(maxage);
|
||||
var agestrict = $('#input-agestrict').prop('checked');
|
||||
var agecrew = $('#input-agecrew').prop('checked');
|
||||
console.log('[rank] rank params:', minDate, maxDate, altm, maxage, agestrict, agecrew);
|
||||
var dbRanking = await dbGetRanking(minDate, maxDate, maxage, agestrict, altm, agecrew);
|
||||
var personMode = $('#select-personmode').val();
|
||||
console.log('[rank] rank params:', minDate, maxDate, altm, maxage, agestrict, agecrew, personMode);
|
||||
var dbRanking = await dbGetRanking(minDate, maxDate, maxage, agestrict, altm, agecrew, personMode);
|
||||
ranking = dbRanking[0];
|
||||
|
||||
lastRanking = null; // TODO: also for quali ranks
|
||||
@@ -361,7 +383,17 @@ var siteScript = async function() {
|
||||
var lYear = parseInt($('#select-year').val()) - 1;
|
||||
var lMinDate = parseDate((lYear - 1) + '-12-01');
|
||||
var lMaxDate = parseDate(lYear + '-11-30');
|
||||
var lDbRanking = (await dbGetRanking(lMinDate, lMaxDate, maxage, agestrict, altm, agecrew))[0];
|
||||
var lDbRanking = (await dbGetRanking(lMinDate, lMaxDate, maxage, agestrict, altm, agecrew, personMode))[0];
|
||||
for (var i in lDbRanking) {
|
||||
lastRanking[lDbRanking[i].id] = lDbRanking[i].rank;
|
||||
}
|
||||
}
|
||||
if ($('#select-type').val() == 'year2') {
|
||||
lastRanking = {};
|
||||
var lYear = parseInt($('#select-year').val()) - 1;
|
||||
var lMinDate = parseDate(lYear + '-01-01');
|
||||
var lMaxDate = parseDate(lYear + '-12-31');
|
||||
var lDbRanking = (await dbGetRanking(lMinDate, lMaxDate, maxage, agestrict, altm, agecrew, personMode))[0];
|
||||
for (var i in lDbRanking) {
|
||||
lastRanking[lDbRanking[i].id] = lDbRanking[i].rank;
|
||||
}
|
||||
|
||||
258
server/scripts/regatta_facts.js
Normal file
258
server/scripts/regatta_facts.js
Normal file
@@ -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('<font class="color-red2-dark">Datum noch unklar</font>');
|
||||
} else {
|
||||
$('#p-title').html(formatDate('d.m.Y', dateFrom) + ' - <font class="color-red2-dark">Datum nicht final</font>');
|
||||
}
|
||||
} 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: <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.entry.price)) + '</b>';
|
||||
if ('early' in facts.entry) {
|
||||
content += '<br />vergünstigt: <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.entry.early)) + '</b> (bis ' + formatDate('d.m.Y', parseDate(regatta.meldungEarly)) + ')';
|
||||
}
|
||||
if ('late' in facts.entry) {
|
||||
content += '<br />nach Meldeschluss (' + formatDate('d.m.Y', parseDate(regatta.meldungSchluss)) + '): <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.entry.late)) + '</b>';
|
||||
}
|
||||
$('#card-entryfee').find('p').html(content);
|
||||
}
|
||||
|
||||
// Wettfahrten / Anzahl
|
||||
if ('races' in facts && 'cnt' in facts.races) {
|
||||
$('#card-races').show();
|
||||
$('#card-races').find('.content').append('<p>Anzahl Wettfahrten: <b>' + facts.races.cnt + '</b></p>');
|
||||
if ('days' in facts.races) {
|
||||
var table = $('<table class="table table-striped table-bordered text-nowrap">');
|
||||
var tbody = $('<tbody>');
|
||||
for (var day in facts.races.days) {
|
||||
var cnt = facts.races.days[day];
|
||||
day = formatDate('D, j.', parseDate(day));
|
||||
tbody.append('<tr><td>' + day + '</td><td><b>' + cnt + '</b></td></tr>')
|
||||
}
|
||||
table.append(tbody);
|
||||
$('#card-races').find('.content').append(table);
|
||||
}
|
||||
}
|
||||
|
||||
// Wettfahrten / Racetimes
|
||||
if ('racetimes' in facts) {
|
||||
$('#card-races').show();
|
||||
var table = $('<table class="table table-striped table-bordered mb-0 text-nowrap">');
|
||||
var tbody = $('<tbody>');
|
||||
if ('sollzeit' in facts.racetimes) {
|
||||
tbody.append('<tr><td>Sollzeit</td><td>' + facts.racetimes.sollzeit + ' min</td></tr>');
|
||||
}
|
||||
if ('zeitlimit' in facts.racetimes) {
|
||||
tbody.append('<tr><td>Zeitlimit</td><td>' + facts.racetimes.zeitlimit + ' min</td></tr>');
|
||||
}
|
||||
if ('zielzeitfenster' in facts.racetimes) {
|
||||
tbody.append('<tr><td>Zielzeitfenster</td><td>' + facts.racetimes.zielzeitfenster + ' min</td></tr>');
|
||||
}
|
||||
table.append(tbody);
|
||||
$('#card-races').find('.content').append(table);
|
||||
}
|
||||
|
||||
// Zeitplan
|
||||
if ('times' in facts) {
|
||||
$('#card-times').show();
|
||||
var tbody = $('#card-times').find('table').find('tbody');
|
||||
tbody.html('');
|
||||
if ('checkin' in facts.times) {
|
||||
tbody.append('<tr><td colspan="2" style="text-align: center; font-weight: bold;">Registrierung</td></tr>');
|
||||
for (var day in facts.times.checkin) {
|
||||
var times = facts.times.checkin[day];
|
||||
day = formatDate('D, j.', parseDate(day));
|
||||
var content = '';
|
||||
if ('from' in times && 'to' in times) content = times.from + ' bis ' + times.to; // TODO:
|
||||
else if ('from' in times) content = 'ab ' + times.from;
|
||||
else if ('to' in times) content = 'bis ' + times.to;
|
||||
tbody.append('<tr><td>' + day + '</td><td>' + content + '</td></tr>')
|
||||
}
|
||||
}
|
||||
if ('measurements' in facts.times) {
|
||||
tbody.append('<tr><td colspan="2" style="text-align: center; font-weight: bold;">Vermessung</td></tr>');
|
||||
for (var day in facts.times.measurements) {
|
||||
var times = facts.times.measurements[day];
|
||||
day = formatDate('D, j.', parseDate(day));
|
||||
var content = '';
|
||||
if ('from' in times && 'to' in times) content = times.from + ' bis ' + times.to; // TODO:
|
||||
else if ('from' in times) content = 'ab ' + times.from;
|
||||
else if ('to' in times) content = 'bis ' + times.to;
|
||||
tbody.append('<tr><td>' + day + '</td><td>' + content + '</td></tr>')
|
||||
}
|
||||
}
|
||||
if ('helmmeeting' in facts.times) {
|
||||
tbody.append('<tr><td colspan="2" style="text-align: center; font-weight: bold;">Steuerleutebesprechung</td></tr>');
|
||||
for (var day in facts.times.helmmeeting) {
|
||||
var time = facts.times.helmmeeting[day];
|
||||
day = formatDate('D, j.', parseDate(day));
|
||||
tbody.append('<tr><td>' + day + '</td><td>' + time + '</td></tr>')
|
||||
}
|
||||
}
|
||||
if ('firststart' in facts.times) {
|
||||
tbody.append('<tr><td colspan="2" style="text-align: center; font-weight: bold;">Erster Start</td></tr>');
|
||||
for (var day in facts.times.firststart) {
|
||||
var time = facts.times.firststart[day];
|
||||
day = formatDate('D, j.', parseDate(day));
|
||||
tbody.append('<tr><td>' + day + '</td><td>' + time + '</td></tr>')
|
||||
}
|
||||
}
|
||||
if ('laststart' in facts.times) {
|
||||
tbody.append('<tr><td colspan="2" style="text-align: center; font-weight: bold;">Letzter Start</td></tr>');
|
||||
for (var day in facts.times.laststart) {
|
||||
var time = facts.times.laststart[day];
|
||||
day = formatDate('D, j.', parseDate(day));
|
||||
tbody.append('<tr><td>' + day + '</td><td>' + time + '</td></tr>')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Camping
|
||||
if ('camping' in facts) {
|
||||
$('#card-camping').show();
|
||||
$('#card-camping').find('p').remove();
|
||||
if ('tent' in facts.camping) {
|
||||
var content = '';
|
||||
if ('price' in facts.camping.tent && facts.camping.tent.price > 0) {
|
||||
content += 'Zelten möglich für <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.camping.tent.price)) + '</b>';
|
||||
}
|
||||
else if ('pricepernight' in facts.camping.tent) {
|
||||
content += 'Zelten möglich für <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.camping.tent.pricepernight)) + ' pro Nacht</b>';
|
||||
}
|
||||
else {
|
||||
content += 'Zelten möglich und im Preis enthalten';
|
||||
}
|
||||
if ('electricity' in facts.camping.tent) {
|
||||
content += '<br />';
|
||||
if (facts.camping.tent.electricity > 0) {
|
||||
content += 'Strom: <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.camping.tent.electricity)) + '</b>';
|
||||
}
|
||||
else {
|
||||
content += 'Strom inklusive';
|
||||
}
|
||||
}
|
||||
$('#card-camping').find('.content').append('<p>' + content + '</p>');
|
||||
}
|
||||
if ('van' in facts.camping) {
|
||||
var content = '';
|
||||
if ('price' in facts.camping.van && facts.camping.van.price > 0) {
|
||||
content += 'Wohnwagen/-mobil möglich für <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.camping.van.price)) + '</b>';
|
||||
}
|
||||
else if ('pricepernight' in facts.camping.van) {
|
||||
content += 'Wohnwagen/-mobil möglich für <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.camping.van.pricepernight)) + ' pro Nacht</b>';
|
||||
}
|
||||
else {
|
||||
content += 'Wohnwagen/-mobil möglich und im Preis enthalten';
|
||||
}
|
||||
if ('electricity' in facts.camping.van) {
|
||||
content += '<br />';
|
||||
if (facts.camping.van.electricity > 0) {
|
||||
content += 'Strom: <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.camping.van.electricity)) + '</b>';
|
||||
}
|
||||
else {
|
||||
content += 'Strom inklusive';
|
||||
}
|
||||
}
|
||||
$('#card-camping').find('.content').append('<p>' + content + '</p>');
|
||||
}
|
||||
if ('beds' in facts.camping) {
|
||||
var content = '';
|
||||
if ('price' in facts.camping.beds && facts.camping.beds.price > 0) {
|
||||
content += 'Betten im Clubhaus vorhanden für <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.camping.beds.price)) + '</b>';
|
||||
}
|
||||
else if ('pricepernight' in facts.camping.beds) {
|
||||
content += 'Betten im Clubhaus vorhanden für <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.camping.beds.pricepernight)) + ' pro Nacht</b>';
|
||||
}
|
||||
else {
|
||||
content += 'Betten im Clubhaus vorhanden und im Preis enthalten';
|
||||
}
|
||||
$('#card-camping').find('.content').append('<p>' + content + '</p>');
|
||||
}
|
||||
if ('text' in facts.camping) {
|
||||
var p = $('<p>');
|
||||
p.text(facts.camping.text);
|
||||
p.html(p.html().replace(/\n/g, '<br />'));
|
||||
$('#card-camping').find('.content').append(p);
|
||||
}
|
||||
}
|
||||
|
||||
// Verpflegung
|
||||
if ('food' in facts) {
|
||||
$('#card-food').show();
|
||||
$('#card-food').find('p').remove();
|
||||
for (var day in facts.food) {
|
||||
var food = facts.food[day];
|
||||
if (day == 'text') {
|
||||
var p = $('<p>');
|
||||
p.text(food);
|
||||
p.html(p.html().replace(/\n/g, '<br />'));
|
||||
$('#card-food').find('.content').append(p);
|
||||
}
|
||||
else {
|
||||
day = formatDate('D, j.', parseDate(day));
|
||||
var content = '';
|
||||
if ('breakfast' in food) {
|
||||
content += 'Frühstück am ' + day;
|
||||
if (food.breakfast > 0) content += ' für <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(food.breakfast)) + '</b><br />';
|
||||
else content += ' inklusive<br />';
|
||||
}
|
||||
if ('dinner' in food) {
|
||||
content += 'Abendessen';
|
||||
if ('dinnerdesc' in food) content += ' (' + food.dinnerdesc + ')';
|
||||
content += ' am ' + day;
|
||||
if (food.dinner > 0) content += ' für <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(food.dinner)) + '</b><br />';
|
||||
else content += ' inklusive<br />';
|
||||
}
|
||||
$('#card-food').find('.content').append('<p>' + content + '</p>');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Weitere Informationen
|
||||
if ('text' in facts) {
|
||||
$('#card-text').show();
|
||||
var p = $('#card-text').find('p');
|
||||
p.text(facts.text);
|
||||
p.html(p.html().replace(/\n/g, '<br />'));
|
||||
}
|
||||
} else {
|
||||
$('#card-nofactsinfo').show();
|
||||
}
|
||||
|
||||
hideLoader();
|
||||
}
|
||||
@@ -1,3 +1,10 @@
|
||||
Element.prototype.documentOffsetTop = function() {
|
||||
return this.offsetTop + (this.offsetParent ? this.offsetParent.documentOffsetTop() : 0);
|
||||
};
|
||||
function scrollToToday() {
|
||||
window.scrollTo({ top: document.getElementById('div-today').documentOffsetTop() - (window.innerHeight / 2), behavior: 'smooth' });
|
||||
}
|
||||
|
||||
function selectChange(callSiteScript = true) {
|
||||
var val = $('#select-year').val();
|
||||
if (val == "user") {
|
||||
@@ -60,7 +67,7 @@ async function drawList () {
|
||||
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>';
|
||||
list += '<div><div id="div-today" 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;
|
||||
}
|
||||
@@ -76,6 +83,7 @@ var siteScript = async function() {
|
||||
$('#select-year').change(selectChange);
|
||||
$('#button-show').click(buttonShowPressed);
|
||||
$('#input-search').on('input', drawList);
|
||||
$('#button-totoday').click(scrollToToday);
|
||||
}
|
||||
|
||||
today = getToday();
|
||||
@@ -84,6 +92,9 @@ var siteScript = async function() {
|
||||
var maxDate = parseDate($('#input-to').val());
|
||||
var regattas = await dbGetRegattasRange(minDate, maxDate);
|
||||
|
||||
if (minDate <= today && maxDate >= today) $('#button-totoday').parent().parent().show();
|
||||
else $('#button-totoday').parent().parent().hide();
|
||||
|
||||
var selectedYear = $('#select-year').val();
|
||||
|
||||
var years = await dbGetData('years');
|
||||
|
||||
@@ -194,12 +194,10 @@ var siteScript = async function() {
|
||||
|
||||
if (isLoggedIn()) {
|
||||
var user = await dbGetData('users', USER_ID);
|
||||
var follows = await dbGetData('follows');
|
||||
followedSailors = [];
|
||||
for (var i = 1; i <= 5; i ++) {
|
||||
sailor_id = user['sailor' + i];
|
||||
if (sailor_id != null) {
|
||||
followedSailors.push(await dbGetData('sailors', sailor_id));
|
||||
}
|
||||
for (var i in follows) {
|
||||
followedSailors.push(await dbGetData('sailors', follows[i].sailor));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
define('PWA_VERSION', '1.11.7');
|
||||
define('PWA_VERSION', '1.13h6');
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user