lms/public/build/assets/admin-table-columns-vYUbwSRl.js
2025-12-15 12:26:23 +01:00

2 lines
2.3 KiB
JavaScript

import{j as e,T as d}from"./vendor-BKmmeuxg.js";import{D as o}from"./delete-modal-D1GJlb1P.js";import{B as c}from"./badge-AQfLLMpR.js";import{B as m}from"./button-BpNwv2aE.js";import"./dialog-B2gN9MvT.js";import"./utils-DxSsnXxD.js";import"./index-WW_1X1qx.js";const v=(i,s,n)=>{const{table:a}=s;return[{id:"index",header:()=>e.jsx("div",{className:"pl-4",children:"#"}),cell:({row:r})=>e.jsx("div",{className:"w-4 pl-4 text-center font-medium",children:r.index+1})},{id:"name",header:a.name,cell:({row:r})=>{const t=r.original.user;return e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"bg-muted h-12 w-12 overflow-hidden rounded-full",children:t.photo?e.jsx("img",{src:t.photo,alt:t.name,className:"h-full w-full object-cover"}):e.jsx("div",{className:"flex h-full w-full items-center justify-center bg-gray-200 text-gray-500",children:e.jsx("span",{className:"text-lg",children:a.img_placeholder})})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:t.name}),e.jsx("p",{className:"text-muted-foreground text-sm",children:t.email})]})]})}},{id:"enrolled_course",header:()=>i==="course"?a.enrolled_course:"Enrolled Exam",cell:({row:r})=>{const t=r.original,l=r.original;return e.jsx("div",{className:"max-w-md",children:e.jsx("p",{className:"line-clamp-1",children:i==="course"?l.course.title:t.exam.title})})}},{id:"enrolled_date",header:a.enrolled_date,cell:({row:r})=>{const l=new Date(r.original.entry_date).toLocaleDateString("en-US",{month:"long",day:"2-digit",year:"numeric"});return e.jsx("div",{children:l})}},{id:"expiry_date",header:a.expiry_date,cell:({row:r})=>{if(!r.original.expiry_date)return e.jsx(c,{className:"bg-green-100 text-green-800 hover:bg-green-100",children:a.lifetime_access});const l=new Date(r.original.expiry_date).toLocaleDateString("en-US",{month:"long",day:"2-digit",year:"numeric"});return e.jsx("div",{children:l})}},{id:"actions",header:()=>e.jsx("div",{className:"pr-4 text-end",children:a.action}),cell:({row:r})=>e.jsx("div",{className:"flex justify-end pr-4",children:e.jsx(o,{routePath:route(n,r.original.id),actionComponent:e.jsx(m,{size:"icon",variant:"ghost",className:"h-8 w-8 bg-red-50 text-red-500 hover:bg-red-100 hover:text-red-500",children:e.jsx(d,{className:"h-5 w-5"})})})})}]};export{v as default};