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