You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
1.7 KiB
75 lines
1.7 KiB
![]()
2 years ago
|
<script setup>
|
||
|
import { useI18n } from "vue-i18n"
|
||
|
import BaseButton from "../basecomponents/BaseButton.vue"
|
||
|
import Fieldset from "primevue/fieldset"
|
||
|
import InputNumber from "primevue/inputnumber"
|
||
|
import Dropdown from "primevue/dropdown"
|
||
|
import { useCalendarReminders } from "../../composables/calendar/calendarReminders"
|
||
|
|
||
|
const { t } = useI18n()
|
||
|
|
||
|
const { agendaRemindersEnabled, periodList } = useCalendarReminders()
|
||
|
|
||
|
const model = defineModel({
|
||
|
type: Object,
|
||
|
})
|
||
|
|
||
|
model.value.reminders = model.value.reminders || []
|
||
|
|
||
|
function addEmptyReminder() {
|
||
|
model.value.reminders.push({
|
||
|
count: 0,
|
||
|
period: "i",
|
||
|
})
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<template>
|
||
|
<Fieldset
|
||
|
v-if="agendaRemindersEnabled"
|
||
|
:legend="t('Reminders')"
|
||
|
>
|
||
|
<div class="reminder-list space-y-4">
|
||
|
<BaseButton
|
||
|
:label="t('Add reminder')"
|
||
|
icon="add-event-reminder"
|
||
|
type="black"
|
||
|
@click="addEmptyReminder"
|
||
|
/>
|
||
|
|
||
|
<div
|
||
|
v-for="(reminderItem, i) in model.reminders"
|
||
|
:key="i"
|
||
|
class="flex flex-row gap-4"
|
||
|
>
|
||
|
<div class="p-inputgroup">
|
||
|
<InputNumber
|
||
|
v-model="reminderItem.count"
|
||
|
:min="0"
|
||
|
:step="1"
|
||
|
class="w-20"
|
||
|
/>
|
||
|
<Dropdown
|
||
|
v-model="reminderItem.period"
|
||
|
:options="periodList"
|
||
|
option-label="label"
|
||
|
option-value="value"
|
||
|
/>
|
||
|
<div
|
||
|
v-t="'Before'"
|
||
|
class="p-inputgroup-addon"
|
||
|
/>
|
||
|
</div>
|
||
|
|
||
|
<BaseButton
|
||
|
:label="t('Delete')"
|
||
|
icon="delete"
|
||
|
only-icon
|
||
|
type="danger"
|
||
|
@click="model.reminders.splice(i, 1)"
|
||
|
/>
|
||
|
</div>
|
||
|
</div>
|
||
|
</Fieldset>
|
||
|
</template>
|