import{jsxs as r,jsx as e}from"react/jsx-runtime";import{D as M,a as g}from"./dynamic-marksheet-CLP0rkNq.js";import{o as p,p as h,q as f,a as s,l as m,a4 as w,x as v,y as u,z as x}from"./ui-components-B24mpb8o.js";import{usePage as T}from"@inertiajs/react";import{format as N}from"date-fns";import{Lock as k,Award as o,ClipboardList as y}from"lucide-react";import"jspdf";import"react";import"sonner";import"next-themes";import"@radix-ui/react-label";import"class-variance-authority";import"@radix-ui/react-checkbox";import"@radix-ui/react-avatar";import"@radix-ui/react-dropdown-menu";import"@radix-ui/react-scroll-area";import"@radix-ui/react-popover";import"@radix-ui/react-radio-group";import"@radix-ui/react-dialog";import"@radix-ui/react-slot";import"clsx";import"@radix-ui/react-separator";import"@radix-ui/react-tooltip";import"@radix-ui/react-tabs";import"@radix-ui/react-accordion";import"@radix-ui/react-progress";import"@radix-ui/react-select";import"cmdk";import"@radix-ui/react-switch";import"react-day-picker";import"@radix-ui/react-slider";import"embla-carousel-react";import"@radix-ui/react-toggle-group";import"vaul";import"tailwind-merge";const le=()=>{const{props:C}=T(),{exam:c,bestAttempt:t,certificateTemplate:i,marksheetTemplate:a,studentMarks:l,auth:n}=C,b=(t==null?void 0:t.is_passed)||!1;if(!((t==null?void 0:t.status)==="completed"))return r(p,{children:[e(k,{className:"h-4 w-4"}),e(h,{children:"Certificate & Marksheet Locked"}),e(f,{children:"Complete at least one exam attempt to unlock your certificate and marksheet."})]});if(!b)return r(p,{children:[e(k,{className:"h-4 w-4"}),e(h,{children:"Certificate & Marksheet Locked"}),e(f,{children:"You need to pass the exam to unlock your certificate and marksheet."})]});const d=t!=null&&t.end_time?N(new Date(t.end_time),"MMMM d, yyyy"):N(new Date,"MMMM d, yyyy");return!i&&!a?e("div",{className:"p-6",children:e(s,{children:r(m,{className:"flex flex-col items-center justify-center p-12 text-center",children:[e(o,{className:"text-muted-foreground mb-4 h-16 w-16"}),e("h3",{className:"mb-2 text-xl font-semibold",children:"No Certificate or Marksheet Available"}),e("p",{className:"text-muted-foreground",children:"The instructor hasn't set up certificates or marksheets for this exam yet."})]})})}):e("div",{children:r(w,{defaultValue:"certificate",className:"w-full",children:[r(v,{className:"mb-6 grid h-11 w-full grid-cols-2",children:[r(u,{value:"certificate",className:"flex h-9 cursor-pointer items-center gap-2",children:[e(o,{className:"h-4 w-4"}),"Certificate"]}),r(u,{disabled:!0,value:"",className:"flex h-9 cursor-pointer items-center gap-2",children:[e(y,{className:"h-4 w-4"}),"Marksheet"]})]}),e(x,{value:"certificate",children:i?e(M,{template:i,courseName:c.title,studentName:n.user.name,completionDate:d}):e(s,{children:r(m,{className:"flex flex-col items-center justify-center p-12 text-center",children:[e(o,{className:"text-muted-foreground mb-4 h-16 w-16"}),e("h3",{className:"mb-2 text-xl font-semibold",children:"No Certificate Available"}),e("p",{className:"text-muted-foreground",children:"The instructor hasn't set up certificates for this exam yet."})]})})}),e(x,{value:"marksheet",children:!a||!l?e(s,{children:r(m,{className:"flex flex-col items-center justify-center p-12 text-center",children:[e(y,{className:"text-muted-foreground mb-4 h-16 w-16"}),e("h3",{className:"mb-2 text-xl font-semibold",children:"No Marksheet Available"}),e("p",{className:"text-muted-foreground",children:a?"No marks data available. Complete exam attempts to view your marksheet.":"The instructor hasn't set up marksheets for this exam yet."})]})}):e(g,{template:a,courseName:c.title,studentName:n.user.name,completionDate:d,studentMarks:l})})]})})};export{le as default};
