import{_ as P}from"./vU4aS4uy.js";import{u as R}from"./BHvLfWtM.js";import{_ as z,c as d,o as n,b as r,W as v,f as O,J as T,t as f,e as x,E as N,F as D,g as B,d as y,w as u,O as U,j,m as i,G as $,H as L,K as C}from"./Bgmy51Qv.js";import{a as F}from"./Z4eZ-m2s.js";import{u as H}from"./CYl1ofbh.js";import"./BE7GDBwC.js";import"./DKgjlGGV.js";import"./7pZkuj9N.js";import"./hSbGpNHU.js";import"./DuhDFJjj.js";import"./ByXs6QR-.js";import"./D_7E8SMU.js";const M={name:"TreeNode",components:{},props:{node:{type:Object,required:!0}},data(){return{}},mixins:[R],methods:{editNode(e){this.$emit("edit",e)},deleteNode(e){this.$emit("delete",e)}}},S={class:"tree-node"},q={class:"o-flex gap-10 a-center"},G={class:"node-data"},J={class:"o-flex gap-10"};function K(e,o,t,a,k,l){const m=P,_=E;return n(),d("li",S,[r("div",q,[v(e.$slots,"checkbox",{id:t.node.id}),r("span",G,[O(m,{"lazy-src":e.getThumbImageURL(t.node.image),alt:t.node.title},null,8,["lazy-src","alt"]),T(" "+f(t.node.title),1)]),r("span",J,[e.$can("category","edit")?(n(),d("button",{key:0,class:"lite-btn",onClick:o[0]||(o[0]=N(s=>l.editNode(t.node),["prevent"]))},f(e.$t("category.edit")),1)):x("",!0),e.$can("category","delete")?(n(),d("button",{key:1,onClick:o[1]||(o[1]=N(s=>l.deleteNode(t.node),["prevent"])),class:"delete-btn lite-btn"},f(e.$t("category.delete")),1)):x("",!0)])]),r("ul",null,[(n(!0),d(D,null,B(t.node.child,s=>(n(),y(_,{key:s.id,node:s,onEdit:l.editNode,onDelete:l.deleteNode},{checkbox:u(({id:b})=>[v(e.$slots,"inner-checkbox",{id:s.id})]),_:2},1032,["node","onEdit","onDelete"]))),128))])])}const E=z(M,[["render",K]]),W={class:"table-tree"},A=["value"],Q=["value"],de={__name:"index",setup(e){const{t:o}=U(),t=j({created_at:{title:o("category.date")},title:{title:o("index.title")},status:{title:o("category.status")}}),{cbList:a,deleteBulk:k,listPageRef:l,setItemList:m,deleteNode:_,editNode:s}=H();return(b,c)=>{const V=E,w=F;return n(),y(w,{ref_key:"listPageRef",ref:l,"list-api":"getCategories","delete-api":"deleteCategory","route-name":"categories","empty-store-variable":"allCategories",name:b.$t("category.cat"),gate:"category","order-options":i(t),class:"tree-wrapper",onDeleteBulk:i(k),onList:i(m)},{table:u(({list:I})=>[r("ul",W,[(n(!0),d(D,null,B(I,h=>(n(),y(V,{node:h,key:h.id,onEdit:i(s),onDelete:i(_)},{checkbox:u(({id:p})=>[$(r("input",{type:"checkbox",value:p,"onUpdate:modelValue":c[0]||(c[0]=g=>L(a)?a.value=g:null)},null,8,A),[[C,i(a)]])]),"inner-checkbox":u(({id:p})=>[$(r("input",{type:"checkbox",value:p,"onUpdate:modelValue":c[1]||(c[1]=g=>L(a)?a.value=g:null)},null,8,Q),[[C,i(a)]])]),_:2},1032,["node","onEdit","onDelete"]))),128))])]),_:1},8,["name","order-options","onDeleteBulk","onList"])}}};export{de as default};
