2025-01-13 08:00:21 +00:00
|
|
|
"use strict";(()=>{var e={};e.id=5109,e.ids=[5109],e.modules={9591:(e,t,s)=>{s.r(t),s.d(t,{config:()=>N,default:()=>b,getServerSideProps:()=>w,getStaticPaths:()=>v,getStaticProps:()=>S,reportWebVitals:()=>P,routeModule:()=>D,unstable_getServerProps:()=>q,unstable_getServerSideProps:()=>A,unstable_getStaticParams:()=>M,unstable_getStaticPaths:()=>y,unstable_getStaticProps:()=>_});var r={};s.r(r),s.d(r,{default:()=>f,getServerSideProps:()=>j});var a=s(63865),l=s(9455),i=s(30671),n=s(5583),o=s(19796),u=s(8732),c=s(82015),d=s.n(c),m=s(61197),p=s(40778),x=s(1360);function h({data:e}){return(0,u.jsx)(d().Fragment,{children:(0,u.jsxs)("section",{className:"items-start justify-start p-6",children:[(0,u.jsxs)("div",{className:"flex flex-row items-center w-full gap-20 mb-6 justify-between",children:[(0,u.jsx)("h2",{className:"text-xl m-0",children:"Users"}),(0,u.jsx)("a",{href:"/su/users/new",className:"button",children:"Add User"})]}),(0,u.jsx)("div",{className:"flex-col items-stretch gap-10 w-full",children:e.users.map((e,t)=>(0,u.jsx)(x.A,{userObject:e},t+1))})]})})}var g=s(71934);function f({user:e,data:t}){let s=(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("title",{children:"User Dashboard | Datasquirel"}),(0,u.jsx)("meta",{name:"description",content:"Welcome to your data app"})]});return(0,u.jsx)(p.A,{head:s,user:e,children:(0,u.jsx)(h,{data:t})})}async function j({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,g.A)("SELECT * FROM users")).reverse()}}}:{redirect:{destination:"/su/login",permanent:!1}}}let b=(0,i.M)(r,"default"),S=(0,i.M)(r,"getStaticProps"),v=(0,i.M)(r,"getStaticPaths"),w=(0,i.M)(r,"getServerSideProps"),N=(0,i.M)(r,"config"),P=(0,i.M)(r,"reportWebVitals"),_=(0,i.M)(r,"unstable_getStaticProps"),y=(0,i.M)(r,"unstable_getStaticPaths"),M=(0,i.M)(r,"unstable_getStaticParams"),q=(0,i.M)(r,"unstable_getServerProps"),A=(0,i.M)(r,"unstable_getServerSideProps"),D=new a.PagesRouteModule({definition:{kind:l.A.PAGES,page:"/su/users",pathname:"/su/users",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),[u,c]=l().useState(!t);return(0,r.jsxs)("div",{className:"card col green w-full overflow-hidden"+(u?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=>{u?c(!1):c(!0)},children:u?"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<s.length-1&&(0,r.jsx)("hr",{})]},a+1))}),(0,r.jsx)("button",{className:"outlined gray small-text w-full",onClick:e=>{c(!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"
|