"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1225],{51225:function(e,t,n){n.r(t),n.d(t,{default:function(){return g}});var l=n(81862),a=n(85333),i=n(6692),r=n(89290),u=n(8226),s=n(5163),o=n(52322),c=n(63756),p=n(98317),d=n(18588),m=n(2784),f=n(1441),h=n(90379),v=n(74531),b=n(98099);function g(){var e,t,n,g,y=(0,p.getGraphQLClient)(),_=(0,r._)((0,m.useState)(null),2),w=_[0],P=_[1],S=(0,r._)((0,m.useState)(null),2),x=S[0],V=S[1],O={whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},j=(e=(0,l._)(function(){var e,t;return(0,s.__generator)(this,function(n){switch(n.label){case 0:return[4,y.getUsers({pagedParams:{pageSize:1e4},filterParams:{permissions:["create_post","update_post","all"]}}).catch(function(e){console.error(e)})];case 1:return P(null!==(t=null==(e=n.sent())?void 0:e.elements)&&void 0!==t?t:[]),[2]}})}),function(){return e.apply(this,arguments)}),D=(t=(0,l._)(function(){var e,t,n;return(0,s.__generator)(this,function(l){switch(l.label){case 0:return[4,null==y?void 0:y.getTags({pagedParams:{pageSize:1e4}}).catch(function(e){console.error(e)})];case 1:return V(null!==(n=null==(t=null===(e=l.sent())||void 0===e?void 0:e.elements)?void 0:t.sort(function(e,t){return e.name<t.name?-1:1}))&&void 0!==n?n:[]),[2]}})}),function(){return t.apply(this,arguments)});return(0,m.useEffect)(function(){j(),D()},[]),(0,o.jsx)(f.Z,{entityCategory:c.EDBEntity.Post,entityListRoute:h.pv.route,entityBaseRoute:h.QW.baseRoute,listLabel:"Posts",entityLabel:"Post",nameProperty:"title",getMany:y.getPosts,deleteOne:y.deletePost,deleteMany:y.deleteManyPosts,columns:[{name:"mainImage",label:"Image",type:"Image",visible:!0},{name:"title",label:"Title",type:"Simple text",visible:!0,minWidth:"25%",width:"25%"},{name:"author",label:"Author",type:"Simple text",visible:!0,customGraphQlFragment:"author {\n id\n fullName\n }\n",getValueView:function(e){return(0,o.jsx)("p",{style:O,children:null==e?void 0:e.fullName})},searchOptions:null!==(n=null==w?void 0:w.map(function(e){return{value:e.id,label:e.fullName}}))&&void 0!==n?n:[],applyFilter:function(e,t){return t.authorId=e,t}},{name:"published",label:"Status",type:"Simple text",visible:!0,exactSearch:!0,searchOptions:[{label:"Published",value:!0},{label:"Draft",value:!1}],getValueView:function(e){return(0,o.jsx)("p",{style:O,children:e?"Published":"Draft"})}},{name:"publishDate",label:"Published at",type:"Datetime",visible:!0,getValueView:function(e){return(0,b.BK)(e)}},{name:"tags",label:"Tags",type:"Simple text",visible:!0,disableSort:!0,customGraphQlFragment:"tags {\n id\n name\n }\n",getValueView:function(e){var t,n,l=null!==(n=null===(t=null==e?void 0:e.map(function(e){return e.name}))||void 0===t?void 0:t.join(", "))&&void 0!==n?n:"";return l?(0,o.jsx)(d.Z,{title:l,children:(0,o.jsx)("p",{style:O,children:l})}):""},multipleOptions:!0,searchOptions:null!==(g=null==x?void 0:x.map(function(e){return{value:e.id,label:e.name}}))&&void 0!==g?g:[],applyFilter:function(e,t){var n=[];if("string"==typeof e)try{n=JSON.parse(e)}catch(e){console.error(e)}return"number"==typeof e&&n.push(e),t.tagIds=n,t}}].concat((0,u._)(v.xz.map(function(e){return"createDate"===e.name?(0,i._)((0,a._)({},e),{visible:!0}):(0,i._)((0,a._)({},e),{visible:!1})})))})}}}]);