import{u as b,j as e,c1 as d,p as x,A as r,cY as h}from"./vendor-rThclpOQ.js";import{D as C,a as M}from"./dynamic-marksheet-DHeD_qYe.js";import{A as u,a as f,b as p}from"./alert-d3kkvqat.js";import{C as i,b as c}from"./card-HXna_7vU.js";import{c as g,T as w,a as j,b as N}from"./tabs-NZTgQ56C.js";import"./button-ZcsoqUQn.js";import"./index-DquVdLUg.js";import"./utils-8KAaAB9H.js";import"./label-CtY1vfZY.js";import"./radio-group-ZDy0XuKl.js";import"./jspdf.es.min-oulr87P8.js";import"./index-CWNIUFqh.js";const B=()=>{const{props:k}=b(),{exam:l,bestAttempt:t,certificateTemplate:a,marksheetTemplate:s,studentMarks:m,auth:o}=k,y=(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(!y)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};
