Compare commits

...

54 Commits

Author SHA1 Message Date
b63b4c6714 Merge branch 'hotfix/fix_expenditures_approve' 2025-05-16 17:18:27 +02:00
595c684e23 fix_expenditures_approve 2025-05-16 17:18:18 +02:00
3c0c2a3f2e Merge branch 'hotfix/fix_login' 2025-05-16 17:11:10 +02:00
ac9b5ef652 gitflow-hotfix-stash: fix_login 2025-05-16 17:10:51 +02:00
099fb6deb6 Merge branch 'hotfix/fix_login_loop' 2025-02-19 19:44:01 +01:00
f3e1620057 gitflow-hotfix-stash: fix_login_loop 2025-02-19 19:43:56 +01:00
b52eea79c2 Merge branch 'hotfix/debug_info_on_push_subscription' 2025-02-19 16:49:56 +01:00
8972d2d72a gitflow-hotfix-stash: debug_info_on_push_subscription 2025-02-19 16:49:51 +01:00
49ed27e58f Merge branch 'hotfix/menu-more-size' 2025-02-19 15:37:36 +01:00
9a5d90a703 fix menu-more-size 2025-02-19 15:37:28 +01:00
bceca97c98 Merge branch 'hotfix/expenditures_dark_mode' 2025-02-19 15:35:19 +01:00
52c6914d41 fix expenditures dark mode 2025-02-19 15:35:11 +01:00
0a323be5bf Merge branch 'release/v1.13' 2025-02-19 15:21:09 +01:00
2242cedfea release v1.13 2025-02-19 15:20:54 +01:00
69dcb13f50 Merge branch 'feature/expenditures' into develop 2025-02-19 15:18:40 +01:00
5dc88a78a2 expenditures: add: regatta_name got datalist 2025-02-19 15:18:08 +01:00
a221c86431 expenditures: Ausgleichen-Button 2025-02-19 15:05:19 +01:00
839f668b08 expenditures: added badge for open approvals 2025-02-19 14:49:21 +01:00
8f597051dd planning_edit: crew: fa-times
instead of fa-angle-right to show that by clicking the sailor will be removed
2025-02-19 14:31:45 +01:00
dd587f7603 added full expenditures functionality 2025-02-19 14:30:44 +01:00
0e501e8ba4 added table expenditures inkl sync 2025-02-18 14:02:06 +01:00
42e68e5511 changed main menu: planning <-> lists 2025-02-18 13:05:22 +01:00
2971fdd259 Merge branch 'hotfix/v1.12.1h9' 2025-02-17 13:28:49 +01:00
9360f0e943 Merge branch 'hotfix/v1.12.1h9' into develop 2025-02-17 13:28:49 +01:00
47718318ef gitflow-hotfix-stash: v1.12.1h9 2025-02-17 13:28:34 +01:00
bd4fc4c255 Merge branch 'hotfix/register_on_regatten_net' 2025-02-17 13:26:59 +01:00
1ab0e9185f Merge branch 'hotfix/register_on_regatten_net' into develop 2025-02-17 13:26:59 +01:00
027abe5364 gitflow-hotfix-stash: register_on_regatten_net 2025-02-17 13:26:08 +01:00
ostertun
29f83814ee Merge branch 'hotfix/new_follow2' 2024-02-18 13:19:12 +01:00
ostertun
deb23a5f7f Merge branch 'hotfix/new_follow2' into develop 2024-02-18 13:19:12 +01:00
ostertun
744be24410 gitflow-hotfix-stash: new_follow2 2024-02-18 13:19:04 +01:00
ostertun
633e39ce5d Merge branch 'hotfix/new_follow' 2024-02-18 13:14:12 +01:00
ostertun
bd2aafe67c Merge branch 'hotfix/new_follow' into develop 2024-02-18 13:14:12 +01:00
ostertun
2e6eb25e68 gitflow-hotfix-stash: new_follow 2024-02-18 13:13:55 +01:00
ostertun
dc2ead3a07 Merge branch 'hotfix/a53.2' 2023-11-27 09:21:05 +01:00
ostertun
ccc8731394 Merge branch 'hotfix/a53.2' into develop 2023-11-27 09:21:05 +01:00
ostertun
6b89acf422 gitflow-hotfix-stash: a53.2 2023-11-27 09:20:58 +01:00
ostertun
54ceae6ce0 Merge branch 'hotfix/a53' 2023-11-27 09:14:53 +01:00
ostertun
fe02f8707b Merge branch 'hotfix/a53' into develop 2023-11-27 09:14:52 +01:00
ostertun
a6f0c8e0f5 a53 2023-11-27 09:14:45 +01:00
ostertun
fe90438cb3 gitflow-hotfix-stash: a53 2023-11-27 09:14:19 +01:00
ostertun
8c4d2f00cd Merge branch 'temp' 2023-10-10 08:09:23 +02:00
ostertun
34ae418598 Merge branch 'hotfix/ranking_year2' into develop 2023-10-10 08:07:31 +02:00
ostertun
d59b384e1a gitflow-hotfix-stash: ranking_year2 2023-10-10 08:07:12 +02:00
ostertun
25df9995dd Merge branch 'hotfix/wfn_entrylist_link' 2023-09-04 14:26:03 +02:00
ostertun
12538aaa3f Merge branch 'hotfix/wfn_entrylist_link' into develop 2023-09-04 14:26:02 +02:00
ostertun
e087e137ff fix wfn_entrylist_link 2023-09-04 14:25:37 +02:00
ostertun
e5dc107a7d Merge branch 'hotfix/extServiceWfn' 2023-04-28 21:44:27 +02:00
ostertun
fefd3c8929 Merge branch 'hotfix/extServiceWfn' into develop 2023-04-28 21:44:26 +02:00
ostertun
dcc5428615 gitflow-hotfix-stash: extServiceWfn 2023-04-28 21:43:49 +02:00
ostertun
49f2923a97 Merge branch 'hotfix/api_move_regattenNet2' into develop 2023-03-29 12:07:52 +02:00
ostertun
0dd83a47cb Merge branch 'hotfix/api_move_ranglistenNet' into develop 2023-03-29 12:03:34 +02:00
ostertun
dd7d8731e8 remove tel num 2023-01-02 11:02:01 +01:00
ostertun
866d3ab3c1 Merge branch 'release/v_1.12.1' into develop 2022-08-03 12:32:53 +02:00
26 changed files with 1265 additions and 153 deletions

1
.gitignore vendored
View File

@@ -3,3 +3,4 @@ server/config.php
api/config.php api/config.php
.htaccess .htaccess
!.keepfolder !.keepfolder
.idea

View File

@@ -1,4 +1,4 @@
const DB_VERSION = 8; const DB_VERSION = 10;
const USER_ID = localStorage.getItem('auth_user'); const USER_ID = localStorage.getItem('auth_user');
const USER_NAME = localStorage.getItem('auth_username'); const USER_NAME = localStorage.getItem('auth_username');
@@ -44,15 +44,17 @@ function search(string, fields) {
var keywords = string.split(' '); var keywords = string.split(' ');
for (kid in keywords) { for (kid in keywords) {
var keyword = keywords[kid].toLowerCase(); var keyword = keywords[kid].toLowerCase();
var found = false; if (keyword != '') {
for (fid in fields) { var found = false;
var field = fields[fid].toLowerCase(); for (fid in fields) {
if (field.indexOf(keyword) >= 0) { var field = fields[fid].toLowerCase();
found = true; if (field.indexOf(keyword) >= 0) {
break; found = true;
break;
}
} }
if (!found) return false;
} }
if (!found) return false;
} }
return true; return true;
} }
@@ -163,6 +165,15 @@ function dbGetResultCalculated(regatta) {
if (results.length > 0) { if (results.length > 0) {
var gemeldet = results.length; 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) { for (id in results) {
results[id]['finished'] = false; results[id]['finished'] = false;
@@ -179,24 +190,25 @@ function dbGetResultCalculated(regatta) {
results[id]['texts'][i] = race; results[id]['texts'][i] = race;
results[id]['finished'] = true; results[id]['finished'] = true;
} else { } else {
var p1points = (regatta.a53 ? started[i] : gemeldet) + 1;
switch (race.toUpperCase()) { switch (race.toUpperCase()) {
// Nicht gestartet // Nicht gestartet
case 'DNC': results[id]['values'][i] = gemeldet + 1; copy[i] = gemeldet + 1; break; // Did not come 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 // Startfehler
case 'OCS': results[id]['values'][i] = gemeldet + 1; copy[i] = gemeldet + 1; break; // On course site case 'OCS': results[id]['values'][i] = p1points; copy[i] = p1points; 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 'UFD': results[id]['values'][i] = p1points; copy[i] = p1points; 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 'BFD': results[id]['values'][i] = p1points; copy[i] = p1points; break; // Black Flag Disqualified (disqu. nach 30.4)
// Nicht durch Ziel gegangen // Nicht durch Ziel gegangen
case 'DNF': results[id]['values'][i] = gemeldet + 1; copy[i] = gemeldet + 1; break; // Did not finish case 'DNF': results[id]['values'][i] = p1points; copy[i] = p1points; break; // Did not finish
case 'RET': results[id]['values'][i] = gemeldet + 1; copy[i] = gemeldet + 1; break; // Retired (Aufgegeben) case 'RET': results[id]['values'][i] = p1points; copy[i] = p1points; break; // Retired (Aufgegeben)
case 'RAF': results[id]['values'][i] = gemeldet + 1; copy[i] = gemeldet + 1; break; // Retired after finish case 'RAF': results[id]['values'][i] = p1points; copy[i] = p1points; break; // Retired after finish
// Kursfehler // 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 // Disqualifizierun
case 'DSQ': results[id]['values'][i] = gemeldet + 1; copy[i] = gemeldet + 1; break; // Disqualified case 'DSQ': results[id]['values'][i] = p1points; copy[i] = p1points; 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 '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] = gemeldet + 1; copy[i] = -2; break; // Disqualification Gross Missconduct (kann nach 69.1(b)(2) nicht gestr. werden, grobes Fehlverhalten) 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 // Unbekannt
default: results[id]['values'][i] = 0; copy[i] = 0; break; default: results[id]['values'][i] = 0; copy[i] = 0; break;
} }
@@ -224,9 +236,10 @@ function dbGetResultCalculated(regatta) {
var netto = 0; var netto = 0;
for (var i = 0; i < regatta['races']; i ++) { for (var i = 0; i < regatta['races']; i ++) {
brutto += results[id]['values_all'][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 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) { if (results[id]['values'][i] == 0) {
results[id]['texts'][i] = '[' + results[id]['texts'][i] + ']'; results[id]['texts'][i] = '[' + results[id]['texts'][i] + ']';
} }
@@ -608,7 +621,7 @@ function sync() {
localTimes[entry['table']] = entry['time']; localTimes[entry['table']] = entry['time'];
}); });
syncInProgress = 13; syncInProgress = 15;
var syncOkay = true; var syncOkay = true;
log("[db] Sync Start"); log("[db] Sync Start");
$('#i-sync').addClass('fa-spin'); $('#i-sync').addClass('fa-spin');
@@ -997,8 +1010,68 @@ function sync() {
syncInProgress --; 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 { } else {
syncInProgress -= 3; syncInProgress -= 5;
} }
// NEWS // NEWS
@@ -1225,6 +1298,19 @@ function initDatabase() {
var osRankings = db.createObjectStore('rankings', { keyPath: 'id' }); 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 // Force resync after db update
if (oldVersion >= 1) { if (oldVersion >= 1) {
var osUpdateTimes = upgradeTransaction.objectStore('update_times'); var osUpdateTimes = upgradeTransaction.objectStore('update_times');
@@ -1241,7 +1327,30 @@ function initDatabase() {
function resetDb() { function resetDb() {
if (canUseLocalDB) { if (canUseLocalDB) {
showLoader(); 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: 'last_sync', time: 1 });
osUpdateTimes.put({ table: 'clubs', time: 0 }); osUpdateTimes.put({ table: 'clubs', time: 0 });
osUpdateTimes.put({ table: 'boats', time: 0 }); osUpdateTimes.put({ table: 'boats', time: 0 });
@@ -1254,6 +1363,9 @@ function resetDb() {
osUpdateTimes.put({ table: 'trim_trims', time: 0 }); osUpdateTimes.put({ table: 'trim_trims', time: 0 });
osUpdateTimes.put({ table: 'news', time: 0 }); osUpdateTimes.put({ table: 'news', time: 0 });
osUpdateTimes.put({ table: 'users', 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'); log('[db] DB update times reset');
hideLoader(); hideLoader();
} }

View File

@@ -62,7 +62,11 @@ var badges = {
news: { news: {
id: 'badge-more-news', id: 'badge-more-news',
cnt: 0 cnt: 0
} },
expenditures: {
id: 'badge-more-expenditures',
cnt: 0
}
} }
} }
}; };
@@ -157,51 +161,6 @@ function findGetParameter(parameterName) {
return result; 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() { var login = function() {
log('[app] Login'); log('[app] Login');
showLoader(); showLoader();
@@ -361,7 +320,7 @@ function pushesSubscribe() {
applicationServerKey: applicationServerKey applicationServerKey: applicationServerKey
}) })
.then(async function(subscription) { .then(async function(subscription) {
log('[app] Subscription:', subscription); log('[app] Subscription:', JSON.stringify(subscription));
if (await pushesUpdateServerSubscription(subscription, true)) { if (await pushesUpdateServerSubscription(subscription, true)) {
log('[app] Subscription: Sent to server, updating UI'); log('[app] Subscription: Sent to server, updating UI');
dbSettingsSet('notify_endpoint_' + BOATCLASS, subscription.endpoint); dbSettingsSet('notify_endpoint_' + BOATCLASS, subscription.endpoint);
@@ -387,7 +346,7 @@ function pushesUnSubscribe(silent = false) {
log('[app] Unsubscribing'); log('[app] Unsubscribing');
swRegistration.pushManager.getSubscription() swRegistration.pushManager.getSubscription()
.then(async function(subscription) { .then(async function(subscription) {
log('[app] Subscription:', subscription); log('[app] Subscription:', JSON.stringify(subscription));
if (subscription) { if (subscription) {
if (await pushesUpdateServerSubscription(subscription, false)) { if (await pushesUpdateServerSubscription(subscription, false)) {
log('[app] Subscription: Removed from server'); log('[app] Subscription: Removed from server');
@@ -415,7 +374,7 @@ function pushesUnSubscribe(silent = false) {
function pushesUpdateServerSubscription(subscription, enabled) { function pushesUpdateServerSubscription(subscription, enabled) {
return new Promise(function(resolve){ return new Promise(function(resolve){
log('[app] updateServer', enabled, subscription); log('[app] updateServer', enabled, JSON.stringify(subscription));
$.ajax({ $.ajax({
url: QUERY_URL + (enabled ? 'add' : 'remove') + '_subscription', url: QUERY_URL + (enabled ? 'add' : 'remove') + '_subscription',
type: 'POST', type: 'POST',
@@ -518,7 +477,7 @@ function updatePushBadge() {
var dbSub = await dbSettingsGet('notify_endpoint_' + BOATCLASS); var dbSub = await dbSettingsGet('notify_endpoint_' + BOATCLASS);
var isSub = (subscription !== null); var isSub = (subscription !== null);
log('[app] DB Subscription:', dbSub); log('[app] DB Subscription:', dbSub);
log('[app] Real Subscription:', subscription); log('[app] Real Subscription:', JSON.stringify(subscription));
if (isSub) { if (isSub) {
$('#badge-pushes').removeClass('bg-red2-dark').addClass('bg-green2-dark').text('AN'); $('#badge-pushes').removeClass('bg-red2-dark').addClass('bg-green2-dark').text('AN');
if (dbSub === null) dbSettingsSet('notify_endpoint_' + BOATCLASS, subscription.endpoint); if (dbSub === null) dbSettingsSet('notify_endpoint_' + BOATCLASS, subscription.endpoint);
@@ -557,6 +516,24 @@ async function updateNewsBadge() {
updateBadge('more/news', sum); 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() { var initRegatten = function() {
showLoader(); showLoader();
@@ -613,11 +590,11 @@ var onDatabaseLoaded = function() {
onServiceWorkerLoaded(); onServiceWorkerLoaded();
initPushSettings(); initPushSettings();
updateNewsBadge(); updateBadges();
} }
var onAfterSync = function() { var onAfterSync = function() {
updateNewsBadge(); updateBadges();
} }
function sendErrorReport() { function sendErrorReport() {
@@ -680,12 +657,21 @@ function ro_getLink(type, eventId, classId) {
} }
return ''; 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 = '') { function extServiceGetLink(serviceName, type, eventId = '', classId = '') {
switch (serviceName) { switch (serviceName) {
case 'm2s': case 'm2s':
return m2s_getLink(type, eventId, classId); return m2s_getLink(type, eventId, classId);
case 'ro': case 'ro':
return ro_getLink(type, eventId); return ro_getLink(type, eventId, classId);
case 'wfn':
return wfn_getLink(type, eventId, classId);
} }
return ''; return '';
} }

View File

@@ -144,6 +144,72 @@
text-align: right; 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 ***/
.normal-list > div { .normal-list > div {
padding-top: 1rem; padding-top: 1rem;

View File

@@ -2,7 +2,7 @@
$sp['title'] = 'Boote - Regatten.net ' . $_CLASS['name']; $sp['title'] = 'Boote - Regatten.net ' . $_CLASS['name'];
$sp['backbutton'] = 'index'; $sp['backbutton'] = 'index';
$sp['activenav'] = 4; $sp['activenav'] = 5;
// Title // Title
$content = "<h1>Boote</h1>"; $content = "<h1>Boote</h1>";

View File

@@ -2,7 +2,7 @@
$sp['title'] = 'Vereine - Regatten.net ' . $_CLASS['name']; $sp['title'] = 'Vereine - Regatten.net ' . $_CLASS['name'];
$sp['backbutton'] = 'index'; $sp['backbutton'] = 'index';
$sp['activenav'] = 4; $sp['activenav'] = 5;
// Title // Title
$content = "<h1>Vereine</h1>"; $content = "<h1>Vereine</h1>";

View File

@@ -1,28 +1,28 @@
<?php <?php
$sp['title'] = 'Kontakt - Regatten.net ' . $_CLASS['name']; $sp['title'] = 'Kontakt - Regatten.net ' . $_CLASS['name'];
$sp['backbutton'] = true; $sp['backbutton'] = true;
$sp['activenav'] = 5; $sp['activenav'] = 5;
// TITLE // TITLE
$content = '<h1>Kontakt</h1>'; $content = '<h1>Kontakt</h1>';
$sp['output'] .= $tpl->load('card', [$content]); $sp['output'] .= $tpl->load('card', [$content]);
// Info // Info
$content = '<p>'; $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&uuml;r Deine Bootsklasse nutzen?<br>'; $content .= 'Du hast eine Frage? Du hast einen Fehler in unserer Software oder in den gespeicherten Daten gefunden? Du willst Regatten.net auch f&uuml;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 .= '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&ouml;glich bearbeiten.'; $content .= 'Wir werden Deine Anfrage so schnell wie m&ouml;glich bearbeiten.';
$content .= '</p>'; $content .= '</p>';
$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 .= '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 .= 'Mo-Fr: 7-20 Uhr<br>';
$content .= 'Sa: 9-17 Uhr'; //$content .= 'Sa: 9-17 Uhr';
$content .= '</p>'; //$content .= '</p>';
$sp['output'] .= $tpl->load('card', [$content]); $sp['output'] .= $tpl->load('card', [$content]);
// Formular // Formular
$content = '<h2>Kontakt-Formular</h2>'; $content = '<h2>Kontakt-Formular</h2>';
$content .= $tpl->load('input', ['html-id' => 'input-name', 'placeholder' => 'Dein Name', 'type' => 'text']); $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('input', ['html-id' => 'input-subject', 'placeholder' => 'Betreff', 'type' => 'text']);
$content .= $tpl->load('textarea', ['html-id' => 'input-message', 'placeholder' => 'Deine Nachricht']); $content .= $tpl->load('textarea', ['html-id' => 'input-message', 'placeholder' => 'Deine Nachricht']);
$content .= $tpl->load('button', ['Senden', '#', 'html-id' => 'button-send']); $content .= $tpl->load('button', ['Senden', '#', 'html-id' => 'button-send']);
$sp['output'] .= $tpl->load('card', [$content]); $sp['output'] .= $tpl->load('card', [$content]);
$sp['scripts'] .= $scripts->load('contact'); $sp['scripts'] .= $scripts->load('contact');
?> ?>

View 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>&ensp;Neue Ausgabe', '#', 'html-id' => 'button-add', 'css-class' => 'mt-3 mb-2']);
$content .= $tpl->load('button', ['<i class="fas fa-plus"></i>&ensp;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>&ensp;genehmigt<br>';
$content .= '<i class="fas fa-times"></i>&ensp;storniert<br>';
$content .= '<i class="fas fa-hourglass-half"></i>&ensp;wartet auf Zustimmung von <span class="span-username"></span><br>';
$content .= '<i class="fas fa-exclamation"></i>&ensp;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&uuml;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');
?>

View 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>&ensp;Neue Ausgabe', '#', 'html-id' => 'button-add', 'css-class' => 'mt-3 mb-2']);
$content .= $tpl->load('button', ['<i class="fas fa-plus"></i>&ensp;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&uuml;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');
?>

View File

@@ -32,7 +32,7 @@
$content = '<h2>Nicht angemeldet</h2>'; $content = '<h2>Nicht angemeldet</h2>';
$content .= '<p class="mt-3">'; $content .= '<p class="mt-3">';
$content .= 'Um alle Funktionen dieser Seite nutzen zu k&ouml;nnen, <a href="#" data-menu="menu-login">logge Dich bitte ein</a>.<br>'; $content .= 'Um alle Funktionen dieser Seite nutzen zu k&ouml;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>'; $content .= '</p>';
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-notloggedin']); $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>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 .= '<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-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&ouml;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&ouml;nlichen Kalender.</font>';
$content .= '</p>'; $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> 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&uuml;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> Kalender f&uuml;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]); $sp['output'] .= $tpl->load('card', [$content]);

View File

@@ -2,7 +2,7 @@
$sp['title'] = 'Saison-Planung - Regatten.net ' . $_CLASS['name']; $sp['title'] = 'Saison-Planung - Regatten.net ' . $_CLASS['name'];
$sp['backbutton'] = 'index'; $sp['backbutton'] = 'index';
$sp['activenav'] = 5; $sp['activenav'] = 4;
// Title // Title
$content = '<h1>Saison-Planung</h1>'; $content = '<h1>Saison-Planung</h1>';
@@ -15,7 +15,7 @@
// Not loggedin // Not loggedin
$content = '<h1>Saison-Planung</h1>'; $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']); $sp['output'] .= $tpl->load('card', [$content, 'css-class' => 'show-notloggedin']);

View File

@@ -2,7 +2,7 @@
$sp['title'] = 'Saison-Planung bearbeiten - Regatten.net ' . $_CLASS['name']; $sp['title'] = 'Saison-Planung bearbeiten - Regatten.net ' . $_CLASS['name'];
$sp['backbutton'] = true; $sp['backbutton'] = true;
$sp['activenav'] = 5; $sp['activenav'] = 4;
// Title, Inputs // Title, Inputs
$content = "<h1>Saison-Planung bearbeiten</h1>"; $content = "<h1>Saison-Planung bearbeiten</h1>";

View File

@@ -2,7 +2,7 @@
$sp['title'] = 'Saison-Planungen - Regatten.net ' . $_CLASS['name']; $sp['title'] = 'Saison-Planungen - Regatten.net ' . $_CLASS['name'];
$sp['backbutton'] = true; $sp['backbutton'] = true;
$sp['activenav'] = 5; $sp['activenav'] = 4;
// Title // Title
$content = '<h1>Saison-Planungen</h1>'; $content = '<h1>Saison-Planungen</h1>';
@@ -12,7 +12,7 @@
// Not loggedin // Not loggedin
$content = '<h1>Saison-Planungen</h1>'; $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']); $sp['output'] .= $tpl->load('card', [$content, 'css-class' => 'show-notloggedin']);

View File

@@ -2,7 +2,7 @@
$sp['title'] = 'Saison-Planung - Regatten.net ' . $_CLASS['name']; $sp['title'] = 'Saison-Planung - Regatten.net ' . $_CLASS['name'];
$sp['backbutton'] = true; $sp['backbutton'] = true;
$sp['activenav'] = 5; $sp['activenav'] = 4;
// Title // Title
$content = '<h1>Saison-Planung</h1>'; $content = '<h1>Saison-Planung</h1>';

View File

@@ -21,7 +21,7 @@
$content = '<p>Du planst, hier hinzufahren, aber stehst nicht auf dieser Liste?<br>'; $content = '<p>Du planst, hier hinzufahren, aber stehst nicht auf dieser Liste?<br>';
$content .= 'Das kannst Du &auml;ndern! '; $content .= 'Das kannst Du &auml;ndern! ';
$content .= '<font class="show-loggedin">Erstelle einfach <a href="' . LINK_PRE . 'planning">hier</a> Deine eigene Saison-Planung.</font>'; $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>'; $content .= '</p>';
$sp['output'] .= $tpl->load('card', [$content]); $sp['output'] .= $tpl->load('card', [$content]);

View File

@@ -2,7 +2,7 @@
$sp['title'] = 'Segler - Regatten.net ' . $_CLASS['name']; $sp['title'] = 'Segler - Regatten.net ' . $_CLASS['name'];
$sp['backbutton'] = 'index'; $sp['backbutton'] = 'index';
$sp['activenav'] = 4; $sp['activenav'] = 5;
// Title // Title
$content = "<h1>Segler</h1>"; $content = "<h1>Segler</h1>";

View File

@@ -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; ?>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; ?>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="<?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> <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> </div>

View File

@@ -57,7 +57,7 @@
</div> </div>
</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">&nbsp;</p><a href="#" class="close-menu"><i class="fa fa-times"></i></a></div> <div class="menu-title"><h1>Mehr</h1><p class="color-highlight">&nbsp;</p><a href="#" class="close-menu"><i class="fa fa-times"></i></a></div>
<div class="divider divider-margins mb-n2"></div> <div class="divider divider-margins mb-n2"></div>
<div class="content"> <div class="content">
@@ -68,11 +68,12 @@
<span id="badge-more-news" class="badge bg-highlight color-white"></span> <span id="badge-more-news" class="badge bg-highlight color-white"></span>
<i class="fa fa-angle-right"></i> <i class="fa fa-angle-right"></i>
</a> </a>
<a href="<?php echo LINK_PRE; ?>planning"> <a href="<?php echo LINK_PRE; ?>expenditures" class="show-loggedin">
<i class="fa font-14 fa-calendar-alt rounded-s bg-highlight color-white"></i> <i class="fa font-14 fa-money-bill-wave rounded-s bg-highlight color-white"></i>
<span>Saison-Planung</span> <span>Ausgaben-Verwaltung</span>
<i class="fa fa-angle-right"></i> <span id="badge-more-expenditures" class="badge bg-highlight color-white"></span>
</a> <i class="fa fa-angle-right"></i>
</a>
<a href="<?php echo LINK_PRE; ?>trim_list"> <a href="<?php echo LINK_PRE; ?>trim_list">
<i class="fa font-14 fa-book rounded-s bg-highlight color-white"></i> <i class="fa font-14 fa-book rounded-s bg-highlight color-white"></i>
<span>Trimm-B&uuml;cher</span> <span>Trimm-B&uuml;cher</span>
@@ -83,6 +84,11 @@
<span>RLP-Rechner</span> <span>RLP-Rechner</span>
<i class="fa fa-angle-right"></i> <i class="fa fa-angle-right"></i>
</a> </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"> <a href="<?php echo LINK_PRE; ?>contact" class="border-0">
<i class="fa font-14 fa-phone rounded-s bg-highlight color-white"></i> <i class="fa font-14 fa-phone rounded-s bg-highlight color-white"></i>
<span>Kontakt</span> <span>Kontakt</span>
@@ -110,7 +116,7 @@
<span>Login</span> <span>Login</span>
<i class="fa fa-angle-right"></i> <i class="fa fa-angle-right"></i>
</a> </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> <i class="fa font-14 fa-user-plus rounded-s bg-highlight color-white"></i>
<span>Registrieren</span> <span>Registrieren</span>
<span class="badge bg-red2-dark color-white">FREE</span> <span class="badge bg-red2-dark color-white">FREE</span>
@@ -266,28 +272,6 @@
</div> </div>
</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 id="menu-welcome" class="menu menu-box-bottom" style="height: 70vh">
<div class="content bottom-0"> <div class="content bottom-0">
<h1 class="text-center font-900">Willkommen</h1> <h1 class="text-center font-900">Willkommen</h1>
@@ -300,9 +284,6 @@
<p> <p>
Mehr Informationen findest Du <a href="https://info.ostertun.net/regatten/beta">hier</a>. Mehr Informationen findest Du <a href="https://info.ostertun.net/regatten/beta">hier</a>.
</p> </p>
<p>
Mit der Nutzung dieser App erkl&auml;rst Du Dich au&szlig;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> <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>
</div> </div>
@@ -317,7 +298,7 @@
Das Nachladen kann au&szlig;erdem gerade bei gro&szlig;en Datenmengen (wie Ranglisten) sehr lange dauern. Das Nachladen kann au&szlig;erdem gerade bei gro&szlig;en Datenmengen (wie Ranglisten) sehr lange dauern.
Wir empfehlen Dir daher, auf diesem Ger&auml;t unsere normale Website zu benutzen. Diese ist auch f&uuml;r Mobil-Ger&auml;te optimiert. Wir empfehlen Dir daher, auf diesem Ger&auml;t unsere normale Website zu benutzen. Diese ist auch f&uuml;r Mobil-Ger&auml;te optimiert.
</p> </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> <a id="menu-nodb-warning-okay" class="btn btn-m mt-2 mb-3 btn-full bg-highlight text-uppercase font-900" href="#">Nicht erneut anzeigen</a>
</div> </div>
</div> </div>

View 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();
}

View 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 = '&emsp;<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 = '&emsp;<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();
}

View 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();
}

View File

@@ -85,12 +85,10 @@ var siteScript = async function() {
var user = await dbGetData('users', localStorage.getItem('auth_user')); var user = await dbGetData('users', localStorage.getItem('auth_user'));
// Favorites // Favorites
var follows = await dbGetData('follows');
var watched = []; var watched = [];
for (var i = 1; i <= 5; i ++) { for (var i in follows) {
sailor_id = user['sailor' + i]; watched.push(await dbGetData('sailors', follows[i].sailor));
if (sailor_id != null) {
watched.push(await dbGetData('sailors', sailor_id));
}
} }
if (watched.length > 0) { if (watched.length > 0) {
var year = (new Date()).getFullYear(); var year = (new Date()).getFullYear();

View File

@@ -367,7 +367,7 @@ async function planningEdit(id) {
if (sailor !== null) { if (sailor !== null) {
var item = '<a class="item-crew" onclick="planningChangeCrew(' + sailor.id + ')">'; var item = '<a class="item-crew" onclick="planningChangeCrew(' + sailor.id + ')">';
item += '<span>' + sailor.name + '</span>'; item += '<span>' + sailor.name + '</span>';
item += '<i class="fa fa-angle-right"></i>'; item += '<i class="fa fa-times"></i>';
item += '</a>'; item += '</a>';
$('#menu-edit').find('.content').find('.list-group').append(item); $('#menu-edit').find('.content').find('.list-group').append(item);
} }

View File

@@ -166,7 +166,7 @@ function selectChange(callSiteScript = true) {
var btns = ''; var btns = '';
for (var i in specialRanks) { for (var i in specialRanks) {
var sr = specialRanks[i]; var sr = specialRanks[i];
var link = 'https://regatten.net/frame.php?class=' + BOATCLASS + '&site=special_rank&rank_id=' + sr.id; var link = 'https://ranglisten.net/frame.php?class=' + BOATCLASS + '&site=special_rank&rank_id=' + sr.id;
var name = sr.title; var name = sr.title;
var cssclass = i > 0 ? ' mt-3' : ''; 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>'; btns += '<a class="btn btn-full rounded-s text-uppercase font-900 shadow-m bg-highlight' + cssclass + '" href="' + link + '">' + name + '</a>';
@@ -196,6 +196,10 @@ function selectChange(callSiteScript = true) {
from = (year - 1) + '-12-01'; from = (year - 1) + '-12-01';
to = year + '-11-30'; to = year + '-11-30';
break; break;
case 'year2':
from = year + '-01-01';
to = year + '-12-31';
break;
case 'quali': case 'quali':
// TODO: auslagern in function getRegattaBegin // TODO: auslagern in function getRegattaBegin
var beginn = null; var beginn = null;
@@ -384,6 +388,16 @@ var siteScript = async function() {
lastRanking[lDbRanking[i].id] = lDbRanking[i].rank; 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;
}
}
var selectedYear = $('#select-year').val(); var selectedYear = $('#select-year').val();

View File

@@ -194,12 +194,10 @@ var siteScript = async function() {
if (isLoggedIn()) { if (isLoggedIn()) {
var user = await dbGetData('users', USER_ID); var user = await dbGetData('users', USER_ID);
var follows = await dbGetData('follows');
followedSailors = []; followedSailors = [];
for (var i = 1; i <= 5; i ++) { for (var i in follows) {
sailor_id = user['sailor' + i]; followedSailors.push(await dbGetData('sailors', follows[i].sailor));
if (sailor_id != null) {
followedSailors.push(await dbGetData('sailors', sailor_id));
}
} }
} }

View File

@@ -1,5 +1,5 @@
<?php <?php
define('PWA_VERSION', '1.12.1h2'); define('PWA_VERSION', '1.13h6');
?> ?>