server/dist/files_reminders-init.js

3 lines
37 KiB
JavaScript
Raw Normal View History

/*! For license information please see files_reminders-init.js.LICENSE.txt */
(()=>{"use strict";var e,t,n,r={91410:(e,t,n)=>{var r=n(35810),i=n(53334);const o='<svg xmlns="http://www.w3.org/2000/svg" id="mdi-alarm" viewBox="0 0 24 24"><path d="M12,20A7,7 0 0,1 5,13A7,7 0 0,1 12,6A7,7 0 0,1 19,13A7,7 0 0,1 12,20M12,4A9,9 0 0,0 3,13A9,9 0 0,0 12,22A9,9 0 0,0 21,13A9,9 0 0,0 12,4M12.5,8H11V14L15.75,16.85L16.5,15.62L12.5,13.25V8M7.88,3.39L6.6,1.86L2,5.71L3.29,7.24L7.88,3.39M22,5.72L17.4,1.86L16.11,3.39L20.71,7.25L22,5.72Z" /></svg>';var s,a=n(85471),d=n(61338),l=n(85168),c=n(9518),u=n(4604),p=n(43899),m=n(94219),h=n(48934);!function(e){e.LaterToday="later-today",e.Tomorrow="tomorrow",e.ThisWeekend="this-weekend",e.NextWeek="next-week"}(s||(s={}));const f=()=>{const e=new Date;return e.setHours(0,0,0,0),e.setDate(e.getDate()-e.getDay()+1),new Date(e)},g=e=>{new Date(e).setHours(0,0,0,0);const t=new Date(e.getFullYear(),0,1,0,0,0,0),n=(e.getTime()-t.getTime())/864e5;return Math.ceil((n+t.getDay()+1)/7)},w=e=>({[s.LaterToday]:()=>{const e=new Date,t=new Date;t.setHours(18,0,0,0);const n=new Date;return n.setHours(17,0,0,0),e>=n?null:t},[s.Tomorrow]:()=>{const e=new Date,t=new Date;return t.setDate(e.getDate()+1),t.setHours(8,0,0,0),t},[s.ThisWeekend]:()=>{const e=new Date;if([5,6,0].includes(e.getDay()))return null;const t=new Date,n=f();return t.setDate(n.getDate()+5),t.setHours(8,0,0,0),t},[s.NextWeek]:()=>{if(0===(new Date).getDay())return null;const e=new Date,t=f();return e.setDate(t.getDate()+7),e.setHours(8,0,0,0),e}}[e]()),v=e=>{let t={hour:"numeric",minute:"2-digit"};const n=new Date;var r,o;return o=n,((r=e).getDate()!==o.getDate()||r.getMonth()!==o.getMonth()||r.getFullYear()!==o.getFullYear())&&(t={...t,weekday:"short"}),((e,t)=>g(e)===g(t)&&e.getFullYear()===t.getFullYear())(e,n)||(t={...t,month:"short",day:"numeric"}),e.getFullYear()!==n.getFullYear()&&(t={...t,year:"numeric"}),e.toLocaleString((0,i.lO)(),t)},b=e=>{let t={month:"long",day:"numeric",weekday:"long",hour:"numeric",minute:"2-digit"};const n=new Date;return e.getFullYear()!==n.getFullYear()&&(t={...t,year:"numeric"}),e.toLocaleString((0,i.lO)(),t)},y=(0,n(53529).YK)().setApp("files_reminders").detectUser().build();var A=n(26287),N=n(63814);const _=async(e,t)=>{const n=(0,N.KT)("/apps/files_reminders/api/v1/{fileId}",{fileId:e});return(await A.A.put(n,{dueDate:t.toISOString()})).data.ocs.data},x=async e=>{const t=(0,N.KT)("/apps/files_reminders/api/v1/{fileId}",{fileId:e});return(await A.A.delete(t)).data.ocs.data},D=a.Ay.extend({name:"SetCustomReminderModal",components:{NcButton:c.A,NcDateTime:u.A,NcDateTimePickerNative:p.A,NcDialog:m.A,NcNoteCard:h.A},data:()=>({node:void 0,hasDueDate:!1,opened:!1,isValid:!0,customDueDate:null,nowDate:new Date}),computed:{fileId(){return this.node.fileid},fileName(){return this.node.basename},name(){return(0,i.Tl)("files_reminders",'Set reminder for "{fileName}"',{fileName:this.fileName})},label:()=>(0,i.Tl)("files_reminders","Set reminder at custom date & time"),clearAriaLabel:()=>(0,i.Tl)("files_reminders","Clear reminder")},methods:{t:i.Tl,getDateString:v,open(e){const t=e.attributes["reminder-due-date"]?new Date(e.attributes["reminder-due-date"]):null;this.node=e,this.hasDueDate=Boolean(t),this.isValid=!0,this.opened=!0,this.customDueDate=null!=t?t:(()=>{const e=new Date,t=new Date;return t.setHours(e.getHours()+2,0,0,0),t})(),this.nowDate=new Date,setTimeout((()=>{const e=document.getElementById("set-custom-reminder");e.focus(),this.hasDueDate||e.showPicker()}),300)},async setCustom(){if(this.customDueDate instanceof Date&&!isNaN(this.customDueDate))try{await _(this.fileId,this.customDueDate),a.Ay.set(this.node.attributes,"reminder-due-date",this.customDueDate.toISOString()),(0,d.Ic)("files:node:updated",this.node),(0,l.Te)((0,i.Tl)("files_reminders",'Reminder set for "{fileName}"',{fileName:this.fileName})),this.onClose()}catch(e){y.error("Failed to set reminder",{error:e}),(0,l.Qg)((0,i.Tl)("files_reminders","Failed to set reminder"))}else(0,l.Qg)((0,i.Tl)("files_reminders","Please choose a valid date & time"))},async clear(){try{await x(this.fileId),a.Ay.set(this.node.attributes,"remi
//# sourceMappingURL=files_reminders-init.js.map?v=91e54555a55c28a020e9