import{r as a,j as e,a as x}from"./app-DP6lEqpE.js";import{A as m}from"./AppLayout-DveQsGoq.js";function u({students:s,classrooms:i,filters:r}){const[l,d]=a.useState(String(r.min_absences)),[n,c]=a.useState(r.classroom_id?String(r.classroom_id):"");function o(){x.get("/school/absence-report",{min_absences:l||"3",...n?{classroom_id:n}:{}},{preserveState:!0,replace:!0})}function h(t){return t>=80?"var(--color-success)":t>=60?"var(--color-warning)":"var(--color-danger)"}return e.jsx(m,{title:"گزارش دانش‌آموزان پرغیبت",children:e.jsxs("div",{className:"page-stack",children:[e.jsx("section",{className:"section-header",children:e.jsxs("div",{children:[e.jsx("h2",{children:"گزارش دانش‌آموزان پرغیبت"}),e.jsx("p",{children:"دانش‌آموزانی که تعداد غیبت آن‌ها از حد مشخص شده بیشتر است."})]})}),e.jsx("section",{className:"panel-card",children:e.jsxs("div",{className:"form-grid",style:{gridTemplateColumns:"repeat(auto-fit, minmax(180px, 1fr))",marginBottom:"1rem"},children:[e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",marginBottom:"0.4rem",fontWeight:600,fontSize:"0.9rem"},children:"حداقل تعداد غیبت"}),e.jsx("input",{type:"number",min:1,value:l,onChange:t=>d(t.target.value),style:{width:"100%",border:"1.5px solid var(--color-border)",borderRadius:"var(--radius-sm)",padding:"0.55rem 0.8rem",fontSize:"0.95rem"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",marginBottom:"0.4rem",fontWeight:600,fontSize:"0.9rem"},children:"کلاس"}),e.jsxs("select",{value:n,onChange:t=>c(t.target.value),style:{width:"100%",border:"1.5px solid var(--color-border)",borderRadius:"var(--radius-sm)",padding:"0.55rem 0.8rem",fontSize:"0.95rem",background:"white"},children:[e.jsx("option",{value:"",children:"همه کلاس‌ها"}),i.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))]})]}),e.jsx("div",{style:{display:"flex",alignItems:"flex-end"},children:e.jsxs("button",{className:"btn btn-primary",type:"button",onClick:o,children:[e.jsx("i",{className:"bi bi-funnel"})," اعمال فیلتر"]})})]})}),s.length===0?e.jsx("section",{className:"panel-card",children:e.jsxs("p",{style:{color:"var(--color-text-muted)"},children:["هیچ دانش‌آموزی با ",r.min_absences," یا بیشتر غیبت یافت نشد."]})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{display:"flex",gap:"1rem",alignItems:"center",padding:"0 0.25rem"},children:e.jsxs("span",{style:{fontSize:"0.9rem",color:"var(--color-text-muted)"},children:[s.length," دانش‌آموز یافت شد"]})}),e.jsx("div",{className:"table-wrap panel-card",style:{padding:0,overflow:"hidden"},children:e.jsxs("table",{className:"data-table",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("th",{children:"موجه"}),e.jsx("th",{children:"تاخیر"}),e.jsx("th",{children:"درصد حضور"})]})}),e.jsx("tbody",{children:s.map(t=>e.jsxs("tr",{children:[e.jsx("td",{style:{fontWeight:600},children:t.name}),e.jsx("td",{children:e.jsx("code",{style:{fontSize:"0.8rem"},children:t.studentCode})}),e.jsx("td",{children:t.classroomName}),e.jsx("td",{style:{textAlign:"center"},children:t.totalSessions}),e.jsx("td",{style:{textAlign:"center"},children:e.jsx("span",{className:"badge badge-danger",children:t.absenceCount})}),e.jsx("td",{style:{textAlign:"center"},children:t.excusedCount>0?e.jsx("span",{className:"badge badge-warning",children:t.excusedCount}):e.jsx("span",{style:{color:"var(--color-text-muted)"},children:"—"})}),e.jsx("td",{style:{textAlign:"center"},children:t.lateCount>0?e.jsx("span",{className:"badge badge-muted",children:t.lateCount}):e.jsx("span",{style:{color:"var(--color-text-muted)"},children:"—"})}),e.jsx("td",{style:{textAlign:"center"},children:e.jsxs("span",{style:{color:h(t.attendancePct),fontWeight:700},children:[t.attendancePct,"٪"]})})]},t.id))})]})})]})]})})}export{u as default};
