import{a as S}from"./apiAdmin-D4J8O5cP.js";import{_ as $,x as k,Z as C,$ as h,e as D,o as w,f as O,w as n,c as o,i as p,t as _,a0 as E,a1 as I,n as T,v as B,a4 as M,a8 as A,B as U,al as q,b as N}from"./app-DGDivIsO.js";import{S as V}from"./SaveOutlined-saF8VQQc.js";const W=k({props:["formData","data","visible","url","addEditType","pageTitle","successMessage"],components:{PlusOutlined:C,LoadingOutlined:h,SaveOutlined:V},setup(e,{emit:a}){const{addEditRequestAdmin:s,loading:l,rules:t}=S();return{loading:l,rules:t,onClose:()=>{t.value={},a("closed")},onSubmit:()=>{s({url:e.url,data:e.formData,successMessage:e.successMessage,success:i=>{a("addEditSuccess",i.xid)}})},drawerWidth:window.innerWidth<=991?"90%":"45%"}}});function F(e,a,s,l,t,f){const r=E,i=I,u=T,m=B,g=M,v=A,b=D("SaveOutlined"),c=U,y=q;return w(),O(y,{open:e.visible,closable:!1,centered:!0,title:e.pageTitle,onOk:e.onSubmit},{footer:n(()=>[o(c,{key:"submit",type:"primary",loading:e.loading,onClick:e.onSubmit},{icon:n(()=>[o(b)]),default:n(()=>[p(" "+_(e.addEditType=="add"?e.$t("common.create"):e.$t("common.update")),1)]),_:1},8,["loading","onClick"]),o(c,{key:"back",onClick:e.onClose},{default:n(()=>[p(_(e.$t("common.cancel")),1)]),_:1},8,["onClick"])]),default:n(()=>[o(v,{layout:"vertical"},{default:n(()=>[o(m,{gutter:16},{default:n(()=>[o(u,{xs:24,sm:24,md:24,lg:24},{default:n(()=>[o(i,{label:e.$t("expense_category.name"),name:"name",help:e.rules.name?e.rules.name.message:null,validateStatus:e.rules.name?"error":null,class:"required"},{default:n(()=>[o(r,{value:e.formData.name,"onUpdate:value":a[0]||(a[0]=d=>e.formData.name=d),placeholder:e.$t("common.placeholder_default_text",[e.$t("expense_category.name")])},null,8,["value","placeholder"])]),_:1},8,["label","help","validateStatus"])]),_:1})]),_:1}),o(m,{gutter:16},{default:n(()=>[o(u,{xs:24,sm:24,md:24,lg:24},{default:n(()=>[o(i,{label:e.$t("expense_category.description"),name:"description",help:e.rules.description?e.rules.description.message:null,validateStatus:e.rules.description?"error":null},{default:n(()=>[o(g,{value:e.formData.description,"onUpdate:value":a[1]||(a[1]=d=>e.formData.description=d),placeholder:e.$t("common.placeholder_default_text",[e.$t("expense_category.description")]),rows:4},null,8,["value","placeholder"])]),_:1},8,["label","help","validateStatus"])]),_:1})]),_:1})]),_:1})]),_:1},8,["open","title","onOk"])}const Z=$(W,[["render",F]]),j=()=>{const e="expense-categories",{t:a}=N(),s={name:"",description:""},l=[{title:a("expense_category.name"),dataIndex:"name",sorter:!0},{title:a("expense_category.description"),dataIndex:"description"},{title:a("common.action"),dataIndex:"action"}],t=[{key:"name",value:a("common.name")}];return{addEditUrl:e,initData:s,columns:l,filterableColumns:t}};export{Z as A,j as f};
