import{A as z,f as H}from"./fields-DksZS33k.js";import{c as I}from"./crud-CjEsxyNP.js";import{_ as j,Z as F,am as L,aq as q,a as J,E as Z,e as s,o as d,g as y,c as a,w as n,F as b,i as r,t as u,f as c,J as m,h as G,j as Q,az as W,aD as X,aE as Y,B as x,m as ee,n as ae,a3 as ne,as as te,at as oe,v as le,aw as se,a2 as de}from"./app-DGDivIsO.js";import{A as ie}from"./AdminPageHeader-ff2SFNbk.js";import"./apiAdmin-D4J8O5cP.js";import"./SaveOutlined-saF8VQQc.js";import"./datatable-Cnt5bvOi.js";import"./filter-_TPdNMe8.js";import"./index-C2QBqMxH.js";const re={components:{PlusOutlined:F,EditOutlined:L,DeleteOutlined:q,AddEdit:z,AdminPageHeader:ie},setup(){const{addEditUrl:e,initData:i,columns:h,filterableColumns:t}=H(),l=I(),{permsArray:C}=J();return Z(()=>{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 A=W,E=s("router-link"),g=X,w=Y,S=s("AdminPageHeader"),D=s("PlusOutlined"),p=x,k=s("DeleteOutlined"),O=ee,_=ae,T=de,B=ne,P=te,U=oe,f=le,V=s("admin-page-filters"),K=s("AddEdit"),M=s("EditOutlined"),N=se,R=s("admin-page-table-content");return d(),y(b,null,[a(S,null,{header:n(()=>[a(A,{title:e.$t("menu.expense_categories"),class:"p-0"},null,8,["title"])]),breadcrumb:n(()=>[a(w,{separator:"-",style:{"font-size":"12px"}},{default:n(()=>[a(g,null,{default:n(()=>[a(E,{to:{name:"admin.dashboard.index"}},{default:n(()=>[r(u(e.$t("menu.dashboard")),1)]),_:1})]),_:1}),a(g,null,{default:n(()=>[r(u(e.$t("menu.expense_manager")),1)]),_:1}),a(g,null,{default:n(()=>[r(u(e.$t("menu.expense_categories")),1)]),_:1})]),_:1})]),_:1}),a(V,null,{default:n(()=>[a(f,{gutter:[16,16]},{default:n(()=>[a(_,{xs:24,sm:24,md:12,lg:10,xl:10},{default:n(()=>[a(O,null,{default:n(()=>[t.permsArray.includes("expense_categories_create")||t.permsArray.includes("admin")?(d(),c(p,{key:0,type:"primary",onClick:e.addItem},{default:n(()=>[a(D),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(p,{key:1,type:"primary",onClick:e.showSelectedDeleteConfirm,danger:""},{icon:n(()=>[a(k)]),default:n(()=>[r(" "+u(e.$t("common.delete")),1)]),_:1},8,["onClick"])):m("",!0)]),_:1})]),_:1}),a(_,{xs:24,sm:24,md:12,lg:14,xl:14},{default:n(()=>[a(f,{gutter:[16,16],justify:"end"},{default:n(()=>[a(_,{xs:24,sm:24,md:12,lg:12,xl:10},{default:n(()=>[a(U,{compact:""},{default:n(()=>[a(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:n(()=>[(d(!0),y(b,null,G(t.filterableColumns,o=>(d(),c(T,{key:o.key},{default:n(()=>[r(u(o.value),1)]),_:2},1024))),128))]),_:1},8,["value","placeholder"]),a(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}),a(R,null,{default:n(()=>[a(K,{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"]),a(f,null,{default:n(()=>[a(_,{span:24},{default:n(()=>[Q("div",ue,[a(N,{"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:n(({column:o,record:v})=>[o.dataIndex==="action"?(d(),y(b,{key:0},[t.permsArray.includes("expense_categories_edit")||t.permsArray.includes("admin")?(d(),c(p,{key:0,type:"primary",onClick:$=>e.editItem(v),style:{"margin-left":"4px"}},{icon:n(()=>[a(M)]),_:2},1032,["onClick"])):m("",!0),t.permsArray.includes("expense_categories_delete")||t.permsArray.includes("admin")?(d(),c(p,{key:1,type:"primary",onClick:$=>e.showDeleteConfirm(v.xid),style:{"margin-left":"4px"}},{icon:n(()=>[a(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};
