(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6956],{58990:(e,s,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/adminpanel/doctors/UserAccessListing",function(){return n(59400)}])},59400:(e,s,n)=>{"use strict";n.r(s),n.d(s,{default:()=>v});var l=n(37876),a=n(14232),t=n(31777),i=n(16190),d=n(64329),r=n(3945);let c=e=>{let{children:s,type:n,Ref:a,...t}=e;return(0,l.jsx)("button",{type:n||"button",ref:a,...t,children:s})};var u=n(59561),o=n(84780),m=n(80791),h=n(84495),x=n(5033),p=n(48230),j=n.n(p);let v=()=>{let{assignedUserList:e,loading:s,currentOption:n}=(0,t.d4)(e=>e.assign),{modules:p}=(0,t.d4)(e=>e.auth),[v,f]=(0,a.useState)(e),{checkRoleAccess:g}=(0,m.Z)(),b=(0,t.wA)(),[_,w]=(0,a.useState)([]);(0,a.useEffect)(()=>{g(["super_admin","admin"],[])&&b((0,h.Iu)()),w(p.map(e=>({value:e.module_id,label:e.module_name})))},[]),(0,a.useEffect)(()=>{f(e)},[e]);let N=(0,a.useCallback)(s=>{s&&(b((0,x.T)(s)),f(e.filter(e=>e.modules.some(e=>parseInt(e.module_assign_id)===s.value))))},[x.T,b,e]),y=(0,a.useCallback)(()=>{b((0,x.T)(null))},[x.T,b]),C=(0,a.useMemo)(()=>Object.values({admin:"admin",...i.dn}),[]),k=(0,a.useMemo)(()=>[{name:"Full Name",cell:e=>{var s;return null==(s=e.user)?void 0:s.name},width:"auto",className:"ellipsis",style:{maxWidth:"35%",justifyContent:"flex-start",fontWeight:"bold"}},...C.map(e=>({name:e,cell:s=>{let a=!1,t=s.modules.find(e=>parseInt(e.module_assign_id)===parseInt(n.value));if("admin"===e)(null==t?void 0:t.role)==="admin"&&(a=!0);else{var i;(null==t||null==(i=t.permission)?void 0:i.includes(e))&&(a=!0)}return(0,l.jsx)("input",{type:"checkbox",style:{pointerEvents:"none"},label:e,onChange:()=>{},checked:a})},width:"10%"})),{name:"",cell:e=>(0,l.jsxs)(j(),{href:"/adminpanel/edit-access-user/"+e.user_id,children:[" ",(0,l.jsxs)(c,{"aria-label":"edit",className:"action-icon",children:[" ",(0,l.jsx)(d.qU,{height:15,width:15})]})]}),width:"4%",style:{justifyContent:"flex-end"}}],[n,N]),A=(0,a.useMemo)(()=>[{name:"Full Name",cell:e=>{var s;return null==(s=e.user)?void 0:s.name},width:"auto",style:{justifyContent:"flex-start",fontWeight:"bold"}},...p.map(e=>({name:e.module_name,cell:s=>{var n;let a=null==(n=s.modules)?void 0:n.find(s=>s.module_assign_id===e.module_id);return a?(0,l.jsx)(r.BD,{type:null==a?void 0:a.role}):(0,l.jsx)("span",{children:"-"})},width:"8%",style:{justifyContent:"center"}})),{name:"",cell:e=>(0,l.jsxs)(j(),{href:"/adminpanel/edit-access-user/"+e.user_id,children:[" ",(0,l.jsxs)(c,{"aria-label":"edit",className:"action-icon",children:[" ",(0,l.jsx)(d.qU,{height:15,width:15})]})]}),width:"4%",style:{justifyContent:"flex-end"}}],[N,n]);return(0,l.jsxs)("div",{className:"container-listing",children:[(0,l.jsx)("div",{className:"",children:(0,l.jsxs)("div",{className:"resource-header",children:[(0,l.jsxs)("div",{className:"modulename d-flex gap-2 align-items-center",children:[(0,l.jsx)(u.A,{}),(0,l.jsx)("span",{className:"main-heading",children:"Access Panel"})]}),(0,l.jsxs)("div",{className:"filter-section",children:[(0,l.jsx)(r.Ae,{className:"user-access-dropdown",DropdownIndicator:()=>(0,l.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",height:"20",width:"13",viewBox:"0 0 320 512",children:(0,l.jsx)("path",{d:"M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"})}),width:"auto",control:{padding:"0 10px"},onChange:N,placeholder:"All Modules",options:_,value:n}),(0,l.jsx)(r.Yn,{onClick:y}),g(["super_admin","admin"],[])&&(0,l.jsxs)("div",{className:"action-btn",children:[" ",(0,l.jsxs)(NavLink,{to:"/adminpanel/add-access-user",children:["  ",(0,l.jsx)(r.jn,{textTransform:"capitalize",background:"#fff",height:"35px",children:"Add +"})]})]})]})]})}),(0,l.jsx)("div",{className:"resource-body",children:(0,l.jsx)("div",{className:"resource-body user-access-listing user-access-listing-resp",children:(0,l.jsx)(r.up,{columns:n?k:A,pagination:!0,progressPending:s,progressComponent:(0,l.jsx)(o.A,{columns:A}),data:v})})})]})}},59561:(e,s,n)=>{"use strict";n.d(s,{A:()=>i});var l=n(37876);n(14232);var a=n(89099),t=n(64329);let i=e=>{let{to:s=-1,...n}=e,i=(0,a.useRouter)();return(0,l.jsx)("button",{type:"button","aria-label":"go-back",onClick:()=>-1===s?i.back():i.push(s),children:(0,l.jsx)(t.Z3,{...n})})}},84780:(e,s,n)=>{"use strict";n.d(s,{A:()=>t});var l=n(37876);n(14232);var a=n(96010);n(71463);let t=e=>{let{columns:s,rowCount:n=8}=e;return(0,l.jsxs)("table",{className:"table mt-2",children:[(0,l.jsx)("thead",{}),(0,l.jsx)("tbody",{children:[...Array(n)].map(()=>(0,l.jsx)("tr",{children:s.map((e,s)=>(0,l.jsx)("td",{children:(0,l.jsx)(a.A,{height:20,width:"100%"})},s))},Math.random().toString(36).substring(7)))})]})}}},e=>{var s=s=>e(e.s=s);e.O(0,[636,6593,8792],()=>s(58990)),_N_E=e.O()}]);
//# sourceMappingURL=UserAccessListing-130df34c9c10fd4d.js.map