1 line
16 KiB
JavaScript
1 line
16 KiB
JavaScript
|
"use strict";(()=>{var e={};e.id=5662,e.ids=[636,5662],e.modules={30671:(e,s)=>{Object.defineProperty(s,"M",{enumerable:!0,get:function(){return function e(s,t){return t in s?s[t]:"then"in s&&"function"==typeof s.then?s.then(s=>e(s,t)):"function"==typeof s&&"default"===t?s:void 0}}})},67777:(e,s,t)=>{t.r(s),t.d(s,{config:()=>C,default:()=>M,getServerSideProps:()=>E,getStaticPaths:()=>k,getStaticProps:()=>P,reportWebVitals:()=>F,routeModule:()=>H,unstable_getServerProps:()=>T,unstable_getServerSideProps:()=>R,unstable_getStaticParams:()=>O,unstable_getStaticPaths:()=>I,unstable_getStaticProps:()=>U});var i={};t.r(i),t.d(i,{UsersContext:()=>w,default:()=>q,getServerSideProps:()=>S});var r=t(63865),a=t(9455),l=t(30671),n=t(49407),u=t(68268),o=t(8732),d=t(82015),c=t.n(d),m=t(95222),p=t(20048),x=t.n(p),h=t(84312),v=t(58548),y=t(21347);function f({user:e,setTargetUser:s,users:t,adminUsers:i,invitedAccounts:r}){return(0,o.jsx)(c().Fragment,{children:(0,o.jsxs)("section",{className:"paper",children:[(0,o.jsx)("h2",{className:"text-xl m-0",children:"Users List"}),(0,o.jsxs)("div",{className:"card no-hover items-center w-full justify-between",children:[(0,o.jsxs)("div",{className:"gap-2",children:[(0,o.jsx)("div",{className:"w-10 h-10 rounded-full overflow-hidden",children:(0,o.jsx)("img",{src:e.image_thumbnail,alt:"Main User Image",width:40,className:"w-full h-full object-cover"})}),(0,o.jsxs)("span",{className:"font-semibold",children:[e.first_name," ",e.last_name]})]}),(0,o.jsx)("span",{className:"text-sm font-semibold",children:"Super User (Owner)"})]}),(0,o.jsxs)("div",{className:"w-full flex-col items-stretch",children:[r&&r[0]&&(0,o.jsxs)(c().Fragment,{children:[(0,o.jsx)("h4",{className:"m-0 text-sm font-semibold text-slate-400",children:"Accounts that Invited you"}),r.map((e,t)=>(0,o.jsx)(y.A,{userObject:e,setTargetUser:s,paradigm:"invited"},t+1))]}),i&&i[0]&&(0,o.jsxs)(c().Fragment,{children:[(0,o.jsx)("h4",{className:"m-0 text-sm font-semibold text-slate-400",children:"Accounts you Invited"}),i.map((e,t)=>(0,o.jsx)(y.A,{userObject:e,setTargetUser:s},t+1))]})]})]})})}var j=t(63715),g=t(32415);function b({invitationObject:e}){let[s,t]=c().useState(!1);return(0,o.jsxs)("div",{className:"bg-slate-100 px-4 py-2 rounded w-full justify-between relative",children:[s&&(0,o.jsx)(g.A,{width:"20px"}),(0,o.jsxs)("span",{className:"text-sm font-semibold",children:[e.first_name," ",e.last_name," (",e.email,")"]}),(0,o.jsx)("button",{className:"py-1.5 px-3 text-sm secondary",onClick:s=>{t(!0),(0,j.A)("/api/acceptUserInvitation",{method:"post",body:{...e}},!0).then(e=>{e.success&&(window.alert("Invitation Accepted!"),window.location.reload()),setTimeout(()=>{t(!1)},500)})},children:"Accept Invitation"})]},e.id)}function A(e){let{user:s,databases:t,pendingInvitations:i,pendingInvitationsReceived:r,adminUsers:a,invitedAccounts:l,setTargetUser:n}=c().useContext(w),[u,d]=c().useState(!1);return(0,o.jsxs)(c().Fragment,{children:[(0,o.jsxs)("div",{className:"flex-col items-start gap-0 w-full",children:[(0,o.jsxs)("div",{className:"w-full justify-between flex-wrap",children:[(0,o.jsx)("h1",{className:"text-3xl m-0",children:"Users"}),(0,o.jsxs)("a",{href:`/admin/${s?.id}/users/add-user`,className:"flex items-center gap-2 whitespace-normal button",children:[(0,o.jsx)("span",{className:"symbol",children:"+"}),(0,o.jsx)("span",{children:"Add New User"})]})]}),(0,o.jsx)(v.A,{user:s})]}),(0,o.jsxs)("div",{className:"w-full grid grid-cols-1 items-start justify-start",children:[(0,o.jsx)("div",{className:"flex-col items-stretch justify-start",children:(0,o.jsx)(f,{setTargetUser:n,user:s,adminUsers:a,invitedAccounts:l})}),(0,o.jsxs)("div",{className:"flex-col items-stretch justify-start",children:[i&&i[0]&&(0,o.jsx)(c().Fragment,{children:(0,o.jsx)("section",{className:"p-4 items-start gap-4 overflow-visible",children:(0,o.jsxs)("div",{className:"flex-col w-full items-start",children:[(0,o.jsx)("h2",{className:"text-xl m-0",children:"Invitations Sent"}),i.map((e,s)=>(0,o.jsxs)("div",{className:"bg-slate-100 px-4 py-2 rounded w-full justify-between",c
|