1import {I}from'./chunk-CmH7r0y7.js';import {o as o$1}from'./chunk-DsobRbkC.js';import {p as p$2}from'./chunk-ChU91JJL.js';import {X as X$1,e as ee}from'./chunk-Dfyns7Wc.js';import'./chunk-lrEbxK91.js';import {y}from'./chunk-3h9VR88y.js';import {p}from'./chunk-B2qlGaqX.js';import {o}from'./chunk-Cco1Crmt.js';import {G,r,j as j$1,C}from'./chunk-CWBrHG4i.js';import {g as g$1}from'./chunk-B8kH3X4V.js';import'./chunk-CSiN8rSO.js';import {n as n$1,x,b,p as p$1,d as l,z as z$1,e as l$1,B}from'./chunk-SDcs1xql.js';import {x as my,O as Oc,b3 as ii,bb as xu,F as we,en as Vs,eB as Wa,eC as W6,bx as Ro,bh as _e$1,bl as Ga,bz as Nf,bA as Rf,bB as X9,bG as sB,eD as O0,d3 as r8,el as k6,e3 as Bn,bj as Cu,em as Y3,eE as _8,e5 as a8,dL as yI,dM as i8,cN as u,eF as a6,V,ak as aa,bn as ne$1,bm as br,X,dz as E,t as de,bI as Qe,cj as H,ci as CI,w as we$1,_ as _f,n as hI,L as Do$1,aS as V$1,b6 as K$1,d as E$2,E as E$3,eG as c,P as qT,cF as eR,cG as yi,cH as co$1,cI as Ch,d_ as ea,cK as Ei,cL as Ml,cM as j,br as Te,aB as g,cX as X3,c_ as fu,bu as mn,eH as Sn,a2 as ye,a3 as Ms,a4 as ky,aM as N_,a6 as mC,a5 as rd,aa as mb,a8 as Ry,bv as R_,ab as gC,cP as Qy,cQ as FC,cR as jC,ck as P,cD as Xo,e as ep,bo as Mf,ad as c_,b_,aN as cd,aO as k_,b$ as T_,T as dn,eI as Tn,bK as p$3,bX as s,df as uD,cp as ct,eJ as nR,eK as iR,eL as Eh,cJ as fh,aL as RC,c1 as CC,di as pv,c2 as qy,d6 as tT,dk as fv,d7 as nT,eM as Sf,j as Sa,m as mI,bL as h,M as S$1,bM as Ys$1,cO as nd,f as Vn,ev as mg,ew as v6,ey as sN,D,dP as QT,bY as IC,dR as vC,bZ as EC,ei as O_,ba as cv,eN as M_,bH as PO,bJ as VO,bP as og,bQ as TO,bR as X8,bS as Z8,eO as J8,bT as hi,bU as ig,ez as q8,eP as o6,cl as A,eq as Cf,eQ as j$,eR as oR,d5 as No,d4 as vI,cY as uo$1,cZ as Nl,eS as Cr,c$ as Pa,d0 as gu,d1 as on,d2 as sI,eu as f8,eo as QI,c3 as HC,d$ as yn,e0 as vn,a7 as ev,dc as Y9,bw as m_,eT as Ay,eU as G6,eV as pC,a9 as C_,eW as Q8,eX as OC,eY as PC,$ as $N,h as he$1,dC as q,v as vM,dD as G$1,dV as vc,eZ as Z,W,N as N$1,J as da$1,cm as J,p as pi,c5 as Be,K as j$3,cn as X$2,b as $n,c4 as Fh,be as na,dA as J$1,dW as os,e_ as l$2,c6 as yh,c7 as vh,dX as lg,dj as f_,c0 as wy,dQ as
1L_,cA as sd,cB as Qs$1}from'./chunk-hxK0xzc4.js';import {S,F,E as E$1,N}from'./main-UKM7BIED.js';import {i as qt,k as n,l as L,d,c as m,p as i,m as m$1,j as j$2,T as Tt}from'./chunk-BdMK6VUw.js';import'./chunk-Ck4AodjT.js';import'./chunk-DROiOONM.js';import'./chunk-D1g3129g.js';$N();he$1();q();vM();G$1();vc();Z();var ge=class n extends E{constructor(t,a,i){super();this.dsObservable=t;this.DS=a;this.refreshService=i;this.dsNames=["bankMessages"];}fetch(t){return t?this.DS.findAll("bankMessages",t):this.DS.findAll("bankMessages")}fromCache(){return this.DS.getAll("bankMessages")}deleteBankMessage(t){return this.DS.destroy("bankMessages",t).then(a=>(this.refreshService.refreshResource("bankMessageCount"),a))}updateBankMessage(t,a){return this.DS.get("bankMessages",t).update(a).then(i=>(this.refreshService.refreshResource("bankMessageCount"),i))}updateBankMessageStatusInCache(t,a){let i=this.DS.get("bankMessages",t);i&&(i.status=a);}clearCache(){return this.DS.ejectAll("bankMessages")}static{this.\u0275fac=function(a){return new(a||n)(de(J$1),de(os),de(l$2))};}static{this.\u0275prov=X({token:n,factory:n.\u0275fac,providedIn:"root"});}};var _i=N(j$1());vM();vM();W();N$1();he$1();var ue=class n{constructor(e,t,a){this.log=e;this.alert=t;this.translateService=a;}error(e,t,a){a&&this.alert.error(this.translateService.instant(a)),this.log.error(`${e}: ${t}`);}static{this.\u0275fac=function(t){return new(t||n)(de(E$2),de(E$3),de(V))};}static{this.\u0275prov=X({token:n,factory:n.\u0275fac,providedIn:"any"});}};he$1();var st=class n{constructor(e,t){this.bankMessagesLogService=e;this.translateService=t;}export(e){return S(this,null,function*(){let t=yield e?.exportDocumentToPdf();this.processAndDownload(t,e?.id);})}processAndDownload(e,t){try{if(!(e?.content||e?.contentDisposition))throw new Error("error");this.saveAs(e.content,t);}catch(a){this.onError(t);}}saveAs(e,t){let a=`${this.translateService.instant("PAGE.BANK_MESSAGES.V2.DOCUMENT",{id:t})}.pdf`;(0, _i.saveAs)(e,a);}onError(e){this.bankMessagesLogService.error("CibBankMessagesMainComponent: Error while exporting document archive item",e,"PAGE.BANK_MESSAGES.V2.EXPORT.ERROR");}static{this.\u0275fac=function(t){return new(t||n)(de(ue),de(V))};}static{this.\u0275prov=X({token:n,factory:n.\u0275fac,providedIn:"any"});}};vM();da$1();var ot=class n extends o{constructor(e,{config:t}){super(e,t);}static{this.\u0275fac=function(t){return new(t||n)(de(V$1),de(r))};}static{this.\u0275prov=X({token:n,factory:n.\u0275fac,providedIn:"root"});}};da$1();vM();J();var pa=N(ep());pi();var Re=(t=>(t.Header="header",t.Item="item",t))(Re||{}),_e=(a=>(a.read="read",a.unread="unread",a.delete="delete",a))(_e||{});Be();vM();he$1();N$1();j$3();$N();vM();$N();vM();he$1();$N();Be();vM();$N();function Vi(n,e){if(n&1&&ky(0,"ebank-template-email-thumbnail",0),n&2){let t=RC();Ry("thumbnailType",t.thumbnailType)("hasBeenRead",t.bankMessageTemplateInfo.hasBeenRead)("receivedDate",t.bankMessageTemplateInfo.receivedDate)("subject",t.bankMessageTemplateInfo.subject)("from",t.bankMessageTemplateInfo.accountInfo);}}var rt=class n{constructor(e){this.accountNumberFormatPipe=e;this.thumbnailType="thumbnail";}set bankMessage(e){e&&this.transformMessage(e);}transformMessage(e){this.bankMessageTemplateInfo={hasBeenRead:e.status==="read",receivedDate:Qe(e.date).format("DD.MM.YYYY"),subject:e.descriptionShort,accountInfo:this.getAccountInfo(e)};}getAccountInfo(e){if(e.accountName&&e.accountNumber)return e.accountName+" - "+this.accountNumberFormatPipe.transform(e.accountNumber);if(!e.accountName&&e.accountNumber)return this.accountNumberFormatPipe.transform(e.accountNumber)}static{this.\u0275fac=function(t){return new(t||n)(Do$1(p$3))};}
1static{this.\u0275cmp=qT({type:n,selectors:[["bank-messages-template"]],inputs:{bankMessage:"bankMessage"},standalone:false,decls:1,vars:1,consts:[[3,"thumbnailType","hasBeenRead","receivedDate","subject","from"]],template:function(t,a){t&1&&mC(0,Vi,1,5,"ebank-template-email-thumbnail",0),t&2&&gC(a.bankMessageTemplateInfo?0:-1);},dependencies:[G6],encapsulation:2,changeDetection:1});}};function ji(n,e){if(n&1&&(Ms(0,"ebank-section-header-panel"),c_(1),rd()),n&2){let t=RC(2).$index,a=RC(2);mb(),cv(a.paginatedBankMessages[t].name);}}function Ui(n,e){n&1&&wy(0,ji,2,1,"ebank-section-header-panel",3);}function Ki(n,e){if(n&1){let t=CC();Ms(0,"li")(1,"ebank-button",7),qy("buttonClick",function(){yh(t);let i=RC(3).$index,s=RC(2);return vh(s.onMarkAsReadClicked(s.paginatedBankMessages[i]))}),c_(2),N_(3,"translate"),rd()();}n&2&&(mb(2),cd(" ",R_(3,1,"PAGE.BANK_MESSAGES.V2.MARK_AS_READ")," "));}function $i(n,e){if(n&1){let t=CC();Ms(0,"ebank-expandable-panel")(1,"ebank-expandable-panel-header"),ky(2,"bank-messages-template",4),rd(),Ms(3,"ebank-expandable-panel-content")(4,"ebank-expandable-panel-menu-row")(5,"li")(6,"ebank-button",5),N_(7,"translate"),qy("buttonClick",function(){yh(t);let i=RC(2).$index,s=RC(2);return vh(s.onShowMessageClicked(s.paginatedBankMessages[i]))}),c_(8),N_(9,"translate"),rd()(),mC(10,Ki,4,3,"li"),Ms(11,"li")(12,"ebank-button",6),qy("buttonClick",function(){yh(t);let i=RC(2).$index,s=RC(2);return vh(s.onDeleteClicked(s.paginatedBankMessages[i].id))}),c_(13),N_(14,"translate"),rd()()()()();}if(n&2){let t=RC(2).$index,a=RC(2);mb(2),Ry("bankMessage",a.paginatedBankMessages[t]),mb(4),Ry("altTextFunctionalIcon",m_(R_(7,7,"EBANKUI.CONFIG.EXTERNAL.LINK")))("useAsLink",true),mb(2),cd(" ",R_(9,9,"PAGE.BANK_MESSAGES.V2.SHOW_MESSAGE")," "),mb(2),gC(a.paginatedBankMessages[t].status==="unread"?10:-1),mb(3),cd(" ",R_(14,11,"PAGE.BANK_MESSAGES.V2.DELETE")," ");}}function Yi(n,e){n&1&&wy(0,$i,15,13,"ebank-expandable-panel",3);}function Hi(n,e){if(n&1&&(mC(0,Ui,1,0,"ebank-section-header-panel"),mC(1,Yi,1,0,"ebank-expandable-panel")),n&2){let t=e.$index,a=RC(2);gC(a.paginatedBankMessages[t].itemType===a.ItemType.Header?0:-1),mb(),gC(a.paginatedBankMessages[t].itemType===a.ItemType.Item?1:-1);}}function Wi(n,e){if(n&1){let t=CC();Ms(0,"ebank-load-more",1),qy("slicedList",function(i){yh(t);let s=RC();return vh(s.paginatedBankMessages=i)}),Ms(1,"ebank-panel-list",2)(2,"ebank-expandable-panel-container"),IC(3,Hi,2,2,null,null,pC().trackByBankMessageId,true),rd()()();}if(n&2){let t=RC();Ry("list",t.bankMessages)("isDataItem",t.isDataItem)("totalDataItemCount",t.totalDataItemCount)("counter",t.counter.bind(t))("loaded",t.customLoader.bind(t))("buttonText",t.loadMoreButtonText)("config",t.loadMoreInitConfig),mb(3),EC(t.paginatedBankMessages);}}var ra=class n{constructor(e,t,a){this.translateService=e;this.forwardLinkService=t;this.dialog=a;this.markAsRead=new ct;this.delete=new ct;this.totalDataItemCount=0;this.loadMoreButtonText=this.translateService.instant("PAGE.BANK_MESSAGES.V2.LOAD_MORE.BUTTON.LABEL");this.loadMoreInitConfig={initialLoad:50,increment:50};this.ItemType=Re;}set setBankMessages(e){e&&(this.bankMessages=e,this.totalDataItemCount=this.getTotalDataItems());}isDataItem(e){return e.itemType!=="header"}counter(e){return this.translateService.instant("PAGE.BANK_MESSAGES.V2.SHOWING",{count:e.count,total:e.total})}customLoader(e){return this.translateService.instant("PAGE.BANK_MESSAGES.V2.CUSTOM_LOADER",{amount:e.amount})}trackByBankMessageId(e,t){return t.id}onShowMessageClicked(e){this.openBankMessage(e),e.status==="unread"&&this.onMarkAsReadClicked(e);}onMarkAsReadClicked(e){this.markAsRead.emit(e);}onDeleteClicked(e){this.showConfirmationModal(e);}getTotalDataItems(){return this.totalItems?this.totalItems:this.bankMessages.reduce((e,t)=>t.itemType==="header"?e:e+1,0)}openBankMessage(e){return S(this,null,function*(){yield this.forwardLinkService.openApiV4(e.links.document.href);})}showConfirmationModal(e){this.modalRef=this.dialog.open(PO,{data:this.createDeleteBankMessagesModalData(e)});}createDeleteBankMessagesModalData(e){return {title:this.translateService.instant("PAGE.BANK_MESSAGES.V2.DELETE_MODAL.TITLE"),content:this.translateService.instant("PAGE.BANK_MESSAGES.V2.DELETE_MODAL.CONTENT"),actionButtonText:this.translateService.instant("PAGE.BANK_MESSAGES.V2.DELETE_MODAL.ACTION_BUTTON"),actionButtonStyle:"primary-danger",cancelButtonText:this.translateService.instant("PAGE.BANK_MESSAGES.V2.DELETE_MODAL.CANSEL_BUTTON"),action:()=>{this.delete.emit(e),this.modalRef.close();},cancel:()=>{this.modalRef.close();}}}static{this.\u0275fac=function(t){return new(t||n)(Do$1(V),Do$1(x),Do$1(VO))};}
1static{this.\u0275cmp=qT({type:n,selectors:[["bank-messages-items"]],inputs:{setBankMessages:"setBankMessages"},outputs:{markAsRead:"markAsRead",delete:"delete"},standalone:false,decls:1,vars:1,consts:[[3,"list","isDataItem","totalDataItemCount","counter","loaded","buttonText","config"],[3,"slicedList","list","isDataItem","totalDataItemCount","counter","loaded","buttonText","config"],["groupHeadingId","bank-messages-heading-id"],[4,"ebankPanelList"],[3,"bankMessage"],["buttonStyle","secondary","size","s","iconType","external",3,"buttonClick","useAsLink","altTextFunctionalIcon"],["size","s","buttonStyle","tertiary-danger",3,"buttonClick"],["size","s","buttonStyle","tertiary",3,"buttonClick"]],template:function(t,a){t&1&&mC(0,Wi,5,7,"ebank-load-more",0),t&2&&gC(a.bankMessages?.length?0:-1);},dependencies:[og,TO,X8,Z8,J8,hi,ig,q8,_e$1,o6,rt,ye],encapsulation:2,changeDetection:1});}};vM();X$2();vM();he$1();$N();function zi(n,e){if(n&1&&(Ms(0,"a",1),N_(1,"translate"),Ms(2,"span",0),c_(3,"PAGE.BANK_MESSAGES.V2.DOCUMENT_ARCHIVE_LINK"),rd()()),n&2){let t=RC();Ry("href",m_(R_(1,2,t.documentArchiveLink)),lg);}}function Qi(n,e){n&1&&(Ms(0,"span",0),c_(1,"PAGE.BANK_MESSAGES.V2.DOCUMENT_ARCHIVE_LINK"),rd());}var ca=class n{constructor(){this.bankMessagesConfigService=D(r);this.urlService=D(A);this.hasDocumentArchiveLink=this.bankMessagesConfigService.config.hasDocumentArchiveLink;this.documentArchiveLink=this.urlService.getUrl("URL.PAGE.DOCUMENTARCHIVE");}static{this.\u0275fac=function(t){return new(t||n)};}
1static{this.\u0275cmp=qT({type:n,selectors:[["bank-messages-info"]],standalone:false,decls:11,vars:1,consts:[["translate",""],[1,"ebank-text-link",3,"href"]],template:function(t,a){t&1&&(Ms(0,"ebank-lead-block")(1,"div")(2,"span",0),c_(3,"PAGE.BANK_MESSAGES.V2.LEAD_TEXT_LINE_1"),rd(),Ms(4,"span",0),c_(5,"PAGE.BANK_MESSAGES.V2.LEAD_TEXT_LINE_2_1 "),mC(6,zi,4,4,"a",1)(7,Qi,2,0,"span",0),Ms(8,"span",0),c_(9,"PAGE.BANK_MESSAGES.V2.LEAD_TEXT_SEPARATOR_SIGN"),rd(),c_(10," PAGE.BANK_MESSAGES.V2.LEAD_TEXT_LINE_2_2 "),rd()()()),t&2&&(mb(6),gC(a.hasDocumentArchiveLink?6:7));},dependencies:[Te,sB,ye],encapsulation:2,changeDetection:1});}};vM();vM();he$1();$N();var la=class n{constructor(e){this.translateService=e;this.sortingChanged=new ct;this.sortingOptions=[this.translateService.instant("PAGE.BANK_MESSAGES.V2.SORTING_DATE_NEWEST"),this.translateService.instant("PAGE.BANK_MESSAGES.V2.SORTING_DATE_OLDEST")];this.sortingButtonText=this.translateService.instant("PAGE.BANK_MESSAGES.V2.SORTING_DATE_NEWEST");}onSortingOptionSelected(e){this.sortingButtonText!==e&&(this.changeSortingButtonText(e),this.notifySortingChanged(e));}changeSortingButtonText(e){this.sortingButtonText=e.toString();}notifySortingChanged(e){this.sortingChanged.emit(e);}static{this.\u0275fac=function(t){return new(t||n)(Do$1(V))};}
1static{this.\u0275cmp=qT({type:n,selectors:[["bank-messages-sorting"]],outputs:{sortingChanged:"sortingChanged"},standalone:false,decls:2,vars:3,consts:[[3,"optionSelected","options","size"]],template:function(t,a){t&1&&(Ms(0,"ebank-dropdown-button",0),qy("optionSelected",function(s){return a.onSortingOptionSelected(s)}),c_(1),rd()),t&2&&(Ry("options",a.sortingOptions)("size","s"),mb(),cd(" ",a.sortingButtonText,` 2`));},dependencies:[Wa],encapsulation:2,changeDetection:1});}};$n();function as(n,e){if(n&1){let t=CC();Ms(0,"bank-messages-sorting",2),qy("sortingChanged",function(i){yh(t);let s=RC();return vh(s.onSortingChanged(i))}),rd(),Ms(1,"bank-messages-items",3),N_(2,"async"),qy("markAsRead",function(i){yh(t);let s=RC();return vh(s.onMarkAsReadClicked(i))})("delete",function(i){yh(t);let s=RC();return vh(s.onDeleteClicked(i))}),rd();}if(n&2){let t=RC();mb(),Ry("setBankMessages",R_(2,1,t.bankMessages$));}}function ns(n,e){n&1&&(Ms(0,"ebank-empty-state-description"),c_(1),N_(2,"translate"),rd()),n&2&&(mb(),cd(" ",R_(2,1,"PAGE.BANK_MESSAGES.V2.NO_ACCOUNTS")," "));}function is(n,e){n&1&&(Ms(0,"ebank-empty-state-description"),c_(1),N_(2,"translate"),rd()),n&2&&(mb(),cd(" ",R_(2,1,"PAGE.BANK_MESSAGES.V2.LIST_EMPTY")," "));}function ss(n,e){if(n&1&&(Ms(0,"ebank-empty-state"),mC(1,ns,3,3,"ebank-empty-state-description"),N_(2,"async"),mC(3,is,3,3,"ebank-empty-state-description"),N_(4,"async"),rd()),n&2){let t=RC();mb(),gC(R_(2,2,t.showNoAccountsEmptyState$)?1:-1),mb(2),gC(R_(4,4,t.showNoMessagesEmptyState$)?3:-1);}}var ma=class n{constructor(e,t,a,i,s,E,P){this.bankMessagesService=e;this.bankMessagesLogService=t;this.dateUtils=a;this.dataAccounts=i;this.translateService=s;this.alert=E;this.routerDataService=P;this.bankMessages$=hI([]);this.showSpinner$=new br(true);this.showNoMessagesEmptyState$=new br(false);this.showNoAccountsEmptyState$=new br(false);this.sortingOption="desc";}ngOnInit(){this.changePageSize(),this.loadData();}onSortingChanged(e){e===this.translateService.instant("PAGE.BANK_MESSAGES.V2.SORTING_DATE_NEWEST")&&this.changeBankMessagesSorting("desc"),e===this.translateService.instant("PAGE.BANK_MESSAGES.V2.SORTING_DATE_OLDEST")&&this.changeBankMessagesSorting("asc");}onMarkAsReadClicked(e){let t=this.prepareBankMessageForUpdate(e);this.updateBankMessage(t);}onDeleteClicked(e){this.storeLastRemovedBankMessage(e),this.removeBankMessageFromList(e),this.prepareBankMessages(this.rawBankMessages),this.deleteBankMessage(e);}changePageSize(){this.routerDataService.addData({ebankuiPage:"half"},{overrideDataOnRouteChange:false});}loadData(){this.bankMessages$=CI([this.dataAccounts.get(),this.bankMessagesService.get()]).pipe(we$1(e=>this.handleData(e[0],e[1])),we$1(e=>this.groupBankMessagesByDate(e,"desc")),we$1(e=>this.getBankMessagesByItems(e)),Sf(()=>this.showSpinner(false)),Sa(e=>this.handleFetchingBankMessagesError(e)));}handleData(e,t){return this.checkAccountAccessPermission(e),this.checkNumberOfMessages(t),this.storeBankMessages(t),this.storeAccounts(e),t}checkAccountAccessPermission(e){let t=this.filterAccountsByAccessPermission(e);e&&e.length&&!t.length&&this.showNoAccountsEmptyState(true);}filterAccountsByAccessPermission(e){return e.filter(t=>t.rights&&t.rights.accessPermission)}groupBankMessagesByDate(e,t){let a={};return (0, pa.orderBy)(e,s=>s.date,[t]).forEach(s=>{let E=this.getBankMessagesGroupName(new Date(s.date.toDate()));a[E]||(a[E]=[]),a[E].push(s);}),a}getBankMessagesGroupName(e){return this.dateUtils.formatDate(e,"MMMM yyyy").replace(/\w\S*/g,a=>a[0].toUpperCase()+a.slice(1).toLowerCase())}getBankMessagesByItems(e){let t=[];return Object.keys(e).forEach(a=>{t.push({itemType:"header",name:a}),e[a].forEach(i=>{t.push({itemType:"item",path:"",id:i.id,status:i.status,date:i.date.toDate(),descriptionShort:i.descriptionShort,accountName:this.getAccountName(i),accountNumber:this.getAccountNumber(i),links:i.links});});}),t}handleFetchingBankMessagesError(e){return this.errorMessages(e.statusText,"BankMessagesComponent: Error while getting the bank messages","PAGE.BANK_MESSAGES.V2.ERROR"),this.showSpinner(false),mI(()=>e)}errorMessages(e,t,a){this.bankMessagesLogService.error(t,e,a);}showSpinner(e){this.showSpinner$.next(e);}checkNumberOfMessages(e){e.length===0&&this.showNoMessagesEmptyState(true);}showNoMessagesEmptyState(e){this.showNoMessagesEmptyState$.next(e);}showNoAccountsEmptyState(e){this.showNoAccountsEmptyState$.next(e);}storeBankMessages(e){this.rawBankMessages=e;}storeAccounts(e){this.accountList=e;}changeBankMessagesSorting(e){this.storeSortingOption(e),this.prepareBankMessages(this.rawBankMessages);}storeSortingOption(e){this.sortingOption=e;}updateBankMessage(e){let t=this.changeBankMessageStatus(e,"read");this.bankMessagesService.updateBankMessage(e.id,t).then(()=>{this.bankMessagesService.updateBankMessageStatusInCache(e.id,"read"),this.overrideRawBankMessageDate(e.id);}).catch(a=>{this.handleUpdatingBankMessageError(a),this.changeBankMessageStatus(e,"unread");});}handleUpdatingBankMessageError(e){this.errorMessages(e.statusText,"BankMessagesMainComponent: Error while marking the bank message as read","PAGE.BANK_MESSAGES.V2.MARK_AS_READ.ERROR");}changeBankMessageStatus(e,t){let a;return this.rawBankMessages=this.rawBankMessages.map(i=>(i.id===e.id&&(i.status=t,a=i),i)),this.prepareBankMessages(this.rawBankMessages),a}prepareBankMessages(e){let t=this.groupBankMessagesByDate(e,this.sortingOption);this.bankMessages$=hI(this.getBankMessagesByItems(t));}removeBankMessageFromList(e){this.rawBankMessages=this.rawBankMessages.filter(t=>t.id!==e);}deleteBankMessage(e){this.bankMessagesService.deleteBankMessage(e).then(()=>this.showDeletionSuccessMessage()).catch(t=>{this.restoreLastRemovedBankMessages(),this.handleDeletingBankMessageError(t);});}handleDeletingBankMessageError(e){this.errorMessages(e.statusText,"BankMessagesMainComponent: Error while deleting message","PAGE.BANK_MESSAGES.V2.DELETE.ERROR");}prepareBankMessageForUpdate(e){let t=(0, pa.clone)(e);return delete t.links,delete t._id,t}storeLastRemovedBankMessage(e){this.lastRemovedBankMessages=this.rawBankMessages.filter(t=>t.id===e)[0];}restoreLastRemovedBankMessages(){this.rawBankMessages.push(this.lastRemovedBankMessages),this.prepareBankMessages(this.rawBankMessages);}showDeletionSuccessMessage(){this.alert.success(this.translateService.instant("PAGE.BANK_MESSAGES.V2.DELETE.SUCCESS"));}overrideRawBankMessageDate(e){this.rawBankMessages.map(t=>{t.id===e&&(t.date=Qe(t.date));});}getAccountName(e){return e.accountIdReference?this.accountList.find(t=>
2t.id===e.accountIdReference)?.getName():""}getAccountNumber(e){let t="";return e.accountIdReference&&(t=this.accountList.find(a=>a.id===e.accountIdReference)?.getNumber()),!t&&e.accountNumber&&(t=e.accountNumber),t}static{this.\u0275fac=function(t){return new(t||n)(Do$1(ge),Do$1(ue),Do$1(h),Do$1(G),Do$1(V),Do$1(E$3),Do$1(S$1))};}static{this.\u0275cmp=qT({type:n,selectors:[["pib-bank-messages"]],standalone:false,decls:9,vars:11,consts:[[1,"page-bank-messages-v2"],[3,"loading","loadAnnouncement"],[3,"sortingChanged"],[3,"markAsRead","delete","setBankMessages"]],template:function(t,a){t&1&&(Ms(0,"div",0),ky(1,"bank-messages-info"),Ms(2,"ebank-spinner",1),N_(3,"async"),N_(4,"translate"),mC(5,as,3,3),N_(6,"async"),N_(7,"async"),nd(8,ss,5,6,"ebank-empty-state"),rd()()),t&2&&(mb(2),Ry("loading",R_(3,3,a.showSpinner$))("loadAnnouncement",R_(4,5,"PAGE.BANK_MESSAGES.V2.LOADING")),mb(3),gC(R_(6,7,a.showNoMessagesEmptyState$)===false&&R_(7,9,a.showNoAccountsEmptyState$)===false?5:8));},dependencies:[Ys$1,Nf,X9,ra,ca,la,mn,ye],encapsulation:2,changeDetection:1});}};var ae=N(ep());pi();var Ra=(t=>(t.upLeft="name",t.downLeft="accountsText",t))(Ra||{});Be();vM();q();vM();G$1();vc();Z();var da=class n extends E{constructor(t,a,i){super();this.dsObservable=t;this.DS=a;this.refreshService=i;this.dsNames=["bankMessages"];}fetch(t){return S(this,null,function*(){let a,i=(H,ve)=>{a=ve;};this.DS.definitions.bankMessages.on("ROB.hasMoreElements",i);let s,E=(H,ve)=>{s=ve;};return this.DS.definitions.bankMessages.on("ROB.hasLinks",E),{bankMessages:yield this.DS.findAll("bankMessages",t,{bypassCache:true}),next:a,links:s}})}fromCache(t,a){return {bankMessages:this.DS.getAll("bankMessages"),next:a.next,links:a.links}}deleteBankMessage(t){return this.DS.destroy("bankMessages",t).then(a=>(this.refreshService.refreshResource("bankMessageCount"),a))}updateBankMessage(t,a){let i=(s,E)=>{let P=this.DS.get("bankMessages",s);P&&(P.status=E);};return this.DS.get("bankMessages",t).update(a).then(s=>(i(t,_e[a.status]),s))}updateMoreBankMessages(t){let a=t.map(i=>this.DS.get("bankMessages",i.messageId));return this.DS.updateAll("bankMessages",t,null,{cacheResponse:false}).then(i=>(t.forEach(s=>{if(s.status!=="delete"){let E=a.find(P=>P.id===s.messageId);E.status=s.status,this.DS.inject("bankMessages",E);}}),i))}clearCache(){return this.DS.ejectAll("bankMessages")}static{this.\u0275fac=function(a){return new(a||n)(de(J$1),de(os),de(l$2))};}static{this.\u0275prov=X({token:n,factory:n.\u0275fac,providedIn:"root"});}};pi();pi();vM();var ga=class n{constructor(e){this._state=new br(e);}get state$(){return this._state.asObservable()}get state(){return this._state.getValue()}setState(e){let t=e(this.state);this._state.next(E$1(E$1({},this.state),t));}select(e){return this.state$.pipe(we$1(e),Xo())}static{this.\u0275fac=function(t){return new(t||n)(de("initialState"))};}static{this.\u0275prov=X({token:n,factory:n.\u0275fac,providedIn:"root"});}};vM();var ls={sortingName:"PAGE.BANK_MESSAGES.V2.SORTING.DATE_DESCENDING",sortingType:"date",sortingOrder:"descending"},Di={rawBankMessages:[],bankMessages:[],accounts:[],companies:[],filters:{companies:[],fromDate:"",toDate:""},totalCount:0,isFilterFormValid:true,isSelectMoreEnabled:false,selectedSorting:ls,lastRemovedMessages:null,isSelectAllChecked:null,isSelectAllIntermediateState:false,selectedBankMessages:[],isChooseActionButtonDisabled:true},K=class n extends ga{constructor(){super(Di);this.resetFiltersSubject$=new ne$1;this.removeFilterChipsSubject$=new ne$1;this.sortingSubject$=new br(Di.selectedSorting);this.showResultSubject$=new ne$1;this.performDocumentsSearchSubject$=new ne$1;this.showMessageSubject$=new ne$1;this.markAsReadSubject$=new ne$1;this.markAsUnreadSubject$=new ne$1;this.deleteMessageSubject$=new ne$1;this.turnOnOffSelectMoreSubject$=new ne$1;this.selectAllSubject$=new ne$1;this.markAsReadChooseActionSubject$=new ne$1;this.markAsUnreadChooseActionSubject$=new ne$1;this.deleteChooseActionSubject$=new ne$1;this.exportToPdfChooseActionSubject$=new ne$1;this.enableMultipleSelectionSubject$=new ne$1;this.resetFiltersButtonClicked$=this.resetFiltersSubject$.asObservable();this.removeFilterChipsClicked$=this.removeFilterChipsSubject$.asObservable();this.sortingClicked$=this.sortingSubject$.asObservable();this.showResultClicked$=this.showResultSubject$.asObservable();this.performDocumentSearch$=this.performDocumentsSearchSubject$.asObservable();this.showMessageClicked$=this.showMessageSubject$.asObservable();this.markAsReadClicked$=this.markAsReadSubject$.asObservable();this.markAsUnreadClicked$=this.markAsUnreadSubject$.asObservable();this.deleteMessageClicked$=this.deleteMessageSubject$.asObservable();this.turnOnOffSelectMoreClicked$=this.turnOnOffSelectMoreSubject$.asObservable();this.selectAllClicked$=this.selectAllSubject$.asObservable();this.markAsReadChooseActionClicked$=this.markAsReadChooseActionSubject$.asObservable();this.markAsUnreadChooseActionClicked$=this.markAsUnreadChooseActionSubject$.asObservable();this.deleteChooseActionClicked$=this.deleteChooseActionSubject$.asObservable();this.exportToPdfChooseActionClicked$=this.exportToPdfChooseActionSubject$.asObservable();this.enableMultipleSelection$=this.enableMultipleSelectionSubject$.asObservable();}resetFiltersAction(t){this.resetFiltersSubject$.next(t);}removeFilterChipsAction(t){this.removeFilterChipsSubject$.next(t);}sortingSelectedAction(t){this.sortingSubject$.next(t);}showResultClicked(){this.showResultSubject$.next({});}performDocumentSearch(t){this.performDocumentsSearchSubject$.next(t);}showMessageAction(t){this.showMessageSubject$.next(t);}markAsReadAction(t){this.markAsReadSubject$.next(t);}markAsUnreadAction(t){this.markAsUnreadSubject$.next(t);}deleteMessageAction(t){this.deleteMessageSubject$.next(t);}turnOnOffSelectMoreAction(t){this.turnOnOffSelectMoreSubject$.next(t);}selectAllAction(t){t===false&&this.setState(()=>({isSelectAllIntermediateState:false,isSelectAllChecked:false,selectedBankMessages:[]})),this.selectAllSubject$.next(t);}markAsReadChooseAction(){this.markAsReadChooseActionSubject$.next({});}markAsUnreadChooseAction(){this.markAsUnreadChooseActionSubject$.next({});}deleteChooseAction(){this.deleteChooseActionSubject$.next({});}enableMultipleSelectionAction(t){this.enableMultipleSelectionSubject$.next(t);}exportToPdfChooseAction(){this.exportToPdfChooseActionSubject$.next({});}static{this.\u0275fac=function(a){return new(a||n)};}static{this.\u0275prov=X({token:n,factory:n.\u0275fac,providedIn:"root"});}};j$3();Be();vM();var he=class n{getCurrentDate(){return Qe().startOf("day").toDate()}getFormattedDateFromDate(e,t){return typeof t<"u"?Qe(e).format(t):Qe(e).toDate()}getMonthAgoDate(e){return Qe(e).subtract(1,"months").toDate()}getSixMonthsAgoDate(e){return Qe(e).subtract(6,"months").toDate()}static{this.\u0275fac=function(t){return new(t||n)};}static{this.\u0275prov=X({token:n,factory:n.\u0275fac,providedIn:"any"});}};he$1();N$1();$N();pi();Fh();var Ka=N(ep());vM();na();he$1();var ja=N(ep());Be();vM();var ua=class n{constructor(e){this.bankMessagesConfigService=e;}customDatesValidator(){return e=>{let t=e.get("fromDate"),a=e.get("toDate"),i=Qe(),s=Qe().subtract(1,"day").diff(Qe(t.value),"month"),E={};this.resetControls([t,a]),E=this.checkDatesValidation(E,t,a,i,s),this.setValidations(E,e);}}checkDatesValidation(e,t,a,i,s){return (0, ja.isDate)(t.value)||(e.fromDate="invalidDate"),(0, ja.isDate)(a.value)||(e.toDate="invalidDate"),Qe(t.value)>i&&(e.fromDate="invalidFutureDate"),Qe(a.value)>i&&(e.toDate="invalidFutureDate"),s>=6&&t.dirty&&!this.bankMessagesConfigService.config.enableLongPeriodDatesSearch&&(e.fromDate="datesExceedSixMonths"),s>=6&&a.dirty&&!this.bankMessagesConfigService.config.enableLongPeriodDatesSearch&&(e.toDate="datesExceedSixMonths"),Qe(t.value).isAfter(Qe(a.value))&&t.dirty&&(e.fromDate="fromDateAfterToDate"),Qe(a.value).isBefore(Qe(t.value))&&a.dirty&&(e.toDate="toDateBeforeFromDate"),e}setValidations(e,t){let a=Object.entries(e);if(a.length>0){let i=a[0][0],s=a[0][1];t.get(i).setErrors({[s]:true}),t.get(i).markAsTouched(),t.get(i).markAsDirty();}}resetControls(e){e.forEach(t=>t.setErrors(null));}static{this.\u0275fac=function(t){return new(t||n)(de(r))};}static{this.\u0275prov=X({token:n,factory:n.\u0275fac,providedIn:"any"});}};$N();var ps=()=>["name","numberOfAccounts"];function ds(n,e){if(n&1&&(Ms(0,"div",17)(1,"div",18)(2,"div",19),c_(3),rd(),Ms(4,"div",20),c_(5),rd()()()),n&2){let t=RC(2);mb(3),cv(t.companyLabel),mb(2),cv(t.numberOfSelectedOptions);}}function gs(n,e){if(n&1&&(Ms(0,"ebank-form-field")(1,"ebank-label",6),c_(2,"PAGE.BANK_MESSAGES.V2.COMPANY"),rd(),Ms(3,"ebank-simple-selector",14,2),ky(5,"ebank-option-template",15),rd(),tT(),wy(6,ds,6,2,"ng-template",null,3,L_),Ms(8,"ebank-form-error-wrapper")(9,"ebank-form-error",16)(10,"span",6),c_(11,"MODULE.VALIDATION.ACCOUNTOWNERS.REQUIRED"),rd()()()()),n&2){let t=HC(4),a=HC(7),i=RC();mb(3),Ry("allowEmpty",true)("id","cibBankMessagesCompanyFilter")("isMultiSelect",i.multipleCompaniesAvailable)("maxNumberOfSelectedOptions",i.maxCompaniesSelected)("options",i.companiesOptions)("searchAttributes",b_(12,ps))("selectedOptionsFormGroup",i.companiesGroup)("selectedOptionTemplate",a)("titleOnMobile",i.mobileCompanyLabel)("showSelectAllButton",i.showSelectAllCompanies),nT(),mb(2),Ry("labelMap",i.LabelMap),mb(4),Ry("control",t);}}var Ua=10,ha=class n{constructor(e,t,a,i,s,E,P){this.changeDetectorRef=e;this.store=t;this.formBuilder=a;this.dateTimeService=i;this.translateService=s;this.bankMessagesConfigService=E;this.bankMessagesValidators=P;this.LabelMap=Ra;this.showCompanySelector=false;this.companies=this.store.state.companies;this.maxCompaniesSelected=Ua;this.showSelectAllCompanies=false;this.minFromDate=this.bankMessagesConfigService.config.enableLongPeriodDatesSearch?null:this.dateTimeService.getSixMonthsAgoDate(this.dateTimeService.getCurrentDate());this.minToDate=this.dateTimeService.getSixMonthsAgoDate(this.dateTimeService.getCurrentDate());this.maxFromDate=this.dateTimeService.getCurrentDate();this.maxToDate=this.dateTimeService.getCurrentDate();this.hasPreselectedFirstCompanyOption=false;this.multipleCompaniesAvailable=false;this.subscription=new H;this.defaultFromDate=this.dateTimeService.getMonthAgoDate(this.dateTimeService.getCurrentDate());this.defaultToDate=this.dateTimeService.getCurrentDate();this.selectedCompaniesLabel=this.translateService.instant("PAGE.CIB_BANK_MESSAGES.V2.COMPANIES_SELECTED");this.selectCompaniesLabel=this.translateService.instant("PAGE.CIB_BANK_MESSAGES.V2.SELECT_COMPANIES");this.filterFormInitialization();}get companiesGroup(){return this.filterForm?.get("companies")}get minMaxDatesGroup(){return this.filterForm.get("minMaxDates")}get fromDateControl(){return this.minMaxDatesGroup.get("fromDate")}get toDateControl(){return this.minMaxDatesGroup.get("toDate")}ngOnInit(){this.setSubscriptions();}
2ngOnDestroy(){this.subscription.unsubscribe();}onSubmit(){if(this.areFilterValuesChanged()){let e={companies:this.getSelectedCompanies(),fromDate:this.fromDateControl.value,toDate:this.toDateControl.value};if(this.getSelectedCompanies().length===0){this.filterForm.get("selected").setErrors({required:true});return}this.store.performDocumentSearch(e),this.storeFilters();}}areFilterValuesChanged(){return this.areCompaniesValuesChanged()||this.fromDateControl.value!==this.store.state.filters.fromDate||this.toDateControl.value!==this.store.state.filters.toDate}filterFormInitialization(){this.filterForm=this.formBuilder.group({companies:this.formBuilder.group({options:this.formBuilder.record({})}),minMaxDates:this.formBuilder.group({fromDate:this.defaultFromDate,toDate:this.defaultToDate},{validators:this.bankMessagesValidators.customDatesValidator()}),selected:this.formBuilder.control("")}),this.storeFilters();}storeFilters(){this.store.setState(e=>F(E$1({},e),{filters:{companies:this.getSelectedCompanies(),fromDate:this.fromDateControl.value,toDate:this.toDateControl.value}}));}getAllCompanies(e){return Object.values(e?.options||this.companiesGroup.value.options||this.companiesOptions[0])}getCompaniesOptionsFormControls(){return Object.values(this.companiesGroup.get("options").controls)}getSelectedCompanies(){if(this.companies?.length===1)return this.companies;let e=this.getAllCompanies().filter(t=>t.selected).map(t=>t.option);return this.companies.filter(t=>e.some(a=>a.companyId===t.companyId))}setSubscriptions(){this.subscription.add(this.store.state$.pipe(Vn(e=>this.byCompanies(e.companies))).subscribe(e=>this.handleCompanies(e.companies))),this.subscription.add(this.filterForm.valueChanges.subscribe(()=>this.storeFilterValidation())),this.subscription.add(this.store.showResultClicked$.subscribe(()=>this.onSubmit())),this.subscription.add(this.store.resetFiltersButtonClicked$.subscribe(e=>this.onResetFilterButtonClicked(e))),this.subscription.add(this.store.removeFilterChipsClicked$.subscribe(e=>this.onRemoveFilterChipsClicked(e))),this.subscription.add(this.companiesGroup.valueChanges.pipe(Cf(this.companiesGroup.value)).subscribe(e=>{!this.hasPreselectedFirstCompanyOption&&Object.values(e.options).length!==0&&(this.hasPreselectedFirstCompanyOption=true,this.getCompaniesOptionsFormControls()[0].patchValue({selected:true})),this.setNumberOfSelectedOptions(e),this.setCompanyLabel(e);}));}byCompanies(e){return this.companies!==e}setCompanyLabel(e){let t=(this.getAllCompanies(e).filter(a=>a.selected)||[]).length>0;this.companyLabel=t?this.selectedCompaniesLabel:this.selectCompaniesLabel,this.mobileCompanyLabel=t?`${this.selectedCompaniesLabel} (${this.numberOfSelectedOptions})`:this.selectCompaniesLabel,this.changeDetectorRef.detectChanges();}setNumberOfSelectedOptions(e){let t=this.getAllCompanies(e),a=t?.filter(i=>i.selected);a.length>0&&this.filterForm.get("selected").setErrors(null),this.numberOfSelectedOptions=this.translateService.instant("PAGE.CIB_BANK_MESSAGES.V2.COMPANIES_SELECTED_OF",{selected:a.length,total:Math.min(t?.length,Ua)});}handleCompanies(e){this.setCompanies(e),this.setCompaniesOptions(e),this.isCompanySelectorShown(true);}setCompanies(e){this.companies=e,e.length>1&&(this.multipleCompaniesAvailable=true),e.length<=Ua&&(this.maxCompaniesSelected=0,this.showSelectAllCompanies=true);}setCompaniesOptions(e){this.companiesOptions=e.map((t,a)=>F(E$1({},t),{accountsText:this.translateService.instant("PAGE.BANK_MESSAGES.V2.MULTI_SELECTOR.NUMBER_OF_ACCOUNTS",{number:t.numberOfAccounts}),_id:a.toString()}));}isCompanySelectorShown(e){this.showCompanySelector=e;}storeFilterValidation(){this.checkDatesValuesAndValidity(),this.store.setState(()=>({isFilterFormValid:this.filterForm.valid}));}setFilterValues(e){this.fromDateControl.setValue(e.fromDate),this.toDateControl.setValue(e.toDate),this.resetSelectionsAndSetDefaultCompany(),this.storeFilters();}onResetFilterButtonClicked(e){this.setFilterValues(e);}onRemoveFilterChipsClicked(e){e===this.getSelectedCompanies().length?this.fromDateControl.setValue(this.defaultFromDate):e===this.getSelectedCompanies().length+1?this.toDateControl.setValue(this.defaultToDate):this.removeCompanySelection(e);let t={companies:this.getSelectedCompanies(),fromDate:this.fromDateControl.value,toDate:this.toDateControl.value};
2this.filterForm.invalid||(this.store.performDocumentSearch(t),this.storeFilters());}resetSelectionsAndSetDefaultCompany(){this.getCompaniesOptionsFormControls().forEach((e,t)=>{let a=e;a.enable(),t===0?a.patchValue({selected:true}):a.patchValue({selected:false});});}removeCompanySelection(e){let t=this.getCompaniesOptionsFormControls(),a=this.getSelectedCompanies()[e];t.forEach(i=>{let s=i;s.enable(),s.value.option.companyId===a.companyId&&s.patchValue({selected:false}),this.getSelectedCompanies().length===0&&t[0].patchValue({selected:true});});}areCompaniesValuesChanged(){let e=this.getAllCompanies().filter(t=>t.selected);return e.length===this.store.state.filters.companies.length?e.some((t,a)=>t.companyId!==this.store.state.filters.companies[a].companyId):true}checkDatesValuesAndValidity(){this.fromDateControl.dirty&&!this.fromDateControl.errors&&this.fromDateControl.markAsPristine(),this.toDateControl.dirty&&!this.toDateControl.errors&&this.toDateControl.markAsPristine(),this.setMinToDate(),this.setMaxFromDate();}setMaxFromDate(){(0, Ka.isDate)(this.toDateControl.value)&&(this.maxFromDate=this.toDateControl.value);}setMinToDate(){(0, Ka.isDate)(this.fromDateControl.value)&&(this.minToDate=this.fromDateControl.value);}static{this.\u0275fac=function(t){return new(t||n)(Do$1(j$),Do$1(K),Do$1(oR),Do$1(he),Do$1(V),Do$1(r),Do$1(ua))};}
2static{this.\u0275cmp=qT({type:n,selectors:[["bank-messages-filters-panel"]],standalone:false,decls:42,vars:19,consts:[["fromDateEbankControl","ebankControl"],["toDateEbankControl","ebankControl"],["control","ebankControl"],["optionTemplate",""],["id","cibBankMessagesFiltersPanel",3,"formGroup"],["formGroupName","minMaxDates"],["translate",""],["id","fromDate","formControlName","fromDate",3,"min","max","titleOnMobile"],["validation","invalidDate",3,"control"],["validation","invalidFutureDate",3,"control"],["validation","fromDateAfterToDate",3,"control"],["validation","datesExceedSixMonths",3,"control"],["id","toDate","formControlName","toDate",3,"min","max","titleOnMobile"],["validation","toDateBeforeFromDate",3,"control"],["formControlName","selected","optionUniqueIdProperty","_id",3,"allowEmpty","id","isMultiSelect","maxNumberOfSelectedOptions","options","searchAttributes","selectedOptionsFormGroup","selectedOptionTemplate","titleOnMobile","showSelectAllButton"],["selectTemplate","2left",3,"labelMap"],["validation","required",3,"control"],[1,"ebank-option-items","ebank-option-row"],[1,"ebank-option-col","ebank-option-left"],[1,"ebank-text-weight-bold"],[1,"ebank-text-small"]],template:function(t,a){if(t&1&&(Ms(0,"form",4),mC(1,gs,12,13,"ebank-form-field"),Ms(2,"div",5)(3,"ebank-form-field")(4,"ebank-label",6),c_(5,"PAGE.BANK_MESSAGES.V2.FROM_DATE"),rd(),Ms(6,"ebank-sub-label",6),c_(7,"PAGE.BANK_MESSAGES.V2.DATE.SUBLABEL"),rd(),ky(8,"ebank-date-picker",7,0),N_(10,"translate"),tT(),Ms(11,"ebank-form-error-wrapper")(12,"ebank-form-error",8)(13,"span",6),c_(14,"PAGE.BANK_MESSAGES.V2.INVALID_DATE"),rd()(),Ms(15,"ebank-form-error",9)(16,"span",6),c_(17,"PAGE.BANK_MESSAGES.V2.INVALID_FUTURE_DATE"),rd()(),Ms(18,"ebank-form-error",10)(19,"span",6),c_(20,"PAGE.BANK_MESSAGES.V2.INVALID_FROM_DATE_GREATER"),rd()(),Ms(21,"ebank-form-error",11)(22,"span",6),c_(23,"PAGE.BANK_MESSAGES.V2.INVALID_TIMESPAN"),rd()()()(),Ms(24,"ebank-form-field")(25,"ebank-label",6),c_(26,"PAGE.BANK_MESSAGES.V2.TO_DATE"),rd(),Ms(27,"ebank-sub-label",6),c_(28,"PAGE.BANK_MESSAGES.V2.DATE.SUBLABEL"),rd(),ky(29,"ebank-date-picker",12,1),N_(31,"translate"),tT(),Ms(32,"ebank-form-error-wrapper")(33,"ebank-form-error",8)(34,"span",6),c_(35,"PAGE.BANK_MESSAGES.V2.INVALID_DATE"),rd()(),Ms(36,"ebank-form-error",9)(37,"span",6),c_(38,"PAGE.BANK_MESSAGES.V2.INVALID_FUTURE_DATE"),rd()(),Ms(39,"ebank-form-error",13)(40,"span",6),c_(41,"PAGE.BANK_MESSAGES.V2.INVALID_TO_DATE_EARLIER"),rd()()()()()()),t&2){let i=HC(9),s=HC(30);Ry("formGroup",a.filterForm),mb(),gC(a.showCompanySelector?1:-1),mb(7),Ry("min",a.minFromDate)("max",a.maxFromDate)("titleOnMobile",R_(10,15,"PAGE.BANK_MESSAGES.V2.FROM_DATE")),nT(),mb(4),Ry("control",i),mb(3),Ry("control",i),mb(3),Ry("control",i),mb(3),Ry("control",i),mb(8),Ry("min",a.minToDate)("max",a.maxToDate)("titleOnMobile",R_(31,17,"PAGE.BANK_MESSAGES.V2.TO_DATE")),nT(),mb(4),Ry("control",s),mb(3),Ry("control",s),mb(3),Ry("control",s);}},dependencies:[eR,co$1,Ch,j,u,Te,No,vI,X3,uo$1,Nl,Cr,fu,Pa,gu,on,sI,f8,QI,ye],encapsulation:2,changeDetection:1});}};pi();Fh();vM();he$1();$N();function hs(n,e){if(n&1){let t=CC();Ms(0,"ebank-chip",2),qy("removeClick",function(){let i=yh(t).$implicit,s=RC();return vh(s.removeFilter(i.id))}),rd();}if(n&2){let t=e.$implicit;Ry("text",t.text)("readOnly",t.readOnly);}}var ka=class n{constructor(e,t,a){this.store=e;this.translateService=t;this.dateTimeService=a;this.matchedItems=this.store.state.totalCount;this.chips=[];this.subscription=new H;this.areDefaultFilterValuesSet=false;this.defaultFilterValues={companies:[],fromDate:null,toDate:null};}ngOnInit(){this.setSubscriptions();}ngOnDestroy(){this.subscription.unsubscribe();}resetFilters(){this.resetChips(),this.setLastFilterValues(null),this.store.resetFiltersAction(this.defaultFilterValues);}removeFilter(e){e>0&&e<this.lastFilterValues.companies.length&&this.removeChipsIfAdded(e),this.store.removeFilterChipsAction(e);}setSubscriptions(){this.subscription.add(this.store.state$.pipe(Vn(e=>this.byFilters(e.filters))).subscribe(e=>this.handleFilterValuesChanged(e.filters))),this.subscription.add(this.store.state$.pipe(Vn(e=>this.byNumberBankMessages(e.totalCount))).subscribe(e=>this.setMatchedItems(e.totalCount)));}byFilters(e){return e.companies.length?this.areCompaniesValuesChanged(e)||this.lastFilterValues?.toDate!==e.toDate||this.lastFilterValues?.fromDate!==e.fromDate:false}byNumberBankMessages(e){return this.matchedItems!==e}setMatchedItems(e){this.matchedItems=e;}
2handleFilterValuesChanged(e){this.setDefaultFilterValues(e),this.setChips(e);}setDefaultFilterValues(e){this.areDefaultFilterValuesSet||(this.defaultFilterValues=e,this.checkIfDefaultFilterValuesSet());}checkIfDefaultFilterValuesSet(){this.defaultFilterValues.companies.length&&this.defaultFilterValues.fromDate&&this.defaultFilterValues.toDate&&(this.areDefaultFilterValuesSet=true);}setChips(e){this.checkFilterChanges(e),this.setLastFilterValues(e);}checkFilterChanges(e){e.companies.length>0&&(this.adjustCompaniesChipsLength(e),e.companies.forEach((t,a)=>{this.checkCompanyValueChange(t,a,e.companies.length);}),this.checkFromDateValueChange(e.fromDate,e.companies.length),this.checkToDateValueChange(e.toDate,e.companies.length+1));}checkCompanyValueChange(e,t,a){this.removeChipsIfAdded(t),this.addChips(t,"PAGE.BANK_MESSAGES.V2.COMPANY",e.name,a===1&&e.name===this.defaultFilterValues.companies[0].name&&e.numberOfAccounts===this.defaultFilterValues.companies[0].numberOfAccounts);}removeChipsIfAdded(e){this.chips=this.chips.filter(t=>t.id!==e);}addChips(e,t,a,i=false){this.chips[e]={id:e,text:`${this.translateService.instant(t)}: ${a}`,readOnly:i};}checkFromDateValueChange(e,t){e=this.getFormattedDate(e),this.removeChipsIfAdded(t),this.addChips(t,"PAGE.BANK_MESSAGES.V2.FROM_DATE",e,e===this.getFormattedDate(this.defaultFilterValues.fromDate));}checkToDateValueChange(e,t){e=this.getFormattedDate(e),this.removeChipsIfAdded(t),this.addChips(t,"PAGE.BANK_MESSAGES.V2.TO_DATE",e,e===this.getFormattedDate(this.defaultFilterValues.toDate));}setLastFilterValues(e){this.lastFilterValues=e;}getFormattedDate(e){return this.dateTimeService.getFormattedDateFromDate(e,"DD-MM-YYYY").toString()}resetChips(){this.chips=[];}areCompaniesValuesChanged(e){return e.companies.length===this.lastFilterValues?.companies?.length?!e.companies.every((t,a)=>t.companyId===this.lastFilterValues?.companies[a].companyId):true}adjustCompaniesChipsLength(e){e.companies.length<this.lastFilterValues?.companies?.length&&(this.chips=this.chips.filter(t=>t.id<e.companies.length));}static{this.\u0275fac=function(t){return new(t||n)(Do$1(K),Do$1(V),Do$1(he))};}
2static{this.\u0275cmp=qT({type:n,selectors:[["bank-messages-filters-chips"]],standalone:false,decls:3,vars:1,consts:[[3,"removeAllClick","numResults"],[3,"text","readOnly"],[3,"removeClick","text","readOnly"]],template:function(t,a){t&1&&(Ms(0,"ebank-filter-display-area",0),qy("removeAllClick",function(){return a.resetFilters()}),IC(1,hs,1,2,"ebank-chip",1,vC),rd()),t&2&&(Ry("numResults",a.matchedItems),mb(),EC(a.chips));},dependencies:[Vs,Y3],encapsulation:2,changeDetection:1});}};na();pi();Fh();vM();he$1();J();$n();na();$N();var fs=(n,e,t,a)=>({"bank-messages-sorting-by-date":n,"bank-messages-sorting-by-other":e,"bank-messages-select-all-sorting-by-date":t,"bank-messages-select-all-sorting-by-others":a}),ks=(n,e)=>({"bank-messages-select-all-and-choose-action-with-header-items":n,"bank-messages-select-all-and-choose-action-without-header-items":e});function bs(n,e){if(n&1){let t=CC();Ms(0,"ebank-dropdown-button",5),qy("optionSelected",function(i){yh(t);let s=RC();return vh(s.onSortingSelected(i))}),c_(1),rd();}if(n&2){let t=RC();Ry("options",t.sortingOptions),mb(),cd(" ",t.selectedSortingOption," ");}}function Cs(n,e){if(n&1){let t=CC();Ms(0,"div",4)(1,"div",6)(2,"ebank-checkbox-field",7),qy("changed",function(i){yh(t);let s=RC();return vh(s.onSelectAll(i))}),c_(3),N_(4,"translate"),rd(),tT(),rd(),Ms(5,"div")(6,"ebank-dropdown-button",8),qy("optionSelected",function(i){yh(t);let s=RC();return vh(s.onActionOptionSelected(i))}),c_(7),N_(8,"translate"),rd(),ky(9,"ebank-help-button",9),Ms(10,"ebank-help-button-content",null,0),c_(12),N_(13,"translate"),rd()()();}if(n&2){let t=HC(11),a=RC();Ry("ngClass",C_(15,ks,a.isSortedByDateSelected,!a.isSortedByDateSelected&&a.isSelectMoreEnabled)),mb(),Ry("formGroup",a.selectAllFormGroup),mb(),Ry("indeterminate",a.isSelectAllIntermediateState),nT(),mb(),cd(" ",R_(4,9,"PAGE.BANK_MESSAGES.V2.SELECT_ALL")," "),mb(3),Ry("options",a.actionOptions)("disabled",a.isChooseActionButtonDisabled),mb(),cd(" ",R_(8,11,"PAGE.BANK_MESSAGES.V2.CHOOSE_ACTION")," "),mb(2),Ry("content",t),mb(3),cd(" ",R_(13,13,"PAGE.CIB_BANK_MESSAGES.V2.SELECT_ALL_ACTION_HELP")," ");}}var ba=class n{constructor(e,t,a){this.translateService=e;this.store=t;this.context=a;this.bankMessagesSelectionsArea=true;this.sortingOptions=[this.translateService.instant("PAGE.BANK_MESSAGES.V2.SORTING.DATE_DESCENDING"),this.translateService.instant("PAGE.BANK_MESSAGES.V2.SORTING.DATE_ASCENDING"),this.translateService.instant("PAGE.BANK_MESSAGES.V2.SORTING.GROUP_ASCENDING"),this.translateService.instant("PAGE.BANK_MESSAGES.V2.SORTING.GROUP_DESCENDING"),this.translateService.instant("PAGE.BANK_MESSAGES.V2.SORTING.ACCOUNT_ASCENDING"),this.translateService.instant("PAGE.BANK_MESSAGES.V2.SORTING.ACCOUNT_DESCENDING"),this.translateService.instant("PAGE.BANK_MESSAGES.V2.SORTING.STATUS_ASCENDING"),this.translateService.instant("PAGE.BANK_MESSAGES.V2.SORTING.STATUS_DESCENDING")];this.actionOptions=[this.translateService.instant("PAGE.BANK_MESSAGES.V2.MARK_AS_READ"),this.translateService.instant("PAGE.BANK_MESSAGES.V2.MARK_AS_UNREAD"),this.translateService.instant("PAGE.BANK_MESSAGES.V2.EXPORT_TO_PDF"),this.translateService.instant("PAGE.BANK_MESSAGES.V2.DELETE")];this.selectedSortingOption=this.translateService.instant(this.store.state.selectedSorting.sortingName);this.isSelectMoreEnabled=this.store.state.isSelectMoreEnabled;this.isSortedByDateSelected=this.isSortedByDate();this.selectMoreLabel=this.isSelectMoreEnabled?this.translateService.instant("PAGE.BANK_MESSAGES.V2.TURN_OFF_SELECT_MORE"):this.translateService.instant("PAGE.BANK_MESSAGES.V2.TURN_ON_SELECT_MORE");this.isMobile=this.context.isNativeApp;this.selectMoreButtonLabel=this.isMobile?"secondary":"tertiary";this.isSelectAllIntermediateState=this.store.state.isSelectAllIntermediateState;this.isChooseActionButtonDisabled=this.store.state.selectedBankMessages.length===0;this.selectAllFormGroup=new yn({selectAllMessages:new vn(this.store.state.isSelectAllChecked)});this.subscription=new H;}get isSelectAllMessagesControl(){return this.selectAllFormGroup.get("selectAllMessages")}ngOnInit(){this.setSubscriptions();}
2ngOnDestroy(){this.subscription.unsubscribe();}onSelectMore(){this.isSelectMoreEnabled&&this.selectAll(false),this.changeSelectMoreStatus(!this.isSelectMoreEnabled),this.setSelectMoreLabel(),this.store.turnOnOffSelectMoreAction(this.isSelectMoreEnabled);}onSortingSelected(e){this.selectedSortingOption=e,this.storeSelectedOption(),this.store.sortingSelectedAction(this.store.state.selectedSorting),this.isSortedByDateSelected=this.isSortedByDate(),this.selectAll(false);}onActionOptionSelected(e){switch(e){case this.translateService.instant("PAGE.BANK_MESSAGES.V2.MARK_AS_READ"):this.store.markAsReadChooseAction();break;case this.translateService.instant("PAGE.BANK_MESSAGES.V2.MARK_AS_UNREAD"):this.store.markAsUnreadChooseAction();break;case this.translateService.instant("PAGE.BANK_MESSAGES.V2.EXPORT_TO_PDF"):this.store.exportToPdfChooseAction();break;case this.translateService.instant("PAGE.BANK_MESSAGES.V2.DELETE"):this.store.deleteChooseAction();break}}onSelectAll(e){this.selectAll(e);}selectAll(e){let t=this.selectOrUnselectBankMessages(e);this.store.setState(()=>({isSelectAllIntermediateState:false,isSelectAllChecked:e,selectedBankMessages:t})),this.store.selectAllAction(e);}setSubscriptions(){this.subscription.add(this.store.state$.pipe(Vn(e=>this.bySelectAllIntermediateState(e.isSelectAllIntermediateState))).subscribe(e=>this.setSelectAllIntermediateSate(e.isSelectAllIntermediateState))),this.subscription.add(this.store.state$.subscribe(e=>this.checkChooseActionButtonStatus(e.selectedBankMessages.length===0))),this.subscription.add(this.store.selectAllClicked$.subscribe(e=>{this.isSelectAllMessagesControl.setValue(e);}));}bySelectAllIntermediateState(e){return this.isSelectAllIntermediateState!==e}setSelectAllIntermediateSate(e){this.isSelectAllIntermediateState=e;}checkChooseActionButtonStatus(e){this.isChooseActionButtonDisabled=e;}selectOrUnselectBankMessages(e){return e?this.selectBankMessages():[]}selectBankMessages(){return this.store.state.rawBankMessages.map(t=>({messageId:t.id})).slice(0,100)}changeSelectMoreStatus(e){this.isSelectMoreEnabled=e;}setSelectMoreLabel(){this.isSelectMoreEnabled?this.selectMoreLabel=this.translateService.instant("PAGE.BANK_MESSAGES.V2.TURN_OFF_SELECT_MORE"):this.selectMoreLabel=this.translateService.instant("PAGE.BANK_MESSAGES.V2.TURN_ON_SELECT_MORE");}storeSelectedOption(){let e={sortingName:"PAGE.BANK_MESSAGES.V2.SORTING.DATE_DESCENDING",sortingType:"date",sortingOrder:"descending"};switch(this.selectedSortingOption){case this.translateService.instant("PAGE.BANK_MESSAGES.V2.SORTING.DATE_ASCENDING"):e={sortingName:"PAGE.BANK_MESSAGES.V2.SORTING.DATE_ASCENDING",sortingType:"date",sortingOrder:"ascending"},this.store.setState(()=>({selectedSorting:e}));break;case this.translateService.instant("PAGE.BANK_MESSAGES.V2.SORTING.DATE_DESCENDING"):e={sortingName:"PAGE.BANK_MESSAGES.V2.SORTING.DATE_DESCENDING",sortingType:"date",sortingOrder:"descending"},this.store.setState(()=>({selectedSorting:e}));break;case this.translateService.instant("PAGE.BANK_MESSAGES.V2.SORTING.GROUP_ASCENDING"):e={sortingName:"PAGE.BANK_MESSAGES.V2.SORTING.GROUP_ASCENDING",sortingType:"description",sortingOrder:"ascending"},this.store.setState(()=>({selectedSorting:e}));break;case this.translateService.instant("PAGE.BANK_MESSAGES.V2.SORTING.GROUP_DESCENDING"):e={sortingName:"PAGE.BANK_MESSAGES.V2.SORTING.GROUP_DESCENDING",sortingType:"description",sortingOrder:"descending"},this.store.setState(()=>({selectedSorting:e}));break;case this.translateService.instant("PAGE.BANK_MESSAGES.V2.SORTING.ACCOUNT_ASCENDING"):e={sortingName:"PAGE.BANK_MESSAGES.V2.SORTING.ACCOUNT_ASCENDING",sortingType:"account",sortingOrder:"ascending"},this.store.setState(()=>({selectedSorting:e}));break;case this.translateService.instant("PAGE.BANK_MESSAGES.V2.SORTING.ACCOUNT_DESCENDING"):e={sortingName:"PAGE.BANK_MESSAGES.V2.SORTING.ACCOUNT_DESCENDING",sortingType:"account",sortingOrder:"descending"},this.store.setState(()=>({selectedSorting:e}));break;case this.translateService.instant("PAGE.BANK_MESSAGES.V2.SORTING.STATUS_ASCENDING"):e={sortingName:"PAGE.BANK_MESSAGES.V2.SORTING.STATUS_ASCENDING",sortingType:"status",sortingOrder:"ascending"},this.store.setState(()=>({selectedSorting:e}));break;case this.translateService.instant("PAGE.BANK_MESSAGES.V2.SORTING.STATUS_DESCENDING"):e={sortingName:"PAGE.BANK_MESSAGES.V2.SORTING.STATUS_DESCENDING",sortingType:"status",sortingOrder:"descending"},this.store.setState(()=>({selectedSorting:e}));break}}isSortedByDate(){return this.store.state.selectedSorting.sortingName==="PAGE.BANK_MESSAGES.V2.SORTING.DATE_ASCENDING"||this.store.state.selectedSorting.sortingName==="PAGE.BANK_MESSAGES.V2.SORTING.DATE_DESCENDING"}static{this.\u0275fac=function(t){return new(t||n)(Do$1(V),Do$1(K),Do$1(P))};}
2static{this.\u0275cmp=qT({type:n,selectors:[["bank-messages-selections-area"]],hostVars:2,hostBindings:function(t,a){t&2&&ev("bank-messages-selections-area",a.bankMessagesSelectionsArea);},standalone:false,decls:5,vars:10,consts:[["actionInfo",""],[1,"separated-buttons",3,"ngClass"],["size","s",3,"buttonClick","buttonStyle"],["size","s",3,"options"],[1,"bank-messages-select-all",3,"ngClass"],["size","s",3,"optionSelected","options"],[3,"formGroup"],["formControlName","selectAllMessages",3,"changed","indeterminate"],["size","s",1,"choose-action",3,"optionSelected","options","disabled"],[3,"content"]],template:function(t,a){t&1&&(Ms(0,"div",1)(1,"ebank-button",2),qy("buttonClick",function(){return a.onSelectMore()}),c_(2),rd(),mC(3,bs,2,2,"ebank-dropdown-button",3),rd(),mC(4,Cs,14,18,"div",4)),t&2&&(Ry("ngClass",M_(5,fs,a.isSortedByDateSelected&&!a.isSelectMoreEnabled,!a.isSortedByDateSelected&&!a.isSelectMoreEnabled,a.isSortedByDateSelected&&a.isSelectMoreEnabled,!a.isSortedByDateSelected&&a.isSelectMoreEnabled)),mb(),Ry("buttonStyle",a.selectMoreButtonLabel),mb(),cd(" ",a.selectMoreLabel," "),mb(),gC(a.isMobile?-1:3),mb(),gC(a.isSelectMoreEnabled?4:-1));},dependencies:[dn,co$1,Ch,j,Wa,_e$1,Bn,uo$1,Nl,fu,yI,i8,ye],encapsulation:2,changeDetection:1});}};var xi=N(ep());pi();Fh();vM();he$1();$N();na();pi();vM();na();$N();var _s=["*"],Ca=class n{constructor(e){this.store=e;this.checkBoxFormGroup=new yn({isChecked:new vn(false)});this.subscription=new H;}get isCheckedControl(){return this.checkBoxFormGroup.get("isChecked")}ngOnInit(){this.setSubscriptions(),this.enableOrDisableSelectActionAfterSelectAllOrLoadMore(),this.checkAndSetIntermediateStateAfterLoadMore();}ngOnDestroy(){this.subscription.unsubscribe();}onCheckBoxChanged(e){this.selectOrUnselectBankMessage(e),this.checkAndSetSelectAllStatus();}setSubscriptions(){this.subscription.add(this.store.selectAllClicked$.subscribe(e=>{this.isCheckedControl.value!==e&&this.isCheckedControl.setValue(e),this.enableOrDisableSelectActionAfterSelectAllOrLoadMore();})),this.subscription.add(this.store.enableMultipleSelection$.subscribe(e=>{e?this.enableSelectAction():this.disableSelectAction();}));}checkAndSetSelectAllStatus(){if(this.store.state.selectedBankMessages.length===0){this.store.selectAllAction(false);return}this.store.state.isSelectAllIntermediateState!==true&&this.store.setState(()=>({isSelectAllIntermediateState:true})),(this.store.state.selectedBankMessages.length===this.store.state.rawBankMessages.length||this.store.state.selectedBankMessages.length===100)&&(this.store.setState(()=>({isSelectAllIntermediateState:false})),this.store.selectAllAction(true));}selectOrUnselectBankMessage(e){e?this.selectBankMessage():this.unselectBankMessage();}selectBankMessage(){let e={messageId:this.bankMessageId};this.store.setState(()=>({selectedBankMessages:[...this.store.state.selectedBankMessages,e]})),this.store.state.selectedBankMessages.length===100&&this.store.enableMultipleSelectionAction(false),this.isCheckedControl.enable();}unselectBankMessage(){this.store.setState(()=>({selectedBankMessages:this.store.state.selectedBankMessages.filter(e=>e.messageId!==this.bankMessageId)})),this.store.state.selectedBankMessages.length===99&&this.store.enableMultipleSelectionAction(true);}enableOrDisableSelectActionAfterSelectAllOrLoadMore(){this.store.state.selectedBankMessages.length===100?(this.deselectBankMessagesAbove100(),this.disableSelectAction()):this.enableSelectAction();}disableSelectAction(){this.isCheckedControl.value||this.isCheckedControl.disable();}enableSelectAction(){this.isCheckedControl.enable();}deselectBankMessagesAbove100(){this.store.state.selectedBankMessages.some(t=>t.messageId===this.bankMessageId)||this.isCheckedControl.setValue(false);}checkAndSetIntermediateStateAfterLoadMore(){this.store.state.isSelectAllChecked&&this.store.state.selectedBankMessages.length!==this.store.state.rawBankMessages.length&&this.store.setState(()=>({isSelectAllChecked:false,isSelectAllIntermediateState:true}));}static{this.\u0275fac=function(t){return new(t||n)(Do$1(K))};}
2static{this.\u0275cmp=qT({type:n,selectors:[["bank-messages-checkbox-panel"]],inputs:{bankMessageId:"bankMessageId"},standalone:false,ngContentSelectors:_s,decls:3,vars:1,consts:[[3,"formGroup"],["formControlName","isChecked",3,"changed"]],template:function(t,a){t&1&&(OC(),Ms(0,"form",0)(1,"ebank-checkbox-panel",1),qy("changed",function(s){return a.onCheckBoxChanged(s)}),PC(2),rd(),tT(),rd()),t&2&&(Ry("formGroup",a.checkBoxFormGroup),mb(),nT());},dependencies:[eR,co$1,Ch,j,u,Q8,X3,uo$1,Nl,fu],encapsulation:2,changeDetection:1});}};vM();he$1();var Ma=class n{constructor(e){this.translateService=e;}transform(e){return e==="read"?this.translateService.instant("PAGE.BANK_MESSAGES.V2.MARK_AS_UNREAD"):this.translateService.instant("PAGE.BANK_MESSAGES.V2.MARK_AS_READ")}static{this.\u0275fac=function(t){return new(t||n)(Do$1(V,16))};}static{this.\u0275pipe=QT({name:"markAsReadUnreadLabel",type:n,pure:true,standalone:false});}};function Bs(n,e){if(n&1&&(Ms(0,"ebank-section-header-panel"),c_(1),rd()),n&2){let t=RC(2).$implicit;mb(),cv(t.name);}}function As(n,e){n&1&&wy(0,Bs,2,1,"ebank-section-header-panel",3);}function Ds(n,e){if(n&1){let t=CC();Ms(0,"ebank-expandable-panel")(1,"ebank-expandable-panel-header"),ky(2,"bank-messages-template",5),rd(),Ms(3,"ebank-expandable-panel-content")(4,"ebank-expandable-panel-menu-row")(5,"li")(6,"ebank-button",6),N_(7,"translate"),qy("buttonClick",function(){yh(t);let i=RC(3).$implicit,s=RC(2);return vh(s.onShowMessageClicked(i))}),c_(8),N_(9,"translate"),rd()(),Ms(10,"li")(11,"ebank-button",7),qy("buttonClick",function(){yh(t);let i=RC(3).$implicit,s=RC(2);return vh(s.onMarkAsReadUnreadClicked(i))}),c_(12),N_(13,"markAsReadUnreadLabel"),rd()(),Ms(14,"li")(15,"ebank-button",8),qy("buttonClick",function(){yh(t);let i=RC(3).$implicit,s=RC(2);return vh(s.onDeleteClicked(i.id))}),c_(16),N_(17,"translate"),rd()()()()();}if(n&2){let t=RC(3).$implicit;mb(2),Ry("bankMessage",t),mb(4),Ry("altTextFunctionalIcon",m_(R_(7,7,"EBANKUI.CONFIG.EXTERNAL.LINK")))("useAsLink",true),mb(2),cd(" ",R_(9,9,"PAGE.BANK_MESSAGES.V2.SHOW_MESSAGE")," "),mb(4),cd(" ",R_(13,11,t.status)," "),mb(4),cd(" ",R_(17,13,"PAGE.BANK_MESSAGES.V2.DELETE")," ");}}function ys(n,e){n&1&&wy(0,Ds,18,15,"ebank-expandable-panel",3);}function Ts(n,e){if(n&1&&(Ms(0,"bank-messages-checkbox-panel",4),ky(1,"bank-messages-template",5),rd()),n&2){let t=RC(3).$implicit;Ry("bankMessageId",t==null?null:t.id),mb(),Ry("bankMessage",t);}}function xs(n,e){n&1&&wy(0,Ts,2,2,"bank-messages-checkbox-panel",9);}function Is(n,e){if(n&1&&(mC(0,ys,1,0,"ebank-expandable-panel"),mC(1,xs,1,0,"bank-messages-checkbox-panel",4)),n&2){let t=RC(3);gC(t.isSelectMoreEnabled?-1:0),mb(),gC(t.isSelectMoreEnabled?1:-1);}}function Fs(n,e){if(n&1&&(mC(0,As,1,0,"ebank-section-header-panel"),mC(1,Is,2,2)),n&2){let t=e.$implicit,a=RC(2);gC(t.itemType===a.ItemType.Header?0:-1),mb(),gC(t.itemType===a.ItemType.Item?1:-1);}}function Ns(n,e){if(n&1){let t=CC();Ms(0,"ebank-load-more",1),qy("slicedList",function(i){yh(t);let s=RC();return vh(s.paginatedBankMessages=s.onSlicedList(i))}),Ms(1,"ebank-panel-list",2)(2,"ebank-expandable-panel-container"),IC(3,Fs,2,2,null,null,pC().trackByBankMessageId,true),rd()()();}if(n&2){let t=RC();Ry("callback",t.notifyLoadMoreBankMessages)("list",t.bankMessages)("isDataItem",t.isDataItem)("totalDataItemCount",t.totalDataItemCount)("counter",t.counter.bind(t))("loaded",t.customLoader.bind(t))("buttonText",t.loadMoreButtonText)("config",t.loadMoreInitConfig),mb(3),EC(t.paginatedBankMessages);}}var _a=class n{constructor(e,t,a,i){this.translateService=e;this.forwardLinkService=t;this.dialog=a;this.store=i;this.bankMessages=this.store.state.bankMessages;this.isSelectMoreEnabled=this.store.state.isSelectMoreEnabled;this.showBankMessagesWithHeaders=true;this.totalDataItemCount=this.setTotalDataItems();this.loadMoreButtonText=this.translateService.instant("PAGE.CIB_BANK_MESSAGES.V2.LOAD_MORE.BUTTON.LABEL");this.loadMoreInitConfig={initialLoad:50,increment:50};this.ItemType=Re;this.subscription=new H;}ngOnInit(){this.setSubscriptions();}ngOnDestroy(){this.subscription.unsubscribe();}isDataItem(e){return e.itemType!=="header"}counter(e){return this.translateService.instant("PAGE.BANK_MESSAGES.V2.SHOWING",{count:e.count,total:e.total})}customLoader(e){return this.translateService.instant("PAGE.BANK_MESSAGES.V2.CUSTOM_LOADER",{amount:e.amount})}trackByBankMessageId(e,t){return t.id}onShowMessageClicked(e){this.openBankMessage(e),e.status==="unread"&&this.store.showMessageAction(e);}onMarkAsReadUnreadClicked(e){e.status!=="read"?this.store.markAsReadAction(e):this.store.markAsUnreadAction(e);}onDeleteClicked(e){this.showConfirmationModal(e);}onSlicedList(e){return e}setSubscriptions(){this.subscription.add(CI([this.store.state$,this.store.sortingClicked$]).pipe(Vn(([e,t])=>this.byBankMessagesOSortingOption(e.bankMessages,t))).subscribe(([e,t])=>this.handleStateChanged(e.bankMessages,t))),this.subscription.add(this.store.turnOnOffSelectMoreClicked$.subscribe(e=>this.handleSelectMoreButtonClicked(e)));}handleStateChanged(e,t){(0, xi.isArray)(e)&&this.handleBankMessagesStateChanged(e),this.handleSoringClicked(t.sortingName);}byBankMessagesOSortingOption(e,t){return this.bankMessages!==e||this.lastSortingOption!==t.sortingName}handleSelectMoreButtonClicked(e){this.isSelectMoreEnabled=e;}handleBankMessagesStateChanged(e){this.setBankMessages(e),this.totalDataItemCount=this.setTotalDataItems();}setBankMessages(e){this.bankMessages=e;}setTotalDataItems(){return this.store.state.totalCount}handleSoringClicked(e){this.setShowBankMessagesWithHeaders(e),this.setLastSortingOption(e);}setShowBankMessagesWithHeaders(e){this.showBankMessagesWithHeaders=e==="PAGE.BANK_MESSAGES.V2.SORTING.DATE_DESCENDING"||e==="PAGE.BANK_MESSAGES.V2.SORTING.DATE_ASCENDING";}setLastSortingOption(e){this.lastSortingOption=e;}openBankMessage(e){return S(this,null,function*(){yield this.forwardLinkService.openApiV4(e.links.document.href);})}showConfirmationModal(e){this.dialog.open(this.createDeleteBankMessagesModalData(e));}createDeleteBankMessagesModalData(e){return {title:this.translateService.instant("PAGE.BANK_MESSAGES.V2.DELETE_MODAL.TITLE"),content:this.translateService.instant("PAGE.BANK_MESSAGES.V2.DELETE_MODAL.CONTENT"),confirm:{label:this.translateService.instant("PAGE.BANK_MESSAGES.V2.DELETE_MODAL.ACTION_BUTTON"),style:"primary-danger",onClick:()=>{this.store.deleteMessageAction(e);}},cancel:{label:this.translateService.instant("PAGE.BANK_MESSAGES.V2.DELETE_MODAL.CANSEL_BUTTON")}}}static{this.\u0275fac=function(t){return new(t||n)(Do$1(V),Do$1(x),Do$1(Y9),Do$1(K))};}
2static{this.\u0275cmp=qT({type:n,selectors:[["cib-bank-messages-items"]],inputs:{notifyLoadMoreBankMessages:"notifyLoadMoreBankMessages"},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","bank-messages-heading-id"],[4,"ebankPanelList"],[3,"bankMessageId"],[3,"bankMessage"],["buttonStyle","secondary","size","s","iconType","external",3,"buttonClick","useAsLink","altTextFunctionalIcon"],["size","s","buttonStyle","tertiary",3,"buttonClick"],["size","s","buttonStyle","tertiary-danger",3,"buttonClick"],[3,"bankMessageId",4,"ebankPanelList"]],template:function(t,a){t&1&&mC(0,Ns,5,8,"ebank-load-more",0),t&2&&gC(a.bankMessages.length?0:-1);},dependencies:[og,TO,X8,Z8,J8,hi,ig,q8,_e$1,o6,rt,Ca,ye,Ma],encapsulation:2,changeDetection:1});}};vM();X$2();he$1();$N();var va=class n{constructor(e){this.urlService=e;this.documentArchiveLink=this.urlService.getUrl("URL.PAGE.DOCUMENTARCHIVE");}static{this.\u0275fac=function(t){return new(t||n)(Do$1(A))};}
2static{this.\u0275cmp=qT({type:n,selectors:[["cib-bank-messages-info"]],standalone:false,decls:9,vars:4,consts:[["translate",""],[1,"ebank-text-link",3,"href"]],template:function(t,a){t&1&&(Ms(0,"ebank-lead-block")(1,"p",0),c_(2,"PAGE.CIB_BANK_MESSAGES.V2.LEAD_TEXT_LINE_1"),rd(),Ms(3,"p",0),c_(4," PAGE.CIB_BANK_MESSAGES.V2.LEAD_TEXT_LINE_2 "),Ms(5,"a",1),N_(6,"translate"),Ms(7,"span",0),c_(8,"PAGE.BANK_MESSAGES.V2.DOCUMENT_ARCHIVE_LINK"),rd()()()()),t&2&&(mb(5),Ry("href",m_(R_(6,2,a.documentArchiveLink)),lg));},dependencies:[Te,sB,ye],encapsulation:2,changeDetection:1});}};$n();function ws(n,e){if(n&1&&ky(0,"bank-messages-selections-area")(1,"cib-bank-messages-items",3),n&2){let t=RC();mb(),Ry("notifyLoadMoreBankMessages",t.loadMoreBankMessagesCallback.bind(t));}}function Ls(n,e){n&1&&(Ms(0,"ebank-empty-state-description"),c_(1),N_(2,"translate"),rd()),n&2&&(mb(),cd(" ",R_(2,1,"PAGE.BANK_MESSAGES.V2.NO_ACCOUNTS")," "));}function Rs(n,e){n&1&&(sd(0),Ms(1,"ebank-empty-state-title",4),c_(2,"PAGE.CIB_BANK_MESSAGES.V2.LIST_EMPTY.TITLE "),rd(),Ms(3,"ebank-empty-state-description",4),c_(4,"PAGE.CIB_BANK_MESSAGES.V2.LIST_EMPTY.DESCRIPTION "),rd(),Qs$1());}function Gs(n,e){if(n&1&&(Ms(0,"ebank-empty-state"),mC(1,Ls,3,3,"ebank-empty-state-description"),N_(2,"async"),mC(3,Rs,5,0,"ng-container"),N_(4,"async"),rd()),n&2){let t=RC();mb(),gC(R_(2,2,t.showNoAccountsEmptyState$)?1:-1),mb(2),gC(R_(4,4,t.showNoMessagesEmptyState$)?3:-1);}}var Ea=class n{constructor(e,t,a,i,s,E,P,H$1,ve,Wa){this.bankMessagesDataService=e;this.bankMessagesLogService=t;this.dateUtils=a;this.dataAccounts=i;this.store=s;this.routerDataService=E;this.dateTimeService=P;this.translateService=H$1;this.alert=ve;this.bankMessagesExportService=Wa;this.showSpinner$=new br(true);this.showNoMessagesEmptyState$=new br(false);this.showNoAccountsEmptyState$=new br(false);this.isShowResultButtonDisabled=!this.store.state.isFilterFormValid;this.totalCount=0;this.subscription=new H;this.accountList=this.store.state.accounts;this.isSearchError=false;this.nextPageTokenArray=[];this.paginationDefaultNumber=50;}ngOnInit(){this.changePageSize(),this.setSubscriptions(),this.initialDataLoading();}ngOnDestroy(){this.subscription.unsubscribe();}loadMoreBankMessagesCallback(){return hI({}).pipe(_f(()=>this.loadMoreBankMessages()),we$1(()=>this.store.state.rawBankMessages.length>=this.store.state.totalCount))}onSubmit(){this.store.showResultClicked();}changePageSize(){this.routerDataService.addData({ebankuiPage:"large"});}setSubscriptions(){this.subscription.add(this.store.state$.subscribe(e=>this.handleFilterFormValidationState(e.isFilterFormValid))),this.subscription.add(this.store.performDocumentSearch$.subscribe(e=>this.handleShowResultClicked(e))),this.subscription.add(this.store.sortingClicked$.subscribe(()=>this.handleSortingSelected())),this.subscription.add(this.store.showMessageClicked$.subscribe(e=>this.handleShowMessageClicked(e))),this.subscription.add(this.store.markAsReadClicked$.subscribe(e=>this.handleMarkAsReadClicked(e))),this.subscription.add(this.store.markAsUnreadClicked$.subscribe(e=>this.handleMarkAsUnreadClicked(e))),this.subscription.add(this.store.deleteMessageClicked$.subscribe(e=>this.handleDeleteMessageClicked(e))),this.subscription.add(this.store.markAsReadChooseActionClicked$.subscribe(()=>this.handleMarkAsReadUnreadChooseActionClicked("read"))),this.subscription.add(this.store.markAsUnreadChooseActionClicked$.subscribe(()=>this.handleMarkAsReadUnreadChooseActionClicked("unread"))),this.subscription.add(this.store.deleteChooseActionClicked$.subscribe(()=>this.handleDeleteChooseActionClicked())),this.subscription.add(this.store.exportToPdfChooseActionClicked$.subscribe(()=>this.handleExportToPdfActionClicked())),this.subscription.add(this.store.resetFiltersButtonClicked$.subscribe(e=>this.handleShowResultClicked(e)));}handleFilterFormValidationState(e){this.isShowResultButtonDisabled=!e;}handleShowResultClicked(e){(this.areFilterValuesChanged(e)||this.isSearchError)&&(this.setFilterValues(e),this.loadBankMessages()),this.resetSelectedMessages();}handleSortingSelected(){this.filterValues&&this.loadBankMessages();}handleShowMessageClicked(e){let t=this.prepareBankMessageForUpdate(e);this.updateBankMessage(t);}prepareBankMessageForUpdate(e){let t=(0, ae.clone)(e);return delete t.links,delete t._id,t}updateBankMessage(e){let t=this.flipMessageStatus(e.status),a=this.changeBankMessageStatus(e.id,t);this.bankMessagesDataService.updateBankMessage(e.id,a).catch(i=>{let s=this.flipMessageStatus(t);this.handleUpdatingBankMessageError(i),this.changeBankMessageStatus(e.id,s);});}changeBankMessageStatus(e,t){let a,i=this.store.state.rawBankMessages.map(s=>(e===s.id&&(s.status=t,a=s),s));return this.store.setState(()=>({rawBankMessages:i})),this.prepareBankMessages(i),a}changeBankMessageStatuses(e,t){let a=this.store.state.rawBankMessages.map(i=>(e.includes(i.id)&&(i.status=t),i));this.store.setState(()=>({rawBankMessages:a})),this.prepareBankMessages(a);}prepareBankMessages(e){let t=this.groupBankMessages(e),a=this.getBankMessagesByItems(t);this.store.setState(()=>({bankMessages:a}));}isSortedByDate(){return this.store.state.selectedSorting.sortingName==="PAGE.BANK_MESSAGES.V2.SORTING.DATE_ASCENDING"||this.store.state.selectedSorting.sortingName==="PAGE.BANK_MESSAGES.V2.SORTING.DATE_DESCENDING"}flipMessageStatus(e){return e==="unread"?"read":"unread"}handleUpdatingBankMessageError(e){this.errorMessages(e.statusText,"BankMessagesMainComponent: Error while marking the bank message as read","PAGE.BANK_MESSAGES.V2.MARK_AS_READ.ERROR");}handleMarkAsReadClicked(e){let t=this.prepareBankMessageForUpdate(e);this.updateBankMessage(t);}handleMarkAsUnreadClicked(e){this.updateMoreBankMessagesStatus([{messageId:e.id,status:"unread"}]);}handleDeleteMessageClicked(e){this.storeLastRemovedBankMessage(e),this.removeBankMessageFromList(e),this.prepareBankMessages(this.store.state.rawBankMessages),this.deleteBankMessage(e);}storeLastRemovedBankMessage(e){let t=this.getRawBankMessageById(e);this.store.setState(()=>({lastRemovedMessages:t}));}getRawBankMessageById(e){return this.store.state.rawBankMessages.find(t=>
2t.id===e)}removeBankMessageFromList(e){let t=this.store.state.rawBankMessages.filter(a=>a.id!==e);this.store.setState(()=>({rawBankMessages:t}));}deleteBankMessage(e){this.bankMessagesDataService.deleteBankMessage(e).then(()=>{this.showDeletionSuccessMessage(),this.reloadPagesAfterDeletion(1);}).catch(t=>{this.restoreLastRemovedBankMessage(),this.handleDeletingBankMessageError(t);});}bulkDeleteMessages(e){this.setActionButtonStateDisabled(true),this.bankMessagesDataService.updateMoreBankMessages(e.map(t=>({messageId:t.id,status:"delete"}))).then(()=>{this.showDeletionSuccessMessage(),this.reloadPagesAfterDeletion(e.length),this.setActionButtonStateDisabled(false),this.store.selectAllAction(false);}).catch(t=>{this.handleDeletingBankMessageError(t),this.setActionButtonStateDisabled(false);let a=(0, ae.unionBy)(this.store.state.rawBankMessages,e,"id");this.store.setState(()=>({bankMessages:this.getBankMessagesByItems(this.groupBankMessages(a))}));});}updateMoreBankMessagesStatus(e){this.setActionButtonStateDisabled(true),this.bankMessagesDataService.updateMoreBankMessages(e).then(()=>{this.changeBankMessageStatuses(e.map(t=>t.messageId),e[0].status),this.setActionButtonStateDisabled(false);}).catch(t=>{this.handleUpdatingBankMessageError(t),this.setActionButtonStateDisabled(false);});}reloadPagesAfterDeletion(e){let t=new ne$1,a=Math.ceil((this.store.state.rawBankMessages.length-e)/this.paginationDefaultNumber)-1,i=this.getBankMessagesPayloadParams(a===0?null:this.nextPageTokenArray[a-1]);this.getBankMessages(i).pipe(we$1(s=>(s.bankMessages=(0, ae.unionBy)(this.store.state.rawBankMessages,s.bankMessages,"id"),this.totalCount=s.next?.totalCount||s.bankMessages.length,this.store.setState(()=>({totalCount:this.totalCount})),this.handleBankMessages(s.bankMessages))),we$1(s=>this.groupBankMessages(s)),we$1(s=>this.getBankMessagesByItems(s)),Mf(t)).subscribe({next:s=>{this.store.setState(()=>({bankMessages:s})),t.next({});},error:s=>(this.handleFetchingBankMessagesError(s),t.next({}),hI([]))});}showDeletionSuccessMessage(){this.alert.success(this.translateService.instant("PAGE.BANK_MESSAGES.V2.DELETE.SUCCESS"));}restoreLastRemovedBankMessage(){let e=this.store.state.rawBankMessages;e.push(this.store.state.lastRemovedMessages),this.store.setState(()=>({rawBankMessages:e})),this.prepareBankMessages(e);}handleDeletingBankMessageError(e){this.errorMessages(e.statusText,"BankMessagesMainComponent: Error while deleting message","PAGE.BANK_MESSAGES.V2.DELETE.ERROR");}loadBankMessages(){this.nextPageToken=null,this.nextPageTokenArray=[];let e=this.getBankMessagesPayloadParams(null),t=new ne$1;this.getBankMessages(e).pipe(Sf(a=>this.handlePagination(a)),we$1(a=>this.handleBankMessages(a.bankMessages)),we$1(a=>this.groupBankMessages(a)),we$1(a=>this.getBankMessagesByItems(a)),Mf(t)).subscribe({next:a=>{this.store.setState(i=>F(E$1({},i),{bankMessages:a})),this.isSearchError=false,t.next({});},error:a=>{this.handleFetchingBankMessagesError(a),this.isSearchError=true,t.next({});}});}loadMoreBankMessages(){let e=this.getBankMessagesPayloadParams(this.nextPageToken);return this.getBankMessages(e).pipe(we$1(t=>(t.bankMessages=this.store.state.rawBankMessages.concat(t.bankMessages),this.handlePagination(t),this.handleBankMessages(t.bankMessages))),we$1(t=>this.groupBankMessages(t)),we$1(t=>this.getBankMessagesByItems(t)),Sf(t=>this.store.setState(()=>({bankMessages:t}))),Sa(t=>this.handleFetchingBankMessagesError(t)))}getBankMessagesPayloadParams(e){let t=this.getSortingParams(),a=this.filterValues.companies.map(s=>s.companyId),i={};return e?i.page_token=e:(i.from_date=Qe(this.filterValues.fromDate).format("YYYY-MM-DD"),i.to_date=Qe(this.filterValues.toDate).format("YYYY-MM-DD"),i.company_id=a,i.sorting=t.sorting,i.sorting_order=t.sortingOrder,i.page_size=this.paginationDefaultNumber),i}getSortingParams(){let e=this.store.state.selectedSorting;return {sorting:e.sortingType,sortingOrder:e.sortingOrder}}areFilterValuesChanged(e){return this.areCompaniesValuesChanged(e)||this.filterValues?.fromDate!==e.fromDate||this.filterValues?.toDate!==e.toDate}setFilterValues(e){this.filterValues=e;}initialDataLoading(){let e=new ne$1;this.dataAccounts.get().pipe(Sf(()=>this.showSpinner(true)),_f(t=>{if(!t||t.length===0||this.filterAccountsByAccessPermission(t)?.length===0)return this.showNoAccountsEmptyState(true),this.showSpinner(false),hI(null);this.handleAccounts(t);let a=this.getInitialParams(),i={companies:[this.store.state.companies[0]],fromDate:a.from_date,toDate:a.to_date};return this.setFilterValues(i),this.getBankMessages(a)}),Vn(t=>t!==null),Sf(t=>this.handlePagination(t)),we$1(t=>this.handleBankMessages(t.bankMessages)),we$1(t=>this.groupBankMessages(t)),we$1(t=>this.getBankMessagesByItems(t)),Sf(()=>this.showSpinner(false)),Mf(e)).subscribe({next:t=>{this.store.setState(()=>({bankMessages:t})),e.next({});},error:t=>(this.handleFetchingBankMessagesError(t),e.next({}),hI([]))});}handleAccounts(e){this.setAccountList(e),this.createCompanies(),this.store.setState(()=>({accounts:e}));}setAccountList(e){this.accountList=e;}createCompanies(){let e=this.groupAccountsByCustomerNumber(),t=this.getCompanies(e);t=this.sortCompanies(t),t.length>0&&this.store.setState(a=>({companies:t,filters:F(E$1({},a.filters),{company:t[0],companies:[t[0]]})}));}groupAccountsByCustomerNumber(){return (0, ae.groupBy)(this.accountList,e=>e.owner.customerNumber)}getCompanies(e){return Object.entries(e).map(([t,a])=>({name:a[0].owner.name,companyId:a[0].owner.customerNumber,numberOfAccounts:a.length}))}sortCompanies(e){return (0, ae.sortBy)(e,"name")}getBankMessages(e){return this.bankMessagesDataService.clearCache(),this.bankMessagesDataService.get(e)}getInitialParams(){return {from_date:Qe(this.dateTimeService.getMonthAgoDate(this.dateTimeService.getCurrentDate())).format("YYYY-MM-DD"),to_date:Qe(this.dateTimeService.getCurrentDate()).format("YYYY-MM-DD"),company_id:[this.store.state.companies[0].companyId],sorting:"date",sorting_order:"descending"}}handleBankMessages(e){return this.checkNumberOfMessages(e),this.store.setState(()=>({rawBankMessages:e})),e}handlePagination(e){this.totalCount=e.next?.totalCount||e.bankMessages.length,this.store.setState(()=>({totalCount:this.totalCount})),this.nextPageToken=e.next?.nextPageToken,this.nextPageToken&&!this.nextPageTokenArray.includes(this.nextPageToken)&&this.nextPageTokenArray.push(this.nextPageToken);}filterAccountsByAccessPermission(e){return e.filter(t=>t.rights&&t.rights.accessPermission)}groupBankMessages(e){return this.isSortedByDate()?this.groupBankMessagesByDate(e):this.sortBankMessagesBy(e)}groupBankMessagesByDate(e){let t={};return e.forEach(a=>{let i=this.getBankMessagesGroupName(this.getBankMessageDate(a));t[i]||(t[i]=[]),t[i].push(a);}),t}getBankMessagesGroupName(e){return this.dateUtils.formatDate(e,"MMMM yyyy").replace(/\w\S*/g,a=>a[0].toUpperCase()+a.slice(1).toLowerCase())}sortBankMessagesBy(e){let t=this.getSortingParams(),a=this.getSortingType(t.sorting),i=t.sortingOrder==="descending"?"desc":"asc";return (0, ae.orderBy)(e,[a],[i])}getSortingType(e){let t;switch(e){case "account":t="accountIdReference";break;case "description":t="description";break;default:t=e;}return t}getBankMessagesByItems(e){return this.isSortedByDate()?this.getBankMessagesWithHeaders(e):this.getBankMessagesWithoutHeaders(e)}getBankMessagesWithHeaders(e){let t=[];return Object.keys(e).forEach(a=>{t.push({itemType:"header",name:a}
2),e[a].forEach(i=>{t.push({itemType:"item",path:"",id:i.id,status:i.status,date:this.getBankMessageDate(i),descriptionShort:i.descriptionShort,accountName:this.getAccountName(i),accountNumber:this.getAccountNumber(i),links:i.links});});}),t}getBankMessagesWithoutHeaders(e){return e.map(t=>({itemType:"item",path:"",id:t.id,status:t.status,date:this.getBankMessageDate(t),descriptionShort:t.descriptionShort,accountName:this.getAccountName(t),accountNumber:this.getAccountNumber(t),links:t.links}))}getBankMessageDate(e){return e.date&&typeof e.date.toDate=="function"?e.date.toDate():Qe(e.date).toDate()}handleFetchingBankMessagesError(e){return this.errorMessages(e.statusText,"BankMessagesComponent: Error while getting the bank messages","PAGE.BANK_MESSAGES.V2.ERROR"),this.showSpinner(false),mI(()=>e)}errorMessages(e,t,a){this.bankMessagesLogService.error(t,e,a);}showSpinner(e){this.showSpinner$.next(e);}checkNumberOfMessages(e){e.length===0?this.showNoMessagesEmptyState(true):this.showNoMessagesEmptyState(false);}showNoMessagesEmptyState(e){this.showNoMessagesEmptyState$.next(e);}showNoAccountsEmptyState(e){this.showNoAccountsEmptyState$.next(e);}getAccountName(e){return e.accountIdReference?this.accountList.find(t=>t.id===e.accountIdReference)?.getName():""}getAccountNumber(e){let t="";return e.accountIdReference&&(t=this.accountList.find(a=>a.id===e.accountIdReference)?.getNumber()),!t&&e.accountNumber&&(t=e.accountNumber),t}handleMarkAsReadUnreadChooseActionClicked(e){this.updateMoreBankMessagesStatus(this.getSelectedBankMessagesToUpdateStatus(e));}getSelectedBankMessagesToUpdateStatus(e){return this.store.state.rawBankMessages.filter(a=>this.store.state.selectedBankMessages.some(i=>i.messageId===a.id)).map(a=>({messageId:a.id,status:e}))}handleDeleteChooseActionClicked(){let e=this.getSelectedBankMessagesToDelete(),t=this.store.state.rawBankMessages.filter(a=>!e.some(i=>a.id===i.id));this.store.setState(()=>({rawBankMessages:t})),this.bulkDeleteMessages(e);}getSelectedBankMessagesToDelete(){return this.store.state.rawBankMessages.filter(e=>this.store.state.selectedBankMessages.some(t=>t.messageId===e.id))}handleExportToPdfActionClicked(){this.setActionButtonStateDisabled(true),Promise.all(this.getSelectedBankMessagesToExport().map(e=>this.bankMessagesExportService.export(e))).then(()=>this.setActionButtonStateDisabled(false)).catch(()=>this.setActionButtonStateDisabled(false));}getSelectedBankMessagesToExport(){return this.store.state.rawBankMessages.filter(e=>this.store.state.selectedBankMessages.some(t=>t.messageId===e.id))}setActionButtonStateDisabled(e){this.store.setState(()=>({isChooseActionButtonDisabled:e}));}areCompaniesValuesChanged(e){return e.companies.length===this.filterValues?.companies?.length?!e.companies.every((t,a)=>t.companyId===this.filterValues?.companies[a].companyId):true}resetSelectedMessages(){this.store.selectAllAction(false);}static{this.\u0275fac=function(t){return new(t||n)(Do$1(da),Do$1(ue),Do$1(h),Do$1(G),Do$1(K),Do$1(S$1),Do$1(he),Do$1(V),Do$1(E$3),Do$1(st))};}
2static{this.\u0275cmp=qT({type:n,selectors:[["cib-bank-messages"]],standalone:false,decls:13,vars:14,consts:[[3,"loading","loadAnnouncement"],[3,"showFilter"],["formId","cibBankMessagesFiltersPanel",3,"executionSearchButtonClick","executionSearch","disableSearchButton"],[3,"notifyLoadMoreBankMessages"],["translate",""]],template:function(t,a){t&1&&(ky(0,"cib-bank-messages-info"),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 a.onSubmit()}),ky(6,"bank-messages-filters-panel"),rd(),Ms(7,"ebank-main-content"),ky(8,"bank-messages-filters-chips"),mC(9,ws,2,1),N_(10,"async"),N_(11,"async"),nd(12,Gs,5,6,"ebank-empty-state"),rd()()()),t&2&&(mb(),Ry("loading",R_(2,6,a.showSpinner$))("loadAnnouncement",R_(3,8,"PAGE.BANK_MESSAGES.V2.LOADING")),mb(3),Ry("showFilter",true),mb(),Ry("executionSearch",true)("disableSearchButton",a.isShowResultButtonDisabled),mb(4),gC(R_(10,10,a.showNoMessagesEmptyState$)===false&&R_(11,12,a.showNoAccountsEmptyState$)===false?9:12));},dependencies:[Te,Ys$1,Nf,Rf,X9,mg,v6,sN,ha,ka,ba,_a,va,mn,ye],encapsulation:2,changeDetection:1});}};function js(n,e){n&1&&ky(0,"pib-bank-messages");}function Us(n,e){n&1&&ky(0,"cib-bank-messages");}var Ba=class n{constructor(e){this.context=e;this.isCorporate=this.context.isCorporate;}static{this.\u0275fac=function(t){return new(t||n)(Do$1(P))};}
2static{this.\u0275cmp=qT({type:n,selectors:[["bank-messages-dispatcher"]],standalone:false,decls:2,vars:2,template:function(t,a){t&1&&(mC(0,js,1,0,"pib-bank-messages"),mC(1,Us,1,0,"cib-bank-messages")),t&2&&(gC(a.isCorporate?-1:0),mb(),gC(a.isCorporate?1:-1));},dependencies:[ma,Ea],encapsulation:2,changeDetection:1});}};var ne=N(ep());pi();Be();vM();da$1();he$1();pi();vM();var Ne=class n{constructor(){this.config={increment:25};this.numPaging=500;this.limit=new br(0);this.isExternalPaging=new br(false);this.companyName=new br("");this.loading=new br(true);}setLimit(e){this.limit.next(e);}setLoading(e){this.loading.next(e);}setCompanyName(e){this.companyName.next(e);}setIsExternalPaging(e){this.isExternalPaging.next(e);}static{this.\u0275fac=function(t){return new(t||n)};}static{this.\u0275prov=X({token:n,factory:n.\u0275fac,providedIn:"root"});}};W();N$1();na();pi();vM();W();he$1();$n();var Ks=()=>({folder:"MAIL:INBOX"}),Ii=n=>({count:n}),$s=()=>({folder:"MAIL:INBOX.Sent"}),Ys=()=>({folder:"MAIL:INBOX.Trash"}),Aa=class n{constructor(e,t){this.dataMessageCount=e;this.log=t;this.inboxCount=0;this.inboxKeyMapping={"=0":"MODULE.DIALOGUE.INBOX.COUNT.NONE",other:"MODULE.DIALOGUE.INBOX.COUNT.PLURAL"};this.bankMessagesKeyMapping={"=0":"MODULE.DIALOGUE.BANK_MESSAGES.COUNT.NONE",other:"MODULE.DIALOGUE.BANK_MESSAGES.COUNT.PLURAL"};this.componentDestroy=new ne$1;}ngOnInit(){let e=this.dataMessageCount.get();e?e.pipe(Mf(this.componentDestroy)).subscribe(t=>{this.inboxCount=t.number;},t=>{this.log.error("something wrong happened while fetching messagecount",t);}):this.log.error("observable for dialogue tabs is not defined");}ngOnDestroy(){this.componentDestroy.next(true),this.componentDestroy.complete();}static{this.\u0275fac=function(t){return new(t||n)(Do$1(n$1),Do$1(E$2))};}
2static{this.\u0275cmp=qT({type:n,selectors:[["dialogue-tabs"]],inputs:{bankMessagesCount:"bankMessagesCount"},standalone:false,decls:18,vars:24,consts:[[1,"folder-select-wrap"],[1,"nav","nav-tabs"],["role","presentation",1,"inbox"],["sbLink","URL.PAGE.DIALOGUE",3,"sbLinkParams"],["role","presentation",1,"sent"],["sbLink","URL.PAGE.DIALOGUE","translate","",3,"sbLinkParams"],["role","presentation",1,"trash"],["role","presentation",1,"active","bank-messages"],["sbLink","URL.PAGE.BANKMESSAGES"]],template:function(t,a){t&1&&(Ms(0,"div",0)(1,"ul",1)(2,"li",2)(3,"a",3),c_(4),N_(5,"i18nPlural"),N_(6,"translate"),rd()(),Ms(7,"li",4)(8,"a",5),c_(9,"MODULE.DIALOGUE_TABS.SENT_FOLDER"),rd()(),Ms(10,"li",6)(11,"a",5),c_(12,"MODULE.DIALOGUE_TABS.TRASH_FOLDER"),rd()(),Ms(13,"li",7)(14,"a",8),c_(15),N_(16,"i18nPlural"),N_(17,"translate"),rd()()()()),t&2&&(mb(3),Ry("sbLinkParams",b_(17,Ks)),mb(),cd(" ",k_(6,8,k_(5,5,a.inboxCount,a.inboxKeyMapping),T_(18,Ii,a.inboxCount))," "),mb(4),Ry("sbLinkParams",b_(20,$s)),mb(3),Ry("sbLinkParams",b_(21,Ys)),mb(4),cd(" ",k_(17,14,k_(16,11,a.bankMessagesCount,a.bankMessagesKeyMapping),T_(22,Ii,a.bankMessagesCount))," "));},dependencies:[Te,g$1,Sn,ye],encapsulation:2,changeDetection:1});}};$N();var z=N(ep());pi();vM();he$1();J();N$1();$n();vM();vM();var Da=class n{constructor(){this.accountsUtil=D(C);}transform(e,t=false){return this.accountsUtil.accountNumberFormat(e,t,true)}static{this.\u0275fac=function(t){return new(t||n)};}static{this.\u0275pipe=QT({name:"accountNumberAriaFormat",type:n,pure:true});}};var Xs=(n,e,t,a)=>({first:n,last:e,unread:t,read:a});function zs(n,e){if(n&1&&(Ms(0,"div",8),N_(1,"dateFormat"),Ms(2,"div",19),c_(3),N_(4,"monthNameShort"),rd(),Ms(5,"div",20),c_(6),rd(),Ms(7,"div",21),c_(8),rd()()),n&2){let t=RC().$implicit;Ry("ngClass",t.status),Ay("aria-label",k_(1,5,t.date,"ARIA")),mb(3),cv(R_(4,8,t.date)),mb(3),cv(t.date.date()),mb(2),cv(t.date.year());}}function Qs(n,e){if(n&1&&(Ms(0,"span",12),c_(1),rd()),n&2){let t=RC().$implicit;mb(),cv(t.accountName);}}function qs(n,e){n&1&&(Ms(0,"span",13),c_(1,"COMPONENTS.BANK_MESSAGES_LIST.SEPARATOR"),rd());}function Js(n,e){if(n&1&&(Ms(0,"span",14),N_(1,"accountNumberAriaFormat"),c_(2),N_(3,"accountNumberFormat"),rd()),n&2){let t=RC().$implicit;Ay("aria-label",R_(1,2,t.accountNumber)),mb(2),cv(R_(3,4,t.accountNumber));}}function Zs(n,e){if(n&1&&(Ms(0,"div",15)(1,"div",8),N_(2,"dateFormat"),c_(3),N_(4,"dateFormat"),rd()()),n&2){let t=RC().$implicit;mb(),Ry("ngClass",t.status),Ay("aria-label",k_(2,3,t.date,"ARIA")),mb(2),cd(" ",R_(4,6,t.date)," ");}}function eo(n,e){if(n&1){let t=CC();Ms(0,"button",22),N_(1,"async"),qy("click",function(){yh(t);let i=RC().$implicit,s=RC(2);return vh(s.documentOpened(i))}),ky(2,"loading-spinner",23),N_(3,"async"),Ms(4,"span",24),c_(5,"COMPONENTS.BANK_MESSAGES_LIST.MENU_ITEM.DOCUMENT"),rd()();}if(n&2){let t=RC(3);Ry("disabled",R_(1,2,t.loadingOperations)===true),mb(2),Ry("loading",R_(3,4,t.loadingDocumentOpened)===true);}}function to(n,e){if(n&1){let t=CC();Ms(0,"button",25),N_(1,"async"),qy("click",function(){yh(t);let i=RC().$implicit,s=RC(2);return vh(s.markAsRead(i))}),ky(2,"loading-spinner",23),N_(3,"async"),Ms(4,"span",24),c_(5,"COMPONENTS.BANK_MESSAGES_LIST.MENU_ITEM.MARK_READ"),rd()();}if(n&2){let t=RC(3);Ry("disabled",R_(1,2,t.loadingOperations)===true),mb(2),Ry("loading",R_(3,4,t.loadingMarkAsRead)===true);}}function ao(n,e){if(n&1){let t=CC();Ms(0,"button",26),N_(1,"async"),qy("click",function(){yh(t);let i=RC().$implicit,s=RC(2);return vh(s.delete(i.id))}),ky(2,"loading-spinner",23),N_(3,"async"),Ms(4,"span",24),c_(5,"COMPONENTS.BANK_MESSAGES_LIST.MENU_ITEM.DELETE"),rd()();}if(n&2){let t=RC(3);Ry("disabled",R_(1,2,t.loadingOperations)===true),mb(2),Ry("loading",R_(3,4,t.loadingDelete)===true);}}function no(n,e){if(n&1&&(Ms(0,"sb-expansion",4)(1,"sb-expansion-header"),ky(2,"div",7),N_(3,"translate"),mC(4,zs,9,10,"div",8),Ms(5,"div",9)(6,"div",10)(7,"span"),c_(8),rd()(),Ms(9,"div",11),mC(10,Qs,2,1,"span",12),mC(11,qs,2,0,"span",13),mC(12,Js,4,6,"span",14),rd()(),mC(13,Zs,5,8,"div",15),rd(),Ms(14,"sb-expansion-content")(15,"sb-expansion-action-row"),mC(16,eo,6,6,"button",16),mC(17,to,6,6,"button",17),mC(18,ao,6,6,"button",18),rd()()()),n&2){let t=e.$implicit,a=e.$index,i=e.$count,s=RC(2);Ry("ngClass",M_(17,Xs,a===0,a===i-1,t.status==="unread",t.status==="read"))("id",t.id)("expanded",t.defaultExpanded),mb(2),Ry("ngClass",t.status),Ay("aria-label",R_(3,15,"COMPONENTS.BANK_MESSAGES_LIST.MENU_ITEM."+t.status.toUpperCase())),mb(2),gC(s.dateFloatedRight===false?4:-1),mb(2),Ry("ngClass",t.status),mb(2),cv(t.descriptionShort),mb(2),gC(t.accountName?10:-1),mb(),gC(t.accountName&&t.accountNumber?11:-1),mb(),gC(t.accountNumber?12:-1),mb(),gC(s.dateFloatedRight===true?13:-1),mb(3),gC(t.documentLink?16:-1),mb(),gC(t.showMarkAsRead?17:-1),mb(),gC(t.showDelete?18:-1);}}function io(n,e){if(n&1){let t=CC();Ms(0,"div",0)(1,"div",2),pv("limitChange",function(i){yh(t);let s=RC();return f_(s.limit,i)||(s.limit=i),vh(i)}),qy("externalPaging",function(){yh(t);let i=RC();return vh(i.externalPaging())}),Ms(2,"accordion-list-wrapper")(3,"div",3),IC(4,no,19,22,"sb-expansion",4,vC),N_(6,"slice"),rd(),Ms(7,"div",5)(8,"infinite-scroll-load-more-button",6),N_(9,"async"),qy("loadM
2oreClick",function(){yh(t);let i=RC();return vh(i.externalPaging())}),rd()()()()();}if(n&2){let t=RC();mb(),Ry("list",t.bankMessageItems),fv("limit",t.limit),Ry("config",t.config),mb(3),EC(O_(6,4,t.bankMessageItems,0,t.limit)),mb(4),Ry("hidden",!t.limit||t.limit>t.bankMessageItems.length||R_(9,8,t.bankMessagesService.loading));}}var ya=class n{constructor(e,t,a,i,s,E,P){this._forwardLinkService=e;this._dataBankMessages=t;this.bankMessagesService=a;this._translate=i;this._context=s;this._alert=E;this.bankMessageItems=[];this.dateFloatedRight=false;this.loadingDocumentOpened=new br(false);this.loadingMarkAsRead=new br(false);this.loadingDelete=new br(false);this._limitSubscription=new H;this._bankMessagesConfig=P.config;}ngOnChanges(e){e.bankMessages&&e.bankMessages.currentValue&&(this.bankMessageItems=this._prepareBankMessages(this.accountList,e.bankMessages.currentValue));}ngOnInit(){this.loadingOperations=CI(this.loadingMarkAsRead,this.loadingDelete,this.loadingDocumentOpened).pipe(we$1(e=>e.includes(true))),this.dateFloatedRight=this._bankMessagesConfig.dateFloatedRight,this.config=this.bankMessagesService.config,this._limitSubscription=this.bankMessagesService.limit.subscribe(e=>{this.limit=e;});}ngOnDestroy(){this._limitSubscription&&this._limitSubscription.unsubscribe();}externalPaging(){this.limit%this.bankMessagesService.numPaging||!this._bankMessagesConfig.showFilter?this.bankMessagesService.setLimit(this.limit+this.bankMessagesService.config.increment):(this.bankMessagesService.setLimit(this.limit),this.bankMessagesService.setIsExternalPaging(true));}documentOpened(e){if(this._forwardLinkService.open(e.documentLink),e.showMarkAsRead){let t=this._getBankMessageForUpdate(e,"read");this.loadingDocumentOpened.next(true),this._dataBankMessages.updateBankMessage(t.id,t).catch(a=>{this._alert.serverError(a,"COMPONENTS.BANK_MESSAGES_LIST.MARK_READ.ERROR");}).then(()=>{this.loadingDocumentOpened.next(false);});}}markAsRead(e){let t=this._getBankMessageForUpdate(e,"read");this.loadingMarkAsRead.next(true),this._dataBankMessages.updateBankMessage(t.id,t).then(()=>{this._alert.success("COMPONENTS.BANK_MESSAGES_LIST.MARK_READ.SUCCESS");}).catch(a=>{this._alert.serverError(a,"COMPONENTS.BANK_MESSAGES_LIST.MARK_READ.ERROR");}).then(()=>{this.loadingMarkAsRead.next(false);});}delete(e){this.loadingDelete.next(true),this._dataBankMessages.deleteBankMessage(e).then(()=>{this._alert.success("COMPONENTS.BANK_MESSAGES_LIST.DELETE.SUCCESS");}).catch(t=>{this._alert.serverError(t,"COMPONENTS.BANK_MESSAGES_LIST.DELETE.ERROR");}).then(()=>{this.loadingDelete.next(false);});}_prepareBankMessages(e,t){return t.map(i=>{let s={id:(0, z.get)(i,"id"),accountIdReference:(0, z.get)(i,"accountIdReference"),defaultExpanded:false,accountNumber:(0, z.get)(i,"accountNumber"),status:(0, z.get)(i,"status"),date:(0, z.get)(i,"date"),type:(0, z.get)(i,"type"),descriptionShort:this._context.isCorporate&&(0, z.get)(i,"type")?this._translate.instant("PAGE.BANK_MESSAGES.DOCUMENT_TYPE."+(0, z.get)(i,"type").toUpperCase()):(0, z.get)(i,"descriptionShort"),description:(0, z.get)(i,"description"),showMarkAsUnread:i.hasLink("self","PUT")&&i.status==="read",showMarkAsRead:i.hasLink("self","PUT")&&i.status==="unread",showDelete:i.hasLink("self","DELETE")};if(i.hasLink("document")&&(s.documentLink=(0, z.get)(i,"links.document.href")),s.accountIdReference){let E=e.find(P=>P.id===s.accountIdReference);E&&(s.accountName=E.getName(),s.accountNumber=E.getNumber());}return s})}_getBankMessageForUpdate(e,t){let a=(0, z.clone)(this.bankMessages.find(i=>i.id===e.id));return a.status=t,delete a.links,delete a._id,a}static{this.\u0275fac=function(t){return new(t||n)(Do$1(x),Do$1(ge),Do$1(Ne),Do$1(V),Do$1(P),Do$1(E$3),Do$1(r))};}
2static{this.\u0275cmp=qT({type:n,selectors:[["bank-messages-list"]],viewQuery:function(t,a){if(t&1&&Qy(p$2,5),t&2){let i;FC(i=jC())&&(a.infiniteScrollDirective=i.first);}},inputs:{bankMessages:"bankMessages",accountList:"accountList"},standalone:false,features:[uD],decls:3,vars:4,consts:[[1,"bank-messages-list-wrapper"],["id","loading",3,"loading"],["infiniteScroll","",3,"limitChange","externalPaging","list","limit","config"],[1,"bank-messages-list"],[3,"ngClass","id","expanded"],[1,"bank-messages-load-more"],["id","infiniteScrollLoadMoreButton",3,"loadMoreClick","hidden"],["aria-hidden","false",1,"status",3,"ngClass"],[1,"date",3,"ngClass"],[1,"left-content"],[1,"type-name",3,"ngClass"],[1,"account"],[1,"account-name"],["translate","",1,"separator"],[1,"account-number"],[1,"right-content"],["sbExpansionActionButton","","role","link",1,"document-action",3,"disabled"],["sbExpansionActionButton","",1,"mark-read-action",3,"disabled"],["sbExpansionActionButton","",1,"delete-action",3,"disabled"],[1,"month"],[1,"day"],[1,"year"],["sbExpansionActionButton","","role","link",1,"document-action",3,"click","disabled"],[3,"loading"],["translate",""],["sbExpansionActionButton","",1,"mark-read-action",3,"click","disabled"],["sbExpansionActionButton","",1,"delete-action",3,"click","disabled"]],template:function(t,a){t&1&&(mC(0,io,10,10,"div",0),ky(1,"loading-spinner",1),N_(2,"async")),t&2&&(gC(a.bankMessageItems&&a.bankMessageItems.length>0?0:-1),mb(),Ry("loading",R_(2,2,a.bankMessagesService.loading)));},dependencies:[dn,Te,b,p$1,l,z$1,l$1,d,m,p$2,I,mn,Tn,ye,p$3,Da,s,o$1],encapsulation:2,changeDetection:1});}};vM();var Ha=N(ep());Be();pi();vM();da$1();na();he$1();$N();$n();var oo=["bmlForm"],xa=n=>({date:n});function ro(n,e){n&1&&(Ms(0,"div",17),c_(1," COMPONENTS.BANK_MESSAGES_FILTER.DATE_FIELD.ERROR.REQUIRED_FROM "),rd());}function co(n,e){n&1&&(Ms(0,"div",18),c_(1," COMPONENTS.BANK_MESSAGES_FILTER.DATE_FIELD.ERROR.FORMAT "),rd());}function lo(n,e){if(n&1&&(Ms(0,"div",19),c_(1," COMPONENTS.BANK_MESSAGES_FILTER.DATE_FIELD.ERROR.MAXDATE "),rd()),n&2){let t=RC(3);Ry("translateParams",T_(1,xa,t.maxDateFrom?t.maxDateFrom.format("DD.MM.YYYY"):t.today.format("DD.MM.YYYY")));}}function mo(n,e){if(n&1&&(Ms(0,"div",20),c_(1," COMPONENTS.BANK_MESSAGES_FILTER.DATE_FIELD.ERROR.MINDATE "),rd()),n&2){let t=RC(3);Ry("translateParams",T_(1,xa,t.minDateFrom.format("DD.MM.YYYY")));}}function po(n,e){n&1&&(Ms(0,"div",24),c_(1," COMPONENTS.BANK_MESSAGES_FILTER.DATE_FIELD.ERROR.REQUIRED_TO "),rd());}function go(n,e){n&1&&(Ms(0,"div",25),c_(1," COMPONENTS.BANK_MESSAGES_FILTER.DATE_FIELD.ERROR.FORMAT "),rd());}function uo(n,e){if(n&1&&(Ms(0,"div",26),c_(1," COMPONENTS.BANK_MESSAGES_FILTER.DATE_FIELD.ERROR.MAXDATE "),rd()),n&2){let t=RC(3);Ry("translateParams",T_(1,xa,t.today.format("DD.MM.YYYY")));}}function ho(n,e){if(n&1&&(Ms(0,"div",27),c_(1," COMPONENTS.BANK_MESSAGES_FILTER.DATE_FIELD.ERROR.MINDATE "),rd()),n&2){let t=RC(3);Ry("translateParams",T_(1,xa,t.minDateTo.format("DD.MM.YYYY")));}}function So(n,e){if(n&1&&(Ms(0,"option",31),c_(1),N_(2,"translate"),rd()),n&2){let t=e.$implicit;Ry("ngValue",t),mb(),cd(" ",R_(2,2,t.name)," ");}}function fo(n,e){if(n&1){let t=CC();Ms(0,"div",5)(1,"div",12)(2,"div",13)(3,"label",14),c_(4,"COMPONENTS.BANK_MESSAGES_FILTER.DATE_FIELD.FROM.LABEL"),rd(),Ms(5,"div")(6,"dp-date-picker",15,2),N_(8,"translate"),qy("onChange",function(){yh(t);let i=HC(19),s=RC(2);return vh(s.handleDateChange("fromDate",i.errors))}),pv("ngModelChange",function(i){yh(t);let s=RC(2);return f_(s.model.chosenDateFrom,i)||(s.model.chosenDateFrom=i),vh(i)}),rd(),tT(),Ms(9,"div",16),mC(10,ro,2,0,"div",17),mC(11,co,2,0,"div",18),mC(12,lo,2,3,"div",19),mC(13,mo,2,3,"div",20),rd()()(),Ms(14,"div",13)(15,"label",21),c_(16,"COMPONENTS.BANK_MESSAGES_FILTER.DATE_FIELD.TO.LABEL"),rd(),Ms(17,"div")(18,"dp-date-picker",22,3),N_(20,"translate"),qy("onChange",function(){yh(t);let i=HC(19),s=RC(2);return vh(s.handleDateChange("toDate",i.errors))}),pv("ngModelChange",function(i){yh(t);let s=RC(2);return f_(s.model.chosenDateTo,i)||(s.model.chosenDateTo=i),vh(i)}),rd(),tT(),Ms(21,"div",23),mC(22,po,2,0,"div",24),mC(23,go,2,0,"div",25),mC(24,uo,2,3,"div",26),mC(25,ho,2,3,"div",27),rd()()()(),Ms(26,"div",28)(27,"div",7)(28,"label",29),c_(29,"COMPONENTS.BANK_MESSAGES_FILTER.SORTING.CRITERIA"),rd(),Ms(30,"select",30),pv("ngModelChange",function(i){yh(t);let s=RC(2);return f_(s.model.selectedSortingCriteria,i)||(s.model.selectedSortingCriteria=i),vh(i)}),qy("change",function(){yh(t);let i=RC(2);return vh(i.handleSortingChange())}),IC(31,So,3,4,"option",31,vC),rd(),tT(),rd()()();}if(n&2){let t=HC(7),a=HC(19),i=RC(2);mb(6),Ry("config",i.dateConfigFrom)("minDate",i.minDateFrom)("maxDate",i.maxDateFrom?i.maxDateFrom:i.today),fv("ngModel",i.model.chosenDateFrom),Ry("placeholder",R_(8,20,"COMPONENTS.BANK_MESSAGES_FILTER.DATE_FIELD.PLACEHOLDER")),nT(),mb(4),gC(t.errors?.required?10:-1),mb(),gC(t.errors?.format?11:-1),mb(),gC(t.errors?.maxDate?12:-1),mb(),gC(t.errors?.minDate?13:-1),mb(5),Ry("config",i.dateConfigTo)("minDate",i.minDateTo)("maxDate",i.today),fv("ngModel",i.model.chosenDateTo),Ry("placeholder",R_(20,22,"COMPONENTS.BANK_MESSAGES_FILTER.DATE_FIELD.PLACEHOLDER")),nT(),mb(4),gC(a.errors?.required?22:-1),mb(),gC(a.errors?.format?23:-1),mb(),gC(a.errors?.maxDate?24:-1),mb(),gC(a.errors?.minDate?25:-1),mb(5),Ry("compareWith",i.compareFn),fv("ngModel",i.model.selectedSortingCriteria),nT(),mb(),EC(i.sortingCriteriaList);}}function ko(n,e){if(n&1){let t=CC();Ms(0,"div")(1,"form",4,0)(3,"div",5)(4,"div",6)(5,"div",7)(6,"label",8),c_(7,"COMPONENTS.ACCOUNTOWNERS_TYPEAHEAD.LABEL"),rd(),Ms(8,"account-owners-typeahead",9),qy("selectEvent",function(){yh(t);let i=RC();return vh(i.handleAccountOwnersChange())}),Ms(9,"input",10,1),pv("ngModelChange",function(i){yh(t);let s=RC();return f_(s.model.selectedAccountOwner,i)||(s.model.selectedAccountOwner=i),vh(i)}),rd(),tT(),rd(),Ms(11,"validation-error-wrapper"),ky(12,"validation-error-message",11),rd()()()(),mC(13,fo,33,24,"div",5),rd()();}if(n&2){let t=HC(10),a=RC();mb(8),Ry("accountOwners",a.accountOwners)("selectedAccountOwners",a.model.selectedAccountOwner),mb(),Ry("sbTypeahead",void 0),fv("ngModel",a.model.selectedAccountOwner),nT(),mb(3),Ry("field",t),mb(),gC(a.isDisplaySort?13:-1);}}var Ta=class n{constructor(e,t,a,i,s,E){this._router=e;this._activatedRoute=t;this._datePickerService=a;this._bankMessagesService=i;this._accountOwnersTypeaheadService=s;this.accountList=[];this.searchEvent=new ct;this.today=Qe().endOf("day");this.model={chosenDateFrom:null,chosenDateTo:null,selectedSortingCriteria:null,
2selectedAccountOwner:null};this.accountOwners=[];this.sortingCriteriaList=[{name:"COMPONENTS.BANK_MESSAGES_FILTER.SORTING.DATE.ASCENDING",criteria:"date",order:"ascending"},{name:"COMPONENTS.BANK_MESSAGES_FILTER.SORTING.DATE.DESCENDING",criteria:"date",order:"descending"},{name:"COMPONENTS.BANK_MESSAGES_FILTER.SORTING.TYPE.ASCENDING",criteria:"type",order:"ascending"},{name:"COMPONENTS.BANK_MESSAGES_FILTER.SORTING.TYPE.DESCENDING",criteria:"type",order:"descending"},{name:"COMPONENTS.BANK_MESSAGES_FILTER.SORTING.ACCOUNT.ASCENDING",criteria:"account",order:"ascending"},{name:"COMPONENTS.BANK_MESSAGES_FILTER.SORTING.ACCOUNT.DESCENDING",criteria:"account",order:"descending"},{name:"COMPONENTS.BANK_MESSAGES_FILTER.SORTING.STATUS.ASCENDING",criteria:"status",order:"ascending"},{name:"COMPONENTS.BANK_MESSAGES_FILTER.SORTING.STATUS.DESCENDING",criteria:"status",order:"descending"}];this.dateParamFormat="YYYY-MM-DD";this.defaultParams={fromDate:Qe().subtract(1,"month").format(this.dateParamFormat),toDate:Qe().format(this.dateParamFormat),sorting:"date",sortingOrder:"descending",companyId:null};this.searchParams={};this.isInitVariables=new br(false);this.isDisplaySort=false;this._activatedRouteSubscription=new H;this._limitSubscription=new H;this._formSubscription=new H;this._externalPagingSubscription=new H;this._viewCheckedDone=false;this._bankMessagesConfig=E.config;}ngOnInit(){this.dateConfigTo=this._datePickerService.set({max:this.today}),this.dateConfigFrom=this._datePickerService.set({max:this.today}),this._externalPagingSubscription=this._bankMessagesService.isExternalPaging.subscribe(e=>{e&&this.onSearch(true);}),this._limitSubscription=this._bankMessagesService.limit.subscribe(e=>{this._limit=e;});}ngOnChanges(e){e.accountList&&e.accountList.currentValue&&(this._initAccountOwners(),this._activatedRouteSubscription=this._activatedRoute.queryParams.subscribe(t=>{let a={fromDate:t&&t.fromDate,toDate:t&&t.toDate,sorting:t&&t.sorting,sortingOrder:t&&t.sortingOrder,companyId:t&&t.companyId};Object.entries(a).forEach(([i,s])=>{this._setSearchParam(i,s);}),this.model={chosenDateFrom:Qe(this.searchParams.fromDate,this.dateParamFormat).startOf("day"),chosenDateTo:Qe(this.searchParams.toDate,this.dateParamFormat).endOf("day"),selectedSortingCriteria:this.sortingCriteriaList.find(i=>i.criteria===this.searchParams.sorting&&i.order===this.searchParams.sortingOrder),selectedAccountOwner:this._getAccountOwner(this.searchParams.companyId)},this._bankMessagesService.setCompanyName(this.model.selectedAccountOwner.name),this.isDisplaySort=this.accountList.filter(i=>i.owner.name===this.model.selectedAccountOwner.name).length>=this._bankMessagesConfig.minAccountsLength,this._bmlForm?.valid&&this.onSearch(),this.isInitVariables.next(true);}));}handleDateChange(e,t){if(this.shouldStopProceedDateChange(t))return;let{chosenDateFrom:a,chosenDateTo:i}=this.model;e==="fromDate"&&this.isFromDateEqualToPrevious(a)||e==="toDate"&&this.isToDateEqualToPrevious(i)||(this.setCurrentDateFrom(e,a),this.setCurrentDateTo(e,i),this._configDate(e),Qe.isDayjs(a)&&this._setQueryParams({fromDate:a.format(this.dateParamFormat)}),Qe.isDayjs(i)&&this._setQueryParams({toDate:i.format(this.dateParamFormat)}));}handleSortingChange(){(0, Ha.get)(this._bmlForm,"controls.sortingCriteria.valid")&&this._setQueryParams({sorting:this.model.selectedSortingCriteria.criteria,sortingOrder:this.model.selectedSortingCriteria.order});}handleAccountOwnersChange(){(0, Ha.get)(this._bmlForm,"controls.accountOwners.valid")&&this._setQueryParams({companyId:this.model.selectedAccountOwner.id});}ngAfterViewChecked(){if(!this._viewCheckedDone&&this._currentForm){let e=this._currentForm.statusChanges.pipe(Xo());this._formSubscription=e.subscribe(t=>{this._currentForm.controls.accountOwners&&this._currentForm.controls.accountOwners.markAsDirty(),t==="VALID"&&(this._bmlForm=this._currentForm,this.onSearch());}),this._viewCheckedDone=true;}}ngOnDestroy(){this.resetIndex(),this._activatedRouteSubscription&&this._activatedRouteSubscription.unsubscribe(),this._limitSubscription&&this._limitSubscription.unsubscribe(),this._externalPagingSubscription&&this._externalPagingSubscription.unsubscribe(),this._formSubscription&&this._formSubscription.unsubscribe();}onSearch(e){if(this.canSearch(e)){let t={fromDate:this.getFromDate(),toDate:this.getToDate(),companyId:this.model.selectedAccountOwner.id,sorting:this.model.selectedSortingCriteria.criteria,sortingOrder:this.model.selectedSortingCriteria.order,index:e?this._limit:0,number:this._bankMessagesService.numPaging};this.searchEvent.emit(t),this.setPreviousParams(t);}}compareFn(e,t){return e&&t?e.name===t.name:e===t}_initAccountOwners(){let e=this._accountOwnersTypeaheadService.getAccountOwners(this.accountList);e&&e.length&&(this.accountOwners=this._accountOwnersTypeaheadService.mapAccountOwners(e,{showAllAccounts:false,allAccountsTranslationKey:"COMPONENTS.BANK_MESSAGES_FILTER.ALL_COMPANIES"}),this.model.selectedAccountOwner=this._accountOwnersTypeaheadService.setInitValue(this.model.selectedAccountOwner,this.accountOwners,this.searchParams.companyId));}_setQueryParams(e){this._isParamsSet(e)||(this.resetIndex(),this._router.navigate([],{relativeTo:this._activatedRoute,queryParams:e,queryParamsHandling:"merge"}));}_isParamsSet(e){return !Object.keys(e).some(t=>this.searchParams[t]!==e[t])}_isDateParamValid(e){let t=e&&Qe(e,this.dateParamFormat);return t&&t.isValid()}_isSortingParamValid(e){return ["date","type","account","status"].includes(e)}_isSortingOrderParamValid(e){return ["ascending","descending"].includes(e)}_isCompanyIdParamValid(e){let t=this.accountOwners.filter(a=>a.id===e);return !!(t&&t.length)}_setSearchParam(e,t){(e==="toDate"||e==="fromDate")&&this._isDateParamValid(t)?this.searchParams[e]=t:e==="sortingOrder"&&this._isSortingOrderParamValid(t)?this.searchParams.sortingOrder=t:e==="sorting"&&this._isSortingParamValid(t)?this.searchParams.sorting=t:e==="companyId"&&this._isCompanyIdParamValid(t)?this.searchParams.companyId=t:this.searchParams[e]=this.searchParams[e]||this.defaultParams[e];}_configDate(e){let{chosenDateFrom:t,chosenDateTo:a}=this.model;if(e==="fromDate"){let i=this.minDateFrom||t;
2typeof i<"u"&&this._bmlForm?.controls.dateFieldFrom?.valid&&(this.dateConfigTo=this._datePickerService.set({min:i.startOf("day"),max:this.today}),this.minDateTo=i.startOf("day"));}else {let i=a&&!a.isAfter(this.today)?a:this.today;typeof i<"u"&&this._bmlForm?.controls.dateFieldTo?.valid&&(this.dateConfigFrom=this._datePickerService.set({max:i.endOf("day")}),this.maxDateFrom=i.endOf("day"));}}_getAccountOwner(e){let t=this.accountOwners.filter(a=>e?a.id===e:a.accounts.length&&a.accounts[0].customerRole.toUpperCase()==="OWNER");return t&&t.length?t[0]:this.accountOwners[0]}isToDateEqualToPrevious(e){return Qe.isDayjs(e)&&e.format(this.dateParamFormat)===this._currentDateTo?.format(this.dateParamFormat)}isFromDateEqualToPrevious(e){return Qe.isDayjs(e)&&e.format(this.dateParamFormat)===this._currentDateFrom?.format(this.dateParamFormat)}setCurrentDateFrom(e,t){e==="fromDate"&&(this._currentDateFrom=t);}setCurrentDateTo(e,t){e==="toDate"&&(this._currentDateTo=t);}getFromDate(){let e=this._currentForm&&this._currentForm.controls.dateFieldFrom?this._currentForm.controls.dateFieldFrom.value:this.model.chosenDateFrom;return this.isDisplaySort?Qe(e).format(this.dateParamFormat):Qe().subtract(6,"month").format(this.dateParamFormat)}getToDate(){let e=this._currentForm&&this._currentForm.controls.dateFieldTo?this._currentForm.controls.dateFieldTo.value:this.model.chosenDateTo;return this.isDisplaySort?Qe(e).format(this.dateParamFormat):Qe().format(this.dateParamFormat)}areParamsChanged(){let e=this.getFromDate(),t=this.getToDate();return typeof this.prevBankMessagesParams>"u"?true:this.prevBankMessagesParams?.fromDate!==e||this.prevBankMessagesParams?.toDate!==t||this.prevBankMessagesParams?.companyId!==this.model.selectedAccountOwner.id||this.prevBankMessagesParams?.sorting!==this.model.selectedSortingCriteria.criteria||this.prevBankMessagesParams?.sortingOrder!==this.model.selectedSortingCriteria.order}setPreviousParams(e){this.prevBankMessagesParams=e;}resetIndex(){this._bankMessagesService.setLimit(0);}canSearch(e){return this._bmlForm&&this.areParamsChanged()&&this.model.selectedAccountOwner||this._bmlForm&&e}shouldStopProceedDateChange(e){return e||typeof this.model.chosenDateTo>"u"||typeof this.model.chosenDateFrom>"u"}static{this.\u0275fac=function(t){return new(t||n)(Do$1(V$1),Do$1(K$1),Do$1(i),Do$1(Ne),Do$1(X$1),Do$1(r))};}
2static{this.\u0275cmp=qT({type:n,selectors:[["bank-messages-filter"]],viewQuery:function(t,a){if(t&1&&Qy(oo,5),t&2){let i;FC(i=jC())&&(a._currentForm=i.first);}},inputs:{accountList:"accountList"},outputs:{searchEvent:"searchEvent"},standalone:false,features:[uD],decls:2,vars:3,consts:[["bmlForm","ngForm"],["accountOwnersRef","sbControl"],["dateFieldFrom","ngModel"],["dateFieldTo","ngModel"],["name","bmlForm","id","bmlForm","role","form","novalidate",""],[1,"bank-messages-row"],[1,"bank-messages-row-item","bank-messages-row-item-account"],[1,"form-group"],["for","accountOwners","translate",""],[3,"selectEvent","accountOwners","selectedAccountOwners"],["name","accountOwners","id","accountOwners","required","",1,"form-control",3,"ngModelChange","sbTypeahead","ngModel"],["validation","required",3,"field"],[1,"bank-messages-row-item","bank-messages-row-item-date"],[1,"datepicker-wrapper","form-group"],["for","dateFieldFrom","translate",""],["id","dateFieldFrom","name","dateFieldFrom","required","",3,"onChange","ngModelChange","config","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","maxDateFrom","translate","",1,"text-danger","validation-message",3,"translateParams"],["id","minDateFrom","translate","",1,"text-danger","validation-message",3,"translateParams"],["for","dateFieldTo","translate",""],["id","dateFieldTo","name","dateFieldTo","required","",3,"onChange","ngModelChange","config","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","maxDateTo","translate","",1,"text-danger","validation-message",3,"translateParams"],["id","minDateTo","translate","",1,"text-danger","validation-message",3,"translateParams"],[1,"bank-messages-row-item","bank-messages-row-item-sort"],["for","sortingCriteria","translate",""],["id","sortingCriteria","name","sortingCriteria",1,"form-control",3,"ngModelChange","change","compareWith","ngModel"],[3,"ngValue"]],template:function(t,a){t&1&&(mC(0,ko,14,6,"div"),N_(1,"async")),t&2&&gC(R_(1,1,a.isInitVariables)?0:-1);},dependencies:[m$1,j$2,eR,nR,iR,yi,Eh,co$1,Ch,fh,Ei,Ml,j,u,Te,B,ee,Tt,X3,fu,mn,ye],encapsulation:2,changeDetection:1});}};$n();var Co=["bankMessagesForm"],Mo=(n,e,t,a)=>({count:n,company:e,date:t,searchText:a});function _o(n,e){if(n&1&&ky(0,"dialogue-tabs",5),n&2){let t=RC();Ry("bankMessagesCount",t.unreadMessagesCount);}}function vo(n,e){if(n&1){let t=CC();Ms(0,"form",7,0)(2,"div",11)(3,"label",12),c_(4,"PAGE.BANK_MESSAGES.LABEL.SEARCHTEXT"),rd(),Ms(5,"input",13,1),N_(7,"translate"),pv("ngModelChange",function(i){yh(t);let s=RC();return f_(s.model.searchText,i)||(s.model.searchText=i),vh(i)}),qy("ngModelChange",function(){yh(t);let i=RC();return vh(i.searchTextChanged())}),rd(),tT(),rd()();}if(n&2){let t=RC();mb(5),fv("ngModel",t.model.searchText),Ry("placeholder",R_(7,3,"PAGE.BANK_MESSAGES.PLACEHOLDER.SEARCHTEXT"))("maxlength",t.searchTextMaxLength),nT();}}function Eo(n,e){if(n&1){let t=CC();Ms(0,"bank-messages-filter",14),qy("searchEvent",function(i){yh(t);let s=RC();return vh(s.searchEvent(i))}),rd();}if(n&2){let t=RC();Ry("accountList",t.accountList);}}function Bo(n,e){if(n&1){let t=CC();Ms(0,"button",18),qy("click",function(){yh(t);let i=RC(2);return vh(i.clearFilter())}),Ms(1,"span",19),c_(2,"\xD7"),rd()();}}function Ao(n,e){if(n&1&&(Ms(0,"span",16),c_(1),N_(2,"i18nPlural"),N_(3,"translate"),rd()),n&2){let t=RC(2);mb(),cv(k_(3,4,k_(2,1,t.bankMessages.length,t.messageMapping),M_(7,Mo,t.bankMessages.length>=t.bankMessagesService.numPaging&&t.config.showFilter?t.bankMessagesService.numPaging+"+":t.bankMessages.length,t.searchCompany,t.searchDate,t.model.searchText)));}}function Do(n,e){n&1&&(Ms(0,"span",17),c_(1,"PAGE.BANK_MESSAGES.DENIED_ACCESS"),rd());}function yo(n,e){if(n&1&&(Ms(0,"div",9),mC(1,Bo,3,0,"button",15),mC(2,Ao,4,12,"span",16),mC(3,Do,2,0,"span",17),rd()),n&2){let t=RC();mb(),gC(t.config.showSearchField&&!t.isDeniedAccess?1:-1),mb(),gC(t.isDeniedAccess?-1:2),mb(),gC(t.isDeniedAccess?3:-1);}}function To(n,e){n&1&&(Ms(0,"div",9)(1,"span",20),c_(2,"PAGE.BANK_MESSAGES.LIST.EMPTY"),rd()());}function xo(n,e){if(n&1&&ky(0,"bank-messages-list",10),n&2){let t=RC();Ry("bankMessages",t.bankMessages)("accountList",t.accountList);}}var Ia=class n{constructor(e,t,a,i,s,E,P,H$1,ve,Wa,Ni){this._dataBankMessages=e;this._dataAccounts=t;this._router=a;this._activatedRoute=i;this._translate=s;this.bankMessagesService=E;this._log=P;this._alert=H$1;this._fuseService=ve;this.bankMessages=[];this.messageMapping={};this.accountList=[];this.model={searchText:""};this.searchTextMaxLength=32;this.unreadMessagesCount=0;this.isDeniedAccess=false;this.searchTextChanged=(0, ne.debounce)(()=>{this._router.navigate([],{relativeTo:this._activatedRoute,queryParams:F(E$1({},this._activatedRoute.snapshot.queryParams),{searchtext:this.model.searchText&&this.model.searchText.length>0?this.model.searchText:void 0}),replaceUrl:true});},100);this.loading=new br(false);this._accountsSubscription=new H;this._searchSubscription=new H;this._prevIndex=0;this._dateFormatConfig=Wa.config,this.config=Ni.config;}ngAfterViewChecked(){this._formChanged();}
2ngOnInit(){this._accountsSubscription=this._dataAccounts.get(void 0,this.loading).subscribe(e=>{this.accountList=e.filter(t=>t.rights&&t.rights.accessPermission),this.isDeniedAccess=e&&e.length&&!this.accountList.length,!this.isDeniedAccess&&!this.config.showFilter&&this.searchEvent();},e=>{this._log.error("something wrong happened while fetching bankmessages",e),this._alert.serverError(e,"PAGE.BANK_MESSAGES.LOAD_ERROR");}),this.config.showFilter?this.messageMapping={"=0":"PAGE.BANK_MESSAGES.CORPORATE_CONTEXT.FILTER_RESULT.TEXT_NONE","=1":"PAGE.BANK_MESSAGES.CORPORATE_CONTEXT.FILTER_RESULT.TEXT_SINGULAR",other:"PAGE.BANK_MESSAGES.CORPORATE_CONTEXT.FILTER_RESULT.TEXT_PLURAL"}:this.messageMapping={"=0":"PAGE.BANK_MESSAGES.PRIVATE_CONTEXT.FILTER_RESULT.TEXT_NONE","=1":"PAGE.BANK_MESSAGES.PRIVATE_CONTEXT.FILTER_RESULT.TEXT_SINGULAR",other:"PAGE.BANK_MESSAGES.PRIVATE_CONTEXT.FILTER_RESULT.TEXT_PLURAL"};}searchEvent(e){this._searchSubscription&&this._searchSubscription.unsubscribe(),e&&(e.index===0||e.index===this._prevIndex)&&(this._dataBankMessages.clearCache(),this._prevIndex=0),this.bankMessagesService.setLoading(true),this._searchSubscription=CI(this._dataBankMessages.get(e),this._activatedRoute.queryParamMap.pipe(we$1(t=>t.get("searchtext")))).pipe(_f(([t,a])=>{let i=t.filter(s=>s.status==="unread");if(this.unreadMessagesCount=i&&i.length,this.model.searchText=a||"",t&&t.length>0){let s=t;if(this.model.searchText&&this.model.searchText.length>0&&(s=this._performSearch(this.model.searchText,t)),!e)s=(0, ne.orderBy)(s,"date","desc");else {this.searchCompany=e.companyId.indexOf(",")!==-1?"":this._translate.instant("PAGE.BANK_MESSAGES.FILTER_RESULT.LABEL.FOR")+" "+this.bankMessagesService.companyName.getValue();let E=Qe(e.fromDate,"YYYY-MM-DD"),P=Qe(e.toDate,"YYYY-MM-DD");if(this.config.showFilter)this.searchDate=this._translate.instant("PAGE.BANK_MESSAGES.FILTER_RESULT.DATE.INTERVAL",{fromDate:E.format("DD.MM.YYYY"),toDate:P.format("DD.MM.YYYY")});else {let H=P.diff(E,"months",true),ve=P.diff(E,"days",true);H===6?this.searchDate=this._translate.instant("PAGE.BANK_MESSAGES.FILTER_RESULT.DATE.LAST_6_MONTHS"):H===1?this.searchDate=this._translate.instant("PAGE.BANK_MESSAGES.FILTER_RESULT.DATE.LAST_MONTH"):ve===14?this.searchDate=this._translate.instant("PAGE.BANK_MESSAGES.FILTER_RESULT.DATE.LAST_2_WEEKS"):ve===7?this.searchDate=this._translate.instant("PAGE.BANK_MESSAGES.FILTER_RESULT.DATE.LAST_WEEK"):this.searchDate=this._translate.instant("PAGE.BANK_MESSAGES.FILTER_RESULT.DATE.INTERVAL",{fromDate:E.format("DD.MM.YYYY"),toDate:P.format("DD.MM.YYYY")});}}return hI(s)}else return hI([])})).subscribe(t=>{this.bankMessages=t,e&&(this._prevIndex=e.index),this.bankMessagesService.setLimit(this.config.showFilter?e.index+this.bankMessagesService.config.increment:this.bankMessagesService.limit.getValue()+this.bankMessagesService.config.increment),this.bankMessagesService.setLoading(false);},t=>{this.bankMessages=[],this._log.error("something wrong happened while fetching bankmessages",t),this._alert.serverError(t,"PAGE.BANK_MESSAGES.LOAD_ERROR"),this.bankMessagesService.setLoading(false);});}showFilterResultBox(e){if(this.config.showFilter)return !e;{let t=(0, ne.get)(this,"model.searchText");return e?!t&&!this.bankMessages.length:t&&t.length>0}}clearFilter(){this._router.navigate([],{relativeTo:this._activatedRoute,queryParams:F(E$1({},this._activatedRoute.snapshot.queryParams),{searchtext:void 0}),replaceUrl:true});}ngOnDestroy(){this._accountsSubscription&&this._accountsSubscription.unsubscribe(),this._searchSubscription&&this._searchSubscription.unsubscribe();}_formChanged(){this._currentForm!==this._bankMessagesForm&&(this._bankMessagesForm=this._currentForm);}_formatDate(e){return e&&e.format&&e.format(this._dateFormatConfig.dateFormat)}_performSearch(e,t){let a={keys:["searchableStrings"],threshold:.2,maxPatternLength:2e3,distance:200,shouldSort:false,include:["score"]},i=(0, ne.map)(t,P=>{let H=P;return H.searchableStrings=[H.descriptionShort,this._formatDate(H.date)],H.accountNumber&&H.searchableStrings.push(H.accountNumber),H}),s=this._fuseService.search(e,i,a),E=(0, ne.map)(s,"item");return (0, ne.isEmpty)(E)&&e===""?t:E}static{this.\u0275fac=function(t){return new(t||n)(Do$1(ge),Do$1(G),Do$1(V$1
2),Do$1(K$1),Do$1(V),Do$1(Ne),Do$1(E$2),Do$1(E$3),Do$1("ng1-fuseService"),Do$1(c),Do$1(r))};}static{this.\u0275cmp=qT({type:n,selectors:[["ng-component"]],viewQuery:function(t,a){if(t&1&&Qy(Co,5),t&2){let i;FC(i=jC())&&(a._currentForm=i.first);}},standalone:false,decls:14,vars:14,consts:[["bankMessagesForm","ngForm"],["searchTextRef","sbControl"],[1,"bank-messages-module"],[3,"url"],[3,"hidden"],[3,"bankMessagesCount"],["id","bank-messages-pageinfo",3,"main"],["name","bankMessagesForm","id","bankMessagesForm","role","form","novalidate",""],[3,"accountList"],[1,"filter-result-box"],[3,"bankMessages","accountList"],[1,"form-group"],["for","searchText","translate",""],["id","searchText","name","searchText","type","text",1,"form-control",3,"ngModelChange","ngModel","placeholder","maxlength"],[3,"searchEvent","accountList"],["type","button","name","button",1,"close"],["id","searchResult"],["id","deniedAccess","translate",""],["type","button","name","button",1,"close",3,"click"],["aria-hidden","true"],["id","emptyList","translate",""]],template:function(t,a){t&1&&(Ms(0,"section",2),ky(1,"old-page-link",3),Ms(2,"div",4),N_(3,"async"),mC(4,_o,1,1,"dialogue-tabs",5),ky(5,"page-info-ngx",6),mC(6,vo,8,5,"form",7),mC(7,Eo,1,1,"bank-messages-filter",8),mC(8,yo,4,3,"div",9),mC(9,To,3,0,"div",9),mC(10,xo,1,2,"bank-messages-list",10),rd(),Ms(11,"div",4),N_(12,"async"),ky(13,"page-loading-spinner"),rd()()),t&2&&(mb(),Ry("url","URL.CNB.INBOX"),mb(),Ry("hidden",R_(3,10,a.loading)),mb(2),gC(a.config.showDialogueTabs?4:-1),mb(),Ry("main",a.config.showFilter?"PAGE.BANK_MESSAGES.CIB":"PAGE.BANK_MESSAGES"),mb(),gC(a.config.showSearchField?6:-1),mb(),gC(a.config.showFilter&&a.accountList.length?7:-1),mb(),gC(a.showFilterResultBox()?8:-1),mb(),gC(a.showFilterResultBox(true)?9:-1),mb(),gC(a.accountList.length?10:-1),mb(),Ry("hidden",R_(12,12,a.loading)===false));},dependencies:[eR,yi,co$1,Ch,ea,Ei,Ml,j,u,Te,g,Aa,y,X3,fu,L,ya,Ta,mn,Sn,ye],encapsulation:2,changeDetection:1});}};vM();var Io=[{path:"",component:Ia,data:{name:"bank-messages",title:"PAGE.BANK_MESSAGES.HEADING"},canActivate:[ot]},{path:"wad",component:Ba,data:{name:"bank-messages-wad",title:"PAGE.BANK_MESSAGES.V2.TITLE"}}],Fa=class n{static{this.\u0275fac=function(t){return new(t||n)};}static{this.\u0275mod=my({type:n});}static{this.\u0275inj=Oc({imports:[aa.forChild(Io),aa]});}};da$1();vM();var Na=class n{static{this.\u0275fac=function(t){return new(t||n)};}static{this.\u0275mod=my({type:n});}static{this.\u0275inj=Oc({imports:[ii,aa]});}};vM();var Fi=class n$1{static{this.\u0275fac=function(t){return new(t||n$1)};}static{this.\u0275mod=my({type:n$1});}static{this.\u0275inj=Oc({providers:[K,ge,ue,ot,he,st,u],imports:[Fa,ii,Na,qt,p,xu,we,Vs,Wa,W6,Ro,_e$1,Ga,Nf,Rf,X9,sB,a6.forRoot({useFactory:e=>({showCounter:({count:t=0,total:a=0})=>e.instant("EBANKUI.CONFIG.LOAD_MORE.SHOW_COUNTER",{count:t,total:a}),loadedAmount:({amount:t})=>e.instant("EBANKUI.CONFIG.LOAD_MORE.LOADED_AMOUNT",{amount:t})}),deps:[V]}),O0,r8,k6,Bn,Cu,Y3,_8,a8,yI,i8,n]});}};export{Fi as BankMessagesModule};
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.