import{r as l,a as S,o as E,w as d,b as _,e as u,t as r,h as m,i as N,k as b,c as L}from"./style-CHsIVRyi.chunk.mjs";import{t as a,_ as I,N as A,b as v,a as D,d as M,v as V,c as w,s as y,l as T}from"./index-Dh8t1o6F-BSJbSXZa.chunk.mjs";import"./vite-preload-helper-B9rAsR6N.chunk.mjs";const s={EMAIL_SEND_OFF:0,EMAIL_SEND_HOURLY:1,EMAIL_SEND_3HOURLY:2,EMAIL_SEND_DAILY:3,EMAIL_SEND_WEEKLY:4},p=[{label:a("notifications","Never"),value:s.EMAIL_SEND_OFF},{label:a("notifications","1 hour"),value:s.EMAIL_SEND_HOURLY},{label:a("notifications","3 hours"),value:s.EMAIL_SEND_3HOURLY},{label:a("notifications","1 day"),value:s.EMAIL_SEND_DAILY},{label:a("notifications","1 week"),value:s.EMAIL_SEND_WEEKLY}],O={name:"AdminSettings",components:{NcSelect:D,NcCheckboxRadioSwitch:v,NcSettingsSection:A},setup(){const t=N(T("notifications","config",{})),e=b({get(){return p.find(({value:c})=>c===t.setting_batchtime)},set({value:c}){t.setting_batchtime=c}});return{BATCHTIME_OPTIONS:p,config:t,currentBatchTime:e}},methods:{t:a,async updateSettings(){try{const t=new FormData;t.append("batchSetting",this.config.setting_batchtime),t.append("soundNotification",this.config.sound_notification?"yes":"no"),t.append("soundTalk",this.config.sound_talk?"yes":"no"),await M.post(V("apps/notifications/api/v2/settings/admin"),t),w(a("notifications","Your settings have been updated."))}catch(t){y(a("notifications","An error occurred while updating your settings.")),console.error(t)}}}},U={class:"notification-frequency__wrapper"},k={for:"notification_reminder_batchtime",class:"notification-frequency__label"};function Y(t,e,c,n,B,i){const g=l("NcSelect"),f=l("NcCheckboxRadioSwitch"),h=l("NcSettingsSection");return E(),S(h,{name:i.t("notifications","Notifications defaults"),description:i.t("notifications","Configure the default notification settings")},{default:d(()=>[_("div",U,[_("label",k,r(i.t("notifications","Send email reminders about unhandled notifications after:")),1),u(g,{id:"notification_reminder_batchtime",modelValue:n.currentBatchTime,"onUpdate:modelValue":[e[0]||(e[0]=o=>n.currentBatchTime=o),i.updateSettings],class:"notification-frequency__select",clearable:!1,"label-outside":"",options:n.BATCHTIME_OPTIONS},null,8,["modelValue","options","onUpdate:modelValue"])]),u(f,{modelValue:n.config.sound_notification,"onUpdate:modelValue":[e[1]||(e[1]=o=>n.config.sound_notification=o),i.updateSettings]},{default:d(()=>[m(r(i.t("notifications","Play sound when a new notification arrives")),1)]),_:1},8,["modelValue","onUpdate:modelValue"]),u(f,{modelValue:n.config.sound_talk,"onUpdate:modelValue":[e[2]||(e[2]=o=>n.config.sound_talk=o),i.updateSettings]},{default:d(()=>[m(r(i.t("notifications","Play sound when a call started (requires Nextcloud Talk)")),1)]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:1},8,["name","description"])}const R=I(O,[["render",Y],["__scopeId","data-v-d470d351"]]);L(R).mount("#notifications-admin-settings");
//# sourceMappingURL=notifications-admin-settings.mjs.map
