"use strict";(self.webpackChunkapp=self.webpackChunkapp||[]).push([[94956],{94956:(e,t,n)=>{n.r(t),n.d(t,{AddonNotesAddComponent:()=>A});var o=n(10467),s=n(90378),d=n(52749),a=n(63153),r=n(79555),i=n(44426),l=n(86654),c=n(47551),p=n(33014),u=n(25572),m=n(54438),g=n(89417),b=n(2910),h=n(86198),C=n(88246),f=n(43570),I=n(73955);const _=["itemEdit"];let A=(()=>{var e;class AddonNotesAddComponent{constructor(){this.type="personal",this.text="",this.processing=!1}addNote(e){var t=this;return(0,o.A)((function*(){e.preventDefault(),e.stopPropagation(),i.p.close();const n=yield p.CoreLoadings.show("core.sending",!0);t.processing=!0;try{t.userId=t.userId||d.CoreSites.getCurrentSiteUserId();const e=yield s.AddonNotes.addNote(t.userId,t.courseId,t.type,t.text);a.R.triggerFormSubmittedEvent(t.formElement,e,d.CoreSites.getCurrentSiteId()),r.W3.dismiss({type:t.type,sent:!0}).finally((()=>{c.CoreToasts.show({message:e?"addon.notes.eventnotecreated":"core.datastoredoffline",translateMessage:!0,duration:c.ToastDuration.LONG})}))}catch(e){u.CoreAlerts.showError(e),t.processing=!1}finally{n.dismiss()}}))()}closeModal(){a.R.triggerFormCancelledEvent(this.formElement,d.CoreSites.getCurrentSiteId()),r.W3.dismiss({type:this.type})}}return(e=AddonNotesAddComponent).ɵfac=function AddonNotesAddComponent_Factory(t){return new(t||e)},e.ɵcmp=m.VBU({type:e,selectors:[["ng-component"]],viewQuery:function AddonNotesAddComponent_Query(e,t){if(1&e&&m.GBs(_,5),2&e){let e;m.mGM(e=m.lsd())&&(t.formElement=e.first)}},inputs:{courseId:"courseId",userId:"userId",type:"type"},standalone:!0,features:[m.aNF],decls:33,vars:30,consts:[["itemEdit",""],["slot","end"],["fill","clear",3,"click","ariaLabel"],["name","fas-xmark","slot","icon-only","aria-hidden","true"],["name","itemEdit",3,"ngSubmit"],["name","publishState","interface","popover",3,"ngModelChange","ngModel","label"],["value","personal"],["value","course"],["value","site"],["rows","5","name","text","required","required",3,"ngModelChange","ariaLabel","placeholder","ngModel"],[1,"ion-padding"],["expand","block","type","submit",3,"disabled"]],template:function AddonNotesAddComponent_Template(e,t){if(1&e){const e=m.RV6();m.j41(0,"ion-header")(1,"ion-toolbar")(2,"ion-title")(3,"h1"),m.EFF(4),m.nI1(5,"translate"),m.k0s()(),m.j41(6,"ion-buttons",1)(7,"ion-button",2),m.nI1(8,"translate"),m.bIt("click",(function AddonNotesAddComponent_Template_ion_button_click_7_listener(){return m.eBV(e),m.Njj(t.closeModal())})),m.nrm(9,"ion-icon",3),m.k0s()()()(),m.j41(10,"ion-content")(11,"form",4,0),m.bIt("ngSubmit",(function AddonNotesAddComponent_Template_form_ngSubmit_11_listener(n){return m.eBV(e),m.Njj(t.addNote(n))})),m.j41(13,"ion-item")(14,"ion-select",5),m.nI1(15,"translate"),m.mxI("ngModelChange",(function AddonNotesAddComponent_Template_ion_select_ngModelChange_14_listener(n){return m.eBV(e),m.DH7(t.type,n)||(t.type=n),m.Njj(n)})),m.j41(16,"ion-select-option",6),m.EFF(17),m.nI1(18,"translate"),m.k0s(),m.j41(19,"ion-select-option",7),m.EFF(20),m.nI1(21,"translate"),m.k0s(),m.j41(22,"ion-select-option",8),m.EFF(23),m.nI1(24,"translate"),m.k0s()()(),m.j41(25,"ion-item")(26,"ion-textarea",9),m.nI1(27,"translate"),m.nI1(28,"translate"),m.mxI("ngModelChange",(function AddonNotesAddComponent_Template_ion_textarea_ngModelChange_26_listener(n){return m.eBV(e),m.DH7(t.text,n)||(t.text=n),m.Njj(n)})),m.k0s()(),m.j41(29,"div",10)(30,"ion-button",11),m.EFF(31),m.nI1(32,"translate"),m.k0s()()()()}2&e&&(m.R7$(4),m.JRh(m.bMT(5,12,"addon.notes.addnewnote")),m.R7$(3),m.Y8G("ariaLabel",m.bMT(8,14,"core.close")),m.R7$(7),m.R50("ngModel",t.type),m.Y8G("label",m.bMT(15,16,"addon.notes.publishstate")),m.R7$(3),m.JRh(m.bMT(18,18,"addon.notes.personalnotes")),m.R7$(3),m.JRh(m.bMT(21,20,"addon.notes.coursenotes")),m.R7$(3),m.JRh(m.bMT(24,22,"addon.notes.sitenotes")),m.R7$(3),m.FS9("placeholder",m.bMT(27,24,"addon.notes.note")),m.Y8G("ariaLabel",m.bMT(28,26,"addon.notes.note")),m.R50("ngModel",t.text),m.R7$(4),m.Y8G("disabled",t.processing||t.text.length<2),m.R7$(),m.SpI(" ",m.bMT(32,28,"addon.notes.addnewnote")," "))},dependencies:[l.n,g.qT,g.BC,g.cb,g.YS,g.vS,g.cV,b.Jm,b.QW,b.W9,b.eU,b.iq,b.uz,b.Nm,b.Ip,b.nc,b.BC,b.ai,b.Je,b.Gw,h.t,C.i,f.T,I.D9],encapsulation:2}),AddonNotesAddComponent})()}}]);