1import{k,aH as c,I as p,F as h,L as u,b5 as m,D as g,aP as r,aW as I,M as a,bG as d,z as n,i as B,C as y,aU as U,e as D,g as j}from"#entry";import{_ as H}from"./fyMi1UQ3.js";import{_ as E}from"./DbCxjiWf.js";import{c as F}from"./BGoe1292.js";import{f as J}from"./D4V3dYni.js";import{u as T}from"./ZJHTRKiM.js";import{s as z}from"./CYklpo3M.js";import{u as P}from"./BcV9CiMg.js";import{u as W}from"./DND5_WDB.js";import{_ as G,b as M,a as R}from"./BTD2PmRU.js";import{_ as K}from"./COXQYw1_.js";import{_ as Q}from"./DLddwm_w.js";import"./C708Vfd-.js";import"./DE5sf8y8.js";import"./Baz3LDWO.js";import"./CZpnmbu4.js";import"./B626PCNl.js";import"./BBjdBgfc.js";import"./B1EBMIfq.js";import"./CoaQEihs.js";import"./BEl6E_3r.js";import"./BmgZgFTw.js";import"./CUZZr_Cp.js";import"./BZmXmLfY.js";import"./C9bzE0DU.js";import"./D5dFX9Nx.js";import"./DqRdKDWF.js";import"./BHYdOnDK.js";import"./ChQxOCcI.js";import"./BjYP5sR0.js";import"./DeX2yFZp.js";import"./D7VCUZXK.js";import"./DYaHZCZL.js";import"./q2GtJrXW.js";import"./cgIBojgC.js";import"./BUlR7i8n.js";import"./DItwaOUP.js";const X={props:{user:{type:Object}}},Y={key:0,class:"text-caption text-grey-8"};function Z(e,t,l,s,_,i){return l.user?(c(),p("div",Y,[typeof l.user=="string"?(c(),p(h,{key:0},[u(m(l.user),1)],64)):(c(),p(h,{key:1},[u(m(l.user.firstName)+" "+m(l.user.lastName),1)],64))])):g("",!0)}const $=Object.assign(k(X,[["render",Z]]),{__name:"UserLink"}),N=()=>{const{getAxiosInstance:e}=T();return{hideNote:async(_,i)=>(await e().patch("/note",{_id:_,hide:i})).data.notes,getNotes:async(_,i)=>(await e().get("/note",{params:{viewHidden:_,count:i}})).data.notes,saveNote:async _=>{await e().post("/note",{note:_})}}},tt={setup(){return{formatJSDate:J,notes:r([]),filterStudentId:r(""),students:r([]),viewAll:r(!1),saving:r(!1),viewNotes:r(!1),countNotes:r(0),reloadOnClose:r(!1),writeNewNote:r(!1),loadingStudents:r(!0),errorLoadingStudents:r(!1),note:r({text:"",createdBy:""})}},computed:{filteredNotes(){return this.notes.filter(e=>!this.filterStudentId||e.student&&typeof e.student!="string"&&e.student._id===this.filterStudentId)},notesStudents(){const e={};for(const t of this.notes)t.student&&typeof t.student!="string"&&(e[String(t._id)]=t.student);return e},notesStudentsList(){const e={};for(const t of Object.values(this.notesStudents))e[String(t._id)]=t;return Object.values(e).map(t=>({value:t._id,label:`${t.firstName} ${t.lastName}`,description:t.status}))},studentOptions(){return this.students.map(t=>({value:t._id,label:`${t.firstName} ${t.lastName}`,description:t.status})).sort((t,l)=>t.label.localeCompare(l.label))}},watch:{viewAll(){this.loadNotes()},viewNotes(e){!e&&this.reloadOnClose&&(this.loadNotes(),this.reloadOnClose=!1)},countNotes(e){F().updateCounter("NOTES",e)}},methods:{async toggleVisibility(e){try{const{hideNote:t}=N();this.reloadOnClose=!0;const l=!e.hide;await t(String(e._id),l),e.hide=l,this.updateCountNotes()}catch(t){console.error(t)}},async updateCountNotes(){try{const{getNotes:e}=N();this.countNotes=await e(this.viewAll,!0)}catch(e){console.error(e)}},async loadNotes(){try{const{getNotes:e}=N();this.notes=await e(this.viewAll)}catch(e){console.error(e)}},async saveNote(){try{this.saving=!0;const{saveNote:e}=N();await e(this.note),z({message:"Note saved."}),this.writeNewNote=!1,this.updateCountNotes(),this.loadNotes()}catch{alert("We had an error saving your note. Please try again later.")}finally{this.saving=!1}},async openNew(){if(this.note={text:"",createdBy:""},this.writeNewNote=!0,this.loadingStudents)try{const{getStudents:e}=P();this.students=await e({infos:"BASIC"})}catch{this.errorLoadingStudents=!0}finally{this.loadingStudents=!1}}},mounted(){this.updateCountNotes();const{on:e}=W();e("view-notes",t=>{this.filterStudentId=t||"",this.viewNotes=!0,this.loadNotes()})}},et={class:"q-pa-md"},ot={class:"row justify-between q-mb-sm"},st={class:"col-auto text-italic"},nt={class:"col-auto text-italic"},it={class:"bg-white q-pa-md",style:{position:"sticky",bottom:"0"}},at={class:"row justify-between no-wrap items-end"},lt={class:"col-xs-12 col-sm-6 col-md-4"},rt={class:"q-mb-sm"},dt={class:"col-auto"},ct={class:"q-px-md q-pb-md"},ut={class:"column q-gutter-y-md"},mt={class:"col border-neutral border-radius-sm shadow-1 bg-white"},_t={class:"q-px-md"},pt={class:"text-center"},ft={class:"text-grey"},Nt={class:"col bg-white"},ht={key:0,class:"text-negative text-italic"},vt={class:"q-mt-md text-right"};function yt(e,t,l,s,_,i){const f=G,v=D,w=R,V=$,C=I("router-link"),q=M,L=B,A=K,b=H,x=j,S=E,O=Q;return c(),p("div",null,[a(S,{modelValue:s.viewNotes,"onUpdate:modelValue":t[2]||(t[2]=o=>s.viewNotes=o),title:"Notes",seamless:"",position:"bottom","sticky-header":""},{default:d(()=>[n("div",null,[n("div",et,[a(L,{separator:""},{default:d(()=>[i.filteredNotes.length===0?(c(),y(f,{key:0,header:"",class:"text-center"},{default:d(()=>[...t[6]||(t[6]=[u(" No notes found. ",-1)])]),_:1})):(c(),p(h,{key:1},[],64)),(c(!0),p(h,null,U(i.filteredNotes,o=>(c(),y(q,{key:o._id,class:"q-mb-sm"},{default:d(()=>[a(w,{side:""},{default:d(()=>[a(v,{flat:"",dense:"",size:"sm",icon:o.hide?"visibility_off":"visibility",color:o.hide?"grey":"dark",onClick:gt=>i.toggleVisibility(o)},null,8,["icon","color","onClick"])]),_:2},1024),a(w,null,{default:d(()=>[n("div",ot,[n("div",st,[a(f,{caption:""},{default:d(()=>[u(m(s.formatJSDate(new Date(o.createdAt||""),{format:"dd LLL yyyy 'at' HH:mm"})),1)]),_:2},1024)]),n("div",nt,[a(V,{user:o.createdBy},null,8,["user"])])]),i.notesStudents[String(o._id)]?(c(),y(f,{key:0,caption:""},{default:d(()=>[t[7]||(t[7]=u(" Related to ",-1)),a(C,{to:`/admin/student?_id=${i.notesStudents[String(o._id)]?._id}`},{default:d(()=>[u(m(i.notesStudents[String(o._id)]?.firstName)+" "+m(i.notesStudents[String(o._id)]?.lastName),1)]),_:2},1032,["to"]),t[8]||(t[8]=u(". ",-1))]),_:2},1024)):g("",!0),a(f,null,{default:d(()=>[u(m(o.text),1)]),_:2},1024)]),_:2},1024)]),_:2},1024))),128))]),_:1})]),n("div",it,[n("div",at,[n("div",lt,[n("div",null,[n("div",rt,[a(A,{dense:"",modelValue:s.viewAll,"onUpdate:modelValue":t[0]||(t[0]=o=>s.viewAll=o),label:"View hidden notes"},null,8,["modelValue"])]),a(b,{clearable:"",dense:"",label:"Filter by student",modelValue:s.filterStudentId,"onUpdate:modelValue":t[1]||(t[1]=o=>s.filterStudentId=o),options:i.notesStudentsList},null,8,["modelValue","options"])])]),n("div",dt,[a(x,{onClick:i.openNew,color:"dark",label:"New Note"},null,8,["onClick"])])])])])]),_:1},8,["modelValue"]),a(S,{width:"520px",position:"standard",modelValue:s.writeNewNote,"onUpdate:modelValue":t[5]||(t[5]=o=>s.writeNewNote=o),"body-class":"bg-grey-1",title:"New note"},{default:d(()=>[n("div",ct,[n("div",ut,[n("div",mt,[n("div",_t,[n("div",pt,[n("small",ft,m(s.formatJSDate(new Date,{format:"dd LLL yyyy 'at' HH:mm"})),1)]),a(O,{autofocus:"",modelValue:s.note.text,"onUpdate:modelValue":t[3]||(t[3]=o=>s.note.text=o),type:"textarea","stack-label":"",borderless:""},null,8,["modelValue"])])]),n("div",Nt,[a(b,{label:"Is this note related to a student?",loading:s.loadingStudents,options:i.studentOptions,modelValue:s.note.student,"onUpdate:modelValue":t[4]||(t[4]=o=>s.note.student=o)},null,8,["loading","options","modelValue"]),s.errorLoadingStudents?(c(),p("small",ht," The student list could not be retrieved. ")):g("",!0)])]),n("div",vt,[a(x,{disable:!s.note.text,loading:s.saving,label:"Save",color:"primary",onClick:i.saveNote},null,8,["disable","loading","onClick"])])])]),_:1},8,["modelValue"])])}const ne=Object.assign(k(tt,[["render",yt]]),{__name:"AdminNotes"});export{ne as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.