import{r as x,j as e}from"./app-DP6lEqpE.js";import{A as h}from"./AppLayout-DveQsGoq.js";import{f as n}from"./formatters-CfeoZ7wP.js";function j({metrics:l,tasks:a,activeModules:i,importantAnnouncements:t,licenseWarning:o}){const[c,d]=x.useState([]),m=t.filter(s=>!c.includes(s.id)),p=[{label:"دانش‌آموزان",value:l.students,icon:"bi-person-badge",href:"/school/students"},{label:"معلمان",value:l.teachers,icon:"bi-person-workspace",href:"/school/teachers"},{label:"کلاس‌ها",value:l.classes,icon:"bi-door-open",href:"/school/classes"},{label:"SMS باقی‌مانده",value:l.smsBalance,icon:"bi-wallet2",href:"/school/sms-wallet",accent:l.smsBalance<100},{label:"امتحانات فعال",value:l.activeExams,icon:"bi-pencil-square",href:"/school/grades"},{label:"غیبت‌های امروز",value:l.absencesToday,icon:"bi-clipboard-x",href:"/school/attendance",accent:l.absencesToday>0}];return e.jsx(h,{title:"داشبورد مدرسه",children:e.jsxs("div",{className:"page-stack",children:[o&&e.jsxs("div",{style:{background:"#fee2e2",border:"1px solid #f87171",borderRadius:"var(--radius-md)",padding:"0.875rem 1.25rem",display:"flex",gap:"0.75rem",alignItems:"flex-start"},children:[e.jsx("i",{className:"bi bi-shield-exclamation",style:{color:"var(--color-danger)",fontSize:"1.1rem",flexShrink:0,marginTop:"0.1rem"}}),e.jsxs("span",{children:[e.jsx("strong",{children:"هشدار مجوز: "}),o]})]}),m.map(s=>e.jsxs("div",{style:{background:"#fef3c7",border:"1px solid #f59e0b",borderRadius:"var(--radius-md)",padding:"1rem 1.25rem",display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"1rem"},children:[e.jsxs("div",{children:[e.jsxs("strong",{style:{display:"block",marginBottom:"0.25rem"},children:[e.jsx("i",{className:"bi bi-megaphone-fill",style:{marginLeft:"0.4rem"}}),s.title]}),e.jsx("span",{style:{fontSize:"0.9rem"},children:s.body}),e.jsx("span",{style:{display:"block",fontSize:"0.78rem",color:"var(--color-text-muted)",marginTop:"0.25rem"},children:s.createdAt})]}),e.jsx("button",{style:{background:"none",border:"none",cursor:"pointer",fontSize:"1.2rem",flexShrink:0},type:"button",onClick:()=>d(r=>[...r,s.id]),"aria-label":"بستن",children:e.jsx("i",{className:"bi bi-x"})})]},s.id)),e.jsx("section",{className:"dashboard-grid",children:p.map(s=>{const r=s.href?"a":"article";return e.jsxs(r,{className:"metric-card",href:s.href,style:{textDecoration:"none",cursor:s.href?"pointer":"default",borderColor:s.accent?"var(--color-danger)":void 0,display:"flex",flexDirection:"column",gap:"0.75rem"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[e.jsx("span",{style:{fontSize:"0.875rem"},children:s.label}),e.jsx("span",{style:{background:s.accent?"#fee2e2":"var(--color-primary-soft)",borderRadius:"var(--radius-sm)",color:s.accent?"var(--color-danger)":"var(--color-primary)",display:"inline-flex",fontSize:"1rem",padding:"0.4rem"},children:e.jsx("i",{className:`bi ${s.icon}`})})]}),e.jsx("strong",{style:{fontSize:"2rem",color:s.accent?"var(--color-danger)":void 0},children:n(s.value)})]},s.label)})}),e.jsxs("section",{className:"split-panel",children:[e.jsxs("article",{className:"panel-card",children:[e.jsxs("h2",{style:{marginBottom:"1rem",fontSize:"1.05rem"},children:[e.jsx("i",{className:"bi bi-list-check",style:{marginLeft:"0.5rem",color:"var(--color-primary)"}}),"کارهای فوری"]}),a.length===0?e.jsx("p",{style:{color:"var(--color-text-muted)"},children:"موردی برای پیگیری وجود ندارد."}):e.jsx("ul",{className:"timeline-list",children:a.map(s=>e.jsxs("li",{children:[e.jsx("span",{children:s.title}),e.jsx("span",{className:`status-pill ${s.tone==="default"?"":s.tone}`,children:n(s.count)})]},s.title))})]}),e.jsxs("article",{className:"panel-card",children:[e.jsxs("h2",{style:{marginBottom:"1rem",fontSize:"1.05rem"},children:[e.jsx("i",{className:"bi bi-puzzle",style:{marginLeft:"0.5rem",color:"var(--color-primary)"}}),"ماژول‌های فعال"]}),i.length===0?e.jsx("p",{style:{color:"var(--color-text-muted)"},children:"هنوز ماژول فعالی برای این مدرسه ثبت نشده است."}):e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"0.5rem"},children:i.map(s=>e.jsxs("span",{className:"badge badge-success",style:{fontSize:"0.8rem"},children:[e.jsx("i",{className:"bi bi-check-circle",style:{marginLeft:"0.3rem"}}),s]},s))})]})]})]})})}export{j as default};
