import{A as z,f as H}from"./fields-D1C-O0HF.js";import{c as I}from"./crud-HgA7krBk.js";import{_ as j,R as F,az as G,aA as L,b as q,E as J,r as s,o as d,c as y,a as n,w as a,G as b,l as r,t as u,i as c,k as m,M as Q,j as W,ay as X,aB as Y,aC as Z,B as x,a0 as ee,q as ne,aD as ae,aE as te,aF as oe,h as le,J as se,aG as de}from"./app-DyK1k-lL.js";import{A as ie}from"./AdminPageHeader-DvckKcMF.js";import"./apiAdmin-I34Xe3Oj.js";import"./SaveOutlined-BNo3Yq0P.js";import"./datatable-CE60mo9E.js";import"./filter-D9xdVtXb.js";import"./index-IxYN3YHr.js";const re={components:{PlusOutlined:F,EditOutlined:G,DeleteOutlined:L,AddEdit:z,AdminPageHeader:ie},setup(){const{addEditUrl:e,initData:i,columns:h,filterableColumns:t}=H(),l=I(),{permsArray:C}=q();return J(()=>{l.tableUrl.value={url:"expense-categories?fields=id,xid,name,description"},l.table.filterableColumns=t,l.fetch({page:1}),l.crudUrl.value=e,l.langKey.value="expense_category",l.initData.value={...i},l.formData.value={...i}}),{columns:h,...l,filterableColumns:t,permsArray:C}}},ue={class:"table-responsive"};function ce(e,i,h,t,l,C){const v=X,E=s("router-link"),g=Y,w=Z,D=s("AdminPageHeader"),S=s("PlusOutlined"),_=x,k=s("DeleteOutlined"),O=ee,p=ne,T=de,B=ae,P=te,U=oe,f=le,V=s("admin-page-filters"),M=s("AddEdit"),R=s("EditOutlined"),K=se,N=s("admin-page-table-content");return d(),y(b,null,[n(D,null,{header:a(()=>[n(v,{title:e.$t("menu.expense_categories"),class:"p-0"},null,8,["title"])]),breadcrumb:a(()=>[n(w,{separator:"-",style:{"font-size":"12px"}},{default:a(()=>[n(g,null,{default:a(()=>[n(E,{to:{name:"admin.dashboard.index"}},{default:a(()=>[r(u(e.$t("menu.dashboard")),1)]),_:1},8,["to"])]),_:1}),n(g,null,{default:a(()=>[r(u(e.$t("menu.expense_manager")),1)]),_:1}),n(g,null,{default:a(()=>[r(u(e.$t("menu.expense_categories")),1)]),_:1})]),_:1})]),_:1}),n(V,null,{default:a(()=>[n(f,{gutter:[16,16]},{default:a(()=>[n(p,{xs:24,sm:24,md:12,lg:10,xl:10},{default:a(()=>[n(O,null,{default:a(()=>[t.permsArray.includes("expense_categories_create")||t.permsArray.includes("admin")?(d(),c(_,{key:0,type:"primary",onClick:e.addItem},{default:a(()=>[n(S),r(" "+u(e.$t("expense_category.add")),1)]),_:1},8,["onClick"])):m("",!0),e.table.selectedRowKeys.length>0&&(t.permsArray.includes("expense_categories_delete")||t.permsArray.includes("admin"))?(d(),c(_,{key:1,type:"primary",onClick:e.showSelectedDeleteConfirm,danger:""},{icon:a(()=>[n(k)]),default:a(()=>[r(" "+u(e.$t("common.delete")),1)]),_:1},8,["onClick"])):m("",!0)]),_:1})]),_:1}),n(p,{xs:24,sm:24,md:12,lg:14,xl:14},{default:a(()=>[n(f,{gutter:[16,16],justify:"end"},{default:a(()=>[n(p,{xs:24,sm:24,md:12,lg:12,xl:10},{default:a(()=>[n(U,{compact:""},{default:a(()=>[n(B,{style:{width:"25%"},value:e.table.searchColumn,"onUpdate:value":i[0]||(i[0]=o=>e.table.searchColumn=o),placeholder:e.$t("common.select_default_text",[""])},{default:a(()=>[(d(!0),y(b,null,Q(t.filterableColumns,o=>(d(),c(T,{key:o.key},{default:a(()=>[r(u(o.value),1)]),_:2},1024))),128))]),_:1},8,["value","placeholder"]),n(P,{style:{width:"75%"},value:e.table.searchString,"onUpdate:value":i[1]||(i[1]=o=>e.table.searchString=o),"show-search":"",onChange:e.onTableSearch,onSearch:e.onTableSearch,loading:e.table.filterLoading},null,8,["value","onChange","onSearch","loading"])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),n(N,null,{default:a(()=>[n(M,{addEditType:e.addEditType,visible:e.addEditVisible,url:e.addEditUrl,onAddEditSuccess:e.addEditSuccess,onClosed:e.onCloseAddEdit,formData:e.formData,data:e.viewData,pageTitle:e.pageTitle,successMessage:e.successMessage},null,8,["addEditType","visible","url","onAddEditSuccess","onClosed","formData","data","pageTitle","successMessage"]),n(f,null,{default:a(()=>[n(p,{span:24},{default:a(()=>[W("div",ue,[n(K,{"row-selection":{selectedRowKeys:e.table.selectedRowKeys,onChange:e.onRowSelectChange,getCheckboxProps:o=>({disabled:!1,name:o.xid})},columns:t.columns,"row-key":o=>o.xid,"data-source":e.table.data,pagination:e.table.pagination,loading:e.table.loading,onChange:e.handleTableChange,bordered:"",size:"middle"},{bodyCell:a(({column:o,record:A})=>[o.dataIndex==="action"?(d(),y(b,{key:0},[t.permsArray.includes("expense_categories_edit")||t.permsArray.includes("admin")?(d(),c(_,{key:0,type:"primary",onClick:$=>e.editItem(A),style:{"margin-left":"4px"}},{icon:a(()=>[n(R)]),_:2},1032,["onClick"])):m("",!0),t.permsArray.includes("expense_categories_delete")||t.permsArray.includes("admin")?(d(),c(_,{key:1,type:"primary",onClick:$=>e.showDeleteConfirm(A.xid),style:{"margin-left":"4px"}},{icon:a(()=>[n(k)]),_:2},1032,["onClick"])):m("",!0)],64)):m("",!0)]),_:1},8,["row-selection","columns","row-key","data-source","pagination","loading","onChange"])])]),_:1})]),_:1})]),_:1})],64)}const ke=j(re,[["render",ce]]);export{ke as default};
