1import{_ as $}from"./3vefiHTg.js";import{Q as N}from"./Bo9pR_xS.js";import{u as A,L as B}from"./DxlKPx3t.js";import{a as S}from"./mRitgnh6.js";import{e as T,u as U,i as z,H as F,y as H,z as L,G as p,o as i,w as s,c as b,k as e,F as P,b as l,N as f,a as c,C as y,t as a,d as h,j as R,x as G}from"./CQFajELG.js";import{u as M}from"./BqhZctYq.js";import{V as I}from"./DdHoRToh.js";import"./d55g4Sen.js";import"./BWyMJzjw.js";import"./nO98DqZ_.js";import"./BXDaMAPy.js";import"./CUKsfdYo.js";const O={class:"text-caption text-medium-emphasis mb-1"},Q={class:"text-h6 font-weight-bold mb-2"},j={key:0,class:"text-body-2 mb-3"},D={class:"text-caption text-medium-emphasis text-center mt-2 mb-0"},E={class:"text-body-2 text-medium-emphasis mb-3"},q={class:"text-body-2 text-medium-emphasis mb-0"},ie=T({__name:"student-view",setup(J){const g=F(),m=M(),{loading:w,error:V,authUrl:v,startAuth:k,reload:x,params:n,courseName:C,assignment:o}=A("/classroom/student-view");U({title:"Natur På Spåret"});const _=z(()=>o.value?`${g.public.lmsUrl}/uppdrag/${o.value.id}`:g.public.lmsUrl),u=H(null);return L(o,async t=>{if(!(!t||!m.authStore.isValid))try{const r=await m.collection(S.UserMissions).getFullList({filter:m.filter("missionTemplateId = {:templateId} && userId = {:userId} && created >= {:since}",{templateId:t.templateId,userId:m.authStore.record?.id,since:t.created}),fields:"completed"});u.value={started:r.length>0,completed:r.some(d=>d.completed)},u.value.completed&&n.value.submissionId&&await $fetch("/api/classroom/grade",{method:"POST",headers:{Authorization:`Bearer ${m.authStore.token}`},body:{courseId:n.value.courseId,itemId:n.value.itemId,itemType:n.value.itemType,attachmentId:n.value.attachmentId,submissionId:n.value.submissionId}}).catch(d=>console.error("Grade passback failed:",d))}catch(r){console.error("Could not read own progress:",r)}},{immediate:!0}),(t,r)=>{const d=$;return i(),p(B,{loading:e(w),error:e(V),"auth-url":e(v),onAuth:e(k),onReload:e(x)},{default:s(()=>[e(o)?(i(),b(P,{key:0},[l(f,{class:"pa-5 mb-4",rounded:"lg"},{default:s(()=>[c("div",O,a(e(C)),1),c("h1",Q,a(e(o).templateName),1),e(o).message?(i(),b("p",j,a(e(o).message),1)):y("",!0),e(u)?.completed?(i(),p(I,{key:1,type:"success",variant:"tonal",density:"compact",class:"mb-3"},{default:s(()=>[h(a(t.$t("assignmentView.youCompleted")),1)]),_:1})):e(u)?.started?(i(),p(I,{key:2,type:"info",variant:"tonal",density:"compact",class:"mb-3"},{default:s(()=>[h(a(t.$t("assignmentView.youStarted")),1)]),_:1})):y("",!0),l(R,{href:e(_),target:"_blank",color:"primary",size:"large",block:"","prepend-icon":"mdi-cellphone-arrow-down"},{default:s(()=>[h(a(t.$t("assignmentView.openInApp")),1)]),_:1},8,["href"]),c("p",D,a(t.$t("assignmentView.openInAppHint")),1)]),_:1}),l(f,{class:"pa-5 text-center",rounded:"lg"},{default:s(()=>[c("p",E,a(t.$t("assignmentView.scanHint")),1),l(d,null,{default:s(()=>[l(N,{value:e(_),width:170,height:170},null,8,["value"])]),_:1})]),_:1})],64)):(i(),p(f,{key:1,class:"pa-6 text-center",rounded:"lg"},{default:s(()=>[l(G,{size:"44",color:"grey-lighten-1",class:"mb-2"},{default:s(()=>[...r[0]||(r[0]=[h("mdi-clipboard-alert-outline",-1)])]),_:1}),c("p",q,a(t.$t("classroom.attachmentMissing")),1)]),_:1}))]),_:1},8,["loading","error","auth-url","onAuth","onReload"])}}});export{ie 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.