import{lt as r,n as e}from"./render-cqdoDfd9.js";import{t}from"./Box-pvlRBLzs.js";import{t as i}from"./Typography-8v555lWC.js";import{t as o}from"./Paper-DtiadJnq.js";import{t as s}from"./IconButton-BkXELyri.js";import{t as l}from"./LinearProgress-jZTkf1Z2.js";import{t as n}from"./TableContainer-FwpzIaZ5.js";import{a,i as c,n as d,r as h,t as m}from"./TableCell-DrJgogcq.js";import{t as g}from"./Tooltip-BI9A-Ujn.js";import{t as x}from"./WorkspacePremium-BuOxKl4p.js";var p=r();function f({value:r,direction:e}){const o=Math.min(100,Math.max(0,r||0));return(0,p.jsxs)(t,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,p.jsx)(l,{variant:"determinate",value:o,sx:r=>({flex:1,height:8,borderRadius:4,backgroundColor:"light"===r.palette.mode?r.palette.grey[100]:r.palette.grey[800],"& .MuiLinearProgress-bar":{borderRadius:4}})}),(0,p.jsxs)(i,{variant:"body2",color:"text.secondary",sx:{minWidth:38,textAlign:"rtl"===e?"left":"right"},children:[o,"%"]})]})}function j({enrollments:r,selectHandler:t}){const{localeMessages:l,direction:j}=e();return 0===r.length?(0,p.jsx)(i,{component:"span",children:l.nor_enrollments_found}):(0,p.jsx)(n,{component:o,sx:{maxHeight:300,border:"1px solid",borderColor:"grey.300",borderRadius:1},children:(0,p.jsxs)(a,{children:[(0,p.jsx)(c,{children:(0,p.jsxs)(h,{children:[(0,p.jsx)(m,{align:"rtl"==j?"right":"left",children:l.course}),(0,p.jsx)(m,{align:"rtl"==j?"right":"left",children:l.status}),(0,p.jsx)(m,{align:"rtl"==j?"right":"left",children:l.progress||"Progress"}),(0,p.jsx)(m,{align:"rtl"==j?"right":"left",children:l.certificate||"Certificate"})]})}),(0,p.jsx)(d,{children:r.map(r=>(0,p.jsxs)(h,{sx:r=>({":hover":{backgroundColor:r.palette.background.dark,cursor:"pointer",borderBottomColor:"primary.light",borderBottomWidth:2,borderBottomStyle:"solid"}}),onClick:()=>t(r.id),children:[(0,p.jsx)(m,{align:"rtl"==j?"right":"left",children:r.course_title}),(0,p.jsx)(m,{align:"rtl"==j?"right":"left",children:l[r.status]}),(0,p.jsx)(m,{align:"rtl"==j?"right":"left",sx:{minWidth:170},children:(0,p.jsx)(f,{value:r.progress,direction:j})}),(0,p.jsx)(m,{align:"rtl"==j?"right":"left",children:r.certificate_url?(0,p.jsx)(g,{title:l.certificate||"Certificate",children:(0,p.jsx)(s,{component:"a",href:r.certificate_url,rel:"noopener noreferrer",size:"small",onClick:r=>r.stopPropagation(),children:(0,p.jsx)(x,{fontSize:"small"})})}):null})]},r.id))})]})})}export{j as default};