import{br as n,A as s,c as i}from"./index.cf09daef.js";const o=e=>[{label:e.$t("label.all"),value:null},{label:e.$t("label.active"),value:!0}],d=n("page",{state:()=>({rows:[],permissions:{new:"pages:new",edit:"pages:edit",delete:"pages:delete"}}),getters:{module:e=>({name:"Pages",label:e.$t("label.pages"),singular:e.$t("singular.page"),plural:e.$t("plural.pages")}),columns:e=>[{name:"title",align:"left",label:e.$t("label.title"),field:"title",style:"width: 200px; white-space: normal;",sortable:!0},{name:"template",align:"center",field:"template",style:"width: 15px;"},{name:"url",align:"center",field:"url",style:"width: 15px;"},{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:a=>a?"Yes":"No",style:"width: 40px",sortable:!0},{name:"actions",align:"right",sortable:!1}],actions:e=>[{label:e.$t("label.edit"),permission:"pages:edit",action:"route",route:"Page",params:a=>({id:a.id}),query:a=>({action:"edit"}),icon:"fas fa-edit",deleted:!1},{label:e.$t("label.delete"),permission:"pages:delete",action:"delete",icon:"fas fa-trash-alt",deleted:!1},{label:e.$t("label.restore"),permission:"pages: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:o(e),prefix:e.$t("prefix.status"),deleted:"all",width:"6"},{icon:"fad fa-plus-circle",label:e.$t("label.addPage"),permission:"pages:new",action:"route",params:{id:"add"},route:"Page",color:"primary",deleted:"all",width:"6"}],templates:e=>[{label:e.$t("home"),value:"home"},{label:e.$t("singleBlogPage"),value:"blog"}]},actions:{get(e){return new Promise((a,l)=>{s.get("pages",e).then(t=>{this.rows=t.data,a(t)}).catch(t=>{l(t)})})},store(e){return new Promise((a,l)=>{s.post("pages/store",e).then(t=>{a(t)}).catch(t=>{l(t)})})},show(e){return new Promise((a,l)=>{s.get(`pages/${e}`).then(t=>{a(t)}).catch(t=>{l(t)})})},update(e){return new Promise((a,l)=>{s.put(`pages/${e.id}`,e).then(t=>{a(t)}).catch(t=>{l(t)})})},delete(e){return new Promise((a,l)=>{s.delete(`pages/${e}/destroy`).then(t=>{a(t)}).catch(t=>{l(t)})})},deleteSelected(e){return new Promise((a,l)=>{s.delete("pages/destroy",{items:e}).then(t=>{a(t)}).catch(t=>{l(t)})})},restore(e){return new Promise((a,l)=>{s.post(`pages/${e}/restore`).then(t=>{a(t)}).catch(t=>{l(t)})})},restoreSelected(e){return new Promise((a,l)=>{s.post("pages/restore",{items:e}).then(t=>{a(t)}).catch(t=>{l(t)})})},changeActive(e){return new Promise((a,l)=>{s.post(`pages/${e.id}/change-active`).then(t=>{e.is_active=!e.is_active;const{message:r}=t;i.success(r),a(t)}).catch(t=>{i.error(t),l(t)})})},shortCode(e){return new Promise((a,l)=>{s.get("application/short-code",e).then(t=>{a(t)}).catch(t=>{l(t)})})}}});export{d as u};
