import{r as j,j as e,w as g,k as u,C as N,F as f,d4 as v,i as _,bP as w,t as y,p as S}from"./vendor-rThclpOQ.js";import{B as k}from"./badge-DJgeeB6N.js";import{B as c}from"./button-ZcsoqUQn.js";import{D,a as C,b,c as A,d as M}from"./dialog-CDEDwQhm.js";import{S as B}from"./scroll-area-BCwyUKIK.js";import F from"./assignment-grade-form-zb8d87-J.js";import"./index-DquVdLUg.js";import"./utils-8KAaAB9H.js";import"./input-error-Br4ngfdE.js";import"./loading-button-DKhpmf6V.js";import"./input-BeqyurrI.js";import"./label-CtY1vfZY.js";import"./select-u0okJC03.js";import"./textarea-DM_GyfeP.js";const Q=({submission:t})=>{var l,m,d,i,n;const[x,o]=j.useState(!1),a=t.is_late,s=t.status==="graded",r=a?((l=t.assignment)==null?void 0:l.late_total_mark)||0:((m=t.assignment)==null?void 0:m.total_mark)||0,h=p=>S(new Date(p),"MMMM dd, yyyy, hh:mm a");return e.jsxs(D,{open:x,onOpenChange:o,children:[e.jsx(C,{asChild:!0,children:e.jsxs(c,{variant:"secondary",size:"sm",className:"gap-2",children:[e.jsx(g,{className:"h-4 w-4"}),e.jsx("span",{children:s?"Review":"Grade"})]})}),e.jsx(b,{className:"max-h-[90vh] max-w-4xl p-0",children:e.jsx(B,{className:"max-h-[90vh]",children:e.jsxs("div",{className:"p-6",children:[e.jsx(A,{className:"mb-6",children:e.jsx(M,{className:"text-lg",children:s?"Review Submission":"Grade Submission"})}),e.jsxs("div",{className:"space-y-6",children:[a&&e.jsxs("div",{className:"bg-destructive/10 mt-2 rounded-lg p-3",children:[e.jsxs("div",{className:"text-destructive flex items-center gap-2 text-sm font-medium",children:[e.jsx(u,{className:"h-4 w-4"}),e.jsx("p",{children:"Late Submission"})]}),e.jsxs("p",{className:"text-muted-foreground mt-1 text-xs",children:["Maximum marks is considered as ",(d=t.assignment)==null?void 0:d.late_total_mark," ",t.is_late?"for late submission":""]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border p-4",children:[e.jsx(N,{className:"text-primary h-5 w-5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Submitted At"}),e.jsx("p",{className:"text-sm font-medium",children:h(t.submitted_at)})]})]}),e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border p-4",children:[e.jsx(f,{className:"text-primary h-5 w-5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Assignment"}),e.jsx("p",{className:"font-medium",children:((i=t.assignment)==null?void 0:i.title)||"N/A"})]})]}),e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border p-4",children:[e.jsx(v,{className:"text-primary h-5 w-5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Total Marks"}),e.jsxs("p",{className:"font-medium",children:[r,a&&e.jsxs("span",{className:"text-muted-foreground ml-1 text-xs",children:["(Late: ",(n=t.assignment)==null?void 0:n.late_total_mark,")"]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border p-4",children:[e.jsx(_,{className:"text-primary h-5 w-5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Attempt Number"}),e.jsxs(k,{variant:"outline",children:["Attempt #",t.attempt_number]})]})]})]}),e.jsxs("div",{className:"space-y-4 rounded-lg border p-4",children:[e.jsx("h3",{className:"font-semibold",children:"Submission Details"}),e.jsxs("div",{children:[e.jsxs("p",{className:"mb-2 text-sm font-medium",children:["Submitted ",t.attachment_type==="url"?"URL":"File",":"]}),t.attachment_type==="url"?e.jsxs("a",{href:t.attachment_path,target:"_blank",rel:"noopener noreferrer",className:"text-primary flex items-center gap-2 hover:underline",children:[e.jsx(w,{className:"h-4 w-4"}),t.attachment_path]}):e.jsx(c,{variant:"outline",size:"sm",className:"gap-2",asChild:!0,children:e.jsxs("a",{href:t.attachment_path,download:!0,children:[e.jsx(y,{className:"h-4 w-4"}),"Download Submission File"]})})]}),t.comment&&e.jsxs("div",{children:[e.jsx("p",{className:"mb-2 text-sm font-medium",children:"Student Comment:"}),e.jsx("p",{className:"text-muted-foreground bg-muted rounded-lg p-3 text-sm",children:t.comment})]})]}),e.jsx(F,{isGraded:s,isLate:a,totalMarks:r,submission:t})]})]})})})]})};export{Q as default};
