import{c as A}from"./crud-CjEsxyNP.js";import{_ as D,Z as B,am as U,aq as V,a as F,E as M,e as y,o as d,g as f,c as l,f as p,w as o,F as S,h as N,i as I,t as L,J as m,j,a2 as q,a3 as J,as as K,at as P,n as Z,v as z,B as G,aw as H}from"./app-DGDivIsO.js";import{A as Q,f as R}from"./AddEdit-Ctxjpq3V.js";const W={props:{showFilter:{default:!0},panelType:{type:String,default:"admin"}},emits:["addOrEditSuccess"],components:{PlusOutlined:B,EditOutlined:U,DeleteOutlined:V,AddEdit:Q},setup(e,{emit:i}){const{permsArray:s,appSetting:n}=F(),{url:b,addEditUrl:h,initData:c,columns:_,filterableColumns:u}=R(e.panelType),a=A();return M(()=>{a.tableUrl.value={url:b},a.table.filterableColumns=u,a.fetch({page:1}),a.crudUrl.value=h,a.langKey.value="currency",a.initData.value={...c},a.formData.value={...c}}),{appSetting:n,permsArray:s,columns:_,...a,filterableColumns:u,addOrEditSuccess:r=>{a.addEditSuccess(r),i("addOrEditSuccess",{action_type:a.addEditType.value,xid:r})}}}},X={class:"table-responsive"};function Y(e,i,s,n,b,h){const c=y("AddEdit"),_=q,u=J,a=K,E=P,r=Z,v=z,T=y("EditOutlined"),C=G,k=y("DeleteOutlined"),w=H;return d(),f("div",null,[l(c,{addEditType:e.addEditType,visible:e.addEditVisible,url:e.addEditUrl,onAddEditSuccess:n.addOrEditSuccess,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"]),s.showFilter?(d(),p(v,{key:0,gutter:[15,15],class:"mb-20"},{default:o(()=>[l(r,{xs:24,sm:24,md:12,lg:8,xl:8},{default:o(()=>[l(E,{compact:""},{default:o(()=>[l(u,{style:{width:"25%"},value:e.table.searchColumn,"onUpdate:value":i[0]||(i[0]=t=>e.table.searchColumn=t),placeholder:e.$t("common.select_default_text",[""])},{default:o(()=>[(d(!0),f(S,null,N(n.filterableColumns,t=>(d(),p(_,{key:t.key},{default:o(()=>[I(L(t.value),1)]),_:2},1024))),128))]),_:1},8,["value","placeholder"]),l(a,{style:{width:"75%"},value:e.table.searchString,"onUpdate:value":i[1]||(i[1]=t=>e.table.searchString=t),"show-search":"",onChange:e.onTableSearch,onSearch:e.onTableSearch,loading:e.table.filterLoading},null,8,["value","onChange","onSearch","loading"])]),_:1})]),_:1})]),_:1})):m("",!0),l(v,{class:"mt-20"},{default:o(()=>[l(r,{span:24},{default:o(()=>[j("div",X,[l(w,{columns:n.columns,"row-key":t=>t.xid,"data-source":e.table.data,pagination:e.table.pagination,loading:e.table.loading,onChange:e.handleTableChange},{bodyCell:o(({column:t,record:g})=>[t.dataIndex==="action"?(d(),f(S,{key:0},[s.panelType=="admin"&&(n.permsArray.includes("currencies_edit")||n.permsArray.includes("admin"))||s.panelType=="superadmin"?(d(),p(C,{key:0,type:"primary",onClick:O=>e.editItem(g),style:{"margin-left":"4px"}},{icon:o(()=>[l(T)]),_:2},1032,["onClick"])):m("",!0),(s.panelType=="admin"&&(n.permsArray.includes("currencies_delete")||n.permsArray.includes("admin"))||s.panelType=="superadmin")&&n.appSetting.x_currency_id!=g.xid?(d(),p(C,{key:1,type:"primary",onClick:O=>e.showDeleteConfirm(g.xid),style:{"margin-left":"4px"}},{icon:o(()=>[l(k)]),_:2},1032,["onClick"])):m("",!0)],64)):m("",!0)]),_:1},8,["columns","row-key","data-source","pagination","loading","onChange"])])]),_:1})]),_:1})])}const ae=D(W,[["render",Y]]);export{ae as C};
