1import{r as n,j as t,Q as D,S as M,at as N,U as w,d$ as J,aN as F,V as L,ar as f,aU as K,aV as Z,ai as ee,d as te,al as ae,cS as ne,b9 as le,av as se,aw as y,dG as re,m as ie,bb as oe,au as de,bc as ce,dV as ue,dW as fe,dX as he,d_ as ge,e0 as me}from"./index-c3583149.js";import{h as W}from"./moment-a9aaa855.js";import{g as pe}from"./ProviderSearchAction-6e5cd577.js";import{d as xe}from"./index-e010460b.js";const ve=l=>{const[i,p]=n.useState(""),[s,h]=n.useState([]),[d,c]=n.useState(null);n.useEffect(()=>{l.open&&c(null)},[l.open]);const g=async o=>{const r=await pe(o,"");h(r.data)},m=n.useCallback(xe(g,300),[]);return n.useEffect(()=>{i?m(i):h([])},[i,m]),t.jsxs(D,{open:l.open,onClose:l.handleClose,fullWidth:!0,maxWidth:"xs",style:{textAlign:"center",fontFamily:"Montserrat",margin:"16px",borderRadius:"8px"},children:[t.jsx(M,{id:"alert-dialog-title",style:{backgroundColor:"#fafafb"},children:t.jsxs("div",{style:{fontFamily:"Montserrat",fontSize:"22px",fontWeight:"bold",fontStretch:"normal",fontStyle:"normal",lineHeight:1.71,letterSpacing:"0.1px",textAlign:"left",color:"#92929d"},children:[l.title,"?"]})}),t.jsx(N,{}),t.jsx(w,{children:"Are you sure you want to convert this general user to a provider user? Search for the organization to connect the user to below."}),t.jsx(J,{freeSolo:!0,style:{margin:"5px"},options:s,onChange:(o,r)=>{const x=r?r._id:null;c(x),l.onSelectedOrgIdChange&&l.onSelectedOrgIdChange(x)},getOptionLabel:o=>o.name,onInputChange:(o,r)=>{p(r)},renderInput:o=>t.jsx(F,{...o,label:"Type org to search...",variant:"outlined"})}),t.jsxs(L,{children:[t.jsx(f,{varient:"outlined",onclick:l.handleClose,name:"Cancel",size:"large",fullWidth:!0}),t.jsx(f,{varient:"contained",onclick:l.handleConvert,styled:{backgroundColor:"red"},name:"Convert",size:"large",fullWidth:!0,disabled:!d})]})]})},be=({open:l,handleClose:i,handleSave:p,initialValues:s})=>{const[h,d]=n.useState(!1),[c,g]=n.useState("");n.useEffect(()=>{d(s.potentialProvider||!1),g(s.newOrgWebsiteUrl||"")},[s]);const m=r=>{d(r.target.checked)},o=()=>{const r={...s,potentialProvider:h,newOrgWebsiteUrl:c};p(r)};return t.jsxs(D,{open:l,onClose:i,fullWidth:!0,maxWidth:"xs",style:{textAlign:"center",fontFamily:"Montserrat",margin:"16px",borderRadius:"8px"},children:[t.jsx(M,{id:"alert-dialog-title",style:{backgroundColor:"#fafafb"},children:t.jsx("div",{style:{fontFamily:"Montserrat",fontSize:"22px",fontWeight:"bold",fontStretch:"normal",fontStyle:"normal",lineHeight:1.71,letterSpacing:"0.1px",textAlign:"left",color:"#92929d"},children:"Edit User"})}),t.jsx(N,{}),t.jsxs(w,{children:[t.jsx(F,{label:"Organization Website URL",type:"text",fullWidth:!0,variant:"outlined",value:c,onChange:r=>g(r.target.value),style:{marginTop:"20px"}}),t.jsx(K,{control:t.jsx(Z,{checked:h,onChange:m}),label:"Potential Provider"})]}),t.jsxs(L,{children:[t.jsx(f,{varient:"outlined",onclick:i,name:"Cancel",size:"large",fullWidth:!0}),t.jsx(f,{varient:"contained",onclick:o,name:"Update User",size:"large",fullWidth:!0,styled:{backgroundColor:"red",color:"white"}})]})]})},I=new de,Ce=ee(l=>({aboutContainer:{paddingTop:"8em",width:"90%",textAlign:"center",margin:"auto",paddingBottom:"10em",[l.breakpoints.down("md")]:{width:"95%"}},sortContainer:{display:"flex",gap:"10px",background:"white",padding:"10px",borderRadius:"8px"},sortLabel:{fontSize:"14px",color:"#696974",paddingTop:"10px",paddingRight:"10px"},dataGrid:{"& .MuiDataGrid-cell":{fontSize:"13px"},"& .MuiDataGrid-columnHeaderTitle":{fontWeight:"normal",fontSize:"13px"}},pagination:{"& .MuiTablePagination-selectLabel, & .MuiTablePagination-select":{fontSize:"13px"},"& .MuiTablePagination-displayedRows":{fontSize:"13px"}}})),ze=l=>{const i=Ce(),[p,s]=n.useState(!0),[h,d]=n.useState([]),[c,g]=n.useState([]),[m,o]=n.useState("de"),[r,x]=n.useState(""),[P,C]=n.useState(!1),[T,S]=n.useState(!1),[E,j]=n.useState(!1),[G,O]=n.useState(""),[A,z]=n.useState(null),[R,k]=n.useState({}),_=te(),v=ae({setTitle:ce,getFrezeList:ue,deleteFrezeList:fe,updateFrezeList:he,convertUser:ge},_),b=async()=>{s(!0),o("de"),I.createToken();const e=await v.getFrezeList("user",I.getToken());e&&e.length?(d(()=>e),g(()=>e)):(d(()=>[]),g(()=>[])),s(!1)};n.useEffect(()=>(v.setTitle({title:l.title}),b(),()=>I.cancelTheApi()),[]);const Y=e=>{x(()=>e),C(()=>!0)},U=async(e,a,u)=>{C(!1),s(!0),a?(e&&await v.deleteFrezeList("user",e),x("")):await v.updateFrezeList({id:e,status:u,type:"user"}),await b(),s(!1)},B=e=>{if(e!=="de"){const a=[];
1switch(e){case 0:{c.forEach(u=>{u.freeze&&a.push(u)});break}case 1:{c.forEach(u=>{u.freeze||a.push(u)});break}}d(()=>a)}else d(()=>c);o(e)},H=e=>{O(()=>e),S(()=>!0)},V=async e=>{if(S(!1),s(!0),e){const a=await v.convertUser({_id:e,role:"provider",organizationId:A});O(""),z(""),a?(console.log("User Converted: ",e),await b()):console.log("Error Converting User: ",e)}s(!1)},Q=e=>{z(e)},X=e=>{k(e),j(!0)},$=async({_id:e,potentialProvider:a,newOrgWebsiteUrl:u})=>{s(!0),j(!1),await me({id:e,potentialProvider:a,newOrgWebsiteUrl:u})&&b(),s(!1)},q=[{field:"firstName",headerName:"First Name",flex:1,minWidth:120},{field:"lastName",headerName:"Last Name",flex:1,minWidth:120},{field:"email",headerName:"Email",flex:1,minWidth:120},{field:"potentialProvider",headerName:"Potential Provider",flex:1,minWidth:50,renderCell:e=>e.value?"Yes":"No"},{field:"newOrgWebsiteUrl",headerName:"Organization Website",flex:1,minWidth:150,renderCell:e=>t.jsx("p",{children:e.value})},{headerName:"Phone",minWidth:100,flex:1,field:"profileId1",valueGetter:({row:e})=>{let a="-";return e.profileId&&e.profileId.contact&&(a=e.profileId.contact),a}},{headerName:"Date Of Birth",minWidth:120,field:"profileId2",valueGetter:({row:e})=>{let a="-";return e.profileId&&e.profileId.dob&&(a=W(e.profileId.dob).format("MMM, DD yyyy")),a}},{headerName:"Gender",field:"profileId3",minWidth:100,valueGetter:({row:e})=>{let a="-";return e.profileId&&e.profileId.gender&&(a=e.profileId.gender),a}},{headerName:"Last login date",minWidth:120,field:"lastLogin",valueGetter:({row:e})=>{let a="-";return e.lastLogin&&(a=W(e.lastLogin).format("YYYY-MM-DD")),a}},{field:"action",headerName:"Action",sortable:!1,filterable:!1,minWidth:335,flex:1,renderCell:({row:e})=>t.jsxs("div",{style:{display:"flex",gap:"10px"},children:[t.jsx(f,{name:"Delete",styled:{backgroundColor:"red"},varient:"contained",onclick:()=>Y(e._id)}),t.jsx(f,{name:e.freeze?"Unfreeze":"Freeze",styled:{backgroundColor:"var(--clr-complimentary)"},varient:"contained",onclick:()=>U(e._id,!1,!e.freeze)}),t.jsx(f,{name:"Convert",styled:{backgroundColor:"var(--clr-accent)"},varient:"contained",onclick:()=>H(e._id)}),t.jsx(f,{name:"Edit",styled:{backgroundColor:"var(--clr-primary)"},varient:"contained",onclick:()=>X(e)})]})}];return t.jsxs("div",{children:[t.jsx(ne,{children:"General Users"}),t.jsxs("div",{className:i.aboutContainer,children:[t.jsx(le,{direction:"row",justifyContent:"space-between",style:{marginBottom:"20px"},children:t.jsxs("div",{className:i.sortContainer,children:[t.jsx("div",{className:i.sortLabel,children:"View:"}),t.jsxs(se,{labelId:"demo-simple-select-helper-label",id:"demo-simple-select-helper",value:m,size:"small",variant:"standard",onChange:e=>B(e.target.value),children:[t.jsx(y,{value:"de",children:t.jsx("em",{children:"All"})}),t.jsx(y,{value:0,children:"Freeze"}),t.jsx(y,{value:1,children:"Unfreeze"})]})]})}),t.jsx("div",{style:{height:550,overflow:"auto",width:"100%"},children:t.jsx(re,{getRowId:e=>e._id,rows:h||[],disableExtendRowFullWidth:!1,columns:q,disableSelectionOnClick:!0,loading:p,rowsPerPageOptions:[...ie.pageSlot],className:i.dataGrid,componentsProps:{pagination:{className:i.pagination}}})}),t.jsx(oe,{open:P,title:"General User",handleClose:()=>C(!1),handleDelete:()=>U(r,!0,"")}),t.jsx(ve,{open:T,title:"Convert User",handleClose:()=>S(!1),handleConvert:()=>V(G),onSelectedOrgIdChange:Q}),t.jsx(be,{open:E,handleClose:()=>{j(!1),k({})},initialValues:R,handleSave:$})]})]})};export{ze as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.