feat(reminders): make relative presets actually work
This commit is contained in:
parent
02da1e171e
commit
39cc7a00d8
@ -12,16 +12,17 @@
|
|||||||
<Card class="reminder-options-popup" :class="{'is-open': isOpen}" :padding="false">
|
<Card class="reminder-options-popup" :class="{'is-open': isOpen}" :padding="false">
|
||||||
<div class="options" v-if="showFormSwitch === null">
|
<div class="options" v-if="showFormSwitch === null">
|
||||||
<SimpleButton
|
<SimpleButton
|
||||||
class="option-button"
|
|
||||||
v-for="p in presets"
|
v-for="p in presets"
|
||||||
|
class="option-button"
|
||||||
|
@click="setReminderFromPreset(p)"
|
||||||
>
|
>
|
||||||
{{ formatReminder(p) }}
|
{{ formatReminder(p) }}
|
||||||
</SimpleButton>
|
</SimpleButton>
|
||||||
<SimpleButton @click="showFormSwitch = 'relative'" class="option-button">
|
<SimpleButton @click="showFormSwitch = 'relative'" class="option-button">
|
||||||
Custom
|
{{ $t('task.reminder.custom') }}
|
||||||
</SimpleButton>
|
</SimpleButton>
|
||||||
<SimpleButton @click="showFormSwitch = 'absolute'" class="option-button">
|
<SimpleButton @click="showFormSwitch = 'absolute'" class="option-button">
|
||||||
Date
|
{{ $t('task.reminder.dateAndTime') }}
|
||||||
</SimpleButton>
|
</SimpleButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -62,7 +63,6 @@ import {PeriodUnit, secondsToPeriod} from '@/helpers/time/period'
|
|||||||
import type {ITaskReminder} from '@/modelTypes/ITaskReminder'
|
import type {ITaskReminder} from '@/modelTypes/ITaskReminder'
|
||||||
import {formatDateShort} from '@/helpers/time/formatDate'
|
import {formatDateShort} from '@/helpers/time/formatDate'
|
||||||
|
|
||||||
import BaseButton from '@/components/base/BaseButton.vue'
|
|
||||||
import DatepickerInline from '@/components/input/datepickerInline.vue'
|
import DatepickerInline from '@/components/input/datepickerInline.vue'
|
||||||
import ReminderPeriod from '@/components/tasks/partials/reminder-period.vue'
|
import ReminderPeriod from '@/components/tasks/partials/reminder-period.vue'
|
||||||
import Popup from '@/components/misc/popup.vue'
|
import Popup from '@/components/misc/popup.vue'
|
||||||
@ -88,10 +88,10 @@ const emit = defineEmits(['update:modelValue'])
|
|||||||
const reminder = ref<ITaskReminder>(new TaskReminderModel())
|
const reminder = ref<ITaskReminder>(new TaskReminderModel())
|
||||||
|
|
||||||
const presets: TaskReminderModel[] = [
|
const presets: TaskReminderModel[] = [
|
||||||
{relativePeriod: SECONDS_A_DAY, relativeTo: REMINDER_PERIOD_RELATIVE_TO_TYPES.DUEDATE},
|
{reminder: null, relativePeriod: -1 * SECONDS_A_DAY, relativeTo: REMINDER_PERIOD_RELATIVE_TO_TYPES.DUEDATE},
|
||||||
{relativePeriod: SECONDS_A_DAY * 3, relativeTo: REMINDER_PERIOD_RELATIVE_TO_TYPES.DUEDATE},
|
{reminder: null, relativePeriod: -1 * SECONDS_A_DAY * 3, relativeTo: REMINDER_PERIOD_RELATIVE_TO_TYPES.DUEDATE},
|
||||||
{relativePeriod: SECONDS_A_DAY * 7, relativeTo: REMINDER_PERIOD_RELATIVE_TO_TYPES.DUEDATE},
|
{reminder: null, relativePeriod: -1 * SECONDS_A_DAY * 7, relativeTo: REMINDER_PERIOD_RELATIVE_TO_TYPES.DUEDATE},
|
||||||
{relativePeriod: SECONDS_A_DAY * 30, relativeTo: REMINDER_PERIOD_RELATIVE_TO_TYPES.DUEDATE},
|
{reminder: null, relativePeriod: -1 * SECONDS_A_DAY * 30, relativeTo: REMINDER_PERIOD_RELATIVE_TO_TYPES.DUEDATE},
|
||||||
]
|
]
|
||||||
const reminderDate = ref(null)
|
const reminderDate = ref(null)
|
||||||
|
|
||||||
@ -126,6 +126,11 @@ function setReminderDate() {
|
|||||||
emit('update:modelValue', reminder.value)
|
emit('update:modelValue', reminder.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setReminderFromPreset(preset) {
|
||||||
|
reminder.value = preset
|
||||||
|
emit('update:modelValue', reminder.value)
|
||||||
|
}
|
||||||
|
|
||||||
function formatReminder(reminder: TaskReminderModel) {
|
function formatReminder(reminder: TaskReminderModel) {
|
||||||
|
|
||||||
const period = secondsToPeriod(reminder.relativePeriod)
|
const period = secondsToPeriod(reminder.relativePeriod)
|
||||||
|
@ -727,7 +727,9 @@
|
|||||||
"afterShort": "after",
|
"afterShort": "after",
|
||||||
"onDueDate": "On the due date",
|
"onDueDate": "On the due date",
|
||||||
"onStartDate": "On the start date",
|
"onStartDate": "On the start date",
|
||||||
"onEndDate": "On the end date"
|
"onEndDate": "On the end date",
|
||||||
|
"custom": "Custom",
|
||||||
|
"dateAndTime": "Date and time"
|
||||||
},
|
},
|
||||||
"repeat": {
|
"repeat": {
|
||||||
"everyDay": "Every Day",
|
"everyDay": "Every Day",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user