lms/public/build/assets/index-BDtnK4Vb.js
2025-12-15 12:26:23 +01:00

2 lines
5.8 KiB
JavaScript

import{j as e,L as g,H as v}from"./vendor-BKmmeuxg.js";import{C as b,a as w,b as y}from"./card-D9_SJYq6.js";import{c as _}from"./utils-DxSsnXxD.js";import{B as C}from"./button-gradient-primary-CuKxTw1k.js";import{A as k,a as E,b as T}from"./avatar-j28afJTV.js";import{B as h}from"./badge-AQfLLMpR.js";import{P as j}from"./progress-DinXkPLd.js";import{T as P}from"./tabs-D0Mbb5M5.js";import{S as B}from"./separator-_3LZ_wAA.js";import{T as S,a as F,b as L}from"./tabs-Ifouhv9A.js";import M from"./layout-DmOvRWqJ.js";import R from"./exam-attempts-BjwLRWRI.js";import H from"./exam-certificate-DPZqPquP.js";import I from"./exam-resources-BbwzAb4o.js";import G from"./exam-result-DcxbFkFo.js";import"./button-BpNwv2aE.js";import"./index-WW_1X1qx.js";import"./scroll-area-C8HGru-R.js";import"./sheet-DSvHVmaW.js";import"./use-screen-DU5n3V8C.js";import"./landing-layout-DQFYAk24.js";import"./index-CupQom6K.js";import"./app-logo-CmnEIwal.js";import"./main-_V386djS.js";import"./index-D9-QKOod.js";import"./dropdown-menu-DO-po5c1.js";import"./use-auth-NG-DQJrC.js";import"./appearance-D2z3xcjR.js";import"./app-BytVvUs_.js";/* empty css */import"./language-BFZ7KItL.js";import"./notification-CYMPYbAP.js";import"./popover-B4kBsMuI.js";import"./profile-toggle-CvHrFE0q.js";import"./index.browser-OxPLOBIU.js";import"./tab-lists-rr3mSx6y.js";import"./table-header-DVkEnG6Y.js";import"./table-DWOXv4Pu.js";import"./exam-attempt-columns-DvReECYM.js";import"./route-B4ZMN77y.js";import"./dynamic-marksheet-1vU1WSTz.js";import"./label-HmIcv5Yx.js";import"./radio-group-C0C2vfl-.js";import"./jspdf.es.min-BFMcGtlR.js";import"./alert-D9uBQ7fu.js";import"./question-status-icon-ClKO4JNY.js";import"./question-type-badge-C65yTFrV.js";import"./richtor-CRcM6Du2.js";const q=({exam:r,attempts:a,bestAttempt:s,className:m})=>{var l,t,p,x,u,f;const i=(a==null?void 0:a.length)||0;a!=null&&a.filter(d=>d.status==="completed").length;const n=r.max_attempts>0?i/r.max_attempts*100:0,c=Math.min(n,100),o=s&&Number(s.total_marks)>0?Math.round(Number(s.obtained_marks)/Number(s.total_marks)*100*100)/100:0;return e.jsxs(b,{className:_("flex flex-col justify-between overflow-hidden !border md:flex-row",m),children:[e.jsx(w,{className:"h-full w-full p-0 md:min-h-full md:max-w-[340px]",children:e.jsx("img",{src:r.thumbnail||"/assets/images/blank-image.jpg",alt:r.title,className:"h-full w-full object-cover md:min-h-[220px]",onError:d=>{const N=d.target;N.src="/assets/images/blank-image.jpg"}})}),e.jsxs(y,{className:"flex w-full flex-col justify-between p-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"mb-3 flex items-center gap-2",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(k,{className:"h-8 w-8",children:[e.jsx(E,{src:((t=(l=r.instructor)==null?void 0:l.user)==null?void 0:t.photo)||"",alt:(x=(p=r.instructor)==null?void 0:p.user)==null?void 0:x.name,className:"object-cover"}),e.jsx(T,{children:"IM"})]}),e.jsx("p",{className:"text-sm font-medium",children:((f=(u=r.instructor)==null?void 0:u.user)==null?void 0:f.name)||"Instructor"})]})}),e.jsx("p",{className:"hover:text-secondary-foreground text-sm font-semibold",children:r.title})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"w-full space-y-2 pt-4 pb-2",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"w-full",children:[e.jsxs("p",{className:"text-muted-foreground flex items-center justify-between text-sm font-medium",children:[e.jsx("span",{children:"Attempts"}),e.jsxs("span",{children:[i," / ",r.max_attempts]})]}),e.jsx(j,{value:c,className:"h-1.5"})]}),e.jsxs("div",{className:"w-full",children:[e.jsxs("p",{className:"text-muted-foreground flex items-center justify-between text-sm font-medium",children:[e.jsx("span",{children:"Best Score"}),e.jsxs("span",{children:[(s==null?void 0:s.obtained_marks)??0," / ",(s==null?void 0:s.total_marks)??0," (",o,"%)"]})]}),e.jsx(j,{value:o,className:"h-1.5"})]})]}),s&&e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[s.is_passed?e.jsx(h,{className:"bg-green-600",children:"Passed"}):e.jsx(h,{variant:"destructive",children:"Failed"}),e.jsxs("span",{className:"text-muted-foreground text-xs",children:["Pass Mark: ",r.pass_mark,"%"]})]})]}),i<r.max_attempts&&e.jsx(C,{asChild:!0,shadow:!1,containerClass:"w-full",className:"to-primary-light hover:to-primary-light h-9 w-full",children:e.jsx(g,{method:"post",href:route("exam-attempts.start",r.id),data:{exam_id:r.id},children:"Start Exam"})})]})]})]})},z=r=>{const{tab:a,exam:s,attempt:m,attempts:i,bestAttempt:n}=r,c=[{value:"attempts",label:"Attempts"},{value:"resources",label:"Resources"},{value:"certificate",label:"Certificate"}],o=()=>{switch(a){case"attempts":return m?e.jsx(G,{}):e.jsx(R,{});case"resources":return e.jsx(I,{});case"certificate":return e.jsx(H,{});default:return e.jsx(e.Fragment,{})}};return e.jsxs(e.Fragment,{children:[e.jsx(v,{title:s.title}),e.jsx(q,{exam:s,attempts:i||[],bestAttempt:n}),e.jsx(b,{className:"mt-6",children:e.jsxs(P,{value:a,className:"bg-card w-full overflow-hidden rounded-md",children:[e.jsx("div",{className:"overflow-x-auto overflow-y-hidden",children:e.jsx(S,{className:"bg-transparent px-0 py-6",children:c.map(({label:l,value:t})=>e.jsx(F,{value:t,className:"border-primary data-[state=active]:!bg-muted data-[state=active]:before:bg-primary relative flex cursor-pointer items-center justify-start gap-3 rounded-none bg-transparent px-8 py-4 text-start !shadow-none before:absolute before:right-0 before:bottom-0 before:left-0 before:h-1 before:rounded-t-xl data-[state=active]:before:content-['.']",asChild:!0,children:e.jsx(g,{href:route("student.exam.show",{id:s.id,tab:t}),children:e.jsx("span",{children:l})})},t))})}),e.jsx(B,{className:"mt-[1px]"}),e.jsx(L,{value:a,className:"m-0 p-5",children:o()})]})})]})};z.layout=r=>e.jsx(M,{children:r,tab:"exams"});export{z as default};