import{P as x}from"./Page.b1f38576.js";import{n as C,r as t,Z as b,a0 as S,j as e,T as _,G as I,f as a,F as y,a4 as d,S as L,Y as T,a2 as j}from"./index.4524613b.js";import{T as k}from"./Table.b404960e.js";import{T as w}from"./TableMoreMenu.fbaa38aa.js";import{r as D,i as E,a as M}from"./jsx-runtime_commonjs-proxy.08daee49.js";import{d as q}from"./VisibilityOutlined.7d63b3a6.js";import{H as P}from"./HeaderBreadcrumbs.f593a2a7.js";import{G as p}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";var s={},R=E.exports;Object.defineProperty(s,"__esModule",{value:!0});var m=s.default=void 0,$=R(D()),A=M,G=(0,$.default)((0,A.jsx)("path",{d:"m14.06 9.02.92.92L5.92 19H5v-.92l9.06-9.06M17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29zm-3.6 3.19L3 17.25V21h3.75L17.81 9.94l-3.75-3.75z"}),"EditOutlined");m=s.default=G;function H(){const r=C(),{corporateValue:n}=t.exports.useContext(b),l=new AbortController,[u,f]=t.exports.useState([]),[g,o]=t.exports.useState(!0),h={isLoading:g,setIsLoading:o},v=[{id:"code",align:"left",label:"Code",isSort:!1},{id:"name",align:"left",label:"Name",isSort:!1},{id:"active",align:"center",label:"Status",isSort:!1},{id:"action",align:"center",label:"",isSort:!1}];return t.exports.useEffect(()=>{(async()=>{try{o(!0);const[i]=await Promise.all([S.get(`${n}/corporate`,{signal:l.signal})]);f(i.data.data.map(c=>({...c,active:c.active===1?e(_,{variant:"overline",sx:{backgroundColor:"rgba(84, 214, 44, 0.16)",color:"#229A16",paddingX:1.5,paddingY:1,display:"inline-flex",alignItems:"center",borderRadius:"10px"},children:"Active"}):e(I,{variant:"outlined",color:"error",children:"Inactive"}),action:e(w,{actions:a(y,{children:[a(d,{onClick:()=>r("/corporate/edit"),children:[e(m,{}),"Edit"]}),a(d,{onClick:()=>r("/corporate/view"),children:[e(q,{}),"View"]})]})})}))),o(!1)}catch(i){console.error("Error fetching data:",i.message)}return()=>{l.abort()}})()},[n]),e(L,{children:e(k,{headCells:v,rows:u,loadings:h})})}function ie(){const{themeStretch:r}=T();return e(x,{title:"Corporate",children:a(j,{maxWidth:r?!1:"xl",children:[e(P,{heading:"Corporate",links:[{name:"Dashboard",href:"/dashboard"},{name:"Corporates",href:"/corporates"}]}),e(p,{container:!0,children:e(p,{item:!0,xs:12,lg:12,md:12,children:e(H,{})})})]})})}export{ie as default};
