import{cH as k,cG as L,f as A,r as B,cK as z,j as e,cL as H,cM as w,P as S,o as K,B as I,I as g}from"./index-c5c88b67.js";import{c as h}from"./Grow-7345f8ea.js";import{S as N}from"./componentStyles-a5e5a830.js";import{T as R}from"./TableContainer-c31f204a.js";import{T as U,a as W,b as E}from"./TableHead-c2c21491.js";import{b as D,a as x,T as u}from"./TableRow-2b359fa8.js";import{T as G}from"./TablePagination-0147f84a.js";function O(n){return k("MuiTableFooter",n)}L("MuiTableFooter",["root"]);const $=n=>{const{classes:t}=n;return w({root:["root"]},O,t)},q=A("tfoot",{name:"MuiTableFooter",slot:"Root",overridesResolver:(n,t)=>t.root})({display:"table-footer-group"}),J={variant:"footer"},T="tfoot",Q=B.forwardRef(function(t,r){const a=z({props:t,name:"MuiTableFooter"}),{className:c,component:s=T,...p}=a,d={...a,component:s},i=$(d);return e.jsx(D.Provider,{value:J,children:e.jsx(q,{as:s,className:H(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"),M=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=K(),{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(I,{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(M,{}):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(M,{})})]})}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((F,j)=>{const v=F.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(G,{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};
