chore: make showNulls and showOverdue computed
This commit is contained in:
parent
f691e96e22
commit
d825960836
1 changed files with 26 additions and 20 deletions
|
@ -4,21 +4,12 @@
|
||||||
{{ pageTitle }}
|
{{ pageTitle }}
|
||||||
</h3>
|
</h3>
|
||||||
<p v-if="!showAll">
|
<p v-if="!showAll">
|
||||||
<fancycheckbox
|
<fancycheckbox @change="setShowNulls">
|
||||||
@change="setDate"
|
|
||||||
v-model="showNulls"
|
|
||||||
>
|
|
||||||
{{ $t('task.show.noDates') }}
|
{{ $t('task.show.noDates') }}
|
||||||
</fancycheckbox>
|
</fancycheckbox>
|
||||||
<fancycheckbox
|
<fancycheckbox @change="setShowOverdue">
|
||||||
@change="setDate"
|
|
||||||
v-model="showOverdue"
|
|
||||||
>
|
|
||||||
{{ $t('task.show.overdue') }}
|
{{ $t('task.show.overdue') }}
|
||||||
</fancycheckbox>
|
</fancycheckbox>
|
||||||
|
|
||||||
{{ showOverdue ? 'true' : 'false'}}
|
|
||||||
|
|
||||||
{{ $t('task.show.select') }}
|
{{ $t('task.show.select') }}
|
||||||
<datepicker-with-range @dateChanged="setDate"/>
|
<datepicker-with-range @dateChanged="setDate"/>
|
||||||
</p>
|
</p>
|
||||||
|
@ -66,12 +57,6 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
tasks: [],
|
tasks: [],
|
||||||
showNulls: true,
|
|
||||||
showOverdue: false,
|
|
||||||
|
|
||||||
// TODO: Set the date range based on the default (to make sure it shows up in the picker) -> maybe also use a computed which depends on dateFrom and dateTo?
|
|
||||||
dateRange: null,
|
|
||||||
|
|
||||||
showNothingToDo: false,
|
showNothingToDo: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -108,6 +93,12 @@ export default {
|
||||||
? d
|
? d
|
||||||
: this.endDate
|
: this.endDate
|
||||||
},
|
},
|
||||||
|
showNulls() {
|
||||||
|
return this.$route.query.showNulls === 'true'
|
||||||
|
},
|
||||||
|
showOverdue() {
|
||||||
|
return this.$route.query.showOverdue === 'true'
|
||||||
|
},
|
||||||
pageTitle() {
|
pageTitle() {
|
||||||
const title = this.showAll
|
const title = this.showAll
|
||||||
? this.$t('task.show.titleCurrent')
|
? this.$t('task.show.titleCurrent')
|
||||||
|
@ -149,6 +140,24 @@ export default {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
setShowOverdue(show) {
|
||||||
|
this.$router.push({
|
||||||
|
name: this.$route.name,
|
||||||
|
query: {
|
||||||
|
...this.$route.query,
|
||||||
|
showOverdue: show,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
setShowNulls(show) {
|
||||||
|
this.$router.push({
|
||||||
|
name: this.$route.name,
|
||||||
|
query: {
|
||||||
|
...this.$route.query,
|
||||||
|
showNulls: show,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
async loadPendingTasks() {
|
async loadPendingTasks() {
|
||||||
// Since this route is authentication only, users would get an error message if they access the page unauthenticated.
|
// Since this route is authentication only, users would get an error message if they access the page unauthenticated.
|
||||||
// Since this component is mounted as the home page before unauthenticated users get redirected
|
// Since this component is mounted as the home page before unauthenticated users get redirected
|
||||||
|
@ -157,9 +166,6 @@ export default {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.showOverdue = this.$route.query.showOverdue === 'true'
|
|
||||||
this.showNulls = this.$route.query.showNulls === 'true'
|
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
sort_by: ['due_date', 'id'],
|
sort_by: ['due_date', 'id'],
|
||||||
order_by: ['desc', 'desc'],
|
order_by: ['desc', 'desc'],
|
||||||
|
|
Loading…
Reference in a new issue