import{u as y,j as e,b5 as d,q as x,A as r,c2 as h}from"./vendor-BKmmeuxg.js";import{D as C,a as M}from"./dynamic-marksheet-1vU1WSTz.js";import{A as u,a as f,b as p}from"./alert-D9uBQ7fu.js";import{C as i,b as c}from"./card-D9_SJYq6.js";import{c as g,T as w,a as j,b as N}from"./tabs-Ifouhv9A.js";import"./button-BpNwv2aE.js";import"./index-WW_1X1qx.js";import"./utils-DxSsnXxD.js";import"./label-HmIcv5Yx.js";import"./radio-group-C0C2vfl-.js";import"./jspdf.es.min-BFMcGtlR.js";import"./index-D9-QKOod.js";const B=()=>{const{props:k}=y(),{exam:l,bestAttempt:t,certificateTemplate:a,marksheetTemplate:s,studentMarks:m,auth:o}=k,b=(t==null?void 0:t.is_passed)||!1;if(!((t==null?void 0:t.status)==="completed"))return e.jsxs(u,{children:[e.jsx(d,{className:"h-4 w-4"}),e.jsx(f,{children:"Certificate & Marksheet Locked"}),e.jsx(p,{children:"Complete at least one exam attempt to unlock your certificate and marksheet."})]});if(!b)return e.jsxs(u,{children:[e.jsx(d,{className:"h-4 w-4"}),e.jsx(f,{children:"Certificate & Marksheet Locked"}),e.jsx(p,{children:"You need to pass the exam to unlock your certificate and marksheet."})]});const n=t!=null&&t.end_time?x(new Date(t.end_time),"MMMM d, yyyy"):x(new Date,"MMMM d, yyyy");return!a&&!s?e.jsx("div",{className:"p-6",children:e.jsx(i,{children:e.jsxs(c,{className:"flex flex-col items-center justify-center p-12 text-center",children:[e.jsx(r,{className:"text-muted-foreground mb-4 h-16 w-16"}),e.jsx("h3",{className:"mb-2 text-xl font-semibold",children:"No Certificate or Marksheet Available"}),e.jsx("p",{className:"text-muted-foreground",children:"The instructor hasn't set up certificates or marksheets for this exam yet."})]})})}):e.jsx("div",{children:e.jsxs(g,{defaultValue:"certificate",className:"w-full",children:[e.jsxs(w,{className:"mb-6 grid h-11 w-full grid-cols-2",children:[e.jsxs(j,{value:"certificate",className:"flex h-9 cursor-pointer items-center gap-2",children:[e.jsx(r,{className:"h-4 w-4"}),"Certificate"]}),e.jsxs(j,{disabled:!0,value:"",className:"flex h-9 cursor-pointer items-center gap-2",children:[e.jsx(h,{className:"h-4 w-4"}),"Marksheet"]})]}),e.jsx(N,{value:"certificate",children:a?e.jsx(C,{template:a,courseName:l.title,studentName:o.user.name,completionDate:n}):e.jsx(i,{children:e.jsxs(c,{className:"flex flex-col items-center justify-center p-12 text-center",children:[e.jsx(r,{className:"text-muted-foreground mb-4 h-16 w-16"}),e.jsx("h3",{className:"mb-2 text-xl font-semibold",children:"No Certificate Available"}),e.jsx("p",{className:"text-muted-foreground",children:"The instructor hasn't set up certificates for this exam yet."})]})})}),e.jsx(N,{value:"marksheet",children:!s||!m?e.jsx(i,{children:e.jsxs(c,{className:"flex flex-col items-center justify-center p-12 text-center",children:[e.jsx(h,{className:"text-muted-foreground mb-4 h-16 w-16"}),e.jsx("h3",{className:"mb-2 text-xl font-semibold",children:"No Marksheet Available"}),e.jsx("p",{className:"text-muted-foreground",children:s?"No marks data available. Complete exam attempts to view your marksheet.":"The instructor hasn't set up marksheets for this exam yet."})]})}):e.jsx(M,{template:s,courseName:l.title,studentName:o.user.name,completionDate:n,studentMarks:m})})]})})};export{B as default};