import{u as I,s as $,j as a,k as K,l as M,d as _,w as R,o as i,b as s,E as U,D as z,m as t,c as T,e as v,f as B,a as q,t as C}from"./Bgmy51Qv.js";import{_ as G}from"./D_7E8SMU.js";import{A as H}from"./AmaTRG5a.js";import{_ as J}from"./DIkWVjrx.js";import{u as O}from"./7pZkuj9N.js";import{u as Q}from"./DFDXfcnr.js";import{u as W}from"./DKgjlGGV.js";import"./DuhDFJjj.js";import"./CNIrc0EA.js";const X={key:0,class:"spinner-wrapper"},Y={class:"input-wrapper single-line"},Z={class:"input-wrapper single-line"},ee={class:"input-wrapper single-line"},me={__name:"currency",setup(te){const{getById:h}=O(),w=I(),{setting:n}=$(w),{setCurrency:x}=w,S=Q(),{currencyList:b,decimalFormatList:P}=$(S),{setCurrencyList:D,setDecimalFormatList:F}=S,m=a(null),r=a("en-US"),c=a(1),l=a(!1),f=a(!1),L=a(!1),{currencyPositions:N}=W(),g=K(()=>{var e;return((e=n.value)==null?void 0:e.currency)||"USD"}),p=a("$"),j=e=>{r.value=e.key},A=e=>{c.value=e.key},E=e=>{m.value=e.key,p.value=e.value.symbolNative},V=async()=>{m.value&&p.value&&c.value&&(f.value=!0,await x({currency:m.value||g.value,currency_icon:p.value,decimal_format:r.value,currency_position:c.value}),f.value=!1)};return M(async()=>{var e,k,d,o,y;if(!b.value){l.value=!0;const u=await h({params:null,id:"currencies",api:"resource"});D(u),l.value=!1}if(!P.value){l.value=!0;const u=await h({params:null,id:"decimalFormats",api:"resource"});F(u),l.value=!1}m.value=(e=n.value)==null?void 0:e.currency,p.value=(k=n.value)==null?void 0:k.currency_icon,c.value=(d=n.value)==null?void 0:d.currency_position,(o=n.value)!=null&&o.decimal_format&&(r.value=(y=n.value)==null?void 0:y.decimal_format)}),(e,k)=>{const d=q,o=G,y=H,u=J;return i(),_(u,{"active-route":"currency",class:"mb-5"},{rightArea:R(()=>[s("form",{class:z({"has-error":t(L)}),onSubmit:U(V,["prevent"])},[t(l)?(i(),T("div",X,[B(d,{radius:60,color:"primary",class:"mr-15"})])):v("",!0),s("div",Y,[s("label",null,C(e.$t("setting.cur")),1),t(g)?(i(),_(o,{key:0,"selected-key":t(g),options:t(b),"key-name":"name",searching:!0,onClicked:E},null,8,["selected-key","options"])):v("",!0)]),s("div",Z,[s("label",null,C(e.$t("setting.curPos")),1),B(o,{selectedKey:`${t(c)}`,options:t(N),onClicked:A},null,8,["selectedKey","options"])]),s("div",ee,[s("label",null,C(e.$t("dataPage.df")),1),t(r)?(i(),_(o,{key:0,"selected-key":t(r),options:t(P),"key-name":"name",searching:!0,onClicked:j},null,8,["selected-key","options"])):v("",!0)]),e.$can("setting","edit")?(i(),_(y,{key:1,class:"primary-btn",text:e.$t("dataPage.uc"),"fetching-data":t(f)},null,8,["text","fetching-data"])):v("",!0)],34)]),_:1})}}};export{me as default};
