(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7262],{7259:(e,s,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/[user_id]/su",function(){return l(514)}])},5175:(e,s,l)=>{"use strict";l.d(s,{A:()=>n});var t=l(4848),r=l(3430),a=l(6540);function n(e){let{userObject:s,userPage:l}=e,n=a.useContext(r.AppContext).user,i=Object.keys(s),[o,c]=a.useState(!1),[d,u]=a.useState(0),[h,m]=a.useState(!l);return(0,t.jsxs)("div",{className:"card col green w-full overflow-hidden"+(h?l?" h-[100px]":" h-[85px]":" "),children:[(0,t.jsxs)("div",{className:"items-center w-full",children:[(0,t.jsx)("img",{src:s.image_thumbnail,alt:"",className:"rounded-full object-cover"+(l?" w-16 h-16":" w-12 h-12")}),!l&&(0,t.jsxs)("h3",{className:"m-0 text-xl",children:[s.first_name," ",s.last_name," "]}),(0,t.jsxs)("div",{className:"ml-auto",children:[(0,t.jsx)("button",{className:"outlined gray small-text",onClick:e=>{h?m(!1):m(!0)},children:h?"More Details":"Collapse"}),!l&&(0,t.jsx)("a",{href:"/admin/".concat(null==n?void 0:n.id,"/users/").concat(s.id),className:"button outlined gray small-text",children:"View User"})]})]}),(0,t.jsx)("div",{className:"card no-hover col w-full light-gray-bg",children:i.map((e,l)=>(0,t.jsxs)(a.Fragment,{children:[(0,t.jsx)("div",{children:(0,t.jsxs)("span",{style:{wordBreak:"break-all"},children:[e,":"," ",(0,t.jsx)("b",{children:s[e]})]})}),l<i.length-1&&(0,t.jsx)("hr",{})]},l+1))}),(0,t.jsx)("button",{className:"outlined gray small-text w-full",onClick:e=>{m(!0)},children:"Collapse"})]})}},514:(e,s,l)=>{"use strict";l.r(s),l.d(s,{__N_SSP:()=>d,default:()=>u});var t=l(4848),r=l(6540),a=l(9020),n=l(1710),i=l(5175);function o(e){let{data:s}=e;Object.keys(s.users[0]);let[l,o]=r.useState(null),[c,d]=r.useState(0),[u,h]=r.useState(!1);function m(){(0,a.A)("/api/admin/grabErrorLogs").then(e=>{var s;if((null==e?void 0:e.log)&&"string"==typeof e.log&&!(null===(s=e.log)||void 0===s?void 0:s.match(/./))){o("No Logs Yet");return}(null==e?void 0:e.log)&&o("No Logs"),o(e.log.replace(/\n|\r|\n\r|\\n/gm,"<br/>"))})}return console.log(typeof l),r.useEffect(()=>{m(),0===c&&setInterval(()=>{m()},1e4)},[c]),(0,t.jsx)(r.Fragment,{children:(0,t.jsxs)("div",{className:"items-stretch gap-10 w-full",children:[(0,t.jsxs)("section",{className:"paper w-full",children:[(0,t.jsx)("h2",{className:"text-xl m-0 mb-6",children:"Users"}),(0,t.jsx)("div",{className:"flex-col items-stretch gap-10",children:s.users.map((e,s)=>(0,t.jsx)(i.A,{userObject:e},s+1))})]}),(0,t.jsxs)("section",{className:"paper",children:[(0,t.jsxs)("div",{className:"w-full justify-between",children:[(0,t.jsx)("h2",{className:"text-xl m-0",children:"Error Logs"}),(0,t.jsx)("div",{children:(0,t.jsxs)("button",{onClick:e=>{window.confirm("Clear Error Logs?")&&(h(!0),(0,a.A)("/api/admin/clearErrorLogs",{method:"POST"}).then(e=>{d(e=>e+1)}),setTimeout(()=>{h(!1)},2e3))},className:"outlined gray relative",children:[u&&(0,t.jsx)(n.A,{width:"20px"}),"Clear Error Log"]})})]}),l&&(0,t.jsx)("p",{dangerouslySetInnerHTML:{__html:l||"No Log"}}),"string"!=typeof l&&(0,t.jsx)(n.A,{position:"relative",width:"25px"})]})]})})}var c=l(4725),d=!0;function u(e){let{user:s,data:l}=e,r=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("title",{children:"User Dashboard | Datasquirel"}),(0,t.jsx)("meta",{name:"description",content:"Welcome to your data app"})]});return(0,t.jsx)(c.A,{head:r,children:(0,t.jsx)(o,{data:l})})}}},e=>{var s=s=>e(e.s=s);e.O(0,[1335,3348,4725,636,6593,8792],()=>s(7259)),_N_E=e.O()}]);