import{a as k}from"./apiAdmin-B6-2qm0d.js";import{_ as h,d as C,e as w,w as a,g as o,i as u,t as d,b as D,a0 as E,k as F,m as O,o as I,u as T}from"./app-D7zH3Nl5.js";import{I as M}from"./index-Cu62pBdq.js";import{_ as B,F as U}from"./index-DZxk72Vu.js";import{B as A}from"./useFlexGapSupport-CpBR-RD-.js";import{M as V}from"./index-fjGxdX_x.js";import{S as q}from"./SaveOutlined-jkHaLNj1.js";import{P as N}from"./index-BUzTR6QN.js";import{_ as P,a as W}from"./index-Cv7zOydE.js";import{_ as x,a as z}from"./RadioButton-BeQscLER.js";import{_ as L}from"./TextArea-C1mL3q5m.js";const R=C({props:["formData","data","visible","url","addEditType","pageTitle","successMessage","expenseFor"],components:{PlusOutlined:N,LoadingOutlined:E,SaveOutlined:q},setup(e,{emit:n}){const{addEditRequestAdmin:m,loading:p,rules:s}=k(),t=F(),c=()=>{m({url:e.url,data:{...e.formData,expense_for:t.value},successMessage:e.successMessage,success:l=>{n("addEditSuccess",l.xid)}})},r=()=>{s.value={},n("closed")};return O(()=>e.visible,l=>{t.value="",e.addEditType==="edit"?t.value=e.data.expense_for||"all":t.value=e.expenseFor}),{loading:p,rules:s,onClose:r,onSubmit:c,expenseFor:t,drawerWidth:window.innerWidth<=991?"90%":"45%"}}});function j(e,n,m,p,s,t){const c=M,r=B,l=W,_=P,f=z,v=x,y=L,b=U,$=D("SaveOutlined"),g=A,S=V;return I(),w(S,{open:e.visible,closable:!1,centered:!0,title:e.pageTitle,onOk:e.onSubmit},{footer:a(()=>[o(g,{key:"submit",type:"primary",loading:e.loading,onClick:e.onSubmit},{icon:a(()=>[o($)]),default:a(()=>[u(" "+d(e.addEditType=="add"?e.$t("common.create"):e.$t("common.update")),1)]),_:1},8,["loading","onClick"]),o(g,{key:"back",onClick:e.onClose},{default:a(()=>[u(d(e.$t("common.cancel")),1)]),_:1},8,["onClick"])]),default:a(()=>[o(b,{layout:"vertical"},{default:a(()=>[o(_,{gutter:16},{default:a(()=>[o(l,{xs:24,sm:24,md:24,lg:24},{default:a(()=>[o(r,{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:a(()=>[o(c,{value:e.formData.name,"onUpdate:value":n[0]||(n[0]=i=>e.formData.name=i),placeholder:e.$t("common.placeholder_default_text",[e.$t("expense_category.name")])},null,8,["value","placeholder"])]),_:1},8,["label","help","validateStatus"])]),_:1})]),_:1}),o(_,{gutter:16},{default:a(()=>[o(l,{xs:24,sm:24,md:24,lg:24},{default:a(()=>[o(r,{label:e.$t("expense_category.expense_for"),name:"expense_for",help:e.rules.expense_for?e.rules.expense_for.message:null,validateStatus:e.rules.expense_for?"error":null},{default:a(()=>[o(v,{value:e.expenseFor,"onUpdate:value":n[1]||(n[1]=i=>e.expenseFor=i),"button-style":"solid",size:"small",disabled:!0},{default:a(()=>[o(f,{value:"all"},{default:a(()=>[u(d(e.$t("common.all")),1)]),_:1}),o(f,{value:"employee_specific"},{default:a(()=>[u(d(e.$t("common.employee_specific")),1)]),_:1}),o(f,{value:"company_specific"},{default:a(()=>[u(d(e.$t("common.company_specific")),1)]),_:1})]),_:1},8,["value"])]),_:1},8,["label","help","validateStatus"])]),_:1})]),_:1}),o(_,{gutter:16},{default:a(()=>[o(l,{xs:24,sm:24,md:24,lg:24},{default:a(()=>[o(r,{label:e.$t("expense_category.description"),name:"description",help:e.rules.description?e.rules.description.message:null,validateStatus:e.rules.description?"error":null},{default:a(()=>[o(y,{value:e.formData.description,"onUpdate:value":n[2]||(n[2]=i=>e.formData.description=i),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 ne=h(R,[["render",j]]),te=()=>{const e="expense-categories",{t:n}=T(),m={name:"",expense_for:"all",description:""},p=[{title:n("expense_category.name"),dataIndex:"name"},{title:n("expense_category.description"),dataIndex:"description"},{title:n("common.action"),dataIndex:"action"}],s=[{key:"name",value:n("common.name")}];return{addEditUrl:e,initData:m,columns:p,filterableColumns:s}};export{ne as A,te as f};
