2 lines
4.0 KiB
JavaScript
2 lines
4.0 KiB
JavaScript
import{o as G,r as a,$ as V,a2 as X,a0 as Y,j as e,H as x,t as v,Z as m,S as H,a1 as U,a3 as Z,f as F,B as D,s as O}from"./index.52c19e01.js";import{P as q}from"./Page.2d2aae4a.js";import{T as z}from"./Table.4e5e7a7b.js";import{G as I}from"./Grid.35ade0df.js";import{C as J}from"./Card.6cad65b0.js";import{T as K,a as Q}from"./Tabs.8cb1735e.js";import"./Box.bdfd146f.js";import"./TablePagination.9f676df5.js";import"./TableRow.2979bcea.js";import"./KeyboardArrowRight.45cdeaba.js";import"./TextField.ca0ae25e.js";function ee(){const t=G(),{corporateValue:o}=a.exports.useContext(V),[l,n]=a.exports.useState([]),[d,c]=a.exports.useState(!0),w={isLoading:d,setIsLoading:c},[s,y]=X(),[p,u]=a.exports.useState({}),_={searchParams:s,setSearchParams:y,appliedParams:p,setAppliedParams:u},[g,E]=a.exports.useState("asc"),[b,$]=a.exports.useState("fullName"),j={order:g,setOrder:E,orderBy:b,setOrderBy:$},[M,P]=a.exports.useState(0),[N,T]=a.exports.useState(10),[k,B]=a.exports.useState({current_page:0,from:0,last_page:0,links:[],path:"",per_page:0,to:0,total:0}),A={page:M,setPage:P,rowsPerPage:N,setRowsPerPage:T,paginationTable:k,setPaginationTable:B},[h,L]=a.exports.useState(""),R={searchText:h,setSearchText:L,handleSearchSubmit:async f=>{if(f.preventDefault(),h===""){s.delete("search");const i=Object.fromEntries([...s.entries()]);u(i)}else{const i=Object.fromEntries([...s.entries(),["search",h]]);u(i)}}},W=[{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:!1},{id:"status",align:"center",label:"Status",isSort:!0}];return a.exports.useEffect(()=>{(async()=>{c(!0),await new Promise(r=>setTimeout(r,250));const f=Object.keys(p).length!==0?p:Object.fromEntries([...s.entries(),["order",g],["orderBy",b]]),i=await Y.get(`${o}/members?type=alarm-center`,{params:{...f}});if(n(i.data.data.map(r=>({...r,memberId:e(x,{onClick:()=>t("/user-profile/"+r.personId),children:r.memberId}),status:r.status===1?e(x,{onClick:()=>t("service-monitoring/"+r.personId),startIcon:e(v,{icon:"ic:round-check"}),sx:{backgroundColor:m.light.grey[300],color:m.light.grey[800],paddingX:1.5,paddingY:1,"&:hover":{backgroundColor:m.light.grey[400],color:m.light.grey[800]}},children:"done"}):e(x,{startIcon:e(v,{icon:"fa6-solid:clock"}),sx:{backgroundColor:"#CD7B2E",color:"#FFFF",paddingX:1.5,paddingY:1,"&:hover":{backgroundColor:"#BF6919",color:"#FFFF"}},children:"Ongoing"})}))),B(i.data),T(i.data.per_page),s.get("page")){const r=parseInt(s.get("page"))-1;k.current_page=r,P(r)}c(!1)})()},[p,s,g,b,y,o]),e(H,{children:e(z,{headCells:W,rows:l,orders:j,paginations:A,loadings:w,params:_,searchs:R})})}function te(t){const{children:o,value:l,index:n,...d}=t;return e("div",{role:"tabpanel",hidden:l!==n,id:`simple-tabpanel-${n}`,"aria-labelledby":`simple-tab-${n}`,...d,children:l===n&&e(D,{children:o})})}function S(t){return{id:`simple-tab-${t}`,"aria-controls":`simple-tabpanel-${t}`}}const ae=O(t=>e(K,{...t}))({backgroundColor:"#F4F6F8",padding:"0 24px","& .MuiTabs-indicator":{display:"flex",justifyContent:"space-between",backgroundColor:"transparent"},"& .MuiTabs-indicatorSpan":{maxWidth:40,backgroundColor:"#635ee7"}}),C=O(t=>e(Q,{disableRipple:!0,...t}))(({theme:t})=>({textTransform:"none",fontWeight:600,color:t.palette.grey[600],marginRight:"5rem","&.Mui-selected":{color:"#212B36",borderBottom:"2px solid "+t.palette.primary.main},"&:hover":{color:"#212B36",opacity:1,borderBottom:"2px solid "+t.palette.primary.main}}));function be(){const{themeStretch:t}=U(),[o,l]=a.exports.useState(0);return e(q,{title:"Alarm Center",children:e(Z,{maxWidth:t?!1:"xl",children:e(I,{container:!0,children:e(I,{item:!0,xs:12,lg:12,md:12,children:F(J,{children:[e(D,{sx:{borderBottom:1,borderColor:"divider"},children:F(ae,{value:o,onChange:(d,c)=>{l(c)},"aria-label":"basic tabs example",children:[e(C,{label:"All Data",...S(0)}),e(C,{label:"Ongoing",...S(1)}),e(C,{label:"Done",...S(2)})]})}),e(te,{value:o,index:0,children:e(ee,{})})]})})})})})}export{be as default};
|