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.
39 lines
903 B
39 lines
903 B
|
2 years ago
|
import { usePlatformConfig } from "../../store/platformConfig"
|
||
|
|
import { useI18n } from "vue-i18n"
|
||
|
|
|
||
|
|
export function useCalendarReminders() {
|
||
|
|
const platformConfigStore = usePlatformConfig()
|
||
|
|
|
||
|
|
const { t } = useI18n()
|
||
|
|
|
||
|
|
const agendaRemindersEnabled = "true" === platformConfigStore.getSetting("agenda.agenda_reminders")
|
||
|
|
|
||
|
|
const periodList = [
|
||
|
|
{ label: t("Minutes"), value: "i" },
|
||
|
|
{ label: t("Hours"), value: "h" },
|
||
|
|
{ label: t("Days"), value: "d" },
|
||
|
|
]
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @param {Object} reminder
|
||
|
|
* @returns {string}
|
||
|
|
*/
|
||
|
|
function decodeDateInterval(reminder) {
|
||
|
|
if (reminder.period === "i") {
|
||
|
|
return t("%d minutes before", [reminder.count])
|
||
|
|
}
|
||
|
|
|
||
|
|
if (reminder.period === "h") {
|
||
|
|
return t("%d hours before", [reminder.count])
|
||
|
|
}
|
||
|
|
|
||
|
|
return t("%d days before", [reminder.count])
|
||
|
|
}
|
||
|
|
|
||
|
|
return {
|
||
|
|
agendaRemindersEnabled,
|
||
|
|
periodList,
|
||
|
|
decodeDateInterval,
|
||
|
|
}
|
||
|
|
}
|