import{u as j,j as e,cW as n,L as v,cs as y,e as l,c3 as N,cX as f,T as b}from"./vendor-rThclpOQ.js";import{D as _}from"./delete-modal-CrLtMjfS.js";import{B as c}from"./badge-DJgeeB6N.js";import{B as a}from"./button-ZcsoqUQn.js";import{D as C,a as k,b as D,c as K}from"./dropdown-menu-Cm0H42C1.js";import{u as P}from"./use-auth-C-KzOAQ_.js";import{g as V}from"./route-B4ZMN77y.js";import{s as z,c as T}from"./utils-8KAaAB9H.js";import"./dialog-CDEDwQhm.js";import"./index-DquVdLUg.js";const R=()=>{const{isAdmin:o}=P(),{props:d,url:m}=j(),{system:u,translate:x}=d,{table:M,common:A}=x,r=z(u.fields.selling_currency),i=V(m),h=["all","draft","published","archived"];return[{accessorKey:"instructor",header:({column:s})=>e.jsx("div",{className:"flex items-center pl-4",children:e.jsxs(a,{variant:"ghost",className:"p-0 hover:bg-transparent",onClick:()=>s.toggleSorting(s.getIsSorted()==="asc"),children:["Instructor",e.jsx(n,{})]})}),cell:({row:s})=>e.jsxs("div",{className:"pl-4",children:[e.jsx("p",{className:"mb-0.5 text-base font-medium",children:s.original.instructor.user.name}),e.jsx("p",{className:"text-muted-foreground text-xs",children:s.original.instructor.user.email})]})},{accessorKey:"title",header:"Exam Title",cell:({row:s})=>e.jsxs("div",{className:"py-1",children:[e.jsx(v,{href:route("exams.details",{slug:s.original.slug,id:s.original.id}),className:"font-medium hover:underline",children:s.getValue("title")}),e.jsx("p",{className:"text-muted-foreground text-xs",children:s.original.exam_category.title})]})},{accessorKey:"status",header:({column:s})=>e.jsx("div",{className:"flex justify-center",children:e.jsxs(C,{children:[e.jsx(k,{className:"flex items-center justify-center",children:e.jsxs(a,{variant:"ghost",className:"text-muted-foreground capitalize",children:[e.jsx("span",{children:i.status??"Status"}),e.jsx(y,{className:"h-3 w-3 text-gray-700"})]})}),e.jsx(D,{align:"center",className:"min-w-[72px]",children:h.map(t=>e.jsx(K,{onClick:()=>l.get(route("exams.index",{...i,status:t})),className:T("cursor-pointer text-center capitalize",i.status===t&&"bg-gray-100"),children:t},t))})]})}),cell:({row:s})=>e.jsx("div",{className:"flex justify-center py-1",children:e.jsx(c,{variant:s.getValue("status")==="published"?"default":"secondary",className:"capitalize",children:s.getValue("status")})})},{accessorKey:"level",header:()=>e.jsx("div",{className:"text-center",children:"Level"}),cell:({row:s})=>e.jsx("div",{className:"py-1 text-center",children:s.getValue("level")?e.jsx(c,{variant:"outline",className:"capitalize",children:s.getValue("level")}):"--"})},{accessorKey:"total_questions",header:()=>e.jsx("div",{className:"text-center",children:"Questions"}),cell:({row:s})=>e.jsx("div",{className:"py-1 text-center",children:s.getValue("total_questions")})},{accessorKey:"total_marks",header:()=>e.jsx("div",{className:"text-center",children:"Total Marks"}),cell:({row:s})=>e.jsx("div",{className:"py-1 text-center",children:s.getValue("total_marks")})},{accessorKey:"enrollments_count",header:({column:s})=>e.jsx("div",{className:"flex items-center justify-center",children:e.jsxs(a,{variant:"ghost",onClick:()=>s.toggleSorting(s.getIsSorted()==="asc"),children:["Enrollments",e.jsx(n,{})]})}),cell:({row:s})=>e.jsx("div",{className:"py-1 text-center",children:s.getValue("enrollments_count")||0})},{accessorKey:"pricing_type",header:()=>e.jsx("div",{className:"text-center",children:"Price"}),cell:({row:s})=>{const t=s.original.discount_price?Number(s.original.discount_price):null,g=s.original.price?Number(s.original.price):0,p=t||g;return e.jsx("div",{className:"py-1 text-center",children:s.original.pricing_type==="paid"?e.jsxs("span",{className:"font-semibold",children:[r==null?void 0:r.symbol,p.toFixed(2)]}):e.jsx(c,{variant:"outline",className:"bg-green-50 text-green-600",children:"Free"})})}},{id:"actions",header:()=>e.jsx("div",{className:"pr-4 text-end",children:"Actions"}),cell:({row:s})=>{const t=s.original;return e.jsxs("div",{className:"flex justify-end gap-2 py-1 pr-4",children:[e.jsx(a,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>l.get(route("exams.details",{slug:t.slug,id:t.id})),children:e.jsx(N,{className:"h-4 w-4"})}),e.jsx(a,{size:"icon",variant:"secondary",className:"h-8 w-8",onClick:()=>l.get(route("exams.edit",t.id)),children:e.jsx(f,{})}),o&&e.jsx(_,{routePath:route("exams.destroy",t.id),message:`Are you sure you want to delete "${t.title}"? This action cannot be undone.`,actionComponent:e.jsx(a,{size:"icon",variant:"ghost",className:"bg-destructive/8 hover:bg-destructive/6 h-8 w-8 p-0",children:e.jsx(b,{className:"text-destructive text-sm"})})})]})}}]};export{R as default};
