From c31015bd70d8aae8a8986c2ab3b6cbcecdf4899f Mon Sep 17 00:00:00 2001 From: kolaente Date: Sat, 16 Jan 2021 20:20:43 +0100 Subject: [PATCH] Add "today" task filter --- src/views/tasks/ShowTasks.vue | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/views/tasks/ShowTasks.vue b/src/views/tasks/ShowTasks.vue index 13e9d34fa..be080fab8 100644 --- a/src/views/tasks/ShowTasks.vue +++ b/src/views/tasks/ShowTasks.vue @@ -30,6 +30,7 @@ />
+ Today Next Week Next Month
@@ -72,6 +73,7 @@ export default { hasUndoneTasks: false, taskService: TaskService, showNulls: true, + showOverdue: false, cStartDate: null, cEndDate: null, @@ -151,9 +153,11 @@ export default { params.filter_value.push(this.cEndDate) params.filter_comparator.push('less') - params.filter_by.push('due_date') - params.filter_value.push(this.cStartDate) - params.filter_comparator.push('greater') + if (!this.showOverdue) { + params.filter_by.push('due_date') + params.filter_value.push(this.cStartDate) + params.filter_comparator.push('greater') + } } this.taskService.getAll({}, params) @@ -188,11 +192,21 @@ export default { setDatesToNextWeek() { this.cStartDate = new Date() this.cEndDate = new Date((new Date()).getTime() + 7 * 24 * 60 * 60 * 1000) + this.showOverdue = false this.loadPendingTasks() }, setDatesToNextMonth() { this.cStartDate = new Date() this.cEndDate = new Date((new Date()).setMonth((new Date()).getMonth() + 1)) + this.showOverdue = false + this.loadPendingTasks() + }, + showTodaysTasks() { + const d = new Date() + this.cStartDate = new Date() + this.cEndDate = new Date(d.setDate(d.getDate() + 1)) + this.showNulls = false + this.showOverdue = true this.loadPendingTasks() }, },