PageSourceSearch

https://nettbank.bnbank.no/ebank/web/9235/chunk-BkkcBg_T.js

js bnbank.no collected 2026-09-24 09:47:54 UTC 128,878 bytes, 3 lines download raw bytes

1import {L,G as G$1}from'./chunk-Ch6V68he.js';import {V as V$1,H as H$1,J,Q}from'./chunk-T3vBxKw0.js';import {o as o$2}from'./chunk-DsobRbkC.js';import {p as p$3}from'./chunk-ChU91JJL.js';import {X as X$1,e as ee$1}from'./chunk-Dfyns7Wc.js';import'./chunk-lrEbxK91.js';import {y as y$1}from'./chunk-3h9VR88y.js';import {y,A,T,U,B as B$2,w}from'./chunk-DPUKRWbP.js';import {p}from'./chunk-B2qlGaqX.js';import {V as Ve}from'./chunk-Db_Baw-a.js';import {o as o$1}from'./chunk-Cco1Crmt.js';import {G,C,i as c$1,j as j$3}from'./chunk-CWBrHG4i.js';import {a as t,o,c,p as p$1,B,x,k as n,h as h$1}from'./chunk-SDcs1xql.js';import {i as qt,p as i,m,j as j$1,T as Tt}from'./chunk-BdMK6VUw.js';import {S,E as E$3,N,F as F$1}from'./main-UKM7BIED.js';import {x as my,O as Oc,bi as dn,b3 as ii,e3 as Bn$1,e5 as a8,bh as _e,bl as Ga,bM as Ys,F as we,bB as X9,bA as Rf,bz as Nf,eD as O0,d3 as r8,el as k6,em as Y3,eE as _8,bx as Ro,cb as fN,bj as Cu,bV as K6,en as Vs,dL as yI,dM as i8,bG as sB,eF as a6,V,ak as aa$1,D,P as qT,ey as sN,ev as mg,ew as v6,br as Te,a2 as ye,a4 as ky,a3 as Ms,aM as N_,c2 as qy,a5 as rd,dS as mv,a6 as mC,aa as mb,a8 as Ry,bv as R_,dT as p_,ab as gC,bI as Qe,dP as QT,bn as ne,X,dz as E,t as de,bm as br$1,cj as H,ci as CI,w as we$1,_ as _f,n as hI,L as Do,ck as P,b6 as K$1,d as E$1,E as E$2,cF as eR,eJ as nR,eK as iR,cG as yi$1,eL as Eh,cH as co,cI as Ch,cJ as fh,cK as Ei$1,cL as Ml,cM as j$2,cN as u,aB as g,cX as X3,c_ as fu,bu as mn,eH as Sn,bK as p$2,cO as nd,cP as Qy,cQ as FC,cR as jC,f1 as Xv,eM as Sf,cV as B$1,f2 as H$2,eR as oR,cY as uo$1,cZ as Nl,eS as Cr$1,c$ as Pa$1,d0 as gu,d1 as on,d2 as sI,eu as f8,d4 as vI,f0 as M,A as D$1,eo as QI,d5 as No,ad as c_,d6 as tT,b$ as T_,d7 as nT,bY as IC,bZ as EC,d$ as yn,e0 as vn,c3 as HC,aN as cd,bT as hi,bU as ig,ez as q8,eP as o6,dg as D_,f3 as Ui$1,aL as RC,dU as h_,cD as Xo,e as ep,df as uD,ej as Zt,j as Sa,m as mI,bL as h,bN as Qs,f4 as nI,eW as Q8,dl as xt,eX as OC,eY as PC,bw as m_,cA as sd,cB as Qs$1,c1 as CC,di as pv,dk as fv,f5 as hf,f as Vn,c0 as wy,c6 as yh,c7 as vh,ei as O_,be as na$1,$ as $N,v as vM,h as he,cp as ct,dp as JN,f6 as Ol,cm as J$1,ba as cv,p as pi,c4 as Fh,W,N as N$1,J as da$1,c5 as Be$1,dC as q$1,dD as G$2,dV as vc,b as $n,aw as F,ct as w_,eI as Tn,dj as f_,dA as J$2,dW as os,aS as V$2,dQ as L_,a9 as C_,b_,eT as Ay,aO as k_,dR as vC,f7 as uv}from'./chunk-hxK0xzc4.js';import'./chunk-DROiOONM.js';import'./chunk-D1g3129g.js';na$1();$N();vM();na$1();vM();na$1();$N();he();var Ci=class o{constructor(){this.export=new ct;this.changeInBulk=new ct;this.selectControl=new JN(false);}set config(t){let{indeterminate:e,controlValue:i}=t;!e&&i!==this.selectControl.value&&this.selectControl.setValue(i),this._config=t;}get indeterminate(){return this._config?.indeterminate||false}get configControlValue(){return this._config?.indeterminate||false}ngOnInit(){this.subscription=this.selectControl.valueChanges.subscribe(this.changeInBulk);}ngOnDestroy(){this.subscription?.unsubscribe();}static{this.\u0275fac=function(e){return new(e||o)};}
1static{this.\u0275cmp=qT({type:o,selectors:[["document-archive-list-actions"]],inputs:{config:"config",disabled:"disabled",isSelected:"isSelected"},outputs:{export:"export",changeInBulk:"changeInBulk"},standalone:false,decls:6,vars:10,consts:[[3,"indeterminate","disabled","formControl"],["buttonStyle","tertiary",3,"buttonClick","disabled"]],template:function(e,i){e&1&&(Ms(0,"ebank-checkbox-field",0),c_(1),N_(2,"translate"),rd(),tT(),Ms(3,"ebank-button",1),qy("buttonClick",function(){return i.export.emit()}),c_(4),N_(5,"translate"),rd()),e&2&&(Ry("indeterminate",i.indeterminate)("disabled",i.disabled)("formControl",i.selectControl),nT(),mb(),cd("",R_(2,6,"PAGE.DOCUMENT_ARCHIVE.ACTION.SELECT")," "),mb(2),Ry("disabled",i.disabled||!i.isSelected),mb(),cd("",R_(5,8,"PAGE.DOCUMENT_ARCHIVE.ACTION.EXPORT_TO_PDF")," "));},dependencies:[co,Ol,j$2,Bn$1,_e,fu,ye],encapsulation:2});}};vM();J$1();$N();vM();he();var bi=class o{constructor(t){this.forwardLinkService=t;}onLinkOpened(){return S(this,null,function*(){yield this.forwardLinkService.open(this.externalLink);})}static{this.\u0275fac=function(e){return new(e||o)(Do(x))};}
1static{this.\u0275cmp=qT({type:o,selectors:[["document-archive-link-mobile"]],inputs:{externalLink:"externalLink"},standalone:false,decls:7,vars:4,consts:[[1,"ebank-link",3,"click"],["target","_blank","translate","",1,"ebank-link-link","ebank-dont-break-out","underline-text"],[1,"ebank-link-functional-icon"],[1,"ebank-sr-only"]],template:function(e,i){e&1&&(Ms(0,"div",0),qy("click",function(){return i.onLinkOpened()}),Ms(1,"span",1),c_(2),Ms(3,"span",2)(4,"span",3),c_(5),N_(6,"translate"),rd()()()()),e&2&&(mb(2),cd(" ","PAGE.DOCUMENT_ARCHIVE.EXPORT.VIEW_DETAILS"," "),mb(3),cv(R_(6,2,"EBANKUI.CONFIG.EXTERNAL.LINK")));},dependencies:[Te,ye],encapsulation:2,changeDetection:1});}};he();vM();he();var Si=class o{constructor(t){this.translate=t;}transform(t){let e=t.reportId,i=t.type;if(t.group==="ESIGNBM")return i;let s=["leiekontrakt","frigivelsesbrev","kontoavtale","depositumskontoavtale"],_=i&&i.trim();return i&&s.includes(_.toLowerCase())?this.translate.instant(`PAGE.DOCUMENT_ARCHIVE.DOCUMENT_TYPE.${_.toUpperCase()}`):e&&!e.startsWith("BEMERC")&&!e.startsWith("BEMEBA")?this.translate.instant(`PAGE.DOCUMENT_ARCHIVE.DOCUMENT_TYPE.${e.substr(0,6)}`):i}static{this.\u0275fac=function(e){return new(e||o)(Do(V,16))};}static{this.\u0275pipe=QT({name:"documentFileNameFormat",type:o,pure:true,standalone:false});}};function Wn(o,t){if(o&1&&(Ms(0,"div",5),c_(1),rd()),o&2){let e=RC();mb(),cv(e.item.type);}}function Xn(o,t){if(o&1&&(Ms(0,"div",5),c_(1),N_(2,"documentFileNameFormat"),rd()),o&2){let e=RC();mb(),cv(R_(2,1,e.item));}}function zn(o,t){if(o&1&&(Ms(0,"span",7),c_(1),rd()),o&2){let e=RC();mb(),cv(e.item.accountName);}}function qn(o,t){o&1&&(Ms(0,"span"),c_(1,"\xA0 - \xA0"),rd());}function Kn(o,t){if(o&1&&(Ms(0,"span",8),c_(1),N_(2,"accountNumberFormat"),rd()),o&2){let e=RC();mb(),cv(R_(2,1,e.item.accountNumber));}}function Qn(o,t){if(o&1&&(Ms(0,"ebank-link",9),c_(1),N_(2,"translate"),rd()),o&2){let e=RC();Ry("href",e.item.href)("external",true),mb(),cd(" ",R_(2,3,"PAGE.DOCUMENT_ARCHIVE.EXPORT.VIEW_DETAILS")," ");}}function Zn(o,t){if(o&1&&ky(0,"document-archive-link-mobile",10),o&2){let e=RC();Ry("externalLink",e.item.hrefMobile);}}var Ei=class o{constructor(t){this.context=t;this.isMobile=false;this.isCorporate=false;}ngOnInit(){this.checkApplicationContext();}checkApplicationContext(){this.isMobile=this.context.isNativeApp,this.isCorporate=this.context.isCorporate;}static{this.\u0275fac=function(e){return new(e||o)(Do(P))};}
1static{this.\u0275cmp=qT({type:o,selectors:[["document-archive-list-item"]],inputs:{item:"item"},standalone:false,decls:17,vars:12,consts:[[1,"date"],[1,"month"],[1,"day"],[1,"year"],[1,"left-content"],[1,"type"],[1,"account"],[1,"account-name"],[1,"account-number"],[3,"href","external"],[3,"externalLink"]],template:function(e,i){e&1&&(Ms(0,"div",0)(1,"div",1),c_(2),N_(3,"monthNameShort"),rd(),Ms(4,"div",2),c_(5),rd(),Ms(6,"div",3),c_(7),rd()(),Ms(8,"div",4),mC(9,Wn,2,1,"div",5),mC(10,Xn,3,3,"div",5),Ms(11,"div",6),mC(12,zn,2,1,"span",7),mC(13,qn,2,0,"span"),mC(14,Kn,3,3,"span",8),rd(),mC(15,Qn,3,5,"ebank-link",9),mC(16,Zn,1,1,"document-archive-link-mobile",10),rd()),e&2&&(mb(2),cv(R_(3,10,i.item.date)),mb(3),cv(i.item.date.date()),mb(2),cv(i.item.date.year()),mb(2),gC(i.isCorporate?-1:9),mb(),gC(i.isCorporate?10:-1),mb(2),gC(i.item.accountName?12:-1),mb(),gC(i.item.accountName&&i.item.accountNumber?13:-1),mb(),gC(i.item.accountNumber?14:-1),mb(),gC(i.isMobile?-1:15),mb(),gC(i.isMobile?16:-1));},dependencies:[Qs,bi,ye,p$2,o$2,Si],encapsulation:2});}};var ee=N(ep());pi();Fh();vM();pi();vM();var At=class o{constructor(){this.config={increment:30};this.limit=new br$1(0);this.dateProp="main";}setLimit(t){this.limit.next(t);}static{this.\u0275fac=function(e){return new(e||o)};}static{this.\u0275prov=X({token:o,factory:o.\u0275fac,providedIn:"root"});}};var Nn=N(j$3());vM();W();N$1();he();var yi=class o{constructor(t,e,i){this.log=t;this.alert=e;this.translateService=i;}export(t){return S(this,null,function*(){let e=yield t?.exportDocumentToPdf();this.processAndDownload(e,t?.id);})}processAndDownload(t,e){try{if(!(t?.content||t?.contentDisposition))throw new Error("error");this.saveAs(t.content,e);}catch(i){this.onError(e);}}saveAs(t,e){let i=`${this.translateService.instant("PAGE.DOCUMENT_ARCHIVE.DOCUMENT",{id:e})}.pdf`;(0, Nn.saveAs)(t,i);}onError(t){this.alert.error("PAGE.DOCUMENT_ARCHIVE.EXPORT.ERROR"),this.log.error(`Error while exporting document archive item: ${t}`);}static{this.\u0275fac=function(e){return new(e||o)(de(E$1),de(E$2),de(V))};}static{this.\u0275prov=X({token:o,factory:o.\u0275fac,providedIn:"root"});}};vM();var Ii=class o{setValue(t,e){t.isSelected=e;}toggle(t){this.setValue(t,!t.isSelected);}deselectAll(t){t.forEach(e=>this.setValue(e,false));}selectAll(t){t.forEach(e=>this.setValue(e,true));}isAnyItemSelected(t){return t.some(e=>e.isSelected)}haveAlItemsSelected(t){return t.every(e=>e.isSelected)}static{this.\u0275fac=function(e){return new(e||o)};}static{this.\u0275prov=X({token:o,factory:o.\u0275fac,providedIn:"any"});}};J$1();var Rn=(o,t)=>t.id;function tr(o,t){if(o&1){let e=CC();Ms(0,"document-archive-list-actions",3),qy("export",function(){yh(e);let n=RC(2);return vh(n.export())})("changeInBulk",function(n){yh(e);let s=RC(2);return vh(s.changeInBulk(n))}),rd();}if(o&2){let e=RC(2);Ry("config",e.actionsConfig)("disabled",e.isExporting)("isSelected",e.isSelectedItem);}}function ir(o,t){if(o&1&&ky(0,"document-archive-list-item",4),o&2){let e=t.$implicit;Ry("item",e);}}function or(o,t){if(o&1&&IC(0,ir,1,1,"document-archive-list-item",4,Rn),o&2){let e=RC(2);EC(e.documentItems);}}function nr(o,t){if(o&1){let e=CC();Ms(0,"ebank-checkbox-field",6),qy("click",function(){let n=yh(e).$implicit,s=RC(3);return vh(s.onSelect(n))}),ky(1,"document-archive-list-item",7),rd();}if(o&2){let e=t.$implicit,i=RC(3);Ry("checked",e.isSelected)("disabled",i.isExporting),mb(),Ry("item",e);}}function rr(o,t){if(o&1&&(Ms(0,"ebank-checkbox-field-group"),IC(1,nr,2,3,"ebank-checkbox-field",5,Rn),N_(3,"slice"),rd()),o&2){let e=RC(2);mb(),EC(O_(3,0,e.documentItems,0,e.limit));}}function ar(o,t){if(o&1){let e=CC();sd(0,1),pv("limitChange",function(n){yh(e);let s=RC();return f_(s.limit,n)||(s.limit=n),vh(n)}),mC(1,tr,1,3,"document-archive-list-actions",2),mC(2,or,2,0)(3,rr,4,4,"ebank-checkbox-field-group"),Qs$1();}if(o&2){let e=RC();Ry("list",e.documentItems),fv("limit",e.limit),Ry("config",e.config)("isInfiniteScrollActivated",true),mb(),gC(e.context.
1isCorporate&&!e.context.isMobileDevice?1:-1),mb(),gC(!e.context.isCorporate||e.context.isCorporate&&e.context.isMobileDevice?2:3);}}var ft=class o{constructor(t,e,i,n,s,_){this.dataAccounts=t;this.documentArchiveService=e;this.documentArchiveExportService=i;this.documentArchiveExportSelectService=n;this.forwardLinkService=s;this.context=_;this.isExporting=false;this.isSelectedItem=false;this.documentSubscription=new H;this.limitSubscription=new H;}ngOnDestroy(){this.documentSubscription&&this.documentSubscription.unsubscribe(),this.limitSubscription&&this.limitSubscription.unsubscribe();}ngOnInit(){this.config=this.documentArchiveService.config,this.limitSubscription=this.documentArchiveService.limit.subscribe(t=>{this.limit=t;}),this.documentSubject=new ne,this.documentSubscription=CI(this.dataAccounts.get(),this.documentSubject).pipe(_f(([t,e])=>{let i=(0, ee.map)(e,n=>{let s={id:(0, ee.get)(n,"id"),accountIdReference:(0, ee.get)(n,"accountIdReference"),defaultExpanded:false,accountNumber:(0, ee.get)(n,"account.number"),date:(0, ee.get)(n,"dates."+this.documentArchiveService.dateProp),type:(0, ee.get)(n,"type"),metaData:(0, ee.get)(n,"metaData"),customerId:(0, ee.get)(n,"customerId"),isSelected:false,group:(0, ee.get)(n,"group"),reportId:(0, ee.get)(n,"reportId")};if(n.hasLink("document")&&(s.href=this.forwardLinkService.getForwardAppUrl((0, ee.get)(n,"links.document.href")),s.hrefMobile=n.links.document.href),s.accountIdReference){let _=(0, ee.find)(t,G=>G.id===s.accountIdReference);_&&(s.accountName=_.getName());}return s});return hI(i)})).subscribe(t=>{this.documentItems=t;});}ngOnChanges(){this.documentSubject&&this.documentSubject.next(this.documents);}get actionsConfig(){return {indeterminate:this.isIndeterminate(),controlValue:this.haveAlItemsSelected()}}haveAlItemsSelected(){return this.documentArchiveExportSelectService.haveAlItemsSelected(this.documentItems)}isIndeterminate(){return this.documentArchiveExportSelectService.isAnyItemSelected(this.documentItems)&&!this.haveAlItemsSelected()}getResourcesToExport(){return this.documentItems.map(t=>this.documents.find(e=>e.id===t.id&&t.isSelected)).filter(t=>t)}export(){this.isExporting=true,Promise.all(this.getResourcesToExport().map(t=>this.documentArchiveExportService.export(t))).then(()=>this.isExporting=false).catch(()=>this.isExporting=false);}changeInBulk(t){t?this.documentArchiveExportSelectService.selectAll(this.documentItems):this.documentArchiveExportSelectService.deselectAll(this.documentItems),this.checkIsItemSelected();}onSelect(t){this.isExporting||(this.documentArchiveExportSelectService.toggle(t),this.checkIsItemSelected());}checkIsItemSelected(){this.isSelectedItem=this.documentArchiveExportSelectService.isAnyItemSelected(this.documentItems);}static{this.\u0275fac=function(e){return new(e||o)(Do(G),Do(At),Do(yi),Do(Ii),Do(x),Do(P))};}
1static{this.\u0275cmp=qT({type:o,selectors:[["document-archive-list"]],inputs:{documents:"documents",loading:"loading"},standalone:false,features:[uD],decls:1,vars:1,consts:[["infiniteScroll","",3,"list","limit","config","isInfiniteScrollActivated"],["infiniteScroll","",3,"limitChange","list","limit","config","isInfiniteScrollActivated"],[3,"config","disabled","isSelected"],[3,"export","changeInBulk","config","disabled","isSelected"],[1,"pib-document-archive-list-item",3,"item"],[3,"checked","disabled"],[3,"click","checked","disabled"],[1,"cib-document-archive-list-item",3,"item"]],template:function(e,i){e&1&&mC(0,ar,4,6,"ng-container",0),e&2&&gC(i.documentItems?.length?0:-1);},encapsulation:2,changeDetection:1});}};da$1();var j=N(ep());Be$1();pi();vM();J$1();da$1();q$1();vM();G$2();vc();var Be=class o extends E{constructor(e,i){super();this.dsObservable=e;this.DS=i;this.dsNames=["documentArchiveGroups"];}fetch(){return this.DS.findAll("documentArchiveGroups")}fromCache(){return this.DS.getAll("documentArchiveGroups")}static{this.\u0275fac=function(i){return new(i||o)(de(J$2),de(os))};}static{this.\u0275prov=X({token:o,factory:o.\u0275fac,providedIn:"root"});}};q$1();Be$1();vM();G$2();vc();J$1();var Oi=class o extends E{constructor(e,i,n){super();this.dsObservable=e;this.DS=i;this.context=n;this.dsNames=["documentArchive"];}fetch(e){return this.DS.create("documentArchive",e)}fromCache(e,i){let n=this.context.isCorporate?"posting":"main",s=i.filter(_=>{let G=Qe(_.dates[n]).format("YYYY-MM-DD");return _.group===e.group&&e.fromDate&&e.toDate?G>=e.fromDate&&G<=e.toDate:_.group===e.group});return e.account&&(s=s.filter(_=>_.account&&_.accountIdReference===e.account)),s}static{this.\u0275fac=function(i){return new(i||o)(de(J$2),de(os),de(P))};}static{this.\u0275prov=X({token:o,factory:o.\u0275fac,providedIn:"root"});}};he();Be$1();vM();var We=class o{transform(t,e){if(!t||!e)return t;let i=Qe().diff(Qe(e,"DD.MM.YYYY"),"years",true),n=Qe().diff(Qe(e,"DD.MM.YYYY"),"days"),s=[];return n<=30?s=["1","2","3"]:n<=182?s=["2","3"]:i<=1&&(s=["3"]),t.filter(_=>!s.includes(_.id))}static{this.\u0275fac=function(e){return new(e||o)};}static{this.\u0275pipe=QT({name:"authorizedFromDate",type:o,pure:true,standalone:false});}};W();N$1();h$1();na$1();$N();$n();var ur=["documentArchiveForm"],Pt=o=>({date:o}),pr=(o,t)=>t.group,Ln=(o,t)=>t.id;function dr(o,t){if(o&1&&(Ms(0,"option",13),c_(1),rd()),o&2){let e=t.$implicit;Ry("value",e.group),mb(),cv(e.displayName);}}function hr(o,t){if(o&1){let e=CC();Ms(0,"div",8)(1,"div",9)(2,"div",20)(3,"div",21)(4,"label",22),c_(5,"COMPONENTS.ACCOUNTOWNERS_TYPEAHEAD.LABEL"),rd(),Ms(6,"account-owners-typeahead",23),qy("selectEvent",function(n){yh(e);let s=RC(2);return vh(s.accountOwnersChanged(n))}),Ms(7,"input",24,1),pv("ngModelChange",function(n){yh(e);let s=RC(2);return f_(s.model.chosenAccountOwner,n)||(s.model.chosenAccountOwner=n),vh(n)}),rd(),tT(),rd(),Ms(9,"validation-error-wrapper"),ky(10,"validation-error-message",25),rd()()()()();}if(o&2){let e=HC(8),i=RC(2);mb(6),Ry("accountOwners",i.accountOwners)("selectedAccountOwners",i.model.chosenAccountOwner),mb(),fv("ngModel",i.model.chosenAccountOwner),Ry("sbTypeahead",void 0),nT(),mb(3),Ry("field",e);}}function vr(o,t){if(o&1&&(Ms(0,"option",13),c_(1),N_(2,"translate"),rd()),o&2){let e=t.$implicit;Ry("value",e.id),mb(),cd(" ",R_(2,2,e.displayName)," ");}}function Ar(o,t){if(o&1){let e=CC();Ms(0,"div",21)(1,"label",27),c_(2,"PAGE.DOCUMENT_ARCHIVE.DATE_SEARCH.LABEL"),rd(),Ms(3,"select",28),pv("ngModelChange",function(n){yh(e);let s=RC(3);return f_(s.model.chosenPeriodId,n)||(s.model.chosenPeriodId=n),vh(n)}),qy("ngModelChange",function(){yh(e);let n=RC(3);return vh(n.periodSelected())}),IC(4,vr,3,4,"option",13,Ln),N_(6,"authorizedFromDate"),rd(),tT(),rd();}if(o&2){let e=RC(3);mb(3),fv("ngModel",e.model.chosenPeriodId),nT(),mb(),EC(k_(6,1,e.periods,e.validFromDate));}}function fr(o,t){o&1&&(Ms(0,"div",32),c_(1," PAGE.DOCUMENT_ARCHIVE.DATE_FIELD.ERROR.REQUIRED_FROM "),rd());}function Dr(o,t){o&1&&(Ms(0,"div",33),c_(1," PAGE.DOCUMENT_ARCHIVE.DATE_FIELD.ERROR.FORMAT "),rd());}function Cr(o,t){if(o&1&&(Ms(0,"div",34),c_(1),N_(2,"translate"),rd()),o&2){let e=RC(5);mb(),cd(" ",k_(2,1,e.validFromDate?"PAGE.DOCUMENT_ARCHIVE.DATE_FIELD.ERROR.MINDATE_AUTHORIZED":"PAGE.DOCUMENT_ARCHIVE.DATE_FIELD.ERROR.MINDATE",T_(4,Pt,e.minDateFrom?e.minDateFrom.format("DD.MM.YYYY"):""))," ");}}function br(o,t){if(o&1&&(Ms(0,"div",35),c_(1," PAGE.DOCUMENT_ARCHIVE.DATE_FIELD.ERROR.MAXDATE_FROM "),rd()),o&2){let e=RC(5);Ry("translateParams",T_(1,Pt,e.maxDateFrom?e.maxDateFrom.format("DD.MM.YYYY"):e.today.format("DD.MM.YYYY")));}}
1function Sr(o,t){o&1&&(Ms(0,"div",39),c_(1," PAGE.DOCUMENT_ARCHIVE.DATE_FIELD.ERROR.REQUIRED_TO "),rd());}function Er(o,t){o&1&&(Ms(0,"div",40),c_(1," PAGE.DOCUMENT_ARCHIVE.DATE_FIELD.ERROR.FORMAT "),rd());}function _r(o,t){if(o&1&&(Ms(0,"div",41),c_(1," PAGE.DOCUMENT_ARCHIVE.DATE_FIELD.ERROR.MINDATE "),rd()),o&2){let e=RC(5);Ry("translateParams",T_(1,Pt,e.minDateTo.format("DD.MM.YYYY")));}}function gr(o,t){if(o&1&&(Ms(0,"div",42),c_(1," PAGE.DOCUMENT_ARCHIVE.DATE_FIELD.ERROR.MAXDATE_TO "),rd()),o&2){let e=RC(5);Ry("translateParams",T_(1,Pt,e.today.format("DD.MM.YYYY")));}}function yr(o,t){if(o&1){let e=CC();Ms(0,"div")(1,"label",29),c_(2,"PAGE.DOCUMENT_ARCHIVE.DATE_FIELD.FROM.LABEL"),rd(),Ms(3,"dp-date-picker",30,2),N_(5,"translate"),qy("onChange",function(){yh(e);let n=RC(4);return vh(n.dateChanged("fromDate"))}),pv("ngModelChange",function(n){yh(e);let s=RC(4);return f_(s.model.chosenDateFrom,n)||(s.model.chosenDateFrom=n),vh(n)}),rd(),tT(),Ms(6,"div",31),mC(7,fr,2,0,"div",32),mC(8,Dr,2,0,"div",33),mC(9,Cr,3,6,"div",34),mC(10,br,2,3,"div",35),rd(),Ms(11,"label",36),c_(12,"PAGE.DOCUMENT_ARCHIVE.DATE_FIELD.TO.LABEL"),rd(),Ms(13,"dp-date-picker",37,3),N_(15,"translate"),qy("onChange",function(){yh(e);let n=RC(4);return vh(n.dateChanged("toDate"))}),pv("ngModelChange",function(n){yh(e);let s=RC(4);return f_(s.model.chosenDateTo,n)||(s.model.chosenDateTo=n),vh(n)}),rd(),tT(),Ms(16,"div",38),mC(17,Sr,2,0,"div",39),mC(18,Er,2,0,"div",40),mC(19,_r,2,3,"div",41),mC(20,gr,2,3,"div",42),rd()();}if(o&2){let e=HC(4),i=HC(14),n=RC(4);mb(3),Ry("config",n.dateConfigFrom)("displayDate",n.displayDateFrom)("minDate",n.minDateFrom)("maxDate",n.maxDateFrom?n.maxDateFrom:n.today),fv("ngModel",n.model.chosenDateFrom),Ry("placeholder",R_(5,20,"PAGE.DOCUMENT_ARCHIVE.DATE_FIELD.PLACEHOLDER")),nT(),mb(4),gC(e.errors?.required?7:-1),mb(),gC(e.errors?.format?8:-1),mb(),gC(e.errors?.minDate?9:-1),mb(),gC(e.errors?.maxDate?10:-1),mb(3),Ry("config",n.dateConfigTo)("displayDate",n.displayDateTo)("minDate",n.minDateTo)("maxDate",n.today),fv("ngModel",n.model.chosenDateTo),Ry("placeholder",R_(15,22,"PAGE.DOCUMENT_ARCHIVE.DATE_FIELD.PLACEHOLDER")),nT(),mb(4),gC(i.errors?.required?17:-1),mb(),gC(i.errors?.format?18:-1),mb(),gC(i.errors?.minDate?19:-1),mb(),gC(i.errors?.maxDate?20:-1);}}function Ir(o,t){if(o&1&&(Ms(0,"option",13),c_(1),rd()),o&2){let e=t.$implicit;Ry("value",e),mb(),cv(e);}}function Tr(o,t){if(o&1){let e=CC();Ms(0,"div",8)(1,"div",9)(2,"div",10)(3,"label",43),c_(4,"PAGE.DOCUMENT_ARCHIVE.DATE_FIELD.YEAR.LABEL"),rd(),Ms(5,"select",44),pv("ngModelChange",function(n){yh(e);let s=RC(4);return f_(s.model.chosenDateYear,n)||(s.model.chosenDateYear=n),vh(n)}),IC(6,Ir,2,2,"option",13,vC),rd(),tT(),rd()()();}if(o&2){let e=RC(4);mb(5),fv("ngModel",e.model.chosenDateYear),nT(),mb(),EC(e.listOfYears);}}function xr(o,t){if(o&1&&(Ms(0,"div",26),mC(1,yr,21,24,"div"),mC(2,Tr,8,1,"div",8),rd()),o&2){let e=RC(3);mb(),gC(e.model.chosenGroupId!=="AARSOPPG"||!e.context.isCorporate?1:-1),mb(),gC(e.model.chosenGroupId==="AARSOPPG"&&e.context.isCorporate?2:-1);}}function Or(o,t){if(o&1&&(Ms(0,"div",8)(1,"div",9),mC(2,Ar,7,4,"div",21),mC(3,xr,3,2,"div",26),rd()()),o&2){let e=RC(2);
1mb(2),gC(e.context.isCorporate?-1:2),mb(),gC(e.model&&e.model.chosenPeriodId==="4"||e.context.isCorporate?3:-1);}}function Fr(o,t){if(o&1&&(Ms(0,"option",13),c_(1),N_(2,"accountNumberFormat"),rd()),o&2){let e=t.$implicit;Ry("value",e.id),mb(),uv(" ",e.getName()," - ",R_(2,4,e.getNumber())," ",e.disp===true?"("+e.owner.name+")":""," ");}}function Pr(o,t){if(o&1&&(Ms(0,"div",48),c_(1," PAGE.DOCUMENT_ARCHIVE.ACCOUNT_SEARCH.AUTHORIZED_FROM_DATE "),rd()),o&2){let e=RC(4);Ry("translateParams",T_(1,Pt,e.validFromDate));}}function kr(o,t){if(o&1){let e=CC();Ms(0,"div",21)(1,"label",45),c_(2,"PAGE.DOCUMENT_ARCHIVE.ACCOUNT_SEARCH.LABEL"),rd(),Ms(3,"select",46),pv("ngModelChange",function(n){yh(e);let s=RC(3);return f_(s.model.chosenAccountId,n)||(s.model.chosenAccountId=n),vh(n)}),qy("change",function(){yh(e);let n=RC(3);return vh(n.accountSelected())}),Ms(4,"option",47),c_(5,"PAGE.DOCUMENT_ARCHIVE.ACCOUNT_SEARCH.PLACEHOLDER"),rd(),IC(6,Fr,3,6,"option",13,Ln),rd(),tT(),mC(8,Pr,2,3,"div",48),rd();}if(o&2){let e=RC(3);mb(3),fv("ngModel",e.model.chosenAccountId),nT(),mb(3),EC(e.accounts),mb(2),gC(e.validFromDate?8:-1);}}function Nr(o,t){if(o&1){let e=CC();Ms(0,"div",21)(1,"label",45),c_(2,"PAGE.DOCUMENT_ARCHIVE.ACCOUNT_SEARCH.LABEL"),rd(),Ms(3,"asset-selector",49)(4,"input",50,4),N_(6,"translate"),pv("ngModelChange",function(n){yh(e);let s=RC(3);return f_(s.model.chosenAccount,n)||(s.model.chosenAccount=n),vh(n)}),qy("ngModelChange",function(n){yh(e);let s=RC(3);return vh(s.accountSelected(n))}),rd(),tT(),rd(),Ms(7,"validation-error-wrapper"),ky(8,"validation-error-message",51)(9,"validation-error-message",52)(10,"validation-error-message",53),rd()();}if(o&2){let e=HC(5),i=RC(3);mb(3),Ry("assets",i.accounts)("className","document-archive-item"),mb(),Ry("placeholder",m_(R_(6,12,"PAGE.DOCUMENT_ARCHIVE.ACCOUNT_SEARCH.PLACEHOLDER")))("sbTypeahead",void 0),fv("ngModel",i.model.chosenAccount),nT(),mb(4),Ry("field",e)("message","PAGE.DOCUMENT_ARCHIVE.ACCOUNT_SEARCH.VALIDATION_ERROR"),mb(),Ry("field",e)("message","PAGE.DOCUMENT_ARCHIVE.ACCOUNT_SEARCH.VALIDATION_ERROR_NUMBER"),mb(),Ry("field",e)("message","PAGE.DOCUMENT_ARCHIVE.ACCOUNT_SEARCH.VALIDATION_ERROR_NOT_CHOSEN");}}function Mr(o,t){if(o&1&&(Ms(0,"div",8)(1,"div",9),mC(2,kr,9,2,"div",21),mC(3,Nr,11,14,"div",21),rd()()),o&2){let e=RC(2);
1mb(2),gC(e.context.isCorporate?-1:2),mb(),gC(e.context.isCorporate?3:-1);}}function Rr(o,t){o&1&&(Ms(0,"span",16),c_(1,"PAGE.DOCUMENT_ARCHIVE.SEARCH.BUTTON"),rd());}function Vr(o,t){if(o&1&&(ky(0,"loading-spinner",17),N_(1,"async")),o&2){let e=RC(2);Ry("loading",R_(1,1,e.saving));}}function wr(o,t){if(o&1&&(Ms(0,"span",56),c_(1),N_(2,"i18nPlural"),N_(3,"translate"),rd()),o&2){let e=RC(3);mb(),cv(k_(3,4,k_(2,1,e.documents.length,e.infoSnapshot.messageMapping),e.infoSnapshot));}}function Lr(o,t){if(o&1){let e=CC();Ms(0,"div",18)(1,"button",54),N_(2,"translate"),qy("click",function(){yh(e);let n=RC(2);return vh(n.clearFilter())}),Ms(3,"span",55),c_(4,"\xD7"),rd()(),mC(5,wr,4,7,"span",56),rd();}if(o&2){let e=RC(2);mb(),Ay("aria-label",R_(2,2,"PAGE.DOCUMENT_ARCHIVE.CLOSE.ARIA.LABEL")),mb(4),gC(e.infoSnapshot?5:-1);}}function Gr(o,t){if(o&1){let e=CC();Ms(0,"div")(1,"form",7,0),qy("ngSubmit",function(){yh(e);let n=RC();return vh(n.performSearch())}),Ms(3,"div",8)(4,"div",9)(5,"div",10)(6,"label",11),c_(7,"PAGE.DOCUMENT_ARCHIVE.DOCUMENT_TYPE.LABEL"),rd(),Ms(8,"select",12),pv("ngModelChange",function(n){yh(e);let s=RC();return f_(s.model.chosenGroupId,n)||(s.model.chosenGroupId=n),vh(n)}),qy("ngModelChange",function(){yh(e);let n=RC();return vh(n.groupSelected())}),IC(9,dr,2,2,"option",13,pr),rd(),tT(),rd()()(),mC(11,hr,11,5,"div",8),mC(12,Or,4,2,"div",8),mC(13,Mr,4,2,"div",8),Ms(14,"div",8)(15,"div",9)(16,"div",14)(17,"button",15),mC(18,Rr,2,0,"span",16),N_(19,"async"),nd(20,Vr,2,3,"loading-spinner",17),rd()()()()(),mC(21,Lr,6,4,"div",18),ky(22,"document-archive-list",19),rd();}if(o&2){let e=RC();mb(8),fv("ngModel",e.model.chosenGroupId),nT(),mb(),EC(e.groups),mb(2),gC(e.config.showAgreementSelector&&e.agreementSearch?11:-1),mb(),gC(e.dateSearch?12:-1),mb(),gC(e.accountSearch?13:-1),mb(5),gC(R_(19,8,e.saving)===false?18:20),mb(3),gC(e.showFilterResultBox()?21:-1),mb(),Ry("documents",e.documents)("loading",e.saving);}}function Ur(o,t){o&1&&ky(0,"page-loading-spinner");}var Fi=class o{constructor(t,e,i,n,s,_,G,re,St,fo,ae,cc,sc,mc,jn){this.context=t;this.activatedRoute=e;this.dataDocumentArchiveGroups=i;this.dataAccounts=n;this.dataDocumentArchive=s;this.datePickerService=_;this.translate=G;this.documentArchiveService=re;this.accountOwnersTypeaheadService=St;this.accountsUtil=fo;this.authorizedFromDatePipe=ae;this.log=cc;this.alert=sc;this.customersService=mc;this.today=Qe().endOf("day");this.saving=new br$1(false);this.dateSearch=true;this.accountSearch=true;this.agreementSearch=true;this.limit=25;this.accountOwners=[];this.listOfYears=[];this.notSelectedAccount=[null,void 0,"none"];this.loadingGroups=new br$1(false);this.loadingAccounts=new br$1(false);this.loadingStakeholders=new br$1(false);this.performSearchSubscription=new H;this.searchInfoSubscription=new H;this.limitSubscription=new H;this.activatedRouteSubscription=new H;this.customerSubscription=new H;this.dateFormat="YYYY-MM-DD";this.number=500;this.config=jn.config;}ngOnInit(){this.resetForm(),this.periods=this.getPeriods(),this.dateConfigTo=this.datePickerService.set({min:this.model.chosenDateFrom,max:this.today}),this.dateConfigFrom=this.datePickerService.set({max:this.today}),this.displayDateFrom=Qe(this.model.chosenDateFrom),this.displayDateTo=Qe(this.model.chosenDateTo),this.setListOfYears(),this.documentArchiveService.dateProp=this.context.isCorporate?"posting":"main",this.activatedRouteSubscription=this.activatedRoute.queryParams.subscribe(e=>{this.groupParam=e.group,this.accountParam=e.account,this.searchParam=e.search,this.accountOwnerId=e.accountowner;}),this.loading=CI(this.loadingGroups,this.loadingAccounts,this.loadingStakeholders).pipe(we$1(e=>e.includes(true))),this.limitSubscription=this.documentArchiveService.limit.subscribe(e=>{this.limit=e;});let t=this.dataDocumentArchiveGroups.get(void 0,this.loadingGroups);t?t.pipe(_f(e=>this.loadAndCombineResources(e))).subscribe(e=>{if((this.context.isCorporate||this.config.overrideDocumentTypeListTexts)&&e.groups.forEach(i=>{i.displayName=this.translate.instant("PAGE.DOCUMENT_ARCHIVE.DOCUMENT_TYPE."+i.group.toUpperCase());}),this.groups=e.groups,e.accounts&&e.accounts.length>0){let i=this.accountsUtil.showRobAccounts(e.accounts);i=this.accountsUtil.filterRights(i,["accessPermission"]);let n=this.accountsUtil.sortAccounts(i),s=n.owner||[],_=n.disp||[];this.accounts=s.concat(_),this.model.chosenAccountId=this.accountParam||this.accounts[0].id,this.model.chosenAccountId&&this.context.
1isCorporate&&this.selectAccountById(this.model.chosenAccountId),this.model.chosenAccountNumber=this.accounts[0].getNumber(),this.model.chosenAccountName=this.accounts[0].getName(),this.accountsCopy=[...this.accounts];}this.model.chosenPeriodId=this.context.isCorporate?"4":"2",this.setGroupId(),this.groupSelected(),this.searchParam==="true"&&this.performSearch();},e=>{this.log.error("something wrong happened while fetching documentarchivegroups",e),this.alert.serverError(e,"PAGE.DOCUMENT_ARCHIVE.LOAD_ERROR");}):(this.log.error("observable for document archive is not defined"),this.alert.error("PAGE.DOCUMENT_ARCHIVE.LOAD_ERROR")),this.customerSubscription=this.customersService.get().subscribe(e=>{this.customerNumber=e.customerNumber;},e=>{this.log.error("Failed to load customer data - stakeholder date validation will not be available",e);});}ngOnDestroy(){this.performSearchSubscription&&this.performSearchSubscription.unsubscribe(),this.searchInfoSubscription&&this.searchInfoSubscription.unsubscribe(),this.limitSubscription&&this.limitSubscription.unsubscribe(),this.activatedRouteSubscription&&this.activatedRouteSubscription.unsubscribe(),this.customerSubscription&&this.customerSubscription.unsubscribe();}ngAfterViewChecked(){this.formChanged();}formChanged(){this.currentForm!==this.documentArchiveForm&&(this.documentArchiveForm=this.currentForm);}dateChanged(t){let{chosenDateFrom:e,chosenDateTo:i}=this.model;if(t==="fromDate"&&Qe.isDayjs(e)){let n=e.startOf("day");n.isSame(this.minDateTo)||(this.dateConfigTo=this.datePickerService.set({min:n,max:this.today}),this.minDateTo=n);}else if(t==="toDate"&&Qe.isDayjs(i)){let s=(i&&!i.isAfter(this.today)?i:this.today).endOf("day");s.isSame(this.dateConfigFrom.max)||(this.dateConfigFrom.max=s);}}accountOwnersChanged(t){let e=t.id||void 0;this.accountOwnersTypeaheadService.updateUrlParam(e,this.accountOwnerId),e?this.accountSearch&&(t.id==="allaccounts"?this.accounts=this.accountsCopy:this.accounts=this.accountsCopy.filter(i=>i.owner.customerNumber===t.id)):this.documentArchiveForm.controls.accountOwners.setErrors({required:true});}initAccountOwners(){let t=this.accountOwnersTypeaheadService.getAccountOwners(this.accounts);t&&t.length&&(this.accountOwners=this.accountOwnersTypeaheadService.mapAccountOwners(t,{showAllAccounts:false}),this.model.chosenAccountOwner=this.accountOwnersTypeaheadService.setCurrentAccountOwner(this.accountOwnerId,this.accountOwners));}performSearch(){if(this.documentArchiveForm&&this.documentArchiveForm.valid){this.model.chosenPeriodId&&(this.chosenPeriod=this.getPeriod(this.model.chosenPeriodId));let t={group:this.model.chosenGroupId,account:this.model.chosenAccountId,fromDate:this.chosenPeriod?this.chosenPeriod.start.format(this.dateFormat):void 0,toDate:this.chosenPeriod?this.chosenPeriod.end.format(this.dateFormat):void 0};this.context.isCorporate&&(t.index=0,t.number=this.number,this.config.showAgreementSelector&&this.agreementSearch&&(t.customerNumber=this.model.chosenAccountOwner.id)),(this.notSelectedAccount.includes(t.account)||!this.accountSearch)&&delete t.account,this.chosenGroup=(0, j.find)(this.groups,e=>e.group===t.group),this.performSearchSubscription&&this.performSearchSubscription.unsubscribe(),this.performSearchSubscription=CI(this.dataDocumentArchive.get(t,this.saving),this.translatedPeriod(this.model)).pipe(_f(([e,i])=>(this.translatedPeriodTxt=i,hI(e))),we$1(e=>{if(e=(0, j.flattenDeep)(e),e=(0, j.uniqBy)(e,"id"),e=(0, j.filter)(e,i=>i.group===this.model.chosenGroupId),this.model.chosenAccountId&&!this.notSelectedAccount.includes(this.model.chosenAccountId)&&this.accountSearch){let i=[];i=(0, j.filter)(e,n=>n.account&&n.accountIdReference===this.model.chosenAccountId),e=i;}return this.chosenPeriod&&(e=(0, j.filter)(e,i=>!!i.dates[this.documentArchiveService.dateProp].isBetween(this.chosenPeriod.start,this.chosenPeriod.end,null,"[]"))),!this.context.isCorporate&&this.config.overrideDocumentTypeListTexts&&e.forEach(i=>{i.type=this.translate.instant("PAGE.DOCUMENT_ARCHIVE.DOCUMENT_TYPE."+i.group.toUpperCase());}),e})).subscribe(e=>{this.documents=(0, j.orderBy)(e,"dates."+this.documentArchiveService.dateProp,"desc"),this.context.
1isCorporate?this.documentArchiveService.setLimit(this.limit+this.documentArchiveService.config.increment):this.documentArchiveService.setLimit(1/0),this.infoSnapshot={count:e.length,group:this.chosenGroup.displayName,period:this.translatedPeriodTxt,accountName:this.model.chosenAccountName,accountNumber:this.model.chosenAccountNumber,startDate:this.model.chosenDateFrom?this.model.chosenDateFrom.format("DD.MM.YYYY"):"",endDate:this.model.chosenDateTo?this.model.chosenDateTo.format("DD.MM.YYYY"):"",year:this.model.chosenDateYear,company:this.model.chosenAccountOwner?this.translate.instant("PAGE.DOCUMENT_ARCHIVE.FILTER_RESULT.FOR_COMPANY")+"\xAB"+this.model.chosenAccountOwner.name+"\xBB":"",messageMapping:this.getMessageMapping(this.model.chosenPeriodId,this.model.chosenAccountId,this.model.chosenGroupId)};},e=>{this.log.error("could not find documents"),e&&e.data&&e.data.code==="CPS-0003"?this.alert.error("ERROR.ERA.CPS-0003.DOCUMENT_ARCHIVE"):this.alert.serverError(e,"PAGE.DOCUMENT_ARCHIVE.SEARCH_ERROR");});}}groupSelected(){if(!this.model.chosenGroupId)return;this.documents=void 0,this.model.chosenAccountOwner=void 0,this.minDateFrom=void 0,this.validFromDate=void 0,delete this.dateConfigFrom.min;let t=(0, j.find)(this.groups,i=>i.group===this.model.chosenGroupId),e=this.accountSearch;this.dateSearch=t.dateSearch,this.accountSearch=t.accountSearch,this.agreementSearch=t.agreementSearch,this.accountSearch?this.accountSearch&&!e&&(this.model.chosenAccountId=this.accounts?this.accounts[0].id:void 0,this.model.chosenAccountName=this.accounts?this.accounts[0].getName():void 0,this.model.chosenAccountNumber=this.accounts?this.accounts[0].getNumber():void 0,this.model.chosenAccount=this.accounts?this.accounts[0]:void 0):(this.model.chosenAccountId=void 0,this.model.chosenAccountName=void 0,this.model.chosenAccountNumber=void 0,this.model.chosenAccount=void 0),this.config.showAgreementSelector&&this.agreementSearch&&!this.model.chosenAccountOwner&&this.initAccountOwners(),!this.context.isCorporate&&this.config.restrictAccessToHistoricInformation&&this.accountSearch&&this.model.chosenAccountId&&(0, j.find)(this.accounts,i=>{i.id===this.model.chosenAccountId&&this.getAuthorizedCustomers(i);}),this.accountSearch&&(this.accounts=this.accountsCopy);}accountSelected(t){t&&(t.id?this.model.chosenAccountId=t.id:this.accounts.find(i=>i.getNumber()===t)?(!this.model.chosenAccount||!this.model.chosenAccount.id)&&this.documentArchiveForm.controls.accountField.setErrors({notChosen:true}):this.documentArchiveForm.controls.accountField.setErrors({number:true})),(0, j.find)(this.accounts,e=>{e.id===this.model.chosenAccountId&&(this.model.chosenAccountName=e.getName(),this.model.chosenAccountNumber=e.getNumber(),!this.context.isCorporate&&this.config.restrictAccessToHistoricInformation&&this.getAuthorizedCustomers(e));}),!this.context.isCorporate&&this.config.restrictAccessToHistoricInformation&&this.model.chosenAccountId==="none"&&(this.validFromDate=void 0,this.minDateFrom=void 0,delete this.dateConfigFrom.min),this.documents=void 0;}getAuthorizedCustomers(t){this.validFromDate=void 0,this.minDateFrom=void 0,delete this.dateConfigFrom.min,t?.hasLink("stakeholders")&&t.customerRole.toUpperCase()!=="OWNER"&&(this.loadingStakeholders.next(true),t.getStakeholders().then(e=>{if(e?.length){let i=e.filter(s=>t.customerRole.toUpperCase()===s.role?.toUpperCase()&&this.customerNumber===s.roleCustomerNumber),n;if(i.length&&(n=i[0],this.validFromDate=n?.validFromDate?Qe(n.validFromDate,this.dateFormat).format("DD.MM.YYYY"):null),this.validFromDate&&this.periods?.length){let s=this.authorizedFromDatePipe.transform(this.periods,this.validFromDate).map(G=>G.id),_=this.model.chosenPeriodId;this.model.chosenPeriodId=s.includes(this.model.chosenPeriodId)?this.model.chosenPeriodId:s[0],this.model.chosenPeriodId==="4"&&(this.dateConfigFrom=this.datePickerService.set({max:this.today,min:Qe(n.validFromDate,this.dateFormat)}),this.minDateFrom=Qe(n.validFromDate,this.dateFormat),this.displayDateFrom=this.model.chosenDateFrom.clone(),s.includes(_)||(this.model.chosenDateFrom=Qe(this.model.chosenDateFrom).isAfter(this.minDateFrom)?this.model.chosenDateFrom:this.minDateFrom));}}}).catch(e=>{this.log.error("Failed to get stakeholders",e),this.alert.serverError(e,"PAGE.DOCUMENT_ARCHIVE.LOAD_ERROR");}).finally(()=>{this.loadingStakeholders.next(false);}));}periodSelected(){if(this.documents=void 0,this.config.restrictAccessToHistoricInformation)if(this.validFromDate&&this.model.chosenPeriodId==="4"){let t=Qe(this.validFromDate,"DD.MM.YYYY");this.minDateFrom=t,this.dateConfigFrom.min=t,this.model.chosenDateFrom=Qe(this.model.chosenDateFrom).isAfter(t)?Qe(this.model.chosenDateFrom):t,this.displayDateFrom=Qe(this.model.chosenDateFrom);}else this.minDateFrom=void 0,delete this.dateConfigFrom.min,this.model.chosenDateFrom=Qe().startOf("day").subtract(90,"days"),this.displayDateFrom=Qe(this.model.chosenDateFrom);}showFilterResultBox(){return !!this.documents}
1resetModel(){this.model={chosenDateFrom:this.context.isCorporate?Qe().startOf("day").subtract(182,"days"):Qe().startOf("day").subtract(90,"days"),chosenDateTo:Qe().endOf("day"),chosenDateYear:this.context.isCorporate?this.listOfYears[0]:void 0,chosenGroupId:this.getDefaultDocumentType(),chosenPeriodId:this.context.isCorporate?"4":"2",chosenAccountId:this.accounts&&this.accounts.length?this.accounts[0].id:void 0,chosenAccountNumber:this.accounts&&this.accounts.length?this.accounts[0].getNumber():void 0,chosenAccountName:this.accounts&&this.accounts.length?this.accounts[0].getName():void 0},this.displayDateFrom=Qe(this.model.chosenDateFrom),this.displayDateTo=Qe(this.model.chosenDateTo),this.documentArchiveForm&&(this.documentArchiveForm.controls.groupField&&this.documentArchiveForm.controls.groupField.setValue(this.model.chosenGroupId),this.documentArchiveForm.controls.periodField&&this.documentArchiveForm.controls.periodField.setValue(this.model.chosenPeriodId),this.documentArchiveForm.controls.dateFieldFrom&&this.documentArchiveForm.controls.dateFieldFrom.setValue(this.model.chosenDateFrom),this.documentArchiveForm.controls.dateFieldTo&&this.documentArchiveForm.controls.dateFieldTo.setValue(this.model.chosenDateTo),this.documentArchiveForm.controls.dateFieldYear&&this.documentArchiveForm.controls.dateFieldYear.setValue(this.model.chosenDateYear),this.documentArchiveForm.controls.accountField&&this.documentArchiveForm.controls.accountField.setValue(this.context.isCorporate?this.accounts&&this.accounts.length?this.accounts[0]:void 0:this.model.chosenAccountId),this.documentArchiveForm.controls.accountOwners&&this.documentArchiveForm.controls.accountOwners.setValue(this.accountOwners&&this.accountOwners.length?this.accountOwners[0]:void 0)),this.documents=void 0,this.maxDateFrom=this.model.chosenDateTo,this.minDateTo=this.model.chosenDateFrom,this.dateConfigTo&&(this.dateConfigTo.min=this.model.chosenDateFrom);}resetForm(){this.documentArchiveForm&&this.documentArchiveForm.resetForm(),this.resetModel();}clearFilter(){this.resetForm();}getPeriod(t){switch(t){case "1":return {start:Qe().startOf("day").subtract(30,"days"),end:Qe().endOf("day")};case "2":return {start:Qe().startOf("day").subtract(180,"days"),end:Qe().endOf("day")};case "3":return {start:Qe().startOf("day").subtract(365,"days"),end:Qe().endOf("day")};case "4":{if(this.context.isCorporate&&this.model.chosenGroupId==="AARSOPPG")return {start:Qe(this.model.chosenDateYear+"-12-01").startOf("day"),end:Qe(+this.model.chosenDateYear+1+"-05-30").endOf("day")};{let e=Qe(this.model.chosenDateFrom),i=Qe(this.model.chosenDateTo);return e.isValid()||(e=Qe().startOf("day").subtract(90,"days")),i.isValid()||(i=Qe().endOf("day")),{start:e.startOf("day"),end:i.endOf("day")}}}}}translatedPeriod(t){let e=(0, j.find)(this.getPeriods(),i=>i.id===t.chosenPeriodId).displayName;return this.translate.get(e)}getMessageMapping(t,e,i){return i==="AARSOPPG"&&this.context.isCorporate?{"=0":"PAGE.DOCUMENT_ARCHIVE.FILTER_RESULT.DATE.TEXT_NONE","=1":"PAGE.DOCUMENT_ARCHIVE.FILTER_RESULT.DATE.TEXT_AARSOPPG",other:"PAGE.DOCUMENT_ARCHIVE.FILTER_RESULT.DATE.TEXT_AARSOPPG"}:t==="4"?this.notSelectedAccount.includes(e)?{"=0":"PAGE.DOCUMENT_ARCHIVE.FILTER_RESULT.DATE_NONE.TEXT_NONE","=1":"PAGE.DOCUMENT_ARCHIVE.FILTER_RESULT.DATE_NONE.TEXT_SINGULAR",other:"PAGE.DOCUMENT_ARCHIVE.FILTER_RESULT.DATE_NONE.TEXT_PLURAL"}:{"=0":"PAGE.DOCUMENT_ARCHIVE.FILTER_RESULT.DATE.TEXT_NONE","=1":"PAGE.DOCUMENT_ARCHIVE.FILTER_RESULT.DATE.TEXT_SINGULAR",other:"PAGE.DOCUMENT_ARCHIVE.FILTER_RESULT.DATE.TEXT_PLURAL"}:this.notSelectedAccount.includes(e)?{"=0":"PAGE.DOCUMENT_ARCHIVE.FILTER_RESULT.PERIOD_NONE.TEXT_NONE","=1":"PAGE.DOCUMENT_ARCHIVE.FILTER_RESULT.PERIOD_NONE.TEXT_SINGULAR",other:"PAGE.DOCUMENT_ARCHIVE.FILTER_RESULT.PERIOD_NONE.TEXT_PLURAL"}:{"=0":"PAGE.DOCUMENT_ARCHIVE.FILTER_RESULT.PERIOD.TEXT_NONE","=1":"PAGE.DOCUMENT_ARCHIVE.FILTER_RESULT.PERIOD.TEXT_SINGULAR",other:"PAGE.DOCUMENT_ARCHIVE.FILTER_RESULT.PERIOD.TEXT_PLURAL"}}getPeriods(){return [{id:"1",displayName:"PAGE.DOCUMENT_ARCHIVE.DATE_SEARCH.PERIOD.LAST_THIRTY_DAYS"}
1,{id:"2",displayName:"PAGE.DOCUMENT_ARCHIVE.DATE_SEARCH.PERIOD.LAST_HALF_YEAR"},{id:"3",displayName:"PAGE.DOCUMENT_ARCHIVE.DATE_SEARCH.PERIOD.LAST_YEAR"},{id:"4",displayName:"PAGE.DOCUMENT_ARCHIVE.DATE_SEARCH.PERIOD.SELECT_DATE"}]}loadAndCombineResources(t){return (0, j.some)(t,i=>i.accountSearch)?this.dataAccounts.get(void 0,this.loadingAccounts).pipe(we$1(i=>({groups:t,accounts:i}))):hI({groups:t})}setListOfYears(){this.listOfYears=[];for(let t=0;t<10;t++)this.listOfYears.push(Qe().subtract(t+1,"year").format("YYYY"));this.model.chosenDateYear=this.listOfYears[0];}selectAccountById(t){this.model.chosenAccount=this.accounts.find(e=>e.id===t);}setGroupId(){if(this.groups&&this.groups.length){let t=this.groups.find(e=>e.group===this.config.defaultDocumentType);this.model.chosenGroupId=this.groupParam||t&&t.group||this.groups[0].group;}}getDefaultDocumentType(){if(this.groups&&this.groups.length){let t=this.groups.find(e=>this.groupParam?e.group===this.groupParam:e.group===this.config.defaultDocumentType);return t&&t.group||this.groups[0].group}else return this.config.defaultDocumentType}static{this.\u0275fac=function(e){return new(e||o)(Do(P),Do(K$1),Do(Be),Do(G),Do(Oi),Do(i),Do(V),Do(At),Do(X$1),Do(C),Do(We),Do(E$1),Do(E$2),Do(c),Do(c$1))};}
1static{this.\u0275cmp=qT({type:o,selectors:[["ng-component"]],viewQuery:function(e,i){if(e&1&&Qy(ur,5),e&2){let n;FC(n=jC())&&(i.currentForm=n.first);}},standalone:false,decls:5,vars:4,consts:[["documentArchiveForm","ngForm"],["accountOwnersRef","sbControl"],["dateFieldFrom","ngModel"],["dateFieldTo","ngModel"],["assetSelectorRef","sbControl"],[1,"document-archive-module"],[3,"url"],["name","documentArchiveForm","role","form","id","documentArchiveForm","novalidate","",1,"small-screen-gutter",3,"ngSubmit"],[1,"row"],[1,"col-sm-6"],[1,"form-group-bs-select"],["for","groupField","translate",""],["id","groupField","name","groupField","required","",1,"form-control",3,"ngModelChange","ngModel"],[3,"value"],[1,"form-actions"],["id","submitButton","type","submit",1,"btn","btn-primary"],["translate",""],[3,"loading"],[1,"filter-result-box"],[3,"documents","loading"],[1,"form-group-account-agreement"],[1,"form-group"],["for","accountOwners","translate",""],[3,"selectEvent","accountOwners","selectedAccountOwners"],["name","accountOwners","id","accountOwners","required","",1,"form-control",3,"ngModelChange","ngModel","sbTypeahead"],["validation","required",3,"field"],[1,"datepicker-wrapper","form-group"],["for","periodField","translate",""],["id","periodField","name","periodField",1,"form-control",3,"ngModelChange","ngModel"],["for","dateFieldFrom","translate",""],["id","dateFieldFrom","name","dateFieldFrom","required","",3,"onChange","ngModelChange","config","displayDate","minDate","maxDate","ngModel","placeholder"],[1,"from-date-validation-container"],["id","dateFromRequired","translate","",1,"text-danger","validation-message"],["id","formatFrom","translate","",1,"text-danger","validation-message"],["id","minDateFrom",1,"text-danger","validation-message"],["id","maxDateFrom","translate","",1,"text-danger","validation-message",3,"translateParams"],["for","dateFieldTo","translate",""],["id","dateFieldTo","name","dateFieldTo","required","",3,"onChange","ngModelChange","config","displayDate","minDate","maxDate","ngModel","placeholder"],[1,"to-date-validation-container"],["id","dateToRequired","translate","",1,"text-danger","validation-message"],["id","formatTo","translate","",1,"text-danger","validation-message"],["id","minDateTo","translate","",1,"text-danger","validation-message",3,"translateParams"],["id","maxDateTo","translate","",1,"text-danger","validation-message",3,"translateParams"],["for","dateYear","translate",""],["id","dateYear","name","dateFieldYear","required","",1,"form-control",3,"ngModelChange","ngModel"],["for","accountField","translate",""],["id","accountField","name","accountField",1,"form-control",3,"ngModelChange","change","ngModel"],["value","none","translate",""],["translate","",1,"authorized-from-date",3,"translateParams"],[3,"assets","className"],["id","accountFieldCorp","name","accountField","type","text","required","",1,"form-control",3,"ngModelChange","sbTypeahead","ngModel","placeholder"],["validate-on","blur","validation","required",3,"field","message"],["validation","number","validate-on","blur",3,"field","message"],["validation","notChosen","validate-on","blur",3,"field","message"],["type","button","name","button",1,"close",3,"click"],["aria-hidden","true"],[1,"info-text"]],template:function(e,i){e&1&&(Ms(0,"section",5),ky(1,"old-page-link",6),mC(2,Gr,23,10,"div"),N_(3,"async"),nd(4,Ur,1,0,"page-loading-spinner"),rd()),e&2&&(mb(),Ry("url","URL.CNB.ARCHIVE_SEARCH"),mb(),gC(R_(3,2,i.loading)===false?2:4));},dependencies:[eR,nR,iR,yi$1,Eh,co,Ch,fh,m,j$1,Ei$1,Ml,j$2,u,Te,g,p$1,B,Ve,ee$1,Tt,y$1,X3,fu,ft,mn,Sn,ye,p$2,We],encapsulation:2,changeDetection:1});}};vM();da$1();var Pi=class o extends o$1{constructor(t,{config:e}){super(t,e);}static{this.\u0275fac=function(e){return new(e||o)(de(V$2),de(c$1))};}static{this.\u0275prov=X({token:o,factory:o.\u0275fac,providedIn:"root"});}};vM();J$1();vM();$N();vM();$N();na$1();he();vM();F();pi();q$1();vM();G$2();vc();var ki=class o extends E{constructor(e,i){super();this.dsObservable=e;this.DS=i;this.dsNames=["documentArchiveV4"];}fetch(e){return this.DS.create("documentArchiveV4",e)}fromCache(e,i){return i}static{this.\u0275fac=function(i){return new(i||o)(de(J$2),de(os))};}static{this.\u0275prov=X({token:o,factory:o.\u0275fac,providedIn:"root"});}};vM();he();$N();var Ni=(e=>(e.Header="header",e.Item="item",e))(Ni||{}),uo=(n=>(n.DisplayName="displayName",n.Name="name",n.AccountNumber="accountNumber",n.Year="year",n))(uo||{}),po=(i=>(i.AnnualStatement="AARSOPPG",i.AccountStatement="KTOUTSKR",i.SignedDocuments="SIGDOCUM",i))(po||{});Be$1();vM();var kt=class o{constructor(){this.translate=D(V);this.dateUtils=D(h);}mapGroupsToGroupOptions(t){return [...t].sort((i,n)=>this.translate.instant("PAGE.DOCUMENT_ARCHIVE.DOCUMENT_TYPE."+i.group.toUpperCase()).localeCompare(this.translate.instant("PAGE.DOCUMENT_ARCHIVE.DOCUMENT_TYPE."+n.group.toUpperCase()))).map(i=>({groupCode:i.group,displayName:this.translate.instant("PAGE.DOCUMENT_ARCHIVE.DOCUMENT_TYPE."+i.group.toUpperCase()),accountSearch:i.accountSearch,agreementSearch:i.agreementSearch,dateSearch:i.dateSearch}))}mapToAccountOptions(t,e){let[i,n]=this.splitAccountsByOwnership(t),_=this.sortActiveAccountsByAccountName(i).map(ae=>({id:ae.id,name:ae.getName(),accountNumber:ae.accountNumber,isClosed:false})),re=this.sortActiveAccountsByAccountName(n).map(ae=>({id:ae.id,name:ae.getName(),accountNumber:ae.accountNumber,accountOwner:ae.owner?.name,isClosed:false})),fo=this.sortClosedAccountsByAccountName(e).map(ae=>({id:ae.accountId,name:ae.accountName,accountNumber:ae.accountId,isClosed:true}));return [..._,...re,...fo]}getPayloadParams(t){let e={};return e.group=t.documentGroup.groupCode,t.account&&t.account.id!=="allAccounts"&&(e.account=t.account.id),e.fromDate=Qe(t.fromDate).format("YYYY-MM-DD"),e.toDate=Qe(t.toDate).format("YYYY-MM-DD"),e}mapAndGroupByDateDocumentArchive(t,e){if(e.length===0)return [];let i={};return e.forEach(n=>{let s=this.getDocumentArchiveDate(n),_=this.getDocumentArchiveGroupName(s);i[_]||(i[_]=[]),i[_].push(n);}),this.getDocumentArchiveByItems(t,i)}getDocumentArchiveDate(t){return Qe.isDayjs(t.dates.main)?t.dates.main.toDate():Qe(t.dates.main).toDate()}getDocumentArchiveGroupName(t){return this.dateUtils.formatDate(t,"MMMM yyyy").replace(/\w\S*/g,i=>i[0].toUpperCase()+i.slice(1).toLowerCase())}getDocumentArchiveByItems(t,e){return this.getDocumentArchiveWithHeaders(t,e)}getDocumentArchiveWithHeaders(t,e){let i=[];return Object.keys(e).forEach(n=>{i.push({itemType:"header",name:n}
1),e[n].forEach(s=>{i.push({itemType:"item",id:s.id,date:this.getDocumentArchiveDate(s),type:s.type,metaData:s.metaData,reportId:s.reportId,group:s.group,accountIdReference:s.accountIdReference,accountName:this.getAccountName(t,s),accountNumber:this.getAccountNumber(t,s),links:s.links});});}),i}getAccountName(t,e){return e.accountIdReference?t.find(i=>i.id===e.accountIdReference)?.getName():""}getAccountNumber(t,e){return e.accountIdReference?t.find(i=>i.id===e.accountIdReference)?.getNumber():""}sortActiveAccountsByAccountName(t){return t.sort((e,i)=>nI(e.getName()?.toLowerCase(),i.getName()?.toLowerCase(),true))}sortClosedAccountsByAccountName(t){return t.sort((e,i)=>nI(e.accountName.toLowerCase(),i.accountName.toLowerCase(),true))}splitAccountsByOwnership(t){let e=["OWNER","GUARANTOR"];return t.reduce((i,n)=>(e.includes(n.customerRole.toUpperCase())?i[0].push(n):i[1].push(n),i),[[],[]])}static{this.\u0275fac=function(e){return new(e||o)};}static{this.\u0275prov=X({token:o,factory:o.\u0275fac,providedIn:"root"});}};q$1();vM();G$2();vc();var Mi=class o extends E{constructor(e,i){super();this.dsObservable=e;this.DS=i;this.dsNames=["documentsTerminatedAccountsSearch"];}fetch(e){return this.DS.create("documentsTerminatedAccountsSearch",e)}fromCache(e,i){return i}static{this.\u0275fac=function(i){return new(i||o)(de(J$2),de(os))};}static{this.\u0275prov=X({token:o,factory:o.\u0275fac,providedIn:"root"});}};h$1();vM();W();N$1();he();var Oe=class o{constructor(t,e,i){this.log=t;this.alert=e;this.translateService=i;}error(t,e){e&&this.alert.error(this.translateService.instant(e)),this.log.error(t);}static{this.\u0275fac=function(e){return new(e||o)(de(E$1),de(E$2),de(V))};}static{this.\u0275prov=X({token:o,factory:o.\u0275fac,providedIn:"any"});}};he();vM();var Gn={rawDocumentArchive:[],paginatedDocumentArchive:[],documentArchiveToDisplay:[],accounts:[],closedAccounts:[],accountOptions:[],documentGroups:[],groupOptions:[],filters:{documentGroup:null,account:null,fromDate:null,toDate:null,chosenYear:null},isFilterFormValid:true,selectedDocumentArchive:[],isSelectAllChecked:false,isSelectAllIntermediateState:false,isExportButtonDisabled:false,showSpinner:false,showNoAccountsEmptyState:false,showNoResultsEmptyState:false,showStartEmptyState:true,isMultipleSelectionEnabled:true,totalItems:0,customerNumber:null,minFromDateAuthorizedUser:null},q=class o extends V$1({protectedState:false},Q(Gn),J((e,i=D(kt))=>({loadMoreDocumentArchiveCallback(){return hI({}).pipe(we$1(()=>{let n=e.paginatedDocumentArchive().length,s=n<e.totalItems(),_=n+50<e.totalItems()?n+50:e.totalItems();if(s){let G=e.rawDocumentArchive().slice(n,_);H$1(e,re=>F$1(E$3({},re),{paginatedDocumentArchive:[...re.paginatedDocumentArchive,...G],documentArchiveToDisplay:i.mapAndGroupByDateDocumentArchive(e.accounts(),[...re.paginatedDocumentArchive,...G]),isSelectAllIntermediateState:re.isSelectAllChecked?true:re.isSelectAllIntermediateState,isSelectAllChecked:false}));}return s}))}}))){constructor(){super();this.dataAccountsService=D(G);this.dataClosedAccountsService=D(T);this.dataDocumentArchiveGroups=D(Be);this.dataDocumentArchive=D(ki);this.dataDocumentArchiveForClosedAccounts=D(Mi);this.documentArchiveService=D(kt);this.customersService=D(c);this.documentArchiveLogService=D(Oe);this.translateService=D(V);this.showResultSubject$=new ne;this.resetFiltersSubject$=new ne;this.showResultClicked$=this.showResultSubject$.asObservable();this.resetFiltersClicked$=this.resetFiltersSubject$.asObservable();this.loadAllAccounts=L(Xv(B$1(),Sf(()=>this.showLoadingSpinner(true)),_f(()=>this.dataAccountsService.get().pipe(_f(e=>(this.storeAccounts(e),this.dataClosedAccountsService.get().pipe(G$1({next:i=>{this.storeClosedAccounts(i),this.storeAccountOptions(this.documentArchiveService.mapToAccountOptions(e,i)),this.setNoAccountsEmptyState(e.length===0&&i.length===0),setTimeout(()=>{this.showLoadingSpinner(false),this.showResultAction();});},error:()=>{this.setNoAccountsEmptyState(true),this.showLoadingSpinner(false);}})))))),G$1({next:()=>{},error:()=>{this.setNoAccountsEmptyState(true),this.showLoadingSpinner(false);}})));this.loadDocumentArchiveGroups=L(Xv(B$1(),Sf(()=>this.showLoadingSpinner(true)),_f(()=>this.dataDocumentArchiveGroups.get().pipe(G$1({next:e=>{this.storeDocumentGroups(e);let i=this.documentArchiveService.mapGroupsToGroupOptions(e);this.storeGroupOptions(i),this.showLoadingSpinner(false);},error:()=>{this.storeDocumentGroups([]),this.showLoadingSpinner(false);}})))));this.loadDocumentArchive=L(Xv(B$1(),Sf(()=>this.showLoadingSpinner(true)),_f(()=>this.dataDocumentArchive.get(this.documentArchiveService.getPayloadParams(this.filters())).pipe(G$1({next:e=>{this.setNoResultsEmptyState(e.length===0);let i=this.sortDocumentArchiveByDate(e);this.storeRawDocumentArchive(i),this.setTotalItems(e.length),this.handlePagination(i),this.setStartEmptyState(false),this.showLoadingSpinner(false);},error:()=>{this.storeRawDocumentArchive([]),this.storeDocumentArchiveToDisplay([]),this.setNoResultsEmptyState(true),this.showLoadingSpinner(false),this.documentArchiveLogService.error("PIB DocumentArchive: Error while getting the document archive","PAGE.DOCUMENT_ARCHIVE.V2.LOAD_ERROR");}})))));this.loadDocumentArchiveForClosedAccounts=L(Xv(B$1(),Sf(()=>this.showLoadingSpinner(true)),_f(()=>this.dataDocumentArchiveForClosedAccounts.get(this.documentArchiveService.getPayloadParams(this.filters())).pipe(G$1({next:e=>{this.setNoResultsEmptyState(e.length===0);let i=this.sortDocumentArchiveByDate(e);this.storeRawDocumentArchive(i),this.setTotalItems(e.length),this.handlePagination(i),this.setStartEmptyState(false),this.showLoadingSpinner(false);},error:()=>{this.storeRawDocumentArchive([]),this.storeDocumentArchiveToDisplay([]),this.setNoResultsEmptyState(true),this.showLoadingSpinner(false);}})))));this.loadCustomer=L(Xv(B$1(),_f(()=>this.customersService.get().pipe(G$1({next:e=>{H$1(this,{customerNumber:e.customerNumber});},error:()=>{this.documentArchiveLogService.error("Failed to load customer data - stakeholder date validation will not be available");}})))));this.loadCustomer();}showLoadingSpinner(e){H$1(this,{showSpinner:e});}setStartEmptyState(e){H$1(this,{showStartEmptyState:e});}setNoAccountsEmptyState(e){H$1(this,{showNoAccountsEmptyState:e});}setNoResultsEmptyState(e){H$1(this,{showNoResultsEmptyState:e});}showResultAction(){H$1(this,{isSelectAllChecked:false,isSelectAllIntermediateState:false,selectedDocumentArchive:[]}
1),this.showResultSubject$.next({});}resetFiltersAction(){H$1(this,{selectedDocumentArchive:[],isMultipleSelectionEnabled:true}),this.resetFiltersSubject$.next({});}selectAllAction(e){H$1(this,{isSelectAllChecked:e,isSelectAllIntermediateState:false,selectedDocumentArchive:e?this.selectAllVisibleDocumentArchive():[]}),this.selectedDocumentArchive().length===100&&H$1(this,{isMultipleSelectionEnabled:false});}enableMultipleSelectionAction(e){H$1(this,{isMultipleSelectionEnabled:e});}storeAccounts(e){H$1(this,{accounts:e});}storeClosedAccounts(e){H$1(this,{closedAccounts:e});}storeAccountOptions(e){H$1(this,{accountOptions:this.addAllAccountsOptionToAccountOptions(e)});}storeDocumentGroups(e){H$1(this,{documentGroups:e});}storeGroupOptions(e){H$1(this,{groupOptions:e});}storeRawDocumentArchive(e){H$1(this,{rawDocumentArchive:e});}storePaginatedDocumentArchive(e){H$1(this,{paginatedDocumentArchive:e});let i=this.documentArchiveService.mapAndGroupByDateDocumentArchive(this.accounts(),e);this.storeDocumentArchiveToDisplay(i);}storeDocumentArchiveToDisplay(e){H$1(this,{documentArchiveToDisplay:e});}storeFilters(e){H$1(this,{filters:e});}setTotalItems(e){H$1(this,{totalItems:e});}setSelectedDocumentArchive(e){H$1(this,{selectedDocumentArchive:[...this.selectedDocumentArchive(),e]}),(this.selectedDocumentArchive().length===this.paginatedDocumentArchive().length||this.selectedDocumentArchive().length===100)&&H$1(this,{isSelectAllChecked:true});}removeSelectedDocumentArchive(e){H$1(this,{selectedDocumentArchive:this.selectedDocumentArchive().filter(i=>i!==e)}),this.selectedDocumentArchive().length===0&&H$1(this,{isSelectAllChecked:false,isSelectAllIntermediateState:false}),this.selectedDocumentArchive().length<100&&H$1(this,{isMultipleSelectionEnabled:true});}setSelectAllIntermediateState(e){H$1(this,{isSelectAllIntermediateState:e});}setExportButtonDisabled(e){H$1(this,{isExportButtonDisabled:e});}setMinFromDateAuthorizedUser(e){H$1(this,{minFromDateAuthorizedUser:e});}checkAndSetSelectAllStatus(){if(this.selectedDocumentArchive().length===0){this.selectAllAction(false);return}this.isSelectAllIntermediateState()!==true&&this.setSelectAllIntermediateState(true),(this.selectedDocumentArchive().length===this.paginatedDocumentArchive().length||this.selectedDocumentArchive().length===100)&&this.setSelectAllIntermediateState(false);}checkAndSetSelectionStateAfterLoadMore(){this.selectedDocumentArchive().length===100&&this.paginatedDocumentArchive().length>100?H$1(this,{isMultipleSelectionEnabled:false}):H$1(this,{isMultipleSelectionEnabled:true});}setInitialState(){H$1(this,Gn);}sortDocumentArchiveByDate(e){return e.sort((i,n)=>{let s=this.documentArchiveService.getDocumentArchiveDate(i);return this.documentArchiveService.getDocumentArchiveDate(n).getTime()-s.getTime()})}selectAllVisibleDocumentArchive(){return this.paginatedDocumentArchive().map(i=>i.id).slice(0,100)}handlePagination(e){let i=e.slice(0,50);this.storePaginatedDocumentArchive(i);}addAllAccountsOptionToAccountOptions(e){return [{id:"allAccounts",name:this.translateService.instant("PAGE.PIB_DOCUMENT_ARCHIVE.V2.ALL_ACTIVE_ACCOUNTS")},...e]}static{this.\u0275fac=function(i){return new(i||o)};}static{this.\u0275prov=X({token:o,factory:o.\u0275fac,providedIn:"root"});}};pi();Be$1();F();var vo=N(ep());da$1();vM();vM();var ho=N(ep());Be$1();vM();var Ri=class o{constructor(){this.pibDocumentArchiveStore=D(q);}customDatesValidator(){return t=>{let e=t.get("fromDate"),i=t.get("toDate"),n=Qe(),s={};this.resetControls([e,i]),s=this.checkDatesValidation(s,e,i,n),this.setValidations(s,t),this.setControlsUntouched(e,i);}}checkDatesValidation(t,e,i,n){return (0, ho.isDate)(e.value)||(t.fromDate="invalidDate"),(0, ho.isDate)(i.value)||(t.toDate="invalidDate"),Qe(e.value)>n&&(t.fromDate="invalidFutureDate"),Qe(i.value)>n&&(t.toDate="invalidFutureDate"),Qe(e.value).isAfter(Qe(i.value))&&e.dirty&&(t.fromDate="fromDateAfterToDate"),Qe(i.value).isBefore(Qe(e.value))&&i.dirty&&(t.toDate="toDateBeforeFromDate"),this.pibDocumentArchiveStore.minFromDateAuthorizedUser()&&Qe(this.pibDocumentArchiveStore.minFromDateAuthorizedUser()).isAfter(Qe(e.value))&&(t.fromDate="fromDateAuthorizedUserTooEarly"),t}setValidations(t,e){let i=Object.entries(t);if(i.length>0){let n=i[0][0],s=i[0][1];e.get(n).setErrors({[s]:true}),e.get(n).markAsTouched(),e.get(n).markAsDirty();}}
1resetControls(t){t.forEach(e=>e.setErrors(null));}setControlsUntouched(t,e){t.valid&&e.valid&&(t.markAsPristine(),t.markAsUntouched(),e.markAsPristine(),e.markAsUntouched());}static{this.\u0275fac=function(e){return new(e||o)};}static{this.\u0275prov=X({token:o,factory:o.\u0275fac,providedIn:"any"});}};$N();na$1();he();var Wr=o=>[o],Un=o=>({label:o}),Xr=(o,t)=>[o,t],zr=o=>({date:o});function qr(o,t){o&1&&(c_(0),N_(1,"translate")),o&2&&cd(" ",R_(1,1,"PAGE.PIB_DOCUMENT_ARCHIVE.V2.CLOSED")," ");}function Kr(o,t){if(o&1&&(Ms(0,"div",12),c_(1),rd()),o&2){let e=RC().$implicit;mb(),cv(e.item?.accountOwner);}}function Qr(o,t){if(o&1&&(Ms(0,"div",10)(1,"div",11)(2,"span"),c_(3),mC(4,qr,2,3),rd(),Ms(5,"span"),c_(6),N_(7,"accountNumberFormat"),rd()(),mC(8,Kr,2,1,"div",12),rd()),o&2){let e=t.$implicit;mb(3),cd("",e.item?.name," "),mb(),gC(e.item?.isClosed?4:-1),mb(2),cv(R_(7,4,e.item==null?null:e.item.accountNumber)),mb(2),gC(e.item?.accountOwner?8:-1);}}function Zr(o,t){if(o&1&&(Ms(0,"div",9),c_(1," PAGE.PIB_DOCUMENT_ARCHIVE.V2.ACCOUNT_SEARCH.AUTHORIZED_FROM_DATE "),rd()),o&2){let e=RC(2);Ry("translateParams",T_(1,zr,e.validFromDate));}}function Jr(o,t){if(o&1&&(Ms(0,"ebank-form-field")(1,"ebank-label",4),c_(2,"PAGE.DOCUMENT_ARCHIVE.V2.ACCOUNT"),rd(),Ms(3,"ebank-simple-selector",8),N_(4,"translate"),wy(5,Qr,9,6,"ng-template",null,0,L_),rd(),tT(),mC(7,Zr,2,3,"div",9),rd()),o&2){let e=HC(6),i=RC();mb(3),Ry("options",i.pibDocumentArchiveStore.accountOptions())("itemTemplate",e)("searchAttributes",C_(7,Xr,i.labelMap.AccountNumber,i.labelMap.Name))("titleOnMobile",R_(4,5,"PAGE.DOCUMENT_ARCHIVE.V2.ACCOUNT")),nT(),mb(4),gC(i.minFromDate?7:-1);}}function ea(o,t){if(o&1&&(Ms(0,"div",7)(1,"ebank-form-field")(2,"ebank-label",4),c_(3,"PAGE.DOCUMENT_ARCHIVE.V2.FROM_DATE"),rd(),Ms(4,"ebank-sub-label",4),c_(5,"PAGE.DOCUMENT_ARCHIVE.V2.DATE.SUBLABEL"),rd(),ky(6,"ebank-date-picker",13,1),N_(8,"translate"),tT(),Ms(9,"ebank-form-error-wrapper")(10,"ebank-form-error",14)(11,"span",4),c_(12,"PAGE.DOCUMENT_ARCHIVE.V2.INVALID_DATE"),rd()(),Ms(13,"ebank-form-error",15)(14,"span",4),c_(15,"PAGE.DOCUMENT_ARCHIVE.V2.INVALID_FUTURE_DATE"),rd()(),Ms(16,"ebank-form-error",16)(17,"span",4),c_(18,"PAGE.DOCUMENT_ARCHIVE.V2.INVALID_FROM_DATE_GREATER"),rd()(),Ms(19,"ebank-form-error",17)(20,"span",4),c_(21,"PAGE.PIB_DOCUMENT_ARCHIVE.V2.AUTHORIZED_FROM_DATE.ERROR"),rd()()()(),Ms(22,"ebank-form-field")(23,"ebank-label",4),c_(24,"PAGE.DOCUMENT_ARCHIVE.V2.TO_DATE"),rd(),Ms(25,"ebank-sub-label",4),c_(26,"PAGE.DOCUMENT_ARCHIVE.V2.DATE.SUBLABEL"),rd(),ky(27,"ebank-date-picker",18,2),N_(29,"translate"),tT(),Ms(30,"ebank-form-error-wrapper")(31,"ebank-form-error",14)(32,"span",4),c_(33,"PAGE.DOCUMENT_ARCHIVE.V2.INVALID_DATE"),rd()(),Ms(34,"ebank-form-error",15)(35,"span",4),c_(36,"PAGE.DOCUMENT_ARCHIVE.V2.INVALID_FUTURE_DATE"),rd()(),Ms(37,"ebank-form-error",19)(38,"span",4),c_(39,"PAGE.DOCUMENT_ARCHIVE.V2.INVALID_TO_DATE_EARLIER"),rd()()()()()),o&2){let e=HC(7),i=HC(28),n=RC();mb(6),Ry("max",n.maxFromDate)("min",n.minFromDate)("titleOnMobile",R_(8,13,"PAGE.DOCUMENT_ARCHIVE.V2.FROM_DATE")),nT(),mb(4),Ry("control",e),mb(3),Ry("control",e),mb(3),Ry("control",e),mb(3),Ry("control",e),mb(8),Ry("min",n.minToDate)("max",n.maxDate)("titleOnMobile",R_(29,15,"PAGE.DOCUMENT_ARCHIVE.V2.TO_DATE")),nT(),mb(4),Ry("control",i),mb(3),Ry("control",i),mb(3),Ry("control",i);}}function ta(o,t){if(o&1&&(Ms(0,"ebank-form-field")(1,"ebank-label",4),c_(2,"PAGE.DOCUMENT_ARCHIVE.V2.YEAR"),rd(),Ms(3,"ebank-simple-selector",20),N_(4,"translate"),ky(5,"ebank-option-template",6),rd(),tT(),rd()),o&2){let e=RC();mb(3),Ry("options",e.listOfYears)("disableSearch",true)("titleOnMobile",R_(4,4,"PAGE.DOCUMENT_ARCHIVE.V2.YEAR")),nT(),mb(2),Ry("labelMap",T_(6,Un,e.labelMap.Year));}}var Vi=class o{constructor(t){this.documentArchiveValidators=t;this.pibDocumentArchiveStore=D(q);this.route=D(K$1);this.groupOptions$=H$2(this.pibDocumentArchiveStore.groupOptions);this.defaultFromDate=Qe().subtract(3,"month").startOf("day").toDate();this.defaultToDate=Qe().startOf("day").toDate();this.formBuilder=D(oR);this.configService=D(c$1);this.documentArchiveLogService=D(Oe);this.subscription=new H;this.defaultGroupCode="KTOUTSKR";this.hasRouteDefaultGroupInitialized=false;this.hasPendingRouteDefaultGroupRefresh=false;this.filterForm=this.formBuilder.group({group:null,account:null,minMaxDates:this.formBuilder.group({fromDate:this.defaultFromDate,toDate:this.defaultToDate},{validators:this.documentArchiveValidators.customDatesValidator()}),chosenYear:null});this.maxDate=this.defaultToDate;this.maxFromDate=this.defaultToDate;this.minToDate=this.defaultFromDate;this.listOfYears=[];this.labelMap=uo;this.GroupCodes=po;this.documentArchiveConfig=this.configService.config;}get groupControl(){return this.filterForm.controls.group}get accountControl(){return this.filterForm.controls.account}get minMaxDatesGroup(){return this.filterForm.get("minMaxDates")}get fromDateControl(){return this.minMaxDatesGroup.get("fromDate")}get toDateControl(){return this.minMaxDatesGroup.get("toDate")}get chosenYearControl(){return this.filterForm.controls.chosenYear}ngOnInit(){this.setSubscriptions(),this.setListOfYears();}ngOnDestroy(){this.subscription.unsubscribe();}setSubscriptions(){this.subscription.add(this.pibDocumentArchiveStore.showResultClicked$.subscribe(()=>this.onSubmit())),this.subscription.add(this.pibDocumentArchiveStore.resetFiltersClicked$.subscribe(()=>this.setDefaultFilters())),this.subscription.add(this.fromDateControl.valueChanges.subscribe(()=>{this.setMinToDate();})),this.subscription.add(this.toDateControl.valueChanges.subscribe(()=>{this.setMaxFromDate();})),this.subscription.add(this.accountControl.valueChanges.subscribe(t=>{!t.isClosed&&this.documentArchiveConfig.restrictAccessToHistoricInformation&&this.checkCustomerRole(t.id);})),this.subscription.add(CI([this.groupOptions$,this.route.queryParams]).subscribe(([t,e])=>{let i=e.defaultGroup==="sigdocum"?"SIGDOCUM":"KTOUTSKR",n=this.hasRouteDefaultGroupInitialized&&this.defaultGroupCode!==i;if(this.defaultGroupCode=i,n&&(this.hasPendingRouteDefaultGroupRefresh=true),t.length){let s=this.checkAndFindDefaultGroupOption(t);this.hasPendingRouteDefaultGroupRefresh&&s&&(this.pibDocumentArchiveStore.showLoadingSpinner(true),this.pibDocumentArchiveStore.showResultAction(),this.hasPendingRouteDefaultGroupRefresh=false);}this.hasRouteDefaultGroupInitialized=true;}));}onSubmit(){this.filterForm.valid&&(this.storeFilters(),this.accountControl.value?.isClosed?this.pibDocumentArchiveStore.loadDocumentArchiveForClosedAccounts():this.pibDocumentArchiveStore.loadDocumentArchive());}storeFilters(){let t=this.groupControl.value,e=this.accountControl.value,i=t.groupCode==="AARSOPPG",n=Qe(this.chosenYearControl.value.year+"-12-01").startOf("day"),s=Qe(this.chosenYearControl.value.year).add(1,"year").format("YYYY"),_=Qe(s+"-05-30").endOf("day"),G=i?n:this.fromDateControl.value,re=i?_:this.toDateControl.value,St={documentGroup:t,account:t.accountSearch?e:null,fromDate:G,toDate:re,chosenYear:i?this.chosenYearControl.value.year:null};this.pibDocumentArchiveStore.storeFilters(St);}setListOfYears(){for(let t=0;t<10;t++)this.listOfYears.push({year:Qe().subtract(t+1,"year").format("YYYY")});this.chosenYearControl.setValue(this.listOfYears[0]);}setDefaultFilters(){this.setDefaultGroupOption(),this.accountControl.setValue(this.pibDocumentArchiveStore.accountOptions()[0]),this.fromDateControl.setValue(this.defaultFromDate),this.toDateControl.setValue(this.defaultToDate),this.storeFilters(),this.pibDocumentArchiveStore.showResultAction();}checkCustomerRole(t){let e=this.pibDocumentArchiveStore.accounts().find(i=>i.getNumber()===t);e?.hasLink("stakeholders")&&e?.customerRole.toUpperCase()!=="OWNER"?this.loadStakeholders(e):this.turnOffMinDateValidationForOwnerRole();}setMinToDate(){(0, vo.isDate)(this.fromDateControl.value)&&!isNaN(this.fromDateControl.value.getTime())&&(this.minToDate=this.fromDateControl.value);}setMaxFromDate(){(0, vo.isDate)(this.toDateControl.value)&&!isNaN(this.fromDateControl.value.getTime())&&(this.maxFromDate=this.toDateControl.value);}checkAndSetStakeholderDateFrom(t,e){let i=e.find(n=>t.customerRole.toUpperCase()===n.role?.toUpperCase()&&this.pibDocumentArchiveStore.customerNumber()===n.roleCustomerNumber);i&&i.validFromDate?(this.minFromDate=Qe(i.validFromDate).toDate(),this.validFromDate=Qe(i.validFromDate).format("DD.MM.YYYY"),this.pibDocumentArchiveStore.setMinFromDateAuthorizedUser(i.validFromDate),Qe(this.fromDateControl.value).isBefore(Qe(i.validFromDate))&&this.fromDateControl.setValue(this.minFromDate)):this.turnOffMinDateValidationForOwnerRole();}loadStakeholders(t){t.getStakeholders().then(e=>{this.checkAndSetStakeholderDateFrom(t,e);}).catch(e=>{this.documentArchiveLogService.error("Failed to get stakeholders",e);});}turnOffMinDateValidationForOwnerRole(){this.minFromDate=void 0,this.pibDocumentArchiveStore.setMinFromDateAuthorizedUser(null),this.fromDateControl.setErrors(null);}checkAndFindDefaultGroupOption(t=this.pibDocumentArchiveStore.groupOptions()){return this.defaultGroup=t.find(e=>e.groupCode===this.defaultGroupCode),this.defaultGroup&&this.groupControl.value?.groupCode!==this.defaultGroup.groupCode?(this.groupControl.setValue(this.defaultGroup),true):false}setDefaultGroupOption(){this.defaultGroup||this.checkAndFindDefaultGroupOption(),this.defaultGroup&&this.groupControl.setValue(this.defaultGroup);}static{this.\u0275fac=function(e){return new(e||o)(Do(Ri))};}
1static{this.\u0275cmp=qT({type:o,selectors:[["pib-document-archive-filters-panel"]],decls:11,vars:13,consts:[["accountItemTemplate",""],["fromDateEbankControl","ebankControl"],["toDateEbankControl","ebankControl"],["id","pibDocumentArchiveFiltersPanel",3,"formGroup"],["translate",""],["formControlName","group","id","pibDocumentArchiveGroupFilter",3,"options","searchAttributes","titleOnMobile"],["selectTemplate","single",3,"labelMap"],["formGroupName","minMaxDates"],["formControlName","account","id","pibDocumentArchiveAccountFilter",3,"options","itemTemplate","searchAttributes","titleOnMobile"],["translate","",1,"authorized-from-date",3,"translateParams"],[1,"ebank-option-items","ebank-option-row"],[1,"ebank-option-col","ebank-option-left"],[1,"ebank-option-right"],["id","fromDate","formControlName","fromDate",3,"max","min","titleOnMobile"],["validation","invalidDate",3,"control"],["validation","invalidFutureDate",3,"control"],["validation","fromDateAfterToDate",3,"control"],["validation","fromDateAuthorizedUserTooEarly",3,"control"],["id","toDate","formControlName","toDate",3,"min","max","titleOnMobile"],["validation","toDateBeforeFromDate",3,"control"],["formControlName","chosenYear","id","pibDocumentArchiveChosenYear",3,"options","disableSearch","titleOnMobile"]],template:function(e,i){if(e&1&&(Ms(0,"form",3)(1,"ebank-form-field")(2,"ebank-label",4),c_(3,"PAGE.PIB_DOCUMENT_ARCHIVE.V2.DOCUMENT_GROUP"),rd(),Ms(4,"ebank-simple-selector",5),N_(5,"translate"),ky(6,"ebank-option-template",6)(7,"ebank-option-template"),rd(),tT(),rd(),mC(8,Jr,8,10,"ebank-form-field"),mC(9,ea,40,17,"div",7)(10,ta,6,8,"ebank-form-field"),rd()),e&2){Ry("formGroup",i.filterForm);let n=i.groupControl.value;mb(4),Ry("options",i.pibDocumentArchiveStore.groupOptions())("searchAttributes",T_(9,Wr,i.labelMap.DisplayName))("titleOnMobile",R_(5,7,"PAGE.PIB_DOCUMENT_ARCHIVE.V2.DOCUMENT_GROUP")),nT(),mb(2),Ry("labelMap",T_(11,Un,i.labelMap.DisplayName)),mb(2),gC(n?.accountSearch?8:-1),mb(),gC(n?.dateSearch&&n?.groupCode!==i.GroupCodes.AnnualStatement?9:i.groupControl.value?.groupCode===i.GroupCodes.AnnualStatement?10:-1);}},dependencies:[Cu,X3,eR,co,Ch,uo$1,Nl,Cr$1,fu,Pa$1,gu,on,sI,f8,vI,M,j$2,u,we,Te,D$1,QI,No,ye,p$2],encapsulation:2,changeDetection:1});}};he();vM();$N();he();pi();F();Be$1();vM();var ia=(o,t)=>t.text;function oa(o,t){if(o&1&&ky(0,"ebank-chip",1),o&2){let e=t.$implicit;Ry("readOnly",true)("text",e.text);}}var wi=class o{constructor(){this.pibDocumentArchiveStore=D(q);this.translate=D(V);this.chips=[];this.disableResetFilterBtn=true;this.subscription=new H;this.setSubscriptions(),this.setDefaultFilters();}ngOnDestroy(){this.subscription.unsubscribe();}resetFilters(){this.pibDocumentArchiveStore.resetFiltersAction();}setSubscriptions(){this.subscription.add(H$2(this.pibDocumentArchiveStore.filters).subscribe(t=>this.checkFilterValuesChanged(t)));}addChips(t,e){this.chips.push({text:`${this.translate.instant(t)}: ${e}`});}resetChips(){this.chips=[];}checkFilterValuesChanged(t){this.resetChips(),setTimeout(()=>{this.checkDocumentGroupValueChange(t.documentGroup.displayName),t.account&&this.checkAccountValueChange(t.account),t.fromDate&&this.checkFromDateValueChange(t.fromDate),t.toDate&&this.checkToDateValueChange(t.toDate),t.chosenYear&&this.checkChosenYearValueChange(t.chosenYear),this.areFiltersEqual(t,this.defaultFilters)?this.disableResetFilterBtn=true:this.disableResetFilterBtn=false;});}checkDocumentGroupValueChange(t){this.addChips("PAGE.PIB_DOCUMENT_ARCHIVE.V2.DOCUMENT_GROUP",t);}checkAccountValueChange(t){this.addChips("PAGE.DOCUMENT_ARCHIVE.V2.ACCOUNT",t.name);}checkFromDateValueChange(t){this.addChips("PAGE.DOCUMENT_ARCHIVE.V2.FROM_DATE",this.getFormattedDate(t));}checkToDateValueChange(t){this.addChips("PAGE.DOCUMENT_ARCHIVE.V2.TO_DATE",this.getFormattedDate(t));}checkChosenYearValueChange(t){this.removeDatesChipsWhenYearModeEnabled(),this.addChips("PAGE.DOCUMENT_ARCHIVE.V2.YEAR",t);}getFormattedDate(t){return Qe(t).format("DD.MM.YYYY")}removeDatesChipsWhenYearModeEnabled(){this.chips.splice(-2,2);}setDefaultFilters(){this.defaultFilters=this.pibDocumentArchiveStore.filters();}areFiltersEqual(t,e){let i=t.documentGroup.groupCode===e.documentGroup.groupCode,n=!!t.account&&!!e.account&&t.account.id===e.account.id||!t.account&&!e.account,s=!t.fromDate&&!e.fromDate||t.fromDate&&e.fromDate&&this.getFormattedDate(t.fromDate)===this.getFormattedDate(e.fromDate),_=!t.toDate&&!e.toDate||t.toDate&&e.toDate&&this.getFormattedDate(t.toDate)===this.getFormattedDate(e.toDate),G=t.chosenYear===e.chosenYear;return i&&n&&s&&_&&G}static{this.\u0275fac=function(e){return new(e||o)};}
1static{this.\u0275cmp=qT({type:o,selectors:[["pib-document-archive-filters-chips"]],decls:3,vars:2,consts:[[3,"removeAllClick","numResults","disableResetFilterBtn"],[3,"readOnly","text"]],template:function(e,i){e&1&&(Ms(0,"ebank-filter-display-area",0),qy("removeAllClick",function(){return i.resetFilters()}),IC(1,oa,1,2,"ebank-chip",1,ia),rd()),e&2&&(Ry("numResults",i.pibDocumentArchiveStore.totalItems())("disableResetFilterBtn",i.disableResetFilterBtn),mb(),EC(i.chips));},dependencies:[Vs,Y3],encapsulation:2,changeDetection:1});}};vM();na$1();$N();he();F();vM();na$1();var Li=class o{constructor(){this.documentArchiveStore=D(q);this.documentArchiveExportService=D(y);this.selectAllFormGroup=new yn({selectAllDocuments:new vn(this.documentArchiveStore.isSelectAllChecked())});H$2(this.documentArchiveStore.isSelectAllChecked).subscribe(t=>{this.selectAllFormGroup.controls.selectAllDocuments.setValue(t);});}onSelectAll(t){this.documentArchiveStore.selectAllAction(t);}exportToPdfAction(){this.exportDocumentArchiveToPdf();}exportDocumentArchiveToPdf(){return S(this,null,function*(){this.documentArchiveStore.setExportButtonDisabled(true);try{yield Promise.all(this.getSelectedDocumentArchiveToExport().map(t=>this.documentArchiveExportService.export(t)));}finally{this.documentArchiveStore.setExportButtonDisabled(false);}})}getSelectedDocumentArchiveToExport(){return this.documentArchiveStore.rawDocumentArchive().filter(t=>this.documentArchiveStore.selectedDocumentArchive().some(e=>e===t.id))}static{this.\u0275fac=function(e){return new(e||o)};}
1static{this.\u0275cmp=qT({type:o,selectors:[["pib-document-archive-selections-area"]],decls:14,vars:13,consts:[["actionInfo",""],[1,"document-archive-select-all"],[3,"formGroup"],["formControlName","selectAllDocuments",3,"changed","indeterminate"],["buttonStyle","tertiary","size","s",3,"buttonClick","disabled"],[3,"content"]],template:function(e,i){if(e&1&&(Ms(0,"div",1)(1,"div",2)(2,"ebank-checkbox-field",3),qy("changed",function(s){return i.onSelectAll(s)}),c_(3),N_(4,"translate"),rd(),tT(),rd(),Ms(5,"div")(6,"ebank-button",4),qy("buttonClick",function(){return i.exportToPdfAction()}),c_(7),N_(8,"translate"),rd(),ky(9,"ebank-help-button",5),Ms(10,"ebank-help-button-content",null,0),c_(12),N_(13,"translate"),rd()()()),e&2){let n=HC(11);mb(),Ry("formGroup",i.selectAllFormGroup),mb(),Ry("indeterminate",i.documentArchiveStore.isSelectAllIntermediateState()),nT(),mb(),cd(" ",R_(4,7,"PAGE.DOCUMENT_ARCHIVE.V2.SELECT_ALL")," "),mb(3),Ry("disabled",i.documentArchiveStore.isExportButtonDisabled()),mb(),cd(" ",R_(8,9,"PAGE.DOCUMENT_ARCHIVE.V2.EXPORT_TO_PDF")," "),mb(2),Ry("content",n),mb(3),cd(" ",R_(13,11,"PAGE.DOCUMENT_ARCHIVE.V2.SELECT_ALL_ACTION_HELP")," ");}},dependencies:[_e,Bn$1,fu,yI,i8,M,co,Ch,j$2,dn,uo$1,Nl,ye],encapsulation:2,changeDetection:1});}};vM();$N();vM();na$1();$N();F();vM();na$1();var na=["*"],Gi=class o{constructor(){this.documentArchiveStore=D(q);this.checkBoxFormGroup=new yn({isChecked:new vn(false)});H$2(this.documentArchiveStore.selectedDocumentArchive).subscribe(t=>{let e=t.includes(this.documentArchiveItemId);this.checkBoxFormGroup.controls.isChecked.setValue(e),this.enableOrDisableSelectActionAfterSelectAllOrLoadMore();}),H$2(this.documentArchiveStore.isMultipleSelectionEnabled).subscribe(t=>{t?this.enableSelectAction():this.disableSelectAction();});}ngOnInit(){this.documentArchiveStore.checkAndSetSelectionStateAfterLoadMore(),this.enableOrDisableSelectActionAfterSelectAllOrLoadMore();}onCheckBoxChanged(t){this.selectOrUnselectDocumentArchive(t),this.documentArchiveStore.checkAndSetSelectAllStatus();}selectOrUnselectDocumentArchive(t){t?this.selectDocumentArchiveItem():this.unselectDocumentArchiveItem();}selectDocumentArchiveItem(){this.documentArchiveStore.setSelectedDocumentArchive(this.documentArchiveItemId),this.documentArchiveStore.selectedDocumentArchive().length===100&&this.documentArchiveStore.enableMultipleSelectionAction(false),this.checkBoxFormGroup.controls.isChecked.enable();}unselectDocumentArchiveItem(){this.documentArchiveStore.removeSelectedDocumentArchive(this.documentArchiveItemId),this.documentArchiveStore.selectedDocumentArchive().length===99&&this.documentArchiveStore.enableMultipleSelectionAction(true);}enableOrDisableSelectActionAfterSelectAllOrLoadMore(){this.documentArchiveStore.selectedDocumentArchive()?.length===100?(this.deselectDocumentItemsAboveSelectionLimit(),this.disableSelectAction()):this.enableSelectAction();}disableSelectAction(){this.checkBoxFormGroup.controls.isChecked.value||this.checkBoxFormGroup.controls.isChecked.disable();}enableSelectAction(){this.checkBoxFormGroup.controls.isChecked.enable();}deselectDocumentItemsAboveSelectionLimit(){this.documentArchiveStore.selectedDocumentArchive().some(e=>e===this.documentArchiveItemId)||this.checkBoxFormGroup.controls.isChecked.setValue(false);}static{this.\u0275fac=function(e){return new(e||o)};}
1static{this.\u0275cmp=qT({type:o,selectors:[["pib-document-archive-checkbox-panel"]],inputs:{documentArchiveItemId:"documentArchiveItemId"},ngContentSelectors:na,decls:3,vars:1,consts:[[3,"formGroup"],["formControlName","isChecked",3,"changed"]],template:function(e,i){e&1&&(OC(),Ms(0,"form",0)(1,"ebank-checkbox-panel",1),qy("changed",function(s){return i.onCheckBoxChanged(s)}),PC(2),rd(),tT(),rd()),e&2&&(Ry("formGroup",i.checkBoxFormGroup),mb(),nT());},dependencies:[Q8,fu,X3,xt,eR,co,Ch,dn,uo$1,Nl],encapsulation:2,changeDetection:1});}};vM();$N();he();Be$1();vM();var Ui=class o{constructor(){this.forwardLinkService=D(x);this.accountNumberFormatPipe=D(p$2);this.fileNamePipe=D(A);}set documentArchiveItem(t){t&&this.transformDocumentArchiveItem(t);}onShowDocumentClicked(){this.openDocument(this.documentArchiveTemplateInfo);}openDocument(t){return S(this,null,function*(){yield this.forwardLinkService.openApiV4(t.links.document.href);})}transformDocumentArchiveItem(t){this.documentArchiveTemplateInfo={dueDate:Qe(t.date).format("DD.MM.YYYY"),recipientName:this.fileNamePipe.transform(t),from:this.getAccountInfo(t),links:t.links};}getAccountInfo(t){if(t.accountName&&t.accountNumber)return t.accountName+" - "+this.accountNumberFormatPipe.transform(t.accountNumber);if(!t.accountName&&t.accountNumber)return this.accountNumberFormatPipe.transform(t.accountNumber)}static{this.\u0275fac=function(e){return new(e||o)};}
1static{this.\u0275cmp=qT({type:o,selectors:[["pib-document-archive-item-template"]],inputs:{documentArchiveItem:"documentArchiveItem"},decls:5,vars:11,consts:[[3,"duedate","recipientName","from"],["buttonStyle","tertiary","size","xs","iconType","external",3,"buttonClick","useAsLink","altTextFunctionalIcon"]],template:function(e,i){e&1&&(ky(0,"ebank-template-payment",0),Ms(1,"ebank-button",1),N_(2,"translate"),qy("buttonClick",function(){return i.onShowDocumentClicked()}),c_(3),N_(4,"translate"),rd()),e&2&&(Ry("duedate",i.documentArchiveTemplateInfo.dueDate)("recipientName",i.documentArchiveTemplateInfo.recipientName)("from",i.documentArchiveTemplateInfo.from),mb(),Ry("altTextFunctionalIcon",m_(R_(2,7,"EBANKUI.CONFIG.EXTERNAL.LINK")))("useAsLink",true),mb(2),cd(" ",R_(4,9,"PAGE.DOCUMENT_ARCHIVE.V2.DETAILS"),`
2`));},dependencies:[_e,K6,ye],encapsulation:2,changeDetection:1});}};he();vM();$N();var ra=(o,t)=>t.id;function aa(o,t){if(o&1&&(Ms(0,"ebank-section-header-panel"),c_(1),rd()),o&2){let e=RC(2).$implicit;mb(),cv(e.name);}}function ca(o,t){o&1&&wy(0,aa,2,1,"ebank-section-header-panel",3);}function sa(o,t){if(o&1&&(Ms(0,"pib-document-archive-checkbox-panel",2),ky(1,"pib-document-archive-item-template",5),rd()),o&2){let e=RC(2).$implicit;Ry("documentArchiveItemId",e.id),mb(),Ry("documentArchiveItem",e);}}function ma(o,t){o&1&&wy(0,sa,2,2,"pib-document-archive-checkbox-panel",4);}function la(o,t){if(o&1&&mC(0,ca,1,0,"ebank-section-header-panel")(1,ma,1,0,"pib-document-archive-checkbox-panel",2),o&2){let e=t.$implicit,i=RC();gC(e.itemType===i.ItemType.Header?0:e.itemType===i.ItemType.Item?1:-1);}}var Bi=class o{constructor(){this.pibDocumentArchiveStore=D(q);this.translateService=D(V);this.loadMoreButtonText=this.translateService.instant("PAGE.PIB_DOCUMENT_ARCHIVE.V2.LOAD_MORE_LABEL");this.loadMoreInitConfig={initialLoad:50,increment:50};this.ItemType=Ni;}counter(t){return this.translateService.instant("PAGE.PIB_DOCUMENT_ARCHIVE.V2.SHOWING",{count:t.count,total:t.total})}customLoader(t){return this.translateService.instant("EBANKUI.CONFIG.LOAD_MORE.LOADED_AMOUNT",{amount:t.amount})}isDataItem(t){return t.itemType!=="header"}onSlicedList(t){return t}static{this.\u0275fac=function(e){return new(e||o)};}
2static{this.\u0275cmp=qT({type:o,selectors:[["pib-document-archive-items"]],features:[D_([{provide:Ui$1,useFactory:t=>({showCounter:({count:e=0,total:i=0})=>t.instant("EBANKUI.CONFIG.LOAD_MORE.SHOW_COUNTER",{count:e,total:i}),loadedAmount:({amount:e})=>t.instant("EBANKUI.CONFIG.LOAD_MORE.LOADED_AMOUNT",{amount:e})}),deps:[V]}])],decls:4,vars:8,consts:[[3,"slicedList","callback","list","isDataItem","totalDataItemCount","counter","loaded","buttonText","config"],["groupHeadingId","document-archive-heading-id"],[3,"documentArchiveItemId"],[4,"ebankPanelList"],[3,"documentArchiveItemId",4,"ebankPanelList"],[3,"documentArchiveItem"]],template:function(e,i){e&1&&(Ms(0,"ebank-load-more",0),qy("slicedList",function(s){return i.paginatedDocumentArchive=i.onSlicedList(s)}),Ms(1,"ebank-panel-list",1),IC(2,la,2,1,null,null,ra),rd()()),e&2&&(Ry("callback",i.pibDocumentArchiveStore.loadMoreDocumentArchiveCallback)("list",i.pibDocumentArchiveStore.documentArchiveToDisplay())("isDataItem",i.isDataItem)("totalDataItemCount",i.pibDocumentArchiveStore.totalItems())("counter",i.counter.bind(i))("loaded",i.customLoader.bind(i))("buttonText",i.loadMoreButtonText)("config",i.loadMoreInitConfig),mb(2),EC(i.pibDocumentArchiveStore.documentArchiveToDisplay()));},dependencies:[Ro,hi,ig,q8,a6,o6,Gi,Ui],encapsulation:2,changeDetection:1});}};vM();function ua(o,t){o&1&&ky(0,"pib-document-archive-filters-chips");}function pa(o,t){o&1&&ky(0,"pib-document-archive-selections-area")(1,"pib-document-archive-items");}function da(o,t){o&1&&(Ms(0,"ebank-empty-state-description"),c_(1),N_(2,"translate"),rd()),o&2&&(mb(),cd(" ",R_(2,1,"PAGE.DOCUMENT_ARCHIVE.V2.NO_ACCOUNTS")," "));}function ha(o,t){o&1&&(sd(0),Ms(1,"ebank-empty-state-title",3),c_(2,"PAGE.DOCUMENT_ARCHIVE.V2.LIST_EMPTY.TITLE "),rd(),Ms(3,"ebank-empty-state-description",3),c_(4,"PAGE.DOCUMENT_ARCHIVE.V2.LIST_EMPTY.DESCRIPTION "),rd(),Qs$1());}function va(o,t){o&1&&(sd(0),Ms(1,"ebank-empty-state-title",3),c_(2,"PAGE.DOCUMENT_ARCHIVE.V2.NO_RESULTS.TITLE "),rd(),Ms(3,"ebank-empty-state-description",3),c_(4,"PAGE.DOCUMENT_ARCHIVE.V2.NO_RESULTS.DESCRIPTION "),rd(),Qs$1());}function Aa(o,t){if(o&1&&(Ms(0,"ebank-empty-state"),mC(1,da,3,3,"ebank-empty-state-description")(2,ha,5,0,"ng-container")(3,va,5,0,"ng-container"),rd()),o&2){RC();let e=h_(7),i=h_(8),n=h_(9);mb(),gC(i?1:e?2:n?3:-1);}}var Dt=class o{constructor(){this.pibDocumentArchiveStore=D(q);}ngOnInit(){this.pibDocumentArchiveStore.loadDocumentArchiveGroups(),this.pibDocumentArchiveStore.loadAllAccounts();}onSubmit(){this.pibDocumentArchiveStore.showResultAction();}ngOnDestroy(){this.pibDocumentArchiveStore.setInitialState();}static{this.\u0275fac=function(e){return new(e||o)};}
2static{this.\u0275cmp=qT({type:o,selectors:[["pib-document-archive"]],decls:13,vars:11,consts:[[3,"loading","loadAnnouncement"],[3,"showFilter"],["formId","pibDocumentArchiveFiltersPanel",3,"executionSearchButtonClick","executionSearch"],["translate",""]],template:function(e,i){if(e&1&&(ky(0,"ebank-lead-block"),Ms(1,"ebank-spinner",0),N_(2,"translate"),Ms(3,"ebank-sidebar-filter",1)(4,"ebank-filter-content",2),qy("executionSearchButtonClick",function(){return i.onSubmit()}),ky(5,"pib-document-archive-filters-panel"),rd(),Ms(6,"ebank-main-content"),mv(7)(8)(9),mC(10,ua,1,0,"pib-document-archive-filters-chips"),mC(11,pa,2,0)(12,Aa,4,1,"ebank-empty-state"),rd()()()),e&2){mb(),Ry("loading",i.pibDocumentArchiveStore.showSpinner())("loadAnnouncement",R_(2,6,"PAGE.DOCUMENT_ARCHIVE.V2.LOADING")),mb(2),Ry("showFilter",true),mb(),Ry("executionSearch",true),mb(3);let n=p_(i.pibDocumentArchiveStore.showStartEmptyState());mb();let s=p_(i.pibDocumentArchiveStore.showNoAccountsEmptyState());mb();let _=p_(i.pibDocumentArchiveStore.showNoResultsEmptyState());mb(),gC(n===false?10:-1),mb(),gC(n===false&&s===false&&_===false?11:12);}},dependencies:[sN,mg,Vi,wi,Li,v6,Ys,X9,Nf,Rf,Te,sB,Bi,ye],encapsulation:2,changeDetection:1});}};pi();var Zi=N(ep());Be$1();vM();q$1();vM();G$2();vc();var Ct=class o extends E{constructor(e,i){super();this.dsObservable=e;this.DS=i;this.dsNames=["documentArchive"];}fetch(e){return S(this,null,function*(){let i,n=(_,G)=>{i=G;};return this.DS.definitions.documentArchive.on("ROB.hasMoreElements",n),{documentArchive:yield this.DS.create("documentArchive",e),next:i}})}fromCache(e,i){return {documentArchive:i.documentArchive,next:i.next}}static{this.\u0275fac=function(i){return new(i||o)(de(J$2),de(os))};}static{this.\u0275prov=X({token:o,factory:o.\u0275fac,providedIn:"root"});}};pi();pi();vM();var ji=class o{constructor(t){this._state=new br$1(t);}get state$(){return this._state.asObservable()}get state(){return this._state.getValue()}setState(t){let e=t(this.state);this._state.next(E$3(E$3({},this.state),e));}select(t){return this.state$.pipe(we$1(t),Xo())}static{this.\u0275fac=function(e){return new(e||o)(de("initialState"))};}static{this.\u0275prov=X({token:o,factory:o.\u0275fac,providedIn:"root"});}};vM();var Ca={rawDocumentArchive:[],documentArchive:[],accounts:[],companies:[],groups:[],filters:{group:null,company:null,account:null,fromDate:null,toDate:null,chosenYear:null},isFilterFormValid:true,selectedDocumentArchive:[],isSelectAllChecked:false,isSelectAllIntermediateState:false,isExportButtonDisabled:false,totalCount:0},K=class o extends ji{constructor(){super(Ca);this.resetFiltersSubject$=new ne;this.showResultSubject$=new ne;this.performDocumentsSearchSubject$=new ne;this.selectAllSubject$=new ne;this.enableMultipleSelectionSubject$=new ne;this.exportToPdfChooseActionSubject$=new ne;this.isExportButtonDisabledSubject$=new ne;this.resetFiltersButtonClicked$=this.resetFiltersSubject$.asObservable();this.showResultClicked$=this.showResultSubject$.asObservable();this.performDocumentSearch$=this.performDocumentsSearchSubject$.asObservable();this.selectAllClicked$=this.selectAllSubject$.asObservable();this.enableMultipleSelection$=this.enableMultipleSelectionSubject$.asObservable();this.exportToPdfChooseActionClicked$=this.exportToPdfChooseActionSubject$.asObservable();this.isExportButtonDisabled$=this.isExportButtonDisabledSubject$.asObservable();}resetFiltersAction(){this.resetFiltersSubject$.next({});}showResultClicked(){this.showResultSubject$.next({});}performDocumentsSearch(e){this.performDocumentsSearchSubject$.next(e);}selectAllAction(e){e===false&&this.setState(()=>({isSelectAllIntermediateState:false,isSelectAllChecked:false,selectedDocumentArchive:[]})),this.selectAllSubject$.next(e);}enableMultipleSelectionAction(e){this.enableMultipleSelectionSubject$.next(e);}disableExportButton(e){this.isExportButtonDisabledSubject$.next(e);}exportToPdfChooseAction(){this.exportToPdfChooseActionSubject$.next({});}static{this.\u0275fac=function(i){return new(i||o)};}static{this.\u0275prov=X({token:o,factory:o.\u0275fac,providedIn:"root"});}};he();$N();pi();var Nt=N(ep());Be$1();vM();na$1();var Ao=N(ep());Be$1();vM();var Yi=class o{customDatesValidator(){return t=>{let e=t.get("fromDate"),i=t.get("toDate"),n=Qe(),s={};this.resetControls([e,i]),s=this.checkDatesValidation(s,e,i,n),this.setValidations(s,t),this.setControlsUntouched(e,i);}}
2checkDatesValidation(t,e,i,n){return (0, Ao.isDate)(e.value)||(t.fromDate="invalidDate"),(0, Ao.isDate)(i.value)||(t.toDate="invalidDate"),Qe(e.value)>n&&(t.fromDate="invalidFutureDate"),Qe(i.value)>n&&(t.toDate="invalidFutureDate"),Qe(e.value).isAfter(Qe(i.value))&&e.dirty&&(t.fromDate="fromDateAfterToDate"),Qe(i.value).isBefore(Qe(e.value))&&i.dirty&&(t.toDate="toDateBeforeFromDate"),t}setValidations(t,e){let i=Object.entries(t);if(i.length>0){let n=i[0][0],s=i[0][1];e.get(n).setErrors({[s]:true}),e.get(n).markAsTouched(),e.get(n).markAsDirty();}}resetControls(t){t.forEach(e=>e.setErrors(null));}setControlsUntouched(t,e){t.valid&&e.valid&&(t.markAsPristine(),t.markAsUntouched(),e.markAsPristine(),e.markAsUntouched());}static{this.\u0275fac=function(e){return new(e||o)};}static{this.\u0275prov=X({token:o,factory:o.\u0275fac,providedIn:"any"});}};he();$N();vM();var Hi=class o{transform(t){return {label:t}}static{this.\u0275fac=function(e){return new(e||o)};}static{this.\u0275pipe=QT({name:"labelMap",type:o,pure:true,standalone:false});}};var _a=o=>[o],ga=()=>["companyName"],ya=(o,t)=>[o,t];function Ia(o,t){if(o&1&&(Ms(0,"div"),c_(1),rd(),Ms(2,"div",10)(3,"span",5),c_(4,"PAGE.DOCUMENT_ARCHIVE.V2.NUMBER_OF_ACCOUNTS"),rd(),c_(5),rd()),o&2){let e=RC().$implicit;mb(),cv(e.item?.name),mb(4),cd(" ",e.item?.numberOfAccounts," ");}}function Ta(o,t){if(o&1&&(Ms(0,"div"),c_(1),rd()),o&2){let e=RC().$implicit;mb(),cv(e.item?.name);}}function xa(o,t){if(o&1&&mC(0,Ia,6,2)(1,Ta,2,1,"div"),o&2){let e=t.$implicit;gC(e.item?.numberOfAccounts!==0?0:1);}}function Oa(o,t){if(o&1&&(Ms(0,"ebank-form-field")(1,"ebank-label",5),c_(2,"PAGE.DOCUMENT_ARCHIVE.V2.COMPANY"),rd(),Ms(3,"ebank-simple-selector",9),N_(4,"translate"),wy(5,xa,2,1,"ng-template",null,0,L_),rd(),tT(),rd()),o&2){let e=HC(6),i=RC();mb(3),Ry("options",i.companies)("itemTemplate",e)("searchAttributes",b_(6,ga))("titleOnMobile",R_(4,4,"PAGE.DOCUMENT_ARCHIVE.V2.COMPANY")),nT();}}function Fa(o,t){if(o&1&&(Ms(0,"div"),c_(1),rd(),Ms(2,"div"),c_(3),N_(4,"accountNumberFormat"),rd()),o&2){let e=t.$implicit;mb(),cv(e.item?.displayName),mb(2),cv(R_(4,2,e.item==null?null:e.item.accountNumber));}}function Pa(o,t){if(o&1&&(Ms(0,"ebank-form-field")(1,"ebank-label",5),c_(2,"PAGE.DOCUMENT_ARCHIVE.V2.ACCOUNT"),rd(),Ms(3,"ebank-simple-selector",11),N_(4,"translate"),wy(5,Fa,5,4,"ng-template",null,1,L_),rd(),tT(),rd()),o&2){let e=HC(6),i=RC();mb(3),Ry("options",i.sortedAccounts)("itemTemplate",e)("searchAttributes",C_(6,ya,i.labelMap.DisplayName,i.labelMap.AccountNumber))("titleOnMobile",R_(4,4,"PAGE.DOCUMENT_ARCHIVE.V2.ACCOUNT")),nT();}}function ka(o,t){if(o&1&&(Ms(0,"div",8)(1,"ebank-form-field")(2,"ebank-label",5),c_(3,"PAGE.DOCUMENT_ARCHIVE.V2.FROM_DATE"),rd(),Ms(4,"ebank-sub-label",5),c_(5,"PAGE.DOCUMENT_ARCHIVE.V2.DATE.SUBLABEL"),rd(),ky(6,"ebank-date-picker",12,2),N_(8,"translate"),tT(),Ms(9,"ebank-form-error-wrapper")(10,"ebank-form-error",13)(11,"span",5),c_(12,"PAGE.DOCUMENT_ARCHIVE.V2.INVALID_DATE"),rd()(),Ms(13,"ebank-form-error",14)(14,"span",5),c_(15,"PAGE.DOCUMENT_ARCHIVE.V2.INVALID_FUTURE_DATE"),rd()(),Ms(16,"ebank-form-error",15)(17,"span",5),c_(18,"PAGE.DOCUMENT_ARCHIVE.V2.INVALID_FROM_DATE_GREATER"),rd()()()(),Ms(19,"ebank-form-field")(20,"ebank-label",5),c_(21,"PAGE.DOCUMENT_ARCHIVE.V2.TO_DATE"),rd(),Ms(22,"ebank-sub-label",5),c_(23,"PAGE.DOCUMENT_ARCHIVE.V2.DATE.SUBLABEL"),rd(),ky(24,"ebank-date-picker",16,3),N_(26,"translate"),tT(),Ms(27,"ebank-form-error-wrapper")(28,"ebank-form-error",13)(29,"span",5),c_(30,"PAGE.DOCUMENT_ARCHIVE.V2.INVALID_DATE"),rd()(),Ms(31,"ebank-form-error",14)(32,"span",5),c_(33,"PAGE.DOCUMENT_ARCHIVE.V2.INVALID_FUTURE_DATE"),rd()(),Ms(34,"ebank-form-error",17)(35,"span",5),c_(36,"PAGE.DOCUMENT_ARCHIVE.V2.INVALID_TO_DATE_EARLIER"),rd()()()()()),o&2){let e=HC(7),i=HC(25),n=RC();mb(6),Ry("max",n.maxFromDate)("titleOnMobile",R_(8,11,"PAGE.DOCUMENT_ARCHIVE.V2.FROM_DATE")),nT(),mb(4),Ry("control",e),mb(3),Ry("control",e),mb(3),Ry("control",e),mb(8),Ry("min",n.minToDate)("max",n.maxDate)("titleOnMobile",R_(26,13,"PAGE.DOCUMENT_ARCHIVE.V2.TO_DATE")),nT(),mb(4),Ry("control",i),mb(3),Ry("control",i),mb(3),Ry("control",i);}}function Na(o,t){if(o&1&&(Ms(0,"ebank-form-field")(1,"ebank-label",5),c_(2,"PAGE.DOCUMENT_ARCHIVE.V2.YEAR"),rd(),Ms(3,"ebank-simple-selector",18),N_(4,"translate"),ky(5,"ebank-option-template",7),N_(6,"labelMap"),rd(),tT(),rd()),o&2){let e=RC();mb(3),Ry("options",e.listOfYears)("disableSearch",true)("titleOnMobile",R_(4,4,"PAGE.DOCUMENT_ARCHIVE.V2.YEAR")),nT(),mb(2),Ry("labelMap",R_(6,6,e.labelMap.Year));}}var $i=class o{constructor(t,e,i,n,s){this.formBuilder=t;this.store=e;this.documentArchiveValidators=i;this.translateService=n;this.configService=s;this.defaultFromDate=Qe().subtract(1,"months").startOf("day").toDate();this.defaultToDate=Qe().startOf("day").toDate();this.filterForm=this.formBuilder.group({group:null,company:null,account:null,minMaxDates:this.formBuilder.group({fromDate:this.defaultFromDate,toDate:this.defaultToDate},{validators:this.documentArchiveValidators.customDatesValidator()}),chosenYear:null});this.groupOptions=[];this.companies=[];this.sortedAccounts=[];this.labelMap=U;this.maxDate=this.defaultToDate;this.maxFromDate=this.defaultToDate;this.minToDate=this.defaultFromDate;this.listOfYears=[];this.subscription=new H;this.noCompanyAndNoAccountMode=false;this.noCompanyOnlyMode=false;this.GroupCodes=B$2;}get groupControl(){return this.filterForm.controls.group}get companyControl(){return this.filterForm.controls.company}get accountControl(){return this.filterForm.controls.account}get minMaxDatesGroup(){return this.filterForm.get("minMaxDates")}get fromDateControl(){return this.minMaxDatesGroup.get("fromDate")}get toDateControl(){return this.minMaxDatesGroup.get("toDate")}get chosenYearControl(){return this.filterForm.controls.chosenYear}ngOnInit(){this.setSubscriptions(),this.setListOfYears();}ngOnDestroy(){this.subscription.unsubscribe();}
2onSubmit(){if(this.filterForm.invalid)return;let t=this.groupControl.value,e=this.companyControl.value,i=this.accountControl.value,n=t.groupCode==="AARSOPPG",s=Qe(this.chosenYearControl.value.year+"-12-01").startOf("day"),_=Qe(this.chosenYearControl.value.year).add(1,"year").format("YYYY"),G=Qe(_+"-05-30").endOf("day"),re=n?s:this.fromDateControl.value,St=n?G:this.toDateControl.value;this.filters={group:t,company:t.agreementSearch||!t.accountSearch?e:null,account:t.accountSearch||!t.agreementSearch?i:null,fromDate:t.dateSearch?re:null,toDate:t.dateSearch?St:null,chosenYear:n?this.chosenYearControl.value.year:null},this.store.performDocumentsSearch(this.filters),this.storeFilters();}setSubscriptions(){this.subscription.add(this.store.state$.subscribe(t=>{t.groups.length!==this.groupOptions.length&&(this.handleGroupOptions(t.groups),this.setDefaultGroupOption()),this.companies.length===0&&(this.companies=t.companies),this.sortedAccounts.length===0&&(this.sortedAccounts=this.sortAccounts(t.accounts));})),this.subscription.add(this.groupControl.valueChanges.subscribe(t=>{!t.agreementSearch&&!t.accountSearch?(this.addNoCompanyOption(),this.noCompanyAndNoAccountMode=true,this.noCompanyOnlyMode=false):!t.agreementSearch&&t.accountSearch?(this.resetAccountOptionsToDefaultState(),this.noCompanyAndNoAccountMode=false,this.noCompanyOnlyMode=true):(this.resetCompaniesOptionsToDefaultState(),this.resetAccountOptionsToDefaultState(),this.noCompanyAndNoAccountMode=false,this.noCompanyOnlyMode=false);})),this.subscription.add(this.companyControl.valueChanges.pipe(hf(100)).subscribe(t=>{this.noCompanyOnlyMode||(this.sortedAccounts=this.filterAccounts(t?.companyId)),t?.companyId!=="noCompany"&&this.noCompanyAndNoAccountMode&&!this.isAllAccountsOptionAdded()?this.addAllAccountsOption():t?.companyId==="noCompany"&&this.noCompanyAndNoAccountMode&&this.resetAccountOptionsToDefaultState();})),this.subscription.add(this.fromDateControl.valueChanges.subscribe(()=>{this.setMinToDate();})),this.subscription.add(this.toDateControl.valueChanges.subscribe(()=>{this.setMaxFromDate();})),this.subscription.add(this.store.showResultClicked$.subscribe(()=>this.onSubmit())),this.subscription.add(this.store.resetFiltersButtonClicked$.subscribe(()=>{this.resetFilters();}));}handleGroupOptions(t){t.sort((e,i)=>this.translateService.instant("PAGE.DOCUMENT_ARCHIVE.DOCUMENT_TYPE."+e.group.toUpperCase()).localeCompare(this.translateService.instant("PAGE.DOCUMENT_ARCHIVE.DOCUMENT_TYPE."+i.group.toUpperCase()))),this.groupOptions=t.map(e=>({groupCode:e.group,displayName:this.translateService.instant("PAGE.DOCUMENT_ARCHIVE.DOCUMENT_TYPE."+e.group.toUpperCase()),accountSearch:e.accountSearch,agreementSearch:e.agreementSearch,dateSearch:e.dateSearch}));}storeFilters(){this.store.setState(()=>({filters:this.filters}));}filterAccounts(t){if(t==="noCompany")return this.sortAccounts(this.store.state.accounts);{let e=this.store.state.accounts.filter(i=>i.owner.customerNumber===t);return this.sortAccounts(e)}}sortAccounts(t){return (0, Nt.sortBy)(t,[e=>e.displayName.toLowerCase()])}resetFilters(){this.setDefaultGroupOption(),this.companyControl.setValue(this.companies[0]),this.accountControl.setValue(this.sortedAccounts[0]),this.fromDateControl.setValue(this.defaultFromDate),this.toDateControl.setValue(this.defaultToDate),this.storeFilters(),this.store.setState(()=>({rawDocumentArchive:[],documentArchive:[],totalCount:0}));}addAllAccountsOption(){let t=this.getAllAccountsItem();this.sortedAccounts=[t,...this.sortedAccounts],this.accountControl.setValue(this.sortedAccounts[0]);}addNoCompanyOption(){let t=this.getNoCompanyItem();this.isNoCompanyOptionAdded()||(this.companies=[t,...this.companies]),this.companyControl.setValue(this.companies[0]);}getAllAccountsItem(){return {displayName:this.translateService.instant("PAGE.DOCUMENT_ARCHIVE.V2.ALL_ACCOUNTS"),accountId:"allAccounts",rights:{accessPermission:true}}}getNoCompanyItem(){return {companyId:"noCompany",name:" - ",numberOfAccounts:0}}setMinToDate(){(0, Nt.isDate)(this.fromDateControl.value)&&(this.minToDate=this.fromDateControl.value);}setMaxFromDate(){(0, Nt.isDate)(this.toDateControl.value)&&(this.maxFromDate=this.toDateControl.value);}setListOfYears(){for(let t=0;t<10;t++)this.listOfYears.push({year:Qe().subtract(t+1,"year").format("YYYY")});this.chosenYearControl.setValue(this.listOfYears[0]);}isAllAccountsOptionAdded(){return this.sortedAccounts.length>this.store.state.accounts.length}isNoCompanyOptionAdded(){return this.companies.some(t=>t.companyId==="noCompany")}resetCompaniesOptionsToDefaultState(){this.companies=this.store.state.companies,this.companyControl.setValue(this.companies[0]);}resetAccountOptionsToDefaultState(){this.sortedAccounts=this.sortAccounts(this.store.state.accounts),this.accountControl.setValue(this.sortedAccounts[0]);}setDefaultGroupOption(){let t=this.groupOptions.find(e=>e.groupCode===this.configService.config.defaultDocumentType);t&&this.groupControl.setValue(t);}static{this.\u0275fac=function(e){return new(e||o)(Do(oR),Do(K),Do(Yi),Do(V),Do(c$1
2))};}static{this.\u0275cmp=qT({type:o,selectors:[["document-archive-filters-panel"]],standalone:false,decls:13,vars:14,consts:[["companyItemTemplate",""],["accountItemTemplate",""],["fromDateEbankControl","ebankControl"],["toDateEbankControl","ebankControl"],["id","cibDocumentArchiveFiltersPanel",3,"formGroup"],["translate",""],["formControlName","group","id","cibDocumentArchiveGroupFilter",3,"options","searchAttributes","titleOnMobile"],["selectTemplate","single",3,"labelMap"],["formGroupName","minMaxDates"],["formControlName","company","id","cibDocumentArchiveCompanyFilter",3,"options","itemTemplate","searchAttributes","titleOnMobile"],[1,"ebank-text-small"],["formControlName","account","id","cibDocumentArchiveAccountFilter",3,"options","itemTemplate","searchAttributes","titleOnMobile"],["id","fromDate","formControlName","fromDate",3,"max","titleOnMobile"],["validation","invalidDate",3,"control"],["validation","invalidFutureDate",3,"control"],["validation","fromDateAfterToDate",3,"control"],["id","toDate","formControlName","toDate",3,"min","max","titleOnMobile"],["validation","toDateBeforeFromDate",3,"control"],["formControlName","chosenYear","id","cibDocumentArchiveChosenYear",3,"options","disableSearch","titleOnMobile"]],template:function(e,i){e&1&&(Ms(0,"form",4)(1,"ebank-form-field")(2,"ebank-label",5),c_(3,"PAGE.DOCUMENT_ARCHIVE.V2.DOCUMENT_GROUP_AND_TYPE"),rd(),Ms(4,"ebank-simple-selector",6),N_(5,"translate"),ky(6,"ebank-option-template",7),N_(7,"labelMap"),ky(8,"ebank-option-template"),rd(),tT(),rd(),mC(9,Oa,7,7,"ebank-form-field"),mC(10,Pa,7,9,"ebank-form-field"),mC(11,ka,37,15,"div",8)(12,Na,7,8,"ebank-form-field"),rd()),e&2&&(Ry("formGroup",i.filterForm),mb(4),Ry("options",i.groupOptions)("searchAttributes",T_(12,_a,i.labelMap.DisplayName))("titleOnMobile",R_(5,8,"PAGE.DOCUMENT_ARCHIVE.V2.DOCUMENT_GROUP_AND_TYPE")),nT(),mb(2),Ry("labelMap",R_(7,10,i.labelMap.DisplayName)),mb(3),gC(i.groupControl.value?.agreementSearch||!i.groupControl.value?.accountSearch?9:-1),mb(),gC(i.groupControl.value?.accountSearch||!i.groupControl.value?.agreementSearch?10:-1),mb(),gC(i.groupControl.value?.dateSearch&&i.groupControl.value?.groupCode!==i.GroupCodes.AnnualStatement?11:i.groupControl.value?.groupCode===i.GroupCodes.AnnualStatement?12:-1));},dependencies:[eR,co,Ch,uo$1,Nl,Cr$1,j$2,u,Te,No,vI,QI,X3,fu,Pa$1,gu,on,sI,f8,ye,p$2,Hi],encapsulation:2,changeDetection:1});}};pi();Fh();Be$1();vM();he();$N();var Ra=(o,t)=>t.text;function Va(o,t){if(o&1&&ky(0,"ebank-chip",1),o&2){let e=t.$implicit;Ry("readOnly",true)("text",e.text);}}var Wi=class o{constructor(t,e){this.store=t;this.translateService=e;this.matchedItems=this.store.state.totalCount;this.chips=[];this.subscription=new H;}ngOnInit(){this.setSubscriptions();}ngOnDestroy(){this.subscription.unsubscribe();}resetFilters(){this.resetChips(),this.store.resetFiltersAction();}setSubscriptions(){this.subscription.add(this.store.state$.pipe(Vn(t=>this.byFilters(t.filters))).subscribe(t=>this.handleFilterValuesChanged(t.filters))),this.subscription.add(this.store.state$.pipe(Vn(t=>this.byNumberOfDocumentArchiveItems(t.totalCount))).subscribe(t=>this.matchedItems=t.totalCount));}addChips(t,e){this.chips.push({text:`${this.translateService.instant(t)}: ${e}`});}resetChips(){this.chips=[];}handleFilterValuesChanged(t){this.checkFilterValuesChange(t);}checkFilterValuesChange(t){this.resetChips(),this.checkGroupAndTypeValueChange(t.group.displayName),t.company&&this.checkCompanyValueChange(t.company),t.account&&this.checkAccountValueChange(t.account),t.fromDate&&this.checkFromDateValueChange(t.fromDate),t.toDate&&this.checkToDateValueChange(t.toDate),t.chosenYear&&this.checkChosenYearValueChange(t.chosenYear);}checkGroupAndTypeValueChange(t){this.addChips("PAGE.DOCUMENT_ARCHIVE.V2.DOCUMENT_GROUP_AND_TYPE",t);}checkCompanyValueChange(t){this.addChips("PAGE.DOCUMENT_ARCHIVE.V2.COMPANY",t.name);}checkAccountValueChange(t){this.addChips("PAGE.DOCUMENT_ARCHIVE.V2.ACCOUNT",t.displayName);}checkFromDateValueChange(t){this.addChips("PAGE.DOCUMENT_ARCHIVE.V2.FROM_DATE",this.getFormattedDate(t));}checkToDateValueChange(t){this.addChips("PAGE.DOCUMENT_ARCHIVE.V2.TO_DATE",this.getFormattedDate(t));}checkChosenYearValueChange(t){this.removeDatesChipsWhenYearModeEnabled(),this.addChips("PAGE.DOCUMENT_ARCHIVE.V2.YEAR",t);}byFilters(t){return this.lastFilterValues!==t}byNumberOfDocumentArchiveItems(t){return this.matchedItems!==t}getFormattedDate(t){return Qe(t).format("DD.MM.YYYY")}removeDatesChipsWhenYearModeEnabled(){this.chips.splice(-2,2);}static{this.\u0275fac=function(e){return new(e||o)(Do(K),Do(V))};}
2static{this.\u0275cmp=qT({type:o,selectors:[["document-archive-filters-chips"]],standalone:false,decls:3,vars:1,consts:[[3,"removeAllClick","numResults"],[3,"readOnly","text"]],template:function(e,i){e&1&&(Ms(0,"ebank-filter-display-area",0),qy("removeAllClick",function(){return i.resetFilters()}),IC(1,Va,1,2,"ebank-chip",1,Ra),rd()),e&2&&(Ry("numResults",i.matchedItems),mb(),EC(i.chips));},dependencies:[Y3,Vs],encapsulation:2,changeDetection:1});}};pi();vM();he();$N();na$1();pi();vM();na$1();$N();var La=["*"],Xi=class o{constructor(t){this.store=t;this.checkBoxFormGroup=new yn({isChecked:new vn(false)});this.subscription=new H;this.maxSelectedItemsLimit=100;}get isCheckedControl(){return this.checkBoxFormGroup.get("isChecked")}ngOnInit(){this.setSubscriptions(),this.enableOrDisableSelectActionAfterSelectAllOrLoadMore(),this.checkAndSetIntermediateStateAfterLoadMore();}ngOnDestroy(){this.subscription.unsubscribe();}onCheckBoxChanged(t){this.selectOrUnselectDocumentArchive(t),this.checkAndSetSelectAllStatus();}setSubscriptions(){this.subscription.add(this.store.selectAllClicked$.subscribe(t=>{this.isCheckedControl.value!==t&&this.isCheckedControl.setValue(t),this.enableOrDisableSelectActionAfterSelectAllOrLoadMore();})),this.subscription.add(this.store.enableMultipleSelection$.subscribe(t=>{t?this.enableSelectAction():this.disableSelectAction();}));}checkAndSetSelectAllStatus(){if(this.store.state.selectedDocumentArchive.length===0){this.store.selectAllAction(false);return}this.store.state.isSelectAllIntermediateState!==true&&this.store.setState(()=>({isSelectAllIntermediateState:true})),(this.store.state.selectedDocumentArchive.length===this.store.state.rawDocumentArchive.length||this.store.state.selectedDocumentArchive.length===this.maxSelectedItemsLimit)&&(this.store.setState(()=>({isSelectAllIntermediateState:false})),this.store.selectAllAction(true));}selectOrUnselectDocumentArchive(t){t?this.selectDocumentArchiveItem():this.unselectDocumentArchiveItem();}selectDocumentArchiveItem(){this.store.setState(()=>({selectedDocumentArchive:[...this.store.state.selectedDocumentArchive,this.documentArchiveItemId]})),this.store.state.selectedDocumentArchive.length===this.maxSelectedItemsLimit&&this.store.enableMultipleSelectionAction(false),this.isCheckedControl.enable();}unselectDocumentArchiveItem(){this.store.setState(()=>({selectedDocumentArchive:this.store.state.selectedDocumentArchive.filter(t=>t!==this.documentArchiveItemId)})),this.store.state.selectedDocumentArchive.length===this.maxSelectedItemsLimit-1&&this.store.enableMultipleSelectionAction(true);}enableOrDisableSelectActionAfterSelectAllOrLoadMore(){this.store.state.selectedDocumentArchive.length===this.maxSelectedItemsLimit?(this.deselectDocumentItemsAboveSelectionLimit(),this.disableSelectAction()):this.enableSelectAction();}disableSelectAction(){this.isCheckedControl.value||this.isCheckedControl.disable();}enableSelectAction(){this.isCheckedControl.enable();}deselectDocumentItemsAboveSelectionLimit(){this.store.state.selectedDocumentArchive.some(e=>e===this.documentArchiveItemId)||this.isCheckedControl.setValue(false);}checkAndSetIntermediateStateAfterLoadMore(){this.store.state.isSelectAllChecked&&this.store.state.selectedDocumentArchive.length!==this.store.state.rawDocumentArchive.length&&this.store.setState(()=>({isSelectAllChecked:false,isSelectAllIntermediateState:true}));}static{this.\u0275fac=function(e){return new(e||o)(Do(K))};}
2static{this.\u0275cmp=qT({type:o,selectors:[["document-archive-checkbox-panel"]],inputs:{documentArchiveItemId:"documentArchiveItemId"},standalone:false,ngContentSelectors:La,decls:3,vars:1,consts:[[3,"formGroup"],["formControlName","isChecked",3,"changed"]],template:function(e,i){e&1&&(OC(),Ms(0,"form",0)(1,"ebank-checkbox-panel",1),qy("changed",function(s){return i.onCheckBoxChanged(s)}),PC(2),rd(),tT(),rd()),e&2&&(Ry("formGroup",i.checkBoxFormGroup),mb(),nT());},dependencies:[eR,co,Ch,uo$1,Nl,j$2,u,Q8,X3,fu],encapsulation:2,changeDetection:1});}};Be$1();vM();$N();he();var zi=class o{constructor(t,e,i){this.forwardLinkService=t;this.accountNumberFormatPipe=e;this.fileNamePipe=i;}set documentArchiveItem(t){t&&this.transformDocumentArchiveItem(t);}onShowDocumentClicked(){this.openDocument(this.documentArchiveTemplateInfo);}openDocument(t){return S(this,null,function*(){yield this.forwardLinkService.openApiV4(t.links.document.href);})}transformDocumentArchiveItem(t){this.documentArchiveTemplateInfo={dueDate:Qe(t.date).format("DD.MM.YYYY"),recipientName:this.fileNamePipe.transform(t),from:this.getAccountInfo(t),links:t.links};}getAccountInfo(t){if(t.accountName&&t.accountNumber)return t.accountName+" - "+this.accountNumberFormatPipe.transform(t.accountNumber);if(!t.accountName&&t.accountNumber)return this.accountNumberFormatPipe.transform(t.accountNumber)}static{this.\u0275fac=function(e){return new(e||o)(Do(x),Do(p$2),Do(A))};}
2static{this.\u0275cmp=qT({type:o,selectors:[["document-archive-item-template"]],inputs:{documentArchiveItem:"documentArchiveItem"},standalone:false,decls:5,vars:11,consts:[[3,"duedate","recipientName","from"],["buttonStyle","tertiary","size","xs","iconType","external",3,"buttonClick","useAsLink","altTextFunctionalIcon"]],template:function(e,i){e&1&&(ky(0,"ebank-template-payment",0),Ms(1,"ebank-button",1),N_(2,"translate"),qy("buttonClick",function(){return i.onShowDocumentClicked()}),c_(3),N_(4,"translate"),rd()),e&2&&(Ry("duedate",i.documentArchiveTemplateInfo.dueDate)("recipientName",i.documentArchiveTemplateInfo.recipientName)("from",i.documentArchiveTemplateInfo.from),mb(),Ry("altTextFunctionalIcon",m_(R_(2,7,"EBANKUI.CONFIG.EXTERNAL.LINK")))("useAsLink",true),mb(2),cd(" ",R_(4,9,"PAGE.DOCUMENT_ARCHIVE.V2.DETAILS"),`
3`));},dependencies:[_e,K6,ye],encapsulation:2,changeDetection:1});}};var Ba=(o,t)=>t.id;function ja(o,t){if(o&1&&(Ms(0,"ebank-section-header-panel"),c_(1),rd()),o&2){let e=RC(2).$implicit;mb(),cv(e.name);}}function Ya(o,t){o&1&&wy(0,ja,2,1,"ebank-section-header-panel",4);}function Ha(o,t){if(o&1&&(Ms(0,"document-archive-checkbox-panel",3),ky(1,"document-archive-item-template",6),rd()),o&2){let e=RC(2).$implicit;Ry("documentArchiveItemId",e.id),mb(),Ry("documentArchiveItem",e);}}function $a(o,t){o&1&&wy(0,Ha,2,2,"document-archive-checkbox-panel",5);}function Wa(o,t){if(o&1&&mC(0,Ya,1,0,"ebank-section-header-panel")(1,$a,1,0,"document-archive-checkbox-panel",3),o&2){let e=t.$implicit,i=RC(2);gC(e.itemType===i.ItemType.Header?0:e.itemType===i.ItemType.Item?1:-1);}}function Xa(o,t){if(o&1){let e=CC();Ms(0,"ebank-load-more",1),qy("slicedList",function(n){yh(e);let s=RC();return vh(s.paginatedDocumentArchive=s.onSlicedList(n))}),Ms(1,"ebank-panel-list",2),IC(2,Wa,2,1,null,null,Ba),rd()();}if(o&2){let e=RC();Ry("callback",e.notifyLoadMoreDocumentArchive)("list",e.documentArchive)("isDataItem",e.isDataItem)("totalDataItemCount",e.totalDataItemCount)("counter",e.counter.bind(e))("loaded",e.customLoader.bind(e))("buttonText",e.loadMoreButtonText)("config",e.loadMoreInitConfig),mb(2),EC(e.paginatedDocumentArchive);}}var qi=class o{constructor(t,e){this.store=t;this.translateService=e;this.totalDataItemCount=0;this.loadMoreButtonText=this.translateService.instant("PAGE.DOCUMENT_ARCHIVE.V2.LOAD_MORE.BUTTON.LABEL");this.loadMoreInitConfig={initialLoad:50,increment:50};this.ItemType=w;this.subscription=new H;}ngOnInit(){this.setSubscriptions();}ngOnDestroy(){this.subscription.unsubscribe();}isDataItem(t){return t.itemType!=="header"}counter(t){return this.translateService.instant("PAGE.DOCUMENT_ARCHIVE.V2.SHOWING",{count:t.count,total:t.total})}customLoader(t){return this.translateService.instant("EBANKUI.CONFIG.LOAD_MORE.LOADED_AMOUNT",{amount:t.amount})}onSlicedList(t){return t}setSubscriptions(){this.subscription.add(this.store.state$.subscribe(t=>{this.documentArchive=t.documentArchive,this.totalDataItemCount=t.totalCount;}));}static{this.\u0275fac=function(e){return new(e||o)(Do(K),Do(V))};}
3static{this.\u0275cmp=qT({type:o,selectors:[["document-archive-items"]],inputs:{notifyLoadMoreDocumentArchive:"notifyLoadMoreDocumentArchive"},standalone:false,decls:1,vars:1,consts:[[3,"callback","list","isDataItem","totalDataItemCount","counter","loaded","buttonText","config"],[3,"slicedList","callback","list","isDataItem","totalDataItemCount","counter","loaded","buttonText","config"],["groupHeadingId","document-archive-heading-id"],[3,"documentArchiveItemId"],[4,"ebankPanelList"],[3,"documentArchiveItemId",4,"ebankPanelList"],[3,"documentArchiveItem"]],template:function(e,i){e&1&&mC(0,Xa,4,8,"ebank-load-more",0),e&2&&gC(i.documentArchive.length?0:-1);},dependencies:[o6,hi,ig,q8,Xi,zi],encapsulation:2,changeDetection:1});}};pi();na$1();Fh();vM();na$1();$N();$n();he();var Ki=class o{constructor(t){this.store=t;this.isSelectAllIntermediateState=this.store.state.isSelectAllIntermediateState;this.selectAllFormGroup=new yn({selectAllDocuments:new vn(this.store.state.isSelectAllChecked)});this.isExportButtonDisabled$=this.store.isExportButtonDisabled$;this.subscription=new H;}get isSelectAllDocumentsControl(){return this.selectAllFormGroup.get("selectAllDocuments")}ngOnInit(){this.setSubscription();}ngOnDestroy(){this.subscription.unsubscribe();}onSelectAll(t){this.selectAll(t);}exportToPdfAction(){this.store.exportToPdfChooseAction();}setSubscription(){this.subscription.add(this.store.state$.pipe(Vn(t=>this.bySelectAllIntermediateState(t.isSelectAllIntermediateState))).subscribe(t=>this.setSelectAllIntermediateSate(t.isSelectAllIntermediateState))),this.subscription.add(this.store.selectAllClicked$.subscribe(t=>{this.isSelectAllDocumentsControl.setValue(t);}));}selectAll(t){let e=this.selectOrUnselectDocumentArchive(t);this.store.setState(()=>({isSelectAllIntermediateState:false,isSelectAllChecked:t,selectedDocumentArchive:e})),this.store.selectAllAction(t);}selectDocumentArchive(){return this.store.state.rawDocumentArchive.map(e=>e.id).slice(0,100)}selectOrUnselectDocumentArchive(t){return t?this.selectDocumentArchive():[]}bySelectAllIntermediateState(t){return this.isSelectAllIntermediateState!==t}setSelectAllIntermediateSate(t){this.isSelectAllIntermediateState=t;}static{this.\u0275fac=function(e){return new(e||o)(Do(K))};}
3static{this.\u0275cmp=qT({type:o,selectors:[["document-archive-selections-area"]],standalone:false,decls:15,vars:15,consts:[["actionInfo",""],[1,"document-archive-select-all"],[3,"formGroup"],["formControlName","selectAllDocuments",3,"changed","indeterminate"],["buttonStyle","tertiary","size","s",3,"buttonClick","disabled"],[3,"content"]],template:function(e,i){if(e&1&&(Ms(0,"div",1)(1,"div",2)(2,"ebank-checkbox-field",3),qy("changed",function(s){return i.onSelectAll(s)}),c_(3),N_(4,"translate"),rd(),tT(),rd(),Ms(5,"div")(6,"ebank-button",4),N_(7,"async"),qy("buttonClick",function(){return i.exportToPdfAction()}),c_(8),N_(9,"translate"),rd(),ky(10,"ebank-help-button",5),Ms(11,"ebank-help-button-content",null,0),c_(13),N_(14,"translate"),rd()()()),e&2){let n=HC(12);mb(),Ry("formGroup",i.selectAllFormGroup),mb(),Ry("indeterminate",i.isSelectAllIntermediateState),nT(),mb(),cd(" ",R_(4,7,"PAGE.DOCUMENT_ARCHIVE.V2.SELECT_ALL")," "),mb(3),Ry("disabled",R_(7,9,i.isExportButtonDisabled$)),mb(2),cd(" ",R_(9,11,"PAGE.DOCUMENT_ARCHIVE.V2.EXPORT_TO_PDF")," "),mb(2),Ry("content",n),mb(3),cd(" ",R_(14,13,"PAGE.DOCUMENT_ARCHIVE.V2.SELECT_ALL_ACTION_HELP")," ");}},dependencies:[co,Ch,uo$1,Nl,j$2,Bn$1,_e,fu,yI,i8,mn,ye],encapsulation:2,changeDetection:1});}};$n();function Ka(o,t){o&1&&(Ms(0,"ebank-lead-block")(1,"ebank-link",3),N_(2,"sbUrl"),c_(3),N_(4,"translate"),rd()()),o&2&&(mb(),Ry("href",R_(2,2,"URL.PAGE.DOCUMENTS_TERMINATED_ACCOUNTS")),mb(2),cd(" ",R_(4,4,"APP.MENU.LINK.DOCUMENTS_TERMINATED_ACCOUNTS")," "));}function Qa(o,t){o&1&&ky(0,"document-archive-filters-chips");}function Za(o,t){if(o&1&&ky(0,"document-archive-selections-area")(1,"document-archive-items",4),o&2){let e=RC();mb(),Ry("notifyLoadMoreDocumentArchive",e.loadMoreDocumentArchiveCallback.bind(e));}}function Ja(o,t){o&1&&(Ms(0,"ebank-empty-state-description"),c_(1),N_(2,"translate"),rd()),o&2&&(mb(),cd(" ",R_(2,1,"PAGE.DOCUMENT_ARCHIVE.V2.NO_ACCOUNTS")," "));}function ec(o,t){o&1&&(sd(0),Ms(1,"ebank-empty-state-title",5),c_(2,"PAGE.DOCUMENT_ARCHIVE.V2.LIST_EMPTY.TITLE "),rd(),Ms(3,"ebank-empty-state-description",5),c_(4,"PAGE.DOCUMENT_ARCHIVE.V2.LIST_EMPTY.DESCRIPTION "),rd(),Qs$1());}function tc(o,t){o&1&&(sd(0),Ms(1,"ebank-empty-state-title",5),c_(2,"PAGE.DOCUMENT_ARCHIVE.V2.NO_RESULTS.TITLE "),rd(),Ms(3,"ebank-empty-state-description",5),c_(4,"PAGE.DOCUMENT_ARCHIVE.V2.NO_RESULTS.DESCRIPTION "),rd(),Qs$1());}function ic(o,t){if(o&1&&(Ms(0,"ebank-empty-state"),mC(1,Ja,3,3,"ebank-empty-state-description"),N_(2,"async"),N_(3,"async"),N_(4,"async"),nd(5,ec,5,0,"ng-container")(6,tc,5,0,"ng-container"),rd()),o&2){let e=RC();mb(),gC(R_(2,1,e.showNoAccountsEmptyState$)?1:R_(3,3,e.showStartEmptyState$)?5:R_(4,5,e.showNoResultsEmptyState$)?6:-1);}}var Qi=class o$1{constructor(t,e,i,n,s,_,G,re){this.dataAccounts=t;this.dataDocumentArchiveGroups=e;this.documentArchiveDataService=i;this.documentArchiveExportService=n;this.store=s;this.dateUtils=_;this.documentArchiveLogService=G;this.dataUserAccessRights=re;this.showNoAccountsEmptyState$=new br$1(false);this.showStartEmptyState$=new br$1(true);this.showNoResultsEmptyState$=new br$1(false);this.showSpinner$=new br$1(false);this.isShowResultButtonDisabled=false;this.totalCount=0;this.isAdminView=false;this.subscription=new H;this.accountList=this.store.state.accounts;this.nextPageTokenArray=[];this.paginationDefaultNumber=50;}ngOnInit(){this.setSubscriptions(),this.initialDataLoading(),this.setAdminView();}ngOnDestroy(){this.subscription.unsubscribe();}onSubmit(){this.store.showResultClicked();}loadMoreDocumentArchiveCallback(){return hI({}).pipe(_f(()=>this.loadMoreDocumentArchive()),we$1(()=>this.store.state.rawDocumentArchive.length>=this.store.state.totalCount))}setSubscriptions(){this.subscription.add(this.store.performDocumentSearch$.subscribe(t=>this.handleShowResultClicked(t))),this.subscription.add(this.store.exportToPdfChooseActionClicked$.subscribe(()=>this.handleExportTodPdfAction())),this.subscription.add(this.store.resetFiltersButtonClicked$.subscribe(()=>this.resetToInitialState()));}initialDataLoading(){this.showSpinner(true);let t=new ne;this.dataAccounts.get().pipe(_f(e=>!e||e.length===0?(this.showNoAccountsEmptyState(true),this.showSpinner(false),hI([])):(this.handleAccounts(e),this.dataDocumentArchiveGroups.get())),we$1(e=>{this.store.setState(()=>({groups:e}));}),Zt(1)).subscribe({next:()=>{this.showSpinner(false),t.next({});},error:e=>(this.handleFetchingDocumentArchiveError(e),t.next({}),hI([]))});}loadDocumentArchive(){this.showSpinner(true),this.nextPageToken=null,this.nextPageTokenArray=[];let t=this.getDocumentArchivePayloadParams(this.nextPageToken),e=new ne;this.getDocumentArchive(t).pipe(Sf(i=>this.handlePagination(i)),we$1(i=>this.handleDocumentArchiveResponse(i.documentArchive)),we$1(i=>this.groupDocumentArchiveByDate(i)),we$1(i=>this.getDocumentArchiveByItems(i)),Zt(1)).subscribe({next:i=>{this.store.setState(()=>({documentArchive:i})),this.showStartEmptyState(false),this.showSpinner(false),e.next({});},error:i=>(this.handleFetchingDocumentArchiveError(i),this.showSpinner(false),e.next({}),hI([]))});}loadMoreDocumentArchive(){let t=this.getDocumentArchivePayloadParams(this.nextPageToken);return this.getDocumentArchive(t).pipe(we$1(e=>(e.documentArchive=this.store.state.rawDocumentArchive.concat(e.documentArchive),this.handlePagination(e),this.handleDocumentArchiveResponse(e.documentArchive))),we$1(e=>this.groupDocumentArchiveByDate(e)),we$1(e=>this.getDocumentArchiveByItems(e)),Sf(e=>{this.showSpinner(false),this.store.setState(()=>({documentArchive:e}));}),Sa(e=>this.handleFetchingDocumentArchiveError(e)))}getDocumentArchive(t){return this.documentArchiveDataService.get(t)}handleAccounts(t){this.setAccountList(t),this.createCompanies(),this.store.setState(()=>({accounts:t}));}setAccountList(t){this.accountList=t;}handleShowResultClicked(t){this.filterValues=t,this.loadDocumentArchive(),this.resetSelectedDocumentArchive();}handleDocumentArchiveResponse(t){return this.showNoResultsEmptyState(t.length===0),this.store.setState(()=>({rawDocumentArchive:t})),t}handlePagination(t){this.totalCount=t.next?.totalCount||t.documentArchive.length,this.store.setState(()=>({totalCount:this.totalCount})),this.nextPageToken=t.next?.nextPageToken,this.nextPageToken&&!this.nextPageTokenArray.includes(this.nextPageToken)&&this.nextPageTokenArray.push(this.nextPageToken);}groupDocumentArchiveByDate(t){let e={};return t.forEach(i=>
3{let n=this.getDocumentArchiveDate(i),s=this.getDocumentArchiveGroupName(n);e[s]||(e[s]=[]),e[s].push(i);}),e}getDocumentArchiveGroupName(t){return this.dateUtils.formatDate(t,"MMMM yyyy").replace(/\w\S*/g,i=>i[0].toUpperCase()+i.slice(1).toLowerCase())}getDocumentArchiveDate(t){return t.dates.main&&typeof t.dates.main.toDate=="function"?t.dates.main.toDate():Qe(t.dates.main).toDate()}getDocumentArchiveByItems(t){return this.getDocumentArchiveWithHeaders(t)}getDocumentArchivePayloadParams(t){let e={};return t?e.pageToken=t:(e.group=this.filterValues.group.groupCode,this.filterValues.company&&this.filterValues.company.companyId!=="noCompany"&&(e.customerNumber=this.filterValues.company.companyId),this.filterValues.account&&this.filterValues.account.accountId!=="allAccounts"&&(e.account=this.filterValues.account.id),e.fromDate=Qe(this.filterValues.fromDate).format("YYYY-MM-DD"),e.toDate=Qe(this.filterValues.toDate).format("YYYY-MM-DD"),e.pageSize=this.paginationDefaultNumber),e}getDocumentArchiveWithHeaders(t){let e=[];return Object.keys(t).forEach(i=>{e.push({itemType:"header",name:i}),t[i].forEach(n=>{e.push({itemType:"item",id:n.id,date:this.getDocumentArchiveDate(n),type:n.type,reportId:n.reportId,group:n.group,accountIdReference:n.accountIdReference,accountName:this.getAccountName(n),accountNumber:this.getAccountNumber(n),links:n.links});});}),e}getAccountName(t){return t.accountIdReference?this.accountList.find(e=>e.id===t.accountIdReference)?.getName():""}getAccountNumber(t){return t.accountIdReference?this.accountList.find(e=>e.id===t.accountIdReference)?.getNumber():""}createCompanies(){let t=this.groupAccountsByCustomerNumber(),e=this.getCompanies(t);e=this.sortCompanies(e),e.length>0&&this.store.setState(()=>({companies:e}));}groupAccountsByCustomerNumber(){return (0, Zi.groupBy)(this.accountList,t=>t.owner.customerNumber)}getCompanies(t){return Object.entries(t).map(([e,i])=>({name:i[0].owner.name,companyId:i[0].owner.customerNumber,numberOfAccounts:i.length}))}sortCompanies(t){return (0, Zi.sortBy)(t,"name")}handleFetchingDocumentArchiveError(t){return this.resetToInitialState(true),this.showErrorMessage(),mI(()=>t)}showStartEmptyState(t){this.showStartEmptyState$.next(t);}showNoResultsEmptyState(t){this.showNoResultsEmptyState$.next(t);}showNoAccountsEmptyState(t){this.showNoAccountsEmptyState$.next(t);}showSpinner(t){this.showSpinner$.next(t);}handleExportTodPdfAction(){this.store.disableExportButton(true),Promise.all(this.getSelectedDocumentArchiveToExport().map(t=>this.documentArchiveExportService.export(t))).then(()=>{this.store.disableExportButton(false);}).catch(()=>{this.store.disableExportButton(false);});}getSelectedDocumentArchiveToExport(){return this.store.state.rawDocumentArchive.filter(t=>this.store.state.selectedDocumentArchive.some(e=>e===t.id))}resetSelectedDocumentArchive(){this.store.selectAllAction(false);}resetToInitialState(t){this.store.setState(()=>({rawDocumentArchive:[],documentArchive:[],totalCount:0,selectedDocumentArchive:[],isSelectAllChecked:false,isSelectAllIntermediateState:false,isExportButtonDisabled:false})),t?this.showNoResultsEmptyState(true):this.showStartEmptyState(true);}showErrorMessage(){this.documentArchiveLogService.error("DocumentArchiveComponent: Error while getting the document archive","PAGE.DOCUMENT_ARCHIVE.V2.LOAD_ERROR");}setAdminView(){this.dataUserAccessRights.get().pipe(Zt(1),Sf(t=>{this.isAdminView=t.administrator;}),Sa(()=>(this.documentArchiveLogService.error("DocumentArchiveComponent: Error while fetching user permissions","PAGE.DOCUMENT_ARCHIVE.V2.LOAD_ERROR"),hI(false)))).subscribe();}static{this.\u0275fac=function(e){return new(e||o$1)(Do(G),Do(Be),Do(Ct),Do(y),Do(K),Do(h),Do(Oe),Do(o))};}
3static{this.\u0275cmp=qT({type:o$1,selectors:[["cib-document-archive"]],standalone:false,decls:15,vars:19,consts:[[3,"loading","loadAnnouncement"],[3,"showFilter"],["formId","cibDocumentArchiveFiltersPanel",3,"executionSearchButtonClick","executionSearch"],[3,"href"],[3,"notifyLoadMoreDocumentArchive"],["translate",""]],template:function(e,i){e&1&&(mC(0,Ka,5,6,"ebank-lead-block"),Ms(1,"ebank-spinner",0),N_(2,"async"),N_(3,"translate"),Ms(4,"ebank-sidebar-filter",1)(5,"ebank-filter-content",2),qy("executionSearchButtonClick",function(){return i.onSubmit()}),ky(6,"document-archive-filters-panel"),rd(),Ms(7,"ebank-main-content"),mC(8,Qa,1,0,"document-archive-filters-chips"),N_(9,"async"),mC(10,Za,2,1),N_(11,"async"),N_(12,"async"),N_(13,"async"),nd(14,ic,7,7,"ebank-empty-state"),rd()()()),e&2&&(gC(i.isAdminView?0:-1),mb(),Ry("loading",R_(2,7,i.showSpinner$))("loadAnnouncement",R_(3,9,"PAGE.DOCUMENT_ARCHIVE.V2.LOADING")),mb(3),Ry("showFilter",true),mb(),Ry("executionSearch",true),mb(3),gC(R_(9,11,i.showStartEmptyState$)===false?8:-1),mb(2),gC(R_(11,13,i.showStartEmptyState$)===false&&R_(12,15,i.showNoAccountsEmptyState$)===false&&R_(13,17,i.showNoResultsEmptyState$)===false?10:14));},dependencies:[Te,Qs,Ys,X9,Rf,Nf,mg,v6,sN,sB,$i,Wi,qi,Ki,mn,ye,n],encapsulation:2,changeDetection:1});}};function nc(o,t){o&1&&ky(0,"pib-document-archive");}function rc(o,t){o&1&&ky(0,"cib-document-archive");}var Ji=class o{constructor(t){this.context=t;this.isCorporate=this.context.isCorporate;}static{this.\u0275fac=function(e){return new(e||o)(Do(P))};}
3static{this.\u0275cmp=qT({type:o,selectors:[["document-archive-dispatcher"]],standalone:false,decls:2,vars:2,template:function(e,i){e&1&&(mC(0,nc,1,0,"pib-document-archive"),mC(1,rc,1,0,"cib-document-archive")),e&2&&(gC(i.isCorporate?-1:0),mb(),gC(i.isCorporate?1:-1));},dependencies:[Dt,Qi],encapsulation:2,changeDetection:1});}};vM();var ac=[{path:"",component:Fi,data:{name:"document-archive",title:"PAGE.DOCUMENT_ARCHIVE.HEADING"},canActivate:[Pi]},{path:"wad",component:Ji,data:{name:"document-archive-wad",title:"PAGE.DOCUMENT_ARCHIVE.V2.TITLE",ebankuiPage:"large"}}],eo=class o{static{this.\u0275fac=function(e){return new(e||o)};}static{this.\u0275mod=my({type:o});}static{this.\u0275inj=Oc({imports:[aa$1.forChild(ac),aa$1]});}};he();vM();$n();var Bn=class o$1{static{this.\u0275fac=function(e){return new(e||o$1)};}static{this.\u0275mod=my({type:o$1});}static{this.\u0275inj=Oc({providers:[We,K,Ct,y,Oe,A,o],imports:[dn,eo,ii,qt,p,Bn$1,a8,_e,Ga,Ys,we,X9,Rf,Nf,O0,r8,k6,Y3,_8,a6.forRoot({useFactory:t=>({showCounter:({count:e=0,total:i=0})=>t.instant("EBANKUI.CONFIG.LOAD_MORE.SHOW_COUNTER",{count:e,total:i}),loadedAmount:({amount:e})=>t.instant("EBANKUI.CONFIG.LOAD_MORE.LOADED_AMOUNT",{amount:e})}),deps:[V]}),Ro,fN,Cu,a8,Bn$1,K6,Vs,yI,i8,sB,t,Dt]});}};w_(ft,function(){return [p$3,Bn$1,a8,Ci,Ei]},function(){return [Tn]});export{Bn as DocumentArchiveModule};

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.