"use strict";(self.webpackChunk_cromwell_admin_panel=self.webpackChunk_cromwell_admin_panel||[]).push([[48],{7048:(e,t,l)=>{l.r(t),l.d(t,{default:()=>p});var a=l(63756),i=l(49352),n=l(23883),s=l(2784),r=l(42934),o=l(8099),u=l(7736),m=l(25370);const d=r.Z;function p(){var e,t;const l=(0,i.getGraphQLClient)(),[r,p]=(0,s.useState)(null),[c,v]=(0,s.useState)(null),b={whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"};return(0,s.useEffect)((()=>{(async()=>{var e,t;const a=await l.getFilteredUsers({pagedParams:{pageSize:9999},filterParams:{role:"administrator"}}).catch((e=>{console.error(e)})),i=await l.getFilteredUsers({pagedParams:{pageSize:9999},filterParams:{role:"author"}}).catch((e=>{console.error(e)}));p([...null!==(e=null==a?void 0:a.elements)&&void 0!==e?e:[],...null!==(t=null==i?void 0:i.elements)&&void 0!==t?t:[]])})(),(async()=>{var e,t;const a=null===(e=await(null==l?void 0:l.getTags({pageSize:99999}).catch((e=>{console.error(e)}))))||void 0===e?void 0:e.elements;v(null!==(t=null==a?void 0:a.sort(((e,t)=>e.name<t.name?-1:1)))&&void 0!==t?t:[])})()}),[]),r&&c?s.createElement(d,{entityCategory:a.EDBEntity.Post,entityListRoute:u.pv.route,entityBaseRoute:u.QW.baseRoute,listLabel:"Posts",entityLabel:"Post",nameProperty:"title",getManyFiltered:l.getFilteredPosts,deleteOne:l.deletePost,deleteMany:l.deleteManyPosts,deleteManyFiltered:l.deleteManyFilteredPosts,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:e=>s.createElement("p",{style:b},null==e?void 0:e.fullName),searchOptions:null!==(e=null==r?void 0:r.map((e=>({value:e.id,label:e.fullName}))))&&void 0!==e?e:[],applyFilter:(e,t)=>(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:e=>s.createElement("p",{style:b},e?"Published":"Draft")},{name:"publishDate",label:"Published at",type:"Datetime",visible:!0},{name:"tags",label:"Tags",type:"Simple text",visible:!0,disableSort:!0,customGraphQlFragment:"tags {\n id\n name\n }\n",getValueView:e=>{var t,l;const a=null!==(l=null===(t=null==e?void 0:e.map((e=>e.name)))||void 0===t?void 0:t.join(", "))&&void 0!==l?l:"";return s.createElement(n.Z,{title:a},s.createElement("p",{style:b},a))},multipleOptions:!0,searchOptions:null!==(t=null==c?void 0:c.map((e=>({value:e.id,label:e.name}))))&&void 0!==t?t:[],applyFilter:(e,t)=>{let l=[];if("string"==typeof e)try{l=JSON.parse(e)}catch(e){console.error(e)}return"number"==typeof e&&l.push(e),t.tagIds=l,t}},...m.xz.map((e=>"createDate"===e.name?{...e,visible:!0}:{...e,visible:!1}))]}):s.createElement(o.Z,null)}}}]);