import{j as l}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 w}from"./chunk-TGWIHQDX.js";import{d as i}from"./chunk-Q5KZV54I.js";import{a as b}from"./chunk-YHVRQUSB.js";import"./chunk-3Z7PXZF3.js";import{a as S}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 _}from"./chunk-S3ADKFO2.js";import{E as g}from"./chunk-I5MYHHJE.js";import{$b as f,Fb as s,Ib as d,S as p,Wa as m,Xc as y,Zb as v,_b as h,f as c,gb as o,lb as u}from"./chunk-CKLXM6EG.js";import"./chunk-TSRGIXR5.js";var F=class n{constructor(a,e,t,r,R){this.apiService=a;this.route=e;this.translate=t;this.cdr=r;this.toast=R}title;urlApi;titleKey="";translationPrefix="high_value_rule";fullWidthFields=["select","input","date","table","radio","textarea"];values;vendors;isEdit=!1;fields;destroy$=new c;mainFormComponent;titleOfButton;isShow;ngOnInit(){this.route.paramMap.subscribe(a=>{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_high_value"):(this.getDetails(t),this.isEdit=!0,this.titleOfButton="edit",this.title="edit_high_value",this.urlApi=`procurement/high-value-rule/update/${t}`):(this.isEdit=!1,this.titleOfButton="add",this.title="add_high_value",this.urlApi="procurement/high-value-rule/store")}),this.fields=[{type:"input",title:"name_ar_high_value_rule",class:"col-6",controlName:"name_ar",validators:[i.required]},{type:"input",title:"name_en_high_value_rule",class:"col-6",controlName:"name_en",validators:[i.required]},{type:"input",title:"financial_limit",inputType:"number",class:"col-6",controlName:"financial_limit",validators:[i.required]},{type:"select",title:"DRR",class:"col-3",controlName:"operator_DDR",options:[{id:">=",name:"> ="},{id:"<=",name:"< ="},{id:"=",name:"="},{id:">",name:">"},{id:"<",name:"<"}],validators:[i.required]},{type:"input",title:"deposit",class:"col-2",inputType:"number",showLabelForinput:!1,symbol:"%",controlName:"DRR",validators:[i.required]},{type:"symbol",title:"DRR",class:"col-1",showLabelForinput:!1,symbol:"%",controlName:" "},{type:"select",title:"max_deposit_percentage",class:"col-4",controlName:"operator_max_days",options:[{id:">=",name:"> ="},{id:"<=",name:"< ="},{id:"=",name:"="},{id:">",name:">"},{id:"<",name:"<"}],validators:[i.required]},{type:"input",title:"days",class:"col-2",inputType:"number",controlName:"max_days",showLabelForinput:!1,validators:[i.required]},{type:"symbol",title:"DRR",class:"col-1",showLabelForinput:!1,symbol:"days",controlName:""},{type:"textarea",title:"notes",class:"col-5",controlName:"notes"},{type:"radio",title:"is_active",controlName:"active",class:"col-6",options:[{name:this.translate.instant("yes"),id:1},{name:this.translate.instant("no"),id:0}],validators:[i.required],RadioDefaultValue:1}]}getDetails(a){this.apiService.Get(`procurement/high-value-rule/show/${a}`).pipe(p(this.destroy$)).subscribe({next:e=>{this.values=e.data,console.log(e.data,"vvvvvvvvvvvvvvvv"),console.log(this.values,"vvvvvvvvvvvvvvvv")},error:e=>{console.error("Error fetching employee:",e)}})}static \u0275fac=function(e){return new(e||n)(o(b),o(g),o(_),o(y),o(w))};static \u0275cmp=u({type:n,selectors:[["app-high-value-actions"]],viewQuery:function(e,t){if(e&1&&v(l,5),e&2){let r;h(r=f())&&(t.mainFormComponent=r.first)}},decls:2,vars:10,consts:[[3,"title","Translationprefix","showTitle","showBreadcrumb"],["routeAfterSuccess","/finance/prepayment","titleOfButton2","cancel",3,"fields","url","formValues","fullWidthFields","readOnly","titleOfButton"]],template:function(e,t){e&1&&d(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:[l,S],styles:["[_nghost-%COMP%]     .col-2{margin-top:.75rem}[_nghost-%COMP%]     .col-1{margin-top:2rem;text-align:center}[_nghost-%COMP%]     .custom-checkbox-group .form-check{flex-direction:column;gap:.5rem!important}"]})};export{F as HighValueActions};
