1import{e as H,n as V,v as K,d as Y,j as q,U as F,l as W,h as X,aR as J}from"./index-HmgwubOw.js";import{b as Z}from"./index-DBj5G78X.js";import{S as ee}from"./orgTypes-D1Tk9MA4.js";import{s as te}from"./index-C78wIlDn.js";import re from"./HomeAdministrator-DAWLYTEH.js";import{T as se,t as ae,p as R}from"./reports-GIhMAX5m.js";import{y as ie}from"./firekit-DmdkEPY9.js";import{s as oe}from"./index-DVLHuE0S.js";import{u as M}from"./useUserDataQuery-BvShy7xx.js";import{u as ne}from"./useUserAssignmentsQuery-Di4ChNb7.js";import{l as k,$ as le,U as l,Q as o,V as t,Y as T,P as O,u as d,a7 as de,y as g,F as L,a2 as P,a0 as $,r as b,a5 as Q,a8 as ue,O as G,ac as ce,j as me,o as ge}from"./tanstack-BuE7OpQV.js";import{s as j}from"./index-BfTcv17o.js";import{s as pe}from"./index-efmP6CWd.js";import fe from"./RegisterChildren-CyRL-b6w.js";import"./lodash-BxsARtUA.js";import"./sentry-CYO7dHw2.js";import"./index-BSCylq0V.js";import"./index-D81auZQy.js";import"./index-CNxDTBGV.js";import"./index-CnUvH7kj.js";import"./index-ChPZIrTd.js";import"./index-DupnZpD9.js";import"./index-BPUEvB0O.js";import"./index-CEVVeswO.js";import"./index-BbrXYH0I.js";import"./index-DE9lF9aN.js";import"./index-DpsTCdm1.js";import"./index-DCS1PZMx.js";import"./index-BCzVsn89.js";import"./index-DD_oVdbu.js";import"./index-nEfO_SFH.js";import"./index-DSKLe2To.js";import"./index-BXoSGmpA.js";import"./index-nmo7kKDN.js";import"./plotting-CAkhz-rb.js";import"./completionStatus-DWBm6L1b.js";import"./orgs-DHsn2MnM.js";import"./useTasksDictionaryQuery-BtNZzgjG.js";import"./useTasksQuery-CNnm9wrO.js";import"./tasks-BlLNIGrX.js";import"./uniq-C6Yc7FeD.js";import"./toasts-DNRWHxzm.js";import"./utils-COmCBZmj.js";import"./roam-DIm4uuSo.js";import"./assignments-CUPZwg5o.js";import"./find-CaGwutx_.js";import"./groupBy-B6meMME1.js";import"./_baseEach-DMRN0qVq.js";import"./index-DEbAlZMc.js";import"./index-B87fW4ax.js";import"./index-jyn2HCXX.js";import"./index-BU5NGlAJ.js";import"./index-COA6yLlz.js";import"./index-BM8UMNpX.js";import"./ConsentModal-B6LFF_1q.js";import"./index-CBqC_RC6.js";import"./marked.esm-C9B6iGib.js";import"./lowerCase-BPOiiq7z.js";import"./ChallengeV3.vue_vue_type_script_setup_true_lang-BxIxpsNo.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new a.Error().stack;i&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[i]="8e7dbf96-e074-4c7b-899b-40ffc8eeb851",a._sentryDebugIdIdentifier="sentry-dbid-8e7dbf96-e074-4c7b-899b-40ffc8eeb851")}catch{}})();const ye={class:"flex overflow-hidden mx-auto w-full max-w-3xl rounded border-gray-200 flex-column border-1","data-cy":"student-card-simple"},ve={class:"flex gap-2 p-4 bg-gray-100 flex-column"},he={class:"m-0 text-xl font-bold","data-cy":"student-card__name"},xe={class:"flex gap-4 mt-2 font-normal text-gray-500"},be={key:0,class:"text-sm"},_e={key:1,class:"text-sm"},we={class:"flex p-4 border-t border-gray-200"},Se={key:0,class:"flex p-4 border-t border-gray-200 flex-column"},De={class:"flex gap-3 flex-column"},Ee={class:"flex justify-between mb-2 align-items-center"},Te={class:"font-semibold text-sm"},ke={class:"text-xs text-gray-500 mt-1"},Ce={class:"flex gap-1 mt-2 mb-3 flex-column"},Ie={class:"text-xs"},Ue={key:1,class:"flex p-4 border-t border-gray-200"},Ae={__name:"StudentCardSimple",props:{orgType:{type:String,required:!0},orgId:{type:String,required:!0},userId:{type:String,required:!0}},setup(a){const i=a,p=H(),{data:u}=M(i.userId),{data:C}=ne(void 0,i.userId,k(()=>i.orgType),k(()=>[i.orgId])),I=k(()=>C.value||[]),m=k(()=>I.value.length>0),_=k(()=>{var f,S;if(!u.value)return"Loading...";const{first:e,last:r}=((f=u.value)==null?void 0:f.name)||{};return e&&r?`${e} ${r}`:e||((S=u.value)==null?void 0:S.username)||"Student"}),A=()=>{p.push({name:"LaunchParticipant",params:{launchId:i.userId}})},U=e=>{var r;return((r=ae[e])==null?void 0:r.publicName)||e},w=e=>e.completedOn?R.Completed:e.startedOn?R.Started:R.Assigned,h=e=>e?new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric"}):"";return(e,r)=>{var S,D,s,N;const f=le("router-link");return o(),l("article",ye,[t("div",ve,[t("h2",he,T(_.value),1),r[1]||(r[1]=t("span",{class:"text-sm font-light text-gray-600"},"Student",-1)),t("div",xe,[(D=(S=d(u))==null?void 0:S.studentData)!=null&&D.grade?(o(),l("div",be,T(d(se)(d(u).studentData.grade)),1)):O("",!0),(N=(s=d(u))==null?void 0:s.studentData)!=null&&N.schoolLevel?(
1o(),l("div",_e,[de(T(d(ie)(d(u).studentData.schoolLevel))+" ",1),r[0]||(r[0]=t("span",{class:""},"School",-1))])):O("",!0)])]),t("div",we,[g(d(V),{label:"Launch as Student",icon:"pi pi-play",class:"w-full",severity:"primary","data-cy":"launch-student-btn",onClick:A})]),m.value?(o(),l("div",Se,[r[2]||(r[2]=t("h3",{class:"m-0 mb-3 font-semibold text-gray-500 text-md"},"Assignments",-1)),t("div",De,[(o(!0),l(L,null,P(I.value,E=>(o(),l("div",{key:E.id,class:"p-3 bg-gray-50 rounded border-gray-200 border-1"},[t("div",Ee,[t("div",null,[t("div",Te,T(E.name),1),t("div",ke,T(h(E.dateOpened))+" - "+T(h(E.dateClosed)),1)])]),t("div",Ce,[(o(!0),l(L,null,P(E.assessments,y=>(o(),l("div",{key:y.taskId,class:"flex justify-between text-sm align-items-center"},[t("div",Ie,T(U(y.taskId)),1),g(d(oe),{severity:w(y).severity,value:w(y).value,icon:w(y).icon,class:"p-0.5 m-0 text-xs font-semibold capitalize",rounded:""},null,8,["severity","value","icon"])]))),128))]),g(f,{to:{name:"StudentScoreReport",params:{administrationId:E.id,orgType:i.orgType,orgId:i.orgId,userId:i.userId}},class:"text-black no-underline"},{default:$(()=>[g(d(V),{label:"View Scores",icon:"pi pi-chart-bar",outlined:"",severity:"contrast",class:"w-full",size:"small","data-cy":"view-score-report-btn"})]),_:1},8,["to"])]))),128))])])):(o(),l("div",Ue,[...r[3]||(r[3]=[t("div",{class:"text-sm text-gray-500 text-center w-full"}," No assignments available at the moment. If you have just registered, please wait a few minutes and refresh the page. ",-1)])]))])}}},Ne={class:"text-2xl font-bold text-gray-600"},$e={key:0,class:"flex items-center w-full text-center flex-column justify-content-center"},Re={key:1,class:"flex items-center w-full text-center flex-column justify-content-center"},Ve={key:2,class:"p-3"},Le={class:"text-sm font-light text-gray-800"},Pe={key:0,class:"p-3"},ze={class:"flex overflow-hidden p-8 mx-auto w-full max-w-3xl bg-gray-100 rounded border-gray-200 flex-column border-1"},Be={class:"flex gap-4 flex-column align-items-center"},qe=Object.assign({name:"HomeParentStudentView"},{__name:"HomeParentStudentView",props:{isLoading:{type:Boolean,required:!0},parentRegistrationComplete:{type:Boolean,required:!0},childrenUids:{type:Array,default:()=>[]},orgType:{type:String,required:!0},orgId:{type:String,required:!0},registrationError:{type:Error,required:!1,default:null},invitationCodes:{type:Array,default:()=>[]}},emits:["refresh-registration"],setup(a,{emit:i}){const p=b(!1),u=b(!1),C=K(),I=Q(),m=Y(),_=b("consent-behavioral-eye-tracking"),A=i;function U(){p.value=!0}async function w(h){u.value=!0;try{m.initialized||await m.initFirekit();const{email:e}=m.firebaseUser.adminFirebaseUser,r={name:{first:m.userData.firstName,last:m.userData.lastName},legal:{consentType:"family_enrollment",consentVersion:"1.0",amount:"0",expectedTime:"5 minutes",isSignedWithAdobe:!1,dateSigned:new Date().toISOString()}};if(!Array.isArray(h))throw console.error("studentData is not an array:",h),new Error("studentData must be an array");const f=h.map(s=>({email:s.studentUsername.includes("@")?s.studentUsername:`${s.studentUsername}@roar-auth.com`,password:s.password,userData:{name:{first:s.firstName||"",middle:s.middleName||"",last:s.lastName||""},activationCode:s.activationCode,grade:s.grade,dob:s.dob,gender:s.gender,ell_status:s.ell,iep_status:s.IEPStatus,frl_status:s.freeReducedLunch,race:s.race||[],hispanic_ethnicity:s.hispanicEthnicity,home_language:s.homeLanguage||[],accept:s.accept}})),D={version:(await m.getLegalDoc(_.value)).currentCommit,name:_.value};if(!Array.isArray(f))throw new Error("formattedStudentData must be an array");await m.addStudentsToFamily(e,r,f,D,!1),p.value=!1,u.value=!1,A("refresh-registration"),C.add({severity:"success",summary:"Success",detail:"Student successfully enrolled",life:3e3}),I.invalidateQueries({queryKey:[F]})}catch(e){console.error("Error enrolling student:",e),C.add({severity:"error",summary:"Error",detail:"Failed to enroll student(s). Please try again.",life:3e3}),u.value=!1}}return(h,e)=>(o(),l("div",Ne,[a.isLoading?(o(),l("div",$e,[t("div",null,[g(q,{class:"mb-4"})]),e[1]||(e[1]=t("div",{class:"w-64 text-lg font-light"},"Loading Children",-1))])):a.parentRegistrationComplete?a.registrationError?(o(),l("div",Ve,[g(d(j),{severity:"error"},{default:$(()=>[e[3]||(e[3]=t("div",{class:"text-lg font-bold text-gray-600"},"Error while completing registration:",-1)),t("div",Le,T(a.registrationError.message),1)]),_:1})])):(o(),l("div",{key:3,class:ue(["grid flex-wrap grid-cols-1 gap-4 w-full",{"lg:grid-cols-2":a.childrenUids.length<=2,"lg:grid-cols-3":a.childrenUids.length===3,"lg:grid-cols-4":a.childrenUids.length>=4}]),"data-cy":"parent-homepage__students-grid"},[a.childrenUids.length===0?(o(),l("div",Pe,[g(d(j),{severity:"info",class:"h-full"},{default:$(()=>[...e[4]||(e[4]=[t("div",{class:"text-lg font-bold text-gray-600"},"Add your first child",-1),t("div",{class:"text-sm font-light text-gray-800"}," You'll need to add a child to your account before they can take assessments. ",-1)])]),_:1})])):(o(!0),l(L,{key:1},P(a.childrenUids,r=>(o(),G(Ae,{key:r,"user-id":r,"org-type":a.orgType,"org-id":a.orgId},null,8,["user-id","org-type","org-id"]))),128)),t("article",ze,[t("div",Be,[e[5]||
1(e[5]=ce('<div class="flex w-16 h-16 bg-pink-50 rounded-full align-items-center justify-content-center"><i class="text-4xl text-red-700 pi pi-users"></i></div><div class="text-center"><h2 class="m-0 mb-2 text-2xl font-bold">Add a Child</h2><div class="mb-4 text-sm font-light text-gray-600">Add a new student to your family account</div></div>',2)),g(d(V),{label:"Add Child",class:"px-6",severity:"danger",outlined:"","data-cy":"add-student-btn",onClick:U})])]),g(d(pe),{visible:p.value,"onUpdate:visible":e[0]||(e[0]=r=>p.value=r),modal:"",style:{width:"80vw",maxWidth:"1200px"},header:"Enroll New Student",closable:!0,draggable:!1,"data-cy":"enrollment-modal","pt:header:data-testid":"dialog__header"},{default:$(()=>[g(fe,{submitting:u.value,"invitation-codes":a.invitationCodes,onSubmit:w},null,8,["submitting","invitation-codes"])]),_:1},8,["visible"])],2)):(o(),l("div",Re,[t("div",null,[g(q,{class:"mb-4"})]),e[2]||(e[2]=t("div",{class:"w-64 text-lg font-light"},"Registration in progress",-1))]))]))}}),Oe={class:"container p-4","data-cy":"parent-homepage"},je={class:"flex mb-4 align-items-center justify-content-between"},Ye={class:"flex flex-row gap-4 align-items-center"},Fe={key:1,class:"home-administrator-wrapper"},Me=3,Qe={__name:"HomeParent",setup(a){const i=Y(),p=Object.freeze({BY_STUDENT:"Student",BY_ASSIGNMENT:"Assignment"}),u=b({name:p.BY_STUDENT}),C=[{name:p.BY_STUDENT},{name:p.BY_ASSIGNMENT}],{data:I}=X(),m=b(!1),_=b(!1),A=k(()=>{var v,B;const c=((B=(v=I.value)==null?void 0:v.claims)==null?void 0:B.adminOrgs)??{},n=J(U.value);return(c[n]??[])[0]??null}),U=b(ee.FAMILIES),{data:w,isLoading:h}=M(null,{enabled:_}),e=k(()=>{var n;return((n=w.value)==null?void 0:n.childrenUids)||[]}),r=b(null),f=b(0),{isActive:S,pause:D,resume:s}=Z(async()=>{try{m.value=await i.verifyParentRegistration(),m.value&&(_.value=!0,r.value=null,D())}catch(c){console.error("Registration verification failed:",c),f.value++,f.value>=Me&&(console.error("Registration verification failed, maximum retries reached:",c),r.value=c instanceof Error?c:new Error(String(c)),D())}},1e4),N=Q(),E=()=>{f.value=0,N.invalidateQueries({queryKey:[F]}),setTimeout(()=>{s()},15e3)};let y;const z=()=>{var c,n;y&&y(),_.value=!0,!((c=i.userData)!=null&&c.initialized)&&((n=i.userData)!=null&&n.registrations)&&s()};return y=i.$subscribe(async(c,n)=>{var x,v;(v=(x=n.roarfirekit).restConfig)!=null&&v.call(x)&&z()}),me(()=>{var c,n,x,v;(n=(c=i.roarfirekit).restConfig)!=null&&n.call(c)&&z(),((x=i.userData)!=null&&x.initialized||!((v=i.userData)!=null&&v.registrations))&&(m.value=!0)}),ge(()=>{S.value&&D(),y&&y()}),(c,n)=>{var x;return o(),l("main",Oe,[t("div",je,[n[2]||(n[2]=t("div",null,[t("h1",{class:"text-2xl font-bold text-gray-600"},"Parent Dashboard"),t("div",{class:"text-sm font-light text-gray-800"},"Manage your children and view their assessments.")],-1)),t("div",Ye,[n[1]||(n[1]=t("div",{class:"flex flex-row text-sm text-gray-600 uppercase"},"View by",-1)),g(d(te),{modelValue:u.value,"onUpdate:modelValue":n[0]||(n[0]=v=>u.value=v),options:C,"option-disabled":"constant","allow-empty":!1,"option-label":"name",class:"flex my-2"},null,8,["modelValue"])])]),u.value.name===d(p).BY_STUDENT?(o(),G(qe,{key:0,"is-loading":d(h),"parent-registration-complete":m.value,"children-uids":e.value,"org-type":U.value,"org-id":A.value,"registration-error":r.value,"invitation-codes":((x=d(w))==null?void 0:x.invitationCodes)||[],onRefreshRegistration:E},null,8,["is-loading","parent-registration-complete","children-uids","org-type","org-id","registration-error","invitation-codes"])):(o(),l("div",Fe,[g(re)]))])}}},Jt=W(Qe,[["__scopeId","data-v-441b88e8"]]);export{Jt as default}; 2//# sourceMappingURL=HomeParent-3Q7U_Xys.js.map
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.