1import{a as A,e as R,r as i,a1 as z,bW as B,bX as l,w as e,ai as I,al as Q,ak as q,B as F}from"./index-8acdbf7a.js";const K=({handleEdit:b})=>{const r=A(),{circuitNameList:o}=R(t=>t.circuitMaster),[a,d]=i.useState(1),[g,f]=i.useState(""),{isLoading:S,data:s,refetch:C}=z(""),[N,{isLoading:y,data:n,error:v}]=B(),h=10,u=a*h,x=u-h,m=o==null?void 0:o.slice(x,u),j=Math.ceil(o.length/h),[M,p]=i.useState(!1);i.useEffect(()=>{s&&r(l(s))},[S,s]),i.useEffect(()=>{n&&(p(!0),f((n==null?void 0:n.message)??""),C(),r(l(s)))},[y,n,v]);const E=async t=>{confirm("Are you sure!")===!0&&N(t.id)},P=()=>{a>1&&d(a-1)},w=()=>{a<j&&d(a+1)},D=t=>{d(t)},L=t=>{if(t.target.value=="")r(l(s));else{const c=s.filter(k=>k.name.toLowerCase().includes(t.target.value.toLowerCase()));d(1),c.length>0?r(l(c)):r(l(s))}};return e.jsxs("div",{className:"col-xl-8",children:[e.jsxs("div",{className:"card card-body border-primary",children:[e.jsx("div",{className:"form-group mb-3",children:e.jsx("input",{type:"text",className:"form-control",placeholder:"Search",onKeyUp:L})}),e.jsx("div",{className:"table-responsive",children:e.jsxs("table",{className:"table table-striped table-hover table-bordered table-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"S.No."}),e.jsx("th",{children:"Circuit Name"}),e.jsx("th",{children:"Action"})]})}),e.jsx("tbody",{children:m.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:3,className:"text-center",children:"No Records Found!"})}):m.map((t,c)=>e.jsxs("tr",{children:[e.jsx("td",{children:x+c+1}),e.jsx("td",{children:t.name}),e.jsx("td",{children:e.jsxs("div",{className:"hstack",children:[e.jsx("button",{type:"button",title:"Edit",className:"btn text-primary btn-sm",onClick:()=>b(t),children:e.jsx(I,{})}),e.jsx("button",{type:"button",title:"Deactivate",className:"btn text-danger btn-sm",onClick:()=>E(t),children:e.jsx(Q,{})})]})})]},c.toString()))})]})}),e.jsx(q,{currentState:a,handlePrev:P,handleNext:w,totalPost:j,handlePages:D,pageSize:h,siblingCount:1})]}),M&&e.jsx(F,{setShowModal:p,modalMsg:g})]})};export{K 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.