import{u as $,_ as h,d as k,a0 as D,a as C,Q as I,e as O,w as a,b as E,o as w,g as o,i as f,t as d}from"./app-D7zH3Nl5.js";import{a as A}from"./apiAdmin-B6-2qm0d.js";import{S as M}from"./SaveOutlined-jkHaLNj1.js";import{P as U}from"./index-BUzTR6QN.js";import{M as q}from"./index-fjGxdX_x.js";import{F as B,_ as T}from"./index-DZxk72Vu.js";import{I as R}from"./index-Cu62pBdq.js";import"./index-twmpq7Gp.js";import{_ as F,R as N}from"./RadioButton-BeQscLER.js";import{B as P}from"./useFlexGapSupport-CpBR-RD-.js";import{_ as V,a as W}from"./index-Cv7zOydE.js";const oe=e=>{const n=e=="admin"?"currencies?fields=id,xid,name,symbol,position,code":"superadmin/currencies?fields=id,xid,name,symbol,position,code",p=e=="admin"?"currencies":"superadmin/currencies",{t}=$(),i={name:"",symbol:"",position:"",code:""},u=[{title:t("currency.name"),dataIndex:"name"},{title:t("currency.symbol"),dataIndex:"symbol"},{title:t("currency.position"),dataIndex:"position"},{title:t("currency.code"),dataIndex:"code"},{title:t("common.action"),dataIndex:"action"}],l=[{key:"name",value:t("common.name")}];return{url:n,addEditUrl:p,initData:i,columns:u,filterableColumns:l}},L=k({props:["formData","data","visible","url","addEditType","pageTitle","successMessage"],emits:["addOrEditSuccess"],components:{PlusOutlined:U,LoadingOutlined:D,SaveOutlined:M},setup(e,{emit:n}){const{addEditRequestAdmin:p,loading:t,rules:i}=A(),{appSetting:u}=C(),l=I();return{loading:t,rules:i,onClose:()=>{i.value={},n("closed")},onSubmit:()=>{p({url:e.url,data:e.formData,successMessage:e.successMessage,success:s=>{u.value&&u.value.currency&&u.value.currency.xid==s.xid&&l.updateAppAction(),n("addEditSuccess",s.xid)}})},drawerWidth:window.innerWidth<=991?"90%":"45%"}}});function Q(e,n,p,t,i,u){const l=R,m=T,c=W,s=V,y=N,_=F,v=B,g=E("SaveOutlined"),b=P,S=q;return w(),O(S,{open:e.visible,closable:!1,centered:!0,title:e.pageTitle,onOk:e.onSubmit},{footer:a(()=>[o(b,{key:"submit",type:"primary",loading:e.loading,onClick:e.onSubmit},{icon:a(()=>[o(g)]),default:a(()=>[f(" "+d(e.addEditType=="add"?e.$t("common.create"):e.$t("common.update")),1)]),_:1},8,["loading","onClick"]),o(b,{key:"back",onClick:e.onClose},{default:a(()=>[f(d(e.$t("common.cancel")),1)]),_:1},8,["onClick"])]),default:a(()=>[o(v,{layout:"vertical"},{default:a(()=>[o(s,{gutter:16},{default:a(()=>[o(c,{xs:24,sm:24,md:24,lg:24},{default:a(()=>[o(m,{label:e.$t("currency.name"),name:"name",help:e.rules.name?e.rules.name.message:null,validateStatus:e.rules.name?"error":null,class:"required"},{default:a(()=>[o(l,{value:e.formData.name,"onUpdate:value":n[0]||(n[0]=r=>e.formData.name=r),placeholder:e.$t("common.placeholder_default_text",[e.$t("currency.name")])},null,8,["value","placeholder"])]),_:1},8,["label","help","validateStatus"])]),_:1})]),_:1}),o(s,{gutter:16},{default:a(()=>[o(c,{xs:24,sm:24,md:24,lg:24},{default:a(()=>[o(m,{label:e.$t("currency.symbol"),name:"symbol",help:e.rules.symbol?e.rules.symbol.message:null,validateStatus:e.rules.symbol?"error":null,class:"required"},{default:a(()=>[o(l,{value:e.formData.symbol,"onUpdate:value":n[1]||(n[1]=r=>e.formData.symbol=r),placeholder:e.$t("common.placeholder_default_text",[e.$t("currency.symbol")])},null,8,["value","placeholder"])]),_:1},8,["label","help","validateStatus"])]),_:1})]),_:1}),o(s,{gutter:16},{default:a(()=>[o(c,{xs:24,sm:24,md:24,lg:24},{default:a(()=>[o(m,{label:e.$t("currency.position"),name:"position",help:e.rules.position?e.rules.position.message:null,validateStatus:e.rules.position?"error":null},{default:a(()=>[o(_,{value:e.formData.position,"onUpdate:value":n[2]||(n[2]=r=>e.formData.position=r)},{default:a(()=>[o(y,{value:"front"},{default:a(()=>[f(d(e.$t("currency.front"))+" ("+d(e.$t("currency.front_position_example"))+") ",1)]),_:1}),o(y,{value:"behind"},{default:a(()=>[f(d(e.$t("currency.behind"))+" ("+d(e.$t("currency.behind_position_example"))+") ",1)]),_:1})]),_:1},8,["value"])]),_:1},8,["label","help","validateStatus"])]),_:1})]),_:1}),o(s,{gutter:16},{default:a(()=>[o(c,{xs:24,sm:24,md:24,lg:24},{default:a(()=>[o(m,{label:e.$t("currency.code"),name:"code",help:e.rules.code?e.rules.code.message:null,validateStatus:e.rules.code?"error":null,class:"required"},{default:a(()=>[o(l,{value:e.formData.code,"onUpdate:value":n[3]||(n[3]=r=>e.formData.code=r),placeholder:e.$t("common.placeholder_default_text",[e.$t("currency.code")])},null,8,["value","placeholder"])]),_:1},8,["label","help","validateStatus"])]),_:1})]),_:1})]),_:1})]),_:1},8,["open","title","onOk"])}const ae=h(L,[["render",Q]]);export{ae as A,oe as f};
