import{j as n}from"./chunk-JBNKEIUX.js";import"./chunk-5SW267PH.js";import"./chunk-PU7DBJLZ.js";import"./chunk-3DDBG3AR.js";import"./chunk-5MLUVH77.js";import"./chunk-SMMBZMNL.js";import"./chunk-S5GA3KRV.js";import"./chunk-EFONMPAR.js";import"./chunk-YQXLYYOT.js";import"./chunk-6RITFGP2.js";import"./chunk-HGXDKXJP.js";import"./chunk-WQUXAKOL.js";import"./chunk-LYNKRDJC.js";import"./chunk-SKY4LXUD.js";import"./chunk-BZT47AWD.js";import"./chunk-5WQBRAHK.js";import"./chunk-4FTRQKHH.js";import"./chunk-TTWRMELT.js";import"./chunk-EMJ4QQUL.js";import"./chunk-QPCAJSKO.js";import"./chunk-QV67LFVX.js";import"./chunk-4O3FVBGX.js";import{b}from"./chunk-TGWIHQDX.js";import{d as a}from"./chunk-Q5KZV54I.js";import{a as C}from"./chunk-YHVRQUSB.js";import"./chunk-3Z7PXZF3.js";import{a as A}from"./chunk-43BLBOSI.js";import"./chunk-IWSLIKCG.js";import"./chunk-2DXJE6G7.js";import"./chunk-7RP244JU.js";import"./chunk-LHGSJXTX.js";import"./chunk-ZKNPBXGB.js";import{b as S}from"./chunk-S3ADKFO2.js";import{E as w}from"./chunk-I5MYHHJE.js";import{$b as g,Fb as s,Ib as v,S as p,Wa as m,Xc as _,Zb as h,_b as y,f as d,gb as r,lb as f}from"./chunk-CKLXM6EG.js";import{a as c,b as u}from"./chunk-TSRGIXR5.js";var F=class l{constructor(i,e,t,o,T){this.apiService=i;this.route=e;this.translate=t;this.cdr=o;this.toast=T}title;urlApi;titleKey="";translationPrefix="currencies_and_taxes";fullWidthFields=["select","input","date","table","radio","textarea"];values;vendors;isEdit=!1;fields;destroy$=new d;mainFormComponent;titleOfButton;isShow;ngOnInit(){this.route.paramMap.subscribe(i=>{let e=this.route.snapshot.routeConfig?.path?.includes("show");this.isShow=e,console.log(e,"isShow");let t=this.route.snapshot.paramMap.get("id");t?e?(this.getDetails(t),this.title="show_currencies"):(this.getDetails(t),this.isEdit=!0,this.titleOfButton="edit",this.title="edit_currencies",this.urlApi=`procurement/currencies/update/${t}`):(this.isEdit=!1,this.titleOfButton="add",this.title="add_currencies",this.urlApi="procurement/currencies/store")}),this.fields=[{type:"input",title:"currency_ar",class:"col-6",controlName:"currency_ar",validators:[a.required]},{type:"input",title:"currency_en",class:"col-6",controlName:"currency_en",validators:[a.required]},{type:"input",title:"currency_symbol",class:"col-6",controlName:"currency_symbol",validators:[a.required]},{type:"input",title:"price_egp",inputType:"number",class:"col-6",showDecimals:!0,controlName:"price_egp",validators:[a.required]},{type:"radio",title:"is_active",controlName:"is_active",class:"col-6",options:[{name:this.translate.instant("yes"),id:1},{name:this.translate.instant("no"),id:0}],validators:[a.required],RadioDefaultValue:1}]}getDetails(i){this.apiService.Get(`procurement/currencies/show/${i}`).pipe(p(this.destroy$)).subscribe({next:e=>{this.values=e.data,console.log(e.data,"vvvvvvvvvvvvvvvv"),this.values=u(c({},this.values),{currency_ar:e.data.name_ar,currency_symbol:e.data.symbole,currency_en:e.data.name_en})},error:e=>{console.error("Error fetching employee:",e)}})}static \u0275fac=function(e){return new(e||l)(r(C),r(w),r(S),r(_),r(b))};static \u0275cmp=f({type:l,selectors:[["app-add-currency"]],viewQuery:function(e,t){if(e&1&&h(n,5),e&2){let o;y(o=g())&&(t.mainFormComponent=o.first)}},decls:2,vars:10,consts:[[3,"title","Translationprefix","showTitle","showBreadcrumb"],["routeAfterSuccess","/finance/currencies_and_taxes","titleOfButton2","cancel",3,"fields","url","formValues","fullWidthFields","readOnly","titleOfButton"]],template:function(e,t){e&1&&v(0,"app-page-title",0)(1,"app-main-form",1),e&2&&(s("title",t.title)("Translationprefix",t.translationPrefix)("showTitle",!0)("showBreadcrumb",!0),m(),s("fields",t.fields)("url",t.urlApi)("formValues",t.values)("fullWidthFields",t.fullWidthFields)("readOnly",t.isShow)("titleOfButton",t.titleOfButton))},dependencies:[n,A],encapsulation:2})};export{F as AddCurrency};
