1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5295],{11401:function(e,n,i){(window.__NEXT_P=window.__NEXT_P||[]).push(["/dashboard/users/list",function(){return i(52532)}])},29404:function(e,n,i){"use strict";i.d(n,{Z:function(){return p}});var t=i(85893),o=i(45697),s=i.n(o),a=i(80822),r=i(26447),l=i(15861),d=i(23795),c=i(12963),h=i(41664),u=i.n(h);function m(e){let{link:n,activeLast:i,disabled:o}=e;const{name:s,href:r,icon:l}=n,c={typography:"body2",alignItems:"center",color:"text.primary",display:"inline-flex",...o&&!i&&{cursor:"default",pointerEvents:"none",color:"text.disabled"}},h=(0,t.jsxs)(t.Fragment,{children:[l&&(0,t.jsx)(a.Z,{component:"span",sx:{mr:1,display:"inherit","& svg":{width:20,height:20}},children:l}),s]});return r?(0,t.jsx)(d.Z,{component:u(),href:r,sx:c,children:h}):(0,t.jsxs)(a.Z,{sx:c,children:[" ",h," "]})}function p(e){let{links:n,action:i,heading:o,subheading:s,moreLink:h,activeLast:u,sx:p,...v}=e;const g=n[n.length-1].name;return(0,t.jsxs)(a.Z,{sx:{mb:5,...p},children:[(0,t.jsxs)(r.Z,{direction:"row",alignItems:"center",children:[(0,t.jsxs)(a.Z,{sx:{flexGrow:1},children:[o&&(0,t.jsx)(l.Z,{variant:"h4",gutterBottom:!0,children:o}),s&&s.name&&s.path&&(0,t.jsx)(l.Z,{component:d.Z,href:s.path,variant:"p",gutterBottom:!0,sx:{cursor:"pointer"},children:s.name}),!!n.length&&(0,t.jsx)(c.Z,{separator:(0,t.jsx)(x,{}),...v,children:n.map((e=>(0,t.jsx)(m,{link:e,activeLast:u,disabled:e.name===g},e.name||"")))})]}),i&&(0,t.jsxs)(a.Z,{sx:{flexShrink:0},children:[" ",i," "]})]}),!!h&&(0,t.jsx)(a.Z,{sx:{mt:2},children:h.map((e=>(0,t.jsx)(d.Z,{noWrap:!0,href:e,variant:"body2",target:"_blank",rel:"noopener",sx:{display:"table"},children:e},e)))})]})}function x(){return(0,t.jsx)(a.Z,{component:"span",sx:{width:4,height:4,borderRadius:"50%",bgcolor:"text.disabled"}})}m.propTypes={activeLast:s().bool,disabled:s().bool,link:s().shape({href:s().string,icon:s().node,name:s().string})},p.propTypes={sx:s().object,action:s().node,links:s().array,heading:s().string,subheading:s().object,moreLink:s().array,activeLast:s().bool}},52532:function(e,n,i){"use strict";i.r(n),i.d(n,{default:function(){return D}});var t=i(85893),o=i(9008),s=i.n(o),a=i(67294),r=i(46574),l=i(66242),d=i(25662),c=i(34386),h=i(93946),u=i(72882),m=i(7906),p=i(295),x=i(50135),v=i(36100),g=i(88085),f=i(31812),y=i(98887),j=i(77004),b=i(67537),Z=i(16414),C=i(55301),w=i(3135),R=i(97881),I=i(74835),S=i(29404),L=i(55566),P=i(53396),k=i(51742),_=i(63516),E=i(80435),N=i(35237),A=i(22833),O=i(72662);const U=[{id:"name",label:"Name",align:"left"},{id:"email",label:"Email Address",align:"left"},{id:"phone",label:"Phone Contact",align:"left"},{id:"createdAt",label:"Created at",align:"left"},{id:"companyRole",label:"Company Role",align:"left"},{id:""}];function D(){var e,n;const{dense:i,page:o,order:I,orderBy:D,rowsPerPage:W,selected:T,onSelectRow:z,onSelectAllRows:G,onSort:K,onChangeDense:M,onChangePage:$,onChangeRowsPerPage:F}=(0,C.x6)({defaultOrderBy:"companyRole",defaultOrder:"desc"}),{user:J,companyUsers:Q,isCompanyUsersLoading:V,isCompanyLoading:X,selectedCompany:H}=(0,A.v9)((e=>e.user)),[q,Y]=(0,a.useState)(""),{themeStretch:ee}=(0,L.K$)(),[ne,ie]=(0,a.useState)(!1),[te,oe]=(0,a.useState)(!1),se=B({inputData:Q||[],comparator:(0,C.sQ)(I,D),filterName:"",filterStatus:[]});(0,a.useEffect)((()=>{V||X||(0,A.WI)((0,N.uG)())}),[null===H||void 0===H||null===(e=H.companyInfo)||void 0===e?void 0:e.users]);const ae=i?60:80,re=(se.length,!V&&!X&&!se.length),le=()=>{oe(!1)},de=async(e,n,i)=>{var t;const o=(null===H||void 0===H||null===(t=H.companyInfo)||void 0===t?void 0:t.users)||[],s=o.find((n=>n.userRef.id===e)),a=o.filter((n=>n.userRef.id!==e)),r={...s};r.companyRole=i,(0,v.r7)((0,v.JU)(w.DB,P.P.COMPANIES,n),{users:[...a,r]}),(0,A.WI)((0,N.uG)({users:[...a,r]},!0))};return(0,t.jsxs)("div",{children:[(0,t.jsx)(s(),{children:(0,t.jsx)("title",{children:" Users List | PrivacyLabs"})}),(0,t.jsxs)(_.Z,{hasContent:!0,roles:[k.pR["SUPER-ADMIN"],k.pR.CLIENT,k.pR.PROVIDER],children:[(0,t.jsxs)(r.Z,{maxWidth:!ee&&"lg",children:[(0,t.jsx)(S.Z,{heading:"Users List",links:[{name:"Dashboard",href:R.vB.root},{name:"Users",href:R.vB.users.root},{name:"List"}]}),(0,t.jsxs)(l.Z,{children:[(0,t.jsxs)(g.Z,{direction:"row",m:1,justifyContent:"space-between",children:[(0,t.jsx)("div",{children:(null===H||void 0===H||null===(n=H.companyInfo)||void 0===n?void 0:n.admin.id)===(null===J||void 0===J?void 0:J.uid)&&(0,t.jsx)(d.Z,{onClick:()=>{oe(!0)},startIcon:(0,t.jsx)(E.Z,{icon:"mdi:invite"}),children:"Invite Collaborator"})}),(0,t.jsx)(c.Z,{title:"Refresh List",children:(0,t.jsx)(h.Z,{"aria-label":"refresh",onClick:()=>(0,A.WI)((0,N.ht)(H.companyRef)),children:(0,t.jsx)(E.Z,{icon:"material-symbols:refresh"})})})]}),(0,t.jsxs)(u.Z,{sx:{position:"relative",overflow:"unset"}
1,children:[(0,t.jsx)(C.Z4,{dense:i,numSelected:T.length,rowCount:Q.length,onSelectAllRows:e=>G(e,null===Q||void 0===Q?void 0:Q.map((e=>e.id)))}),(0,t.jsx)(Z.Z,{children:(0,t.jsxs)(m.Z,{size:i?"small":"medium",sx:{minWidth:960},children:[(0,t.jsx)(C.K,{order:I,orderBy:D,headLabel:U,rowCount:null===Q||void 0===Q?void 0:Q.length,numSelected:T.length,onSort:K,onSelectAllRows:e=>G(e,null===Q||void 0===Q?void 0:Q.map((e=>e.id)))}),(0,t.jsxs)(p.Z,{children:[(V||X?[...Array(W)]:se).slice(o*W,o*W+W).map(((e,n)=>{var i;return e?(0,t.jsx)(O.l,{row:e,isAdmin:(null===H||void 0===H||null===(i=H.companyInfo)||void 0===i?void 0:i.admin.id)===(null===J||void 0===J?void 0:J.uid),type:"users_listings",selected:T.includes(e.id),onSelectRow:()=>z(e.id),manageCompanyRole:de},e.id):!re&&(0,t.jsx)(C.hM,{sx:{height:ae}},n)})),(0,t.jsx)(C.$W,{height:ae,emptyRows:(0,C.fQ)(o,W,null===Q||void 0===Q?void 0:Q.length)}),(0,t.jsx)(C.et,{isNotFound:re,type:"users_listings"})]})]})})]}),(0,t.jsx)(C.S_,{count:se.length,page:o,rowsPerPage:W,onPageChange:$,onRowsPerPageChange:F,dense:i,onChangeDense:M})]})]}),(0,t.jsx)(b.Z,{open:te,onClose:le,title:"Invite Collaborator",content:(0,t.jsx)(g.Z,{direction:"row",spacing:2,mt:2,children:(0,t.jsx)(x.Z,{placeholder:"Search by Email",fullWidth:!0,type:"email",value:q,onChange:e=>Y(e.target.value)})}),action:(0,t.jsx)(f.Z,{loading:ne,variant:"contained",color:"primary",disabled:!String(q).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),startIcon:(0,t.jsx)(E.Z,{icon:"mdi:invite"}),loadingPosition:"start",onClick:()=>{(async()=>{ie(!0);try{var e;const n=JSON.stringify({emailInvite:q,user:J,selectedCompany:H}),i=(0,j.V1)(w.H7,"handleUserInvitations");await i(n),(0,y.Kz)(w.co,"invite_collaborator",{invitee:q,inviter:J.email,company:null===H||void 0===H||null===(e=H.companyInfo)||void 0===e?void 0:e.name,companyId:null===H||void 0===H?void 0:H.companyId})}catch(n){console.log("ERROR OCURRED IN handleUserInvitations",n)}finally{ie(!1),le()}})()},children:"Invite"})})]})]})}D.getLayout=e=>(0,t.jsx)(I.Z,{children:e});const B=e=>{let{inputData:n,comparator:i,filterName:t,filterStatus:o}=e;const s=n.map(((e,n)=>[e,n]));return s.sort(((e,n)=>{const t=i(e[0],n[0]);return 0!==t?t:e[1]-n[1]})),n=s.map((e=>e[0])),t&&(n=n.filter((e=>-1!==e.name.toLowerCase().indexOf(t.toLowerCase())))),o.length&&(n=n.filter((e=>o.includes(e.inventoryType)))),n}}},function(e){e.O(0,[3524,4768,4220,7471,9774,2888,179],(function(){return n=11401,e(e.s=n);var n}));var n=e.O();_N_E=n}]);
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.