import{r as j,j as e,w as g,l as u,C as N,F as f,ca as v,k as _,aT as w,v as y,q as S}from"./vendor-BKmmeuxg.js";import{B as k}from"./badge-AQfLLMpR.js";import{B as c}from"./button-BpNwv2aE.js";import{D,a as C,b,c as A,d as M}from"./dialog-B2gN9MvT.js";import{S as B}from"./scroll-area-C8HGru-R.js";import F from"./assignment-grade-form-CfP85CNW.js";import"./index-WW_1X1qx.js";import"./utils-DxSsnXxD.js";import"./input-error-LaPr_4wd.js";import"./loading-button-BnTVAMJ7.js";import"./input-DM0goJrn.js";import"./label-HmIcv5Yx.js";import"./select-CD9o3HN1.js";import"./textarea-CyndvowL.js";const Q=({submission:a})=>{var l,m,d,n,i;const[x,o]=j.useState(!1),t=a.is_late,s=a.status==="graded",r=t?((l=a.assignment)==null?void 0:l.late_total_mark)||0:((m=a.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:[t&&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=a.assignment)==null?void 0:d.late_total_mark," ",a.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(a.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:((n=a.assignment)==null?void 0:n.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,t&&e.jsxs("span",{className:"text-muted-foreground ml-1 text-xs",children:["(Late: ",(i=a.assignment)==null?void 0:i.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 #",a.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 ",a.attachment_type==="url"?"URL":"File",":"]}),a.attachment_type==="url"?e.jsxs("a",{href:a.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"}),a.attachment_path]}):e.jsx(c,{variant:"outline",size:"sm",className:"gap-2",asChild:!0,children:e.jsxs("a",{href:a.attachment_path,download:!0,children:[e.jsx(y,{className:"h-4 w-4"}),"Download Submission File"]})})]}),a.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:a.comment})]})]}),e.jsx(F,{isGraded:s,isLate:t,totalMarks:r,submission:a})]})]})})})]})};export{Q as default};