expenditures: added badge for open approvals
This commit is contained in:
@@ -62,6 +62,10 @@ var badges = {
|
|||||||
news: {
|
news: {
|
||||||
id: 'badge-more-news',
|
id: 'badge-more-news',
|
||||||
cnt: 0
|
cnt: 0
|
||||||
|
},
|
||||||
|
expenditures: {
|
||||||
|
id: 'badge-more-expenditures',
|
||||||
|
cnt: 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -512,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();
|
||||||
|
|
||||||
@@ -568,11 +590,11 @@ var onDatabaseLoaded = function() {
|
|||||||
onServiceWorkerLoaded();
|
onServiceWorkerLoaded();
|
||||||
initPushSettings();
|
initPushSettings();
|
||||||
|
|
||||||
updateNewsBadge();
|
updateBadges();
|
||||||
}
|
}
|
||||||
|
|
||||||
var onAfterSync = function() {
|
var onAfterSync = function() {
|
||||||
updateNewsBadge();
|
updateBadges();
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendErrorReport() {
|
function sendErrorReport() {
|
||||||
|
|||||||
@@ -71,7 +71,7 @@
|
|||||||
<a href="<?php echo LINK_PRE; ?>expenditures" class="show-loggedin">
|
<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>
|
<i class="fa font-14 fa-money-bill-wave rounded-s bg-highlight color-white"></i>
|
||||||
<span>Ausgaben-Verwaltung</span>
|
<span>Ausgaben-Verwaltung</span>
|
||||||
<!--<span id="badge-more-expenditures" class="badge bg-highlight color-white"></span>-->
|
<span id="badge-more-expenditures" 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; ?>trim_list">
|
<a href="<?php echo LINK_PRE; ?>trim_list">
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ async function expendituresInitModals() {
|
|||||||
},
|
},
|
||||||
success: async function (data, status, xhr) {
|
success: async function (data, status, xhr) {
|
||||||
await sync();
|
await sync();
|
||||||
|
updateExpendituresBadge();
|
||||||
$('#menu-add').hideMenu();
|
$('#menu-add').hideMenu();
|
||||||
hideLoader();
|
hideLoader();
|
||||||
toastOk('Ausgabe gespeichert. Betrag wurde durch ' + data.count + ' Personen geteilt.');
|
toastOk('Ausgabe gespeichert. Betrag wurde durch ' + data.count + ' Personen geteilt.');
|
||||||
@@ -199,6 +200,7 @@ async function expendituresInitModals() {
|
|||||||
},
|
},
|
||||||
success: async function (data, status, xhr) {
|
success: async function (data, status, xhr) {
|
||||||
await sync();
|
await sync();
|
||||||
|
updateExpendituresBadge();
|
||||||
$('#menu-add-transfer').hideMenu();
|
$('#menu-add-transfer').hideMenu();
|
||||||
hideLoader();
|
hideLoader();
|
||||||
toastOk(direction ? 'Geldtransfer gespeichert. ' + (await dbGetData('users', selectedUser)).username + ' muss dies noch bestätigen' : 'Geldtransfer wurde gespeichert');
|
toastOk(direction ? 'Geldtransfer gespeichert. ' + (await dbGetData('users', selectedUser)).username + ' muss dies noch bestätigen' : 'Geldtransfer wurde gespeichert');
|
||||||
|
|||||||
@@ -78,8 +78,9 @@ function expenditureAction(action, expId, successStr) {
|
|||||||
}
|
}
|
||||||
hideLoader();
|
hideLoader();
|
||||||
},
|
},
|
||||||
success: function (data, status, xhr) {
|
success: async function (data, status, xhr) {
|
||||||
sync();
|
await sync();
|
||||||
|
updateExpendituresBadge();
|
||||||
hideLoader();
|
hideLoader();
|
||||||
toastOk(successStr);
|
toastOk(successStr);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user