"use strict";(()=>{var e={};e.id=5516,e.ids=[5516],e.modules={84231:(e,t,s)=>{s.r(t),s.d(t,{config:()=>y,default:()=>v,getServerSideProps:()=>P,getStaticPaths:()=>N,getStaticProps:()=>w,reportWebVitals:()=>_,routeModule:()=>D,unstable_getServerProps:()=>C,unstable_getServerSideProps:()=>E,unstable_getStaticParams:()=>A,unstable_getStaticPaths:()=>q,unstable_getStaticProps:()=>M});var r={};s.r(r),s.d(r,{default:()=>S,getServerSideProps:()=>b});var a=s(63865),l=s(9455),i=s(30671),n=s(5583),o=s(19796),c=s(8732),u=s(82015),d=s.n(u),m=s(61197),p=s(40778),x=s(46169),h=s(16757),g=s(1360);function j({data:e}){Object.keys(e.users[0]);let[t,s]=d().useState(null),[r,a]=d().useState(0),[l,i]=d().useState(!1);return console.log(typeof t),(0,c.jsx)(d().Fragment,{children:(0,c.jsxs)("div",{className:"items-stretch gap-10 w-full",children:[(0,c.jsxs)("section",{className:"paper w-full",children:[(0,c.jsx)("h2",{className:"text-xl m-0 mb-6",children:"Users"}),(0,c.jsx)("div",{className:"flex-col items-stretch gap-10",children:e.users.map((e,t)=>(0,c.jsx)(g.A,{userObject:e},t+1))})]}),(0,c.jsxs)("section",{className:"paper",children:[(0,c.jsxs)("div",{className:"w-full justify-between",children:[(0,c.jsx)("h2",{className:"text-xl m-0",children:"Error Logs"}),(0,c.jsx)("div",{children:(0,c.jsxs)("button",{onClick:e=>{window.confirm("Clear Error Logs?")&&(i(!0),(0,x.A)("/api/admin/clearErrorLogs",{method:"POST"}).then(e=>{a(e=>e+1)}),setTimeout(()=>{i(!1)},2e3))},className:"outlined gray relative",children:[l&&(0,c.jsx)(h.A,{width:"20px"}),"Clear Error Log"]})})]}),t&&(0,c.jsx)("p",{dangerouslySetInnerHTML:{__html:t||"No Log"}}),"string"!=typeof t&&(0,c.jsx)(h.A,{position:"relative",width:"25px"})]})]})})}var f=s(71934);function S({user:e,data:t}){let s=(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("title",{children:"User Dashboard | Datasquirel"}),(0,c.jsx)("meta",{name:"description",content:"Welcome to your data app"})]});return(0,c.jsx)(p.A,{head:s,user:e,children:(0,c.jsx)(j,{data:t})})}async function b({req:e,res:t,query:s}){let r=await (0,m.A)(e);return r?.logged_in_status?{props:{user:r,data:{users:await (0,f.A)("SELECT * FROM users ORDER BY id DESC")}}}:{redirect:{destination:"/su/login",permanent:!1}}}let v=(0,i.M)(r,"default"),w=(0,i.M)(r,"getStaticProps"),N=(0,i.M)(r,"getStaticPaths"),P=(0,i.M)(r,"getServerSideProps"),y=(0,i.M)(r,"config"),_=(0,i.M)(r,"reportWebVitals"),M=(0,i.M)(r,"unstable_getStaticProps"),q=(0,i.M)(r,"unstable_getStaticPaths"),A=(0,i.M)(r,"unstable_getStaticParams"),C=(0,i.M)(r,"unstable_getServerProps"),E=(0,i.M)(r,"unstable_getServerSideProps"),D=new a.PagesRouteModule({definition:{kind:l.A.PAGES,page:"/su",pathname:"/su",bundlePath:"",filename:""},components:{App:o.default,Document:n.default},userland:r})},1360:(e,t,s)=>{s.d(t,{A:()=>i});var r=s(8732),a=s(82015),l=s.n(a);function i({userObject:e,userPage:t}){let s=Object.keys(e),[a,i]=l().useState(!1),[n,o]=l().useState(0),[c,u]=l().useState(!t);return(0,r.jsxs)("div",{className:"card col green w-full overflow-hidden"+(c?t?" h-[100px]":" h-[85px]":" "),children:[(0,r.jsxs)("div",{className:"items-center w-full",children:[(0,r.jsx)("img",{src:e.image_thumbnail,alt:"",className:"rounded-full object-cover"+(t?" w-16 h-16":" w-12 h-12")}),!t&&(0,r.jsxs)("h3",{className:"m-0 text-xl",children:[e.first_name," ",e.last_name," "]}),(0,r.jsxs)("div",{className:"ml-auto",children:[(0,r.jsx)("button",{className:"outlined gray small-text",onClick:e=>{c?u(!1):u(!0)},children:c?"More Details":"Collapse"}),!t&&(0,r.jsx)("a",{href:`/su/users/${e.id}`,className:"button outlined gray small-text",children:"View User"})]})]}),(0,r.jsx)("div",{className:"card no-hover col w-full light-gray-bg",children:s.map((t,a)=>(0,r.jsxs)(l().Fragment,{children:[(0,r.jsx)("div",{children:(0,r.jsxs)("span",{style:{wordBreak:"break-all"},children:[t,":"," ",(0,r.jsx)("b",{children:e[t]})]})}),a{u(!0)},children:"Collapse"})]})}},71934:(e,t,s)=>{s.d(t,{A:()=>r});async function r(...e){let t=global.DSQL_DB_CONN;try{if(!t)throw Error("No Connection provided to DB_HANDLER function!");let s=await t.query(...e);return JSON.parse(JSON.stringify(s))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await t?.end()}}},13893:e=>{e.exports=require("@moduletrace/datasquirel/dist/client/fetch")},40361:e=>{e.exports=require("next/dist/compiled/next-server/pages.runtime.prod.js")},27912:e=>{e.exports=require("next/head")},82015:e=>{e.exports=require("react")},22326:e=>{e.exports=require("react-dom")},8732:e=>{e.exports=require("react/jsx-runtime")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},33873:e=>{e.exports=require("path")}};var t=require("../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),r=t.X(0,[883,9821,9796,6622],()=>s(84231));module.exports=r})();