2025-02-19 19:38:56 +00:00
|
|
|
"use strict";(()=>{var e={};e.id=5662,e.ids=[5662],e.modules={30671:(e,t)=>{Object.defineProperty(t,"M",{enumerable:!0,get:function(){return function e(t,s){return s in t?t[s]:"then"in t&&"function"==typeof t.then?t.then(t=>e(t,s)):"function"==typeof t&&"default"===s?t:void 0}}})},16340:(e,t,s)=>{s.a(e,async(e,a)=>{try{s.r(t),s.d(t,{config:()=>x,default:()=>u,getServerSideProps:()=>h,getStaticPaths:()=>m,getStaticProps:()=>p,reportWebVitals:()=>v,routeModule:()=>j,unstable_getServerProps:()=>A,unstable_getServerSideProps:()=>g,unstable_getStaticParams:()=>f,unstable_getStaticPaths:()=>_,unstable_getStaticProps:()=>y});var r=s(63865),i=s(9455),n=s(30671),l=s(5583),d=s(53881),c=s(80300),o=e([c]);c=(o.then?(await o)():o)[0];let u=(0,n.M)(c,"default"),p=(0,n.M)(c,"getStaticProps"),m=(0,n.M)(c,"getStaticPaths"),h=(0,n.M)(c,"getServerSideProps"),x=(0,n.M)(c,"config"),v=(0,n.M)(c,"reportWebVitals"),y=(0,n.M)(c,"unstable_getStaticProps"),_=(0,n.M)(c,"unstable_getStaticPaths"),f=(0,n.M)(c,"unstable_getStaticParams"),A=(0,n.M)(c,"unstable_getServerProps"),g=(0,n.M)(c,"unstable_getServerSideProps"),j=new r.PagesRouteModule({definition:{kind:i.A.PAGES,page:"/admin/[user_id]/users",pathname:"/admin/[user_id]/users",bundlePath:"",filename:""},components:{App:d.default,Document:l.default},userland:c});a()}catch(e){a(e)}})},1924:(e,t,s)=>{s.d(t,{A:()=>d});var a=s(8732),r=s(82015),i=s.n(r),n=s(46169),l=s(16757);function d({invitationObject:e}){let[t,s]=i().useState(!1);return(0,a.jsxs)("div",{className:"bg-slate-100 px-4 py-2 rounded w-full justify-between relative",children:[t&&(0,a.jsx)(l.A,{width:"20px"}),(0,a.jsxs)("span",{className:"text-sm font-semibold",children:[e.first_name," ",e.last_name," (",e.email,")"]}),(0,a.jsx)("button",{className:"py-1.5 px-3 text-sm secondary",onClick:t=>{s(!0),(0,n.A)("/api/acceptUserInvitation",{method:"post",body:{...e}},!0).then(e=>{e.success&&(window.alert("Invitation Accepted!"),window.location.reload()),setTimeout(()=>{s(!1)},500)})},children:"Accept Invitation"})]},e.id)}},23649:(e,t,s)=>{s.a(e,async(e,a)=>{try{s.d(t,{A:()=>m});var r=s(8732),i=s(82015),n=s.n(i),l=s(80300),d=s(53926),c=s(58337),o=s(46169),u=s(1924),p=e([l]);function m(){let{user:e,databases:t,pendingInvitations:s,pendingInvitationsReceived:a,adminUsers:i,invitedAccounts:p,setTargetUser:m}=n().useContext(l.UsersContext),[h,x]=n().useState(!1);return(0,r.jsxs)(n().Fragment,{children:[(0,r.jsxs)("div",{className:"flex-col items-start gap-0 w-full",children:[(0,r.jsxs)("div",{className:"w-full justify-between flex-wrap",children:[(0,r.jsx)("h1",{className:"text-3xl m-0",children:"Users"}),(0,r.jsxs)("a",{href:`/admin/${e?.id}/users/add-user`,className:"flex items-center gap-2 whitespace-normal button",children:[(0,r.jsx)("span",{className:"symbol",children:"+"}),(0,r.jsx)("span",{children:"Add New User"})]})]}),(0,r.jsx)(d.A,{user:e})]}),(0,r.jsxs)("div",{className:"w-full grid grid-cols-1 items-start justify-start",children:[(0,r.jsx)("div",{className:"flex-col items-stretch justify-start",children:e&&m&&(0,r.jsx)(c.A,{setTargetUser:m,user:e,adminUsers:i,invitedAccounts:p})}),(0,r.jsxs)("div",{className:"flex-col items-stretch justify-start",children:[s&&s[0]&&(0,r.jsx)(n().Fragment,{children:(0,r.jsx)("section",{className:"p-4 items-start gap-4 overflow-visible",children:(0,r.jsxs)("div",{className:"flex-col w-full items-start",children:[(0,r.jsx)("h2",{className:"text-xl m-0",children:"Invitations Sent"}),s.map((e,t)=>(0,r.jsxs)("div",{className:"bg-slate-100 px-4 py-2 rounded w-full justify-between",children:[(0,r.jsx)("span",{className:"text-sm font-semibold",children:e.invited_user_email}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-sm text-slate-400",children:"Pending"}),(0,r.jsx)("span",{className:"text-sm text-orange-600 hover:opacity-50 cursor-pointer",onClick:t=>{window.confirm("Delete this invitation?")&&(0,o.A)("/api/deleteInvitation",{method:"POST",body:{id:e.id}},!0).finally(()=>{window.location.reload()})},children:"Delete Invitation"})]})]},e.id))]})})}),a&&a[0]&&(0,r.jsx)(n().Fragment,{children:(
|