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