"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[190],{29177:function(e,t,r){r.d(t,{Cy:function(){return i},Gy:function(){return a},WF:function(){return l}});var n=r(89290),a=function(e){if(!e)return"";try{i=JSON.parse(e)}catch(e){}if(!i)return e;var t="",r=!0,a=!1,l=void 0;try{for(var i,s,u=Object.entries(i)[Symbol.iterator]();!(r=(s=u.next()).done);r=!0){var o=(0,n._)(s.value,2),d=o[0],c=o[1];c&&d&&(t+=c+", ")}}catch(e){a=!0,l=e}finally{try{r||null==u.return||u.return()}finally{if(a)throw l}}return t},l=function(e){if(!e)return"";try{i=JSON.parse(e)}catch(e){}if(!i)return e;var t="",r=!0,a=!1,l=void 0;try{for(var i,s,u=Object.entries(i)[Symbol.iterator]();!(r=(s=u.next()).done);r=!0){var o=(0,n._)(s.value,2),d=o[0],c=o[1];c&&d&&(t+="".concat(d,": ").concat(c,"\n"))}}catch(e){a=!0,l=e}finally{try{r||null==u.return||u.return()}finally{if(a)throw l}}return t},i=function(e){var t,r;if(e){try{r=JSON.parse(e)}catch(e){}r||(t=e),r&&"object"!=typeof r&&(t=r,r=void 0)}return{addressString:t,addressJson:r}}},90190:function(e,t,r){r.r(t),r.d(t,{default:function(){return b}});var n=r(81862),a=r(87612),l=r(85333),i=r(6692),s=r(89290),u=r(5163),o=r(52322),d=r(63756),c=r(98317),y=r(92390),f=r(54698),p=r(2784),m=r(80843),v=r(90379),h=r(29177);function b(){var e,t,r=(0,c.getGraphQLClient)(),b=(0,s._)((0,p.useState)([]),2),g=b[0],x=b[1],S=(e=(0,n._)(function(){var e,t;return(0,u.__generator)(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,(0,c.getGraphQLClient)().getRoles({pagedParams:{pageSize:1e3}})];case 1:return x(null!==(t=null==(e=r.sent())?void 0:e.elements)&&void 0!==t?t:[]),[3,3];case 2:return console.error(r.sent()),[3,3];case 3:return[2]}})}),function(){return e.apply(this,arguments)});return(0,p.useEffect)(function(){S()},[]),(0,o.jsx)(m.Z,{entityCategory:d.EDBEntity.User,entityListRoute:v.sG.route,entityBaseRoute:v.Uu.baseRoute,listLabel:"Users",entityLabel:"User",getById:r.getUserById,update:r.updateUser,create:r.createUser,deleteOne:r.deleteUser,fields:[{key:"fullName",type:"Simple text",label:"Full name",required:!0,width:{sm:6}},{key:"avatar",type:"Image",label:"Avatar",width:{sm:6}},{key:"email",type:"Simple text",label:"Email",required:!0,width:{sm:6}},{key:"password",type:"Simple text",label:"Password",simpleTextType:"password",required:!0,onlyOnCreate:!0,width:{sm:6}},{key:"roles",type:"Select",label:"Role",required:!0,customGraphQlFragment:"roles {\n              name\n              permissions\n              title\n          }",options:g.map(function(e){return{label:null!==(t=e.title)&&void 0!==t?t:e.name,value:e.name}}),saveValue:function(e){return{roles:e&&[e]}},getInitialValue:function(e){var t;return null==e?void 0:null===(t=e[0])||void 0===t?void 0:t.name},width:{sm:6}},{key:"bio",type:"Simple text",label:"Bio",simpleTextType:"textarea"},{key:"address",type:"Simple text",label:"Address",component:function(e){var t=e.value,r=e.onChange,n=(0,h.Cy)(t),u=n.addressString,d=n.addressJson;return d?(0,o.jsx)(o.Fragment,{children:Object.entries(d).map(function(e){var t=(0,s._)(e,2),n=t[0],u=t[1];return(0,o.jsx)(y.ZP,{item:!0,xs:12,sm:6,children:(0,o.jsx)(f.Z,{label:n,value:u||"",fullWidth:!0,variant:"standard",style:{margin:"10px 0"},onChange:function(e){var t=e.target.value;r(JSON.stringify((0,i._)((0,l._)({},d),(0,a._)({},n,t))))}})},n)})}):(0,o.jsx)(f.Z,{label:"Address",value:u||"",fullWidth:!0,variant:"standard",style:{margin:"10px 0"},onChange:function(e){r(e.target.value)}})}},{key:"phone",type:"Simple text",label:"Phone",width:{sm:6}}]})}}}]);