import{jsxs as a,Fragment as u,jsx as r}from"react/jsx-runtime";import{a as v,k as N,m as C,n as x,l as f,B as o,H as g,K as y,e as k,M as w,N as b}from"./ui-components-B24mpb8o.js";import{Link as _,router as l}from"@inertiajs/react";import{Check as d,ClipboardList as D,Edit as S,Trash2 as M}from"lucide-react";import{useState as P}from"react";import A from"./marksheet-preview-fxQZvXfe.js";import"next-themes";import"sonner";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 ne=({type:m,template:e})=>{const[i,s]=P(null),n=t=>{l.post(route("marksheet.templates.activate",t),{type:m},{preserveScroll:!0})},c=t=>{confirm("Are you sure you want to delete this marksheet template?")&&l.delete(route("marksheet.templates.destroy",t),{preserveScroll:!0})},h=t=>{s(t)},p=()=>{s(null)};return a(u,{children:[a(v,{className:`relative ${e.is_active?"ring-primary ring-2":""}`,children:[e.is_active&&a("div",{className:"bg-primary text-primary-foreground absolute top-4 right-4 rounded-full px-3 py-1 text-xs font-semibold",children:[r(d,{className:"mr-1 inline h-3 w-3"}),"Active"]}),a(N,{children:[a(C,{className:"flex items-center",children:[r(D,{className:"mr-2 h-5 w-5"}),e.name]}),a(x,{children:["Created: ",new Date(e.created_at).toLocaleDateString()]})]}),a(f,{className:"space-y-4",children:[a("div",{className:"cursor-pointer rounded-lg border-2 p-4 text-center transition-all hover:shadow-md",style:{backgroundColor:e.template_data.backgroundColor,borderColor:e.template_data.borderColor},onClick:()=>h(e),children:[r("div",{className:"mb-2 text-xs font-bold",style:{color:e.template_data.primaryColor},children:e.template_data.headerText}),r("div",{className:"text-[8px]",style:{color:e.template_data.secondaryColor},children:e.template_data.institutionName})]}),a("div",{className:"flex gap-2",children:[a("div",{className:"flex items-center gap-1",children:[r("div",{className:"h-4 w-4 rounded border",style:{backgroundColor:e.template_data.primaryColor}}),r("span",{className:"text-xs",children:"Primary"})]}),a("div",{className:"flex items-center gap-1",children:[r("div",{className:"h-4 w-4 rounded border",style:{backgroundColor:e.template_data.secondaryColor}}),r("span",{className:"text-xs",children:"Secondary"})]})]}),a("div",{className:"flex gap-2",children:[!e.is_active&&a(o,{size:"sm",variant:"outline",className:"flex-1",onClick:()=>n(e.id),children:[r(d,{className:"mr-1 h-3 w-3"}),"Activate"]}),r(o,{asChild:!0,size:"sm",variant:"outline",className:"flex-1",children:a(_,{href:route("marksheet.templates.edit",e.id),children:[r(S,{className:"mr-1 h-3 w-3"}),"Edit"]})}),r(o,{size:"sm",variant:"destructive",onClick:()=>c(e.id),children:r(M,{className:"h-3 w-3"})})]})]})]},e.id),i&&r(g,{open:!!i,onOpenChange:t=>!t&&p(),children:r(y,{className:"w-full gap-0 overflow-y-auto p-0 sm:max-w-4xl",children:r(k,{className:"max-h-[90vh]",children:a("div",{className:"p-6",children:[r(w,{className:"mb-6",children:a(b,{children:["Preview: ",i==null?void 0:i.name]})}),r(A,{template:i,studentName:"John Doe",courseName:"Sample Course Name",completionDate:"January 1, 2025"})]})})})})]})};export{ne as default};
