1import {C,n as n$1}from'./chunk-aSvkaigq.js';import {q}from'./chunk-80RWaGN8.js';import {p}from'./chunk-Q4TZ0USz.js';import {p as pe,d as de,h,L as Ln,w as wn,P as Pn,O as On,I as In,m as mt$1}from'./chunk-CU4h7x19.js';import {s}from'./chunk-Bj2KZ5gi.js';import {T}from'./chunk-DU_iDULH.js';import {s as s$1}from'./chunk-DPqp0J1w.js';import {o as o$1}from'./chunk-BTukzP7S.js';import {m}from'./chunk-C8vpM8Xc.js';import {t}from'./chunk-DBoI92ER.js';import {n}from'./chunk-DPIberPJ.js';import {r}from'./chunk-DCLLjuYL.js';import {R}from'./chunk-Cb_ojFRW.js';import {J,Q}from'./chunk-st9o5owP.js';import {a,d,y,f,m as m$1}from'./chunk-BAWHGQRM.js';import'./chunk-CmzbWx8h.js';import {z}from'./chunk-DXpxRexm.js';import {S}from'./chunk-C-5Gy9mF.js';import {i}from'./chunk-TaAt2vmO.js';import {o}from'./chunk-SDcs1xql.js';import {x as my,O as Oc,R as Rn$1,bg as m0,bh as _e,e3 as Bn,e5 as a8,eW as Q8,dG as vO,bB as X9,bz as Nf,bA as Rf,d1 as on$1,bj as Cu,dL as yI,dM as i8,ek as ru,c8 as H8,ca as Pf,c9 as Bf,dm as t8,d2 as sI,bG as sB,ee as m8,d5 as No,bT as hi,g8 as n6,e2 as Ls,e1 as JI,d4 as vI,bM as Ys,hr as lN,aE as x6,fk as V6,fl as H6,fm as j6,hw as lB,F as we,ak as aa,D,w as we$1,eM as Sf,j as Sa,n as hI,bm as br,cT as Ve,dd as Dh,bJ as VO,b6 as K,aS as V,hm as dN,V as V$1,bn as ne,cV as B,bH as PO,ej as Zt,cE as Ee,ci as CI,_ as _f,eq as Cf,gC as iE,f as Vn,fa as $e,cD as Xo,fw as be,bo as Mf,f5 as hf,hx as fp,hy as XI,P as qT,c_ as fu,cs as G8,cq as Ws,cr as W8,cX as X3,cF as eR,cH as co,cI as Ch,cY as uo,cZ as Nl,br as Te,bu as mn$1,a2 as ye,a3 as Ms,aM as N_,ad as c_,a5 as rd,a4 as ky,d6 as tT,a6 as mC,c0 as wy,dQ as
1L_,a8 as Ry,bv as R_,aa as mb,b_,d7 as nT,ab as gC,cP as Qy,cQ as FC,cR as jC,X,e as ep,cp as ct$1,da as lo,c$ as Pa,d0 as gu,c2 as qy,c3 as HC,aN as cd,ba as cv,e0 as vn,f6 as Ol,df as uD,bU as ig,c1 as CC,cO as nd,aL as RC,aO as k_,a9 as C_,dP as QT,b as $n,$ as $N,h as he,J as da,v as vM,aw as F$1,be as na,p as pi,c4 as Fh,c6 as yh,c7 as vh,bY as IC,bZ as EC,dX as lg,f7 as uv,b$ as T_}from'./chunk-hxK0xzc4.js';import {F,E,N}from'./main-UKM7BIED.js';import'./chunk-DROiOONM.js';import'./chunk-CWBrHG4i.js';$n();$N();he();da();vM();F$1();na();da();$N();pi();he();Fh();var ct=N(ep());vM();pi();vM();var at=class o{constructor(){this.corporateAdminLogService=D(Q);this.dataCorporateAdminAgreementsService=D(s$1);}getCompanyRolesAgreementsMap(t,e,n){return !e?.length||!n.size?hI(new Map):CI(e.map(i=>this.getCompaniesForRole(t,i.id,n.get(i.id)))).pipe(we$1(i=>new Map(i)))}getCompaniesForRole(t,e,n){return this.dataCorporateAdminAgreementsService.get({service_type:n}).pipe(_f(i=>Ee(t.getRoles({service_tag:e})).pipe(we$1(m=>this.mapCompaniesWithAccess(i,m[0]?.companies||[])))),we$1(i=>[e,i]),Sa(i=>(this.corporateAdminLogService.handleBackendError("Error while getting company role agreements",i,a),hI([e,[]]))))}mapCompaniesWithAccess(t,e){let n=new Map(e.map(i=>[i.customerNumber,!!i.access]));return t.map(i=>({companyName:i.companyName,customerNumber:i.customerNumber,access:n.get(i.customerNumber)||false})).sort((i,m)=>i.companyName.localeCompare(m.companyName))}static{this.\u0275fac=function(e){return new(e||o)};}static{this.\u0275prov=X({token:o,factory:o.\u0275fac,providedIn:"root"});}};vM();$N();na();he();vM();na();vM();$N();na();he();var Gi=()=>["displayName"],st=class o{constructor(){this.copyAccountRights=new ct$1;this.labelMap=r;this.fb=D(Dh);this.form=this.fb.group({srcUser:[null,[lo.required]]});}get srcUserCtrl(){return this.form.get("srcUser")}cancelCopyFrom(){this.modalRef.close();}continueCopyFrom(){this.srcUserCtrl.valid&&this.copyAccountRights.emit(this.srcUserCtrl.value);}static{this.\u0275fac=function(e){return new(e||o)};}
1static{this.\u0275cmp=qT({type:o,selectors:[["account-rights-and-permissions-copy-from-modal"]],inputs:{modalRef:"modalRef",users:"users"},outputs:{copyAccountRights:"copyAccountRights"},standalone:false,decls:25,vars:27,consts:[["userCtrlEl","ebankControl"],[1,"ebank-modal-title","ebank-title-h2"],[3,"ngSubmit","formGroup"],["translate","PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.USER_SELECTOR.LABEL"],["formControlName","srcUser","id","userSelector",3,"allowEmpty","options","searchAttributes","titleOnMobile"],["selectTemplate","single",3,"labelMap"],["validation","required",3,"control"],["buttonStyle","tertiary",1,"cancel-btn",3,"buttonClick"],["type","submit",1,"save-btn"]],template:function(e,n){if(e&1&&(Ms(0,"div",1),c_(1),N_(2,"translate"),rd(),Ms(3,"p"),c_(4),N_(5,"translate"),rd(),Ms(6,"form",2),qy("ngSubmit",function(){return n.continueCopyFrom()}),Ms(7,"ebank-form-field"),ky(8,"ebank-label",3),Ms(9,"ebank-simple-selector",4,0),N_(11,"translate"),ky(12,"ebank-option-template",5),N_(13,"labelMap"),rd(),tT(),Ms(14,"ebank-form-error-wrapper")(15,"ebank-form-error",6),c_(16),N_(17,"translate"),rd()()(),Ms(18,"ebank-action-row")(19,"ebank-button",7),qy("buttonClick",function(){return n.cancelCopyFrom()}),c_(20),N_(21,"translate"),rd(),Ms(22,"ebank-button",8),c_(23),N_(24,"translate"),rd()()()),e&2){let i=HC(10);mb(),cd(" ",R_(2,12,"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.COPY_FROM_ANOTHER_USER.MODAL.HEADER"),` 2`),mb(3),cv(R_(5,14,"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.COPY_FROM_ANOTHER_USER.MODAL.DESC")),mb(2),Ry("formGroup",n.form),mb(3),Ry("allowEmpty",true)("options",n.users)("searchAttributes",b_(26,Gi))("titleOnMobile",R_(11,16,"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.USER_SELECTOR.LABEL")),nT(),mb(3),Ry("labelMap",R_(13,18,n.labelMap.DisplayName)),mb(3),Ry("control",i),mb(),cd(" ",R_(17,20,"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.COPY_FROM_ANOTHER_USER.MODAL.USER_VALIDATION.REQUIRED")," "),mb(4),cd(" ",R_(21,22,"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.COPY_FROM_ANOTHER_USER.MODAL.BTN.CANCEL")," "),mb(3),cd(" ",R_(24,24,"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.COPY_FROM_ANOTHER_USER.MODAL.BTN.COPY")," ");}},dependencies:[m0,_e,fu,on$1,X3,eR,co,Ch,uo,Nl,Pa,gu,sI,No,vI,Te,t,ye],encapsulation:2,changeDetection:1});}};vM();na();vM();$N();na();he();var Mi=(o,t)=>t.id;function wi(o,t){if(o&1&&(Ms(0,"ebank-radio-button",2)(1,"ebank-template-basic")(2,"ebank-template-basic-title",3),c_(3),rd(),Ms(4,"ebank-template-basic-text",3),c_(5),rd()()()),o&2){let e=t.$implicit,n=RC(2);Ry("disabled",n.disabledRoles)("value",e.id),mb(3),cv("PAGE.CHANGES_PENDING_APPROVAL.ROLES."+e.id+".HEADER"),mb(2),cv("PAGE.CHANGES_PENDING_APPROVAL.ROLES."+e.id+".DESC");}}function Bi(o,t){if(o&1&&(Ms(0,"h2",0),c_(1,"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.CASH_POOL.PANEL_LIST.HEADER"),rd(),Ms(2,"ebank-radio-button-group",1),IC(3,wi,6,4,"ebank-radio-button",2,Mi),rd(),tT()),o&2){let e=RC();mb(2),Ry("formControl",e.form),nT(),mb(),EC(e.cashPools);}}var lt=class o{constructor(){this.cashPools=[];this.disabledRoles=false;this.form=new vn;this.accountRightsAndPermissionsStore=D(de);this.hasFormChangeObserver=false;}ngOnChanges(t){t.cashPools?.currentValue&&this.initializeForm(t.cashPools.currentValue);}addFormChangeObserver(){this.hasFormChangeObserver=true,this.form.valueChanges.subscribe(t=>this.accountRightsAndPermissionsStore.updateSelectedCashPoolRole(t));}initializeForm(t){this.form.setValue(t.find(e=>e.access)?.id),this.hasFormChangeObserver||this.addFormChangeObserver();}static{this.\u0275fac=function(e){return new(e||o)};}
2static{this.\u0275cmp=qT({type:o,selectors:[["account-rights-and-permissions-cash-pool-panel-list"]],inputs:{cashPools:"cashPools",disabledRoles:"disabledRoles"},standalone:false,features:[uD],decls:1,vars:1,consts:[["translate","",1,"ebank-title-h2"],[3,"formControl"],[3,"disabled","value"],["translate",""]],template:function(e,n){e&1&&mC(0,Bi,5,1),e&2&&gC(n.cashPools.length>0?0:-1);},dependencies:[fu,co,Ol,Ls,JI,V6,H6,j6,Te],encapsulation:2,changeDetection:1});}};vM();na();pi();F$1();vM();$N();na();he();vM();var pt=class o{transform(t,e){let n=Object.values(t??{});if(n.length===0)return false;let i=n.filter(Boolean).length;return e==="checked"?i===n.length:i>0&&i<n.length}static{this.\u0275fac=function(e){return new(e||o)};}static{this.\u0275pipe=QT({name:"roleCompaniesSelectAllState",type:o,pure:true});}};var ki=(o,t)=>t.id,$i=(o,t)=>t.customerNumber;function ji(o,t){if(o&1&&(Ms(0,"ebank-information-area",1)(1,"ebank-information-area-custom-template")(2,"span",3),c_(3,"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.COMPANY_ROLES.PANEL_LIST.INFO.DESC"),rd(),Ms(4,"a",4),c_(5,"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.COMPANY_ROLES.PANEL_LIST.INFO.LINK"),rd()()()),o&2){let e=RC(2);mb(4),Ry("href","#/page/corporate-admin/agreements-users-rights?userID="+e.userId,lg);}}function Wi(o,t){if(o&1){let e=CC();Ms(0,"ebank-checkbox-field",12),N_(1,"roleCompaniesSelectAllState"),N_(2,"roleCompaniesSelectAllState"),qy("changed",function(i){yh(e);let m=RC(2).$implicit,g=RC(3);return vh(g.onRoleCompaniesSelectAllChanged(m,i))}),c_(3),N_(4,"translate"),rd();}if(o&2){let e=RC(2).$implicit,n=RC(3);Ry("checked",k_(1,3,n.companyRolesCompaniesForm.controls[e.id]==null?null:n.companyRolesCompaniesForm.controls[e.id].value,"checked"))("indeterminate",k_(2,6,n.companyRolesCompaniesForm.controls[e.id]==null?null:n.companyRolesCompaniesForm.controls[e.id].value,"indeterminate")),mb(3),cd(" ",R_(4,9,"EBANKUI.CONFIG.SIMPLE_SELECTOR.SELECT_ALL_TEXT")," ");}}function Yi(o,t){if(o&1&&(Ms(0,"ebank-checkbox-field",11),c_(1),rd(),tT()),o&2){let e=t.$implicit;Ry("formControlName",e.customerNumber),nT(),mb(),cd(" ",e.companyName," ");}}function zi(o,t){if(o&1&&(Ms(0,"ebank-checkbox-panel",6)(1,"ebank-template-basic")(2,"ebank-template-basic-title",3),c_(3),rd(),Ms(4,"ebank-template-basic-text",3),c_(5),rd()(),Ms(6,"ebank-nested-section",8),mC(7,Wi,5,11,"ebank-checkbox-field",9),Ms(8,"ebank-checkbox-field-group",10),IC(9,Yi,2,2,"ebank-checkbox-field",11,$i),rd()()(),tT()),o&2){let e=RC().$implicit,n=RC(3);Ry("formControlName",e.id),nT(),mb(3),cv("PAGE.CHANGES_PENDING_APPROVAL.ROLES."+e.id+".HEADER"),mb(2),cv("PAGE.CHANGES_PENDING_APPROVAL.ROLES."+e.id+".DESC"),mb(),Ry("show",n.form.controls[e.id]==null?null:n.form.controls[e.id].value),mb(),gC(n.disabledRoles?-1:7),mb(),Ry("formGroup",n.companyRolesCompaniesForm.controls[e.id])("horizontalAlignment",true),mb(),EC(n.getRoleCompanies(e));}}function qi(o,t){o&1&&wy(0,zi,11,7,"ebank-checkbox-panel",7);}function Qi(o,t){if(o&1&&(Ms(0,"ebank-panel-list-section",2)(1,"ebank-panel-list",5),IC(2,qi,1,0,"ebank-checkbox-panel",6,ki),rd()()),o&2){let e=RC(2);Ry("formGroup",e.form),mb(),Ry("separated",true),mb(),EC(e.roles);}}function Ki(o,t){if(o&1&&(Ms(0,"ebank-checkbox-field",11)(1,"ebank-template-basic")(2,"ebank-template-basic-title",3),c_(3),rd(),Ms(4,"ebank-template-basic-text",3),c_(5),rd()()(),tT()),o&2){let e=t.$implicit;Ry("formControlName",e.id),nT(),mb(3),cv("PAGE.CHANGES_PENDING_APPROVAL.ROLES."+e.id+".HEADER"),mb(2),cv("PAGE.CHANGES_PENDING_APPROVAL.ROLES."+e.id+".DESC");}}function Xi(o,t){if(o&1&&(Ms(0,"ebank-checkbox-field-group",2),IC(1,Ki,6,3,"ebank-checkbox-field",11,ki),rd()),o&2){let e=RC(2);Ry("formGroup",e.form),mb(),EC(e.roles);}}function Ji(o,t){if(o&1&&(Ms(0,"h2",0),c_(1),rd(),mC(2,ji,6,1,"ebank-information-area",1),mC(3,Qi,4,2,"ebank-panel-list-section",2)(4,Xi,3,1,"ebank-checkbox-field-group",2)),o&2){let e=RC();mb(),cd(" ","PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS."+e.roleType.toUpperCase()+"_ROLES.PANEL_LIST.HEADER"," "),mb(),gC(e.roleType==="company"&&!e.config.rolesAndPermissionsWithSubsidiaryAgreements?2:-1),mb(),gC(e.config.rolesAndPermissionsWithSubsidiaryAgreements&&e.roleType==="company"?3:4);}}var mt=class o{constructor(){this.accountRightsAndPermissionsStore=D(de);this.config=D(o$1).config;this.destroyRef=D(Ve);this.fb=D(Dh);this.userRolesChanged$=new ne;this.disabledRoles=false;this.roles=[];this.roleType="user";this.userId="";this.companyRolesCompaniesForm=this.fb.group({});this.form=this.fb.group({});}
2ngOnChanges(t){if(t.roles?.currentValue){this.initializeForm(this.roles);return}t.disabledRoles&&!t.disabledRoles.firstChange&&this.toggleFormsState();}getRoleCompanies(t){return t.companies||[]}getRoleCompaniesForm(t){return this.companyRolesCompaniesForm.get(t)}onRoleCompaniesSelectAllChanged(t,e){if(this.disabledRoles)return;let n=this.getRoleCompaniesForm(t.id);n&&(n.patchValue(Object.fromEntries(this.getRoleCompanies(t).map(i=>[i.customerNumber,e])),{emitEvent:false}),this.accountRightsAndPermissionsStore.updateCompanyRoleCompanies(t.id,this.getUpdatedRoleCompanies(t)));}addFormChangeObserver(){this.isCompanyRolesWithSubsidiaryAgreementsEnabled()||this.form.valueChanges.pipe(B(this.destroyRef),Mf(this.userRolesChanged$)).subscribe(t=>{if(this.roleType==="company"){this.accountRightsAndPermissionsStore.updateCompanyRoles(t);return}this.accountRightsAndPermissionsStore.updateUserRoles(t);});}addCompanyRoleChangeObservers(t){let e=this.form.get(t.id),n=this.getRoleCompaniesForm(t.id);e.valueChanges.pipe(B(this.destroyRef),Mf(this.userRolesChanged$)).subscribe(i=>{i||this.resetRoleCompaniesForm(t),this.accountRightsAndPermissionsStore.updateCompanyRolesWithInitialCompanies(this.form.getRawValue(),this.getInitialCompanyRolesState());}),n?.valueChanges.pipe(B(this.destroyRef),Mf(this.userRolesChanged$)).subscribe(()=>{let i=this.getUpdatedRoleCompanies(t);this.accountRightsAndPermissionsStore.updateCompanyRoleCompanies(t.id,i);});}getUpdatedRoleCompanies(t){let e=this.getRoleCompaniesForm(t.id);return this.getRoleCompanies(t).map(i=>F(E({},i),{access:!!e?.get(i.customerNumber)?.value}))}resetRoleCompaniesForm(t){let e=this.getRoleCompaniesForm(t.id),n=this.getRoleCompanies(t);e?.patchValue(Object.fromEntries(n.map(i=>[i.customerNumber,!!i.access])),{emitEvent:false});}getInitialCompanyRolesState(){return this.roles.reduce((t,e)=>(t[e.id]=this.getRoleCompanies(e),t),{})}initializeForm(t){this.userRolesChanged$.next(),this.form=this.fb.group({}),this.companyRolesCompaniesForm=this.fb.group({}),t.forEach(e=>{if(this.form.addControl(e.id,this.fb.control(!!e.access,{nonNullable:true})),this.isCompanyRolesWithSubsidiaryAgreementsEnabled()){let n=this.fb.group({});this.getRoleCompanies(e).forEach(i=>{n.addControl(i.customerNumber,this.fb.control(!!i.access,{nonNullable:true}));}),this.companyRolesCompaniesForm.addControl(e.id,n);}}),this.isCompanyRolesWithSubsidiaryAgreementsEnabled()&&t.forEach(e=>this.addCompanyRoleChangeObservers(e)),this.toggleFormsState(),this.addFormChangeObserver();}isCompanyRolesWithSubsidiaryAgreementsEnabled(){return this.roleType==="company"&&!!this.config.rolesAndPermissionsWithSubsidiaryAgreements}toggleFormsState(){if(this.disabledRoles){this.form.disable({emitEvent:false}),this.companyRolesCompaniesForm.disable({emitEvent:false});return}this.form.enable({emitEvent:false}),this.companyRolesCompaniesForm.enable({emitEvent:false});}static{this.\u0275fac=function(e){return new(e||o)};}
2static{this.\u0275cmp=qT({type:o,selectors:[["account-rights-and-permissions-roles-panel-list"]],inputs:{disabledRoles:"disabledRoles",roles:"roles",roleType:"roleType",userId:"userId"},standalone:false,features:[uD],decls:1,vars:1,consts:[["translate","",1,"ebank-title-h2"],["level","info"],[3,"formGroup"],["translate",""],["translate","",1,"ebank-text-link",3,"href"],["groupHeadingId","heading",3,"separated"],[1,"panel-with-company-checkboxes",3,"formControlName"],["class","panel-with-company-checkboxes",3,"formControlName",4,"ebankPanelList"],[3,"show"],[3,"checked","indeterminate"],[3,"formGroup","horizontalAlignment"],[3,"formControlName"],[3,"changed","checked","indeterminate"]],template:function(e,n){e&1&&mC(0,Ji,5,3),e&2&&gC(n.roles.length>0?0:-1);},dependencies:[Bn,a8,Q8,fu,co,Ch,uo,Nl,m8,H8,Pf,hi,ig,n6,V6,H6,j6,Te,pt,ye],encapsulation:2,changeDetection:1});}};$n();var en=["copyFromAnotherUserModalTemplate"],tn=["stickyFooterTemplate"],nn=()=>["displayName"],on=(o,t)=>({filteredCount:o,totalCount:t}),rn=o=>({maxValue:o}),an=(o,t)=>t.id;function sn(o,t){o&1&&(Ms(0,"ebank-information-area")(1,"ebank-information-area-custom-template"),c_(2),N_(3,"translate"),rd()()),o&2&&(mb(2),cd(" ",R_(3,1,"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.VIEW_ONLY.INFO")," "));}function ln(o,t){if(o&1){let e=CC();Ms(0,"ebank-button",26),qy("buttonClick",function(){yh(e);let i=RC(2);return vh(i.showCopyFromAnotherUserModal())}),c_(1),N_(2,"translate"),rd();}o&2&&(mb(),cd(" ",R_(2,1,"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.ACCOUNT_RIGHTS.COPY_FROM_ANOTHER_USER.BTN")," "));}function pn(o,t){if(o&1&&(ky(0,"account-group-selector",12),N_(1,"async"),tT()),o&2){let e=RC(2);Ry("isLoading",R_(1,2,e.pageLoading$))("options",e.accountGroups),nT();}}function mn(o,t){if(o&1&&(ky(0,"company-selector",13),N_(1,"async"),tT()),o&2){let e=RC(2);Ry("isLoading",R_(1,2,e.pageLoading$))("options",e.companies),nT();}}function cn(o,t){o&1&&(Ms(0,"ebank-form-field")(1,"ebank-label"),c_(2),N_(3,"translate"),rd(),ky(4,"ebank-input-field",27),tT(),rd()),o&2&&(mb(2),cv(R_(3,1,"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.SEARCH.LABEL")),mb(2),nT());}function dn(o,t){if(o&1&&(Ms(0,"li",31)(1,"span",32),c_(2),rd(),c_(3),N_(4,"translate"),N_(5,"translate"),rd()),o&2){let e=t.$implicit,n=RC(4);mb(2),cv(e.accountAlias),mb(),uv(" ",e.accountNumber," ",R_(4,4,e.controlErrorMessage)," - ",k_(5,6,e.errorMessage,T_(9,rn,n.maxValue))," ");}}function un(o,t){if(o&1&&(Ms(0,"ebank-information-area",29)(1,"ebank-information-area-title"),c_(2),N_(3,"translate"),rd(),Ms(4,"ebank-information-area-custom-template")(5,"ul",30),IC(6,dn,6,11,"li",31,an),rd()()()),o&2){let e=RC(3);mb(2),cv(R_(3,1,"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.ERROR_SUMMARY.TITLE")),mb(4),EC(e.tableErrors);}}function Cn(o,t){if(o&1){let e=CC();Ms(0,"account-rights-table",28),N_(1,"async"),N_(2,"async"),qy("errorsChanged",function(i){yh(e);let m=RC(2);return vh(m.onTableErrorsChange(i))}),rd(),mC(3,un,8,3,"ebank-information-area",29);}if(o&2){let e=RC(2);Ry("accountRights",R_(1,9,e.filteredAccountRights$))("allAccountRights",R_(2,11,e.allAccountRights$))("displayedColumns",e.displayedColumns)("hasSingleCompany",e.isDaughterCompanyScope)("loading$",e.loadingAccessRights$)("tableData$",e.filteredAccountRights$)("accountRightsAndPermissionsTable",true)("viewOnlyTable",e.isAdminView||e.userHasPendingChanges),mb(3),gC(e.tableErrors.length>0?3:-1);}}function hn(o,t){o&1&&(Ms(0,"ebank-empty-state",21)(1,"ebank-empty-state-title",4),c_(2,"PAGE.USER_ROLES.NO_RESULTS.MAIN_TITLE"),rd(),Ms(3,"ebank-empty-state-description",4),c_(4," PAGE.USER_ROLES.NO_RESULTS.MAIN_DESCRIPTION "),rd()());}function gn(o,t){if(o&1&&(ky(0,"account-rights-and-permissions-cash-pool-panel-list",25),N_(1,"async")),o&2){let e=RC(2);Ry("cashPools",R_(1,2,e.cashPools$))("disabledRoles",e.isAdminView||e.userHasPendingChanges);}}function An(o,t){if(o&1){let e=CC();Ms(0,"ebank-spinner",9),N_(1,"async"),N_(2,"translate"),mC(3,sn,4,3,"ebank-information-area"),Ms(4,"h2",10),c_(5,"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.ACCOUNT_RIGHTS.SECTION_HEADER"),rd(),mC(6,ln,3,3,"ebank-button",11),mC(7,pn,2,4,"account-group-selector",12),mC(8,mn,2,4,"company-selector",13),Ms(9,"ebank-help-button-field-wrapper")(10,"ebank-toggle-switch",14),N_(11,"translate"),N_(12,"async"),qy("toggleV
2alueChange",function(i){yh(e);let m=RC();return vh(m.showUnassignedAccounts$.next(i))}),rd(),ky(13,"ebank-help-button",15),Ms(14,"ebank-help-button-content",null,2),c_(16),N_(17,"translate"),rd()(),mC(18,cn,5,3,"ebank-form-field"),N_(19,"async"),ky(20,"account-rights-checkbox-filters",16),Ms(21,"ebank-description-list",17)(22,"div",18)(23,"dt",19),c_(24),N_(25,"translate"),rd(),Ms(26,"dd",20),c_(27),N_(28,"async"),N_(29,"async"),N_(30,"translate"),rd()()(),mC(31,Cn,4,13),N_(32,"async"),nd(33,hn,5,0,"ebank-empty-state",21),Ms(34,"div",22),ky(35,"account-rights-and-permissions-roles-panel-list",23),N_(36,"async"),ky(37,"account-rights-and-permissions-roles-panel-list",24),N_(38,"async"),mC(39,gn,2,4,"account-rights-and-permissions-cash-pool-panel-list",25),rd()();}if(o&2){let e,n=HC(15),i=RC();Ry("loading",R_(1,22,i.loadingAccessRights$))("loadAnnouncement",R_(2,24,"PAGE.USER_ROLES.LOADING_TABLE"))("spinnerDelay",0),mb(3),gC(i.userHasPendingChanges?3:-1),mb(3),gC(i.users?.length>1&&!i.isAdminView&&!i.userHasPendingChanges?6:-1),mb(),gC(i.hasAccountGroups?7:-1),mb(),gC(i.isDaughterCompanyScope?-1:8),mb(2),Ry("title",R_(11,26,"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.UNASSIGNED_ACCOUNTS.LABEL"))("toggleValue",R_(12,28,i.showUnassignedAccounts$)),mb(3),Ry("content",n),mb(3),cd(" ",R_(17,30,"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.UNASSIGNED_ACCOUNTS.HELP")," "),mb(2),gC(R_(19,32,i.accountRights$)?.length>10?18:-1),mb(2),Ry("filters$",i.accountRightFilters$),mb(4),cv(R_(25,34,"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.ACCOUNT_COUNTER.LABEL")),mb(3),cd(" ",k_(30,40,"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.ACCOUNT_COUNTER.VALUE",C_(49,on,(e=R_(28,36,i.filteredAccountRights$))==null?null:e.length,(e=R_(29,38,i.accountRights$))==null?null:e.length))," "),mb(4),gC(R_(32,43,i.filteredAccountRights$)?.length>0?31:33),mb(4),Ry("roles",R_(36,45,i.userRoles$))("disabledRoles",i.isAdminView||i.userHasPendingChanges),mb(2),Ry("roles",R_(38,47,i.companyRoles$))("disabledRoles",i.isAdminView||i.userHasPendingChanges)("userId",i.userCtrl.value.userId),mb(2),gC(i.hasCashPoolEnabled?39:-1);}}function Rn(o,t){if(o&1){let e=CC();Ms(0,"account-rights-and-permissions-copy-from-modal",33),qy("copyAccountRights",function(i){yh(e);let m=RC();return vh(m.copyAccountRights(i))}),rd();}if(o&2){let e=RC();Ry("modalRef",e.modalRef)("users",e.usersForCopyModal);}}function bn(o,t){if(o&1){let e=CC();Ms(0,"ebank-button",36),qy("buttonClick",function(){yh(e);let i=RC(2);return vh(i.sendForApproval())}),c_(1),N_(2,"translate"),rd();}o&2&&(mb(),cv(R_(2,1,"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.STICKY_FOOTER.SEND_FOR_APPROVAL.BTN")));}function Sn(o,t){if(o&1){let e=CC();Ms(0,"ebank-button",37),qy("buttonClick",function(){yh(e);let i=RC(2);return vh(i.saveChanges())}),c_(1),N_(2,"translate"),rd();}o&2&&(mb(),cv(R_(2,1,"PAGE.USER_INFORMATION.STICKY_FOOTER.ACTION_BTN")));}function fn(o,t){if(o&1&&(Ms(0,"ebank-sticky-footer-buttons"),mC(1,bn,3,3,"ebank-button",34),N_(2,"async"),nd(3,Sn,3,3,"ebank-button",35),rd()),o&2){let e=RC();mb(),gC(R_(2,1,e.hasDualControl$)?1:3);}}var dt=class o$2{constructor(){this.accountRightFilters$=new br(d);this.accountSearchText$=new br("");this.cashPools$=new br([]);this.companyRoles$=new br([]);this.displayedColumns=y;this.filteredAccountRights$=new br([]);this.hasAccountGroups=false;this.hasCashPoolEnabled=true;this.isAdminView=false;this.isDaughterCompanyScope=false;this.loadingAccessRights$=new br(true);this.maxValue=D(s).config.maxValue;this.pageLoading$=new br(true);this.showUnassignedAccounts$=new br(false);this.tableErrors=[];this.userRoles$=new br([]);this.userHasPendingChanges=false;this.labelMap=r;this.accountGroupSelectorService=D(S);this.accountRightsAndPermissionsService=D(pe);this.accountRightsAndPermissionsStore=D(de);this.allowUserChange=false;this.companySelectorService=D(C);this.companyRoleAgreementsService=D(at);this.companyRoleServiceTypeByTag=new Map;this.corporateAdminConfig=D(o$1).config;this.corporateAdminLogService=D(Q);this.dataAccountGroupsService=D(i);this.dataCorporateAdminUsersApprovalsService=D(n);this.dataCorporateAdminUsersService=D(m);this.dataCorporateAdminAgreementsService=D(s$1);this.dataCorporateAdminServicesService=D(p);this.dataUserAccessRights=D(o);this.destroyRef=D(Ve);this.fb=D(Dh);this.ignoreNextUserChange=false;this.modal=D(VO);this.route=D(K);this.router=D(V);this.stickyFooterService=D(dN);this.stickyFooterVisible=false;this.translateService=D(V$1);this.userChanged$=new ne;this.usersHavingPendingChanges=[];this.allAccountRights$=this.accountRightsAndPermissionsStore.accountRights$;this.form=this.fb.group({accountGroup:null,accountSearch:null,company:null,user:null});}get accountGroupCtrl(){return this.form.get("accountGroup")}get accountSearchCtrl(){return this.form.get("accountSearch")}get companyCtrl(){return this.form.get("company")}get userCtrl(){return this.form.get("user")}ngOnInit(){this.getData(),this.observeUserChange(),this.hasDualControl$=this.hasDualControl(),this.getAccessRights().subscribe(),this.accountRightsAndPermissionsStore.hasDataChanged().pipe(B(this.destroyRef)).subscribe(t=>t?this.showStickyFooter():this.hideStickyFooter());}ngOnDestroy(){this.accountRightsAndPermissionsStore.resetState();}copyAccountRights(t){let e=this.originalUsers.find(n=>n.id===t.id);this.getCopyFromUserData(e).subscribe({next:()=>{this.corporateAdminLogService.success("PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.COPY_FROM_ANOTHER_USER.ALERT.SUCCESS.DESC",null,"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.COPY_FROM_ANOTHER_USER.ALERT.SUCCESS.HEADER"),this.modalRef?.close();},error:n=>{this.corporateAdminLogService.error(n?.message,n?.error,"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.COPY_FROM_ANOTHER_USER.ALERT.ERROR.HEADER"),this.modalRef?.close();}});}
2onTableErrorsChange(t){this.tableErrors=[],t.forEach(e=>{let n=this.accountRightsAndPermissionsStore.state$.value.accountRights.find(g=>g.id===e.id),i=e.control.get(h.RegisterLimit);i.errors&&i.touched&&this.tableErrors.push(this.getTableError(n,e,h.RegisterLimit));let m=e.control.get(h.ApproveLimit);m.errors&&m.touched&&this.tableErrors.push(this.getTableError(n,e,h.ApproveLimit));});}saveChanges(){this.updateData("PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.SAVE_CHANGES.ALERT.SUCCESS");}sendForApproval(){this.updateData("PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.SEND_CHANGES.ALERT.SUCCESS",true);}showConfirmationModal(t){this.modalRef=this.modal.open(PO,{data:{content:this.translateService.instant("PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.CHANGE_USER.CONFIRMATION.MODAL.DESC"),title:this.translateService.instant("PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.CHANGE_USER.CONFIRMATION.MODAL.HEADER"),cancelButtonText:this.translateService.instant("PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.CHANGE_USER.CONFIRMATION.MODAL.CANCEL"),actionButtonText:this.translateService.instant("PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.CHANGE_USER.CONFIRMATION.MODAL.CHANGE_USER"),cancelButtonStyle:"tertiary",actionButtonStyle:"primary-danger",action:()=>{this.allowUserChange=true,this.loadingAccessRights$.next(true),this.userCtrl.setValue(t),this.modalRef.close(true);},cancel:()=>{this.userCtrl.setValue(this.currentSelectedUser,{emitEvent:false}),this.modalRef.close(false);}}}),this.modalRef?.onEscapeKey$?.pipe(Zt(1)).subscribe(()=>this.modalRef.close(false));}showCopyFromAnotherUserModal(){this.usersForCopyModal=this.users.filter(t=>t.id!==this.userCtrl.value.id),this.modalRef=this.modal.open(this.copyFromAnotherUserModalTemplate);}addNoCashPoolRole(t){let e=t.some(n=>n.access);return {id:Ln,access:!e}}applyUserData(t,e,n){let i=this.getCompanyRolesForCurrentMode(e.companyRoles,n);return this.cashPools$.next([this.addNoCashPoolRole(e.cashPoolRoles),...e.cashPoolRoles]),this.userRoles$.next(e.userRoles),this.companyRoles$.next(i),this.filteredAccountRights$.next(t),{accountRights:t,cashPoolRoles:e.cashPoolRoles,userRoles:e.userRoles,companyRoles:i}}canDeactivate(){return this.allowUserChange||!this.stickyFooterVisible}getErrorMessage(t){return t?.pattern?"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.AMOUNT_FIELD.VALIDATION.ERROR.PATTERN":t.max?"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.AMOUNT_FIELD.VALIDATION.ERROR.MAX_VALUE":t.required?"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.AMOUNT_FIELD.VALIDATION.ERROR.REQUIRED":""}getTableError(t,e,n){let i=this.getErrorMessage(e.control.get(n).errors),m=n===h.RegisterLimit?"PAGE.COPY_ACCOUNT_RIGHTS.TABLE.HEADER.REGISTER_AMOUNT":n===h.ApproveLimit?"PAGE.COPY_ACCOUNT_RIGHTS.TABLE.HEADER.APPROVE_AMOUNT":"";return {accountAlias:t?.accountAlias,accountNumber:t?.accountNumber,control:e.control,controlErrorMessage:m,errorMessage:i,id:e.id}}filterByAccountSearchText(t,e){return !t||e.accountAlias?.toLowerCase().includes(t.toLowerCase())||e.accountNumber.includes(t.replace(/\s+/g,""))}filterByAccountRights(t,e){return (!t.view||e.accountRights.view)&&(!t.register||e.accountRights.register)&&(!t.approve||e.accountRights.approve)&&(!t.internalTransactions||e.accountRights.transfer)&&(!t.salaryPayment||e.accountRights.salary)}filterByCompanyName(t,e){return !t||t.id===n$1||e.companyName===t.companyName}filterByUnassignedAccountRights(t,e){let{approve:n,salary:i,view:m,register:g,transfer:x}=e.accountRights;return !t||!n&&!i&&!m&&!g&&!x}filterData(t,e,n,i,m,g){return t.filter(x=>this.accountGroupSelectorService.filterByAccountGroup(e,x)&&this.filterByCompanyName(n,x)&&this.filterByUnassignedAccountRights(i,x)&&this.filterByAccountSearchText(m,x)&&this.filterByAccountRights(g,x))}filterUsersWithPendingChanges(t,e){return e?t.filter(n=>e.find(i=>i.userId===n.userId)):[]}getAccountGroups(){return this.dataAccountGroupsService.get({visible_only:true}).pipe(we$1(t=>this.accountGroupSelectorService.getAccountGroups(t)),Sf(t=>this.hasAccountGroups=t.length>0),Sa(t=>(this.corporateAdminLogService.handleBackendError("Error while getting account groups",t,a),[])))}getAccountRights(t,e){return Ee(t.getAccountRights()).pipe(Sa(n=>
2{throw {error:n,message:"Error while getting account rights"}}))}getApprovalsData(){return this.dataCorporateAdminUsersApprovalsService.get().pipe(Zt(1),Sa(t=>(this.corporateAdminLogService.handleBackendError("Error while getting approvals data",t,a),hI(null))))}getCompanies(){return this.dataCorporateAdminAgreementsService.get().pipe(Sf(t=>this.isDaughterCompanyScope=t.length===1),we$1(t=>this.companySelectorService.getCorporateAdminAgreements(t)),Sa(t=>(this.corporateAdminLogService.handleBackendError("Error while getting companies",t,a),[])))}getData(){CI([this.getUsers(),this.getUserIdFromUrl(),this.getCompanies(),this.getAccountGroups(),this.hasDualControl(),this.getAgreementServices()]).pipe(_f(([t,e,n,i,m,g])=>m?CI([hI(t),hI(e),hI(n),hI(i),hI(g),this.getApprovalsData()]):CI([hI(t),hI(e),hI(n),hI(i),hI(g),hI(null)])),Sf(([t,e,n,i,m,g])=>{this.usersHavingPendingChanges=this.filterUsersWithPendingChanges(t,g),this.users=t,this.companies=n,this.accountGroups=i,this.availableRoles=m;}),Sf(([t,e,n])=>this.initializeForm(t,e,n)),B(this.destroyRef)).subscribe();}getEmptyRole(t){return {access:false,id:t}}getRoles(t){return Ee(t.getRoles()).pipe(we$1(e=>{let n=(i,m)=>i.filter(g=>m.includes(g)).map(g=>e.find(x=>x.id===g)||this.getEmptyRole(g));return {userRoles:n(On,this.availableRoles.userRoles),companyRoles:n(Pn,this.availableRoles.companyRoles),cashPoolRoles:n(wn,this.availableRoles.cashPoolRoles)}}),Sa(e=>{throw {error:e,message:"Error while getting roles"}}))}getAgreementServices(){return CI([this.dataCorporateAdminServicesService.get({role_group:"company_group"}),this.dataCorporateAdminServicesService.get({role_group:"user_role"}),this.dataCorporateAdminServicesService.get({role_group:"cash_pool"})]).pipe(we$1(([t,e,n])=>(this.companyRoleServiceTypeByTag=new Map((t||[]).map(i=>[i.serviceTag,i.serviceType])),{companyRoles:t?.map(i=>i.serviceTag)?.filter(i=>Pn.includes(i)),userRoles:e?.map(i=>i.serviceTag)?.filter(i=>On.includes(i)),cashPoolRoles:n?.map(i=>i.serviceTag)?.filter(i=>wn.includes(i))})),Sa(t=>{throw {error:t,message:"Error while getting corporate admin services"}}))}getCompanyRolesAgreementsMap(t,e){return !this.isCompanyRolesWithSubsidiaryAgreementsEnabled()||!e?.length||!this.companyRoleServiceTypeByTag.size?hI(new Map):this.companyRoleAgreementsService.getCompanyRolesAgreementsMap(t,e,this.companyRoleServiceTypeByTag)}getUserIdFromUrl(){return this.route.queryParams.pipe(Zt(1),we$1(t=>t.userId))}getCopyFromUserData(t){return CI([this.getAccountRights(t),this.getRoles(t)]).pipe(_f(([e,n])=>this.getCompanyRolesAgreementsMap(t,n.companyRoles).pipe(we$1(i=>({accountRights:e,roles:n,companyRolesAgreementsMap:i})))),Sf(({accountRights:e,roles:n,companyRolesAgreementsMap:i})=>{if(!e||!n)throw new Error("");this.accountRightsAndPermissionsStore.setState(this.applyUserData(e,n,i));}),Zt(1))}getUserData(t){return CI([this.getAccountRights(t,true),this.getRoles(t)]).pipe(_f(([e,n])=>this.getCompanyRolesAgreementsMap(t,n.companyRoles).pipe(we$1(i=>({accountRights:e,roles:n,companyRolesAgreementsMap:i})))),Sf(({accountRights:e,roles:n,companyRolesAgreementsMap:i})=>{this.accountRightsAndPermissionsStore.setUnModifiedState(this.applyUserData(e,n,i)),this.accountRights$=this.accountRightsAndPermissionsStore.accountRights$,this.observeSearchTextChange(),this.observeDataFilterChange(),this.loadingAccessRights$.next(false);}),Sa(e=>(this.corporateAdminLogService.handleBackendError(e.message,e.error,a),hI(null))))}getUsers(){return this.dataCorporateAdminUsersService.get().pipe(we$1(t=>t.users),Sf(t=>this.originalUsers=t),we$1(t=>t.map(e=>F(E({},e),{displayName:`${e.lastName} ${e.firstName}`}))),we$1(t=>t.sort((e,n)=>e.displayName.localeCompare(n.displayName))),Sf(()=>this.pageLoading$.next(false)),Sa(t=>(this.corporateAdminLogService.handleBackendError("Error while getting users",t,a),[])))}hasDualControl(){return this.dataUserAccessRights.get().pipe(Zt(1),we$1(t=>t.dualcontrol&&t.administrator))}hideStickyFooter(){this.stickyFooterVisible&&(this.stickyFooterService.close(),this.stickyFooterVisible=false);}initializeForm(t,e,n){if(t.length===1)this.userCtrl.setValue(t[0]);else if(e){let i=t.find(m=>m.id===e);setTimeout(()=>this.userCtrl.setValue(i),0);}this.isDaughterCompanyScope||this.companyCtrl.setValue(n[0]),this.hasAccountGroups&&this.accountGroupCtrl.setValue(this.accountGroups[0]);}getAccessRights(){return this.dataUserAccessRights.get().pipe(Zt(1),Sf(t=>{this.isAdminView=!t.administrator&&t.administrator_view,this.isAdminView&&
2(this.displayedColumns=f);}),Sf(t=>{this.hasCashPoolEnabled=t.full_cash_pool||t.limited_cash_pool;}))}getCompanyRolesForCurrentMode(t,e){return this.isCompanyRolesWithSubsidiaryAgreementsEnabled()?this.mapCompanyRolesWithCompanies(t,e):t.map(n=>({id:n.id,access:n.access}))}isCompanyRolesWithSubsidiaryAgreementsEnabled(){return !!this.corporateAdminConfig.rolesAndPermissionsWithSubsidiaryAgreements}isCompanyRolesWithSubsidiaryAgreementsSingleRequestEnabled(){return !!this.corporateAdminConfig.rolesAndPermissionsWithSubsidiaryAgreementsSingleRequest}mapCompanyRolesWithCompanies(t,e){return t.map(n=>F(E({},n),{companies:e.get(n.id)||[]}))}observeUserChange(){this.userCtrl.valueChanges.pipe(Cf(null),iE(),Vn(()=>this.ignoreNextUserChange?(this.ignoreNextUserChange=false,false):true),Vn(([t,e])=>e&&e.id!==t?.id),_f(([t,e])=>this.canDeactivate()?(this.loadingAccessRights$.next(true),hI(e)):(this.showConfirmationModal(e),this.modalRef.afterClosed$.pipe(Zt(1),_f(n=>n?hI(e):(this.ignoreNextUserChange=true,this.userCtrl.setValue(t),$e))))),Sf(t=>this.currentSelectedUser=t),we$1(t=>this.originalUsers.find(e=>e.id===t.id)),Sf(t=>{this.userHasPendingChanges=!!this.usersHavingPendingChanges.find(e=>e.id===t.id),this.displayedColumns=this.isAdminView||this.userHasPendingChanges?f:y;}),_f(t=>this.getUserData(t)),B(this.destroyRef)).subscribe(()=>{this.accountGroupCtrl.setValue(this.accountGroups[0]),this.companyCtrl.setValue(this.companies[0]),this.accountSearchCtrl.setValue(""),this.showUnassignedAccounts$.next(false),this.accountRightFilters$.next(d),this.allowUserChange=false;});}observeDataFilterChange(){this.userChanged$.next(),CI([this.accountGroupCtrl.valueChanges.pipe(Xo((t,e)=>(0, ct.isEqual)(t,e))),this.companyCtrl.valueChanges.pipe(Xo((t,e)=>(0, ct.isEqual)(t,e))),this.showUnassignedAccounts$.pipe(Xo()),this.accountSearchText$.pipe(Xo()),this.accountRightFilters$.pipe(Xo((t,e)=>(0, ct.isEqual)(t,e)))]).pipe(be(([t,e,n,i,m])=>CI([hI(t),hI(e),hI(n),hI(i),hI(m),this.accountRights$.pipe(Zt(1))])),we$1(([t,e,n,i,m,g])=>this.filterData(g,t,e,n,i,m)),B(this.destroyRef),Mf(this.userChanged$)).subscribe(t=>{this.filteredAccountRights$.next(t);});}observeSearchTextChange(){this.accountSearchCtrl.valueChanges.pipe(hf(500),B(this.destroyRef)).subscribe(t=>this.accountSearchText$.next(t));}showStickyFooter(){this.stickyFooterVisible||(this.stickyFooterService.open(this.stickyFooterTemplate),this.stickyFooterVisible=true);}getRoleUpdateRequests(t){return this.shouldSendAccessBeforeCompanies(t)?[{id:t.id,access:true},{id:t.id,companies:t.companies}]:[t]}shouldSendAccessBeforeCompanies(t){if(!this.isCompanyRolesWithSubsidiaryAgreementsEnabled()||!t.companies?.length||this.isCompanyRolesWithSubsidiaryAgreementsSingleRequestEnabled())return false;let e=this.accountRightsAndPermissionsStore.state$.value?.companyRoles.find(i=>i.id===t.id);return !this.accountRightsAndPermissionsStore.unModifiedState$.value?.companyRoles.find(i=>i.id===t.id)?.access&&!!e?.access}updateData(t,e){if(!this.accountRightsAndPermissionsService.checkIfFormIsValid())return;let n=this.originalUsers.find(i=>i.id===this.userCtrl.value.id);CI([this.updateAccountRights(n,e),this.updateRoles(n,e)]).pipe(Zt(1)).subscribe(([i,m])=>{i===In||m.includes(In)||(this.dataCorporateAdminUsersApprovalsService.clearCache(),this.corporateAdminLogService.success(t),this.router.navigateByUrl(m$1));});}updateAccountRights(t,e){let n=this.accountRightsAndPermissionsStore.getChangedAccountRights();return this.accountRightsAndPermissionsStore.getChangedAccountRights()?.length>0?t.updateAccountRights(n,e).catch(i=>(this.corporateAdminLogService.error("There was an error while updating account rights",i,"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.UPDATE_ACCOUNT_RIGHTS.ALERT.ERROR"),In)):hI([])}updateRoles(t,e){let n,i=this.accountRightsAndPermissionsStore.getChangedRoles();return i.length>0?Ee(i).pipe(be(m=>Ee(this.getRoleUpdateRequests(m)).pipe(fp(g=>Ee(t.changeAccess(g,e))),Sa(g=>(n=g,hI(In))))),XI(),Sf(m=>{m.includes(In)&&this.corporateAdminLogService.error("There was an error while updating user roles",n,"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.UPDATE_ACCOUNT_RIGHTS.ALERT.ERROR");})):hI([])}static{this.\u0275fac=function(e){return new(e||o$2)};}
2static{this.\u0275cmp=qT({type:o$2,selectors:[["ng-component"]],viewQuery:function(e,n){if(e&1&&Qy(en,5)(tn,5),e&2){let i;FC(i=jC())&&(n.copyFromAnotherUserModalTemplate=i.first),FC(i=jC())&&(n.stickyFooterTemplate=i.first);}},standalone:false,decls:19,vars:21,consts:[["copyFromAnotherUserModalTemplate",""],["stickyFooterTemplate",""],["textInfo","ebankHelpButtonContent"],[1,"form-spinner",3,"loading","loadAnnouncement"],["translate",""],[1,"ebank-form","ebank-form-input",3,"formGroup"],["translate","PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.USER_SELECTOR.LABEL"],["formControlName","user","id","userSelector",1,"user-selector",3,"allowEmpty","isLoading","options","searchAttributes","titleOnMobile"],["selectTemplate","single",3,"labelMap"],[3,"loading","loadAnnouncement","spinnerDelay"],["translate","",1,"ebank-title-h2"],["buttonStyle","secondary",1,"copy-from-another-user-btn"],["formControlName","accountGroup",3,"isLoading","options"],["formControlName","company","labelMapProperty","companyName",3,"isLoading","options"],[3,"toggleValueChange","title","toggleValue"],[3,"content"],[3,"filters$"],["listStyle","compact-inline","groupHeadingId","account-counter-heading-id","id","account-counter-label"],["ebankDescriptionListItem",""],["ebankDescriptionListTerm",""],["ebankDescriptionListDesc",""],[1,"no-table-result"],[1,"roles-wrapper"],["roleType","user",3,"roles","disabledRoles"],["roleType","company",3,"roles","disabledRoles","userId"],[3,"cashPools","disabledRoles"],["buttonStyle","secondary",1,"copy-from-another-user-btn",3,"buttonClick"],["formControlName","accountSearch"],[3,"errorsChanged","accountRights","allAccountRights","displayedColumns","hasSingleCompany","loading$","tableData$","accountRightsAndPermissionsTable","viewOnlyTable"],["level","error"],[1,"ebank-list-ul"],[1,"ebank-list-li"],[1,"ebank-text-weight-medium"],[3,"copyAccountRights","modalRef","users"],["size","s",1,"send-for-approval"],["size","s",1,"save-changes"],["size","s",1,"send-for-approval",3,"buttonClick"],["size","s",1,"save-changes",3,"buttonClick"]],template:function(e,n){e&1&&(Ms(0,"ebank-spinner",3),N_(1,"async"),N_(2,"translate"),Ms(3,"ebank-lead-block")(4,"p",4),c_(5,"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.PAGE_DESCRIPTION"),rd()(),Ms(6,"form",5)(7,"ebank-form-field"),ky(8,"ebank-label",6),Ms(9,"ebank-simple-selector",7),N_(10,"async"),N_(11,"translate"),ky(12,"ebank-option-template",8),N_(13,"labelMap"),rd(),tT(),rd(),mC(14,An,40,52,"ebank-s
2pinner",9),rd()(),wy(15,Rn,1,2,"ng-template",null,0,L_)(17,fn,4,3,"ng-template",null,1,L_)),e&2&&(Ry("loading",R_(1,10,n.pageLoading$))("loadAnnouncement",R_(2,12,"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.FORM.LOADING")),mb(6),Ry("formGroup",n.form),mb(3),Ry("allowEmpty",true)("isLoading",R_(10,14,n.pageLoading$))("options",n.users)("searchAttributes",b_(20,nn))("titleOnMobile",R_(11,16,"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS.USER_SELECTOR.LABEL")),nT(),mb(3),Ry("labelMap",R_(13,18,n.labelMap.DisplayName)),mb(2),gC(n.userCtrl.value?14:-1));},dependencies:[z,q,T,mt$1,_e,fu,vO,G8,Ws,W8,X9,Nf,Rf,on$1,X3,eR,co,Ch,uo,Nl,sI,yI,i8,ru,H8,Pf,Bf,t8,sB,No,vI,Ys,lN,lB,Te,st,lt,mt,mn$1,t,ye],encapsulation:2,changeDetection:1});}};vM();pi();var Ii=(o$1,t)=>{let e=D(Q);return D(o).get().pipe(we$1(i=>i.administrator||i.administrator_view),Sf(i=>{i||e.navigateToUnauthorizedPage(a);}),Sa(i=>(e.handleBackendError("Error while getting access rights",i,a),hI(false))))};vM();var _n=[{path:"",component:dt,canActivate:[Ii],data:{breadcrumbLabel:"PAGE.USERS_LIST.HEADER",breadcrumbPath:"corporate-admin/users",title:"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS_HEADER",name:"account-rights-and-permissions",ebankuiPage:"large"}},{path:"error",component:J,data:{name:"account-rights-and-permissions-error",ebankuiPage:"medium ebankui-alert-page",title:"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS_HEADER"}},{path:"unauthorized",component:J,data:{name:"account-rights-and-permissions-unauthorized",ebankuiPage:"medium ebankui-alert-page",title:"PAGE.ACCOUNT_RIGHTS_AND_PERMISSIONS_HEADER"}}],ut=class o{static{this.\u0275fac=function(e){return new(e||o)};}static{this.\u0275mod=my({type:o});}static{this.\u0275inj=Oc({imports:[aa.forChild(_n),aa]});}};vM();var Oi=class o{static{this.\u0275fac=function(e){return new(e||o)};}static{this.\u0275mod=my({type:o});}static{this.\u0275inj=Oc({imports:[z,ut,Rn$1,q,R,m0,_e,Bn,a8,Q8,vO,X9,Nf,Rf,on$1,Cu,yI,i8,ru,H8,Pf,Bf,t8,sI,sB,m8,No,hi,n6,Ls,JI,vI,Ys,lN,x6,V6,H6,j6,lB,we]});}};export{Oi as AccountRightsAndPermissionsModule};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.