1import {a9 as n}from'./chunk-sloV_gFh.js';import {y}from'./chunk-BHMjXxpy.js';import {p}from'./chunk-BQbdPs4y.js';import {G,j}from'./chunk-fRit9228.js';import {x as my,O as Oc,b3 as ii,dl as xt,bi as dn$1,el as k6,bj as Cu,dm as t8,eE as _8,eB as Wa,fr as B6,bx as Ro,bz as Nf,bA as Rf,bB as X9,dG as vO,em as Y3,en as Vs,bl as Ga,bb as xu,c8 as H8,c9 as Bf,ca as Pf,eF as a6,V,ak as aa,dz as E,t as de,X,bI as Qe,bm as br$1,cj as H,n as hI,eM as Sf,_ as _f,w as we,ci as CI,j as Sa,f as Vn,fv as _p,i0 as te,L as Do,ck as P,E as E$1,aS as V$1,P as qT,aB as g,ev as mg,ew as v6,ey as sN,bM as Ys,bu as mn$1,a2 as ye,a3 as Ms,aM as N_,a4 as ky,a6 as mC,a5 as rd,a8 as Ry,bv as R_,aa as mb,ab as gC,cE as Ee,f5 as hf,M as S$1,d as E$2,cO as nd,bn as ne,cD as Xo,eR as oR,cF as eR,cH as co,cI as Ch,cM as j$1,cN as u,br as Te,cY as uo,cZ as Nl,eS as Cr$1,cX as X3,c_ as fu,c$ as Pa,d0 as gu,d1 as on,d2 as sI,eu as f8,eo as QI,ad as c_,d6 as tT,c3 as HC,d7 as nT,b6 as K,i1 as NO,fd as di,fN as Qi$1,fz as za,fF as T6,fI as N6,fC as tl,fA as w6,fK as R6,hO as S6,fG as M6,fB as hN,hQ as D6,fH as Z3,fJ as Cg,fL as L0,fM as A6,eP as o6,bN as Qs,I as In$1,cP as Qy,cQ as FC,cR as jC,c2 as qy,bY as IC,dR as vC,bZ as EC,c1 as CC,aL as RC,aN as cd,hG as bn$1,ba as cv,cC as lv,cq as Ws,cr as W8,cs as G8,aO as k_,hq as iI,cA as sd,c0 as wy,cB as Qs$1,g7 as Ya,eq as Cf,ea as wf,gM as Kr,fs as N$,cU as jt,e as ep,fj as KC,fQ as g_,be as na,$ as $N,h as he,J as da,p as pi,c5 as Be,v as vM,cm as J,dC as q,dD as G$1,dV as vc,W,N as N$1,b as $n$1,K as j$2,dA as J$1,dW as os,c6 as yh,c7 as vh,cz as bw,b$ as T_,b_,eT as Ay,i2 as Xy}from'./chunk-BVUwsCyn.js';import {S,N,E as E$3}from'./main-KAAHWV4Z.js';import'./chunk-DfNmovlP.js';import'./chunk-yM6K_b1X.js';import'./chunk-4lR12NlP.js';na();$N();he();da();pi();da();Be();vM();J();q();vM();G$1();vc();var ke=class i extends E{constructor(t,n){super();this.dsObservable=t;this.DS=n;this.dsNames=["agreementInvoices"];}fetch(t){return S(this,null,function*(){let n,m=(te,Le)=>{n=Le;};return this.DS.definitions.agreementInvoices.on("ROB.hasMoreElements",m),n&&(t.index=n.index),{agreementInvoices:yield this.DS.findAll("agreementInvoices",t),next:n}})}fromCache(t,n){return n}static{this.\u0275fac=function(n){return new(n||i)(de(J$1),de(os))};}static{this.\u0275prov=X({token:i,factory:i.\u0275fac,providedIn:"any"});}};pi();vM();var nt=class i{constructor(e){this._state=new br$1(e);}get state$(){return this._state.asObservable()}get state(){return this._state.getValue()}setState(e){let t=e(this.state);this._state.next(E$3(E$3({},this.state),t));}select(e){return this.state$.pipe(we(e),Xo())}static{this.\u0275fac=function(t){return new(t||i)(de("initialState"))};}static{this.\u0275prov=X({token:i,factory:i.\u0275fac,providedIn:"root"});}};pi();Be();vM();var At={accounts:[],filters:{search:"",fromDate:Qe().startOf("month").subtract(1,"month").toDate(),toDate:Qe().startOf("day").toDate()},invoices:[],pagination:{index:0,number:50},sorting:{sortDirection:"desc",sortField:"invoiceDate"},selectedInvoice:null,countElements:0},O=class i extends nt{constructor(){super(At);this.sortingChangeSubject$=new ne;this.removeFilterChipsSubject$=new ne;this.resetFiltersSubject$=new ne;this.showResultsSubject$=new ne;this.sortingChangeClicked$=this.sortingChangeSubject$.asObservable();this.removeFilterChipsClicked$=this.removeFilterChipsSubject$.asObservable();this.resetFiltersClicked$=this.resetFiltersSubject$.asObservable();this.showResultsClicked$=this.showResultsSubject$.asObservable();}sortingChangeClickedAction(t){this.sortingChangeSubject$.next(t);}removeFilterChipsAction(t){this.removeFilterChipsSubject$.next(t);}resetFiltersAction(){this.resetFiltersSubject$.next(At.filters);}resetStateToDefault(){this.setState(()=>At);}showResultsAction(){this.showResultsSubject$.next({});}static{this.\u0275fac=function(n){return new(n||i)};}static{this.\u0275prov=X({token:i,factory:i.\u0275fac,providedIn:"root"});}};vM();W();N$1();he();var xe=class i{constructor(e,t,n){this.log=e;this.alert=t;this.translateService=n;}error(e,t,n){n&&this.alert.error(this.translateService.instant(n)),this.log.error(`${e}: ${t}`);}static{this.\u0275fac=function(t){return new(t||i)(de(E$2),de(E$1),de(V))};}static{this.\u0275prov=X({token:i,factory:i.\u0275fac,providedIn:"any"});}};N$1();da();$N();pi();Be();var _t=N(ep());function Ui(i){let e=i.get("fromDate"),t=i.get("toDate"),n=Qe(),m={};ln([e,t]),m=cn(m,e,t,n),mn(m,i);}function cn(i,e,t,n){return e.value&&!(0, _t.isDate)(e.value)&&(i.fromDate="invalidDate"),t.value&&!(0, _t.isDate)(t.value)&&(i.toDate="invalidDate"),Qe(t.value)>n&&(i.toDate="invalidFutureDate"),Qe(e.value)>n&&(i.fromDate="invalidFutureDate"),Qe(t.value).isBefore(Qe(e.value))&&(i.fromDate="toDateOlderThanFromDate"),i}function mn(i,e){let t=Object.entries(i);if(t.length>0){let n=t[0][0],m=t[0][1];e.get(n).setErrors({[m]:true}),e.get(n).markAsTouched(),e.get(n).markAsDirty();}}
1function ln(i){i.forEach(e=>e.setErrors(null));}Be();vM();na();he();$N();var rt=class i{constructor(e,t){this.fb=e;this.agreementInvoicesStoreService=t;this.filterForm=this.fb.group({search:this.agreementInvoicesStoreService.state.filters.search,fromToDates:this.fb.group({fromDate:this.agreementInvoicesStoreService.state.filters.fromDate,toDate:this.agreementInvoicesStoreService.state.filters.toDate},{validator:Ui})});this.maxDate=new Date;this.subscription=new H;this.defaultFromDate=Qe().startOf("month").subtract(1,"month").toDate();this.defaultToDate=Qe().startOf("day").toDate();}get searchControl(){return this.filterForm.get("search")}get fromDateControl(){return this.fromToDatesGroup.get("fromDate")}get toDateControl(){return this.fromToDatesGroup.get("toDate")}get fromToDatesGroup(){return this.filterForm.get("fromToDates")}get isFormValid(){return this.filterForm.valid}ngOnInit(){this.setSubscriptions();}ngOnDestroy(){this.subscription.unsubscribe();}setSubscriptions(){this.subscription.add(this.searchControl.valueChanges.pipe(Xo(),hf(500),Vn(()=>this.filterForm.valid)).subscribe(()=>{this.setFiltersState();})),this.subscription.add(this.agreementInvoicesStoreService.removeFilterChipsClicked$.subscribe(e=>{this.onRemoveFilterChipsClicked(e);})),this.subscription.add(this.agreementInvoicesStoreService.resetFiltersClicked$.subscribe(e=>{this.setFilterValues(e),this.setFiltersState();})),this.subscription.add(this.agreementInvoicesStoreService.showResultsClicked$.subscribe(()=>{this.isFormValid&&this.setFiltersState();}));}setFiltersState(){let e={search:this.searchControl.value,fromDate:this.fromDateControl.value,toDate:this.toDateControl.value};this.agreementInvoicesStoreService.setState(()=>({filters:e}));}onRemoveFilterChipsClicked(e){switch(e){case 0:this.searchControl.setValue("");break;case 1:this.fromDateControl.setValue(this.defaultFromDate);break;case 2:this.toDateControl.setValue(this.defaultToDate);break}this.isFormValid&&this.setFiltersState();}setFilterValues(e){let t={search:e.search,fromToDates:{fromDate:e.fromDate,toDate:e.toDate}};this.filterForm.setValue(t);}static{this.\u0275fac=function(t){return new(t||i)(Do(oR),Do(O))};}
1static{this.\u0275cmp=qT({type:i,selectors:[["agreement-invoices-filters"]],standalone:false,decls:39,vars:14,consts:[["fromDateControl","ebankControl"],["toDateControl","ebankControl"],["id","formId",1,"agreement-invoices-filter-form",3,"formGroup"],["translate",""],["formControlName","search"],["formGroupName","fromToDates"],["formControlName","fromDate",3,"max","titleOnMobile"],["validation","invalidDate",3,"control"],["validation","invalidFutureDate",3,"control"],["validation","toDateOlderThanFromDate",3,"control"],["formControlName","toDate",3,"max","titleOnMobile"]],template:function(t,n){if(t&1&&(Ms(0,"form",2)(1,"ebank-form-field")(2,"ebank-label",3),c_(3," PAGE.AGREEMENT.INVOICES.FILTER.SEARCH "),rd(),ky(4,"ebank-input-field",4),tT(),rd(),Ms(5,"div",5)(6,"ebank-form-field")(7,"ebank-label",3),c_(8," PAGE.AGREEMENT.INVOICES.FILTER.FROM "),rd(),Ms(9,"ebank-sub-label",3),c_(10," PAGE.AGREEMENT.INVOICES.FILTER.DATE_FORMAT_LABEL "),rd(),ky(11,"ebank-date-picker",6,0),N_(13,"translate"),tT(),Ms(14,"ebank-form-error-wrapper")(15,"ebank-form-error",7)(16,"span",3),c_(17,"PAGE.AGREEMENT.INVOICES.INVALID_DATE.ERROR"),rd()(),Ms(18,"ebank-form-error",8)(19,"span",3),c_(20,"PAGE.AGREEMENT.INVOICES.INVALID_FUTURE_DATE.ERROR"),rd()(),Ms(21,"ebank-form-error",9)(22,"span",3),c_(23,"PAGE.AGREEMENT.INVOICES.FROM_DATE_GREATER.ERROR"),rd()()()(),Ms(24,"ebank-form-field")(25,"ebank-label",3),c_(26," PAGE.AGREEMENT.INVOICES.FILTER.TO "),rd(),Ms(27,"ebank-sub-label",3),c_(28," PAGE.AGREEMENT.INVOICES.FILTER.DATE_FORMAT_LABEL "),rd(),ky(29,"ebank-date-picker",10,1),N_(31,"translate"),tT(),Ms(32,"ebank-form-error-wrapper")(33,"ebank-form-error",7)(34,"span",3),c_(35,"PAGE.AGREEMENT.INVOICES.INVALID_DATE.ERROR"),rd()(),Ms(36,"ebank-form-error",8)(37,"span",3),c_(38,"PAGE.AGREEMENT.INVOICES.INVALID_FUTURE_DATE.ERROR"),rd()()()()()()),t&2){let m=HC(12),b=HC(30);Ry("formGroup",n.filterForm),mb(4),nT(),mb(7),Ry("max",n.maxDate)("titleOnMobile",R_(13,10,"PAGE.AGREEMENT.INVOICES.FILTER.FROM")),nT(),mb(4),Ry("control",m),mb(3),Ry("control",m),mb(3),Ry("control",m),mb(8),Ry("max",n.maxDate)("titleOnMobile",R_(31,12,"PAGE.AGREEMENT.INVOICES.FILTER.TO")),nT(),mb(4),Ry("control",b),mb(3),Ry("control",b);}},dependencies:[eR,co,Ch,j$1,u,Te,uo,Nl,Cr$1,X3,fu,Pa,gu,on,sI,f8,t8,QI,ye],encapsulation:2,changeDetection:1});}};$N();pi();vM();he();var Yi=N(j());Be();vM();$n$1();he();W();N$1();var $=class i{constructor(e,t,n,m){this.decimalPipe=e;this.translateService=t;this.logService=n;this.alert=m;}mapToAgreementInvoicesListDataType(e){return e.map(t=>this.transformObj(t))}formatDetailsEssentialData(e,t,n){let{periodDateRange:{fromDate:m,toDate:b},dueDate:te,amountAccruedYear:{amount:Le},paymentMethod:Tt}=e;return {[this.translate("PERIOD")]:`${this.formatDate(m)} - ${this.formatDate(b)}`,[this.translate("INVOICE_DATE")]:t,[this.translate("DUE_DATE")]:this.formatDate(te),[this.translate("PAYMENT_METHOD")]:Tt,[this.translate("INVOICE_AMOUNT")]:String(this.formatDecimal(n)),[this.translate("ACCRUED_THIS_YEAR")]:this.formatDecimal(Le)}}processAndDownload(e,t){try{if(!e||!e.content||!e.contentDisposition)throw new Error("error");this.saveAs(e.content,t);}catch(n){this.handleError(t);}}transformObj(e){let t=e.getDetails,n=e.exportInvoiceToPdf;return {invoiceNumber:e.invoiceId,invoiceDate:Qe(e.invoiceDate).format("DD.MM.YYYY"),amount:e.invoiceAmount.amount,receiver:e.debitor.name,icon:"",links:e.links,getDetails:t.bind(e),exportInvoiceToPdf:n.bind(e)}}saveAs(e,t){let n=`${this.translateService.instant("PAGE.AGREEMENT.INVOICE_DETAILS.TITLE",{invoiceId:t})}.pdf`;(0, Yi.saveAs)(e,n);}formatDecimal(e){return this.decimalPipe.transform(e,".2")}formatDate(e){return Qe(e).format("DD.MM.YYYY")}translate(e){return this.translateService.instant(`PAGE.AGREEMENT.INVOICE_DETAILS.DESCRIPTION.${e}`)}handleError(e){this.alert.error("PAGE.AGREEMENT.INVOICES.EXPORT.ERROR"),this.logService.error(`Error while exporting invoice: ${e}`);}static{this.\u0275fac=function(t){return new(t||i)(de(In$1),de(V),de(E$2),de(E$1))};}static{this.\u0275prov=X({token:i,factory:i.\u0275fac,providedIn:"any"});}};da();$N();$n$1();var dn=()=>["details"],vn=()=>[];function un(i,e){i&1&&(Ms(0,"th",16),c_(1),N_(2,"translate"),rd()),i&2&&(mb(),cd(" ",R_(2,1,"PAGE.AGREEMENT.INVOICES.TABLE.COLUMN_HEADER.INVOICE_NO")," "));}function fn(i,e){if(i&1&&(Ms(0,"td",17),c_(1),rd()),i&2){let t=e.$implicit;mb(),cv(t.invoiceNumber);}}function gn(i,e){i&1&&ky(0,"td",18);}function Cn(i,e){if(i&1&&(Ms(0,"th",19),c_(1),N_(2,"translate"),rd()),i&2){let t=RC(3);Ry("ebankDefaultSortDirection",t.defaultSortDirection),mb(),cd(" ",R_(2,2,"PAGE.AGREEMENT.INVOICES.TABLE.COLUMN_HEADER.DATE")," ");}}function In(i,e){if(i&1&&(Ms(0,"td",17),c_(1),rd()),i&2){let t=e.$implicit;mb(),cv(t.invoiceDate);}}function bn(i,e){i&1&&ky(0,"td",18);}function Dn(i,e){i&1&&(Ms(0,"th",20),c_(1),N_(2,"translate"),rd()),i&2&&(mb(),cd(" ",R_(2,1,"PAGE.AGREEMENT.INVOICES.TABLE.COLUMN_HEADER.RECEIVER")," "));}function Sn(i,e){if(i&1&&(Ms(0,"td",17),c_(1),rd()),i&2){let t=e.$implicit;mb(),cv(t.receiver);}}function En(i,e){i&1&&ky(0,"td",18);}function An(i,e){i&1&&(Ms(0,"th",20),c_(1),N_(2,"translate"),rd()),i&2&&(mb(),cd(" ",R_(2,1,"PAGE.AGREEMENT.INVOICES.TABLE.COLUMN_HEADER.AMOUNT")," "));}function hn(i,e){if(i&1&&(Ms(0,"td",17),c_(1),N_(2,"number"),rd()),i&2){let t=e.$implicit;mb(),cv(k_(2,1,t.amount,".2"));}}function _n(i,e){i&1&&ky(0,"td",18);}function yn(i,e){i&1&&(Ms(0,"th",16)(1,"span",21),c_(2),N_(3,"translate"),rd()()),i&2&&(mb(2),cv(R_(3,1,"PAGE.AGREEMENT.INVOICES.TABLE.COLUMN_HEADER.VIEW")));}function Tn(i,e){if(i&1){let t=CC();Ms(0,"td",22),qy("click",function(){let m=yh(t).$implicit,b=RC(3);return vh(b.onSelectedAgreementInvoice(m))}),ky(1,"ebank-link",23),rd();}if(i&2){let t=e.$implicit;Ry("routerLink",b_(5,dn))("state",t),mb(),Ry("isTableAction",true)("functionalIconAltText",t.invoiceNumber)("routerLinkPath",b_(6,vn));}}function kn(i,e){i&1&&ky(0,"td",18);}function xn(i,e){i&1&&ky(0,"tr",24);}function Nn(i,e){i&1&&ky(0,"th",16);}function Rn(i,e){if(i&1&&(Ms(0,"tr",25),wy(1,Nn,1,0,"th",4),rd()),i&2){let t=e.$implicit;Ay("title",t.invoiceNumber)("aria",t.invoiceNumber),mb(),Ry("ebankHeaderCellDef","icon");}}function Fn(i,e){if(i&1){let t=CC();Ms(0,"ebank-table-wrapper")(1,"table",2),qy("ebankSortChange",function(m){
1yh(t);let b=RC(2);return vh(b.onTableSort(m))}),sd(2,3),wy(3,un,3,3,"th",4)(4,fn,2,1,"td",5)(5,gn,1,0,"td",6),Qs$1(),sd(6,7),wy(7,Cn,3,4,"th",8)(8,In,2,1,"td",5)(9,bn,1,0,"td",6),Qs$1(),sd(10,9),wy(11,Dn,3,3,"th",10)(12,Sn,2,1,"td",5)(13,En,1,0,"td",6),Qs$1(),sd(14,11),wy(15,An,3,3,"th",10)(16,hn,3,4,"td",5)(17,_n,1,0,"td",6),Qs$1(),sd(18,12),wy(19,yn,4,3,"th",4)(20,Tn,2,7,"td",13)(21,kn,1,0,"td",6),Qs$1(),wy(22,xn,1,0,"tr",14)(23,Rn,2,3,"tr",15),rd()();}if(i&2){let t=RC(2);mb(),Ry("dataSource",t.agreementInvoices)("ebankSortStart",t.defaultSortDirection)("ebankDisableSortClear",true),mb(2),Ry("ebankHeaderCellDef","invoiceNumber"),mb(4),Ry("ebankHeaderCellDef","invoiceDate"),mb(4),Ry("ebankHeaderCellDef","receiver"),mb(4),Ry("ebankHeaderCellDef","amount"),mb(4),Ry("ebankHeaderCellDef","icon"),mb(3),Ry("ebankHeaderRowDef",t.columnNames)("ebankHeaderRowDefSticky",true),mb(),Ry("ebankRowDefColumns",t.columnNames);}}function On(i,e){i&1&&ky(0,"page-loading-spinner");}function Ln(i,e){if(i&1){let t=CC();Ms(0,"ebank-load-more",1),qy("slicedList",function(m){yh(t);let b=RC();return vh(b.itemList=m)}),mC(1,Fn,24,11,"ebank-table-wrapper")(2,On,1,0,"page-loading-spinner"),rd();}if(i&2){let t=RC();Ry("callback",t.notifyLoadMoreAgreementInvoices)("list",t.agreementInvoices)("totalDataItemCount",t.totalItems)("counter",t.counter.bind(t))("loaded",t.customLoader.bind(t))("buttonText",t.loadMoreButtonText)("config",t.agreementInvoicesListConfig),mb(),gC(t.agreementInvoices.length>0?1:2);}}function Pn(i,e){i&1&&(Ms(0,"ebank-spinner")(1,"ebank-empty-state")(2,"ebank-empty-state-title",26),c_(3,"PAGE.AGREEMENT.INVOICES.NO_DATA.TITLE"),rd(),Ms(4,"ebank-empty-state-description",26),c_(5,"PAGE.AGREEMENT.INVOICES.NO_DATA.DESCRIPTION "),rd()()());}var ot=class i{constructor(e,t,n,m,b,te){this.translateService=e;this.agreementInvoicesStoreService=t;this.helperService=n;this.router=m;this.route=b;this.loadMoreStateService=te;this.totalItems=0;this.agreementInvoicesListConfig={initialLoad:50,increment:50};this.loadMoreButtonText=this.translateService.instant("PAGE.AGREEMENT.INVOICES.LOAD_MORE_BUTTON_TEXT");this.columnNames=["invoiceNumber","invoiceDate","receiver","amount","icon"];this.defaultSortDirection="desc";this.subscription=new H;}set setTotalItems(e){this.totalItems=e;}ngOnInit(){this.setSubscriptions();}ngOnDestroy(){this.subscription.unsubscribe();}counter(e){return this.translateService.instant("EBANKUI.CONFIG.LOAD_MORE.SHOW_COUNTER",{count:this.agreementInvoicesStoreService.state.invoices.length,total:e.total})}customLoader(e){return this.translateService.instant("EBANKUI.CONFIG.LOAD_MORE.LOADED_AMOUNT",{amount:e.amount})}onSelectedAgreementInvoice(e){this.loadMoreStateService.setRetainState(true),this.agreementInvoicesStoreService.setState(()=>({selectedInvoice:e})),this.router.navigate(["details"],{relativeTo:this.route});}onTableSort(e){let t={sortDirection:e.direction,sortField:e.active};this.agreementInvoicesStoreService.sortingChangeClickedAction(t);}setSubscriptions(){this.subscription.add(this.agreementInvoicesStoreService.state$.subscribe(e=>{this.setAgreementInvoices(e.invoices),setTimeout(()=>{this.checkSortIndicators(e.sorting);},50);}));}setAgreementInvoices(e){this.agreementInvoices=this.helperService.mapToAgreementInvoicesListDataType(e);}checkSortIndicators(e){let t={sortDirection:this.ebankSortDirective?.activeSort.direction,sortField:this.ebankSortDirective?.activeSort.active};(e.sortDirection!==t.sortDirection||e.sortField!==t.sortField)&&this.ebankSortDirective?.triggerSort(e.sortField,e.sortDirection);}static{this.\u0275fac=function(t){return new(t||i)(Do(V),Do(O),Do($),Do(V$1),Do(K),Do(NO))};}
1static{this.\u0275cmp=qT({type:i,selectors:[["agreement-invoices-list"]],viewQuery:function(t,n){if(t&1&&Qy(L0,5),t&2){let m;FC(m=jC())&&(n.ebankSortDirective=m.first);}},inputs:{setTotalItems:"setTotalItems",notifyLoadMoreAgreementInvoices:"notifyLoadMoreAgreementInvoices"},standalone:false,decls:2,vars:2,consts:[[3,"callback","list","totalDataItemCount","counter","loaded","buttonText","config"],[3,"slicedList","callback","list","totalDataItemCount","counter","loaded","buttonText","config"],["ebankTable","","ebankSort","",3,"ebankSortChange","dataSource","ebankSortStart","ebankDisableSortClear"],["ebankColumnDef","invoiceNumber","ebankMainColumn","invoiceNumber"],["ebankHeaderCell","",4,"ebankHeaderCellDef"],["ebankCell","",4,"ebankCellDef"],["ebankFooterCell","",4,"ebankFooterCellDef"],["ebankColumnDef","invoiceDate"],["ebankHeaderCell","","ebankSortHeader","","ebankSortDateFormat","'DD.MM.YYYY'",3,"ebankDefaultSortDirection",4,"ebankHeaderCellDef"],["ebankColumnDef","receiver"],["ebankHeaderCell","","ebankSortHeader","",4,"ebankHeaderCellDef"],["ebankColumnDef","amount","ebankRightAlignColumn",""],["ebankColumnDef","icon","ebankRightAlignColumn",""],["ebankCell","","class","ebank-column-link",3,"routerLink","state","click",4,"ebankCellDef"],["ebankHeaderRow","",4,"ebankHeaderRowDef","ebankHeaderRowDefSticky"],["ebankRow","",4,"ebankRowDef","ebankRowDefColumns"],["ebankHeaderCell",""],["ebankCell",""],["ebankFooterCell",""],["ebankHeaderCell","","ebankSortHeader","","ebankSortDateFormat","'DD.MM.YYYY'",3,"ebankDefaultSortDirection"],["ebankHeaderCell","","ebankSortHeader",""],[1,"ebank-hide-desktop-header"],["ebankCell","",1,"ebank-column-link",3,"click","routerLink","state"],["linkStyle","tertiary-icon",3,"isTableAction","functionalIconAltText","routerLinkPath"],["ebankHeaderRow",""],["ebankRow",""],["translate",""]],template:function(t,n){t&1&&(mC(0,Ln,3,8,"ebank-load-more",0),mC(1,Pn,6,0,"ebank-spinner")),t&2&&(gC(n.agreementInvoices.length>0?0:-1),mb(),gC(n.agreementInvoices.length===0?1:-1));},dependencies:[di,Te,g,Qi$1,za,T6,N6,tl,w6,R6,S6,M6,hN,D6,Z3,Cg,L0,A6,Nf,Rf,X9,o6,Qs,Ys,In$1,ye],encapsulation:2,changeDetection:1});}};pi();Be();vM();he();$N();$n$1();function wn(i,e){if(i&1){let t=CC();Ms(0,"ebank-chip",2),qy("removeClick",function(){let m=yh(t).$implicit,b=RC();return vh(b.removeFilter(m.id))}),rd();}if(i&2){let t=e.$implicit;Ry("text",t.text)("readOnly",t.readOnly);}}var at=class i{constructor(e,t){this.agreementInvoicesStoreService=e;this.translateService=t;this.chips=[];this.resetButtonDisabled$=new br$1(false);this.subscription=new H;this.agreementInvoicesFilters=this.agreementInvoicesStoreService.state.filters;this.searchKey="PAGE.AGREEMENT.INVOICES.FILTER.SEARCH";this.dateFromKey="PAGE.AGREEMENT.INVOICES.FILTER.FROM";this.dateToKey="PAGE.AGREEMENT.INVOICES.FILTER.TO";this.defaultFilters={search:"",fromDate:Qe().startOf("month").subtract(1,"month").toDate(),toDate:Qe().startOf("day").toDate()};}ngOnInit(){this.setSubscriptions(),this.setChips();}ngOnDestroy(){this.subscription.unsubscribe();}resetFilters(){this.setDefaultFilters(),this.setChips();}removeFilter(e){this.agreementInvoicesStoreService.removeFilterChipsAction(e),e===0&&this.removeSingleChips(e);}setSubscriptions(){this.subscription.add(this.agreementInvoicesStoreService.state$.pipe(Vn(e=>this.byFilters(e.filters))).subscribe(e=>{this.agreementInvoicesFilters=e.filters,this.setChips();}));}addChips(e,t,n,m=false){let b={id:e,text:`${this.translateService.instant(t)}: ${n}`,readOnly:m};this.chips.push(b);}setChips(){let e=this.agreementInvoicesStoreService.state.filters;this.resetChips(),this.agreementInvoicesFilters.search&&this.addChips(0,this.searchKey,this.agreementInvoicesFilters.search),this.agreementInvoicesFilters.fromDate&&this.addChips(1,this.dateFromKey,this.formatData(this.agreementInvoicesFilters.fromDate),Qe(this.defaultFilters.fromDate).isSame(e.fromDate)),this.agreementInvoicesFilters.toDate&&this.addChips(2,this.dateToKey,this.formatData(this.agreementInvoicesFilters.toDate),Qe(this.defaultFilters.toDate).isSame(e.toDate)),this.setResetFiltersButtonState();}removeSingleChips(e){this.chips=this.chips.filter(t=>t.id!==e);}resetChips(){this.chips=[];}setDefaultFilters(){this.agreementInvoicesStoreService.resetFiltersAction();}formatData(e){return e&&Qe(e).format("DD.MM.YYYY")||""}byFilters(e){return this.agreementInvoicesFilters.search!==e.search||this.agreementInvoicesFilters.fromDate!==e.fromDate||this.agreementInvoicesFilters.toDate!==e.toDate}setResetFiltersButtonState(){let e=this.agreementInvoicesStoreService.state.filters;this.resetButtonDisabled$.next(this.filtersStateEqualsDefaultFilters(e));}filtersStateEqualsDefaultFilters(e){return Qe(this.defaultFilters.fromDate).isSame(e.fromDate)&&Qe(this.defaultFilters.toDate).isSame(e.toDate)&&this.defaultFilters.search===e.search}static{this.\u0275fac=function(t){return new(t||i)(Do(O),Do(V))};}
1static{this.\u0275cmp=qT({type:i,selectors:[["agreement-invoices-chips"]],standalone:false,decls:4,vars:3,consts:[[3,"removeAllClick","disableResetFilterBtn"],[3,"text","readOnly"],[3,"removeClick","text","readOnly"]],template:function(t,n){t&1&&(Ms(0,"ebank-filter-display-area",0),N_(1,"async"),qy("removeAllClick",function(){return n.resetFilters()}),IC(2,wn,1,2,"ebank-chip",1,vC),rd()),t&2&&(Ry("disableResetFilterBtn",R_(1,1,n.resetButtonDisabled$)),mb(2),EC(n.chips));},dependencies:[Y3,Vs,mn$1],encapsulation:2,changeDetection:1});}};$n$1();he();var Hn=i=>({number:i});function jn(i,e){if(i&1){let t=CC();Ms(0,"ebank-empty-state-description",5),N_(1,"async"),c_(2),N_(3,"translate"),rd(),Ms(4,"ebank-dropdown-button",6),N_(5,"async"),N_(6,"async"),qy("optionSelected",function(){yh(t);let m=RC(2);return vh(m.exportInvoices())}),c_(7),N_(8,"translate"),rd();}if(i&2){let t=RC(2);Ry("hidden",R_(1,6,t.showSpinner$)),mb(2),cd(" ",k_(3,8,"PAGE.AGREEMENT.INVOICES.MATCHING_RESULTS.MESSAGE",T_(17,Hn,e))," "),mb(2),Ry("isLoading",R_(5,11,t.showSpinner$))("options",t.exportOptions)("disabled",R_(6,13,t.showSpinner$)),mb(3),cd(" ",R_(8,15,"PAGE.AGREEMENT.INVOICES.EXPORT_INVOICE_LIST")," ");}}function Bn(i,e){i&1&&ky(0,"page-loading-spinner");}function $n(i,e){if(i&1){let t=CC();Ms(0,"ebank-sidebar-filter",2)(1,"ebank-filter-content",3),qy("executionSearchButtonClick",function(){yh(t);let m=RC();return vh(m.onSubmit())}),ky(2,"agreement-invoices-filters"),rd(),Ms(3,"ebank-main-content"),ky(4,"agreement-invoices-chips"),mC(5,jn,9,19),N_(6,"async"),ky(7,"agreement-invoices-list",4),N_(8,"async"),N_(9,"async"),mC(10,Bn,1,0,"page-loading-spinner"),N_(11,"async"),rd()();}if(i&2){let t,n=RC();Ry("showFilter",n.showFilter),mb(),Ry("executionSearch",true),mb(4),gC((t=R_(6,7,n.countElements$))?5:-1,t),mb(2),Ry("hidden",R_(8,9,n.showSpinner$))("setTotalItems",R_(9,11,n.countElements$))("notifyLoadMoreAgreementInvoices",n.loadMoreAgreementInvoicesCallback.bind(n)),mb(3),gC(R_(11,13,n.showSpinner$)?10:-1);}}function Un(i,e){i&1&&(Ms(0,"ebank-empty-state")(1,"ebank-empty-state-description"),c_(2),N_(3,"translate"),rd()()),i&2&&(mb(2),cd(" ",R_(3,1,"PAGE.AGREEMENT.INVOICES.NO_ACCOUNTS")," "));}var st=class i{constructor(e,t,n,m,b,te,Le,Tt){this.context=e;this.dataAccountsService=t;this.agreementInvoicesListService=n;this.agreementInvoicesStoreService=m;this.logService=b;this.alert=te;this.router=Le;this.exportTo=Tt;this.showSpinner$=new br$1(false);this.countElements$=new br$1(this.agreementInvoicesStoreService.state.countElements);this.accounts=this.agreementInvoicesStoreService.state.accounts||[];this.exportOptions=["CSV"];this.showFilter=!this.context.isMobileDevice;this.subscription=new H;this.agreementInvoicesFilters=this.agreementInvoicesStoreService.state.filters;this.paginationDefaultIndex=0;this.paginationDefaultNumber=50;}ngOnInit(){this.setSubscriptions(),this.agreementInvoicesStoreService.state.selectedInvoice||(this.preparePayload(),this.loadAllData());}ngOnDestroy(){this.subscription.unsubscribe();}exportInvoices(){this.showSpinner(true);let e=this.prepareFilterParamsForExport();this.exportTo.csvERA("agreementInvoicesExport",null,e,"GET").catch(t=>{this.alert.serverError(t,"PAGE.AGREEMENT.INVOICES.EXPORT_LIST.ERROR"),this.logService.error("AgreementInvoicesComponent: Error while exporting invoices to CSV",t);}).finally(()=>this.showSpinner(false));}loadMoreAgreementInvoicesCallback(){return hI({}).pipe(Sf(()=>{this.checkPagination(),this.preparePayload();}),_f(()=>this.loadMoreAgreementInvoices()),we(()=>this.isAllAgreementInvoicesLoaded()))}onSubmit(){this.agreementInvoicesStoreService.showResultsAction();}loadAllData(){this.showSpinner(true),this.subscription.add(CI([this.dataAccountsService.get(),this.agreementInvoicesListService.get(this.agreementInvoicesFilterParams)]).pipe(we(e=>this.handleData(e[0],e[1])),Sf(()=>this.showSpinner(false)),Sa(e=>this.handleError(e)),Vn(e=>!!e)).subscribe(e=>{this.setAgreementInvoicesState(e);}));}loadMoreAgreementInvoices(){return this.agreementInvoicesListService.get(this.agreementInvoicesFilterParams).pipe(Sf(e=>{this.paginationInfo=e.next,this.agreementInvoicesStoreService.setState(()=>({invoices:this.agreementInvoicesStoreService.state.invoices.concat(e.agreementInvoices),pagination:this.paginationInfo}));}),Sa(e=>this.handleError(e)))}loadAgreementInvoices(){this.showSpinner(true),this.agreementInvoicesListService.get(this.agreementInvoicesFilterParams).pipe(Sa(e=>this.handleError(e))).subscribe(e=>{this.setAgreementInvoicesState(e),this.showSpinner(false);});}setSubscriptions(){this.subscription.add(this.router.events.subscribe(e=>this.onRouterEventChange(e))),this.subscription.add(this.agreementInvoicesStoreService.state$.pipe(Vn(e=>this.byFilters(e.filters))).subscribe(e=>{this.fromDateIsAfterToDate()||(this.preparePayload(true),this.agreementInvoicesFilters=e.filters,this.loadAgreementInvoices());})),this.subscription.add(this.agreementInvoicesStoreService.sortingChangeClicked$.pipe(_p(1)).subscribe(e=>{this.bySorting(e)&&(this.agreementInvoicesStoreService.setState(()=>({sorting:e})),this.preparePayload(true),this.loadAgreementInvoices());}));}handleData(e,t){return this.accounts=e.filter(n=>n?.rights?.accessPermission),this.agreementInvoicesStoreService.setState(()=>({accounts:e})),t}handleError(e){return this.showSpinner(false),this.alert.serverError(e,"PAGE.AGREEMENT.INVOICES.FETCHING.ERROR"),this.logService.error("AgreementInvoicesComponent: Error while fetching invoices",e),hI(null)}setAgreementInvoicesState(e){let t=e.agreementInvoices.length;this.setInvoicesState(e.agreementInvoices),e.next&&(t=e.next.totalCount,this.setPaginationState(e.next)),this.paginationInfo=e.next,t===0&&this.resetSortState(),this.setCountElementsState(t),this.countElements$.next(t);}preparePayload(e){let t=this.agreementInvoicesStoreService.state.filters.search.trim(),n=/^[0-9]+$/.test(t);this.agreementInvoicesFilterParams={search:n?t:"%"+t,from_date:this.formatData(this.agreementInvoicesStoreService.state.filters.fromDate),to_date:this.formatData(this.agreementInvoicesStoreService.state.filters.toDate),index:e?this.paginationDefaultIndex:this.agreementInvoicesStoreService.state.pagination.index,number:this.agreementInvoicesStoreService.state.pagination?.number||this.paginationDefaultNumber,sort_field:this.agreementInvoicesStoreService.state.sorting.sortField,sort_order:this.agreementInvoicesStoreService.state.sorting.sortDirection};}checkPagination(){this.paginationInfo&&this.setPaginationFilterParams();}setInvoicesState(e){this.agreementInvoicesStoreService.setState(()=>({invoices:e}));}setPaginationState(e){this.agreementInvoicesStoreService.setState(()=>({pagination:e}));}setCountElementsState(e){this.agreementInvoicesStoreService.setState(()=>({countElements:e}));}isAllAgreementInvoicesLoaded(){return !this.paginationInfo}setPaginationFilterParams(){this.agreementInvoicesFilterParams.index=this.paginationInfo.index,this.agreementInvoicesFilterParams.number=this.paginationInfo.index+this.paginationDefaultNumber<=this.paginationInfo.totalCount?this.paginationDefaultNumber:this.paginationInfo.totalCount-this.paginationInfo.index;}showSpinner(e){this.showSpinner$.next(e);}formatData(e){return e&&Qe(e).format("YYYY-MM-DD")||""}byFilters(e){return this.agreementInvoicesFilters.search!==e.search||this.agreementInvoicesFilters.fromDate!==e.fromDate||this.agreementInvoicesFilters.toDate!==e.toDate}bySorting(e){return this.agreementInvoicesStoreService.state.sorting.sortDirection!==e.sortDirection||this.agreementInvoicesStoreService.state.sorting.sortField!==e.sortField}prepareFilterParamsForExport(){let e=this.agreementInvoicesFilterParams;return e.index=0,e}onRouterEventChange(e){e instanceof te&&this.isGoingOutsideInvoiceList(e.url)&&this.agreementInvoicesStoreService.resetStateToDefault();}isGoingOutsideInvoiceList(e){return !e.includes("page/agreements/invoices")}resetSortState(){this.agreementInvoicesStoreService.setState(()=>({sorting:{sortDirection:"desc",sortField:"invoiceDate"}}));}fromDateIsAfterToDate(){return Qe(this.agreementInvoicesStoreService.state.filters.fromDate).isAfter(Qe(this.agreementInvoicesStoreService.state.filters.toDate))}static{this.\u0275fac=function(t){return new(t||i)(Do(P),Do(G),Do(ke),Do(O),Do(xe),Do(E$1),Do(V$1),Do("ng1-exportTo"))};}
1static{this.\u0275cmp=qT({type:i,selectors:[["agreement-invoices"]],standalone:false,decls:5,vars:5,consts:[[3,"loading"],[3,"url"],[3,"showFilter"],["formId","formId",3,"executionSearchButtonClick","executionSearch"],[3,"hidden","setTotalItems","notifyLoadMoreAgreementInvoices"],[3,"hidden"],["size","s",1,"ebank-dropdown-export","ebank-dropdown-export-table",3,"optionSelected","isLoading","options","disabled"]],template:function(t,n){t&1&&(Ms(0,"ebank-spinner",0),N_(1,"async"),ky(2,"old-page-link",1),mC(3,$n,12,15,"ebank-sidebar-filter",2)(4,Un,4,3,"ebank-empty-state"),rd()),t&2&&(Ry("loading",R_(1,3,n.showSpinner$)),mb(2),Ry("url","URL.CNB.INVOICE_LIST"),mb(),gC(n.accounts.length?3:4));},dependencies:[g,mg,v6,sN,Wa,Nf,X9,Ys,y,rt,ot,at,mn$1,ye],encapsulation:2,changeDetection:1});}};da();pi();vM();da();j$2();W();N$1();$N();var zi=N(ep());vM();$n$1();he();function Yn(i,e){if(i&1&&(Ms(0,"div"),c_(1),rd()),i&2){let t=e.$implicit,n=e.$index;KC(g_("agreement-invoices-details-address__details--",n+1)),mb(),cd(" ",t.value," ");}}function Kn(i,e){if(i&1&&(Ms(0,"div",3)(1,"span",5),c_(2),rd(),c_(3,"\xA0 "),Ms(4,"span",6),c_(5),rd()()),i&2){let t=RC();mb(2),cv(t.data?.address?.postalCode),mb(3),cv(t.data?.address?.postalCity);}}var ct=class i{get address(){let e=this.addressType==="Sender"?["addressLine1","postalCity","postalCode"]:["postalCity","postalCode"];return (0, zi.omit)(this.data.address,e)}static{this.\u0275fac=function(t){return new(t||i)};}
1static{this.\u0275cmp=qT({type:i,selectors:[["agreement-invoices-details-address"]],inputs:{header:"header",data:"data",addressType:"addressType"},standalone:false,decls:11,vars:9,consts:[[1,"ebank-title-h3"],[1,"agreement-invoices-details-address__name"],[3,"class"],[1,"agreement-invoices-details-address__postal"],[1,"agreement-invoices-details-address__organisation_no"],[1,"agreement-invoices-details-address__postal__code"],[1,"agreement-invoices-details-address__postal__city"]],template:function(t,n){t&1&&(Ms(0,"h2",0),c_(1),rd(),Ms(2,"div",1),c_(3),rd(),IC(4,Yn,2,4,"div",2,vC),N_(6,"keyvalue"),mC(7,Kn,6,2,"div",3),Ms(8,"div",4),c_(9),N_(10,"translate"),rd()),t&2&&(mb(),cv(n.header),mb(2),cv(n.data?.name),mb(),EC(R_(6,5,n.address)),mb(3),gC(n.data?.address?.postalCode&&n.data?.address?.postalCity?7:-1),mb(2),lv(" ",R_(10,7,"PAGE.AGREEMENT.INVOICE_DETAILS.ORGANISATION_NO")," ",n.data?.organizationNumber,` 2`));},dependencies:[bn$1,ye],encapsulation:2,changeDetection:1});}};var qi=N(ep());vM();$N();$n$1();function zn(i,e){if(i&1&&(Ms(0,"div",2),ky(1,"dt",3)(2,"dd",4),rd()),i&2){let t=e.$implicit;mb(),Ry("innerHTML",t.key,bw),mb(),Ry("innerHTML",t.value,bw);}}var mt=class i{constructor(e){this.helperService=e;this.keepOriginalOrder=()=>0;}get formattedData(){return this.data&&this.invoiceDate&&(0, qi.isNumber)(this.invoiceAmount)?this.helperService.formatDetailsEssentialData(this.data,this.invoiceDate,this.invoiceAmount):{}}static{this.\u0275fac=function(t){return new(t||i)(Do($))};}
2static{this.\u0275cmp=qT({type:i,selectors:[["agreement-invoices-details-essential"]],inputs:{data:"data",invoiceDate:"invoiceDate",invoiceAmount:"invoiceAmount"},standalone:false,decls:5,vars:3,consts:[[1,"ebank-description-list-wrapper"],["groupHeadingId","heading-id"],["ebankDescriptionListItem",""],["ebankDescriptionListTerm","",3,"innerHTML"],["ebankDescriptionListDesc","",3,"innerHTML"]],template:function(t,n){t&1&&(Ms(0,"div",0)(1,"ebank-description-list",1),IC(2,zn,3,2,"div",2,vC),N_(4,"keyvalue"),rd()()),t&2&&(mb(2),EC(k_(4,0,n.formattedData,n.keepOriginalOrder)));},dependencies:[vO,Ws,W8,G8,bn$1],encapsulation:2,changeDetection:1});}};vM();$N();$n$1();he();function Xn(i,e){i&1&&(Ms(0,"th",9),c_(1),N_(2,"translate"),rd()),i&2&&(mb(),cd(" ",R_(2,1,"PAGE.AGREEMENT.INVOICE_DETAILS.SERVICE_SPEC.HEADER")," "));}function Qn(i,e){if(i&1&&(Ms(0,"td",10),c_(1),rd()),i&2){let t=e.$implicit;mb(),cd(" ",t.name," ");}}function Zn(i,e){i&1&&ky(0,"td",11);}function Jn(i,e){i&1&&(Ms(0,"th",9),c_(1),N_(2,"translate"),rd()),i&2&&(mb(),cd(" ",R_(2,1,"PAGE.AGREEMENT.INVOICE_DETAILS.SERVICE_SPEC.PRICE")," "));}function er(i,e){if(i&1&&(Ms(0,"td",10),c_(1),N_(2,"number"),rd()),i&2){let t=e.$implicit;mb(),cd(" ",k_(2,1,t?.totalAmount?.amount||0,".2")," ");}}function tr(i,e){i&1&&ky(0,"td",11);}function ir(i,e){i&1&&ky(0,"tr",12);}function nr(i,e){i&1&&ky(0,"tr",13);}var lt=class i{constructor(){this.columnNames=["name","amount"];}static{this.\u0275fac=function(t){return new(t||i)};}
2static{this.\u0275cmp=qT({type:i,selectors:[["agreement-invoices-details-service"]],inputs:{data:"data"},standalone:false,decls:15,vars:9,consts:[["ebankTableHeader","",1,"ebank-title-h3"],["ebankTable","",3,"dataSource"],["ebankColumnDef","name","ebankMainColumn","name"],["ebankHeaderCell","",4,"ebankHeaderCellDef"],["ebankCell","",4,"ebankCellDef"],["ebankFooterCell","",4,"ebankFooterCellDef"],["ebankColumnDef","amount"],["ebankHeaderRow","",4,"ebankHeaderRowDef","ebankHeaderRowDefSticky"],["ebankRow","",4,"ebankRowDef","ebankRowDefColumns"],["ebankHeaderCell",""],["ebankCell",""],["ebankFooterCell",""],["ebankHeaderRow",""],["ebankRow",""]],template:function(t,n){t&1&&(Ms(0,"ebank-table-wrapper")(1,"h3",0),c_(2),N_(3,"translate"),rd(),Ms(4,"table",1),sd(5,2),wy(6,Xn,3,3,"th",3)(7,Qn,2,1,"td",4)(8,Zn,1,0,"td",5),Qs$1(),sd(9,6),wy(10,Jn,3,3,"th",3)(11,er,3,4,"td",4),Qs$1(),wy(12,tr,1,0,"td",5)(13,ir,1,0,"tr",7)(14,nr,1,0,"tr",8),rd()()),t&2&&(mb(2),cd(" ",R_(3,7,"PAGE.AGREEMENT.INVOICE_DETAILS.SERVICE_SPEC.HEADER")," "),mb(2),Ry("dataSource",n.data),mb(2),Ry("ebankHeaderCellDef","name"),mb(4),Ry("ebankHeaderCellDef","amount"),mb(3),Ry("ebankHeaderRowDef",n.columnNames)("ebankHeaderRowDefSticky",true),mb(),Ry("ebankRowDefColumns",n.columnNames));},dependencies:[Qi$1,za,T6,N6,tl,w6,R6,S6,M6,hN,D6,Z3,Cg,iI,In$1,ye],encapsulation:2});}};vM();pi();vM();var Xi=N(ep());vM();he();var pt=class i{constructor(e){this.translateService=e;}getAccountDetailedCostSpecification(e){let t={};return (e||[]).forEach((n,m)=>{t[m]=this.formatMetadata(e,n,m);}),t}formatData(e){return (0, Xi.flatten)(this.toDetailsCostTypeNestedArray(e))||[]}toDetailsCostTypeNestedArray(e){let t=this.translateService.instant("PAGE.AGREEMENT.INVOICE_DETAILS.ACCOUNT_COST_SPEC.ACCOUNT_TOTAL");return e.map(({accountNumber:n,elements:m})=>[...this.mapToCostType(n,m),{accountNumber:n,name:t,totalAmount:{currency:"",amount:this.totalAmountPerAccountGroup(m)}}])}totalAmountPerAccountGroup(e){return e.map(t=>t?.totalAmount?.amount).reduce((t,n)=>t+n,0)}mapToCostType(e,t){return t.map(n=>E$3({accountNumber:e},n))}formatMetadata(e,t,n){let m=this.isAccountNumberColumn(e,t,n);return {rowSpan:m?this.countFormattedDataByAccountNumber(e,t):0,display:m?"":"none"}}countFormattedDataByAccountNumber(e,t){return e.filter(n=>n&&n.accountNumber===t.accountNumber).length}isAccountNumberColumn(e,t,n){return !n||e?.[n-1]?.accountNumber!==t?.accountNumber}static{this.\u0275fac=function(t){return new(t||i)(de(V))};}static{this.\u0275prov=X({token:i,factory:i.\u0275fac,providedIn:"any"});}};$N();$n$1();he();function ar(i,e){i&1&&(Ms(0,"th",13),c_(1),N_(2,"translate"),rd()),i&2&&(mb(),cd(" ",R_(2,1,"PAGE.AGREEMENT.INVOICE_DETAILS.ACCOUNT_COST_SPEC.ACCOUNT")," "));}function sr(i,e){if(i&1&&(Ms(0,"td",14),N_(1,"async"),N_(2,"async"),c_(3),rd()),i&2){let t=e.$implicit,n=e.index,m=RC(2);Xy("display",R_(1,4,m.isDesktopView$)?m.accountCostsDisplayProperties[n].display:""),Ay("rowspan",R_(2,6,m.isDesktopView$)?m.accountCostsDisplayProperties[n].rowSpan:1),mb(3),cd(" ",t?.accountNumber," ");}}function cr(i,e){i&1&&ky(0,"td",15);}function mr(i,e){i&1&&(Ms(0,"th",13),c_(1),N_(2,"translate"),rd()),i&2&&(mb(),cd(" ",R_(2,1,"PAGE.AGREEMENT.INVOICE_DETAILS.ACCOUNT_COST_SPEC.DETAILED_SPEC")," "));}function lr(i,e){if(i&1&&(Ms(0,"td",14),c_(1),rd()),i&2){let t=e.$implicit;mb(),cd(" ",t?.name," ");}}function pr(i,e){i&1&&(Ms(0,"th",13),c_(1),N_(2,"translate"),rd()),i&2&&(mb(),cd(" ",R_(2,1,"PAGE.AGREEMENT.INVOICE_DETAILS.ACCOUNT_COST_SPEC.VOLUME")," "));}function dr(i,e){if(i&1&&(Ms(0,"td",14),c_(1),rd()),i&2){let t=e.$implicit;mb(),cd(" ",t?.quantity," ");}}function vr(i,e){i&1&&(Ms(0,"th",13),c_(1),N_(2,"translate"),rd()),i&2&&(mb(),cd(" ",R_(2,1,"PAGE.AGREEMENT.INVOICE_DETAILS.ACCOUNT_COST_SPEC.UNIT_PRICE")," "));}function ur(i,e){if(i&1&&(Ms(0,"td",14),c_(1),N_(2,"number"),rd()),i&2){let t=e.$implicit;mb(),cd(" ",k_(2,1,t==null||t.unitPrice==null?null:t.unitPrice.amount,".2")," ");}}function fr(i,e){i&1&&(Ms(0,"th",13),c_(1),N_(2,"translate"),rd()),i&2&&(mb(),cd(" ",R_(2,1,"PAGE.AGREEMENT.INVOICE_DETAILS.ACCOUNT_COST_SPEC.TOTAL_PRICE")," "));}function gr(i,e){if(i&1&&(Ms(0,"td",14),c_(1),N_(2,"number"),rd()),i&2){let t=e.$implicit;mb(),cd(" ",k_(2,1,t==null||t.totalAmount==null?null:t.totalAmount.amount,".2")," ");}}function Cr(i,e){i&1&&ky(0,"td",15);}function Ir(i,e){i&1&&ky(0,"tr",16);}function br(i,e){i&1&&ky(0,"tr",17);}function Dr(i,e){if(i&1&&(Ms(0,"ebank-table-wrapper")(1,"h3",0),c_(2),N_(3,"translate"),rd(),Ms(4,"table",1),sd(5,2),wy(6,ar,3,3,"th",3)(7,sr,4,8,"td",4)(8,cr,1,0,"td",5),Qs$1(),sd(9,6),wy(10,mr,3,3,"th",3)(11,lr,2,1,"td",7),Qs$1(),sd(12,8),wy(13,pr,3,3,"th",3)(14,dr,2,1,"td",7),Qs$1(),sd(15,9),wy(16,vr,3,3,"th",3)(17,ur,3,4,"td",7),Qs$1(),sd(18,10),wy(19,fr,3,3,"th",3)(20,gr,3,4,"td",7),Qs$1(),wy(21,Cr,1,0,"td",5)(22,Ir,1,0,"tr",11)(23,br,1,0,"tr",12),rd()()),i&2){let t=RC();mb(2),cd(" ",R_(3,10,"PAGE.AGREEMENT.INVOICE_DETAILS.ACCOUNT_COST_SPEC.HEADER")," "),mb(2),Ry("dataSource",t.formattedData),mb(2),Ry("ebankHeaderCellDef","accountNumber"),mb(4),Ry("ebankHeaderCellDef","name"),mb(3),Ry("ebankHeaderCellDef","quantity"),mb(3),Ry("ebankHeaderCellDef","unitPrice"),mb(3),Ry("ebankHeaderCellDef","totalAmount"),mb(3),Ry("ebankHeaderRowDef",t.columnNames)("ebankHeaderRowDefSticky",true),mb(),Ry("ebankRowDefColumns",t.columnNames);}}var dt=class i{constructor(e,t){this.costHelperService=e;this.document=t;this.columnNames=["accountNumber","name","quantity","unitPrice","totalAmount"];this.isDesktopView$=Ya(this.document.defaultView,"resize").pipe(Cf(n[2]<this.document.defaultView.innerWidth),hf(10),we(()=>n[2]<this.document.defaultView.innerWidth),wf(1));}set data(e){e&&(this.formattedData=this.costHelperService.formatData(e),this.accountCostsDisplayProperties=this.costHelperService.getAccountDetailedCostSpecification(this.formattedData));}static{this.\u0275fac=function(t){return new(t||i)(Do(pt),Do(Kr))};}
2static{this.\u0275cmp=qT({type:i,selectors:[["agreement-invoices-details-cost"]],inputs:{data:"data"},standalone:false,decls:1,vars:1,consts:[["ebankTableHeader","",1,"ebank-title-h3"],["ebankTable","",3,"dataSource"],["ebankColumnDef","accountNumber","ebankMainColumn","accountNumber"],["ebankHeaderCell","",4,"ebankHeaderCellDef"],["ebankCell","",3,"display",4,"ebankCellDef"],["ebankFooterCell","",4,"ebankFooterCellDef"],["ebankColumnDef","name"],["ebankCell","",4,"ebankCellDef"],["ebankColumnDef","quantity","ebankRightAlignColumn",""],["ebankColumnDef","unitPrice","ebankRightAlignColumn",""],["ebankColumnDef","totalAmount","ebankRightAlignColumn",""],["ebankHeaderRow","",4,"ebankHeaderRowDef","ebankHeaderRowDefSticky"],["ebankRow","",4,"ebankRowDef","ebankRowDefColumns"],["ebankHeaderCell",""],["ebankCell",""],["ebankFooterCell",""],["ebankHeaderRow",""],["ebankRow",""]],template:function(t,n){t&1&&mC(0,Dr,24,12,"ebank-table-wrapper"),t&2&&gC(n.formattedData?.length&&n.accountCostsDisplayProperties?0:-1);},dependencies:[Qi$1,za,T6,N6,tl,w6,R6,S6,M6,hN,D6,Z3,Cg,iI,mn$1,In$1,ye],encapsulation:2,changeDetection:1});}};vM();vM();$N();$n$1();he();var Er=(i,e)=>e.id;function Ar(i,e){if(i&1&&(Ms(0,"div",2),ky(1,"dt",3),N_(2,"translate"),ky(3,"dd",4),N_(4,"number"),rd()),i&2){let t=e.$implicit;mb(),Ry("innerHTML",R_(2,2,t.id),bw),mb(2),Ry("innerHTML",k_(4,4,t.value,".2"),bw);}}var vt=class i{constructor(){this.invoiceAmount=N$(void 0);this.fixedFees=N$(void 0);this.data=jt(()=>[{id:"PAGE.AGREEMENT.INVOICE_DETAILS.SUMMARY.FIXED_FEES",value:this.fixedFees()?.amount||0},{id:"PAGE.AGREEMENT.INVOICE_DETAILS.SUMMARY.INVOICE_AMOUNT",value:this.invoiceAmount()||0}]);}static{this.\u0275fac=function(t){return new(t||i)};}
2static{this.\u0275cmp=qT({type:i,selectors:[["agreement-invoices-details-summary"]],inputs:{invoiceAmount:[1,"invoiceAmount"],fixedFees:[1,"fixedFees"]},standalone:false,decls:4,vars:0,consts:[[1,"ebank-description-list-wrapper"],["groupHeadingId","heading-id"],["ebankDescriptionListItem",""],["ebankDescriptionListTerm","",3,"innerHTML"],["ebankDescriptionListDesc","",3,"innerHTML"]],template:function(t,n){t&1&&(Ms(0,"div",0)(1,"ebank-description-list",1),IC(2,Ar,5,7,"div",2,Er),rd()()),t&2&&(mb(2),EC(n.data()));},dependencies:[vO,Ws,W8,G8,In$1,ye],encapsulation:2});}};$n$1();he();function _r(i,e){if(i&1){let t=CC();Ms(0,"ebank-dropdown-button",0),N_(1,"async"),qy("optionSelected",function(){yh(t);let m=RC();return vh(m.exportInvoice())}),c_(2),N_(3,"translate"),rd(),Ms(4,"div",1),ky(5,"agreement-invoices-details-address",2),N_(6,"translate"),ky(7,"agreement-invoices-details-address",2),N_(8,"translate"),rd(),ky(9,"agreement-invoices-details-essential",3)(10,"agreement-invoices-details-service",4)(11,"agreement-invoices-details-cost",5)(12,"agreement-invoices-details-summary",6);}if(i&2){let t=e,n=RC();Ry("options",n.exportOptions)("disabled",R_(1,16,n.isExporting$)),mb(2),cd(" ",R_(3,18,"PAGE.AGREEMENT.INVOICE_DETAILS.EXPORT_INVOICE")," "),mb(3),Ry("header",R_(6,20,"PAGE.AGREEMENT.INVOICE_DETAILS.SENDER"))("data",t==null?null:t.invoiceSender)("addressType","Sender"),mb(2),Ry("header",R_(8,22,"PAGE.AGREEMENT.INVOICE_DETAILS.RECEIVER"))("data",t==null?null:t.debitor)("addressType","Receiver"),mb(2),Ry("data",t==null?null:t.invoiceDetails)("invoiceDate",n.invoiceDate)("invoiceAmount",n.invoiceAmount),mb(),Ry("data",t==null?null:t.services),mb(),Ry("data",t==null?null:t.serviceDetails),mb(),Ry("invoiceAmount",n.invoiceAmount)("fixedFees",t==null?null:t.fixedFees);}}function yr(i,e){i&1&&ky(0,"page-loading-spinner");}var ut=class i{constructor(e,t,n,m,b,te){this.router=e;this.routeDataService=t;this.agreementInvoicesStoreService=n;this.agreementInvoicesHelperService=m;this.logService=b;this.alert=te;this.isExporting$=new br$1(false);this.exportOptions=["PDF"];this.subscription=new H;}ngOnInit(){this.setSubscriptions();}ngOnDestroy(){this.subscription.unsubscribe();}exportInvoice(){this.isExporting(true),this.agreementInvoicesStoreService.state.selectedInvoice.exportInvoiceToPdf().then(e=>{this.agreementInvoicesHelperService.processAndDownload(e,this.invoiceId);}).catch(e=>{this.alert.serverError(e,"PAGE.AGREEMENT.INVOICES.EXPORT.ERROR"),this.logService.error(`AgreementInvoicesDetailsComponent: Error while exporting ${this.invoiceId} to PDF`,e);}).finally(()=>{this.isExporting(false);});}setInvoiceProperties(){this.invoiceId=this.agreementInvoicesStoreService.state.selectedInvoice.invoiceNumber,this.invoiceDate=this.agreementInvoicesStoreService.state.selectedInvoice.invoiceDate,this.invoiceAmount=this.agreementInvoicesStoreService.state.selectedInvoice.amount,this.routeDataService.addData({title:"PAGE.AGREEMENT.INVOICE_DETAILS.TITLE",titleParams:{invoiceId:this.invoiceId}});}setInvoiceDetailsData(){this.detailsData$=Ee(this.agreementInvoicesStoreService.state.selectedInvoice.getDetails()).pipe(we(e=>(e.debitor.name=this.agreementInvoicesStoreService.state.selectedInvoice.receiver,e)),Sa(e=>(this.alert.serverError(e,"PAGE.AGREEMENT.INVOICE_DETAILS.FETCHING.ERROR"),this.logService.error(`AgreementInvoicesDetailsComponent: Error while fetching ${this.invoiceId} details`,e),this.router.navigate(["page","agreements","invoices"]),[])));}setSubscriptions(){this.subscription.add(this.agreementInvoicesStoreService.state$.pipe(hf(10)).subscribe(e=>{e.selectedInvoice?(this.setInvoiceProperties(),this.setInvoiceDetailsData()):this.navigateToTheListPage();})),this.subscription.add(this.router.events.subscribe(e=>this.onRouterEventChange(e)));}navigateToTheListPage(){this.router.navigate(["page","agreements","invoices"]);}isExporting(e){this.isExporting$.next(e);}onRouterEventChange(e){e instanceof te&&this.isGoingOutsideInvoiceList(e.url)&&this.agreementInvoicesStoreService.resetStateToDefault();}isGoingOutsideInvoiceList(e){return !e.includes("agreements/invoices")}static{this.\u0275fac=function(t){return new(t||i)(Do(V$1),Do(S$1),Do(O),Do($),Do(E$2),Do(E$1))};}
2static{this.\u0275cmp=qT({type:i,selectors:[["agreement-invoices-details"]],standalone:false,decls:3,vars:3,consts:[["size","s",1,"ebank-dropdown-export",3,"optionSelected","options","disabled"],[1,"agreement-invoices-details__addresses"],[3,"header","data","addressType"],[3,"data","invoiceDate","invoiceAmount"],[3,"data"],[1,"agreement-invoices-details__cost",3,"data"],[3,"invoiceAmount","fixedFees"]],template:function(t,n){if(t&1&&(mC(0,_r,13,24),N_(1,"async"),nd(2,yr,1,0,"page-loading-spinner")),t&2){let m;gC((m=R_(1,1,n.detailsData$))?0:2,m);}},dependencies:[g,Wa,ct,mt,lt,dt,vt,mn$1,ye],encapsulation:2,changeDetection:1});}};vM();var Tr=[{path:"",component:st,data:{name:"agreement-invoices",title:"PAGE.AGREEMENT.INVOICES.TITLE",ebankuiPage:"large"}},{path:"details",component:ut,data:{name:"agreement-invoices-details",breadcrumbLabel:"PAGE.AGREEMENT.INVOICES.TITLE",breadcrumbPath:"agreements/invoices",ebankuiPage:"medium"}}],ft=class i{static{this.\u0275fac=function(t){return new(t||i)};}static{this.\u0275mod=my({type:i});}static{this.\u0275inj=Oc({imports:[aa.forChild(Tr),aa]});}};vM();var Qi=class i{static{this.\u0275fac=function(t){return new(t||i)};}static{this.\u0275mod=my({type:i});}static{this.\u0275inj=Oc({providers:[ke,$,xe],imports:[ft,ii,xt,dn$1,k6,Cu,t8,_8,Wa,B6,Ro,Nf,Rf,X9,a6.forRoot({useFactory:e=>({showCounter:({count:t=0,total:n=0})=>e.instant("EBANKUI.CONFIG.LOAD_MORE.SHOW_COUNTER",{count:t,total:n}),loadedAmount:({amount:t})=>e.instant("EBANKUI.CONFIG.LOAD_MORE.LOADED_AMOUNT",{amount:t})}),deps:[V]}),vO,Y3,Vs,Ga,xu,p,H8,Bf,Pf]});}};export{Qi as AgreementInvoicesModule};
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.