import{a as y}from"./chunk-K3526JGK.js";import{c as f}from"./chunk-ZJWQSJPT.js";import"./chunk-POEUDRE2.js";import"./chunk-3EED4T3B.js";import"./chunk-3AEGLQN3.js";import"./chunk-CVDKI2WT.js";import"./chunk-3NMADI5P.js";import"./chunk-AYRHJYMC.js";import"./chunk-ZRZJCY6I.js";import"./chunk-JRIQ2XQF.js";import"./chunk-POWTZQEB.js";import"./chunk-AZNUVYH2.js";import"./chunk-4SQIPONB.js";import"./chunk-OMYRNWA7.js";import"./chunk-DQZNL7BK.js";import"./chunk-BAEZMG5T.js";import"./chunk-C72E7DYO.js";import"./chunk-WIPHIZE3.js";import{a as m}from"./chunk-2SWLXQPF.js";import"./chunk-LXYD2H4H.js";import"./chunk-IEDTWYT7.js";import"./chunk-TMA5MVRB.js";import{a as p}from"./chunk-IU6KW22E.js";import{a as d}from"./chunk-NLZ5S4LR.js";import"./chunk-4N5DMUBB.js";import"./chunk-VRBUVT76.js";import"./chunk-JKGTJ7SW.js";import"./chunk-7L7QKXDE.js";import"./chunk-VUFRXBL5.js";import"./chunk-AG5UR6GS.js";import"./chunk-XXT62TCF.js";import"./chunk-YUC4NXDM.js";import"./chunk-6P3ZDNP3.js";import"./chunk-VP22RGQG.js";import"./chunk-3FDFNYAA.js";import"./chunk-3HDMTDNY.js";import"./chunk-YR6PJKN6.js";import"./chunk-HVO2LBIZ.js";import"./chunk-JU53QNJX.js";import"./chunk-EMJJQSXR.js";import"./chunk-2G4GCCRX.js";import"./chunk-KAJE4RE3.js";import"./chunk-H6QVTBMZ.js";import"./chunk-XNR6WIGX.js";import"./chunk-5KOP4ULD.js";import"./chunk-F2X3VGZZ.js";import{d as i}from"./chunk-RYV2RH4B.js";import"./chunk-CV2ZWZQE.js";import"./chunk-R2UR7BVM.js";import{j as l}from"./chunk-HKLJ6VPZ.js";import"./chunk-MQ46LYK7.js";import{c as u}from"./chunk-PQ5Q7HJL.js";import"./chunk-72CHOCZD.js";import{Gb as s,Y as n,gb as o,tb as c}from"./chunk-56X5LYJH.js";import"./chunk-TSRGIXR5.js";var v=class a{floorsHeaders=["id","currency_ar","currency_en","currency_code","currency_symbol","exchange_value","is_default"];addCurrency=[];columnIcons=[{col:"is_default",activeIcon:"fas fa-star  text-warning",inactiveIcon:"fas fa-star text_light",activeValue:!0}];authService=n(p);permissions=m;actions=[];get canAddCurrency(){return this.authService.isAuthenticated()&&this.authService.hasPermission(this.permissions.CREATE_CURRENCY)}facilityService=n(d);base="currencies";ngOnInit(){this.initializeFormFields(),this.initializeActions()}initializeFormFields(){this.addCurrency=[{type:"input",title:"currency_name_ar",controlName:"currency_ar",inputType:"text",validators:[i.required],preventUpdate:!0},{type:"input",title:"currency_name_en",controlName:"currency_en",inputType:"text",validators:[i.required],preventUpdate:!0},{type:"input",title:"currency_symbol",controlName:"currency_symbol",inputType:"text",preventUpdate:!0},{type:"input",title:"decimal_number",controlName:"decimal_number",inputType:"number",preventUpdate:!0},{type:"input",title:"currency_code",controlName:"currency_code",validators:[i.required],preventUpdate:!0},{type:"input",title:"exchange_rate",controlName:"exchange_value",validators:[i.required],inputType:"number"},{type:"select",title:"status",controlName:"is_active",validators:[i.required],preventUpdate:!0,manualTranslateOption:!0,options:f},{type:"hidden",title:"facility_id",controlName:"facility_id",value:this.FacilityId,preventUpdate:!0}]}initializeActions(){this.actions=[{type:"button",label:"show",action:"show",permission:"view currency",routerLink:"/home/currency-details/"},{type:"modal",label:"update",action:"update",fieldsModal:this.addCurrency,modalHeader:"update_currency",routerLink:this.base,pathParam:"id",putMethod:!0,permission:"update currency",condition:e=>e.is_default==!1},{type:"toggle",field:"is_active",label:"Active",apiUrl:"currencies",paramName:"id",condition:e=>e.is_default==!1}]}get FacilityId(){return this.facilityService.currentFacility()?.id||null}get url(){let e=this.FacilityId;return e?`${this.base}?facility_id=${e}`:this.base}static \u0275fac=function(r){return new(r||a)};static \u0275cmp=o({type:a,selectors:[["app-currency-list"]],decls:1,vars:7,consts:[["apiUrl","currencies","translationPrefixx","form","titleOfPage","currencyManagement","titleOfbutton","add_currency","fileNameTranslated","currency","submitModalBtnTitle","add","subTitleOfPage","currencyManagementSubTitle",3,"ShowButton","ShowModal","fieldsModal","url","headers","tableAction","columnIcons"]],template:function(r,t){r&1&&s(0,"app-page-body",0),r&2&&c("ShowButton",!1)("ShowModal",t.canAddCurrency)("fieldsModal",t.addCurrency)("url",t.url)("headers",t.floorsHeaders)("tableAction",t.actions)("columnIcons",t.columnIcons)},dependencies:[l,u,y],encapsulation:2})};export{v as CurrencyListComponent};
