import{br as r,A as s,c as i}from"./index.cf09daef.js";const n=e=>[{label:e.$t("label.all"),value:null},{label:e.$t("label.active"),value:"Active"}],d=r("blog",{state:()=>({rows:[],permissions:{new:"blogs:new",edit:"blogs:edit",delete:"blogs:delete"}}),getters:{module:e=>({name:"Blogs",label:e.$t("label.blogs"),singular:e.$t("singular.blog"),plural:e.$t("plural.blogs")}),columns:e=>[{name:"thumbnail",align:"left",field:"thumbnail",style:"width: 40px;"},{name:"title",align:"left",label:e.$t("label.title"),field:"title",style:"width: 200px; white-space: normal;",sortable:!0},{name:"url",align:"center",field:"url",style:"width: 15px;"},{name:"tags",align:"left",label:e.$t("label.tags"),field:"tags",style:"width: 250px; white-space: normal;",sortable:!0},{name:"created_at",align:"left",label:e.$t("label.createdAt"),field:"created_at",style:"width: 40px",sortable:!0},{name:"is_active",align:"left",label:e.$t("label.active"),field:"is_active",format:l=>l?"Yes":"No",style:"width: 40px",sortable:!0},{name:"actions",align:"right",sortable:!1}],actions:e=>[{label:e.$t("label.edit"),permission:"blogs:edit",action:"route",route:"Blog",params:l=>({id:l.id}),query:l=>({action:"edit"}),icon:"fas fa-edit",deleted:!1},{label:e.$t("label.delete"),permission:"blogs:delete",action:"delete",icon:"fas fa-trash-alt",deleted:!1},{label:e.$t("label.restore"),permission:"blogs:delete",action:"restore",icon:"fas fa-trash-undo",deleted:!0}],toolbar:e=>[{title:e.$t("label.status"),action:"request",component:"base-select",dense:!0,outlined:!0,key:"active",placeholder:"Select",optionsDense:!0,style:"width: 150px",mapOptions:!0,emitValue:!0,options:n(e),prefix:e.$t("prefix.status"),deleted:"all",width:"6"},{icon:"fad fa-plus-circle",label:e.$t("label.addBlog"),permission:"blogs:new",action:"route",params:{id:"add"},route:"Blog",color:"primary",deleted:"all",width:"6"}]},actions:{get(e){return new Promise((l,a)=>{s.get("blogs",e).then(t=>{this.rows=t.data,l(t)}).catch(t=>{a(t)})})},store(e){return new Promise((l,a)=>{s.post("blogs/store",e).then(t=>{l(t)}).catch(t=>{a(t)})})},show(e){return new Promise((l,a)=>{s.get(`blogs/${e}`).then(t=>{l(t)}).catch(t=>{a(t)})})},update(e){return new Promise((l,a)=>{s.put(`blogs/${e.id}`,e).then(t=>{l(t)}).catch(t=>{a(t)})})},delete(e){return new Promise((l,a)=>{s.delete(`blogs/${e}/destroy`).then(t=>{l(t)}).catch(t=>{a(t)})})},deleteSelected(e){return new Promise((l,a)=>{s.delete("blogs/destroy",{items:e}).then(t=>{l(t)}).catch(t=>{a(t)})})},restore(e){return new Promise((l,a)=>{s.post(`blogs/${e}/restore`).then(t=>{l(t)}).catch(t=>{a(t)})})},restoreSelected(e){return new Promise((l,a)=>{s.post("blogs/restore",{items:e}).then(t=>{l(t)}).catch(t=>{a(t)})})},changeActive(e){return new Promise((l,a)=>{s.post(`blogs/${e.id}/change-active`).then(t=>{e.is_active=!e.is_active;const{message:o}=t;i.success(o),l(t)}).catch(t=>{i.error(t),a(t)})})},comments(e){return new Promise((l,a)=>{s.post(`blogs/${e.moduleId}/comments`,e).then(t=>{l(t)}).catch(t=>{a(t)})})}}});export{d as u};
