1 line
8.9 KiB
JavaScript
1 line
8.9 KiB
JavaScript
"use strict";(()=>{var e={};e.id=5109,e.ids=[636,5109],e.modules={30671:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},93701:(e,r,t)=>{t.r(r),t.d(r,{config:()=>A,default:()=>v,getServerSideProps:()=>b,getStaticPaths:()=>k,getStaticProps:()=>P,reportWebVitals:()=>j,routeModule:()=>N,unstable_getServerProps:()=>D,unstable_getServerSideProps:()=>E,unstable_getStaticParams:()=>w,unstable_getStaticPaths:()=>_,unstable_getStaticProps:()=>M});var s={};t.r(s),t.d(s,{default:()=>q,getServerSideProps:()=>S});var i=t(63865),a=t(9455),u=t(30671),l=t(49407),o=t(68268),n=t(8732),c=t(82015),p=t.n(c),d=t(93615),m=t.n(d),x=t(64987),h=t(21498);function y({data:e}){return(0,n.jsx)(p().Fragment,{children:(0,n.jsxs)("section",{className:"items-start justify-start p-6",children:[(0,n.jsxs)("div",{className:"flex flex-row items-center w-full gap-20 mb-6 justify-between",children:[(0,n.jsx)("h2",{className:"text-xl m-0",children:"Users"}),(0,n.jsx)("a",{href:"/su/users/new",className:"button",children:"Add User"})]}),(0,n.jsx)("div",{className:"flex-col items-stretch gap-10 w-full",children:e.users.map((e,r)=>(0,n.jsx)(h.A,{userObject:e},r+1))})]})})}var f=t(67216),g=t.n(f);function q({user:e,data:r}){let t=(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("title",{children:"User Dashboard | Datasquirel"}),(0,n.jsx)("meta",{name:"description",content:"Welcome to your data app"})]});return(0,n.jsx)(x.A,{head:t,user:e,children:(0,n.jsx)(y,{data:r})})}async function S({req:e,res:r,query:t}){let s=await m()(e);return s?.logged_in_status?{props:{user:s,data:{users:(await g()("SELECT * FROM users")).reverse()}}}:{redirect:{destination:"/su/login",permanent:!1}}}let v=(0,u.M)(s,"default"),P=(0,u.M)(s,"getStaticProps"),k=(0,u.M)(s,"getStaticPaths"),b=(0,u.M)(s,"getServerSideProps"),A=(0,u.M)(s,"config"),j=(0,u.M)(s,"reportWebVitals"),M=(0,u.M)(s,"unstable_getStaticProps"),_=(0,u.M)(s,"unstable_getStaticPaths"),w=(0,u.M)(s,"unstable_getStaticParams"),D=(0,u.M)(s,"unstable_getServerProps"),E=(0,u.M)(s,"unstable_getServerSideProps"),N=new i.PagesRouteModule({definition:{kind:a.A.PAGES,page:"/su/users",pathname:"/su/users",bundlePath:"",filename:""},components:{App:o.default,Document:l.default},userland:s})},21498:(e,r,t)=>{t.d(r,{A:()=>u});var s=t(8732),i=t(82015),a=t.n(i);function u({userObject:e,userPage:r}){let t=Object.keys(e),[i,u]=a().useState(!1),[l,o]=a().useState(0),[n,c]=a().useState(!r);return(0,s.jsxs)("div",{className:"card col green w-full overflow-hidden"+(n?r?" h-[100px]":" h-[85px]":" "),children:[(0,s.jsxs)("div",{className:"items-center w-full",children:[(0,s.jsx)("img",{src:e.image_thumbnail,alt:"",className:"rounded-full object-cover"+(r?" w-16 h-16":" w-12 h-12")}),!r&&(0,s.jsxs)("h3",{className:"m-0 text-xl",children:[e.first_name," ",e.last_name," "]}),(0,s.jsxs)("div",{className:"ml-auto",children:[(0,s.jsx)("button",{className:"outlined gray small-text",onClick:e=>{n?c(!1):c(!0)},children:n?"More Details":"Collapse"}),!r&&(0,s.jsx)("a",{href:`/su/users/${e.id}`,className:"button outlined gray small-text",children:"View User"})]})]}),(0,s.jsx)("div",{className:"card no-hover col w-full light-gray-bg",children:t.map((r,i)=>(0,s.jsxs)(a().Fragment,{children:[(0,s.jsx)("div",{children:(0,s.jsxs)("span",{style:{wordBreak:"break-all"},children:[r,":"," ",(0,s.jsx)("b",{children:e[r]})]})}),i<t.length-1&&(0,s.jsx)("hr",{})]},i+1))}),(0,s.jsx)("button",{className:"outlined gray small-text w-full",onClick:e=>{c(!0)},children:"Collapse"})]})}},67105:(e,r,t)=>{t.d(r,{A:()=>s});let s=(0,t(82544).A)("CloudUpload",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M12 12v9",key:"192myk"}],["path",{d:"m16 16-4-4-4 4",key:"119tzi"}]])},26628:(e,r,t)=>{t.d(r,{A:()=>s});let s=(0,t(82544).A)("DatabaseBackup",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 12a9 3 0 0 0 5 2.69",key:"1ui2ym"}],["path",{d:"M21 9.3V5",key:"6k6cib"}],["path",{d:"M3 5v14a9 3 0 0 0 6.47 2.88",key:"i62tjy"}],["path",{d:"M12 12v4h4",key:"1bxaet"}],["path",{d:"M13 20a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L12 16",key:"1f4ei9"}]])},34479:(e,r,t)=>{t.d(r,{A:()=>s});let s=(0,t(82544).A)("FileWarning",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},20427:(e,r,t)=>{t.d(r,{A:()=>s});let s=(0,t(82544).A)("Home",[["path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"y5dka4"}],["polyline",{points:"9 22 9 12 15 12 15 22",key:"e2us08"}]])},62011:(e,r,t)=>{t.d(r,{A:()=>s});let s=(0,t(82544).A)("LockKeyhole",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]])},2459:(e,r,t)=>{t.d(r,{A:()=>s});let s=(0,t(82544).A)("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]])},80006:(e,r,t)=>{t.d(r,{A:()=>s});let s=(0,t(82544).A)("SquareChevronRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]])},25294:(e,r,t)=>{t.d(r,{A:()=>s});let s=(0,t(82544).A)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])},67216:(e,r,t)=>{let s=t(9973),i=t(31976),a=s({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4",ssl:i()}});async function u(...e){try{let r=await a.query(...e);return await a.end(),JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=u},31976:(e,r,t)=>{let s=t(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!s.existsSync(r)){console.log(`${r} does not exist`);return}return{ca:s.readFileSync(`${e}/ca-cert.pem`)}}},9455:(e,r)=>{var t;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},66099:e=>{e.exports=require("@mui/system")},37616:e=>{e.exports=require("@mui/system/DefaultPropsProvider")},24509:e=>{e.exports=require("@mui/system/InitColorSchemeScript")},84781:e=>{e.exports=require("@mui/system/colorManipulator")},18215:e=>{e.exports=require("@mui/system/createStyled")},59989:e=>{e.exports=require("@mui/system/createTheme")},16670:e=>{e.exports=require("@mui/system/styleFunctionSx")},88698:e=>{e.exports=require("@mui/system/useThemeProps")},76831:e=>{e.exports=require("@mui/utils")},28578:e=>{e.exports=require("@mui/utils/capitalize")},14036:e=>{e.exports=require("@mui/utils/composeClasses")},31112:e=>{e.exports=require("@mui/utils/createChainedFunction")},21763:e=>{e.exports=require("@mui/utils/debounce")},7546:e=>{e.exports=require("@mui/utils/deepmerge")},5928:e=>{e.exports=require("@mui/utils/deprecatedPropType")},20985:e=>{e.exports=require("@mui/utils/formatMuiErrorMessage")},61119:e=>{e.exports=require("@mui/utils/generateUtilityClass")},81699:e=>{e.exports=require("@mui/utils/generateUtilityClasses")},29823:e=>{e.exports=require("@mui/utils/isMuiElement")},55402:e=>{e.exports=require("@mui/utils/ownerDocument")},46875:e=>{e.exports=require("@mui/utils/ownerWindow")},48080:e=>{e.exports=require("@mui/utils/requirePropFactory")},39597:e=>{e.exports=require("@mui/utils/setRef")},88190:e=>{e.exports=require("@mui/utils/unsupportedProp")},83889:e=>{e.exports=require("@mui/utils/useControlled")},21956:e=>{e.exports=require("@mui/utils/useEnhancedEffect")},4926:e=>{e.exports=require("@mui/utils/useEventCallback")},7376:e=>{e.exports=require("@mui/utils/useForkRef")},63310:e=>{e.exports=require("@mui/utils/useId")},10977:e=>{e.exports=require("@mui/utils/useIsFocusVisible")},74956:e=>{e.exports=require("clsx")},40361:e=>{e.exports=require("next/dist/compiled/next-server/pages.runtime.prod.js")},27912:e=>{e.exports=require("next/head")},29825:e=>{e.exports=require("prop-types")},82015:e=>{e.exports=require("react")},22326:e=>{e.exports=require("react-dom")},8732:e=>{e.exports=require("react/jsx-runtime")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")}};var r=require("../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[9764,883,8268,615],()=>t(93701));module.exports=s})(); |