import{P as H}from"./Page.b1f38576.js";import{n as V,r,Z as $,$ as U,a0 as y,j as e,T as _,F as W,f as E,a4 as Y,S as Z,Y as q,a2 as z}from"./index.4524613b.js";import{T as J}from"./Table.b404960e.js";import{f as P}from"./formatTime.0646b9d0.js";import{T as K}from"./TableMoreMenu.fbaa38aa.js";import{d as Q}from"./VisibilityOutlined.7d63b3a6.js";import{L as i}from"./Label.c0ab61c4.js";import{H as X}from"./HeaderBreadcrumbs.f593a2a7.js";import{G as D}from"./Grid.63392dc1.js";import"./Box.522fc68e.js";import"./TablePagination.a2995130.js";import"./KeyboardArrowRight.dfbe216b.js";import"./LastPage.928f2cf3.js";import"./TableRow.184bd340.js";import"./useId.5c752e65.js";import"./TextField.489cf1ea.js";import"./InputAdornment.c3b5c49a.js";import"./Search.a632f4d1.js";import"./TableContainer.e4a601db.js";import"./TableHead.2295a13e.js";import"./index.49ea62c1.js";import"./jsx-runtime_commonjs-proxy.08daee49.js";function j(){const c=V(),{corporateValue:l}=r.exports.useContext($),[T,I]=r.exports.useState([]),[C,m]=r.exports.useState(!0),w={isLoading:C,setIsLoading:m},[s,d]=U(),[n,p]=r.exports.useState({}),k={searchParams:s,setSearchParams:d,appliedParams:n,setAppliedParams:p},[u,v]=r.exports.useState("asc"),[f,N]=r.exports.useState("fullName"),O={order:u,setOrder:v,orderBy:f,setOrderBy:N},[L,g]=r.exports.useState(0),[M,S]=r.exports.useState(10),[x,b]=r.exports.useState({current_page:0,from:0,last_page:0,links:[],path:"",per_page:0,to:0,total:0}),B={page:L,setPage:g,rowsPerPage:M,setRowsPerPage:S,paginationTable:x,setPaginationTable:b},[h,R]=r.exports.useState(""),A={useSearchs:!0,searchText:h,setSearchText:R,handleSearchSubmit:async o=>{if(o.preventDefault(),h===""){s.delete("search");const a=Object.fromEntries([...s.entries()]);p(a)}else{const a=Object.fromEntries([...s.entries(),["search",h]]);p(a)}}},F={useExport:!0,startDate:"",endDate:"",status:"all",handleExportReport:async()=>{y.get(l+"/export-members/list").then(o=>{const a=document.createElement("a");a.href=o.data.data.file_url,a.setAttribute("download",o.data.data.file_name),document.body.appendChild(a),a.click()})}},G=[{id:"memberId",align:"left",label:"Member ID",isSort:!0},{id:"fullName",align:"left",label:"Name",isSort:!0},{id:"start_date",align:"center",label:"Start Date",isSort:!0},{id:"end_date",align:"center",label:"End Date",isSort:!0},{id:"status",align:"center",label:"Status",isSort:!0},{id:"action",align:"center",label:"",isSort:!0}];return r.exports.useEffect(()=>{(async()=>{m(!0),await new Promise(t=>setTimeout(t,250));const o=Object.keys(n).length!==0?n:Object.fromEntries([...s.entries(),["order",u],["orderBy",f]]),a=await y.get(`${l}/members?type=employee-data`,{params:{...o}});if(d(o),I(a.data.data.map(t=>({...t,status:t.status===1?e(i,{color:"success",children:"Active"}):e(i,{color:"error",children:"Inactive"}),start_date:e(i,{children:t.start_date?P(t.start_date):""}),end_date:e(i,{children:t.end_date?P(t.end_date):""}),fullName:e(_,{variant:"body2",children:t.fullName}),memberId:e(_,{variant:"body2",children:t.memberId}),action:e(K,{actions:e(W,{children:E(Y,{onClick:()=>c("/employee-data/user-profile/"+t.personId),children:[e(Q,{}),"View"]})})})}))),b(a.data),S(a.data.per_page),s.get("page")){const t=parseInt(s.get("page"))-1;x.current_page=t,g(t)}m(!1)})()},[n,s,u,f,d,l]),e(Z,{children:e(J,{headCells:G,rows:T,orders:O,paginations:B,loadings:w,params:k,searchs:A,exportReport:F})})}function Ee(){const{themeStretch:c}=q();return e(H,{title:"Employee Data",children:E(z,{maxWidth:c?!1:"xl",children:[e(X,{heading:"Employee Data",links:[{name:"Case Management"},{name:"Employee Data",href:"/employee-data"}]}),e(D,{container:!0,children:e(D,{item:!0,xs:12,lg:12,md:12,children:e(j,{})})})]})})}export{Ee as default};
