import{j as c}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 as R}from"./chunk-TGWIHQDX.js";import{b as F,d as l,g as M,k as N,x as k}from"./chunk-Q5KZV54I.js";import{a as I}from"./chunk-YHVRQUSB.js";import"./chunk-3Z7PXZF3.js";import{a as j}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 B,d as D,f as P}from"./chunk-S3ADKFO2.js";import{E as O}from"./chunk-I5MYHHJE.js";import{$b as _,Fb as s,Fc as T,Gb as p,Gc as A,Hb as d,Ib as h,S as f,Tb as g,Wa as n,Xc as w,Zb as y,_b as x,f as u,gb as r,ic as C,jc as b,lb as v,xc as S}from"./chunk-CKLXM6EG.js";import"./chunk-TSRGIXR5.js";var V=a=>({is_default:a}),E=class a{constructor(i,t,e,o,m){this.apiService=i;this.route=t;this.translate=e;this.cdr=o;this.toast=m}title;urlApi;titleKey="";translationPrefix="currencies_and_taxes";fullWidthFields=["select","input","date","table","radio","textarea"];values;vendors;isEdit=!1;fields;destroy$=new u;mainFormComponent;titleOfButton;isShow;ngOnInit(){this.route.paramMap.subscribe(i=>{let t=this.route.snapshot.routeConfig?.path?.includes("show");this.isShow=t,console.log(t,"isShow");let e=this.route.snapshot.paramMap.get("id");e?t?(this.getDetails(e),this.title="show_tax"):(this.getDetails(e),this.isEdit=!0,this.titleOfButton="edit",this.title="edit_tax",this.urlApi=`procurement/taxes/update/${e}`):(this.isEdit=!1,this.titleOfButton="add",this.title="add_tax",this.urlApi="procurement/taxes/store")}),this.fields=[{type:"input",title:"name_ar_tax",class:"col-6",controlName:"name_ar",validators:[l.required]},{type:"input",title:"name_en_tax",class:"col-6",controlName:"name_en",validators:[l.required]},{type:"input",title:"percentage_tax",class:"col-6",inputType:"number",controlName:"percentage",validators:[l.required]}]}getDetails(i){this.apiService.Get(`procurement/taxes/${i}`).pipe(f(this.destroy$)).subscribe({next:t=>{this.values=t.data,console.log(t.data,"vvvvvvvvvvvvvvvv"),this.approveOrNotCheckbox=t.data.is_default},error:t=>{console.error("Error fetching employee:",t)}})}approveOrNotCheckbox=0;toggleApprove(i){this.approveOrNotCheckbox=i?1:0}static \u0275fac=function(t){return new(t||a)(r(I),r(O),r(B),r(w),r(R))};static \u0275cmp=v({type:a,selectors:[["app-add-tax"]],viewQuery:function(t,e){if(t&1&&y(c,5),t&2){let o;x(o=_())&&(e.mainFormComponent=o.first)}},decls:7,vars:18,consts:[[3,"title","Translationprefix","showTitle","showBreadcrumb"],["routeAfterSuccess","/finance/currencies_and_taxes","titleOfButton2","cancel",3,"fields","url","formValues","fullWidthFields","readOnly","titleOfButton","extraPayload"],[1,"mt-5"],["type","checkbox","id","checkChecked",1,"form-check-input",3,"ngModelChange","disabled","ngModel"],[1,"px-2"]],template:function(t,e){t&1&&(h(0,"app-page-title",0),p(1,"app-main-form",1)(2,"div",2)(3,"input",3),g("ngModelChange",function(m){return e.toggleApprove(m)}),d(),p(4,"span",4),C(5),T(6,"translate"),d()()()),t&2&&(s("title",e.title)("Translationprefix",e.translationPrefix)("showTitle",!0)("showBreadcrumb",!0),n(),s("fields",e.fields)("url",e.urlApi)("formValues",e.values)("fullWidthFields",e.fullWidthFields)("readOnly",e.isShow)("titleOfButton",e.titleOfButton)("extraPayload",S(16,V,e.approveOrNotCheckbox)),n(2),s("disabled",e.isShow)("ngModel",e.approveOrNotCheckbox===1),n(2),b(A(6,14,e.translationPrefix+".set_as_default_tax")))},dependencies:[c,j,P,k,F,M,N,D],styles:["span[_ngcontent-%COMP%]{color:var(--gray, #808080);font-size:20px;font-style:normal;font-weight:700;line-height:normal}"]})};export{E as AddTax};
