diff --git a/routes/adminTimesheetsOverview.vue b/routes/adminTimesheetsOverview.vue
index d667f4f5c..7a3c553f5 100644
--- a/routes/adminTimesheetsOverview.vue
+++ b/routes/adminTimesheetsOverview.vue
@@ -21,6 +21,12 @@
{{period}}
+
+ <
+
+
+ >
+
Start:
@@ -62,6 +68,12 @@
+
+ Sum |
+ {{ hoursSumTotal }} |
+ |
+ |
+
@@ -99,6 +111,15 @@ export default {
setPeriod(period) {
[this.startYear, this.startMonth, this.endYear, this.endMonth] = PERIODS[period];
},
+ addPeriod(offset) {
+ const startTime = DateTime.fromObject({year: this.startYear, month: this.startMonth}).plus(offset);
+ const endTime = DateTime.fromObject({year: this.endYear, month: this.endMonth}).plus(offset);
+
+ this.startYear = startTime.year;
+ this.startMonth = startTime.month;
+ this.endYear = endTime.year;
+ this.endMonth = endTime.month;
+ },
isInRange(year, month) {
const x = DateTime.local(year, month, 15);
const begin = DateTime.local(this.startYear, this.startMonth, 1).startOf('month');
@@ -137,6 +158,13 @@ export default {
}
return sum;
},
+ hoursSumTotal() {
+ let sum = 0;
+ for (let username in this.hoursSummary) {
+ sum += this.hoursSummary[username];
+ }
+ return sum;
+ },
},
head() {
return head({
diff --git a/src/timesheets.js b/src/timesheets.js
index 109570b30..518c3a9a0 100644
--- a/src/timesheets.js
+++ b/src/timesheets.js
@@ -1,6 +1,8 @@
import {DateTime} from "luxon";
-export const max = DateTime.now();
+const now = DateTime.now();
+const prevMonth = now.minus({months: 1});
+export const max = now;
export const min = DateTime.local(2020, 1, 1);
export const closed = DateTime.now().minus({ months: 1 }).startOf('month');
@@ -46,4 +48,6 @@ export const TRANSFER_METHODS = {
export const PERIODS = {
'2020-2022': [2020, 1, 2022, 12],
'2023': [2023, 1, 2023, 12],
+ 'previous month': [now.year, now.month, now.year, now.month],
+ 'current month': [prevMonth.year, prevMonth.month, prevMonth.year, prevMonth.month],
}