1import{r as a,p as B,j as e,B as o,L as M,l as O,aj as k,s as z}from"./app-CFjtGGq1.js";import{D as G}from"./DynamicBanner-DzE7GhsN.js";import{G as R,C as U,B as C}from"./GuestUserLayout-C0Wch0wM.js";/* empty css */import{A as _}from"./Alert-C98ntLmV.js";import{I as q}from"./IconAlertCircle-BWMb2X3O.js";import{T as p}from"./TextInput-hKgwPGxu.js";import{S as H}from"./Select-1ZP1oF11.js";import{T as r}from"./Table-DwnCthsi.js";import{F as V}from"./Flex-7N6Mxv_y.js";import{P as J}from"./Pagination-DQiV-zj0.js";import"./createReactComponent-BCs0QkHB.js";import"./createLucideIcon-CfQv_UkU.js";import"./get-base-value-piBLkQH9.js";import"./iconBase-pyOhvMbM.js";import"./use-resolved-styles-api-CXPONpb-.js";import"./Popover-DKx1jVhN.js";import"./use-uncontrolled-D8ZNLxiA.js";import"./create-event-handler-C3eq9ghx.js";import"./Text-Lf-8pjd1.js";import"./ActionIcon-DE5tZfxq.js";import"./IconX-DVGexw6V.js";import"./Stack-CjoU-_yh.js";import"./get-auto-contrast-value-Da6zqqWm.js";const j=20,ue=()=>{const[g,w]=a.useState([]),[E,I]=a.useState(!0),[u,L]=a.useState(""),[l,f]=a.useState(""),[c,N]=a.useState(""),[d,b]=a.useState(""),[i,y]=a.useState(null),[v,h]=a.useState(1),F=B();a.useEffect(()=>{(async()=>{try{const t=await z.get("/data-view?name=directory");w(t.data||[])}catch(t){console.error(t),L("Failed to fetch directory data.")}finally{I(!1)}})()},[]),a.useEffect(()=>{h(1)},[l,c,d,i]);const P=[...new Set(g.map(s=>s.division))],T=g.filter(s=>s.name.toLowerCase().includes(l.toLowerCase())&&s.email.toLowerCase().includes(c.toLowerCase())&&s.designation.toLowerCase().includes(d.toLowerCase())&&(!i||s.division===i)),S=Math.ceil(T.length/j),D=(v-1)*j,n=T.slice(D,D+j),A=()=>{f(""),N(""),b(""),y(null),h(1)};return e.jsxs(R,{page:"Directory",children:[e.jsx(G,{}),e.jsx(U,{size:"xl",className:"mb-10",children:E?e.jsx(o,{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"200px"},children:e.jsx(M,{size:"lg"})}):u?e.jsx(_,{icon:e.jsx(q,{size:"1rem"}),title:"Error",color:"red",children:u}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-5 gap-4 mb-10 mt-10",children:[e.jsx(p,{placeholder:"Search by Name",value:l,onChange:s=>f(s.target.value)}),e.jsx(p,{placeholder:"Search by Email",value:c,onChange:s=>N(s.target.value)}),e.jsx(p,{placeholder:"Search by Designation",value:d,onChange:s=>b(s.target.value)}),e.jsx(H,{placeholder:"Filter by Division",data:P,value:i,onChange:y,clearable:!0}),e.jsx(O,{variant:"light",onClick:A,className:"bg-primary-800 text-white",children:"Reset"})]}),e.jsx(o,{className:"hidden sm:block overflow-x-auto rounded-lg shadow-sm",children:e.jsxs(r,{striped:!0,highlightOnHover:!0,className:"min-w-[700px] border border-primary-100",children:[e.jsx(r.Thead,{children:e.jsxs(r.Tr,{style:{backgroundColor:k(F.colors.primary[7],.3)},className:"font-bold text-white",children:[e.jsx(r.Th,{children:"NAME"}),e.jsx(r.Th,{children:"DESIGNATION"}),e.jsx(r.Th,{children:"DIVISION"}),e.jsx(r.Th,{children:"OFFICE NUMBER"}),e.jsx(r.Th,{children:"E-MAIL ID"})]})}),e.jsx(r.Tbody,{children:n.length>0?n.map((s,t)=>e.jsxs(r.Tr,{children:[e.jsx(r.Td,{className:"font-semibold",children:s.name}),e.jsx(r.Td,{children:s.designation}),e.jsx(r.Td,{children:s.division}),e.jsx(r.Td,{className:"flex flex-wrap gap-1",children:s.officeNumber.map((m,x)=>e.jsx(C,{variant:"light",children:m},x))}),e.jsx(r.Td,{children:s.email})]},t)):e.jsx(r.Tr,{children:e.jsx(r.Td,{colSpan:5,className:"py-4 text-center text-gray-500",children:"No results found..."})})})]})}),e.jsx("div",{className:"sm:hidden space-y-4 mt-4",children:n.length>0?n.map((s,t)=>e.jsxs(o,{className:"border border-primary-100 rounded-lg p-4 shadow-sm bg-white",children:[e.jsxs("p",{children:[e.jsx("b",{children:"Name:"})," ",s.name]}),e.jsxs("p",{children:[e.jsx("b",{children:"Designation:"})," ",s.designation]}),e.jsxs("p",{children:[e.jsx("b",{children:"Division:"})," ",s.division]}),e.jsxs("p",{className:"flex flex-wrap gap-1",children:[e.jsx("b",{children:"Office Number:"}),s.officeNumber.map((m,x)=>e.jsx(C,{variant:"light",children:m},x))]}),e.jsxs("p",{children:[e.jsx("b",{children:"Email:"})," ",s.email]})]},t)):e.jsx("p",{className:"text-center text-gray-500",children:"No results found..."})}),S>1&&e.jsx(o,{className:"mt-8",children:e.jsx(V,{justify:"center",children:e.jsx(J,{total:S,value:v,onCh
1ange:h,size:"md",radius:"md"})})})]})})]})};export{ue as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.