"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[14064],{14064:(e,s,a)=>{a.r(s),a.d(s,{default:()=>j});var t=a(95155),l=a(12115),i=a(61659),n=a(2962),r=a(74016),c=a(38992),d=a(30313),h=a(7404),o=a(16099),m=a(2581),x=a(56468);function j(){let[e,s]=(0,l.useState)([]),[a,j]=(0,l.useState)(!0),[f,u]=(0,l.useState)(""),[N,b]=(0,l.useState)(""),S=(0,l.useCallback)(async()=>{j(!0);try{let e=await (0,h.BO)({search:f.trim()||void 0,designation:N||void 0,limit:100});s(e.staff)}catch(e){(0,m.Qg)(e instanceof Error?e.message:"Failed to load staff")}finally{j(!1)}},[f,N]);return(0,l.useEffect)(()=>{S()},[S]),(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)(r.wc,{title:"Staff management",description:"Manage teachers, accountants, and administrators for your school.",children:(0,t.jsx)(r.so,{columns:1,children:(0,t.jsx)(d.u,{href:o.bw.SMS_ADMIN.STAFF_NEW,children:"Add staff member"})})}),(0,t.jsx)(x.O,{}),(0,t.jsxs)(d.r7,{children:[(0,t.jsx)(d.D2,{className:"lg:min-w-[16rem]",children:(0,t.jsx)(d.Ew,{value:f,onChange:u,placeholder:"Search name, email, or phone…",ariaLabel:"Search staff"})}),(0,t.jsx)(d.D2,{label:"Role",children:(0,t.jsxs)(d.Kd,{value:N,onChange:e=>b(e.target.value),children:[(0,t.jsx)("option",{value:"",children:"All roles"}),(0,t.jsx)("option",{value:"teacher",children:"Teacher"}),(0,t.jsx)("option",{value:"accountant",children:"Accountant"}),(0,t.jsx)("option",{value:"administrator",children:"Administrator"})]})})]}),a?(0,t.jsx)(d.nI,{rows:4}):(0,t.jsxs)(c.Z,{className:"overflow-hidden shadow-sm",children:[(0,t.jsx)(d.bX,{icon:(0,t.jsx)(i.Sy$,{className:"h-4 w-4",strokeWidth:1.75,"aria-hidden":!0}),title:"Staff directory",subtitle:`${e.length} staff member${1===e.length?"":"s"}`,action:(0,t.jsx)(n.u,{href:o.bw.SMS_ADMIN.ASSIGN_SUBJECTS,className:"text-sm font-semibold text-primary-700 hover:underline",children:"View class assignments"})}),(0,t.jsx)(d.yg,{children:0===e.length?(0,t.jsx)(d.i0,{title:"No staff members found",description:"Add teachers, accountants, or administrators to get started.",action:(0,t.jsx)(n.u,{href:o.bw.SMS_ADMIN.STAFF_NEW,children:(0,t.jsx)(d.kL,{type:"button",children:"Add staff member"})})}):e.map(e=>(0,t.jsxs)(d.oe,{children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-semibold text-slate-900",children:e.fullName}),(0,t.jsx)("p",{className:"text-sm text-slate-500",children:e.email})]}),(0,t.jsx)(d.XW,{label:e.staffRoleLabel})]}),(0,t.jsx)(d._w,{label:"Phone",children:e.phone||"—"}),(0,t.jsx)(d._w,{label:"Status",children:(0,t.jsx)(d.tF,{active:e.isActive})})]},e.id))}),(0,t.jsx)(d.iZ,{children:(0,t.jsxs)(d.cR,{minWidth:"56rem",children:[(0,t.jsx)(d.K_,{children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{className:`${d.aB} font-medium`,children:"Name"}),(0,t.jsx)("th",{className:`${d.aB} font-medium`,children:"Role"}),(0,t.jsx)("th",{className:`${d.aB} font-medium`,children:"Email"}),(0,t.jsx)("th",{className:`${d.aB} font-medium`,children:"Phone"}),(0,t.jsx)("th",{className:`${d.aB} font-medium`,children:"Status"})]})}),(0,t.jsx)("tbody",{children:0===e.length?(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:5,className:`${d.Cl} text-center text-slate-500`,children:"No staff members found."})}):e.map(e=>(0,t.jsxs)("tr",{className:"border-t border-slate-100 hover:bg-slate-50/80",children:[(0,t.jsx)("td",{className:d.Cl,children:(0,t.jsx)("div",{className:"font-medium text-slate-900",children:e.fullName})}),(0,t.jsx)("td",{className:d.Cl,children:(0,t.jsx)(d.XW,{label:e.staffRoleLabel})}),(0,t.jsx)("td",{className:`${d.Cl} text-slate-600`,children:e.email}),(0,t.jsx)("td",{className:`${d.Cl} text-slate-600`,children:e.phone||"—"}),(0,t.jsx)("td",{className:d.Cl,children:(0,t.jsx)(d.tF,{active:e.isActive})})]},e.id))})]})})]})]})}}}]);