2019-11-24 14:16:24 +01:00
|
|
|
<template>
|
|
|
|
<div class="control repeat-after-input columns">
|
2020-06-14 14:43:01 +02:00
|
|
|
<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>
|
2019-11-24 14:16:24 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-06-14 14:43:01 +02:00
|
|
|
<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>
|
2019-11-24 14:16:24 +01:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-06-17 22:15:59 +02:00
|
|
|
import Fancycheckbox from '../../input/fancycheckbox'
|
2020-06-14 14:43:01 +02:00
|
|
|
|
2019-11-24 14:16:24 +01:00
|
|
|
export default {
|
|
|
|
name: 'repeatAfter',
|
2020-06-14 14:43:01 +02:00
|
|
|
components: {Fancycheckbox},
|
2019-11-24 14:16:24 +01:00
|
|
|
data() {
|
|
|
|
return {
|
2020-06-14 14:43:01 +02:00
|
|
|
task: {},
|
2020-06-25 21:08:01 +02:00
|
|
|
repeatAfter: {
|
|
|
|
amount: 0,
|
|
|
|
type: '',
|
|
|
|
},
|
2019-11-24 14:16:24 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
value: {
|
2020-06-14 14:43:01 +02:00
|
|
|
default: () => {
|
|
|
|
},
|
2019-11-24 14:16:24 +01:00
|
|
|
required: true,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
value(newVal) {
|
2020-06-14 14:43:01 +02:00
|
|
|
this.task = newVal
|
2020-06-25 21:11:30 +02:00
|
|
|
if (typeof newVal.repeatAfter !== 'undefined') {
|
|
|
|
this.repeatAfter = newVal.repeatAfter
|
|
|
|
}
|
2019-11-24 14:16:24 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
mounted() {
|
2020-06-14 14:43:01 +02:00
|
|
|
this.task = this.value
|
2020-06-25 21:08:01 +02:00
|
|
|
if (typeof this.value.repeatAfter !== 'undefined') {
|
|
|
|
this.repeatAfter = this.value.repeatAfter
|
|
|
|
}
|
2019-11-24 14:16:24 +01:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
updateData() {
|
2020-06-14 14:43:01 +02:00
|
|
|
this.task.repeatAfter = this.repeatAfter
|
|
|
|
this.$emit('input', this.task)
|
2019-11-24 14:16:24 +01:00
|
|
|
this.$emit('change')
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2020-06-14 14:43:01 +02:00
|
|
|
<style scoped lang="scss">
|
2019-11-24 14:16:24 +01:00
|
|
|
p {
|
|
|
|
padding-top: 6px;
|
|
|
|
}
|
2020-06-14 14:43:01 +02:00
|
|
|
|
|
|
|
.field.has-addons {
|
|
|
|
|
|
|
|
margin-bottom: .5rem;
|
|
|
|
|
|
|
|
.control .select select {
|
|
|
|
height: 2.5em;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.columns {
|
|
|
|
align-items: center;
|
|
|
|
}
|
2019-11-24 14:16:24 +01:00
|
|
|
</style>
|