Add checkbox to show only tasks which have a due date

This commit is contained in:
kolaente 2020-07-22 12:39:07 +02:00
parent 8d18ef1dbb
commit a09cefd9f1
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -1,5 +1,13 @@
<template> <template>
<div class="is-max-width-desktop show-tasks"> <div class="is-max-width-desktop show-tasks">
<fancycheckbox
class="is-pulled-right"
v-if="!showAll"
v-model="showNulls"
@change="loadPendingTasks"
>
Show tasks without dates
</fancycheckbox>
<h3 v-if="showAll">Current tasks</h3> <h3 v-if="showAll">Current tasks</h3>
<h3 v-else> <h3 v-else>
Tasks from Tasks from
@ -21,7 +29,7 @@
@on-close="loadPendingTasks" @on-close="loadPendingTasks"
/> />
</h3> </h3>
<template v-if="!taskService.loading && (!hasUndoneTasks || !tasks)"> <template v-if="!taskService.loading && (!hasUndoneTasks || !tasks || tasks.length === 0)">
<h3 class="nothing">Nothing to do - Have a nice day!</h3> <h3 class="nothing">Nothing to do - Have a nice day!</h3>
<img src="/images/cool.svg" alt=""/> <img src="/images/cool.svg" alt=""/>
</template> </template>
@ -41,10 +49,12 @@
import flatPickr from 'vue-flatpickr-component' import flatPickr from 'vue-flatpickr-component'
import 'flatpickr/dist/flatpickr.css' import 'flatpickr/dist/flatpickr.css'
import Fancycheckbox from '../../components/input/fancycheckbox'
export default { export default {
name: 'ShowTasks', name: 'ShowTasks',
components: { components: {
Fancycheckbox,
SingleTaskInList, SingleTaskInList,
flatPickr, flatPickr,
}, },
@ -53,6 +63,7 @@
tasks: [], tasks: [],
hasUndoneTasks: false, hasUndoneTasks: false,
taskService: TaskService, taskService: TaskService,
showNulls: true,
cStartDate: null, cStartDate: null,
cEndDate: null, cEndDate: null,
@ -115,9 +126,10 @@
filter_value: [false], filter_value: [false],
filter_comparator: ['equals'], filter_comparator: ['equals'],
filter_concat: 'and', filter_concat: 'and',
filter_include_nulls: true, filter_include_nulls: this.showNulls,
} }
if (!this.showAll) { if (!this.showAll) {
if(this.showNulls) {
params.filter_by.push('start_date') params.filter_by.push('start_date')
params.filter_value.push(this.cStartDate) params.filter_value.push(this.cStartDate)
params.filter_comparator.push('greater') params.filter_comparator.push('greater')
@ -125,6 +137,7 @@
params.filter_by.push('end_date') params.filter_by.push('end_date')
params.filter_value.push(this.cEndDate) params.filter_value.push(this.cEndDate)
params.filter_comparator.push('less') params.filter_comparator.push('less')
}
params.filter_by.push('due_date') params.filter_by.push('due_date')
params.filter_value.push(this.cEndDate) params.filter_value.push(this.cEndDate)