import{aT as b,j as e,cz as d,bd as x,bf as r,d9 as h}from"./react-vendor-xYZnmIII.js";import{D as C,a as M}from"./dynamic-marksheet-CtgiImA4.js";import{o as u,p as f,q as j,a as i,l as c,a5 as g,y as w,z as p,D as N}from"./ui-components-CQM92IK3.js";import"./inertia-vendor-cBbDTmhJ.js";import"./ui-vendor-Ds9iwIxa.js";import"./jspdf.es.min-CkRVFqvw.js";import"./interactive-vendor-B1OgcAgP.js";const P=()=>{const{props:k}=b(),{exam:l,bestAttempt:s,certificateTemplate:a,marksheetTemplate:t,studentMarks:m,auth:n}=k,y=(s==null?void 0:s.is_passed)||!1;if(!((s==null?void 0:s.status)==="completed"))return e.jsxs(u,{children:[e.jsx(d,{className:"h-4 w-4"}),e.jsx(f,{children:"Certificate & Marksheet Locked"}),e.jsx(j,{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(j,{children:"You need to pass the exam to unlock your certificate and marksheet."})]});const o=s!=null&&s.end_time?x(new Date(s.end_time),"MMMM d, yyyy"):x(new Date,"MMMM d, yyyy");return!a&&!t?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(p,{value:"certificate",className:"flex h-9 cursor-pointer items-center gap-2",children:[e.jsx(r,{className:"h-4 w-4"}),"Certificate"]}),e.jsxs(p,{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:n.user.name,completionDate:o}):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:!t||!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:t?"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:t,courseName:l.title,studentName:n.user.name,completionDate:o,studentMarks:m})})]})})};export{P as default};
