turboci-admin/dist/web/static/chunks/pages/admin/users-73e9775838b56d95.js
2026-03-12 14:56:39 +01:00

1 line
6.2 KiB
JavaScript

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[635],{69919:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(s,i){function o(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}c((n=n.apply(e,t||[])).next())})},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return n(this,void 0,void 0,function*(){let r;let n={"Content-Type":"application/json"};(null==t?void 0:t.csrfKey)&&t.csrfValue&&(n[t.csrfKey]=t.csrfValue);let s=e;if((null==t?void 0:t.query)&&(s+=(0,o.default)(t.query)),"string"==typeof t)try{r="post"===t?(yield fetch(s,{method:t,headers:n})).json():(yield fetch(s)).json()}catch(e){console.log("FetchAPI error #1:",e.message),r=null}else if("object"==typeof t){let e={};try{e.method=t.method,t.method.match(/post|put|delete|patch/i)&&t.body&&"object"==typeof t.body&&(e.body=JSON.stringify(t.body)),e.headers=i.default.merge(n,t.headers||{}),e=i.default.merge(e,t.fetchOptions),r=(yield fetch(s,e)).json()}catch(e){console.log("FetchAPI error #2:",e.message),r=null}}else try{let e=yield fetch(s);r=yield e.json()}catch(e){console.log("FetchAPI error #3:",e.message),r=null}return r})};let i=s(r(96486)),o=s(r(65185))},53552:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={parse:function(e,t){if(e){if("object"==typeof e)return e;if("string"==typeof e)try{return JSON.parse(e,t)}catch(e){return}}},stringify:function(e,t,r){try{return JSON.stringify(e,t||void 0,r)}catch(e){return}}}},65185:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){let t="?";if("object"!=typeof e)return console.log("Invalid Query type"),t;if(Array.isArray(e))return console.log("Query is an Array. This is invalid."),t;if(!e)return console.log("No Query provided."),t;let r=Object.keys(e),n=[];return r.forEach(t=>{if(!t||!e[t])return;let r=e[t];if("object"==typeof r){let e=s.default.stringify(r);n.push(`${t}=${encodeURIComponent(String(e))}`)}else"string"==typeof r||"number"==typeof r?n.push(`${t}=${encodeURIComponent(r)}`):n.push(`${t}=${String(r)}`)}),t+=n.join("&")};let s=n(r(53552))},64168:function(e,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/users",function(){return r(50019)}])},94089:function(e,t,r){"use strict";r.d(t,{Z:function(){return u}});var n=r(85893),s=r(76242),i=r(25808),o=r(94495),a=r(69919),c=r.n(a);function u(e){let{dep_user:t,target:r,button_props:a}=e,{loading:u,setLoading:l}=(0,i.Z)(),d=(0,n.jsx)(o.Z,{title:"Delete Deployment User",...a,children:"Delete User"});return t.is_super_admin?null:(0,n.jsx)("div",{onClick:()=>{window.confirm("Delete User?")&&(l(!0),c()("/api/admin/delete-user",{method:"POST",body:{user_id:t.id}}).then(e=>{console.log(e)}))},children:u?(0,n.jsx)(s.Z,{}):r||d})}},50019:function(e,t,r){"use strict";r.r(t),r.d(t,{__N_SSP:function(){return _},default:function(){return b}});var n=r(85893),s=r(67294),i=r(5606),o=r(60705),a=r(33028),c=r(94495),u=r(60),l=r(53151),d=r(36969),f=r(88584),h=r(94655),y=r(3668),p=r(94089);function x(e){let{dep_usr:t}=e,{pageProps:r}=(0,s.useContext)(i.AppContext),o=!!t.is_super_admin;return(0,n.jsx)("a",{href:"/admin/users/".concat(t.id),children:(0,n.jsxs)(h.Z,{className:"w-full justify-between",children:[(0,n.jsxs)(h.Z,{children:[(0,n.jsx)(l.Z,{image_url:t.image,title:"".concat(t.first_name," Image"),image_size:40}),(0,n.jsxs)(y.Z,{children:[t.first_name," ",t.last_name]})]}),(0,n.jsxs)(h.Z,{children:[(0,n.jsx)(c.Z,{title:"Edit User",size:"smaller",variant:"ghost",beforeIcon:(0,n.jsx)(d.Z,{name:"Edit3",size:17})}),o?(0,n.jsx)(f.Z,{children:"Super Admin"}):(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(p.Z,{dep_user:t,target:(0,n.jsx)(c.Z,{title:"Delete User",size:"smaller",variant:"ghost",beforeIcon:(0,n.jsx)(d.Z,{name:"Trash",size:17})})})})]})]})})}function m(){let{pageProps:e}=(0,s.useContext)(i.AppContext),{deployment_users:t}=e;return(0,n.jsx)(u.Z,{className:"grid-cell-content",children:null==t?void 0:t.map((e,t)=>(0,n.jsx)(x,{dep_usr:e},t))})}function g(){let{pageProps:e}=(0,s.useContext)(i.AppContext);return(0,n.jsxs)(s.Fragment,{children:[(0,n.jsx)(a.Z,{title:"Users",description:(0,n.jsx)(n.Fragment,{children:"All Users in this deployment"}),ctas:(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(c.Z,{title:"Add User",href:"/admin/users/add-user",children:"Add User"})})}),(0,n.jsx)(o.Z,{}),(0,n.jsx)(m,{})]})}var j=r(89350),_=!0;function b(){return(0,n.jsx)(j.Z,{children:(0,n.jsx)(g,{})})}},88584:function(e,t,r){"use strict";r.d(t,{Z:function(){return i}});var n=r(85893);r(67294);var s=r(98388);function i(e){let{color:t,variant:r,children:i,href:o,newTab:a,linkProps:c,...u}=e,l=(0,n.jsx)("div",{...u,className:(0,s.m6)("text-xs px-2 py-0.5 rounded-full outline-0","text-center flex items-center justify-center","secondary"==t?"bg-secondary text-white outline-secbg-secondary":"success"==t?"bg-success outline-success text-white":"error"==t?"bg-orange-700 outline-orange-700":"gray"==t?(0,s.m6)("bg-slate-100 outline-slate-200 dark:bg-gray-dark dark:outline-gray-dark","text-slate-800 dark:text-white"):"bg-primary text-white outline-primbg-primary twui-tag-primary","outlined"==r?"!bg-transparent outline-1 "+("secondary"==t?"text-secondary":"success"==t?"text-success dark:text-success-dark":"error"==t?"text-orange-700":"gray"==t?"text-slate-700 dark:text-white/80":"text-primary dark:text-primary-dark twui-tag-primary-outlined"):"ghost"==r?"!bg-transparent outline-none border-none "+("secondary"==t?"text-secondary":"success"==t?"text-success dark:text-success-dark":"error"==t?"text-orange-700":"gray"==t?"text-slate-700 dark:text-white/80":"text-primary dark:text-primary-dark"):"","twui-tag",u.className),children:i});return o?(0,n.jsx)("a",{href:o,target:a?"_blank":void 0,...c,className:(0,s.m6)("hover:opacity-80",null==c?void 0:c.className),children:l}):l}},9008:function(e,t,r){e.exports=r(23867)}},function(e){e.O(0,[662,75,664,433,7,910,888,774,179],function(){return e(e.s=64168)}),_N_E=e.O()}]);