import{j as e}from"./app-BeXbqfQ0.js";import{A as o}from"./AppLayout-DFlN-unB.js";const a={present:{label:"حاضر",color:"#0EA678",bg:"#0EA67815",icon:"bi-check-circle-fill"},absent:{label:"غایب",color:"#ef4444",bg:"#ef444415",icon:"bi-x-circle-fill"},late:{label:"دیر",color:"#f59e0b",bg:"#f59e0b15",icon:"bi-clock-fill"},excused:{label:"موجه",color:"#6366f1",bg:"#6366f115",icon:"bi-shield-check"}},d={in_person:"حضوری",online:"آنلاین"};function b({records:n,summary:i}){const c=Object.values(i).reduce((s,l)=>s+l,0),r=c>0?Math.round(i.present/c*100):100;return e.jsx(o,{title:"حضور و غیاب",children:e.jsxs("div",{className:"page-stack",children:[e.jsx("section",{className:"section-header",children:e.jsxs("div",{children:[e.jsxs("h2",{children:[e.jsx("i",{className:"bi bi-clipboard-check",style:{marginLeft:"0.5rem",color:"var(--color-primary)"}}),"حضور و غیاب"]}),e.jsxs("p",{children:["سابقه حضور و غیاب شما در ",c," جلسه"]})]})}),e.jsx("section",{className:"dashboard-grid",children:Object.entries(a).map(([s,l])=>e.jsxs("article",{className:"metric-card",style:{borderColor:l.color+"40",background:l.bg},children:[e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"0.4rem",color:l.color},children:[e.jsx("i",{className:`bi ${l.icon}`}),l.label]}),e.jsx("strong",{style:{color:l.color},children:i[s]})]},s))}),e.jsxs("section",{className:"panel-card",children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"0.5rem"},children:[e.jsx("span",{style:{fontWeight:600},children:"درصد حضور"}),e.jsxs("strong",{style:{color:r>=80?"#0EA678":r>=60?"#f59e0b":"#ef4444"},children:[r,"٪"]})]}),e.jsx("div",{style:{height:10,background:"var(--color-border)",borderRadius:99,overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${r}%`,background:r>=80?"#0EA678":r>=60?"#f59e0b":"#ef4444",borderRadius:99,transition:"width 0.5s"}})})]}),n.length===0?e.jsx("section",{className:"panel-card",children:e.jsxs("div",{style:{textAlign:"center",padding:"2rem 1rem"},children:[e.jsx("div",{className:"icon-badge",style:{width:56,height:56,fontSize:"1.5rem",margin:"0 auto 1rem"},children:e.jsx("i",{className:"bi bi-clipboard-check"})}),e.jsx("h2",{children:"سابقه‌ای ثبت نشده"}),e.jsx("p",{children:"هنوز هیچ جلسه حضور و غیابی برای شما ثبت نشده است."})]})}):e.jsx("section",{className:"panel-card",style:{padding:0,overflow:"hidden"},children:e.jsx("div",{style:{overflowX:"auto"},children:e.jsxs("table",{className:"data-table",style:{width:"100%"},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"تاریخ"}),e.jsx("th",{children:"کلاس"}),e.jsx("th",{children:"نوع"}),e.jsx("th",{children:"وضعیت"}),e.jsx("th",{children:"یادداشت"})]})}),e.jsx("tbody",{children:n.map((s,l)=>{const t=a[s.status]??{label:s.status,color:"var(--color-text)",bg:"transparent",icon:"bi-dash"};return e.jsxs("tr",{children:[e.jsx("td",{style:{whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},children:s.date}),e.jsx("td",{children:s.classroom}),e.jsx("td",{children:e.jsx("span",{style:{fontSize:"0.8rem",color:"var(--color-text-muted)"},children:d[s.type]??s.type})}),e.jsx("td",{children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.3rem",background:t.bg,color:t.color,border:`1px solid ${t.color}40`,borderRadius:"var(--radius-sm)",padding:"0.15rem 0.5rem",fontSize:"0.8rem",fontWeight:600},children:[e.jsx("i",{className:`bi ${t.icon}`}),t.label]})}),e.jsx("td",{style:{color:"var(--color-text-muted)",fontSize:"0.85rem"},children:s.note??"—"})]},l)})})]})})})]})})}export{b as default};
