import{n as A,r as t,Z as E,au as F,$ as V,a0 as N,f as r,j as a,F as R,a4 as U,S as w,T as Z}from"./index.4524613b.js";import{T as q}from"./Table.b404960e.js";import{d as z}from"./ArrowBackIos.720b1306.js";import{f as T}from"./formatTime.0646b9d0.js";import{T as H}from"./TableMoreMenu.fbaa38aa.js";import{d as J}from"./VisibilityOutlined.7d63b3a6.js";import{L as n}from"./Label.c0ab61c4.js";import{G as m}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"./jsx-runtime_commonjs-proxy.08daee49.js";import"./index.49ea62c1.js";function fe(){const g=A(),{corporateValue:u}=t.exports.useContext(E),[f,y]=t.exports.useState({full_name:"",paginations:[]}),{id:b}=F(),[C,c]=t.exports.useState(!0),D={isLoading:C,setIsLoading:c},[s,p]=V(),[i,v]=t.exports.useState({}),k={searchParams:s,setSearchParams:p,appliedParams:i,setAppliedParams:v},[d,I]=t.exports.useState("asc"),[l,L]=t.exports.useState("admission_date"),O={order:d,setOrder:I,orderBy:l,setOrderBy:L},[$,h]=t.exports.useState(0),[B,x]=t.exports.useState(10),[S,_]=t.exports.useState({current_page:0,from:0,last_page:0,links:[],path:"",per_page:0,to:0,total:0}),G={page:$,setPage:h,rowsPerPage:B,setRowsPerPage:x,paginationTable:S,setPaginationTable:_},M=[{id:"admission_date",align:"center",label:"Admission Date",isSort:!0},{id:"discharge_date",align:"center",label:"Discharge Date",isSort:!0},{id:"code",align:"left",label:"Code",isSort:!0},{id:"service_type",align:"center",label:"Service Type",isSort:!1},{id:"status",align:"center",label:"Status",isSort:!1},{id:"action",align:"center",label:"",isSort:!1}];return t.exports.useEffect(()=>{(async()=>{c(!0),await new Promise(e=>setTimeout(e,250));const P=Object.keys(i).length!==0?i:Object.fromEntries([...s.entries(),["order",d],["orderBy",l]]),o=await N.get(`${u}/alarm-center-members/${b}`,{params:{...P}});if(p(P),y({full_name:o.data.full_name,paginations:o.data.paginations.data.map(e=>({...e,admission_date:e.admission_date?r(n,{children:[" ",T(e.admission_date)," "]}):"",discharge_date:e.discharge_date?r(n,{children:[" ",T(e.discharge_date)," "]}):"",status:e.status==="Done"?a(n,{color:"success",children:"Done"}):a(n,{color:"warning",children:"Ongoing"}),action:a(H,{actions:a(R,{children:r(U,{onClick:()=>g("service-monitoring/"+e.id),children:[a(J,{}),"View"]})})})}))}),_(o.data.paginations),x(o.data.paginations.per_page),s.get("page")){const e=parseInt(s.get("page"))-1;S.current_page=e,h(e)}c(!1)})()},[i,s,d,l,p,u]),r(m,{container:!0,spacing:8,padding:3,children:[a(m,{item:!0,xs:12,children:r(w,{direction:"row",alignItems:"center",gap:3,children:[a(z,{onClick:()=>g("/alarm-center"),sx:{cursor:"pointer"}}),a(Z,{variant:"h5",sx:{flexGrow:1},children:f.full_name})]})}),a(m,{item:!0,xs:12,children:a(w,{children:a(q,{headCells:M,rows:f.paginations,orders:O,paginations:G,loadings:D,params:k})})})]})}export{fe as default};
