1import{d as E,V as U,G as n,c as l,e as t,t as i,i as y,w as C,F as S,r as I,f as b,g as r,j as k,k as c,C as O,b as a,z as F,aC as R,x as Y,_ as H}from"./F0eaaWeQ.js";import{S as Z,a as q}from"./B2rYgypg.js";import{u as K}from"./QY2MLJFu.js";import{u as Q}from"./BqLSW84a.js";import{g as W}from"./BzISPkkE.js";import"./jZatO-wn.js";import"./TEZbefj9.js";const X={key:0,class:"student-dashboard"},tt={class:"student-dashboard__header"},et={id:"courses",class:"student-dashboard__section","aria-labelledby":"student-courses-title"},st={class:"student-dashboard__section-head"},nt={key:0,class:"student-courses"},ot={class:"student-course__cover"},at={key:1},lt={class:"student-course__body"},it={class:"student-course__progress"},dt={class:"student-course__track","aria-hidden":"true"},rt={key:1,class:"student-empty"},ut={id:"lessons",class:"student-card","aria-labelledby":"upcoming-lessons-title"},ct={class:"student-card__head"},_t={key:0,style:{margin:"0 0 16px","font-size":"13px","line-height":"1.55",color:"#4A473F"}},pt={style:{color:"#1C1B17"}},mt={key:1,class:"student-lessons"},ht=["onClick"],gt={class:"student-lesson__date"},vt={class:"student-lesson__content"},yt={class:"student-lesson__tags"},bt={key:0},kt={key:1},ft={key:2},wt={key:3},Ct={key:4},xt=["disabled","onClick"],At={key:2,class:"student-empty student-empty--compact"},Tt={key:3,class:"student-join-error",role:"alert"},$t={key:4,class:"student-pagination"},Dt=["disabled"],St=["disabled"],It={class:"student-card","aria-labelledby":"past-lessons-title"},Nt={class:"student-card__head"},Lt={key:0,class:"student-lessons"},Pt=["onClick"],jt={class:"student-lesson__date student-lesson__date--past"},zt={class:"student-lesson__content"},Ft={class:"student-lesson__tags student-lesson__tags--past"},Bt={key:0},Vt={key:1},Gt={key:1,class:"student-empty student-empty--compact"},Mt={key:2,class:"student-pagination"},Jt=["disabled"],Et=["disabled"],h=5,Ut=E({__name:"index",async setup(Ot){let f,N;const{data:d,refresh:L}=([f,N]=U(()=>K()),f=await f,N(),f),g=k(null),_=k(0),p=k(0),v=k(""),w=k(""),{deviceTimezone:x}=Q(),A=c(()=>d.value?.upcomingLessons||[]),T=c(()=>d.value?.pastLessons||[]),P=c(()=>{const o=_.value*h;return A.value.slice(o,o+h)}),j=c(()=>{const o=p.value*h;return T.value.slice(o,o+h)}),$=c(()=>Math.max(1,Math.ceil(A.value.length/h))),D=c(()=>Math.max(1,Math.ceil(T.value.length/h))),B=c(()=>{const o=new Date().getHours();return o<12?"Good morning":o<18?"Good afternoon":"Good evening"}),V=c(()=>{const o=x.value||"UTC";return{day:new Intl.DateTimeFormat("en-GB",{day:"numeric",timeZone:o}),month:new Intl.DateTimeFormat("en-GB",{month:"short",timeZone:o}),when:new Intl.DateTimeFormat(void 0,{weekday:"short",day:"numeric",month:"short",hour:"2-digit",minute:"2-digit",timeZone:o})}});function m(o){const e=new Date(o),u=V.value;return{day:u.day.format(e),month:u.month.format(e),when:u.when.format(e)}}function G(o){if(!o||typeof o!="object")return"The classroom could not be opened.";const e=o;return String(e.data?.statusMessage||e.data?.message||e.statusMessage||e.message||"The classroom could not be opened.")}async function M(o){if(!(!d.value||!o.canJoin||v.value)){if(w.value="",o.lessonType==="group"){window.location.assign(`/group-classroom/${encodeURIComponent(o.id)}`);return}v.value=o.id;try{const e=await $fetch("/api/student/join-lesson",{method:"POST",headers:await W(),body:{bookingId:o.id}});window.location.assign(e.redirectUrl)}catch(e){w.value=G(e),g.value=o}finally{v.value=""}}}return(o,e)=>{const u=O,J=R;return n(d)?(a(),l("div",X,[t("header",tt,[t("p",null,i(n(B)),1),t("h1",null,i(n(d).user.name),1)]),t("section",et,[t("div",st,[e[6]||(e[6]=t("h2",{id:"student-courses-title",class:"student-dashboard__label"}," Your courses ",-1)),y(u,{to:"/dashboard/courses"},{default:C(()=>[...e[5]||(e[5]=[b("View all courses â",-1)])]),_:1})]),n(d).courses.length?(a(),l("div",nt,[(a(!0),l(S,null,I(n(d).courses,s=>(a(),F(u,{key:s.id,to:`/study/${s.id}`,class:"student-course"},{default:C(()=>[t("div",ot,[s.coverImage?(a(),F(J,{key:0,src:s.coverImage,alt:`${s.title} course cover`,width:"640",height:"240",loading:"lazy"},null,8,["src","alt"])):(a(),l("span",at,i(s.title)+" · course",1))]),t("div",lt,[t("h3",null,i(s.title),1),t("p",null,i(s.description||"Continue your guided English course."),1),t("div",it,[e[7]||(e[7]=t("span",null,"Progress",-1)),t("span",null,i(s.progressPct)+"%",1)]),t("div",dt,[t("span",{style:Y({width:`${s.progressPct}%`})},null,4)]),e[8]||(e[8]=t("strong",null,"Continue learning â",-1))])]),_:2},1032,["to"]))),128))])):(a(),l("div",rt,[...e[9]||(e[9]=[t("h3",null,"No courses yet",-1),t("p",null,"Your enrolled courses will appear here as soon as they are assigned.",-1)])]))]),y(Z,{defaults:n(d).bookingDefaults,credits:n(d).credits,"csrf-token":n(d).csrfToken,onCompleted:n(L)},null,8,["defaults","credits","csrf-token","onCompleted"]),t("section",ut,[t("div",ct,[e[10]||(e[10]=t("h2",{id:"upcoming-lessons-title"},"Upcoming lessons",-1)),y(u,{to:"/dashboard/lessons"},{default:C(()=>[b("View all · "+i(n(A).length),1)]),_:1})]),n(x)?(a(),l("p",_t,[e[11]||(e[11]=b(" Lesson times are shown in this deviceâs current time zone: ",-1)),t("strong",pt,i(n(x)),1),e[12]||(e[12]=b(". If your device time zone changes while you travel, these times update automatically. ",-1))])):r("",!0),n(P).length?(a(),l("div",mt,[(a(!0),l(S,null,I(n(P),s=>
1(a(),l("article",{key:s.id,class:"student-lesson-shell"},[t("button",{type:"button",class:"student-lesson student-lesson--upcoming",onClick:z=>g.value=s},[t("span",gt,[t("strong",null,i(m(s.startsAt).day),1),t("small",null,i(m(s.startsAt).month),1)]),t("span",vt,[t("strong",null,i(s.title),1),t("small",null,i(m(s.startsAt).when),1),t("span",yt,[s.lessonType==="group"?(a(),l("em",bt,"Group class")):r("",!0),s.canJoin?(a(),l("em",kt,"Ready to join")):r("",!0),s.notesAvailable?(a(),l("em",ft,"Notes")):r("",!0),s.reportAvailable?(a(),l("em",wt,"Report")):r("",!0),s.notebookAvailable||s.whiteboardAvailable||s.recordingAvailable?(a(),l("em",Ct,"Files")):r("",!0)])]),e[13]||(e[13]=t("span",{"aria-hidden":"true"},"âº",-1))],8,ht),t("button",{type:"button",class:"student-lesson__join",disabled:!s.canJoin||n(v)===s.id,onClick:z=>M(s)},i(n(v)===s.id?"Openingâ¦":s.canJoin?"Join class":"Opens 5 min before"),9,xt)]))),128))])):(a(),l("div",At,[...e[14]||(e[14]=[t("h3",null,"No upcoming lessons",-1),t("p",null,"Your next confirmed lesson will appear here.",-1)])])),n(w)?(a(),l("p",Tt,i(n(w)),1)):r("",!0),n($)>1?(a(),l("div",$t,[t("button",{type:"button",disabled:n(_)===0,onClick:e[0]||(e[0]=s=>_.value--)}," â Earlier ",8,Dt),t("span",null,i(n(_)+1)+" / "+i(n($)),1),t("button",{type:"button",disabled:n(_)>
1=n($)-1,onClick:e[1]||(e[1]=s=>_.value++)}," Later â ",8,St)])):r("",!0)]),t("section",It,[t("div",Nt,[e[15]||(e[15]=t("h2",{id:"past-lessons-title"},"Past lessons",-1)),y(u,{to:"/dashboard/lessons"},{default:C(()=>[b("View all · "+i(n(T).length),1)]),_:1})]),n(j).length?(a(),l("div",Lt,[(a(!0),l(S,null,I(n(j),s=>(a(),l("button",{key:s.id,type:"button",class:"student-lesson",onClick:z=>g.value=s},[t("span",jt,[t("strong",null,i(m(s.startsAt).day),1),t("small",null,i(m(s.startsAt).month),1)]),t("span",zt,[t("strong",null,i(s.title),1),t("small",null,i(m(s.startsAt).when),1),t("span",Ft,[t("em",null,i(s.status),1),s.reportAvailable?(a(),l("em",Bt,"Report")):r("",!0),s.notebookAvailable||s.whiteboardAvailable||s.recordingAvailable?(a(),l("em",Vt,"Files")):r("",!0)])]),e[16]||(e[16]=t("span",{"aria-hidden":"true"},"âº",-1))],8,Pt))),128))])):(a(),l("div",Gt,[...e[17]||(e[17]=[t("h3",null,"No past lessons yet",-1),t("p",null,"Your completed lesson history will appear here.",-1)])])),n(D)>1?(a(),l("div",Mt,[t("button",{type:"button",disabled:n(p)===0,onClick:e[2]||(e[2]=s=>p.value--)}," â Newer ",8,Jt),t("span",null,i(n(p)+1)+" / "+i(n(D)),1),t("button",{type:"button",disabled:n(p)>=n(D)-1,onClick:e[3]||(e[3]=s=>p.value++)}," Older â ",8,Et)])):r("",!0)]),y(q,{lesson:n(g),"csrf-token":n(d).csrfToken,"booking-defaults":n(d).bookingDefaults,onChanged:n(L),onClose:e[4]||(e[4]=s=>g.value=null)},null,8,["lesson","csrf-token","booking-defaults","onChanged"])])):r("",!0)}}}),Wt=H(Ut,[["__scopeId","data-v-97ef73d3"]]);export{Wt 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.