fix: checkboxes

This commit is contained in:
kolaente 2021-12-29 18:06:12 +01:00
parent 0d6ef8f18a
commit f691e96e22
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 20 additions and 22 deletions

View File

@ -533,6 +533,7 @@
"titleCurrent": "Current Tasks", "titleCurrent": "Current Tasks",
"titleDates": "Tasks from {from} until {to}", "titleDates": "Tasks from {from} until {to}",
"noDates": "Show tasks without dates", "noDates": "Show tasks without dates",
"overdue": "Show overdue tasks",
"fromuntil": "Tasks from {from} until {until}", "fromuntil": "Tasks from {from} until {until}",
"select": "Select a range:", "select": "Select a range:",
"today": "Today", "today": "Today",

View File

@ -1,17 +1,24 @@
<template> <template>
<div class="is-max-width-desktop show-tasks"> <div class="is-max-width-desktop show-tasks">
<fancycheckbox
@change="setDate"
class="is-pulled-right"
v-if="!showAll"
v-model="showNulls"
>
{{ $t('task.show.noDates') }}
</fancycheckbox>
<h3 class="mb-2"> <h3 class="mb-2">
{{ pageTitle }} {{ pageTitle }}
</h3> </h3>
<p v-if="!showAll"> <p v-if="!showAll">
<fancycheckbox
@change="setDate"
v-model="showNulls"
>
{{ $t('task.show.noDates') }}
</fancycheckbox>
<fancycheckbox
@change="setDate"
v-model="showOverdue"
>
{{ $t('task.show.overdue') }}
</fancycheckbox>
{{ showOverdue ? 'true' : 'false'}}
{{ $t('task.show.select') }} {{ $t('task.show.select') }}
<datepicker-with-range @dateChanged="setDate"/> <datepicker-with-range @dateChanged="setDate"/>
</p> </p>
@ -135,8 +142,8 @@ export default {
this.$router.push({ this.$router.push({
name: this.$route.name, name: this.$route.name,
query: { query: {
from: +new Date(dateFrom), from: +new Date(dateFrom ?? this.dateFrom),
to: +new Date(dateTo), to: +new Date(dateTo ?? this.dateTo),
showOverdue: this.showOverdue, showOverdue: this.showOverdue,
showNulls: this.showNulls, showNulls: this.showNulls,
}, },
@ -150,8 +157,8 @@ export default {
return return
} }
this.showOverdue = this.$route.query.showOverdue this.showOverdue = this.$route.query.showOverdue === 'true'
this.showNulls = this.$route.query.showNulls this.showNulls = this.$route.query.showNulls === 'true'
const params = { const params = {
sort_by: ['due_date', 'id'], sort_by: ['due_date', 'id'],
@ -166,16 +173,6 @@ export default {
// FIXME: Add button to show / hide overdue // FIXME: Add button to show / hide overdue
if (!this.showAll) { if (!this.showAll) {
if (this.showNulls) {
params.filter_by.push('start_date')
params.filter_value.push(this.dateFrom)
params.filter_comparator.push('greater')
params.filter_by.push('end_date')
params.filter_value.push(this.dateTo)
params.filter_comparator.push('less')
}
params.filter_by.push('due_date') params.filter_by.push('due_date')
params.filter_value.push(this.dateTo) params.filter_value.push(this.dateTo)
params.filter_comparator.push('less') params.filter_comparator.push('less')