Add repeating tasks from current date setting
continuous-integration/drone/push Build is passing Details

This commit is contained in:
kolaente 2020-06-14 14:43:01 +02:00
parent 74ea1f5d05
commit 366c469843
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
3 changed files with 62 additions and 26 deletions

View File

@ -142,7 +142,10 @@
<icon :icon="['far', 'clock']"/>
Repeat
</div>
<repeat-after v-model="task.repeatAfter" @change="saveTask" ref="repeatAfter"/>
<repeat-after
v-model="task"
@change="saveTask"
ref="repeatAfter"/>
</div>
</div>
@ -393,14 +396,14 @@
},
computed: {
parent() {
if(!this.task.listId) {
if (!this.task.listId) {
return {
namespace: null,
list: null,
}
}
if(!this.$store.getters["namespaces/getListAndNamespaceById"]) {
if (!this.$store.getters["namespaces/getListAndNamespaceById"]) {
return null
}

View File

@ -1,61 +1,93 @@
<template>
<div class="control repeat-after-input columns">
<div class="column">
<p>
Each
</p>
</div>
<div class="column is-two-fifths">
<input class="input" placeholder="Specify an amount..." v-model="repeatAfter.amount" @change="updateData"/>
</div>
<div class="column is-two-fifths">
<div class="select">
<select v-model="repeatAfter.type" @change="updateData">
<option value="hours">Hours</option>
<option value="days">Days</option>
<option value="weeks">Weeks</option>
<option value="months">Months</option>
<option value="years">Years</option>
</select>
<p class="column is-1">
Each
</p>
<div class="column is-7 field has-addons">
<div class="control">
<input
class="input"
placeholder="Specify an amount..."
v-model="repeatAfter.amount"
@change="updateData"/>
</div>
<div class="control">
<div class="select">
<select v-model="repeatAfter.type" @change="updateData">
<option value="hours">Hours</option>
<option value="days">Days</option>
<option value="weeks">Weeks</option>
<option value="months">Months</option>
<option value="years">Years</option>
</select>
</div>
</div>
</div>
<fancycheckbox
class="column"
@change="updateData"
v-model="task.repeatFromCurrentDate"
v-tooltip="'When marking the task as done, all dates will be set relative to the current date rather than the date they had before.'"
>
Repeat from current date
</fancycheckbox>
</div>
</template>
<script>
import Fancycheckbox from '../../global/fancycheckbox'
export default {
name: 'repeatAfter',
components: {Fancycheckbox},
data() {
return {
task: {},
repeatAfter: {},
}
},
props: {
value: {
default: () => {},
default: () => {
},
required: true,
}
},
watch: {
value(newVal) {
this.repeatAfter = newVal
this.task = newVal
this.repeatAfter = newVal.repeatAfter
},
},
mounted() {
this.repeatAfter = this.value
this.task = this.value
this.repeatAfter = this.value.repeatAfter
},
methods: {
updateData() {
this.$emit('input', this.repeatAfter)
this.task.repeatAfter = this.repeatAfter
this.$emit('input', this.task)
this.$emit('change')
}
},
}
</script>
<style scoped>
<style scoped lang="scss">
p {
padding-top: 6px;
}
.field.has-addons {
margin-bottom: .5rem;
.control .select select {
height: 2.5em;
}
}
.columns {
align-items: center;
}
</style>

View File

@ -86,6 +86,7 @@ export default class TaskModel extends AbstractModel {
startDate: 0,
endDate: 0,
repeatAfter: 0,
repeatFromCurrentDate: false,
reminderDates: [],
parentTaskId: 0,
hexColor: '',