import{m as k,n as A,f as B,r as L,t as w,j as e,v as z,w as H,P as S,F as I,B as K,I as g}from"./index-e6164346.js";import{c as h}from"./Grow-306e2fd0.js";import{S as N}from"./componentStyles-00385170.js";import{T as R}from"./TableContainer-7ecd96ea.js";import{T as U,a as W,b as E}from"./TableHead-0c525f54.js";import{b as D,a as x,T as u}from"./TableRow-bf4e60a0.js";import{T as O}from"./TablePagination-b02830fa.js";function $(n){return k("MuiTableFooter",n)}A("MuiTableFooter",["root"]);const q=n=>{const{classes:t}=n;return H({root:["root"]},$,t)},G=B("tfoot",{name:"MuiTableFooter",slot:"Root",overridesResolver:(n,t)=>t.root})({display:"table-footer-group"}),J={variant:"footer"},T="tfoot",Q=L.forwardRef(function(t,r){const a=w({props:t,name:"MuiTableFooter"}),{className:c,component:s=T,...p}=a,d={...a,component:s},i=q(d);return e.jsx(D.Provider,{value:J,children:e.jsx(G,{as:s,className:z(i.root,c),ref:r,role:s===T?null:"rowgroup",ownerState:d,...p})})}),V=Q,P=h(e.jsx("path",{d:"M18.41 16.59 13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z"}),"FirstPage"),C=h(e.jsx("path",{d:"M15.41 16.59 10.83 12l4.58-4.59L14 6l-6 6 6 6z"}),"KeyboardArrowLeft"),y=h(e.jsx("path",{d:"M8.59 16.59 13.17 12 8.59 7.41 10 6l6 6-6 6z"}),"KeyboardArrowRight"),F=h(e.jsx("path",{d:"M5.59 7.41 10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z"}),"LastPage");function X(n){const t=I(),{count:r,page:a,rowsPerPage:c,onPageChange:s}=n,p=l=>{s(l,0)},d=l=>{s(l,a-1)},i=l=>{s(l,a+1)},b=l=>{s(l,Math.max(0,Math.ceil(r/c)-1))};return e.jsxs(K,{sx:{flexShrink:0,ml:2.5},children:[e.jsx(g,{onClick:p,disabled:a===0,"aria-label":"first page",children:t.direction==="rtl"?e.jsx(F,{}):e.jsx(P,{})}),e.jsx(g,{onClick:d,disabled:a===0,"aria-label":"previous page",children:t.direction==="rtl"?e.jsx(y,{}):e.jsx(C,{})}),e.jsx(g,{onClick:i,disabled:a>=Math.ceil(r/c)-1,"aria-label":"next page",children:t.direction==="rtl"?e.jsx(C,{}):e.jsx(y,{})}),e.jsx(g,{onClick:b,disabled:a>=Math.ceil(r/c)-1,"aria-label":"last page",children:t.direction==="rtl"?e.jsx(P,{}):e.jsx(F,{})})]})}function se({showPagination:n,columns:t,rows:r,count:a,page:c,pageSize:s,loading:p=!1,rowsPerPageOptions:d=[10,20,50,100],onRowClick:i,handleChangePage:b,handleChangeRowsPerPage:l,handleSort:f}){return e.jsx(R,{component:S,sx:{maxHeight:600,overflow:"auto"},children:e.jsxs(U,{sx:{minWidth:500},"aria-label":"common pagination table",stickyHeader:!0,children:[e.jsx(W,{children:e.jsx(x,{sx:{backgroundColor:"#fafafa","& .MuiTableCell-root":{backgroundColor:"#fafafa"}},children:t.map((o,m)=>e.jsx(u,{align:o.align||"center",style:{minWidth:o.width||120},onClick:()=>o.sortable&&(f==null?void 0:f(o.field||"")),sx:{cursor:o.sortable?"pointer":"default",fontWeight:"bold",fontFamily:"Poppins",border:"1px solid #e0e0e0",textAlign:o.align||"center",padding:"16px 20px",fontSize:"1rem",height:"56px",lineHeight:"1.5rem",color:"#333"},children:o.title},m))})}),e.jsx(E,{children:p?e.jsx(x,{children:e.jsx(u,{colSpan:t.length,align:"center",sx:{fontFamily:"Poppins"},children:"Loading..."})}):r.length>0?r.map((o,m)=>e.jsx(x,{hover:!0,onClick:()=>i==null?void 0:i(o),sx:{cursor:i?"pointer":"default"},children:t.map((M,j)=>{const v=M.field||Object.keys(o)[j];return e.jsx(N,{align:"center",sx:{textAlign:"center !important",fontFamily:"Poppins",padding:"8px 12px",lineHeight:2.4,"& *":{textAlign:"center !important"}},children:o[v]},j)})},m)):e.jsx(x,{children:e.jsx(u,{colSpan:t.length,align:"center",sx:{fontFamily:"Poppins"},children:"No records found"})})}),n&&e.jsx(V,{children:e.jsx(x,{children:e.jsx(O,{rowsPerPageOptions:d,colSpan:t.length,count:a,rowsPerPage:s,page:c-1,onPageChange:b,onRowsPerPageChange:l,ActionsComponent:X,sx:{fontFamily:"Poppins","& .MuiTablePagination-toolbar":{justifyContent:"flex-end"},"& .MuiTablePagination-spacer":{display:"none"}}})})})]})})}export{se as C};
