WIP timesheet timers: create a single working time timesheet per configured periode of day, week or month

This commit is contained in:
ralf
2022-10-14 10:11:56 +02:00
parent 2dc50f52cc
commit 664bb86b2a
7 changed files with 90 additions and 23 deletions

View File

@ -509,30 +509,32 @@ egw.extend('timer', egw.MODULE_GLOBAL, function()
// check if overall working time is not disabled
if (state.disable.indexOf('overall') === -1)
{
// check if we should ask on login to start working time
this.preference('workingtime_session', 'timesheet', true).then(pref =>
// we need to wait that all JS is loaded
window.egw_ready.then(() => { window.setTimeout(() =>
{
if (pref === 'no') return;
// check if we should ask on login to start working time
this.preference('workingtime_session', 'timesheet', true).then(pref =>
{
if (pref === 'no') return;
// overall timer not running, ask to start
if (overall && !overall.start)
{
Et2Dialog.show_dialog((button) => {
if (button === Et2Dialog.YES_BUTTON)
{
timerAction('overall-start');
}
}, 'Do you want to start your working time?', 'Working time', {}, Et2Dialog.BUTTONS_YES_NO);
}
// overall timer running for more than 16 hours, ask to stop
else if (overall?.start && (((new Date()).valueOf() - overall.start.valueOf()) / 3600000) >= 16)
{
// gives a JS error, if called direct
window.setTimeout(() => {
// overall timer not running, ask to start
if (overall && !overall.start)
{
Et2Dialog.show_dialog((button) => {
if (button === Et2Dialog.YES_BUTTON)
{
timerAction('overall-start');
}
}, 'Do you want to start your working time?', 'Working time', {}, Et2Dialog.BUTTONS_YES_NO);
}
// overall timer running for more than 16 hours, ask to stop
else if (overall?.start && (((new Date()).valueOf() - overall.start.valueOf()) / 3600000) >= 16)
{
timerDialog(state.disable, 'Forgot to switch off working time?');
}, 1000);
}
});
}
});
}, 2000)});
}
},