import{a as lo}from"./chunk-5ROYRYAF.js";import{b as mo,c as xo}from"./chunk-QKMZ3A5S.js";import{a as We,b as ue,d as uo,e as fo,f as bo,g as wi,h as Ye,i as Hi,j as wo,k as Ae,l as Je,m as Vt,n as So}from"./chunk-2QWNQTJZ.js";import{a as _o,b as vo,c as ho}from"./chunk-YTD236A7.js";import{a as Ui,b as co,c as hn,d as Cn,e as Co}from"./chunk-LMJPPEGF.js";import{c as yo}from"./chunk-67ZMAMW3.js";import{a as Oe,b as ct}from"./chunk-HRZRW3RK.js";import{a as oi,b as ke,c as yi,d as bi,f as at,g as kt,h as At,i as Ot,j as Ft,k as ro}from"./chunk-6CYNN6GY.js";import{a as Tt,b as yt,c as bt,d as Zn,e as ni,f as to}from"./chunk-IY7TJIUM.js";import{a as ve,c as ft}from"./chunk-IDBHWKSL.js";import{a as ji,b as eo}from"./chunk-RBYE72UH.js";import{b as Nn,c as Ln,i as Ze}from"./chunk-HIL4HGDQ.js";import{a as Te}from"./chunk-IS3JRR4D.js";import{a as qe,b as Ke,c as po,d as Xe,e as go}from"./chunk-24DFGMZG.js";import{a as Fe,b as Ve,c as Be,d as Re,e as Ne,f as Le,g as je,h as Ue,i as He,j as $e,k as Ge,l as so}from"./chunk-72XYY5XX.js";import{a as Ct}from"./chunk-JXKEKZLA.js";import{Ac as mt,Ae as G,Bb as Ut,Bc as _n,Be as Qn,Cb as Pe,Ce as O,Da as An,Db as nt,Eb as fi,Ec as U,Ee as zn,Fe as ii,Ga as Bi,Gc as ce,Ge as Wn,Hb as u,Ia as f,Ib as v,Jb as F,Jc as V,Jd as vn,Kc as ae,Lc as gi,Ma as s,Mc as Me,Nb as xt,Nc as ei,Nd as $n,Oa as ee,Ob as Fn,Oc as Ee,Pc as R,Q as re,Qa as jt,Qc as et,R as Kt,Rc as Ce,Sc as jn,T as Y,Tc as le,Uc as xe,Wa as a,Wb as Ht,Wc as ye,X as w,Xa as r,Xb as Vn,Xd as ti,Y as Xt,Ya as _,Za as Q,Zb as T,_a as z,_b as M,_d as Gn,ab as S,c as it,cd as Un,cf as te,da as y,db as C,dd as Hn,df as ut,ea as b,ef as q,fb as d,fc as Yt,ff as de,gc as xi,gf as be,hc as me,hf as K,ib as Ri,ic as Bn,if as oe,jf as Kn,lb as N,lc as Z,lf as Xn,mb as L,mc as $,mf as E,nb as j,nc as _e,nf as Yn,oa as Vi,ob as fe,of as Jn,pb as l,pf as io,qb as I,qf as ri,rb as m,re as H,rf as no,sb as ge,se as Ni,sf as oo,t as Qe,ta as ht,tb as dt,te as Li,tf as ze,ua as St,ub as On,ue as rt,uf as ao,wb as we,xa as o,xb as Se,xc as Jt,xe as B,ya as h,yb as Ie,yc as Rn,ye as qn,zc as Zt}from"./chunk-B5D4QNNR.js";import{d as Jr,f as kn}from"./chunk-GAL4ENT6.js";var Dn=Jr((In,Mn)=>{(function(i,p){typeof define=="function"&&define.amd?define([],p):typeof In<"u"?p():(p(),i.FileSaver={})})(In,function(){"use strict";function i(x,P){return typeof P>"u"?P={autoBom:!1}:typeof P!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),P={autoBom:!P}),P.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(x.type)?new Blob(["\uFEFF",x],{type:x.type}):x}function p(x,P,k){var A=new XMLHttpRequest;A.open("GET",x),A.responseType="blob",A.onload=function(){g(A.response,P,k)},A.onerror=function(){console.error("could not download file")},A.send()}function e(x){var P=new XMLHttpRequest;P.open("HEAD",x,!1);try{P.send()}catch{}return 200<=P.status&&299>=P.status}function t(x){try{x.dispatchEvent(new MouseEvent("click"))}catch{var P=document.createEvent("MouseEvents");P.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),x.dispatchEvent(P)}}var n=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof global=="object"&&global.global===global?global:void 0,c=n.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),g=n.saveAs||(typeof window!="object"||window!==n?function(){}:"download"in HTMLAnchorElement.prototype&&!c?function(x,P,k){var A=n.URL||n.webkitURL,ie=document.createElement("a");P=P||x.name||"download",ie.download=P,ie.rel="noopener",typeof x=="string"?(ie.href=x,ie.origin===location.origin?t(ie):e(ie.href)?p(x,P,k):t(ie,ie.target="_blank")):(ie.href=A.createObjectURL(x),setTimeout(function(){A.revokeObjectURL(ie.href)},4e4),setTimeout(function(){t(ie)},0))}:"msSaveOrOpenBlob"in navigator?function(x,P,k){if(P=P||x.name||"download",typeof x!="string")navigator.msSaveOrOpenBlob(i(x,k),P);else if(e(x))p(x,P,k);else{var A=document.createElement("a");A.href=x,A.target="_blank",setTimeout(function(){t(A)})}}:function(x,P,k,A){if(A=A||open("","_blank"),A&&(A.document.title=A.document.body.innerText="downloading..."),typeof x=="string")return p(x,P,k);var ie=x.type==="application/octet-stream",Pt=/constructor/i.test(n.HTMLElement)||n.safari,tt=/CriOS\/[\d]+/.test(navigator.userAgent);if((tt||ie&&Pt||c)&&typeof FileReader<"u"){var Ti=new FileReader;Ti.onloadend=function(){var Ai=Ti.result;Ai=tt?Ai:Ai.replace(/^data:[^;]*;/,"data:attachment/file;"),A?A.location.href=Ai:location=Ai,A=null},Ti.readAsDataURL(x)}else{var ki=n.URL||n.webkitURL,Et=ki.createObjectURL(x);A?A.location=Et:location.href=Et,A=null,setTimeout(function(){ki.revokeObjectURL(Et)},4e4)}});n.saveAs=g.saveAs=g,typeof Mn<"u"&&(Mn.exports=g)})});var Io=(()=>{class i extends io{constructor(e,t){super(e,t)}getStreamController(){return null}getModuleName(){return"commerce"}getMenu(){var e=new Ct("commerce.front.1","","fal fa-list"),t=new Ct("commerce.front.6","attributesets","fal fa-sliders-v-square");return[new Ct("commerce.front.1","","fal fa-list",[e,t]),new Ct("commerce.front.2","categories","fal fa-layer-group"),new Ct("commerce.front.3","prices","fal fa-tags"),new Ct("commerce.front.4","orders","fal fa-receipt"),new Ct("commerce.front.10","invoice","fal fa-file-invoice-dollar"),new Ct("commerce.front.11","trace","fal fa-thin fa-ban-bug"),new Ct("commerce.front.7","contacts","fal fa-address-book",[new Ct("commerce.front.8","companies","fal fa-industry-alt"),new Ct("commerce.front.9","private","fad fa-person-booth")]),new Ct("commerce.front.5","settings","fal fa-cogs")]}getModuleWidgetMenus(){return[]}static \u0275fac=function(t){return new(t||i)(h(Jn),h(Zt))};static \u0275cmp=w({type:i,selectors:[["app-front"]],features:[Bi],decls:3,vars:0,consts:[["contentarea",""],[1,"modulecontentarea"]],template:function(t,n){t&1&&(a(0,"div",1,0),_(2,"router-outlet"),r())},dependencies:[Rn],styles:[".modulecontentarea[_ngcontent-%COMP%]{padding:20px}"]})}return i})();var ai=(()=>{class i{httpService;urlService;addProductToList(e,t){let n=[];n.push({name:"listId",value:e}),n.push({name:"productId",value:t});let c=new $;for(let g of n)c=c.append(g.name,g.value);return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/listcontroller/addProductToList",null,{params:c})}constructor(e,t){this.httpService=e,this.urlService=t}createList(e){let t=[];t.push({name:"name",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/listcontroller/create",null,{params:n})}deleteImage(e,t){let n=[];n.push({name:"listId",value:e}),n.push({name:"uuid",value:t});let c=new $;for(let g of n)c=c.append(g.name,g.value);return this.httpService.delete(this.urlService.getBackendUrl()+"/commerce/listcontroller/deleteImage",{params:c})}deleteList(e){let t=[];t.push({name:"id",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/listcontroller/delete",null,{params:n})}getLists(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/listcontroller/getCategories",e,{headers:t})}getProductList(e){let t=[];t.push({name:"listId",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/listcontroller/list",{params:n})}removeProductFromList(e,t){let n=[];n.push({name:"listId",value:e}),n.push({name:"productId",value:t});let c=new $;for(let g of n)c=c.append(g.name,g.value);return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/listcontroller/removeProductFromList",null,{params:c})}updateList(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/listcontroller/update",e,{headers:t})}uploadImage(e,t,n,c){let g=[];g.push({name:"listid",value:e}),g.push({name:"type",value:t}),g.push({name:"name",value:n});let x=new $;for(let k of g)x=x.append(k.name,k.value);let P=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/listcontroller/uploadimage",c,{headers:P,params:x})}static \u0275fac=function(t){return new(t||i)(Y(_e),Y(ve))};static \u0275prov=re({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();function Zr(i,p){if(i&1){let e=S();a(0,"button",7),C("click",function(){y(e);let n=d();return b(n.createCategory())}),l(1),u(2,"translate"),r()}i&2&&(o(),I(v(2,1,"commerce.categorydialog.3")))}var Mo=(()=>{class i{listController;newCategory=!1;subject=new it;categoryName=new R("",[ce.required]);constructor(e){this.listController=e}ngOnInit(){}onDataChanged(){return this.subject.asObservable()}createCategory(){this.listController.createList(this.categoryName.value).subscribe(e=>{this.subject.next(e)})}static \u0275fac=function(t){return new(t||i)(h(ai))};static \u0275cmp=w({type:i,selectors:[["app-create-list-dialog"]],decls:13,vars:8,consts:[["mat-dialog-title",""],[1,"mat-typography"],["appearance","fill",1,"example-full-width"],["matInput","","placeholder","","value","",3,"formControl"],["align","end"],["mat-button","","mat-dialog-close",""],["mat-button","",3,"click",4,"ngIf"],["mat-button","",3,"click"]],template:function(t,n){t&1&&(a(0,"h2",0),l(1),u(2,"translate"),r(),a(3,"mat-dialog-content",1)(4,"mat-form-field",2)(5,"mat-label"),l(6),u(7,"translate"),r(),_(8,"input",3),r()(),a(9,"mat-dialog-actions",4)(10,"button",5),l(11,"Cancel"),r(),f(12,Zr,3,3,"button",6),r()),t&2&&(o(),I(v(2,4,"commerce.categorydialog.1")),o(5),I(v(7,6,"commerce.categorydialog.2")),o(2),s("formControl",n.categoryName),o(4),s("ngIf",n.newCategory))},dependencies:[M,de,be,oe,K,B,H,G,U,V,le,O,E]})}return i})();var ea=["paginator"],ta=["sorter"],ia=()=>[5,10,25,100],na=i=>["../list",i];function oa(i,p){i&1&&(a(0,"th",19),l(1," ID "),r())}function ra(i,p){if(i&1&&(a(0,"td",20),l(1),r()),i&2){let e=p.$implicit;o(),m(" ",e.id," ")}}function aa(i,p){i&1&&(a(0,"th",19),l(1," Name "),r())}function ca(i,p){if(i&1&&(a(0,"td",20),l(1),r()),i&2){let e=p.$implicit;o(),m(" ",e.defaultName," ")}}function la(i,p){i&1&&(a(0,"th",19),l(1," Created "),r())}function sa(i,p){if(i&1&&(a(0,"td",20),l(1),u(2,"date"),r()),i&2){let e=p.$implicit;o(),m(" ",v(2,1,e.created)," ")}}function pa(i,p){i&1&&_(0,"tr",21)}function da(i,p){if(i&1&&_(0,"tr",22),i&2){let e=p.$implicit;s("routerLink",nt(1,na,e.id))}}function ma(i,p){if(i&1&&(a(0,"tr",23)(1,"td",24),l(2),r()()),i&2){d();let e=fe(12);o(2),m('No data matching the filter "',e.value,'"')}}var Do=(()=>{class i{listController;dialog;dataSource;displayedColumns=["name","created","id"];paginator;sorter;constructor(e,t){this.listController=e,this.dialog=t}ngOnInit(){}ngAfterViewInit(){setTimeout(()=>{this.dataSource=new Te(this.listController,"getLists",this.paginator,25,this.sorter)})}applyFilter(e){this.dataSource.setSearchMap({name:e.target.value})}showCreateCategory(){var e=this.dialog.open(Mo);e.componentInstance.newCategory=!0,e.componentInstance.onDataChanged().subscribe(t=>{this.dataSource.refresh(),e.close()})}static \u0275fac=function(t){return new(t||i)(h(ai),h(q))};static \u0275cmp=w({type:i,selectors:[["app-lists"]],viewQuery:function(t,n){if(t&1&&(N(ea,5),N(ta,5)),t&2){let c;L(c=j())&&(n.paginator=c.first),L(c=j())&&(n.sorter=c.first)}},decls:33,vars:14,consts:[["filter","","input",""],["sorter","matSort"],["paginator",""],[1,"menu"],["mat-flat-button","","color","primary",3,"click"],[1,"filter"],["matInput","","placeholder","Ex. Mia",3,"keyup.enter"],[1,"tt_contentbox"],[1,"header"],["mat-table","","matSort","",1,"tt_table",2,"width","100%",3,"dataSource"],["matColumnDef","id"],["mat-header-cell","","mat-sort-header","",4,"matHeaderCellDef"],["mat-cell","",4,"matCellDef"],["matColumnDef","name"],["matColumnDef","created"],["mat-header-row","",4,"matHeaderRowDef"],["mat-row","",3,"routerLink",4,"matRowDef","matRowDefColumns"],["class","mat-row",4,"matNoDataRow"],[3,"pageSizeOptions"],["mat-header-cell","","mat-sort-header",""],["mat-cell",""],["mat-header-row",""],["mat-row","",3,"routerLink"],[1,"mat-row"],["colspan","4",1,"mat-cell"]],template:function(t,n){if(t&1){let c=S();a(0,"div",3)(1,"button",4),C("click",function(){return y(c),b(n.showCreateCategory())}),a(2,"mat-icon"),l(3,"add"),r(),l(4),u(5,"translate"),r(),a(6,"mat-form-field",5)(7,"mat-label"),l(8),u(9,"translate"),r(),a(10,"input",6,0),C("keyup.enter",function(x){return y(c),b(n.applyFilter(x))}),r()()(),a(13,"div",7)(14,"div",8),l(15),u(16,"translate"),r(),a(17,"table",9,1),Q(19,10),f(20,oa,2,0,"th",11)(21,ra,2,1,"td",12),z(),Q(22,13),f(23,aa,2,0,"th",11)(24,ca,2,1,"td",12),z(),Q(25,14),f(26,la,2,0,"th",11)(27,sa,3,3,"td",12),z(),f(28,pa,1,0,"tr",15)(29,da,1,3,"tr",16)(30,ma,3,1,"tr",17),r(),_(31,"mat-paginator",18,2),r()}t&2&&(o(4),m(" ",v(5,7,"commerce.categorylist.1")," "),o(4),I(v(9,9,"commerce.categorylist.2")),o(7),I(v(16,11,"commerce.categorylist.3")),o(2),s("dataSource",n.dataSource),o(11),s("matHeaderRowDef",n.displayedColumns),o(),s("matRowDefColumns",n.displayedColumns),o(2),s("pageSizeOptions",Pe(13,ia)))},dependencies:[mt,Xe,B,H,ze,G,Fe,Be,je,Re,Ve,Ue,Ne,Le,He,$e,Ge,qe,Ke,O,E,ue],styles:[".header[_ngcontent-%COMP%]{font-size:30px;font-weight:600;margin-bottom:10px;display:block}.menu[_ngcontent-%COMP%]{margin-bottom:20px}.filter[_ngcontent-%COMP%]{margin-left:20px}"]})}return i})();var Po=(()=>{class i{productController;dialogRef;typeTitle="commerce.createproduct.type.product";_type="commerce";set type(e){this.typeTitle="commerce.createproduct.type."+e,this._type=e}get type(){return this._type?this._type:"commerce"}createProductControl=new R("",[ce.required]);subject=new it;constructor(e,t){this.productController=e,this.dialogRef=t}ngOnInit(){}onProductCreated(){return this.subject.asObservable()}createProduct(){this.productController.createProduct(this.createProductControl.value,this.type).subscribe(e=>{this.subject.next(e),this.dialogRef.close(e)})}static \u0275fac=function(t){return new(t||i)(h(ke),h(te))};static \u0275cmp=w({type:i,selectors:[["app-create-product"]],decls:16,vars:13,consts:[["mat-dialog-title",""],[1,"mat-typography"],["appearance","fill",1,"example-full-width"],["matInput","","placeholder","","value","",3,"formControl"],["align","end"],["mat-button","","mat-dialog-close",""],["mat-button","",3,"click"]],template:function(t,n){t&1&&(a(0,"h2",0),l(1),u(2,"translate"),u(3,"translate"),r(),a(4,"mat-dialog-content",1)(5,"mat-form-field",2)(6,"mat-label"),l(7),u(8,"translate"),r(),_(9,"input",3),r()(),a(10,"mat-dialog-actions",4)(11,"button",5),l(12,"Cancel"),r(),a(13,"button",6),C("click",function(){return n.createProduct()}),l(14),u(15,"translate"),r()()),t&2&&(o(),ge("",v(2,5,"commerce.createproduct.1")," ",v(3,7,n.typeTitle),""),o(6),I(v(8,9,"commerce.createproduct.2")),o(2),s("formControl",n.createProductControl),o(5),m(" ",v(15,11,"commerce.createproduct.3")," "))},dependencies:[de,be,oe,K,B,H,G,U,V,le,O,E]})}return i})();var ua=["paginator"],fa=["sorter"],ga=()=>[5,10,25,100,500],_a=i=>["product",i],va=i=>["/front",i];function ha(i,p){i&1&&(a(0,"th",22),l(1," ID "),r())}function Ca(i,p){if(i&1&&(a(0,"td",23),l(1),a(2,"a",24),_(3,"i",25),r()()),i&2){let e=p.$implicit;o(),m(" ",e.id," "),o(),s("routerLink",nt(2,_a,e.id))}}function xa(i,p){i&1&&(a(0,"th",22),l(1," Name "),r())}function ya(i,p){if(i&1&&(a(0,"td",23),l(1),r()),i&2){let e=p.$implicit;o(),m(" ",e.defaultName," ")}}function ba(i,p){i&1&&(a(0,"th",22),l(1," Price "),r())}function wa(i,p){if(i&1&&(a(0,"td",23),l(1),r()),i&2){let e=p.$implicit;o(),m(" ",e.defaultPrice.unitPriceExTax,"")}}function Sa(i,p){i&1&&(a(0,"th",22),l(1," Created "),r())}function Ia(i,p){if(i&1&&(a(0,"td",23),l(1),u(2,"date"),r()),i&2){let e=p.$implicit;o(),m(" ",v(2,1,e.created)," ")}}function Ma(i,p){i&1&&_(0,"th",26)}function Da(i,p){if(i&1&&(a(0,"td",23)(1,"mat-icon",27),l(2,"play_arrow"),r()()),i&2){let e=p.$implicit;o(),s("routerLink",nt(1,va,e.id))}}function Pa(i,p){i&1&&_(0,"tr",28)}function Ea(i,p){i&1&&_(0,"tr",29)}function Ta(i,p){if(i&1&&(a(0,"tr",30)(1,"td",31),l(2),r()()),i&2){d();let e=fe(12);o(2),m('No data matching the filter "',e.value,'"')}}var Eo=(()=>{class i{productController;dialog;dataSource;displayedColumns=["name","price","created","id"];paginator;sorter;constructor(e,t){this.productController=e,this.dialog=t}ngOnInit(){}ngAfterViewInit(){setTimeout(()=>{this.dataSource=new Te(this.productController,"getProducts",this.paginator,25,this.sorter,!1),this.dataSource.setSearchListMap({type:["commerce"]}),this.dataSource.refresh()})}showCreateProduct(){var e=this.dialog.open(Po);e.componentInstance.onProductCreated().subscribe(t=>{this.dataSource.refresh(),e.close()})}applyFilter(e){this.dataSource.setSearchMap({name:e.target.value})}static \u0275fac=function(t){return new(t||i)(h(ke),h(q))};static \u0275cmp=w({type:i,selectors:[["app-product-list"]],viewQuery:function(t,n){if(t&1&&(N(ua,5),N(fa,5)),t&2){let c;L(c=j())&&(n.paginator=c.first),L(c=j())&&(n.sorter=c.first)}},decls:39,vars:14,consts:[["filter","","input",""],["sorter","matSort"],["paginator",""],[1,"menu"],["mat-flat-button","","color","primary",3,"click"],[1,"filter"],["matInput","","placeholder","Ex. Mia",3,"keyup.enter"],[1,"tt_contentbox"],[1,"header"],["mat-table","","matSort","",1,"tt_table",2,"width","100%",3,"dataSource"],["matColumnDef","id"],["mat-header-cell","","mat-sort-header","",4,"matHeaderCellDef"],["mat-cell","",4,"matCellDef"],["matColumnDef","name"],["matColumnDef","price"],["matColumnDef","created"],["matColumnDef","icons"],["mat-header-cell","",4,"matHeaderCellDef"],["mat-header-row","",4,"matHeaderRowDef"],["mat-row","","class","row",4,"matRowDef","matRowDefColumns"],["class","mat-row",4,"matNoDataRow"],[3,"pageSizeOptions"],["mat-header-cell","","mat-sort-header",""],["mat-cell",""],[2,"float","right",3,"routerLink"],[1,"fa","fa-arrow-right"],["mat-header-cell",""],["aria-hidden","false","aria-label","Example home icon",3,"routerLink"],["mat-header-row",""],["mat-row","",1,"row"],[1,"mat-row"],["colspan","4",1,"mat-cell"]],template:function(t,n){if(t&1){let c=S();a(0,"div",3)(1,"button",4),C("click",function(){return y(c),b(n.showCreateProduct())}),a(2,"mat-icon"),l(3,"add"),r(),l(4),u(5,"translate"),r(),a(6,"mat-form-field",5)(7,"mat-label"),l(8),u(9,"translate"),r(),a(10,"input",6,0),C("keyup.enter",function(x){return y(c),b(n.applyFilter(x))}),r()()(),a(13,"div",7)(14,"div",8),l(15),u(16,"translate"),r(),a(17,"table",9,1),Q(19,10),f(20,ha,2,0,"th",11)(21,Ca,4,4,"td",12),z(),Q(22,13),f(23,xa,2,0,"th",11)(24,ya,2,1,"td",12),z(),Q(25,14),f(26,ba,2,0,"th",11)(27,wa,2,1,"td",12),z(),Q(28,15),f(29,Sa,2,0,"th",11)(30,Ia,3,3,"td",12),z(),Q(31,16),f(32,Ma,1,0,"th",17)(33,Da,3,3,"td",12),z(),f(34,Pa,1,0,"tr",18)(35,Ea,1,0,"tr",19)(36,Ta,3,1,"tr",20),r(),_(37,"mat-paginator",21,2),r()}t&2&&(o(4),m(" ",v(5,7,"commerce.productlist.1")," "),o(4),I(v(9,9,"commerce.productlist.2")),o(7),I(v(16,11,"commerce.productlist.3")),o(2),s("dataSource",n.dataSource),o(17),s("matHeaderRowDef",n.displayedColumns),o(),s("matRowDefColumns",n.displayedColumns),o(2),s("pageSizeOptions",Pe(13,ga)))},dependencies:[mt,Xe,B,H,ze,G,Fe,Be,je,Re,Ve,Ue,Ne,Le,He,$e,Ge,qe,Ke,O,E,ue],styles:[".header[_ngcontent-%COMP%]{font-size:30px;font-weight:600;margin-bottom:10px;display:block}.menu[_ngcontent-%COMP%]{margin-bottom:20px}.filter[_ngcontent-%COMP%]{margin-left:20px}.row[_ngcontent-%COMP%]:hover   td[_ngcontent-%COMP%]{color:green}"]})}return i})();var qt=function(i){return i[i.GROUP=0]="GROUP",i[i.CHECKBOX=1]="CHECKBOX",i[i.PARAMETERS=2]="PARAMETERS",i}(qt||{});var ci=(()=>{class i{httpService;urlService;constructor(e,t){this.httpService=e,this.urlService=t}createAttributeSet(e){let t=[];t.push({name:"name",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/attributeset/create",{params:n})}deleteAttributeSet(e){let t=[];t.push({name:"id",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.delete(this.urlService.getBackendUrl()+"/commerce/attributeset/delete",{params:n})}getAll(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/attributeset/list",e,{headers:t})}getById(e){let t=[];t.push({name:"id",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/attributeset/get",{params:n})}getByIds(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/attributeset/byIds",e,{headers:t})}save(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/attributeset/save",e,{headers:t})}static \u0275fac=function(t){return new(t||i)(Y(_e),Y(ve))};static \u0275prov=re({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();var ka=["paginator"],Aa=["sorter"],Oa=()=>[5,10,25,100];function Fa(i,p){i&1&&(a(0,"th",19),l(1," Name "),r())}function Va(i,p){if(i&1&&(a(0,"td",20),l(1),r()),i&2){let e=p.$implicit;o(),m(" ",e.name," ")}}function Ba(i,p){i&1&&(a(0,"th",19),l(1," Select "),r())}function Ra(i,p){if(i&1){let e=S();a(0,"button",22),C("click",function(){y(e);let n=d().$implicit,c=d();return b(c.select(n))}),l(1," Select "),r()}if(i&2){let e=d().$implicit,t=d();s("disabled",t.isDisabled(e))}}function Na(i,p){if(i&1){let e=S();a(0,"button",22),C("click",function(){y(e);let n=d().$implicit,c=d();return b(c.unselect(n))}),_(1,"i",23),r()}if(i&2){let e=d().$implicit,t=d();s("disabled",t.isDisabled(e))}}function La(i,p){if(i&1&&(a(0,"td",20),f(1,Ra,2,1,"button",21)(2,Na,2,1,"button",21),r()),i&2){let e=p.$implicit,t=d();o(),s("ngIf",!t.isSelected(e)),o(),s("ngIf",t.isSelected(e))}}function ja(i,p){i&1&&_(0,"tr",24)}function Ua(i,p){i&1&&_(0,"tr",25)}function Ha(i,p){i&1&&(a(0,"tr",26)(1,"td",27),l(2,"No data matching the filter"),r()())}var To=(()=>{class i{attributeController;dialogRef;dataSource;nameController=new R;displayedColumns=["name","select"];paginator;sorter;constructor(e,t){this.attributeController=e,this.dialogRef=t}ngOnInit(){}ngAfterViewInit(){setTimeout(e=>{this.dataSource=new Te(this.attributeController,"getAll",this.paginator,2e3,this.sorter)})}doSearch(){}select(e){this.dialogRef.close(e)}unselect(e){}isDisabled(){return!1}isSelected(){return!1}static \u0275fac=function(t){return new(t||i)(h(ci),h(te))};static \u0275cmp=w({type:i,selectors:[["app-attributesets-picker-dialog"]],viewQuery:function(t,n){if(t&1&&(N(ka,5),N(Aa,5)),t&2){let c;L(c=j())&&(n.paginator=c.first),L(c=j())&&(n.sorter=c.first)}},decls:31,vars:18,consts:[["sorter","matSort"],["paginator",""],["mat-dialog-title",""],[1,"mat-typography"],[3,"submit"],[1,""],["matInput","","placeholder","","value","",3,"formControl"],["mat-flat-button","","color","primary"],["mat-table","","matSort","",1,"tt_table",2,"width","100%",3,"dataSource"],["matColumnDef","name"],["mat-header-cell","","mat-sort-header","",4,"matHeaderCellDef"],["mat-cell","",4,"matCellDef"],["matColumnDef","select"],["mat-header-row","",4,"matHeaderRowDef"],["mat-row","",4,"matRowDef","matRowDefColumns"],["class","mat-row",4,"matNoDataRow"],[3,"pageSizeOptions"],["align","end"],["mat-button","","mat-dialog-close",""],["mat-header-cell","","mat-sort-header",""],["mat-cell",""],["class","selectbutton","mat-flat-button","","color","primary",3,"disabled","click",4,"ngIf"],["mat-flat-button","","color","primary",1,"selectbutton",3,"click","disabled"],[1,"fa","fa-check"],["mat-header-row",""],["mat-row",""],[1,"mat-row"],["colspan","4",1,"mat-cell"]],template:function(t,n){if(t&1){let c=S();a(0,"h2",2),l(1),u(2,"translate"),r(),a(3,"mat-dialog-content",3)(4,"form",4),C("submit",function(){return y(c),b(n.doSearch())}),a(5,"mat-form-field",5)(6,"mat-label"),l(7),u(8,"translate"),r(),_(9,"input",6),r(),l(10," \xA0\xA0 "),a(11,"button",7),l(12),u(13,"translate"),r()(),a(14,"table",8,0),Q(16,9),f(17,Fa,2,0,"th",10)(18,Va,2,1,"td",11),z(),Q(19,12),f(20,Ba,2,0,"th",10)(21,La,3,2,"td",11),z(),f(22,ja,1,0,"tr",13)(23,Ua,1,0,"tr",14)(24,Ha,3,0,"tr",15),r(),_(25,"mat-paginator",16,1),r(),a(27,"mat-dialog-actions",17)(28,"button",18),l(29),u(30,"translate"),r()()}t&2&&(o(),I(v(2,9,"commerce.attributesetpicker.2")),o(6),m("",v(8,11,"commerce.attributesetpicker.1")," "),o(2),s("formControl",n.nameController),o(3),m(" ",v(13,13,"commerce.attributesetpicker.4")," "),o(2),s("dataSource",n.dataSource),o(8),s("matHeaderRowDef",n.displayedColumns),o(),s("matRowDefColumns",n.displayedColumns),o(2),s("pageSizeOptions",Pe(17,Oa)),o(4),I(v(30,15,"commerce.attributesetpicker.3")))},dependencies:[M,de,be,oe,K,Xe,B,H,G,Fe,Be,je,Re,Ve,Ue,Ne,Le,He,$e,Ge,qe,Ke,Ce,U,V,ae,ei,le,O,E]})}return i})();var $a=["productViewComponent"],qi=(()=>{class i{dialogRef;data;view;constructor(e,t){this.dialogRef=e,this.data=t}ngOnInit(){}ngAfterViewInit(){this.view.setProduct(this.data.product),this.view.setFromDialog(),this.view.selectTab("description")}static \u0275fac=function(t){return new(t||i)(h(te),h(ut))};static \u0275cmp=w({type:i,selectors:[["app-product-dialog"]],viewQuery:function(t,n){if(t&1&&N($a,5),t&2){let c;L(c=j())&&(n.view=c.first)}},decls:4,vars:0,consts:[["productViewComponent",""],[1,"closebutton",3,"mat-dialog-close"],[1,"fal","fa-times-circle"]],template:function(t,n){t&1&&(a(0,"div",1),_(1,"i",2),r(),_(2,"app-product-view",null,0))},styles:["[_nghost-%COMP%]{display:block;position:relative}.closebutton[_ngcontent-%COMP%]{position:absolute;right:-20px;top:-20px;font-size:30px;border:solid 1px #DDD;padding:9px 10px;background-color:#6da1ff;border-radius:0 5px;color:#fff;cursor:pointer}"]})}return i})();var Ga=["paginator"],qa=["sorter"],Qa=()=>[5,10,25,100];function za(i,p){i&1&&(a(0,"th",19),l(1," Name "),r())}function Wa(i,p){if(i&1&&(a(0,"td",20),l(1),r()),i&2){let e=p.$implicit;o(),m(" ",e.defaultName," ")}}function Ka(i,p){i&1&&(a(0,"th",19),l(1," Select "),r())}function Xa(i,p){if(i&1){let e=S();a(0,"button",22),C("click",function(){y(e);let n=d().$implicit,c=d();return b(c.select(n))}),l(1," Select "),r()}if(i&2){let e=d().$implicit,t=d();s("disabled",t.isDisabled(e))}}function Ya(i,p){if(i&1){let e=S();a(0,"button",22),C("click",function(){y(e);let n=d().$implicit,c=d();return b(c.unselect(n))}),_(1,"i",23),r()}if(i&2){let e=d().$implicit,t=d();s("disabled",t.isDisabled(e))}}function Ja(i,p){if(i&1&&(a(0,"td",20),f(1,Xa,2,1,"button",21)(2,Ya,2,1,"button",21),r()),i&2){let e=p.$implicit,t=d();o(),s("ngIf",!t.isSelected(e)),o(),s("ngIf",t.isSelected(e))}}function Za(i,p){i&1&&_(0,"tr",24)}function ec(i,p){i&1&&_(0,"tr",25)}function tc(i,p){i&1&&(a(0,"tr",26)(1,"td",27),l(2,"No data matching the filter"),r()())}var Qi=(()=>{class i{productController;dialog;data;constructor(e,t,n){this.productController=e,this.dialog=t,this.data=n,n.productIds.forEach(c=>this.originalProductids.push(c)),this.type=n.type}dataSource;displayedColumns=["name","select"];nameController=new R;selectSubject=new it;unSelectSubject=new it;originalProductids=[];type="commerce";paginator;sorter;ngOnInit(){}ngAfterViewInit(){setTimeout(()=>{this.dataSource=new Te(this.productController,"searchForProducts",this.paginator,25,this.sorter),this.dataSource.setSearchListMap({type:[this.type]})})}onSelect(){return this.selectSubject.asObservable()}onRemove(){return this.unSelectSubject.asObservable()}unselect(e){this.data.productIds=this.data.productIds.filter(t=>t!=e.id),this.unSelectSubject.next(e)}select(e){this.data.productIds.push(e.id),this.selectSubject.next(e),this.data.singleSelect&&this.dialog.close(e)}doSearch(){this.dataSource.setSearchMap({name:this.nameController.value})}isSelected(e){return this.data.productIds.includes(e.id)}getSelectedProductIds(){return this.data.productIds}getNewProductIds(){var e=this.data.productIds.filter(t=>this.originalProductids.indexOf(t)<0);return e}getRemovedProductIds(){var e=this.originalProductids.filter(t=>this.data.productIds.indexOf(t)<0);return e}isDisabled(e){return this.data.disabledProductIds?this.data.disabledProductIds.indexOf(e.id)>-1:!1}static \u0275fac=function(t){return new(t||i)(h(ke),h(te),h(ut))};static \u0275cmp=w({type:i,selectors:[["app-product-picker"]],viewQuery:function(t,n){if(t&1&&(N(Ga,5),N(qa,5)),t&2){let c;L(c=j())&&(n.paginator=c.first),L(c=j())&&(n.sorter=c.first)}},decls:31,vars:18,consts:[["sorter","matSort"],["paginator",""],["mat-dialog-title",""],[1,"mat-typography"],[3,"submit"],[1,""],["matInput","","placeholder","","value","",3,"formControl"],["mat-flat-button","","color","primary"],["mat-table","","matSort","",1,"tt_table",2,"width","100%",3,"dataSource"],["matColumnDef","name"],["mat-header-cell","","mat-sort-header","",4,"matHeaderCellDef"],["mat-cell","",4,"matCellDef"],["matColumnDef","select"],["mat-header-row","",4,"matHeaderRowDef"],["mat-row","",4,"matRowDef","matRowDefColumns"],["class","mat-row",4,"matNoDataRow"],[3,"pageSizeOptions"],["align","end"],["mat-button","","mat-dialog-close",""],["mat-header-cell","","mat-sort-header",""],["mat-cell",""],["class","selectbutton","mat-flat-button","","color","primary",3,"disabled","click",4,"ngIf"],["mat-flat-button","","color","primary",1,"selectbutton",3,"click","disabled"],[1,"fa","fa-check"],["mat-header-row",""],["mat-row",""],[1,"mat-row"],["colspan","4",1,"mat-cell"]],template:function(t,n){if(t&1){let c=S();a(0,"h2",2),l(1),u(2,"translate"),r(),a(3,"mat-dialog-content",3)(4,"form",4),C("submit",function(){return y(c),b(n.doSearch())}),a(5,"mat-form-field",5)(6,"mat-label"),l(7),u(8,"translate"),r(),_(9,"input",6),r(),l(10," \xA0\xA0 "),a(11,"button",7),l(12),u(13,"translate"),r()(),a(14,"table",8,0),Q(16,9),f(17,za,2,0,"th",10)(18,Wa,2,1,"td",11),z(),Q(19,12),f(20,Ka,2,0,"th",10)(21,Ja,3,2,"td",11),z(),f(22,Za,1,0,"tr",13)(23,ec,1,0,"tr",14)(24,tc,3,0,"tr",15),r(),_(25,"mat-paginator",16,1),r(),a(27,"mat-dialog-actions",17)(28,"button",18),l(29),u(30,"translate"),r()()}t&2&&(o(),I(v(2,9,"commerce.productpicker.2")),o(6),m("",v(8,11,"commerce.productpicker.1")," "),o(2),s("formControl",n.nameController),o(3),m(" ",v(13,13,"commerce.productpicker.4")," "),o(2),s("dataSource",n.dataSource),o(8),s("matHeaderRowDef",n.displayedColumns),o(),s("matRowDefColumns",n.displayedColumns),o(2),s("pageSizeOptions",Pe(17,Qa)),o(4),I(v(30,15,"commerce.productpicker.3")))},dependencies:[M,de,be,oe,K,Xe,B,H,G,Fe,Be,je,Re,Ve,Ue,Ne,Le,He,$e,Ge,qe,Ke,Ce,U,V,ae,ei,le,O,E],styles:[".mat-column-select[_ngcontent-%COMP%]{width:100px;text-align:right}.mat-mdc-cell[_ngcontent-%COMP%]{border-bottom:solid 1px #EEE!important}.selectbutton[_ngcontent-%COMP%]{width:80px}"]})}return i})();var zi=(()=>{class i{productController;dialogRef;formControl=new R("",[ce.required]);description=new R("",[ce.required]);product;contentId;selectedLocale;constructor(e,t){this.productController=e,this.dialogRef=t}ngOnInit(){this.contentId||(this.contentId=oi())}save(){var e=this.product.extras.filter(t=>t.lang==""+this.selectedLocale&&t.name==this.contentId)[0];e||(e={},this.product.extras.push(e)),e.shortDescription=this.product.defaultName,e.name=this.contentId,e.lang=""+this.selectedLocale,e.shortDescription=this.formControl.value,e.description=this.description.value,this.productController.updateProduct(this.product).subscribe(t=>{this.dialogRef.close()})}deleteIt(){this.product.extras=this.product.extras.filter(e=>e.name!=this.contentId),this.productController.updateProduct(this.product).subscribe(e=>{this.dialogRef.close()})}static \u0275fac=function(t){return new(t||i)(h(ke),h(te))};static \u0275cmp=w({type:i,selectors:[["app-add-extra-description-dialog"]],decls:15,vars:12,consts:[["appearance","fill",1,"example-full-width"],["matInput","","placeholder","","value","",3,"formControl"],[3,"formControl"],["mat-flat-button","","color","warn",3,"click"],["mat-flat-button","","color","primary",3,"click","disabled"]],template:function(t,n){t&1&&(a(0,"mat-form-field",0)(1,"mat-label"),l(2),u(3,"translate"),r(),_(4,"input",1),r(),_(5,"br")(6,"quill-editor",2)(7,"br"),a(8,"button",3),C("click",function(){return n.deleteIt()}),l(9),u(10,"translate"),r(),l(11,`
\xA0\xA0\xA0
`),a(12,"button",4),C("click",function(){return n.save()}),l(13),u(14,"translate"),r()),t&2&&(o(2),m(" ",v(3,6,"commerce.addextradialog.1")," "),o(2),s("formControl",n.formControl),o(2),s("formControl",n.description),o(3),m(" ",v(10,8,"commerce.addextradialog.4"),`
`),o(3),s("disabled",!n.formControl.valid),o(),m(" ",v(14,10,"commerce.addextradialog.2"),`
`))},dependencies:[B,H,G,U,V,le,O,ji,E]})}return i})();var gt=(()=>{class i{httpService;urlService;constructor(e,t){this.httpService=e,this.urlService=t}createNewLocale(){return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/settingscontroller/createNewLocale",null)}deleteLocale(e){let t=[];e!=null&&t.push({name:"localeId",value:e.toString()});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/settingscontroller/deleteLocale",null,{params:n})}getAllLocals(){return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/settingscontroller/locals")}getSettings(){return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/settingscontroller/domains")}getTaxes(e){let t=[];e!=null&&t.push({name:"localeId",value:e.toString()});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/settingscontroller/taxes",{params:n})}reset(){return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/settingscontroller/reset")}saveDomain(e){let t=[];t.push({name:"url",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/settingscontroller/saveDomain",null,{params:n})}saveLocale(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/settingscontroller/saveLocale",e,{headers:t})}setVirtualCCPaymentTypeId(e){let t=[];t.push({name:"paymentTypeId",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/settingscontroller/setVirtualCCPaymentTypeId",{params:n})}static \u0275fac=function(t){return new(t||i)(Y(_e),Y(ve))};static \u0275prov=re({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})(),Wi=(()=>{class i{httpService;urlService;constructor(e,t){this.httpService=e,this.urlService=t}getTaxes(){return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/taxescontroller/taxes")}static \u0275fac=function(t){return new(t||i)(Y(_e),Y(ve))};static \u0275prov=re({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();function nc(i,p){if(i&1){let e=S();a(0,"div",21),C("click",function(){let n=y(e).$implicit,c=d(3);return b(c.changeLocale(n))}),_(1,"img",22),r()}if(i&2){let e=p.$implicit,t=d(3);ee("active",t.selectedLocale==e.localeId),o(),s("src","/assets/flags/4x3/"+e.lang+".svg",St)}}function oc(i,p){if(i&1&&(a(0,"div",19),f(1,nc,2,3,"div",20),r()),i&2){let e=d(2);o(),s("ngForOf",e.locales)}}function rc(i,p){if(i&1){let e=S();a(0,"button",8),C("click",function(){y(e);let n=d(2);return b(n.addAttributeSet())}),a(1,"mat-icon"),l(2,"dialpad"),r(),a(3,"span"),l(4),u(5,"translate"),r()()}i&2&&(o(4),m(" ",v(5,1,"commerce.productview.9")," "))}function ac(i,p){if(i&1){let e=S();a(0,"button",8),C("click",function(){y(e);let n=d(2);return b(n.addExtraDescription())}),a(1,"mat-icon"),l(2,"add"),r(),a(3,"span"),l(4),u(5,"translate"),r()()}i&2&&(o(4),m(" ",v(5,1,"commerce.productview.10")," "))}function cc(i,p){i&1&&(a(0,"span"),l(1),u(2,"translate"),r()),i&2&&(o(),m(" ",v(2,1,"commerce.productview.8")," "))}function lc(i,p){i&1&&(a(0,"span"),l(1),u(2,"translate"),r()),i&2&&(o(),m(" ",v(2,1,"commerce.productview.11")," "))}function sc(i,p){if(i&1&&_(0,"app-prices",23),i&2){let e=d(2);s("productview",e)("selectedLocale",e.selectedLocale)("product",e.product)}}function pc(i,p){if(i&1&&_(0,"app-taxes",24),i&2){let e=d(2);s("productview",e)("selectedLocale",e.selectedLocale)("product",e.product)}}function dc(i,p){if(i&1&&_(0,"app-config",25),i&2){let e=d(2);s("productview",e)("selectedLocale",e.selectedLocale)("product",e.product)}}function mc(i,p){if(i&1&&_(0,"app-conference",25),i&2){let e=d(2);s("productview",e)("selectedLocale",e.selectedLocale)("product",e.product)}}function uc(i,p){if(i&1&&_(0,"app-rooms",25),i&2){let e=d(2);s("productview",e)("selectedLocale",e.selectedLocale)("product",e.product)}}function fc(i,p){if(i&1&&_(0,"app-guest-info",25),i&2){let e=d(2);s("productview",e)("selectedLocale",e.selectedLocale)("product",e.product)}}function gc(i,p){if(i&1&&_(0,"app-extra-description-list",26),i&2){let e=d(2);s("locales",e.locales)("product",e.product)}}function _c(i,p){if(i&1){let e=S();a(0,"div")(1,"div",3),l(2),a(3,"i",29),C("click",function(){let n=y(e).$implicit,c=d(3);return b(c.removeAttributeSet(n))}),r()(),_(4,"app-attribute-set-config",30),r()}if(i&2){let e=p.$implicit,t=d(3);o(2),m(" ",e.displayNames[t.selectedLocale]," "),o(2),s("product",t.product)("productview",t)("selectedLocale",t.selectedLocale)("attributeset",e)}}function vc(i,p){if(i&1&&(a(0,"div",27),f(1,_c,5,5,"div",28),r()),i&2){let e=d(2);o(),s("ngForOf",e.attributeSets)}}function hc(i,p){if(i&1){let e=S();a(0,"button",8),C("click",function(){y(e);let n=d().$implicit,c=d(3);return b(c.configureOptionsForBundledProduct(n))}),a(1,"mat-icon"),l(2,"tune"),r(),a(3,"span"),l(4),u(5,"translate"),r()()}i&2&&(o(4),I(v(5,1,"commerce.productview.config.16")))}function Cc(i,p){if(i&1){let e=S();a(0,"div",35)(1,"button",6)(2,"mat-icon"),l(3,"more_vert"),r()(),a(4,"mat-menu",null,0)(6,"button",8),C("click",function(){let n=y(e).$implicit,c=d(3);return b(c.openProduct(n))}),a(7,"mat-icon"),l(8,"link"),r(),a(9,"span"),l(10),u(11,"translate"),r()(),f(12,hc,6,3,"button",7),a(13,"button",8),C("click",function(){let n=y(e).$implicit,c=d(3);return b(c.removeBundledProduct(n))}),a(14,"mat-icon"),l(15,"delete"),r(),a(16,"span"),l(17),u(18,"translate"),r()()(),l(19),r()}if(i&2){let e=p.$implicit,t=fe(5),n=d(3);o(),s("matMenuTriggerFor",t),o(9),I(v(11,5,"commerce.productview.config.15")),o(2),s("ngIf",n.hasOptions(e)),o(5),I(v(18,7,"commerce.productview.config.17")),o(2),m(" ",e.defaultName," ")}}function xc(i,p){if(i&1){let e=S();a(0,"div",31)(1,"div",3),l(2),u(3,"translate"),r(),a(4,"div",32),l(5),u(6,"translate"),r(),a(7,"button",33),C("click",function(){y(e);let n=d(2);return b(n.addBundledProduct())}),l(8),u(9,"translate"),r(),a(10,"div"),f(11,Cc,20,9,"div",34),r()()}if(i&2){let e=d(2);o(2),m(" ",v(3,4,"commerce.productview.config.12")," "),o(3),m(" ",v(6,6,"commerce.productview.config.13")," "),o(3),m(" ",v(9,8,"commerce.productview.config.14")," "),o(3),s("ngForOf",e.bundledProducts)}}function yc(i,p){if(i&1){let e=S();a(0,"div",2)(1,"div",3),l(2),r(),a(3,"div",4),f(4,oc,2,1,"div",5),a(5,"button",6)(6,"mat-icon"),l(7,"more_vert"),r()(),a(8,"mat-menu",null,0),f(10,rc,6,3,"button",7)(11,ac,6,3,"button",7),a(12,"button",8),C("click",function(){y(e);let n=d();return b(n.deleteProduct())}),a(13,"mat-icon"),l(14,"delete"),r(),f(15,cc,3,3,"span",9)(16,lc,3,3,"span",9),r()()(),a(17,"div",10),_(18,"app-description",11)(19,"app-images",12),f(20,sc,1,3,"app-prices",13)(21,pc,1,3,"app-taxes",14)(22,dc,1,3,"app-config",15)(23,mc,1,3,"app-conference",15)(24,uc,1,3,"app-rooms",15)(25,fc,1,3,"app-guest-info",15)(26,gc,1,2,"app-extra-description-list",16)(27,vc,2,1,"div",17)(28,xc,12,10,"div",18),r()()}if(i&2){let e=fe(9),t=d();o(2),m(" ",t.product.productDescription[t.selectedLocale]?t.product.productDescription[t.selectedLocale].name:"Not set yet"," "),o(2),s("ngIf",t.locales&&t.locales.length>1),o(),s("matMenuTriggerFor",e),o(5),s("ngIf",t.shouldShowAttributesSet()),o(),s("ngIf",t.showAddExtraDescription()),o(4),s("ngIf",!t.product.deleted),o(),s("ngIf",t.product.deleted),o(2),s("productview",t)("selectedLocale",t.selectedLocale)("product",t.product),o(),s("selectedLocale",t.selectedLocale)("imageitem",t.product)("controller",t.productController),o(),s("ngIf",t.shouldShowPrices()),o(),s("ngIf",t.shouldShowTaxes()),o(),s("ngIf",t.shouldShowOptions()),o(),s("ngIf",t.shouldShowConference()),o(),s("ngIf",t.shouldShowRooms()),o(),s("ngIf",t.shouldShowRooms()),o(),s("ngIf",t.product.extras.length>0),o(),s("ngIf",t.shouldShowAttributesSet()),o(),s("ngIf",t.shouldShowBundledProducts())}}var _i=(()=>{class i{route;productController;dialog;router;attributeSetControll;settingsController;selected="description";selectedLocale=0;product;locales;inDialog=!1;attributeSets;bundledProducts;constructor(e,t,n,c,g,x){this.route=e,this.productController=t,this.dialog=n,this.router=c,this.attributeSetControll=g,this.settingsController=x,this.route.snapshot.params.id&&this.loadProduct(this.route.snapshot.params.id)}loadProduct(e){this.productController.getProduct(e).subscribe(t=>{this.setProduct(t)})}setProduct(e){this.product=e,this.loadAttributSetsList()}loadAttributSetsList(){var e=this.product.bundledProducts.map(t=>t.productId);this.productController.getProductsById(e).subscribe(t=>{this.bundledProducts=t}),this.attributeSetControll.getByIds(this.product.attributeSets).subscribe(t=>{this.attributeSets=t})}selectTab(e){this.selected=e,this.inDialog||sessionStorage.setItem("productview_tab_selected",e)}ngOnInit(){this.settingsController.getAllLocals().subscribe(e=>{this.locales=e}),!this.inDialog&&sessionStorage.getItem("productview_tab_selected")&&(this.selected=sessionStorage.getItem("productview_tab_selected"))}changeLocale(e){this.selectedLocale=e.localeId}save(e=!0){this.productController.updateProduct(this.product).subscribe(t=>{e&&(this.product.options=t.options,this.loadAttributSetsList())})}deleteProduct(){if(this.product.deleted)var e=new ct("commerce.productview.description.9","commerce.productview.description.10");else var e=new ct("commerce.productview.description.4","commerce.productview.description.5");var t=this.dialog.open(Oe,{data:e});this.product.deleted?t.afterClosed().subscribe(n=>{n&&this.productController.restoreProduct(this.product.id).subscribe(c=>{this.router.navigate(["../../"])})}):t.afterClosed().subscribe(n=>{n&&this.productController.deleteProduct(this.product.id).subscribe(c=>{this.router.navigate(["../../"])})})}setFromDialog(){this.inDialog=!0}showAddExtraDescription(){return this.isType("commerce")}shouldShowPrices(){return this.isType("commerce")}shouldShowBundledProducts(){return this.isType("commerce")}shouldShowOptions(){return this.isType("commerce")}shouldShowAttributesSet(){return this.isType("commerce")}shouldShowTaxes(){return this.isType("commerce")||this.isType("addon")||this.isType("hotel")}shouldShowHotelConfig(){return this.isType("commerce")||this.isType("hotel")}shouldShowConference(){return this.isType("conference")}shouldShowRooms(){return this.isType("hotel")}shouldShowCategoryConfig(){return!1}showAddAddons(){return this.isType("hotel")}showAddonConfig(){return this.isType("addon")}showBookingEngine(){return this.isType("hotel")||this.isType("conference")}isType(e){return this.product&&this.product.type==e}removeAttributeSet(e){this.product.attributeSets=this.product.attributeSets.filter(t=>t!=e.id),this.save(),this.loadAttributSetsList()}addAttributeSet(){var e=this.dialog.open(To);e.afterClosed().subscribe(t=>{t&&(this.product.attributeSets=this.product.attributeSets.filter(n=>n!=t.id),this.product.attributeSets.push(t.id),this.save(),this.loadAttributSetsList())})}addBundledProduct(){var e={};e.productIds=this.product.bundledProducts.map(n=>n.productId),e.disabledProductIds=[this.product.id],e.type="commerce";var t=this.dialog.open(Qi,{data:e});t.afterClosed().subscribe(n=>{t.componentInstance.getNewProductIds().map(c=>{var g={};return g.productId=c,g}).forEach(c=>{this.product.bundledProducts.push(c)}),t.componentInstance.getRemovedProductIds().forEach(c=>{this.product.bundledProducts=this.product.bundledProducts.filter(g=>g.productId!=c)}),this.save()})}hasOptions(e){var t=e.options,n=qt[qt.GROUP];return t.find(c=>c.type.toString()==n)!=null}removeBundledProduct(e){this.product.bundledProducts=this.product.bundledProducts.filter(t=>t.productId!=e.id),this.save()}openProduct(e){var t={product:e},n=this.dialog.open(qi,{width:"99vw",height:"95vh",data:t});n.afterClosed().subscribe(c=>{})}addExtraDescription(){var e=this.dialog.open(zi);e.componentInstance.product=this.product,e.componentInstance.selectedLocale=this.selectedLocale,e.afterClosed().subscribe(t=>{this.loadProduct(this.product.id)})}static \u0275fac=function(t){return new(t||i)(h(Jt),h(ke),h(q),h(Zt),h(ci),h(gt))};static \u0275cmp=w({type:i,selectors:[["app-product-view"]],decls:1,vars:1,consts:[["menu","matMenu"],["class","productview_outer",4,"ngIf"],[1,"productview_outer"],[1,"title"],[1,"sharedmenu"],["class","flags",4,"ngIf"],["mat-icon-button","","aria-label","Example icon-button with a menu",3,"matMenuTriggerFor"],["mat-menu-item","",3,"click",4,"ngIf"],["mat-menu-item","",3,"click"],[4,"ngIf"],[1,"gridview"],[1,"app","tt_contentbox","description",3,"productview","selectedLocale","product"],[1,"app","tt_contentbox","images",3,"selectedLocale","imageitem","controller"],["class","app prices tt_contentbox",3,"productview","selectedLocale","product",4,"ngIf"],["class","app tt_contentbox taxes",3,"productview","selectedLocale","product",4,"ngIf"],["class","app tt_contentbox",3,"productview","selectedLocale","product",4,"ngIf"],["class","app tt_contentbox extralist",3,"locales","product",4,"ngIf"],["class","app attributeset tt_contentbox",4,"ngIf"],["class","app tt_contentbox",4,"ngIf"],[1,"flags"],["class","flag",3,"active","click",4,"ngFor","ngForOf"],[1,"flag",3,"click"],[1,"",3,"src"],[1,"app","prices","tt_contentbox",3,"productview","selectedLocale","product"],[1,"app","tt_contentbox","taxes",3,"productview","selectedLocale","product"],[1,"app","tt_contentbox",3,"productview","selectedLocale","product"],[1,"app","tt_contentbox","extralist",3,"locales","product"],[1,"app","attributeset","tt_contentbox"],[4,"ngFor","ngForOf"],[1,"fa","fa-trash",3,"click"],[3,"product","productview","selectedLocale","attributeset"],[1,"app","tt_contentbox"],[1,"desc"],["mat-flat-button","","color","primary",3,"click"],["class","bundled_product_row",4,"ngFor","ngForOf"],[1,"bundled_product_row"]],template:function(t,n){t&1&&f(0,yc,29,22,"div",1),t&2&&s("ngIf",n.product)},styles:[".title[_ngcontent-%COMP%]{font-size:35px;font-weight:600;width:calc(100% - 400px);display:inline-block;vertical-align:top;margin-bottom:30px}.menu[_ngcontent-%COMP%]{background-color:#fff}.menu[_ngcontent-%COMP%], .content[_ngcontent-%COMP%]{display:inline-block;vertical-align:top;box-sizing:border-box}.menu[_ngcontent-%COMP%]{width:200px;margin-right:50px}.menu[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]{font-size:13px;margin-right:10px}.menu[_ngcontent-%COMP%]   .entry.active[_ngcontent-%COMP%]{font-weight:700}.menu[_ngcontent-%COMP%]   .entry[_ngcontent-%COMP%]{padding:10px;cursor:pointer}.menu[_ngcontent-%COMP%]   div.entry[_ngcontent-%COMP%]:last-child{border-bottom:solid 0px}.content[_ngcontent-%COMP%]{width:calc(100% - 290px)}.gridview[_ngcontent-%COMP%]{display:flex;gap:15px;flex-wrap:wrap}.gridview[_ngcontent-%COMP%]   .app[_ngcontent-%COMP%]{flex:1 1 26%}.gridview[_ngcontent-%COMP%]   .description[_ngcontent-%COMP%]{flex:1 1 100%}.app[_ngcontent-%COMP%]   .title[_ngcontent-%COMP%]{font-size:20px;font-weight:500;text-align:center;width:100%}.app[_ngcontent-%COMP%]   .title[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]{position:absolute;right:20px;top:20px;cursor:pointer}.tt_contentbox[_ngcontent-%COMP%]{margin:0}.sharedmenu[_ngcontent-%COMP%]{width:350px;display:inline-block;text-align:right;margin-bottom:20px;padding-right:40px;vertical-align:top}.sharedmenu[_ngcontent-%COMP%]   button[_ngcontent-%COMP%]{margin-left:20px}.flags[_ngcontent-%COMP%]{display:inline-block;vertical-align:top}.flag[_ngcontent-%COMP%]{display:inline-block;width:45px;margin-left:20px;cursor:pointer}.flag[_ngcontent-%COMP%]   img[_ngcontent-%COMP%]{border:solid 5px transparent}.flag.active[_ngcontent-%COMP%]   img[_ngcontent-%COMP%]{border:solid 5px #44a7ff}.flags[_ngcontent-%COMP%]   img[_ngcontent-%COMP%]{display:inline-block;width:35px}  mat-dialog-container .menu_container,   mat-dialog-container .tt_contentbox{background-color:#fcfcfc!important;border:solid 1px #f3f3f3}@media only screen and (max-width: 910px){.menu[_ngcontent-%COMP%]{display:block;width:100%;text-align:center}.menu[_ngcontent-%COMP%]   .entry[_ngcontent-%COMP%]{display:inline-block}.content[_ngcontent-%COMP%]{width:100%}}"]})}return i})();var wc=["fileDropRef"];function Sc(i,p){if(i&1&&(a(0,"div",9),_(1,"img",10),a(2,"div",11)(3,"h4",12),l(4),r(),a(5,"p",13),l(6),r()()()),i&2){let e=p.$implicit,t=d();ee("uploading",e.progress<100),o(),s("src",e.base64,St),o(3),m(" ",e==null?null:e.name," Uploading.. please wait... "),o(2),m(" ",t.formatBytes(e==null?null:e.size)," ")}}function Ic(i,p){if(i&1){let e=S();a(0,"div",9),_(1,"img",14),a(2,"div",11)(3,"h4",12),l(4),r()(),a(5,"i",15),C("click",function(){let n=y(e),c=n.$implicit,g=n.index,x=d();return b(x.deleteFile(c,g))}),r()()}if(i&2){let e=p.$implicit,t=d();o(),s("src",t.getImageUrl(e),St),o(3),m(" ",e.name," ")}}var Ki=(()=>{class i{urlService;fileDropEl;files=[];imageitem;selectedLocale="";controller;constructor(e){this.urlService=e}ngOnInit(){}onFileDropped(e){this.prepareFilesList(e)}fileBrowseHandler(e){this.prepareFilesList(e)}prepareFilesList(e){for(let n of e){n.progress=0;var t=this.files.push(n);n.index=t;let c=new FileReader;c.readAsDataURL(n),c.onload=()=>{n.base64=c.result,this.controller.uploadImage(this.imageitem.id,n.type,n.name,n.base64.split(",")[1]).subscribe(g=>{this.imageitem.images.push(g),this.files=this.files.filter(x=>x.index!=n.index)})}}this.fileDropEl.nativeElement.value=""}deleteFile(e,t){this.controller.deleteImage(this.imageitem.id,e.uuid).subscribe(n=>{this.imageitem.images.splice(t,1)})}formatBytes(e,t=2){if(e===0)return"0 Bytes";let n=1024,c=t<=0?0:t,g=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],x=Math.floor(Math.log(e)/Math.log(n));return parseFloat((e/Math.pow(n,x)).toFixed(c))+" "+g[x]}getImageUrl(e){return this.urlService.getBackendUrl()+"/commerce/productcontroller/image?uuid="+e.uuid+"&tenantId="+sessionStorage.getItem("tenant")}static \u0275fac=function(t){return new(t||i)(h(ve))};static \u0275cmp=w({type:i,selectors:[["app-images"]],viewQuery:function(t,n){if(t&1&&N(wc,5),t&2){let c;L(c=j())&&(n.fileDropEl=c.first)}},inputs:{imageitem:"imageitem",selectedLocale:"selectedLocale",controller:"controller"},decls:16,vars:5,consts:[["fileDropRef",""],[1,"box-header"],["appDnd","",1,"container",3,"fileDropped"],["type","file","id","fileDropRef","multiple","",3,"change"],["src","/assets/img/dnd/ic-upload-file.svg","alt",""],["for","fileDropRef"],[1,"files-list"],["class","single-file",3,"uploading",4,"ngFor","ngForOf"],["class","single-file",4,"ngFor","ngForOf"],[1,"single-file"],["width","100px","alt","file",3,"src"],[1,"info"],[1,"name"],[1,"size"],["width","100px","alt","file",1,"file",3,"src"],[1,"delete","fa","fa-trash",3,"click"]],template:function(t,n){if(t&1){let c=S();a(0,"div",1),l(1),u(2,"translate"),r(),a(3,"div",2),C("fileDropped",function(x){return y(c),b(n.onFileDropped(x))}),a(4,"input",3,0),C("change",function(x){return y(c),b(n.fileBrowseHandler(x.target.files))}),r(),_(6,"img",4),a(7,"h3"),l(8,"Drag and drop file here"),r(),a(9,"h3"),l(10,"or"),r(),a(11,"label",5),l(12,"Browse for file"),r()(),a(13,"div",6),f(14,Sc,7,5,"div",7)(15,Ic,6,2,"div",8),r()}t&2&&(o(),m(" ",v(2,3,"commerce.productview.2"),`
`),o(13),s("ngForOf",n.files),o(),s("ngForOf",n.imageitem.images))},dependencies:[T,E],styles:[".container[_ngcontent-%COMP%]{height:200px;padding:2rem;text-align:center;position:relative;margin:0 auto}.container[_ngcontent-%COMP%]   input[_ngcontent-%COMP%]{opacity:0;position:absolute;z-index:2;width:100%;height:100%;top:0;left:0}.container[_ngcontent-%COMP%]   label[_ngcontent-%COMP%]{color:#fff;width:183px;height:44px;border-radius:21.5px;background-color:#db202f;padding:8px 16px}.container[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%]{font-size:20px;font-weight:600;color:#38424c}.box-header[_ngcontent-%COMP%]{text-align:center;font-weight:500;font-size:20px;padding-bottom:15px;margin-bottom:15px}.fileover[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_shake 1s;animation-iteration-count:infinite}.uploading[_ngcontent-%COMP%]   .name[_ngcontent-%COMP%]{color:#ccc!important}.files-list[_ngcontent-%COMP%]{margin-top:1.5rem;display:flex;gap:20px;flex-wrap:wrap}.files-list[_ngcontent-%COMP%]   .single-file[_ngcontent-%COMP%]{position:relative;flex:1 0 150px;padding:.5rem;justify-content:space-between;align-items:center;margin-bottom:1rem;background-color:#eee;border-radius:5px;margin:0 auto;text-align:center}.files-list[_ngcontent-%COMP%]   .single-file[_ngcontent-%COMP%]   img.file[_ngcontent-%COMP%]{margin-top:20px}.files-list[_ngcontent-%COMP%]   .single-file[_ngcontent-%COMP%]   .delete[_ngcontent-%COMP%]{margin-left:.5rem;cursor:pointer;position:absolute;top:10px;right:10px;color:red}.files-list[_ngcontent-%COMP%]   .single-file[_ngcontent-%COMP%]   .name[_ngcontent-%COMP%]{font-size:13px;font-weight:400;color:#000;margin:0;padding-top:20px;padding-bottom:20px}.files-list[_ngcontent-%COMP%]   .single-file[_ngcontent-%COMP%]   .size[_ngcontent-%COMP%]{font-size:12px;font-weight:500;color:#000;margin:0;margin-bottom:.25rem}.files-list[_ngcontent-%COMP%]   .single-file[_ngcontent-%COMP%]   .info[_ngcontent-%COMP%]{width:100%}@keyframes _ngcontent-%COMP%_shake{0%{transform:translate(1px,1px) rotate(0)}10%{transform:translate(-1px,-2px) rotate(-1deg)}20%{transform:translate(-3px) rotate(1deg)}30%{transform:translate(3px,2px) rotate(0)}40%{transform:translate(1px,-1px) rotate(1deg)}50%{transform:translate(-1px,2px) rotate(-1deg)}60%{transform:translate(-3px,1px) rotate(0)}70%{transform:translate(3px,1px) rotate(-1deg)}80%{transform:translate(-1px,-1px) rotate(1deg)}90%{transform:translate(1px,2px) rotate(0)}to{transform:translate(1px,-2px) rotate(-1deg)}}"]})}return i})();var Dc=i=>["../../product",i];function Pc(i,p){if(i&1){let e=S();a(0,"div",2)(1,"i",3),C("click",function(){let n=y(e).$implicit,c=d();return b(c.removeProduct(n))}),r(),a(2,"a",4),l(3),r()()}if(i&2){let e=p.$implicit;o(2),s("routerLink",nt(2,Dc,e.id)),o(),m(" ",e.defaultName," ")}}var ko=(()=>{class i{listController;dialog;productController;list;products;constructor(e,t,n){this.listController=e,this.dialog=t,this.productController=n}ngOnInit(){this.loadProducts()}showProductPickerDialog(){var e={};e.productIds=this.list.productIds,e.canUnselect=!0;var t=this.dialog.open(Qi,{width:"95vw",maxWidth:"800px",data:e});t.componentInstance.onSelect().subscribe(n=>{this.addProduct(n)}),t.componentInstance.onRemove().subscribe(n=>{this.removeProduct(n)})}addProduct(e){this.listController.addProductToList(this.list.id,e.id).subscribe(t=>{this.list.productIds.push(e.id),this.loadProducts()})}loadProducts(){this.productController.getProductsById(this.list.productIds).subscribe(e=>{this.products=e})}removeProduct(e){this.listController.removeProductFromList(this.list.id,e.id).subscribe(t=>{this.list.productIds=this.list.productIds.filter(n=>n!=e.id),this.loadProducts()})}static \u0275fac=function(t){return new(t||i)(h(ai),h(q),h(ke))};static \u0275cmp=w({type:i,selectors:[["app-list-products"]],inputs:{list:"list"},decls:6,vars:4,consts:[["mat-flat-button","","color","primary",3,"click"],["class","productrow",4,"ngFor","ngForOf"],[1,"productrow"],[1,"fa","fa-trash",3,"click"],[3,"routerLink"]],template:function(t,n){t&1&&(a(0,"button",0),C("click",function(){return n.showProductPickerDialog()}),l(1),u(2,"translate"),r(),_(3,"br")(4,"br"),f(5,Pc,4,4,"div",1)),t&2&&(o(),m(" ",v(2,2,"commerce.listview.1"),`
`),o(4),s("ngForOf",n.products))},dependencies:[mt,T,O,E],styles:[".productrow[_ngcontent-%COMP%]{padding:5px;border-bottom:solid 1px #DDD}"]})}return i})();var Ao=(()=>{class i{nameControl=new R;descControl=new R;list;selectedLocale=0;set setLocale(e){this.selectedLocale=e,this.populateControls()}set setProduct(e){this.list=e,this.populateControls()}populateControls(){if(this.list&&this.selectedLocale!=null){var e=this.list.listDescription[this.selectedLocale];this.nameControl.patchValue(e?e.name:"",{emitEvent:!1,onlySelf:!0}),this.descControl.patchValue(e?e.description:"",{emitEvent:!1,onlySelf:!0})}}constructor(){}ngOnInit(){this.nameControl.valueChanges.subscribe(e=>this.update()),this.descControl.valueChanges.subscribe(e=>this.update())}update(){this.list.listDescription[this.selectedLocale]||(this.list.listDescription[this.selectedLocale]={}),this.list.listDescription[this.selectedLocale].description=this.descControl.value,this.list.listDescription[this.selectedLocale].name=this.nameControl.value}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=w({type:i,selectors:[["app-list-description"]],inputs:{setLocale:[0,"selectedLocale","setLocale"],setProduct:[0,"list","setProduct"]},decls:11,vars:8,consts:[[1,"example-form"],["appearance","fill",1,"full-width"],["matInput","","placeholder","","value","",3,"formControl"],["matInput","","placeholder","",1,"shortdesc",3,"formControl"]],template:function(t,n){t&1&&(a(0,"form",0)(1,"mat-form-field",1)(2,"mat-label"),l(3),u(4,"translate"),r(),_(5,"input",2),r(),a(6,"mat-form-field",1)(7,"mat-label"),l(8),u(9,"translate"),r(),_(10,"textarea",3),r()()),t&2&&(o(3),I(v(4,4,"commerce.productview.description.1")),o(2),s("formControl",n.nameControl),o(3),I(v(9,6,"commerce.productview.description.2")),o(2),s("formControl",n.descControl))},dependencies:[B,H,G,Ce,U,V,ae,ei,le,E],styles:[".example-form[_ngcontent-%COMP%], .full-width[_ngcontent-%COMP%]{width:100%}.shortdesc[_ngcontent-%COMP%]{height:200px}"]})}return i})();function kc(i,p){if(i&1){let e=S();a(0,"div",13),C("click",function(){let n=y(e).$implicit,c=d(3);return b(c.changeLocale(n))}),_(1,"img",14),r()}if(i&2){let e=p.$implicit,t=d(3);ee("active",t.selectedLocale==e.localeId),o(),s("src","/assets/flags/4x3/"+e.lang+".svg",St)}}function Ac(i,p){if(i&1&&(a(0,"div",11),f(1,kc,2,3,"div",12),r()),i&2){let e=d(2);o(),s("ngForOf",e.locales)}}function Oc(i,p){if(i&1){let e=S();a(0,"div")(1,"div",1),l(2),r(),a(3,"div",2),f(4,Ac,2,1,"div",3),a(5,"button",4),C("click",function(){y(e);let n=d();return b(n.deleteProduct())}),_(6,"i",5),r(),a(7,"button",6),C("click",function(){y(e);let n=d();return b(n.save())}),_(8,"i",7),l(9),u(10,"translate"),r()(),a(11,"div",8),_(12,"app-list-description",9)(13,"app-images",10)(14,"app-list-products",9),r()()}if(i&2){let e=d();o(2),m(" ",e.list.listDescription[e.selectedLocale]?e.list.listDescription[e.selectedLocale].name:"Not set yet"," "),o(2),s("ngIf",e.locales&&e.locales.length>1),o(5),m(" ",v(10,10,"commerce.listview.5"),""),o(3),s("selectedLocale",e.selectedLocale)("list",e.list),o(),s("controller",e.listController)("selectedLocale",e.selectedLocale)("imageitem",e.list),o(),s("selectedLocale",e.selectedLocale)("list",e.list)}}var Oo=(()=>{class i{listController;router;activatedRoute;dialog;settingsController;list;locales;selectedLocale=0;selected="description";constructor(e,t,n,c,g){this.listController=e,this.router=t,this.activatedRoute=n,this.dialog=c,this.settingsController=g}ngOnInit(){this.listController.getProductList(this.activatedRoute.snapshot.params.id).subscribe(e=>{this.list=e}),this.settingsController.getAllLocals().subscribe(e=>{this.locales=e})}changeLocale(e){this.selectedLocale=e.localeId}save(){this.listController.updateList(this.list).subscribe(e=>{})}deleteProduct(){var e=confirm("Are you sure?");e&&this.listController.deleteList(this.list.id).subscribe(t=>{this.router.navigate(["../../categories"],{relativeTo:this.activatedRoute})})}static \u0275fac=function(t){return new(t||i)(h(ai),h(Zt),h(Jt),h(q),h(gt))};static \u0275cmp=w({type:i,selectors:[["app-list-view"]],decls:1,vars:1,consts:[[4,"ngIf"],[1,"title"],[1,"sharedmenu"],["class","flags",4,"ngIf"],["mat-flat-button","","color","warn",3,"click"],[1,"fa","fa-trash"],["mat-flat-button","","color","primary",3,"click"],[1,"fa","fa-save"],[1,"gridlist"],[1,"content","tt_contentbox",3,"selectedLocale","list"],[1,"content","tt_contentbox",3,"controller","selectedLocale","imageitem"],[1,"flags"],["class","flag",3,"active","click",4,"ngFor","ngForOf"],[1,"flag",3,"click"],[1,"",3,"src"]],template:function(t,n){t&1&&f(0,Oc,15,12,"div",0),t&2&&s("ngIf",n.list)},dependencies:[T,M,O,Ki,ko,Ao,E],styles:[".title[_ngcontent-%COMP%]{margin-top:30px;font-size:35px;font-weight:600;margin-bottom:30px;min-height:50px}.menu[_ngcontent-%COMP%]{background-color:#fff}.menu[_ngcontent-%COMP%], .content[_ngcontent-%COMP%]{display:inline-block;vertical-align:top;box-sizing:border-box}.menu[_ngcontent-%COMP%]{width:200px;margin-right:50px}.menu[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]{font-size:13px;margin-right:10px}.menu[_ngcontent-%COMP%]   .entry.active[_ngcontent-%COMP%]{font-weight:700}.menu[_ngcontent-%COMP%]   .entry[_ngcontent-%COMP%]{padding:10px;cursor:pointer}.menu[_ngcontent-%COMP%]   div.entry[_ngcontent-%COMP%]:last-child{border-bottom:solid 0px}.content[_ngcontent-%COMP%]{width:calc(100% - 290px)}.sharedmenu[_ngcontent-%COMP%]{text-align:right;margin-bottom:20px;padding-right:40px}.sharedmenu[_ngcontent-%COMP%]   button[_ngcontent-%COMP%]{margin-left:20px}.flags[_ngcontent-%COMP%]{display:inline-block;vertical-align:top}.flag[_ngcontent-%COMP%]{display:inline-block;width:45px;margin-left:20px;cursor:pointer}.flag[_ngcontent-%COMP%]   img[_ngcontent-%COMP%]{border:solid 5px transparent}.flag.active[_ngcontent-%COMP%]   img[_ngcontent-%COMP%]{border:solid 5px #44a7ff}.flags[_ngcontent-%COMP%]   img[_ngcontent-%COMP%]{display:inline-block;width:35px}.gridlist[_ngcontent-%COMP%]{display:flex;gap:20px;flex-wrap:wrap}.gridlist[_ngcontent-%COMP%]   .tt_contentbox[_ngcontent-%COMP%]{flex:1 1 35%}@media only screen and (max-width: 910px){.menu[_ngcontent-%COMP%]{display:block;width:100%;text-align:center}.menu[_ngcontent-%COMP%]   .entry[_ngcontent-%COMP%]{display:inline-block}.content[_ngcontent-%COMP%]{width:100%}}"]})}return i})();var Fo=(()=>{class i{httpService;urlService;constructor(e,t){this.httpService=e,this.urlService=t}executeTask(e){let t=[];t.push({name:"id",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/taskcontroller/execute",null,{params:n})}getTasks(){return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/taskcontroller/tasks")}static \u0275fac=function(t){return new(t||i)(Y(_e),Y(ve))};static \u0275prov=re({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();var Vc=()=>["./printers"];function Bc(i,p){if(i&1&&(a(0,"div",6),_(1,"app-locale",12),r()),i&2){let e=p.$implicit,t=d();o(),s("locale",e)("settings",t)}}function Rc(i,p){i&1&&(a(0,"div",13),_(1,"i",14),l(2," Printers "),r()),i&2&&s("routerLink",Pe(1,Vc))}function Nc(i,p){i&1&&(a(0,"div",6),_(1,"app-thunder-tech-app-list",15),r()),i&2&&(o(),s("header",!1)("module","commerce"))}var Xi=(()=>{class i{settingsController;taskController;locales=[];constructor(e,t){this.settingsController=e,this.taskController=t}ngOnInit(){this.loadAllLocals()}loadAllLocals(){this.settingsController.getAllLocals().subscribe(e=>{this.locales=e})}createNewLocale(){this.settingsController.createNewLocale().subscribe(e=>{this.loadAllLocals()})}static \u0275fac=function(t){return new(t||i)(h(gt),h(Fo))};static \u0275cmp=w({type:i,selectors:[["app-settings"]],decls:48,vars:37,consts:[[1,"title"],[1,"subtitle"],[1,"information"],["mat-flat-button","","color","primary",3,"click"],["class","locale tt_contentbox",4,"ngFor","ngForOf"],["class","locale tt_contentbox","style","text-align: center; cursor: pointer;",3,"routerLink",4,"ngFor","ngForOf"],[1,"locale","tt_contentbox"],[1,"settingsbox","tasklist"],[3,"controller"],[1,"row_seperator"],[1,"header"],[1,"header_sub_info"],[3,"locale","settings"],[1,"locale","tt_contentbox",2,"text-align","center","cursor","pointer",3,"routerLink"],[1,"fa-sharp","fa-thin","fa-print",2,"font-size","50px","display","block","margin-bottom","10px"],[3,"header","module"]],template:function(t,n){t&1&&(a(0,"div",0),l(1),u(2,"translate"),r(),a(3,"div")(4,"div",1),l(5),u(6,"translate"),r(),a(7,"div",2),l(8),u(9,"translate"),_(10,"br")(11,"br"),a(12,"button",3),C("click",function(){return n.createNewLocale()}),l(13),u(14,"translate"),r()(),f(15,Bc,2,2,"div",4)(16,Rc,3,2,"div",5),r(),a(17,"div")(18,"div",1),l(19),u(20,"translate"),r(),f(21,Nc,2,2,"div",4),r(),a(22,"div")(23,"div",1),l(24),u(25,"translate"),r(),a(26,"div",2),l(27),u(28,"translate"),r(),a(29,"div",6),_(30,"app-domain"),r()(),a(31,"div")(32,"div",1),l(33),u(34,"translate"),r(),a(35,"div",2),l(36),u(37,"translate"),r(),_(38,"app-ocr-debug-display"),r(),a(39,"div",7),_(40,"app-thunder-tech-task-list",8),r(),a(41,"div",9)(42,"div",10),l(43),u(44,"translate"),r(),a(45,"div",11),l(46),u(47,"translate"),r()()),t&2&&(o(),m(" ",v(2,15,"commerce.settings.1"),`
`),o(4),m(" ",v(6,17,"commerce.settings.2")," "),o(3),m(" ",v(9,19,"commerce.settings.7")," "),o(5),m(" ",v(14,21,"commerce.settings.8")," "),o(2),s("ngForOf",n.locales),o(),s("ngForOf",n.locales),o(3),m(" ",v(20,23,"commerce.settings.14")," "),o(2),s("ngForOf",n.locales),o(3),m(" ",v(25,25,"commerce.settings.9")," "),o(3),m(" ",v(28,27,"commerce.settings.10")," "),o(6),m(" ",v(34,29,"commerce.settings.12")," "),o(3),m(" ",v(37,31,"commerce.settings.13")," "),o(4),s("controller",n.taskController),o(3),m(" ",v(44,33,"booking.settings.10")," "),o(3),m(" ",v(47,35,"booking.settings.11")," "))},styles:[".title[_ngcontent-%COMP%]{margin-top:30px;font-size:35px;font-weight:600;margin-bottom:30px}.subtitle[_ngcontent-%COMP%]{font-size:25px;font-weight:700;margin-bottom:30px;border-bottom:solid 1px #333;padding:10px}.locale[_ngcontent-%COMP%]{display:inline-block;width:390px;margin-right:20px;vertical-align:top}.information[_ngcontent-%COMP%]{padding:20px;background-color:#f7ffbd;margin-bottom:20px}.subtitle[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]{font-size:20px;padding:10px}"]})}return i})();function Lc(i,p){if(i&1&&(a(0,"mat-hint"),l(1),u(2,"translate"),r()),i&2){let e=d();o(),ge(" ",v(2,2,"commerce.productview.config.6"),": ",e.currentAttributeSet.displayNames[0]," ")}}function jc(i,p){i&1&&(a(0,"mat-form-field",3)(1,"mat-label"),l(2),u(3,"translate"),r(),a(4,"mat-select",14)(5,"mat-option",15),l(6),u(7,"translate"),r(),a(8,"mat-option",15),l(9),u(10,"translate"),r()()()),i&2&&(o(2),I(v(3,5,"commerce.attributeconfig.5")),o(3),s("value","GROUP"),o(),m(" ",v(7,7,"commerce.attributeconfig.6")," "),o(2),s("value","CHECKBOX"),o(),m(" ",v(10,9,"commerce.attributeconfig.7")," "))}function Uc(i,p){if(i&1){let e=S();a(0,"button",16),C("click",function(){y(e);let n=d();return b(n.addAttribute())}),_(1,"i",17),l(2),u(3,"translate"),r()}i&2&&(o(2),m(" ",v(3,1,"commerce.attributeconfig.3")," "))}function Hc(i,p){i&1&&(a(0,"div"),_(1,"br"),r())}function $c(i,p){if(i&1&&(a(0,"mat-hint"),l(1),u(2,"translate"),r()),i&2){let e=d().$implicit;o(),ge("",v(2,2,"commerce.productview.config.6"),": ",e.name[0],"")}}function Gc(i,p){if(i&1){let e=S();a(0,"div",18)(1,"i",19),C("click",function(){let n=y(e).$implicit,c=d();return b(c.removeAttribute(n))}),r(),a(2,"mat-form-field",20)(3,"mat-label"),l(4),u(5,"translate"),r(),_(6,"input",21),f(7,$c,3,4,"mat-hint",6),r()()}if(i&2){let e=p.$implicit,t=d();o(4),m("",v(5,3,"commerce.attributeconfig.4")," "),o(2),s("formControlName","option_"+e.id+"_name"),o(),s("ngIf",t.selectedLocale!=0)}}var Yi=(()=>{class i{attributeToBaseOn;currentAttributeSet;formGroup=new Me({name:new R("",[ce.required]),displayName:new R("",[ce.required]),type:new R("")});selectedLocale=0;get attributeSetType(){return qt}setLocale(e){this.selectedLocale=e,this.populate()}addAttribute(){var e={};e.id=oi(),e.name={},e.name[this.selectedLocale]="Not set",this.currentAttributeSet.attributes||(this.currentAttributeSet.attributes=[]),this.currentAttributeSet.attributes.push(e),this.createAndAddController(e)}createAndAddController(e){this.formGroup.addControl("option_"+e.id+"_name",new R)}removeAttribute(e){this.currentAttributeSet.attributes=this.currentAttributeSet.attributes.filter(t=>t.id!=e.id)}constructor(e){if(this.attributeToBaseOn=e,this.currentAttributeSet=JSON.parse(JSON.stringify(e)),this.currentAttributeSet.attributes)for(let t of this.currentAttributeSet.attributes)this.createAndAddController(t);this.populate(),this.subscribeChanges()}subscribeChanges(){this.formGroup.valueChanges.subscribe(e=>{this.currentAttributeSet.displayNames||(this.currentAttributeSet.displayNames={}),this.currentAttributeSet.displayNames[this.selectedLocale]=e.displayName,this.isParameter()||(this.currentAttributeSet.type=e.type),this.currentAttributeSet.name=e.name;for(var t in e)if(t.startsWith("option_")){var n=t.split("_"),c=this.currentAttributeSet.attributes.find(g=>g.id==n[1]);t.endsWith("_name")&&(c.name[this.selectedLocale]=e[t])}})}ngOnInit(){}populate(){var e={name:this.currentAttributeSet.name,displayName:this.currentAttributeSet.displayNames[this.selectedLocale]};if(this.isParameter()||(e.type=this.currentAttributeSet.type),this.currentAttributeSet)for(var t of this.currentAttributeSet.attributes)e["option_"+t.id+"_name"]=t.name[this.selectedLocale];this.formGroup.patchValue(e)}isParameter(){var e=qt[qt.PARAMETERS],t=this.currentAttributeSet&&this.currentAttributeSet.type&&e==this.currentAttributeSet.type.toString();return t}static \u0275fac=function(t){return new(t||i)(h(ut))};static \u0275cmp=w({type:i,selectors:[["app-attribute-config-dialog"]],decls:26,vars:17,consts:[["mat-dialog-title",""],[1,"mat-typography"],[3,"formGroup"],["appearance","fill",1,"example-full-width"],["matInput","","placeholder","","value","","formControlName","name"],["matInput","","placeholder","","value","","formControlName","displayName"],[4,"ngIf"],["appearance","fill","class","example-full-width",4,"ngIf"],[1,"topmenu"],["class","add_attribute","mat-flat-button","","color","primary",3,"click",4,"ngIf"],["class","optionrow",4,"ngFor","ngForOf"],["align","end"],["mat-button","","mat-dialog-close","",3,"mat-dialog-close"],["mat-button","","cdkFocusInitial","",3,"mat-dialog-close"],["formControlName","type"],[3,"value"],["mat-flat-button","","color","primary",1,"add_attribute",3,"click"],[1,"fa","fa-plus"],[1,"optionrow"],[1,"fa","fa-trash",3,"click"],["appearance","",1,"optionname"],["matInput","","placeholder","","value","",3,"formControlName"]],template:function(t,n){t&1&&(a(0,"div",0),l(1),u(2,"translate"),r(),a(3,"mat-dialog-content",1)(4,"form",2)(5,"mat-form-field",3)(6,"mat-label"),l(7),u(8,"translate"),r(),_(9,"input",4),r(),a(10,"mat-form-field",3)(11,"mat-label"),l(12),u(13,"translate"),r(),_(14,"input",5),f(15,Lc,3,4,"mat-hint",6),r(),f(16,jc,11,11,"mat-form-field",7),a(17,"div",8),f(18,Uc,4,3,"button",9)(19,Hc,2,0,"div",6),r(),f(20,Gc,8,5,"div",10),r()(),a(21,"mat-dialog-actions",11)(22,"button",12),l(23,"Close"),r(),a(24,"button",13),l(25,"Save"),r()()),t&2&&(o(),m(" ",v(2,11,"commerce.attributeconfig.2"),`
`),o(3),s("formGroup",n.formGroup),o(3),m("",v(8,13,"commerce.attributeconfig.8")," "),o(5),m("",v(13,15,"commerce.attributeconfig.1")," "),o(3),s("ngIf",n.selectedLocale!=0&&n.currentAttributeSet.displayNames&&n.currentAttributeSet.displayNames[0]),o(),s("ngIf",!n.isParameter()),o(2),s("ngIf",n.selectedLocale==0),o(),s("ngIf",n.selectedLocale!=0),o(),s("ngForOf",n.currentAttributeSet.attributes),o(2),s("mat-dialog-close",!1),o(2),s("mat-dialog-close",!0))},dependencies:[T,M,de,be,oe,K,B,H,Li,G,ri,ti,Ce,U,V,ae,xe,ye,O,E],styles:[".topmenu[_ngcontent-%COMP%]{text-align:right;padding-bottom:10px}.example-full-width[_ngcontent-%COMP%]{width:calc(50% - 10px);margin-left:5px;margin-right:5px}.optionname[_ngcontent-%COMP%]{width:calc(100% - 40px);margin-left:20px}.optionrow[_ngcontent-%COMP%]{margin-bottom:10px;border:solid 1px #DDD;padding:10px 10px 0;background-color:#fafafa}"]})}return i})();var qc=["paginator"],Qc=["sorter"];function zc(i,p){if(i&1){let e=S();a(0,"div",19),C("click",function(){let n=y(e).$implicit,c=d(2);return b(c.changeLocale(n))}),_(1,"img",20),r()}if(i&2){let e=p.$implicit,t=d(2);ee("active",t.selectedLocale==e.localeId),o(),s("src","/assets/flags/4x3/"+e.lang+".svg",St)}}function Wc(i,p){if(i&1&&(a(0,"div",17),f(1,zc,2,3,"div",18),r()),i&2){let e=d();o(),s("ngForOf",e.locales)}}function Kc(i,p){i&1&&_(0,"th",21)}function Xc(i,p){if(i&1){let e=S();a(0,"td",22)(1,"button",23)(2,"mat-icon"),l(3,"more_vert"),r()(),a(4,"mat-menu",null,1)(6,"button",24),C("click",function(){let n=y(e).$implicit,c=d();return b(c.edit(n))}),a(7,"mat-icon"),l(8,"edit"),r(),a(9,"span"),l(10),u(11,"translate"),r()(),a(12,"button",24),C("click",function(){let n=y(e).$implicit,c=d();return b(c.delete(n))}),a(13,"mat-icon"),l(14,"delete"),r(),a(15,"span"),l(16),u(17,"translate"),r()()()()}if(i&2){let e=fe(5);o(),s("matMenuTriggerFor",e),o(9),I(v(11,3,"commerce.attributesets.9")),o(6),I(v(17,5,"commerce.attributesets.6"))}}function Yc(i,p){i&1&&(a(0,"th",21),l(1),u(2,"translate"),r()),i&2&&(o(),m(" ",v(2,1,"commerce.attributesets.4")," "))}function Jc(i,p){if(i&1&&(a(0,"td",22),l(1),r()),i&2){let e=p.$implicit;o(),m(" ",e.name," ")}}function Zc(i,p){i&1&&(a(0,"th",21),l(1),u(2,"translate"),r()),i&2&&(o(),m(" ",v(2,1,"commerce.attributesets.4")," "))}function el(i,p){if(i&1&&(a(0,"td",22),l(1),r()),i&2){let e=p.$implicit,t=d();o(),m(" ",e.displayNames[t.selectedLocale]," ")}}function tl(i,p){i&1&&_(0,"tr",25)}function il(i,p){i&1&&_(0,"tr",26)}function nl(i,p){i&1&&(a(0,"tr",27)(1,"td",28),l(2),u(3,"translate"),r()()),i&2&&(o(2),I(v(3,1,"commerce.attributesets.5")))}var Vo=(()=>{class i{attributeSetController;dialog;settingsController;paginator;sorter;dataSource;displayedColumns=["menu","name","displayName"];locales;selectedLocale=0;constructor(e,t,n){this.attributeSetController=e,this.dialog=t,this.settingsController=n,this.settingsController.getAllLocals().subscribe(c=>{this.locales=c})}ngOnInit(){}ngAfterViewInit(){setTimeout(e=>{this.dataSource=new Te(this.attributeSetController,"getAll",this.paginator,25,this.sorter)},10)}createFormGroup=new Me({name:new R("",[ce.required])});create(){this.attributeSetController.createAttributeSet(this.createFormGroup.value.name).subscribe(e=>{this.dataSource.refresh()}),this.createFormGroup.reset()}delete(e){var t={};t.title="commerce.attributesets.7",t.message="commerce.attributesets.8",this.dialog.open(Oe,{data:t}).afterClosed().subscribe(n=>{n&&this.attributeSetController.deleteAttributeSet(e.id).subscribe(c=>{this.dataSource.refresh()})})}edit(e){var t=this.dialog.open(Yi,{data:e});t.componentInstance.setLocale(this.selectedLocale),t.afterClosed().subscribe(n=>{if(n){var c=t.componentInstance.currentAttributeSet;this.attributeSetController.save(c).subscribe(g=>{this.dataSource.refresh()})}})}changeLocale(e){this.selectedLocale=e.localeId}static \u0275fac=function(t){return new(t||i)(h(ci),h(q),h(gt))};static \u0275cmp=w({type:i,selectors:[["app-attribute-sets"]],viewQuery:function(t,n){if(t&1&&(N(qc,5),N(Qc,5)),t&2){let c;L(c=j())&&(n.paginator=c.first),L(c=j())&&(n.sorter=c.first)}},decls:30,vars:15,consts:[["sorter","matSort"],["menu","matMenu"],[1,"tt_contentbox"],[3,"ngSubmit","formGroup"],["appearance","",1,"example-full-width"],["matInput","","placeholder","","value","","formControlName","name"],["mat-flat-button","","color","primary",3,"disabled"],["class","flags",4,"ngIf"],["mat-table","","matSort","",1,"tt_table",3,"dataSource"],["matColumnDef","menu"],["mat-header-cell","","mat-sort-header","",4,"matHeaderCellDef"],["mat-cell","",4,"matCellDef"],["matColumnDef","name"],["matColumnDef","displayName"],["mat-header-row","",4,"matHeaderRowDef"],["mat-row","",4,"matRowDef","matRowDefColumns"],["class","mat-row",4,"matNoDataRow"],[1,"flags"],["class","flag",3,"active","click",4,"ngFor","ngForOf"],[1,"flag",3,"click"],[1,"",3,"src"],["mat-header-cell","","mat-sort-header",""],["mat-cell",""],["mat-icon-button","","aria-label","Example icon-button with a menu",3,"matMenuTriggerFor"],["mat-menu-item","",3,"click"],["mat-header-row",""],["mat-row",""],[1,"mat-row"],["colspan","4",1,"mat-cell"]],template:function(t,n){if(t&1){let c=S();a(0,"div",2)(1,"h2"),l(2),u(3,"translate"),r(),a(4,"form",3),C("ngSubmit",function(){return y(c),b(n.create())}),a(5,"mat-form-field",4)(6,"mat-label"),l(7),u(8,"translate"),r(),_(9,"input",5),r(),l(10," \xA0 "),a(11,"button",6),l(12),u(13,"translate"),r()()(),f(14,Wc,2,1,"div",7),a(15,"div",2)(16,"table",8,0),Q(18,9),f(19,Kc,1,0,"th",10)(20,Xc,18,7,"td",11),z(),Q(21,12),f(22,Yc,3,3,"th",10)(23,Jc,2,1,"td",11),z(),Q(24,13),f(25,Zc,3,3,"th",10)(26,el,2,1,"td",11),z(),f(27,tl,1,0,"tr",14)(28,il,1,0,"tr",15)(29,nl,4,3,"tr",16),r()()}t&2&&(o(2),I(v(3,9,"commerce.attributesets.3")),o(2),s("formGroup",n.createFormGroup),o(3),I(v(8,11,"commerce.attributesets.2")),o(4),s("disabled",!n.createFormGroup.valid),o(),m(" ",v(13,13,"commerce.attributesets.1"),"\xA0"),o(2),s("ngIf",n.locales&&n.locales.length>1),o(2),s("dataSource",n.dataSource),o(11),s("matHeaderRowDef",n.displayedColumns),o(),s("matRowDefColumns",n.displayedColumns))},dependencies:[T,M,B,H,ze,G,Fe,Be,je,Re,Ve,Ue,Ne,Le,He,$e,Ge,qe,Ke,Ce,U,V,ae,yt,Tt,bt,xe,ye,O,ii,E],styles:[".mat-column-menu[_ngcontent-%COMP%]{width:50px}.flags[_ngcontent-%COMP%]{vertical-align:top;text-align:right;padding-right:10px;padding-bottom:10px}.flag[_ngcontent-%COMP%]{display:inline-block;width:45px;margin-left:20px;cursor:pointer}.flag[_ngcontent-%COMP%]   img[_ngcontent-%COMP%]{border:solid 5px transparent}.flag.active[_ngcontent-%COMP%]   img[_ngcontent-%COMP%]{border:solid 5px #44a7ff}.flags[_ngcontent-%COMP%]   img[_ngcontent-%COMP%]{display:inline-block;width:35px}"]})}return i})();function ol(i,p){i&1&&(a(0,"span"),l(1),u(2,"translate"),r()),i&2&&(o(),I(v(2,1,"commerce.companydialog.add")))}function rl(i,p){i&1&&(a(0,"span"),l(1),u(2,"translate"),r()),i&2&&(o(),I(v(2,1,"commerce.companydialog.save")))}var Ji=(()=>{class i{dialogRef;updatingContact=!1;contact={};constructor(e){this.dialogRef=e}ngOnInit(){}completeContact(){this.dialogRef.close(this.contact)}static \u0275fac=function(t){return new(t||i)(h(te))};static \u0275cmp=w({type:i,selectors:[["app-add-company-contact"]],decls:35,vars:22,consts:[["appearance","outline"],["matInput","",3,"ngModelChange","ngModel"],["mat-raised-button","","color","primary",1,"addcontact",3,"click"],[4,"ngIf"]],template:function(t,n){t&1&&(a(0,"mat-dialog-content")(1,"div")(2,"mat-form-field",0)(3,"mat-label"),l(4),u(5,"translate"),r(),a(6,"input",1),Ie("ngModelChange",function(g){return Se(n.contact.firstName,g)||(n.contact.firstName=g),g}),r()()(),a(7,"div")(8,"mat-form-field",0)(9,"mat-label"),l(10),u(11,"translate"),r(),a(12,"input",1),Ie("ngModelChange",function(g){return Se(n.contact.lastName,g)||(n.contact.lastName=g),g}),r()()(),a(13,"div")(14,"mat-form-field",0)(15,"mat-label"),l(16),u(17,"translate"),r(),a(18,"input",1),Ie("ngModelChange",function(g){return Se(n.contact.phonePrefix,g)||(n.contact.phonePrefix=g),g}),r()()(),a(19,"div")(20,"mat-form-field",0)(21,"mat-label"),l(22),u(23,"translate"),r(),a(24,"input",1),Ie("ngModelChange",function(g){return Se(n.contact.phoneNumber,g)||(n.contact.phoneNumber=g),g}),r()()(),a(25,"div")(26,"mat-form-field",0)(27,"mat-label"),l(28),u(29,"translate"),r(),a(30,"input",1),Ie("ngModelChange",function(g){return Se(n.contact.email,g)||(n.contact.email=g),g}),r()()()(),a(31,"mat-dialog-actions")(32,"button",2),C("click",function(){return n.completeContact()}),f(33,ol,3,3,"span",3)(34,rl,3,3,"span",3),r()()),t&2&&(o(4),I(v(5,12,"commerce.companydialog.firstName")),o(2),we("ngModel",n.contact.firstName),o(4),I(v(11,14,"commerce.companydialog.lastName")),o(2),we("ngModel",n.contact.lastName),o(4),I(v(17,16,"commerce.companydialog.prefix")),o(2),we("ngModel",n.contact.phonePrefix),o(4),I(v(23,18,"commerce.address.6")),o(2),we("ngModel",n.contact.phoneNumber),o(4),I(v(29,20,"commerce.address.7")),o(2),we("ngModel",n.contact.email),o(3),s("ngIf",!n.updatingContact),o(),s("ngIf",n.updatingContact))},dependencies:[M,oe,K,B,H,G,U,V,et,O,E],styles:["[_nghost-%COMP%]{display:block}.addcontact[_ngcontent-%COMP%]{width:100%}"]})}return i})();var pt=(()=>{class i{httpService;urlService;connectDomainToCompany(e,t){let n=[];n.push({name:"companyid",value:e}),n.push({name:"domain",value:t});let c=new $;for(let g of n)c=c.append(g.name,g.value);return this.httpService.put(this.urlService.getBackendUrl()+"/commerce/companycontroller/connectdomain",null,{params:c})}constructor(e,t){this.httpService=e,this.urlService=t}delete(e){let t=[];t.push({name:"id",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.delete(this.urlService.getBackendUrl()+"/commerce/companycontroller/delete",{params:n})}getByDomain(e){let t=[];t.push({name:"domain",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/companycontroller/bydomain",{params:n})}getById(e){let t=[];t.push({name:"id",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/companycontroller/byid",{params:n})}getByIds(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/companycontroller/byids",e,{headers:t})}getCompanies(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/companycontroller/list",e,{headers:t})}save(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/companycontroller/save",e,{headers:t})}searchBrreg(e){let t=[];t.push({name:"keyword",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/companycontroller/brreg",{params:n})}static \u0275fac=function(t){return new(t||i)(Y(_e),Y(ve))};static \u0275prov=re({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();var al=["companyaddress"],cl=["shippingaddress"],ll=["invoiceaddress"],sl=["contactsaddress"];function pl(i,p){if(i&1&&_(0,"app-brreg",27),i&2){let e=d();s("companyDialogComponent",e)}}function dl(i,p){i&1&&(a(0,"span"),l(1),u(2,"translate"),r()),i&2&&(o(),I(v(2,1,"commerce.companydialog.3")))}function ml(i,p){i&1&&(a(0,"span"),l(1),u(2,"translate"),r()),i&2&&(o(),I(v(2,1,"commerce.companydialog.4")))}var vi=(()=>{class i{dialogRef;companyController;userService;dialog;model;createNew=!1;company;companyAddressRef;shippingAddressRef;invoiceAddressRef;companyContactsRef;hasBrregActive=!1;detailsGroup=new Me({vatNumber:new R,name:new R("",[ce.required]),internalDescription:new R("",[])});constructor(e,t,n,c,g){this.dialogRef=e,this.companyController=t,this.userService=n,this.dialog=c,this.model=g,this.createNew=g.company==null,this.createNew?this.createNewCompany():(this.company=g.company,this.patchValues())}addContact(){var e=this.dialog.open(Ji,{});e.afterClosed().subscribe(t=>{this.company.contacts.push(t)})}patchValues(){this.detailsGroup.patchValue({name:this.company.name,vatNumber:this.company.vatNumber,internalDescription:this.company.internalDescription})}createNewCompany(){this.company={},this.company.companyAddress={},this.company.shippingAddress={},this.company.invoiceAddress={}}ngOnInit(){this.hasBrregActive=this.userService.isAppActivated("booking_brreg")}save(){this.company.name=this.detailsGroup.value.name,this.company.vatNumber=this.detailsGroup.value.vatNumber,this.company.internalDescription=this.detailsGroup.value.internalDescription,this.company.shippingAddress=this.shippingAddressRef.address,this.company.companyAddress=this.companyAddressRef.address,this.company.invoiceAddress=this.invoiceAddressRef.address,this.company.contacts=this.companyContactsRef.contacts,this.companyController.save(this.company).subscribe(e=>{this.company=e,this.dialogRef.close(this.company)})}static \u0275fac=function(t){return new(t||i)(h(te),h(pt),h(Ze),h(q),h(ut))};static \u0275cmp=w({type:i,selectors:[["app-company-dialog"]],viewQuery:function(t,n){if(t&1&&(N(al,5),N(cl,5),N(ll,5),N(sl,5)),t&2){let c;L(c=j())&&(n.companyAddressRef=c.first),L(c=j())&&(n.shippingAddressRef=c.first),L(c=j())&&(n.invoiceAddressRef=c.first),L(c=j())&&(n.companyContactsRef=c.first)}},decls:57,vars:36,consts:[["companyaddress",""],["shippingaddress",""],["invoiceaddress",""],["contactsaddress",""],["mat-dialog-title",""],[3,"companyDialogComponent",4,"ngIf"],[1,"mat-typography"],[3,"formGroup"],[1,"col","col1"],["appearance","fill",1,"example-full-width"],["matInput","","placeholder","","value","","formControlName","vatNumber"],["matInput","","placeholder","Ex. Pizza","value","","formControlName","name"],[1,"col","col2"],["appearance","fill",1,"commentfield"],["matInput","","placeholder","","formControlName","internalDescription"],[1,"addressgrid"],[1,"addressbox"],[1,"company-title"],[1,"address","company",3,"address"],[1,"address","shipping",3,"address"],[1,"address","invoice",3,"address"],[1,"fa-thin","fa-circle-plus","add-contact",3,"click"],[1,"address","invoice",3,"contacts"],["align","end"],["mat-button","","mat-dialog-close",""],["mat-button","","cdkFocusInitial","",3,"click","disabled"],[4,"ngIf"],[3,"companyDialogComponent"]],template:function(t,n){if(t&1){let c=S();a(0,"h2",4),l(1),u(2,"translate"),f(3,pl,1,1,"app-brreg",5),r(),a(4,"mat-dialog-content",6)(5,"form",7)(6,"div",8)(7,"mat-form-field",9)(8,"mat-label"),l(9),u(10,"translate"),r(),_(11,"input",10),r(),_(12,"br"),a(13,"mat-form-field",9)(14,"mat-label"),l(15),u(16,"translate"),r(),_(17,"input",11),r()(),a(18,"div",12)(19,"mat-form-field",13)(20,"mat-label"),l(21),u(22,"translate"),r(),_(23,"textarea",14),r()()(),a(24,"div",15)(25,"div",16)(26,"div",17),l(27),u(28,"translate"),r(),_(29,"app-address",18,0),r(),a(31,"div",16)(32,"div",17),l(33),u(34,"translate"),r(),_(35,"app-address",19,1),r(),a(37,"div",16)(38,"div",17),l(39),u(40,"translate"),r(),_(41,"app-address",20,2),r(),a(43,"div",16)(44,"div",17),l(45),u(46,"translate"),a(47,"i",21),C("click",function(){return y(c),b(n.addContact())}),r()(),_(48,"app-company-contacts",22,3),r()()(),a(50,"mat-dialog-actions",23)(51,"button",24),l(52),u(53,"translate"),r(),a(54,"button",25),C("click",function(){return y(c),b(n.save())}),f(55,dl,3,3,"span",26)(56,ml,3,3,"span",26),r()()}t&2&&(o(),m("",v(2,18,"commerce.companydialog.1")," "),o(2),s("ngIf",n.hasBrregActive),o(2),s("formGroup",n.detailsGroup),o(4),I(v(10,20,"commerce.companydialog.5")),o(6),I(v(16,22,"commerce.companydialog.6")),o(6),I(v(22,24,"commerce.companydialog.7")),o(6),I(v(28,26,"commerce.companydialog.8")),o(2),s("address",n.company.companyAddress),o(4),I(v(34,28,"commerce.companydialog.9")),o(2),s("address",n.company.shippingAddress),o(4),I(v(40,30,"commerce.companydialog.10")),o(2),s("address",n.company.invoiceAddress),o(4),m("",v(46,32,"commerce.companydialog.11")," "),o(3),s("contacts",n.company.contacts),o(4),I(v(53,34,"commerce.companydialog.2")),o(2),s("disabled",!n.detailsGroup.valid),o(),s("ngIf",!n.createNew),o(),s("ngIf",n.createNew))},styles:["[_nghost-%COMP%]{width:1024px;display:block}.example-full-width[_ngcontent-%COMP%], .commentfield[_ngcontent-%COMP%]{width:100%}.commentfield[_ngcontent-%COMP%]   textarea[_ngcontent-%COMP%]{height:87px}.col[_ngcontent-%COMP%]{display:inline-block;width:50%;padding:10px;box-sizing:border-box;vertical-align:top}.addressgrid[_ngcontent-%COMP%]{display:flex;gap:20px;flex-wrap:wrap;align-items:stretch}.addressbox[_ngcontent-%COMP%]{border-radius:5px;flex:1 1 33%;border:solid 1px #efefef}.address[_ngcontent-%COMP%]{padding:10px;background-color:#fff;min-height:calc(100% - 34px);width:100%;display:block}.tabs[_ngcontent-%COMP%]{padding:10px}@media screen and (max-width: 1250px){[_nghost-%COMP%]{max-width:100%}}.addressbox[_ngcontent-%COMP%]{background-color:#eee;border-radius:5px}.company-title[_ngcontent-%COMP%]{text-align:center;font-weight:500;padding:10px;position:relative}"]})}return i})(),Bo=class{company};var ul=["paginator"],fl=["sorter"],gl=()=>[5,10,25,100];function _l(i,p){i&1&&(a(0,"h2",21),l(1),u(2,"translate"),r()),i&2&&(o(),I(v(2,1,"commerce.companypicker.2")))}function vl(i,p){i&1&&(a(0,"h2",21),l(1),u(2,"translate"),r()),i&2&&(o(),I(v(2,1,"commerce.companypicker.5")))}function hl(i,p){i&1&&(a(0,"th",22),l(1," Name "),r())}function Cl(i,p){if(i&1&&(a(0,"td",23),l(1),r()),i&2){let e=p.$implicit;o(),m(" ",e.name," ")}}function xl(i,p){i&1&&_(0,"th",22)}function yl(i,p){if(i&1){let e=S();a(0,"button",25),C("click",function(){y(e);let n=d().$implicit,c=d();return b(c.select(n))}),l(1," Select "),r()}}function bl(i,p){if(i&1){let e=S();a(0,"button",25),C("click",function(){y(e);let n=d().$implicit,c=d();return b(c.unSelect(n))}),_(1,"i",26),r()}}function wl(i,p){if(i&1&&(a(0,"td",23),f(1,yl,2,0,"button",24)(2,bl,2,0,"button",24),r()),i&2){let e=p.$implicit,t=d();o(),s("ngIf",!t.isSelected(e)),o(),s("ngIf",t.isSelected(e))}}function Sl(i,p){i&1&&_(0,"tr",27)}function Il(i,p){i&1&&_(0,"tr",28)}function Ml(i,p){i&1&&(a(0,"tr",29)(1,"td",30),_(2,"i",31),l(3),u(4,"translate"),r()()),i&2&&(o(3),m(" ",v(4,1,"commerce.companypicker.9")," "))}function Dl(i,p){if(i&1){let e=S();a(0,"button",36),C("click",function(){y(e);let n=d().$implicit,c=d(2);return b(c.createCompany(n))}),l(1," Create "),r()}}function Pl(i,p){if(i&1&&(a(0,"div",34),l(1),f(2,Dl,2,0,"button",35),r()),i&2){let e=p.$implicit,t=d(2);o(),m("",e.name," "),o(),s("ngIf",!t.isSelected(t.row))}}function El(i,p){if(i&1&&(a(0,"div")(1,"div",32),l(2),u(3,"translate"),r(),f(4,Pl,3,2,"div",33),r()),i&2){let e=d();o(2),I(v(3,2,"commerce.companypicker.6")),o(2),s("ngForOf",e.fromBrreg)}}function Tl(i,p){if(i&1){let e=S();a(0,"button",37),C("click",function(){y(e);let n=d();return b(n.craeteNewCompany())}),a(1,"mat-icon"),l(2,"add"),r(),l(3),u(4,"translate"),r()}i&2&&(o(3),m(" ",v(4,1,"commerce.companypicker.8")," "))}var Si=(()=>{class i{companyController;dialog;data;dialogRef;nameController=new R;fromBrreg=[];dataSource;displayedColumns=["name","select"];isCreating=!1;searchBrreg=!1;removeCreateButton=!1;selectedCompanies=[];paginator;sorter;constructor(e,t,n,c){if(this.companyController=e,this.dialog=t,this.data=n,this.dialogRef=c,!n)throw"The data model is required, make sure you inject CompanyPickerDialogModel"}ngOnInit(){}craeteNewCompany(){this.openCompanyDialog({company:null})}openCompanyDialog(e){var t=this.dialog.open(vi,{data:e});t.afterClosed().subscribe(n=>{n&&this.dialogRef.close(n)})}ngAfterViewInit(){setTimeout(e=>{this.dataSource=new Te(this.companyController,"getCompanies",this.paginator,25,this.sorter)},100)}hasBrregData(){return this.fromBrreg.length>0}doSearch(){this.searchBrreg&&this.companyController.searchBrreg(this.nameController.value).subscribe(n=>{this.fromBrreg=n});let e={name:this.nameController.value};this.dataSource.setSearchMap(e),this.dataSource.refresh()}isSelected(e){return!e||!e.id?!1:this.selectedCompanies.includes(e.id)}select(e){this.data.singleSelect?this.dialogRef.close(e):this.selectedCompanies.push(e.id)}getSelectedCompanyIds(){return this.selectedCompanies}unSelect(e){let t=this.selectedCompanies.indexOf(e.id);t!==-1&&this.selectedCompanies.splice(t,1)}createCompany(e){this.dialogRef.close(e)}static \u0275fac=function(t){return new(t||i)(h(pt),h(q),h(ut),h(te))};static \u0275cmp=w({type:i,selectors:[["app-company-picker-dialog"]],viewQuery:function(t,n){if(t&1&&(N(ul,5),N(fl,5)),t&2){let c;L(c=j())&&(n.paginator=c.first),L(c=j())&&(n.sorter=c.first)}},decls:32,vars:19,consts:[["sorter","matSort"],["paginator",""],["mat-dialog-title","",4,"ngIf"],[1,"mat-typography"],[3,"submit"],[1,""],["matInput","","placeholder","","value","",3,"formControl"],["mat-flat-button","","color","primary"],["mat-table","","matSort","",1,"tt_table",2,"width","100%",3,"dataSource"],["matColumnDef","name"],["mat-header-cell","","mat-sort-header","",4,"matHeaderCellDef"],["mat-cell","",4,"matCellDef"],["matColumnDef","select"],["mat-header-row","",4,"matHeaderRowDef"],["mat-row","",4,"matRowDef","matRowDefColumns"],["class","mat-row",4,"matNoDataRow"],[4,"ngIf"],[3,"pageSizeOptions"],["align","end"],["mat-flat-button","","color","primary","class","addFromScratch",3,"click",4,"ngIf"],["mat-button","","mat-dialog-close",""],["mat-dialog-title",""],["mat-header-cell","","mat-sort-header",""],["mat-cell",""],["class","selectbutton","mat-flat-button","","color","primary",3,"click",4,"ngIf"],["mat-flat-button","","color","primary",1,"selectbutton",3,"click"],[1,"fa","fa-check"],["mat-header-row",""],["mat-row",""],[1,"mat-row"],["colspan","4",1,"mat-cell"],[1,"fa","fa-think"],[1,"fromBrregTitle"],["class","brregrow",4,"ngFor","ngForOf"],[1,"brregrow"],["class","selectbutton brregbtn","mat-flat-button","","color","primary",3,"click",4,"ngIf"],["mat-flat-button","","color","primary",1,"selectbutton","brregbtn",3,"click"],["mat-flat-button","","color","primary",1,"addFromScratch",3,"click"]],template:function(t,n){if(t&1){let c=S();f(0,_l,3,3,"h2",2)(1,vl,3,3,"h2",2),a(2,"mat-dialog-content",3)(3,"form",4),C("submit",function(){return y(c),b(n.doSearch())}),a(4,"mat-form-field",5)(5,"mat-label"),l(6),u(7,"translate"),r(),_(8,"input",6),r(),l(9," \xA0\xA0 "),a(10,"button",7),l(11),u(12,"translate"),r()(),a(13,"table",8,0),Q(15,9),f(16,hl,2,0,"th",10)(17,Cl,2,1,"td",11),z(),Q(18,12),f(19,xl,1,0,"th",10)(20,wl,3,2,"td",11),z(),f(21,Sl,1,0,"tr",13)(22,Il,1,0,"tr",14)(23,Ml,5,3,"tr",15),r(),f(24,El,5,4,"div",16),_(25,"mat-paginator",17,1),r(),a(27,"mat-dialog-actions",18),f(28,Tl,5,3,"button",19),a(29,"button",20),l(30),u(31,"translate"),r()()}t&2&&(s("ngIf",!n.isCreating),o(),s("ngIf",n.isCreating),o(5),m("",v(7,12,"commerce.companypicker.1")," "),o(2),s("formControl",n.nameController),o(3),m(" ",v(12,14,"commerce.companypicker.4")," "),o(2),s("dataSource",n.dataSource),o(8),s("matHeaderRowDef",n.displayedColumns),o(),s("matRowDefColumns",n.displayedColumns),o(2),s("ngIf",n.hasBrregData()),o(),s("pageSizeOptions",Pe(18,gl)),o(3),s("ngIf",!n.removeCreateButton),o(2),I(v(31,16,"commerce.companypicker.3")))},dependencies:[T,M,de,be,oe,K,Xe,B,H,ze,G,Fe,Be,je,Re,Ve,Ue,Ne,Le,He,$e,Ge,qe,Ke,Ce,U,V,ae,ei,le,O,E],styles:[".mat-column-select[_ngcontent-%COMP%]{width:50px;text-align:center}.fromBrregTitle[_ngcontent-%COMP%]{text-align:center;border-bottom:solid 1px;font-size:20px;text-transform:uppercase;margin-top:20px;margin-bottom:20px}.brregrow[_ngcontent-%COMP%]{line-height:60px}.brregbtn[_ngcontent-%COMP%], .addFromScratch[_ngcontent-%COMP%]{float:right}"]})}return i})(),Zi=class{companyIds=[];singleSelect=!1};var kl=["paginator"],Al=["sorter"];function Ol(i,p){if(i&1&&(a(0,"div"),l(1),r()),i&2){let e=d().$implicit;o(),m("Vat ",e.vatNumber,"")}}function Fl(i,p){if(i&1&&(a(0,"div"),l(1),r()),i&2){let e=d().$implicit;o(),I(e.companyAddress.address)}}function Vl(i,p){if(i&1&&(a(0,"div"),l(1),r()),i&2){let e=d().$implicit;o(),I(e.companyAddress.address2)}}function Bl(i,p){if(i&1&&(a(0,"div"),l(1),r()),i&2){let e=d().$implicit;o(),ge("",e.companyAddress.postCode," ",e.companyAddress.city," ")}}function Rl(i,p){if(i&1){let e=S();a(0,"div",8),C("click",function(){let n=y(e).$implicit,c=d();return b(c.navigated(n))}),a(1,"div",9),l(2),a(3,"i",10),C("click",function(n){return y(e),b(n.stopPropagation())}),r(),a(4,"mat-menu",null,1)(6,"button",11),C("click",function(){let n=y(e).$implicit,c=d();return b(c.edit(n))}),l(7,"Edit company"),r(),a(8,"button",11),C("click",function(){let n=y(e).$implicit,c=d();return b(c.delete(n))}),l(9,"Delete this list"),r()()(),a(10,"div",12),f(11,Ol,2,1,"div",13)(12,Fl,2,1,"div",13)(13,Vl,2,1,"div",13)(14,Bl,2,2,"div",13),r()()}if(i&2){let e=p.$implicit,t=fe(5);o(2),m("",e.name," "),o(),s("matMenuTriggerFor",t),o(8),s("ngIf",e.vatNumber),o(),s("ngIf",e.companyAddress),o(),s("ngIf",e.companyAddress),o(),s("ngIf",e.companyAddress)}}var Ro=(()=>{class i{dialog;companyController;dataSource;displayedColumns=["menu","name"];companyClicked=new it;paginator;sorter;constructor(e,t){this.dialog=e,this.companyController=t}ngOnInit(){}navigated(e){this.companyClicked.next(e)}getDataSet(){return this.dataSource?this.dataSource.dataSet:[]}ngAfterViewInit(){setTimeout(e=>{this.dataSource=new Te(this.companyController,"getCompanies",this.paginator,100,this.sorter)},10)}pickNewCompany(){this.openDialog({company:null})}craeteNewCompany(){this.openCompanyDialog({company:null})}applyFilter(e){this.dataSource.setSearchMap({name:e.target.value})}edit(e){console.log(e),this.openEditDialog({company:e})}openCompanyDialog(e){var t=this.dialog.open(vi,{data:e});t.afterClosed().subscribe(n=>{n&&this.dataSource.refresh()})}openDialog(e){var t=this.dialog.open(Si,{data:e});t.componentInstance.isCreating=!0,t.componentInstance.searchBrreg=!0,t.afterClosed().subscribe(n=>{this.companyController.save(n).subscribe(c=>{this.dataSource.refresh()})})}openEditDialog(e){var t=this.dialog.open(vi,{data:e});t.afterClosed().subscribe(n=>{this.companyController.save(n).subscribe(c=>{this.dataSource.refresh()})})}delete(e){var t={};t.title="commerce.companylist.7",t.message="commerce.companylist.8",this.dialog.open(Oe,{data:t}).afterClosed().subscribe(n=>{n&&this.companyController.delete(e.id).subscribe(c=>{this.dataSource.refresh()})})}static \u0275fac=function(t){return new(t||i)(h(q),h(pt))};static \u0275cmp=w({type:i,selectors:[["app-company-list"]],viewQuery:function(t,n){if(t&1&&(N(kl,5),N(Al,5)),t&2){let c;L(c=j())&&(n.paginator=c.first),L(c=j())&&(n.sorter=c.first)}},decls:15,vars:7,consts:[["filter","","input",""],["menu","matMenu"],[1,"menu"],["mat-flat-button","","color","primary",3,"click"],[1,"filter"],["matInput","","placeholder","Ex. Mia",3,"keyup.enter"],[1,"grid"],["class","company",3,"click",4,"ngFor","ngForOf"],[1,"company",3,"click"],[1,"companyname"],[1,"fa","fa-ellipsis-vertical","editicon",3,"click","matMenuTriggerFor"],["mat-menu-item","",3,"click"],[1,"companydetails"],[4,"ngIf"]],template:function(t,n){if(t&1){let c=S();a(0,"div",2)(1,"button",3),C("click",function(){return y(c),b(n.pickNewCompany())}),a(2,"mat-icon"),l(3,"add"),r(),l(4),u(5,"translate"),r(),a(6,"mat-form-field",4)(7,"mat-label"),l(8),u(9,"translate"),r(),a(10,"input",5,0),C("keyup.enter",function(x){return y(c),b(n.applyFilter(x))}),r()()(),a(13,"div",6),f(14,Rl,15,6,"div",7),r()}t&2&&(o(4),m(" ",v(5,3,"commerce.companylist.1")," "),o(4),I(v(9,5,"commerce.companylist.2")),o(6),s("ngForOf",n.getDataSet()))},dependencies:[T,M,B,H,ze,G,yt,Tt,bt,O,E],styles:['.menu[_ngcontent-%COMP%]{margin-bottom:20px}.filter[_ngcontent-%COMP%]{margin-left:20px}.mat-column-menu[_ngcontent-%COMP%]{width:50px}.company[_ngcontent-%COMP%]{width:90%;background-color:#eee;margin:10px;border-radius:10px;cursor:pointer}.editicon[_ngcontent-%COMP%]{position:absolute;right:5px;top:5px;width:30px;line-height:25px;background-color:#fff;border-radius:3px}.addFromScratch[_ngcontent-%COMP%]{float:right}.grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr 1fr 1fr}.companyname[_ngcontent-%COMP%]{overflow:hidden;white-space:nowrap;text-overflow:ellipsis " [..]";border-top-left-radius:10px;border-top-right-radius:10px;font-weight:600;padding:10px 10px 5px;font-weight:400;text-align:center;position:relative}.companydetails[_ngcontent-%COMP%]{min-height:100px;padding:10px;line-height:24px;background-color:#fff;border-radius:10px}@media only screen and (max-width: 1800px){.grid[_ngcontent-%COMP%]{grid-template-columns:1fr 1fr 1fr}}@media only screen and (max-width: 1500px){.grid[_ngcontent-%COMP%]{grid-template-columns:1fr 1fr}}@media only screen and (max-width: 600px){.grid[_ngcontent-%COMP%]{grid-template-columns:1fr}}']})}return i})();var pi=(()=>{class i{httpService;urlService;constructor(e,t){this.httpService=e,this.urlService=t}createCustomer(e){let t=[];t.push({name:"name",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/customercontroller/create",null,{params:n})}deleteCustomer(e){let t=[];t.push({name:"customerId",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/customercontroller/delete",null,{params:n})}getByIds(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/customercontroller/byIds",e,{headers:t})}getCustomer(e){let t=[];t.push({name:"id",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/customercontroller/get",{params:n})}getCustomers(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/customercontroller/search",e,{headers:t})}saveCustomer(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/customercontroller/save",e,{headers:t})}static \u0275fac=function(t){return new(t||i)(Y(_e),Y(ve))};static \u0275prov=re({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();var Nl=["paginator"],Ll=["sorter"],jl=()=>[5,10,25,100];function Ul(i,p){i&1&&_(0,"th",18)}function Hl(i,p){i&1&&(a(0,"mat-icon"),l(1,"checked"),r())}function $l(i,p){if(i&1&&(a(0,"td",19),f(1,Hl,2,0,"mat-icon",3),l(2),r()),i&2){let e=p.$implicit,t=d(2);o(),s("ngIf",t.isSelected(e.id)),o(),m(" ",e.details.fullName," ")}}function Gl(i,p){i&1&&_(0,"tr",20)}function ql(i,p){if(i&1){let e=S();a(0,"tr",21),C("click",function(){let n=y(e).$implicit,c=d(2);return b(c.selectCustomer(n))}),r()}if(i&2){let e=d(2);ee("selectable",e.data.singleSelect!=null)}}function Ql(i,p){i&1&&(a(0,"tr",22)(1,"td",23),l(2),u(3,"translate"),r()()),i&2&&(o(2),I(v(3,1,"commerce.privatecustomer.12")))}function zl(i,p){if(i&1&&(a(0,"div"),_(1,"input",8),u(2,"translate"),a(3,"div",9)(4,"table",10,0),Q(6,11),f(7,Ul,1,0,"th",12)(8,$l,3,2,"td",13),z(),f(9,Gl,1,0,"tr",14)(10,ql,1,2,"tr",15)(11,Ql,4,3,"tr",16),r(),_(12,"mat-paginator",17,1),r()()),i&2){let e=d();o(),Ri("placeholder",v(2,6,"commerce.privatecustomer.7")),s("formControl",e.searchController),o(3),s("dataSource",e.dataSource),o(5),s("matHeaderRowDef",e.displayedColumns),o(),s("matRowDefColumns",e.displayedColumns),o(2),s("pageSizeOptions",Pe(8,jl))}}function Wl(i,p){if(i&1&&(a(0,"div",24)(1,"div",25),l(2),u(3,"translate"),r(),a(4,"form",26)(5,"mat-form-field",27)(6,"mat-label"),l(7),u(8,"translate"),r(),_(9,"input",28),r(),_(10,"br"),a(11,"mat-form-field",27)(12,"mat-label"),l(13),u(14,"translate"),r(),_(15,"input",29),r(),_(16,"br"),a(17,"mat-form-field",27)(18,"mat-label"),l(19),u(20,"translate"),r(),_(21,"input",30),r()()()),i&2){let e=d();o(2),m(" ",v(3,5,"commerce.privatecustomer.8")," "),o(2),s("formGroup",e.customerFormGroup),o(3),I(v(8,7,"commerce.privatecustomer.7")),o(6),I(v(14,9,"commerce.privatecustomer.10")),o(6),I(v(20,11,"commerce.privatecustomer.11"))}}function Kl(i,p){if(i&1&&(a(0,"span",34),l(1),r()),i&2){let e=d(2);o(),m('"',e.searchController.value,'"')}}function Xl(i,p){if(i&1){let e=S();a(0,"button",31),C("click",function(){y(e);let n=d();return b(n.createCustomer())}),_(1,"i",32),l(2),u(3,"translate"),f(4,Kl,2,1,"span",33),r()}if(i&2){let e=d();s("disabled",!e.searchController.valid),o(2),m(" ",v(3,3,"commerce.privatecustomer.6")," "),o(2),s("ngIf",e.searchController.value)}}function Yl(i,p){if(i&1){let e=S();a(0,"button",35),C("click",function(){y(e);let n=d();return b(n.saveCustomer())}),l(1),u(2,"translate"),r()}i&2&&(o(),m(" ",v(2,1,"commerce.privatecustomer.9")," "))}var Fi=(()=>{class i{data;customerController;dialogRef;searchController=new R("",[ce.required]);customer;selectedCustomer=[];dataSource;displayedColumns=["name"];paginator;sorter;customerFormGroup=new Me({name:new R("",[ce.required]),phone:new R(""),email:new R("")});constructor(e,t,n){this.data=e,this.customerController=t,this.dialogRef=n,this.customer=e.customer,this.customer&&this.populateForm(),this.searchController.valueChanges.subscribe(c=>{this.dataSource.setSearchMap({searchWord:c})})}isSelected(e){return this.selectedCustomer.includes(e)}ngOnInit(){}ngAfterViewInit(){setTimeout(e=>{this.dataSource=new Te(this.customerController,"getCustomers",this.paginator,5,this.sorter)},10)}populateForm(){this.customerFormGroup.patchValue({name:this.customer.details.fullName,email:this.customer.details.email,phone:this.customer.details.phoneNumber})}createCustomer(){this.customerController.createCustomer(this.searchController.value).subscribe(e=>{this.customer=e,this.populateForm()})}saveCustomer(){if(!this.data.singleSelect){this.dialogRef.close(this.selectedCustomer);return}this.customer.details.fullName=this.customerFormGroup.value.name,this.customer.details.email=this.customerFormGroup.value.email,this.customer.details.phoneNumber=this.customerFormGroup.value.phone,this.customerController.saveCustomer(this.customer).subscribe(e=>{this.customer=e,this.dialogRef.close(this.customer)})}selectCustomer(e){if(this.data.singleSelect)this.dialogRef.close(e);else{let t=this.selectedCustomer.indexOf(e.id);t!==-1?this.selectedCustomer.splice(t,1):this.selectedCustomer.push(e.id)}}static \u0275fac=function(t){return new(t||i)(h(ut),h(pi),h(te))};static \u0275cmp=w({type:i,selectors:[["app-private-customer-picker-dialog"]],viewQuery:function(t,n){if(t&1&&(N(Nl,5),N(Ll,5)),t&2){let c;L(c=j())&&(n.paginator=c.first),L(c=j())&&(n.sorter=c.first)}},decls:6,vars:4,consts:[["sorter","matSort"],["paginator",""],[1,"mat-typography"],[4,"ngIf"],["class","editcustomer",4,"ngIf"],["align","end"],["mat-flat-button","","color","primary",3,"disabled","click",4,"ngIf"],["mat-flat-button","",3,"click",4,"ngIf"],["value","",1,"searchfield",3,"formControl","placeholder"],[1,"searchresult"],["mat-table","","matSort","",1,"tt_table",3,"dataSource"],["matColumnDef","name"],["mat-header-cell","","style","display: none",4,"matHeaderCellDef"],["mat-cell","",4,"matCellDef"],["mat-header-row","",4,"matHeaderRowDef"],["mat-row","",3,"selectable","click",4,"matRowDef","matRowDefColumns"],["class","mat-row",4,"matNoDataRow"],[3,"pageSizeOptions"],["mat-header-cell","",2,"display","none"],["mat-cell",""],["mat-header-row",""],["mat-row","",3,"click"],[1,"mat-row"],[1,"mat-cell"],[1,"editcustomer"],[1,"editcustomerheader"],[1,"example-form",3,"formGroup"],["appearance","fill",1,"example-full-width"],["matInput","","placeholder","","value","","formControlName","name"],["matInput","","placeholder","","value","","formControlName","phone"],["matInput","","placeholder","","value","","formControlName","email"],["mat-flat-button","","color","primary",3,"click","disabled"],[1,"fal","fa-plus"],["style","display: inline-block; vertical-align: top;",4,"ngIf"],[2,"display","inline-block","vertical-align","top"],["mat-flat-button","",3,"click"]],template:function(t,n){t&1&&(a(0,"mat-dialog-content",2),f(1,zl,14,9,"div",3)(2,Wl,22,13,"div",4),r(),a(3,"mat-dialog-actions",5),f(4,Xl,5,5,"button",6)(5,Yl,3,3,"button",7),r()),t&2&&(o(),s("ngIf",!n.customer),o(),s("ngIf",n.customer),o(2),s("ngIf",!n.customer),o(),s("ngIf",n.customer||!n.data.singleSelect))},dependencies:[M,oe,K,Xe,B,H,ze,G,Fe,Be,je,Re,Ve,Ue,Ne,Le,He,$e,Ge,qe,Ce,U,V,ae,le,xe,ye,O,E],styles:[".searchfield[_ngcontent-%COMP%]{padding:10px;border:solid 1px #DDD;width:100%;box-sizing:border-box}.editcustomerheader[_ngcontent-%COMP%]{font-size:18px;font-weight:400;padding-bottom:30px;text-align:center}[_nghost-%COMP%]     .mat-mdc-paginator-page-size, [_nghost-%COMP%]     thead{display:none!important}[_nghost-%COMP%]     tbody{min-height:254px;display:block}.searchresult[_ngcontent-%COMP%]{min-width:300px;height:310px;border:solid 1px #DDD;margin-top:5px}.selectable[_ngcontent-%COMP%]{cursor:pointer}.selectable[_ngcontent-%COMP%]:hover{background-color:#efefef}.tt_table[_ngcontent-%COMP%]{width:100%}table.mat-mdc-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]{width:252px}"]})}return i})(),hi=class{customer;singleSelect=null};var Jl=["paginator"],Zl=["sorter"],es=()=>[5,10,25,100];function ts(i,p){i&1&&_(0,"th",17)}function is(i,p){if(i&1){let e=S();a(0,"td",18)(1,"button",19)(2,"mat-icon"),l(3,"more_vert"),r()(),a(4,"mat-menu",null,2)(6,"button",20),C("click",function(){let n=y(e).$implicit,c=d();return b(c.edit(n))}),a(7,"mat-icon"),l(8,"edit"),r(),a(9,"span"),l(10),u(11,"translate"),r()(),a(12,"button",20),C("click",function(){let n=y(e).$implicit,c=d();return b(c.delete(n))}),a(13,"mat-icon"),l(14,"delete"),r(),a(15,"span"),l(16),u(17,"translate"),r()()()()}if(i&2){let e=fe(5);o(),s("matMenuTriggerFor",e),o(9),I(v(11,3,"commerce.companylist.3")),o(6),I(v(17,5,"commerce.companylist.4"))}}function ns(i,p){i&1&&(a(0,"th",17),l(1),u(2,"translate"),r()),i&2&&(o(),m(" ",v(2,1,"commerce.privatecustomer.7")," "))}function os(i,p){if(i&1&&(a(0,"td",18),l(1),r()),i&2){let e=p.$implicit;o(),m(" ",e.details.fullName," ")}}function rs(i,p){i&1&&_(0,"tr",21)}function as(i,p){i&1&&_(0,"tr",22)}function cs(i,p){i&1&&(a(0,"tr",23)(1,"td",24),l(2),u(3,"translate"),r()()),i&2&&(o(2),I(v(3,1,"commerce.privatecustomer.12")))}var No=(()=>{class i{dialog;customerController;dataSource;displayedColumns=["menu","name"];paginator;sorter;constructor(e,t){this.dialog=e,this.customerController=t}ngOnInit(){}ngAfterViewInit(){setTimeout(e=>{this.dataSource=new Te(this.customerController,"getCustomers",this.paginator,100,this.sorter)},10)}showCreateNewPrivateCustomer(){var e=new hi,t=this.dialog.open(Fi,{data:e});t.afterClosed().subscribe(n=>{this.dataSource.refresh()})}delete(e){var t=new ct("commerce.privatecustomer.13","commerce.privatecustomer.14"),n=this.dialog.open(Oe,{data:t});n.afterClosed().subscribe(c=>{c&&this.customerController.deleteCustomer(e.id).subscribe(g=>{this.dataSource.refresh()})})}edit(e){var t=new hi;t.customer=e;var n=this.dialog.open(Fi,{data:t});n.afterClosed().subscribe(c=>{this.dataSource.refresh()})}static \u0275fac=function(t){return new(t||i)(h(q),h(pi))};static \u0275cmp=w({type:i,selectors:[["app-private-list"]],viewQuery:function(t,n){if(t&1&&(N(Jl,5),N(Zl,5)),t&2){let c;L(c=j())&&(n.paginator=c.first),L(c=j())&&(n.sorter=c.first)}},decls:26,vars:14,consts:[["sorter","matSort"],["paginator",""],["menu","matMenu"],[1,"header"],[1,"header_sub_info"],[1,"menu"],["mat-flat-button","","color","primary",3,"click"],[1,"tt_contentbox"],["mat-table","","matSort","",1,"tt_table",3,"dataSource"],["matColumnDef","menu"],["mat-header-cell","","mat-sort-header","",4,"matHeaderCellDef"],["mat-cell","",4,"matCellDef"],["matColumnDef","name"],["mat-header-row","",4,"matHeaderRowDef"],["mat-row","",4,"matRowDef","matRowDefColumns"],["class","mat-row",4,"matNoDataRow"],[3,"pageSizeOptions"],["mat-header-cell","","mat-sort-header",""],["mat-cell",""],["mat-icon-button","","aria-label","Example icon-button with a menu",3,"matMenuTriggerFor"],["mat-menu-item","",3,"click"],["mat-header-row",""],["mat-row",""],[1,"mat-row"],["colspan","4",1,"mat-cell"]],template:function(t,n){if(t&1){let c=S();a(0,"div",3),l(1),u(2,"translate"),r(),a(3,"div",4),l(4),u(5,"translate"),r(),a(6,"div",5)(7,"button",6),C("click",function(){return y(c),b(n.showCreateNewPrivateCustomer())}),a(8,"mat-icon"),l(9,"add"),r(),l(10),u(11,"translate"),r()(),a(12,"div",7)(13,"table",8,0),Q(15,9),f(16,ts,1,0,"th",10)(17,is,18,7,"td",11),z(),Q(18,12),f(19,ns,3,3,"th",10)(20,os,2,1,"td",11),z(),f(21,rs,1,0,"tr",13)(22,as,1,0,"tr",14)(23,cs,4,3,"tr",15),r(),_(24,"mat-paginator",16,1),r()}t&2&&(o(),m(" ",v(2,7,"commerce.privatecustomer.2"),`
`),o(3),m(" ",v(5,9,"commerce.privatecustomer.3"),`
`),o(6),m(" ",v(11,11,"commerce.privatecustomer.1")," "),o(3),s("dataSource",n.dataSource),o(8),s("matHeaderRowDef",n.displayedColumns),o(),s("matRowDefColumns",n.displayedColumns),o(2),s("pageSizeOptions",Pe(13,es)))},dependencies:[Xe,ze,Fe,Be,je,Re,Ve,Ue,Ne,Le,He,$e,Ge,qe,Ke,yt,Tt,bt,O,ii,E],styles:[".header[_ngcontent-%COMP%]{font-size:20px;font-weight:500;margin-bottom:10px;display:block}.header_sub_info[_ngcontent-%COMP%]{color:#4a5073;font-size:13px;font-weight:500;margin-bottom:30px;padding-right:150px}.menu[_ngcontent-%COMP%]{margin-bottom:20px;position:absolute;right:10px;top:10px}.mat-column-menu[_ngcontent-%COMP%]{width:50px}"]})}return i})();var ls=["paginator"],ss=["sorter"],ps=()=>[5,10,25,100],ds=i=>["../../pos/proforma",i];function ms(i,p){i&1&&(a(0,"th",14),l(1," ID "),r())}function us(i,p){if(i&1&&(a(0,"td",15),l(1),r()),i&2){let e=p.$implicit;o(),m(" ",e.id," ")}}function fs(i,p){i&1&&(a(0,"th",14),l(1," Name "),r())}function gs(i,p){if(i&1&&(a(0,"td",15),l(1),r()),i&2){let e=p.$implicit;o(),m(" ",e.defaultName," ")}}function _s(i,p){i&1&&(a(0,"th",14),l(1," Created "),r())}function vs(i,p){if(i&1&&(a(0,"td",15),l(1),u(2,"date"),r()),i&2){let e=p.$implicit;o(),m(" ",F(2,1,e.docCreatedDate,"d.M.Y hh:mm:ss")," ")}}function hs(i,p){i&1&&_(0,"tr",16)}function Cs(i,p){if(i&1&&_(0,"tr",17),i&2){let e=p.$implicit;s("routerLink",nt(1,ds,e.id))}}function xs(i,p){i&1&&(a(0,"tr",18)(1,"td",19),l(2,"No data matching the filter "),r()())}var Lo=(()=>{class i{accountController;dataSource;displayedColumns=["id","created"];paginator;sorter;constructor(e){this.accountController=e}ngOnInit(){}ngAfterViewInit(){setTimeout(()=>{this.dataSource=new Te(this.accountController,"getOrders",this.paginator,25,this.sorter)})}static \u0275fac=function(t){return new(t||i)(h(Ae))};static \u0275cmp=w({type:i,selectors:[["app-order-list"]],viewQuery:function(t,n){if(t&1&&(N(ls,5),N(ss,5)),t&2){let c;L(c=j())&&(n.paginator=c.first),L(c=j())&&(n.sorter=c.first)}},decls:20,vars:8,consts:[["sorter","matSort"],["paginator",""],[1,"tt_contentbox"],[1,"header"],["mat-table","","matSort","",1,"tt_table",2,"width","100%",3,"dataSource"],["matColumnDef","id"],["mat-header-cell","","mat-sort-header","",4,"matHeaderCellDef"],["mat-cell","",4,"matCellDef"],["matColumnDef","name"],["matColumnDef","created"],["mat-header-row","",4,"matHeaderRowDef"],["mat-row","",3,"routerLink",4,"matRowDef","matRowDefColumns"],["class","mat-row",4,"matNoDataRow"],[3,"pageSizeOptions"],["mat-header-cell","","mat-sort-header",""],["mat-cell",""],["mat-header-row",""],["mat-row","",3,"routerLink"],[1,"mat-row"],["colspan","4",1,"mat-cell"]],template:function(t,n){t&1&&(a(0,"div",2)(1,"div",3),l(2),u(3,"translate"),r(),a(4,"table",4,0),Q(6,5),f(7,ms,2,0,"th",6)(8,us,2,1,"td",7),z(),Q(9,8),f(10,fs,2,0,"th",6)(11,gs,2,1,"td",7),z(),Q(12,9),f(13,_s,2,0,"th",6)(14,vs,3,4,"td",7),z(),f(15,hs,1,0,"tr",10)(16,Cs,1,3,"tr",11)(17,xs,3,0,"tr",12),r(),_(18,"mat-paginator",13,1),r()),t&2&&(o(2),I(v(3,5,"commerce.productlist.3")),o(2),s("dataSource",n.dataSource),o(11),s("matHeaderRowDef",n.displayedColumns),o(),s("matRowDefColumns",n.displayedColumns),o(2),s("pageSizeOptions",Pe(7,ps)))},dependencies:[mt,Xe,Fe,Be,je,Re,Ve,Ue,Ne,Le,He,$e,Ge,qe,Ke,E,ue]})}return i})();function ys(i,p){i&1&&_(0,"i",2)}function bs(i,p){i&1&&(a(0,"span"),l(1," (not transferred to accounting report) "),r())}function ws(i,p){i&1&&(a(0,"span"),l(1," (has been transferred to accounting report) "),r())}function Ss(i,p){i&1&&(a(0,"div",9),l(1," ( Refund ) "),r())}function Is(i,p){if(i&1&&(a(0,"div",5)(1,"div",6),l(2),u(3,"date"),r(),a(4,"div",7),l(5),f(6,bs,2,0,"span",1)(7,ws,2,0,"span",1),l(8),r(),f(9,Ss,2,0,"div",8),r()),i&2){let e=p.$implicit;o(2),m(" ",F(3,6,e.date,"short")," "),o(3),m(" ",e.totalCharged," \xA0\xA0 "),o(),s("ngIf",!e.isTransferredToAccounting),o(),s("ngIf",e.isTransferredToAccounting),o(),m(" ",e.chargeId," "),o(),s("ngIf",e.isRefund)}}function Ms(i,p){if(i&1&&(a(0,"div"),l(1),a(2,"div",3)(3,"b"),l(4," Charges "),r(),f(5,Is,10,9,"div",4),r()()),i&2){let e=d();o(),m(" Type: ",e.payment.type.name," "),o(4),s("ngForOf",e.payment.charges)}}var jo=(()=>{class i{route;paymentController;payment;constructor(e,t){this.route=e,this.paymentController=t;let n=this.route.snapshot.params.id;this.paymentController.getPaymentById(n).subscribe(c=>{this.payment=c})}static \u0275fac=function(t){return new(t||i)(h(Jt),h(We))};static \u0275cmp=w({type:i,selectors:[["app-payment-view"]],decls:2,vars:2,consts:[["class","fa fa-spin fa-spinner",4,"ngIf"],[4,"ngIf"],[1,"fa","fa-spin","fa-spinner"],[1,"charges"],["class","row",4,"ngFor","ngForOf"],[1,"row"],[1,"col1"],[1,"col2"],["class","col3",4,"ngIf"],[1,"col3"]],template:function(t,n){t&1&&f(0,ys,1,0,"i",0)(1,Ms,6,2,"div",1),t&2&&(s("ngIf",!n.payment),o(),s("ngIf",n.payment))},dependencies:[T,M,ue],styles:[".charges[_ngcontent-%COMP%]{background-color:#fff;border-radius:5px;padding:20px;margin-top:20px}.charges[_ngcontent-%COMP%]   .row[_ngcontent-%COMP%]{display:flex;gap:20px;border-top:solid 1px #DDD;margin-top:10px;padding-top:10px}"]})}return i})();var Ds=["invoicelist"];function Ps(i,p){i&1&&(a(0,"div"),_(1,"i",4),r())}function Es(i,p){i&1&&(a(0,"div",7),_(1,"i",8),l(2),u(3,"translate"),r()),i&2&&(o(2),m(" ",v(3,1,"commerce.invoice.1")," "))}function Ts(i,p){i&1&&(a(0,"div"),_(1,"app-summary"),r())}function ks(i,p){i&1&&(a(0,"div",9),_(1,"app-invoice-list",null,0),r())}function As(i,p){if(i&1&&(a(0,"div"),f(1,Es,4,3,"div",5)(2,Ts,2,0,"div",2)(3,ks,3,0,"div",6),r()),i&2){let e=d();o(),s("ngIf",e.paymentTypes.length==0),o(),s("ngIf",e.paymentTypes.length>0),o(),s("ngIf",e.paymentTypes.length>0)}}var di=(()=>{class i{paymentController;loading=!1;paymentTypes;invoiceList;viewType="invoices";constructor(e){this.paymentController=e,this.loading=!0,this.paymentController.getActivatedPaymentTypes().subscribe(t=>{this.paymentTypes=t.filter(n=>n.type=="INVOICE"),this.loading=!1})}static \u0275fac=function(t){return new(t||i)(h(We))};static \u0275cmp=w({type:i,selectors:[["app-invoice-dash-board"]],viewQuery:function(t,n){if(t&1&&N(Ds,5),t&2){let c;L(c=j())&&(n.invoiceList=c.first)}},decls:7,vars:2,consts:[["invoicelist",""],["label","Invoices"],[4,"ngIf"],["label","Bank Reconciliation"],[1,"fa","fa-spin","fa-spinner"],["class","content nomethods",4,"ngIf"],["class","content",4,"ngIf"],[1,"content","nomethods"],[1,"fa-sharp","fa-light","fa-face-thinking"],[1,"content"]],template:function(t,n){t&1&&(a(0,"mat-tab-group")(1,"mat-tab",1),_(2,"br"),f(3,Ps,2,0,"div",2)(4,As,4,3,"div",2),r(),a(5,"mat-tab",3),_(6,"app-invoice-payment-list"),r()()),t&2&&(o(3),s("ngIf",n.loading),o(),s("ngIf",!n.loading))},styles:[".content[_ngcontent-%COMP%]{background-color:#fff;padding:20px;margin-top:20px}.nomethods[_ngcontent-%COMP%]{text-align:center}.nomethods[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]{font-size:40px;margin:20px;display:block}"]})}return i})();function Os(i,p){if(i&1){let e=S();a(0,"div",4)(1,"mat-form-field",5)(2,"mat-label"),l(3,"Account id"),r(),a(4,"input",6),Ie("ngModelChange",function(n){y(e);let c=d();return Se(c.accountId,n)||(c.accountId=n),b(n)}),C("keyup.enter",function(){y(e);let n=d();return b(n.loadAccount())}),r()()()}if(i&2){let e=d();o(4),we("ngModel",e.accountId)}}function Fs(i,p){if(i&1){let e=S();a(0,"div",9),C("click",function(){let n=y(e).$implicit,c=d(3);return b(c.selectEntry(n))}),l(1),r()}if(i&2){let e=p.$implicit;o(),m(" ",e.product.defaultName," ")}}function Vs(i,p){if(i&1&&(a(0,"div"),f(1,Fs,2,1,"div",8),r()),i&2){let e=d(2);o(),s("ngForOf",e.account.entries)}}function Bs(i,p){if(i&1&&(a(0,"div",4),f(1,Vs,2,1,"div",7),r()),i&2){let e=d();o(),s("ngIf",e.account)}}function Rs(i,p){if(i&1){let e=S();a(0,"div",9),C("click",function(){let n=y(e).$implicit,c=d(2);return b(c.selectAccountUnit(n))}),l(1),r()}if(i&2){let e=p.$implicit,t=d(2);o(),On(" ",e.accountingDate," - ",e.count," x ",e.unitPriceIncTaxes," - ",t.getHistoryTotal(e)," ")}}function Ns(i,p){if(i&1&&(a(0,"div",4),f(1,Rs,2,4,"div",8),r()),i&2){let e=d();o(),s("ngForOf",e.entry.units)}}function Ls(i,p){if(i&1&&(a(0,"div",15)(1,"div"),l(2),u(3,"date"),r()()),i&2){let e=p.$implicit,t=d(2);o(2),dt(" ",F(3,3,e.accountingDate,"shortDate")," | ",t.unit.count," x ",e.changedExTax," ")}}function js(i,p){if(i&1){let e=S();a(0,"div",4),l(1," Histories: "),f(2,Ls,4,6,"div",10),a(3,"mat-form-field")(4,"mat-label"),l(5,"Choose a date"),r(),a(6,"input",11),Ie("ngModelChange",function(n){y(e);let c=d();return Se(c.date,n)||(c.date=n),b(n)}),r(),a(7,"mat-hint"),l(8,"MM/DD/YYYY"),r(),_(9,"mat-datepicker-toggle",12)(10,"mat-datepicker",null,0),r(),a(12,"mat-form-field",5)(13,"mat-label"),l(14,"Amount (ex tax)"),r(),a(15,"input",13),Ie("ngModelChange",function(n){y(e);let c=d();return Se(c.amount,n)||(c.amount=n),b(n)}),r()(),a(16,"button",14),C("click",function(){y(e);let n=d();return b(n.saveHistory())}),l(17," Add entry "),r()()}if(i&2){let e=fe(11),t=d();o(2),s("ngForOf",t.unit.history),o(4),s("matDatepicker",e),we("ngModel",t.date),o(3),s("for",e),o(6),we("ngModel",t.amount)}}var Ho=(()=>{class i{accountController;accountId;date;amount;stage="enteraccount";account;entry;unit;constructor(e){this.accountController=e}loadAccount(){this.stage="selectentry",this.accountController.getAccount(this.accountId).subscribe(e=>{this.account=e,this.entry&&(this.entry=this.account.entries.filter(t=>t.accountEntryId==this.entry.accountEntryId)[0]),this.unit&&(this.unit=this.entry.units.filter(t=>t.accountUnitId==this.unit.accountUnitId)[0],this.stage="dateandamount")})}selectEntry(e){this.entry=e,this.stage="selectaccountunit"}selectAccountUnit(e){this.unit=e,this.stage="dateandamount"}getHistoryTotal(e){let t=0;for(let n of e.history)t+=n.changedExTax*e.count;return t}saveHistory(){this.accountController.registerAccounitUnitHistoryManually(this.account.id,this.unit.accountUnitId,this.date,this.amount).subscribe(e=>{alert("Done, check end of day report to see if really was posted..."),this.loadAccount()})}static \u0275fac=function(t){return new(t||i)(h(Ae))};static \u0275cmp=w({type:i,selectors:[["app-edit-account-unit-history"]],decls:8,vars:4,consts:[["picker",""],["mat-dialog-title",""],["mat-dialog-content",""],["class","actionarea",4,"ngIf"],[1,"actionarea"],[1,"example-full-width"],["matInput","","placeholder","","value","",3,"ngModelChange","keyup.enter","ngModel"],[4,"ngIf"],["style","padding: 5px; cursor: pointer;",3,"click",4,"ngFor","ngForOf"],[2,"padding","5px","cursor","pointer",3,"click"],["style","padding: 5px;",4,"ngFor","ngForOf"],["matInput","",3,"ngModelChange","matDatepicker","ngModel"],["matIconSuffix","",3,"for"],["matInput","","placeholder","","value","",3,"ngModelChange","ngModel"],["mat-flat-button","",3,"click"],[2,"padding","5px"]],template:function(t,n){t&1&&(a(0,"h1",1),l(1,` Edit account unit history
`),r(),a(2,"div",2),l(3," Note, this function should very realy be used, and only in cases where you need to correct an account unit that has been incorrectly created for some reason. "),f(4,Os,5,1,"div",3)(5,Bs,2,1,"div",3)(6,Ns,2,1,"div",3)(7,js,18,5,"div",3),r()),t&2&&(o(4),s("ngIf",n.stage=="enteraccount"),o(),s("ngIf",n.stage=="selectentry"),o(),s("ngIf",n.stage=="selectaccountunit"),o(),s("ngIf",n.stage=="dateandamount"))},dependencies:[T,M,be,K,B,H,Li,rt,G,yi,bi,at,U,V,et,O,ue],styles:[".actionarea[_ngcontent-%COMP%]{padding:20px}"]})}return i})();var wt=(()=>{class i{httpService;urlService;closeperiode(){return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/accountingcontroller2/closeperiode")}constructor(e,t){this.httpService=e,this.urlService=t}correctLedger(e,t,n){let c=[];c.push({name:"ledgerId",value:e}),c.push({name:"accountId",value:t}),c.push({name:"accountUnitId",value:n});let g=new $;for(let x of c)g=g.append(x.name,x.value);return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/accountingcontroller2/correctLedger",{params:g})}creditLedger(e){let t=[];t.push({name:"ledgerId",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/accountingcontroller2/creditLedger",{params:n})}doMigrationToNewReport(){return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/accountingcontroller2/doMigrationToNewReport")}getAccountReport(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/accountingcontroller2/accountreport",e,{headers:t})}getAccountingAccountReport(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/accountingcontroller2/accountingaccountreport",e,{headers:t})}getAllRecordsForAccount(e){let t=[];t.push({name:"accountId",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/accountingcontroller2/getAllRecordsForAccount",{params:n})}getDaysToTransfer(){return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/accountingcontroller2/getbatchtotransfer")}getLedgers(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/accountingcontroller2/getLedgers",e,{headers:t})}getMissingMappings(){return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/accountingcontroller2/getMissingMappings")}getOpenLedgers(e,t){let n=[];n.push({name:"typeId",value:e});let c=new $;for(let x of n)c=c.append(x.name,x.value);let g=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/accountingcontroller2/openLedgers",t,{headers:g,params:c})}getTransferredBatches(){return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/accountingcontroller2/getTransferredBatches")}markAsTransferred(e,t){let n=[];n.push({name:"start",value:e.toString()}),n.push({name:"end",value:t.toString()});let c=new $;for(let g of n)c=c.append(g.name,g.value);return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/accountingcontroller2/markAsTransferred",{params:c})}undoBatch(e){let t=[];t.push({name:"batchid",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/accountingcontroller2/undoBatch",{params:n})}undoTransferredToAccounting(){return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/accountingcontroller2/undoTransferredToAccounting")}uploadRemaning(){return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/accountingcontroller2/uploadremaning")}static \u0275fac=function(t){return new(t||i)(Y(_e),Y(ve))};static \u0275prov=re({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();var De=(()=>{class i{httpService;urlService;changeValueOfGroupRecord(e,t,n){let c=[];c.push({name:"groupRecordId",value:e}),t!=null&&c.push({name:"value",value:t.toString()}),c.push({name:"incTax",value:n.toString()});let g=new $;for(let x of c)g=g.append(x.name,x.value);return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/accountingcontroller/changeValueOfGroupRecord",{params:g})}cleanUpAccountMappings(){return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/accountingcontroller/cleanUpAccountMappings")}constructor(e,t){this.httpService=e,this.urlService=t}deleteAccount(e){let t=[];t.push({name:"accountId",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.delete(this.urlService.getBackendUrl()+"/commerce/accountingcontroller/account",{params:n})}getAccountingDay(e){let t=[];t.push({name:"dayId",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/accountingcontroller/accountingday",{params:n})}getAccountintDays(e,t){let n=[];n.push({name:"start",value:e.toString()}),n.push({name:"end",value:t.toString()});let c=new $;for(let g of n)c=c.append(g.name,g.value);return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/accountingcontroller/accountingdays",{params:c})}getAccounts(){return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/accountingcontroller/accounts")}getAllDepartmentMappings(){return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/accountingcontroller/departmentmappings")}getAllMappings(){return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/accountingcontroller/accountmappings")}getEntriesForAccount(e){let t=[];t.push({name:"accountId",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/accountingcontroller/account_entries",{params:n})}getOpenEntries(e){let t=[];t.push({name:"id",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/accountingcontroller/open_entries",{params:n})}resetAccountingDay(e){let t=[];t.push({name:"dayId",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/accountingcontroller/reset_day",{params:n})}resyncAccountRevenueWithAccounting(e){let t=[];t.push({name:"accountId",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/accountingcontroller/resyncAccountRevenueWithAccounting",{params:n})}saveAccount(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/accountingcontroller/account",e,{headers:t})}saveDepartmentMapping(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/accountingcontroller/departmentmapping",e,{headers:t})}saveOtherMapping(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/accountingcontroller/othermapping",e,{headers:t})}savePaymentTypeMapping(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/accountingcontroller/paymenttypemapping",e,{headers:t})}saveProductMapping(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/accountingcontroller/productmapping",e,{headers:t})}saveTaxMapping(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/accountingcontroller/taxmapping",e,{headers:t})}static \u0275fac=function(t){return new(t||i)(Y(_e),Y(ve))};static \u0275prov=re({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();var Us=["receipts"],Hs=["accountoverview"];function $s(i,p){i&1&&_(0,"i",5)}function Gs(i,p){i&1&&(a(0,"mat-tab-group")(1,"mat-tab",6),_(2,"app-guest-account-overview",null,0),r(),a(4,"mat-tab",7),_(5,"app-account-receipts-overview",null,1),r(),a(7,"mat-tab",8),_(8,"app-account-trace-summary"),r()())}var Nt=(()=>{class i{accountController;receiptController;accountingController2;accountingController;accountId;account;ledgers;loaded=!1;accounts;receipts;receiptsComponent;accountoverview;constructor(e,t,n,c){this.accountController=e,this.receiptController=t,this.accountingController2=n,this.accountingController=c}ngOnInit(){setTimeout(()=>this.load(),0)}load(){this.loaded=!1,Qe([this.accountController.getAccount(this.accountId),this.accountingController.getAccounts(),this.receiptController.getReceipts(this.accountId),this.accountingController2.getAllRecordsForAccount(this.accountId)]).subscribe(e=>{this.account=e[0],this.accounts=e[1],this.receipts=e[2],this.ledgers=e[3],this.loaded=!0})}static \u0275fac=function(t){return new(t||i)(h(Ae),h(Je),h(wt),h(De))};static \u0275cmp=w({type:i,selectors:[["app-account-trace-accounting"]],viewQuery:function(t,n){if(t&1&&(N(Us,5),N(Hs,5)),t&2){let c;L(c=j())&&(n.receiptsComponent=c.first),L(c=j())&&(n.accountoverview=c.first)}},decls:3,vars:2,consts:[["accountoverview",""],["receipts",""],[2,"min-width","1024px"],["class","fa fa-spin fa-spinner",4,"ngIf"],[4,"ngIf"],[1,"fa","fa-spin","fa-spinner"],["label","Guest Account Overview"],["label","Receipts"],["label","Summary"]],template:function(t,n){t&1&&(a(0,"mat-dialog-content",2),f(1,$s,1,0,"i",3)(2,Gs,9,0,"mat-tab-group",4),r()),t&2&&(o(),s("ngIf",!n.loaded),o(),s("ngIf",n.loaded))}})}return i})();function Qs(i,p){i&1&&(a(0,"div"),_(1,"i",4),r())}function zs(i,p){if(i&1&&_(0,"app-excel-view",5),i&2){let e=d();s("data",e.data)}}var $o=(()=>{class i{accountingController;receiptController;dialog;userService;paymentController;accountId="";formControl=new Ee;data;loading;constructor(e,t,n,c,g){this.accountingController=e,this.receiptController=t,this.dialog=n,this.userService=c,this.paymentController=g}isSupport(){return this.userService.getUserObject()!=null&&this.userService.getUserObject().email.indexOf("yalidian.com")>-1}loadData(){this.data=null,this.accountingController.getEntriesForAccount(this.formControl.value).subscribe(e=>{this.data=e,this.loading=!1})}search(){let e=this.dialog.open(Nt);e.componentInstance.accountId=this.formControl.value}resyncReceipt(){if(!confirm("Be 100% sure that the receipt has not been accounted for before you run this function!"))return;let t=prompt("paymentid");t&&this.receiptController.reSyncReceiptWithAccounting(t).subscribe(n=>{alert("done"),this.loadData()})}resyncPayment(){let e=prompt("paymentid");e&&this.paymentController.resyncPayment(e).subscribe(t=>{alert("done"),this.loadData()})}editAccountUnitHistory(){let e=this.dialog.open(Ho)}resyncAccount(){}static \u0275fac=function(t){return new(t||i)(h(De),h(Je),h(q),h(Ze),h(We))};static \u0275cmp=w({type:i,selectors:[["app-trace-account-accounting-dialog"]],decls:6,vars:3,consts:[[1,"example-full-width"],["matInput","","placeholder","","value","",3,"keyup.enter","formControl"],[4,"ngIf"],[3,"data",4,"ngIf"],[1,"fa","fa-spin","fa-spinner"],[3,"data"]],template:function(t,n){t&1&&(a(0,"mat-form-field",0)(1,"mat-label"),l(2,"Account Id"),r(),a(3,"input",1),C("keyup.enter",function(){return n.search()}),r()(),f(4,Qs,2,0,"div",2)(5,zs,1,1,"app-excel-view",3)),t&2&&(o(3),s("formControl",n.formControl),o(),s("ngIf",n.loading),o(),s("ngIf",n.data))},dependencies:[M,B,H,G,U,V,le,Hi]})}return i})();var tn=(()=>{class i{httpService;urlService;PrinterMessage(){return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/printercontroller/printermessage")}constructor(e,t){this.httpService=e,this.urlService=t}getPrinters(){return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/printercontroller/printers")}print(e,t){let n=[];n.push({name:"printerid",value:e}),n.push({name:"receiptId",value:t});let c=new $;for(let g of n)c=c.append(g.name,g.value);return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/printercontroller/print",null,{params:c})}savePrinter(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/printercontroller/save",e,{headers:t})}static \u0275fac=function(t){return new(t||i)(Y(_e),Y(ve))};static \u0275prov=re({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();function Ws(i,p){if(i&1){let e=S();a(0,"div")(1,"i",2),C("click",function(){let n=y(e).$implicit,c=d();return b(c.editPrinter(n))}),r(),l(2),r()}if(i&2){let e=p.$implicit;o(2),dt(" ",e.name," - ",e.ip,":",e.port,`
`)}}var qo=(()=>{class i{printController;printers;constructor(e){this.printController=e,this.loadAll()}print(){this.printController.print("a","b").subscribe(e=>{})}loadAll(){this.printController.getPrinters().subscribe(e=>{this.printers=e})}createPrinter(){let e=prompt("name"),t=prompt("ip"),n=prompt("port");if(e&&t&&n){let c={};c.name=e,c.ip=t,c.port=parseInt(n),this.printController.savePrinter(c).subscribe(g=>{this.loadAll()})}}editPrinter(e){let t=prompt("name",e.name),n=prompt("ip",e.ip),c=prompt("port",""+e.port);t&&n&&c&&(e.name=t,e.ip=n,e.port=parseInt(c),this.printController.savePrinter(e).subscribe(g=>{this.loadAll()}))}static \u0275fac=function(t){return new(t||i)(h(tn))};static \u0275cmp=w({type:i,selectors:[["app-printer-list"]],decls:5,vars:1,consts:[[4,"ngFor","ngForOf"],["mat-flat-button","","color","primary",3,"click"],[1,"fa","fa-edit",3,"click"]],template:function(t,n){t&1&&(a(0,"h1"),l(1,"Printers"),r(),f(2,Ws,3,3,"div",0),a(3,"button",1),C("click",function(){return n.createPrinter()}),l(4,` + Add printer
`),r()),t&2&&(o(2),s("ngForOf",n.printers))},dependencies:[T,O]})}return i})();var Ks=[{path:"",component:Io,children:[{path:"",component:Eo},{path:"invoice",component:di},{path:"settings",component:Xi},{path:"settings/printers",component:qo},{path:"categories",component:Do},{path:"product/:id",component:_i},{path:"list/:id",component:Oo},{path:"payment/:id",component:jo},{path:"trace",component:$o},{path:"attributesets",component:Vo},{path:"companies",component:Ro},{path:"private",component:No},{path:"orders",component:Lo}]}],Qo=(()=>{class i{static \u0275fac=function(t){return new(t||i)};static \u0275mod=Xt({type:i});static \u0275inj=Kt({imports:[_n.forChild(Ks),_n]})}return i})();var Xs=["longdesc"];function Ys(i,p){if(i&1&&(a(0,"mat-option",11),l(1),r()),i&2){let e=p.$implicit;s("value",e),o(),m(" ",e," ")}}function Js(i,p){if(i&1&&(a(0,"mat-form-field",4)(1,"mat-label"),l(2),u(3,"translate"),r(),a(4,"mat-select",9),f(5,Ys,2,2,"mat-option",10),r()()),i&2){let e=d();o(2),I(v(3,2,"commerce.productview.description.3")),o(3),s("ngForOf",e.templates)}}function Zs(i,p){if(i&1){let e=S();a(0,"div",12)(1,"div",13)(2,"span",14)(3,"i",15),C("click",function(){y(e);let n=d();return b(n.pickCompany())}),r(),l(4),u(5,"translate"),r(),a(6,"span",16),l(7),r()()()}if(i&2){let e=d();o(4),m(" ",v(5,2,"commerce.productview.description.8")," "),o(3),m(" ",e.getSupplierName()," ")}}var zo=(()=>{class i{dialog;companyController;product;templates=["default","saas-software"];supplier;set setProduct(e){this.product=e,this.populateControls(),this.loadOthers()}productView;desc;selectedLocale="";formGroup=new Me({name:new R(""),template:new R(""),shortDescription:new R(""),description:new R("")},{updateOn:"blur"});set setLocale(e){this.selectedLocale=e,this.populateControls()}constructor(e,t){this.dialog=e,this.companyController=t}ngOnInit(){this.formGroup.valueChanges.subscribe(e=>{this.update(e)})}quillchanged(e){}update(e){var t=this.product.productDescription[this.selectedLocale];t==null&&(t={}),t.name=e.name,t.shortDescription=e.shortDescription,t.description=e.description,this.product.template=e.templateControl,this.product.productDescription[this.selectedLocale]=t,this.productView.save()}populateControls(){if(this.product&&this.selectedLocale!=null){var e=this.product.productDescription[this.selectedLocale],t={template:this.product.template};t.template||(t.template="default"),e&&(t.name=e.name,t.shortDescription=e.shortDescription,t.description=e.description),this.formGroup.patchValue(t)}}getSupplierName(){return this.supplier?this.supplier.name:""}pickCompany(){var e={};e.singleSelect=!0;var t=this.dialog.open(Si,{data:e});t.afterClosed().subscribe(n=>{n&&(this.supplier=n,this.product.supplierId=n.id,this.productView.save())})}loadOthers(){this.product.supplierId&&this.companyController.getById(this.product.supplierId).subscribe(e=>{this.supplier=e})}static \u0275fac=function(t){return new(t||i)(h(q),h(pt))};static \u0275cmp=w({type:i,selectors:[["app-description"]],viewQuery:function(t,n){if(t&1&&N(Xs,5),t&2){let c;L(c=j())&&(n.desc=c.first)}},inputs:{setProduct:[0,"product","setProduct"],productView:[0,"productview","productView"],setLocale:[0,"selectedLocale","setLocale"]},decls:19,vars:12,consts:[[1,"box-header"],[1,"grid"],[1,"example-form",3,"formGroup"],["class","full-width","appearance","fill",4,"ngIf"],["appearance","fill",1,"full-width"],["matInput","","placeholder","","value","","formControlName","name"],["matInput","","placeholder","","formControlName","shortDescription"],["formControlName","description"],["class","other",4,"ngIf"],["formControlName","template"],[3,"value",4,"ngFor","ngForOf"],[3,"value"],[1,"other"],[1,"other_row","last_row"],[1,"col","col1"],[1,"fal","fa-edit",3,"click"],[1,"col","col2"]],template:function(t,n){t&1&&(a(0,"div",0),l(1),u(2,"translate"),r(),a(3,"div",1)(4,"div")(5,"form",2),f(6,Js,6,4,"mat-form-field",3),a(7,"mat-form-field",4)(8,"mat-label"),l(9),u(10,"translate"),r(),_(11,"input",5),r(),a(12,"mat-form-field",4)(13,"mat-label"),l(14),u(15,"translate"),r(),_(16,"textarea",6),r(),_(17,"quill-editor",7),r()(),f(18,Zs,8,4,"div",8),r()),t&2&&(o(),I(v(2,6,"commerce.productview.description.6")),o(4),s("formGroup",n.formGroup),o(),s("ngIf",n.productView.isType("commerce")),o(3),I(v(10,8,"commerce.productview.description.1")),o(5),I(v(15,10,"commerce.productview.description.2")),o(4),s("ngIf",n.productView.isType("commerce")))},dependencies:[T,M,B,H,G,ri,ti,Ce,U,V,ae,xe,ye,ji,E],styles:[".example-form[_ngcontent-%COMP%]{min-width:150px;width:100%}.full-width[_ngcontent-%COMP%]{width:100%}.box-header[_ngcontent-%COMP%]{text-align:center;font-weight:500;font-size:20px;padding-bottom:15px;margin-bottom:15px}.grid[_ngcontent-%COMP%]{display:flex;gap:20px}.grid[_ngcontent-%COMP%]   .other[_ngcontent-%COMP%]{flex:0 1 200px;border-left:solid 1px #DDD;padding-left:20px}.other_row[_ngcontent-%COMP%]{border-bottom:solid 1px #DDD;padding-bottom:10px;padding-top:10px}.other_row[_ngcontent-%COMP%]   .col1[_ngcontent-%COMP%]{display:inline-block;width:100px}div.other_row.last_row[_ngcontent-%COMP%]{border-bottom:solid 1px transparent!important}"]})}return i})();var ep=i=>({optionName:i});function tp(i,p){i&1&&(a(0,"div"),l(1,` Bundled products TO BE Done
`),r())}function ip(i,p){i&1&&(a(0,"div")(1,"div",3),l(2),u(3,"translate"),r(),a(4,"mat-form-field",4)(5,"mat-label"),l(6),u(7,"translate"),r(),_(8,"input",5),r()()),i&2&&(o(2),m(" ",v(3,2,"commerce.product.price.1")," "),o(4),I(v(7,4,"commerce.product.price.2")))}function np(i,p){if(i&1&&(a(0,"div")(1,"mat-form-field",4)(2,"mat-label"),l(3),r(),_(4,"input",9),r()()),i&2){let e=p.$implicit,t=d().$implicit,n=d(2);o(3),I(e.name[n.selectedLocale]),o(),s("formControlName","option_"+t.id+"_"+e.id)}}function op(i,p){if(i&1&&(a(0,"div"),f(1,np,5,2,"div",8),r()),i&2){let e=p.$implicit;o(),s("ngForOf",e.attributes)}}function rp(i,p){if(i&1&&(a(0,"div",6)(1,"div",7),l(2),u(3,"translate"),r(),f(4,op,2,1,"div",8),r()),i&2){let e=p.$implicit,t=d();o(2),m(" ",F(3,2,"commerce.product.price.3",nt(5,ep,e.displayNames[t.selectedLocale]))," "),o(2),s("ngForOf",t.product.options)}}var Wo=(()=>{class i{product;productView;set setProduct(e){this.product=e,this.product.options.forEach(t=>{t.attributes.forEach(n=>{this.formGroup.addControl("option_"+t.id+"_"+n.id,new R)})}),this.patchValues(),this.formGroup.valueChanges.subscribe(t=>{this.savePrices(t)})}selectedLocale="";formGroup=new Me({defaultPrice:new R("")},{updateOn:"blur"});constructor(){}ngOnInit(){}savePrices(e){this.product.defaultPrice&&(this.product.defaultPrice={}),this.product.defaultPrice&&(this.product.defaultPrice.optionPrices={}),this.product.options.forEach(t=>{var n={};n.optionId=t.id,n.prices={},t.attributes.forEach(c=>{var g={};g.price=e["option_"+t.id+"_"+c.id],n.prices[c.id]=g}),this.product.defaultPrice.optionPrices[t.id]=n}),this.product.defaultPrice.unitPriceExTax=e.defaultPrice,this.productView.save()}patchValues(){if(this.product.defaultPrice){var e={defaultPrice:this.product.defaultPrice.unitPriceExTax};for(var t in this.product.defaultPrice.optionPrices)for(var n in this.product.defaultPrice.optionPrices[t].prices)e["option_"+t+"_"+n]=this.product.defaultPrice.optionPrices[t].prices[n].price;this.formGroup.patchValue(e)}}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=w({type:i,selectors:[["app-prices"]],inputs:{productView:[0,"productview","productView"],setProduct:[0,"product","setProduct"],selectedLocale:"selectedLocale"},decls:4,vars:4,consts:[[4,"ngIf"],[3,"formGroup"],["class","optionbox",4,"ngFor","ngForOf"],[1,"box-header"],["appearance","fill",1,"full-width"],["matInput","","placeholder","","value","","type","number","formControlName","defaultPrice"],[1,"optionbox"],[1,"box-header","small"],[4,"ngFor","ngForOf"],["matInput","","placeholder","","value","","type","number",3,"formControlName"]],template:function(t,n){t&1&&(f(0,tp,2,0,"div",0),a(1,"form",1),f(2,ip,9,6,"div",0)(3,rp,5,7,"div",2),r()),t&2&&(s("ngIf",n.product.bundledProducts&&n.product.bundledProducts.length>0),o(),s("formGroup",n.formGroup),o(),s("ngIf",!n.product.bundledProducts||n.product.bundledProducts.length==0),o(),s("ngForOf",n.product.options))},dependencies:[T,M,B,H,G,Ce,U,jn,V,ae,xe,ye,E],styles:[".full-width[_ngcontent-%COMP%]{width:100%}.box-header[_ngcontent-%COMP%]{text-align:center;font-weight:500;font-size:20px;padding-bottom:15px;margin-bottom:15px}.box-header.small[_ngcontent-%COMP%]{font-size:18px}.optionbox[_ngcontent-%COMP%]{margin-top:20px}"]})}return i})();var Ko=(()=>{class i{settingsController;taxes=new Map;constructor(e){this.settingsController=e}getTaxes(e){var t=this.taxes.get(e);return t}fetchTaxes(e){this.taxes.has(e)||this.settingsController.getTaxes(e).subscribe(t=>{this.taxes.set(e,t)})}static \u0275fac=function(t){return new(t||i)(Y(gt))};static \u0275prov=re({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();function cp(i,p){i&1&&(a(0,"div",4),_(1,"i",5),l(2),u(3,"translate"),r()),i&2&&(o(2),m(" ",v(3,1,"commerce.productview.taxes.3"),`
`))}function lp(i,p){if(i&1&&(a(0,"div",15)(1,"span",16),l(2),r(),l(3),u(4,"date"),u(5,"date"),r()),i&2){let e=p.$implicit;o(2),m("",e.percent,"% "),o(),ge(" between ",v(4,3,e.from)," to ",e.end?v(5,5,e.end):"infitity"," ")}}function sp(i,p){if(i&1&&(a(0,"div",11)(1,"mat-radio-button",12)(2,"div",13),l(3),r(),f(4,lp,6,7,"div",14),r()()),i&2){let e=p.$implicit;o(),s("value",e.category),o(2),ge("",e.category," - ",e.description,""),o(),s("ngForOf",e.periodes)}}function pp(i,p){i&1&&(a(0,"div",17),_(1,"i",18),l(2),u(3,"translate"),r()),i&2&&(o(2),m(" ",v(3,1,"commerce.productview.taxes.5")," "))}function dp(i,p){if(i&1&&(a(0,"div")(1,"mat-radio-group",6),f(2,sp,5,4,"div",7),r(),a(3,"div",8)(4,"mat-slide-toggle",9),l(5),u(6,"translate"),r(),f(7,pp,4,3,"div",10),r()()),i&2){let e=d();o(),s("formControl",e.taxFormControl),o(),s("ngForOf",e.taxesService.getTaxes(e.selectedLocale)),o(2),s("formControl",e.lockTaxes),o(),m(" ",v(6,5,"commerce.productview.taxes.4")," "),o(2),s("ngIf",!e.product.lockTaxes)}}var Xo=(()=>{class i{taxesService;taxFormControl=new R;lockTaxes=new R;_product;productView;get product(){return this._product}set setProduct(e){this._product=e,this.taxesService.getTaxes("no"),this._product.taxCategories&&(this.taxFormControl.patchValue(this._product.taxCategories[0]),this.lockTaxes.patchValue(this._product.lockTaxes))}selectedLocale="";constructor(e){this.taxesService=e,this.lockTaxes.valueChanges.subscribe(t=>{this._product.lockTaxes=t,this.productView.save()}),this.taxFormControl.valueChanges.subscribe(t=>{this._product.taxCategories=[],this._product.taxCategories.push(t),this.productView.save()})}ngOnInit(){this.taxesService.fetchTaxes(this.selectedLocale)}static \u0275fac=function(t){return new(t||i)(h(Ko))};static \u0275cmp=w({type:i,selectors:[["app-taxes"]],inputs:{productView:[0,"productview","productView"],setProduct:[0,"product","setProduct"],selectedLocale:"selectedLocale"},decls:8,vars:8,consts:[[1,"title"],[1,"taxinfo"],["class","bundledproducts",4,"ngIf"],[4,"ngIf"],[1,"bundledproducts"],[1,"fa","fa-warning"],["aria-label","Select an option",3,"formControl"],["class","taxrow",4,"ngFor","ngForOf"],[1,"locktaxes"],[3,"formControl"],["class","desc",4,"ngIf"],[1,"taxrow"],[3,"value"],[1,"taxdesc"],["class","subdesc",4,"ngFor","ngForOf"],[1,"subdesc"],[1,"taxrate"],[1,"desc"],[1,"fa","fa-information"]],template:function(t,n){t&1&&(a(0,"div",0),l(1),u(2,"translate"),r(),a(3,"div",1),l(4),u(5,"translate"),r(),f(6,cp,4,3,"div",2)(7,dp,8,7,"div",3)),t&2&&(o(),m(" ",v(2,4,"commerce.productview.taxes.1"),`
`),o(3),m(" ",v(5,6,"commerce.productview.taxes.2"),`
`),o(2),s("ngIf",n.product.bundledProducts&&n.product.bundledProducts.length>0),o(),s("ngIf",!n.product.bundledProducts||n.product.bundledProducts.length==0))},dependencies:[T,M,V,_o,vo,le,ni,E,ue],styles:[".title[_ngcontent-%COMP%]{text-align:center;font-weight:500;font-size:20px}.taxrow[_ngcontent-%COMP%]{margin-bottom:30px;margin-top:15px;border-bottom:solid 1px #DDD;padding-bottom:20px}div.taxrow[_ngcontent-%COMP%]:last-child{border-bottom:solid 0px}.taxdesc[_ngcontent-%COMP%]{padding-left:10px;padding-bottom:5px;margin-bottom:5px}.taxinfo[_ngcontent-%COMP%]{padding:10px}.subdesc[_ngcontent-%COMP%]{color:#888}.subdesc[_ngcontent-%COMP%]   span[_ngcontent-%COMP%]{display:inline-block;width:50px;margin-left:10px}.bundledproducts[_ngcontent-%COMP%]{padding:20px;background-color:#e1ffa8;margin:10px;text-align:center}.locktaxes[_ngcontent-%COMP%]{border-top:solid 1px #DDD;padding:10px}.locktaxes[_ngcontent-%COMP%]   .desc[_ngcontent-%COMP%]{font-style:italic;font-size:12px;padding-top:5px}"]})}return i})();function mp(i,p){if(i&1){let e=S();a(0,"div",4),C("click",function(){y(e);let n=d();return b(n.deleteLocale())}),_(1,"i",5),r()}}function up(i,p){if(i&1&&(a(0,"mat-option",6),l(1),r()),i&2){let e=p.$implicit;s("value",e.id),o(),m(" ",e.text," ")}}function fp(i,p){if(i&1&&(a(0,"mat-option",6),l(1),r()),i&2){let e=p.$implicit;s("value",e.id),o(),m(" ",e.text," ")}}var Yo=(()=>{class i{settingsController;availableLanguages=[{id:"no",text:"Norway"},{id:"us",text:"USA"},{id:"gb",text:"United Kingdom"}];langControl=new R("",[ce.required]);currencyControl=new R("",[ce.required]);availalbeCurrency=[{id:"NOK",text:"Norske Kroner"}];locale;settings;constructor(e){this.settingsController=e}ngOnInit(){this.langControl.patchValue(this.locale.lang),this.currencyControl.patchValue(this.locale.currency),this.langControl.valueChanges.subscribe(e=>{this.save()}),this.currencyControl.valueChanges.subscribe(e=>{this.save()})}deleteLocale(){this.settingsController.deleteLocale(this.locale.localeId).subscribe(e=>{this.settings.loadAllLocals()})}save(){this.locale.lang=this.langControl.value,this.locale.currency=this.currencyControl.value,this.settingsController.saveLocale(this.locale).subscribe(e=>{})}static \u0275fac=function(t){return new(t||i)(h(gt))};static \u0275cmp=w({type:i,selectors:[["app-locale"]],inputs:{locale:"locale",settings:"settings"},decls:15,vars:11,consts:[["class","delete",3,"click",4,"ngIf"],[1,"row_title"],[3,"formControl"],[3,"value",4,"ngFor","ngForOf"],[1,"delete",3,"click"],[1,"fa","fa-trash"],[3,"value"]],template:function(t,n){t&1&&(a(0,"div"),f(1,mp,2,0,"div",0),a(2,"span",1),l(3),u(4,"translate"),r(),a(5,"mat-form-field")(6,"mat-select",2),f(7,up,2,2,"mat-option",3),r()()(),a(8,"div")(9,"span",1),l(10),u(11,"translate"),r(),a(12,"mat-form-field")(13,"mat-select",2),f(14,fp,2,2,"mat-option",3),r()()()),t&2&&(o(),s("ngIf",n.locale.localeId>0),o(2),m(" ",v(4,7,"commerce.settings.3"),"\xA0"),o(3),s("formControl",n.langControl),o(),s("ngForOf",n.availableLanguages),o(3),m(" ",v(11,9,"commerce.settings.4"),"\xA0"),o(3),s("formControl",n.currencyControl),o(),s("ngForOf",n.availalbeCurrency))},dependencies:[T,M,B,ri,ti,V,le,E],styles:["[_nghost-%COMP%]{display:block;position:relative}.row_title[_ngcontent-%COMP%]{display:inline-block;width:200px}.delete[_ngcontent-%COMP%]{position:absolute;right:-30px;top:-30px;background-color:red;border-radius:5px;color:#fff;padding:10px;cursor:pointer}"]})}return i})();var Jo=(()=>{class i{settingsController;formControl=new R;constructor(e){this.settingsController=e}ngOnInit(){this.settingsController.getSettings().subscribe(e=>{this.formControl.patchValue(e.domains)}),this.formControl.valueChanges.subscribe(e=>{this.settingsController.saveDomain(e).subscribe(t=>{})})}static \u0275fac=function(t){return new(t||i)(h(gt))};static \u0275cmp=w({type:i,selectors:[["app-domain"]],decls:6,vars:4,consts:[[1,"row_title"],[1,"example-full-width"],["matInput","","placeholder","","value","",3,"formControl"]],template:function(t,n){t&1&&(a(0,"div")(1,"span",0),l(2),u(3,"translate"),r(),a(4,"mat-form-field",1),_(5,"input",2),r()()),t&2&&(o(2),m(" ",v(3,2,"commerce.settings.11"),"\xA0"),o(3),s("formControl",n.formControl))},dependencies:[B,G,U,V,le,E],styles:["[_nghost-%COMP%]{display:block;position:relative}.row_title[_ngcontent-%COMP%]{display:inline-block;width:200px}"]})}return i})();function gp(i,p){i&1&&(a(0,"span"),l(1),u(2,"translate"),r()),i&2&&(o(),m(" ",v(2,1,"commerce.productview.config.9")," "))}function _p(i,p){if(i&1){let e=S();a(0,"div")(1,"div",14)(2,"div",10)(3,"i",15),C("click",function(){let n=y(e).$implicit,c=d(2);return b(c.deleteAtributeSet(n))}),r()(),a(4,"div",16),C("click",function(){let n=y(e).$implicit,c=d(2);return b(c.selectAttribute(n))}),f(5,gp,3,3,"span",17),a(6,"span"),l(7),r()(),a(8,"div",18),C("click",function(){let n=y(e).$implicit,c=d(2);return b(c.selectAttribute(n))}),l(9),r()()()}if(i&2){let e=p.$implicit,t=d(2);o(5),s("ngIf",!e.name[t.selectedLocale]),o(2),m(" ",e.name," "),o(2),m(" ",e.displayNames[t.selectedLocale]," ")}}function vp(i,p){if(i&1&&(a(0,"div",8)(1,"div",9),_(2,"div",10),a(3,"div",11),l(4),u(5,"translate"),r(),a(6,"div",12),l(7),u(8,"translate"),r()(),f(9,_p,10,3,"div",13),r()),i&2){let e=d();o(4),m("",v(5,3,"commerce.productview.config.4")," "),o(3),m(" ",v(8,5,"commerce.productview.config.5")," "),o(2),s("ngForOf",e.product.options)}}var Zo=(()=>{class i{dialog;productController;attributeSetControll;selectedLocale;product;createOptionSetForm=new Me({name:new R("",[ce.required])});bundledProducts;attributeSets;set setLocale(e){this.selectedLocale=e}set setProduct(e){this.product=e}productView;ngOnInit(){}selectedAttribute;parentAttribute;constructor(e,t,n){this.dialog=e,this.productController=t,this.attributeSetControll=n}addAttribute(){var e={};e.id=oi(),e.displayNames={},e.attributes=[],e.name=this.createOptionSetForm.value.name,this.selectAttribute(e),this.createOptionSetForm.reset()}deleteAtributeSet(e){var t={};t.title="commerce.productview.config.7",t.message="commerce.productview.config.8";var n=this.dialog.open(Oe,{data:t});n.afterClosed().subscribe(c=>{c&&(this.product.options=this.product.options.filter(g=>g.id!=e.id),this.productView.save())})}selectAttribute(e){var t=this.dialog.open(Yi,{width:"95vw",maxWidth:"500px",data:e});t.componentInstance.setLocale(this.selectedLocale),t.afterClosed().subscribe(n=>{n&&(this.product.options=this.product.options.filter(c=>c.id!=t.componentInstance.currentAttributeSet.id),this.product.options.push(t.componentInstance.currentAttributeSet),this.productView.save())})}static \u0275fac=function(t){return new(t||i)(h(q),h(ke),h(ci))};static \u0275cmp=w({type:i,selectors:[["app-config"]],inputs:{setLocale:[0,"selectedLocale","setLocale"],setProduct:[0,"product","setProduct"],productView:[0,"productview","productView"]},decls:19,vars:15,consts:[[1,"title"],[1,"desc"],[3,"ngSubmit","formGroup"],["appearance","",1,"example-full-width"],["matInput","","placeholder","","value","","formControlName","name"],["mat-flat-button","","color","primary",3,"disabled"],[1,"fa","fa-plus"],["class","forignlang",4,"ngIf"],[1,"forignlang"],[1,"attributesetrow","header"],[1,"col","menu"],[1,"col","name"],[1,"col","originalname"],[4,"ngFor","ngForOf"],[1,"attributesetrow"],[1,"fa","fa-trash",3,"click"],[1,"col","name",3,"click"],[4,"ngIf"],[1,"col","originalname",3,"click"]],template:function(t,n){t&1&&(a(0,"div",0),l(1),u(2,"translate"),r(),a(3,"div",1),l(4),u(5,"translate"),r(),a(6,"div")(7,"form",2),C("ngSubmit",function(){return n.addAttribute()}),a(8,"mat-form-field",3)(9,"mat-label"),l(10),u(11,"translate"),r(),_(12,"input",4),r(),l(13," \xA0 "),a(14,"button",5),_(15,"i",6),l(16),u(17,"translate"),r()()(),f(18,vp,10,7,"div",7)),t&2&&(o(),m(" ",v(2,7,"commerce.productview.config.1"),`
`),o(3),m(" ",v(5,9,"commerce.productview.config.2"),`
`),o(3),s("formGroup",n.createOptionSetForm),o(3),I(v(11,11,"commerce.attributesets.2")),o(4),s("disabled",!n.createOptionSetForm.valid),o(2),m(" ",v(17,13,"commerce.productview.config.3"),""),o(2),s("ngIf",n.product.options&&n.product.options.length>0))},dependencies:[T,M,B,H,G,Ce,U,V,ae,xe,ye,O,E],styles:[".title[_ngcontent-%COMP%]{text-align:center;font-weight:500;font-size:20px}.desc[_ngcontent-%COMP%]{margin-bottom:15px}.attributesetrow.header[_ngcontent-%COMP%]{margin-top:10px}.attributesetrow.header[_ngcontent-%COMP%]   .col[_ngcontent-%COMP%]{border-bottom:solid 1px #DDD;height:40px}.attributesetrow[_ngcontent-%COMP%]   .col[_ngcontent-%COMP%]{display:inline-block;box-sizing:border-box;padding:10px;vertical-align:top;cursor:pointer}.attributesetrow[_ngcontent-%COMP%]   .col.menu[_ngcontent-%COMP%]{width:50px;text-align:center}.attributesetrow[_ngcontent-%COMP%]   .col.name[_ngcontent-%COMP%], .attributesetrow[_ngcontent-%COMP%]   .col.originalname[_ngcontent-%COMP%]{width:calc(100% - 50px)}.forignlang[_ngcontent-%COMP%]   .attributesetrow[_ngcontent-%COMP%]   .col.name[_ngcontent-%COMP%], .forignlang[_ngcontent-%COMP%]   .attributesetrow[_ngcontent-%COMP%]   .col.originalname[_ngcontent-%COMP%]{width:calc(50% - 25px)}.bundled_product_row[_ngcontent-%COMP%]{padding:10px 10px 0;border-top:solid 1px #DDD;margin-top:10px}div.bundled_product_row[_ngcontent-%COMP%]:first-child{border-top:solid 0px}.title[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]{float:right}"]})}return i})();var er=(()=>{class i{static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275mod=Xt({type:i})}static{this.\u0275inj=Kt({})}}return i})();var tr=(()=>{class i{static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275mod=Xt({type:i})}static{this.\u0275inj=Kt({imports:[er,vn,vn]})}}return i})();var ir=(()=>{class i{group=new Me({address:new R,address2:new R,postCode:new R,city:new R,phonePrefix:new R,phoneNumber:new R,email:new R});addr;set address(e){this.group.patchValue(e)}update(e){this.group.patchValue(e)}constructor(){}ngOnInit(){}get address(){return{address:this.group.value.address,address2:this.group.value.address2,postCode:this.group.value.postCode,city:this.group.value.city,phonePrefix:this.group.value.phonePrefix,phoneNumber:this.group.value.phoneNumber,email:this.group.value.email}}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=w({type:i,selectors:[["app-address"]],inputs:{address:"address"},decls:40,vars:22,consts:[[3,"formGroup"],[1,"row"],["appearance","fill",1,"field","col1"],["matInput","","placeholder","","value","","formControlName","address"],["appearance","fill",1,"field","col2"],["matInput","","placeholder","","value","","formControlName","address2"],["matInput","","placeholder","","value","","formControlName","postCode"],["matInput","","placeholder","","value","","formControlName","city"],["matInput","","placeholder","","value","","formControlName","phonePrefix"],["matInput","","placeholder","","value","","formControlName","phoneNumber"],["matInput","","placeholder","","value","","formControlName","email"]],template:function(t,n){t&1&&(a(0,"form",0)(1,"div",1)(2,"mat-form-field",2)(3,"mat-label"),l(4),u(5,"translate"),r(),_(6,"input",3),r(),a(7,"mat-form-field",4)(8,"mat-label"),l(9),u(10,"translate"),r(),_(11,"input",5),r()(),a(12,"div",1)(13,"mat-form-field",2)(14,"mat-label"),l(15),u(16,"translate"),r(),_(17,"input",6),r(),a(18,"mat-form-field",4)(19,"mat-label"),l(20),u(21,"translate"),r(),_(22,"input",7),r()(),a(23,"div",1)(24,"mat-form-field",2)(25,"mat-label"),l(26),u(27,"translate"),r(),_(28,"input",8),r(),a(29,"mat-form-field",4)(30,"mat-label"),l(31),u(32,"translate"),r(),_(33,"input",9),r()(),a(34,"div",1)(35,"mat-form-field",2)(36,"mat-label"),l(37),u(38,"translate"),r(),_(39,"input",10),r()()()),t&2&&(s("formGroup",n.group),o(4),I(v(5,8,"commerce.address.1")),o(5),I(v(10,10,"commerce.address.2")),o(6),I(v(16,12,"commerce.address.3")),o(5),I(v(21,14,"commerce.address.4")),o(6),I(v(27,16,"commerce.address.5")),o(5),I(v(32,18,"commerce.address.6")),o(6),I(v(38,20,"commerce.address.7")))},dependencies:[B,H,G,Ce,U,V,ae,xe,ye,E],styles:["[_nghost-%COMP%]{display:block;box-sizing:border-box}.row[_ngcontent-%COMP%]{display:flex;gap:20px}mat-form-field[_ngcontent-%COMP%]{flex:1 1 44%}"]})}return i})();function Dp(i,p){if(i&1&&(a(0,"div")(1,"mat-form-field",2)(2,"mat-label"),l(3),r(),_(4,"input",3),r()()),i&2){let e=p.$implicit,t=d();o(3),I(e.name[t.selectedLocale]),o(),s("formControlName",e.id)}}var nr=(()=>{class i{constructor(){}formGroup=new Me({},{updateOn:"blur"});attributeSet;productView;product;set setAttributeSet(e){this.attributeSet=e,this.attributeSet.attributes.forEach(t=>{var n=new R;this.formGroup.addControl(t.id,n)}),this.patchValues(),this.formGroup.valueChanges.subscribe(t=>{this.saveForm(t)})}patchValues(){var e={};if(this.product.attributeValues[this.attributeSet.id])for(var t in this.product.attributeValues[this.attributeSet.id].values)e[t]=this.product.attributeValues[this.attributeSet.id].values[t].value;this.formGroup.patchValue(e)}selectedLocale;ngOnInit(){}saveForm(e){var t={};t.attributeSetId=this.attributeSet.id,t.values={};for(let n in e)t.values[n]={},t.values[n].value=e[n];this.product.attributeValues[this.attributeSet.id]=t,this.productView.save(!1)}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=w({type:i,selectors:[["app-attribute-set-config"]],inputs:{productView:[0,"productview","productView"],product:"product",setAttributeSet:[0,"attributeset","setAttributeSet"],selectedLocale:"selectedLocale"},decls:2,vars:2,consts:[[3,"formGroup"],[4,"ngFor","ngForOf"],["appearance","fill",1,"example-full-width"],["matInput","","placeholder","","value","",3,"formControlName"]],template:function(t,n){t&1&&(a(0,"form",0),f(1,Dp,5,2,"div",1),r()),t&2&&(s("formGroup",n.formGroup),o(),s("ngForOf",n.attributeSet.attributes))},dependencies:[T,B,H,G,Ce,U,V,ae,xe,ye],styles:[".example-full-width[_ngcontent-%COMP%]{width:100%}"]})}return i})();var or=(()=>{class i{dialogRef;_rentalObject;constructor(e){this.dialogRef=e}set rentalObject(e){this._rentalObject=e,this.nameControl.patchValue(e.name)}nameControl=new Ee("",[ce.required]);save(){this._rentalObject.name=this.nameControl.value,this.dialogRef.close(!0)}static \u0275fac=function(t){return new(t||i)(h(te))};static \u0275cmp=w({type:i,selectors:[["app-edit-rental-object-dialog"]],decls:12,vars:9,consts:[[1,"example-full-width"],["matInput","","placeholder","","value","",3,"formControl"],[3,"align"],["mat-button","",3,"mat-dialog-close"],["mat-button","",3,"click"]],template:function(t,n){t&1&&(a(0,"mat-dialog-content")(1,"mat-form-field",0)(2,"mat-label"),l(3,"Name"),r(),_(4,"input",1),r()(),a(5,"mat-dialog-actions",2)(6,"button",3),l(7),u(8,"translate"),r(),a(9,"button",4),C("click",function(){return n.save()}),l(10),u(11,"translate"),r()()),t&2&&(o(4),s("formControl",n.nameControl),o(),s("align","end"),o(),s("mat-dialog-close",!1),o(),m(" ",v(8,5,"booking.groupview.edit_addon.2")," "),o(3),m(" ",v(11,7,"booking.groupview.edit_addon.3")," "))},dependencies:[de,oe,K,B,H,G,U,V,le,O,E]})}return i})();function Pp(i,p){if(i&1){let e=S();a(0,"div",9)(1,"i",10),C("click",function(){let n=y(e).$implicit,c=d(2);return b(c.editRentalObject(n))}),r(),a(2,"i",11),C("click",function(){let n=y(e).$implicit,c=d(2);return b(c.deleteRentalObject(n))}),r(),l(3),r()}if(i&2){let e=p.$implicit;o(3),m(" ",e.name," ")}}function Ep(i,p){if(i&1&&(a(0,"div",7),f(1,Pp,4,1,"div",8),r()),i&2){let e=d();o(),s("ngForOf",e.product.rentalObjects)}}var rr=(()=>{class i{dialog;bookingController;product;productView;set setProduct(e){this.product=e}selectedLocale="";formGroup=new Me({name:new R("",[ce.required])});constructor(e,t){this.dialog=e,this.bookingController=t}ngOnInit(){}createRoom(){var e={};e.id=oi(),e.name=this.formGroup.value.name,this.product.rentalObjects||(this.product.rentalObjects=[]),this.product.rentalObjects.push(e),this.productView.save()}editRentalObject(e){let t=this.dialog.open(or);t.componentInstance.rentalObject=e,t.afterClosed().subscribe(n=>{n&&this.productView.save()})}deleteRentalObject(e){let t=new ct("commerce.productview.rooms.5","commerce.productview.rooms.6");this.dialog.open(Oe,{data:t}).afterClosed().subscribe(c=>{c&&this.bookingController.deleteRentalObject(this.product.id,e.id).subscribe(g=>{this.product.rentalObjects=this.product.rentalObjects.filter(x=>x!=e),this.productView.save()})})}static \u0275fac=function(t){return new(t||i)(h(q),h(ft))};static \u0275cmp=w({type:i,selectors:[["app-rooms"]],inputs:{productView:[0,"productview","productView"],setProduct:[0,"product","setProduct"],selectedLocale:"selectedLocale"},decls:19,vars:15,consts:[[1,"box-header"],["class","",4,"ngIf"],[1,"createbox"],[3,"formGroup"],[1,"roomname"],["matInput","","placeholder","101","value","","formControlName","name"],["mat-flat-button","","color","primary",3,"click","disabled"],[1,""],["class","roomrow",4,"ngFor","ngForOf"],[1,"roomrow"],[1,"fa","fa-edit",3,"click"],[1,"fa","fa-trash",3,"click"]],template:function(t,n){t&1&&(a(0,"div",0),l(1),u(2,"translate"),r(),f(3,Ep,2,1,"div",1),a(4,"div",2)(5,"div")(6,"h3"),l(7),u(8,"translate"),r(),a(9,"form",3)(10,"mat-form-field",4)(11,"mat-label"),l(12),u(13,"translate"),r(),_(14,"input",5),r(),_(15,"br"),a(16,"button",6),C("click",function(){return n.createRoom()}),l(17),u(18,"translate"),r()()()()),t&2&&(o(),m(" ",v(2,7,"commerce.productview.rooms.4"),`
`),o(2),s("ngIf",n.product.rentalObjects.length),o(4),m(" ",v(8,9,"commerce.productview.rooms.2")," "),o(2),s("formGroup",n.formGroup),o(3),m(" ",v(13,11,"commerce.productview.rooms.1")," "),o(4),s("disabled",!n.formGroup.valid),o(),m(" ",v(18,13,"commerce.productview.rooms.3")," "))},dependencies:[T,M,B,H,G,Ce,U,V,ae,xe,ye,O,E],styles:[".box-header[_ngcontent-%COMP%]{text-align:center;font-weight:500;font-size:20px;padding-bottom:15px;margin-bottom:15px}.createbox[_ngcontent-%COMP%]{background-color:#efefef;text-align:center;padding:10px;margin-top:30px}.roomrow[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]{margin-right:10px}.roomrow[_ngcontent-%COMP%]{border-top:solid 1px #DDD;padding-top:10px;margin-top:10px}div.roomrow[_ngcontent-%COMP%]:first-child{border-top:solid 1px transparent}"]})}return i})();function Tp(i,p){if(i&1){let e=S();a(0,"div",2),C("click",function(){let n=y(e).$implicit,c=d();return b(c.edit(n))}),a(1,"div",3),_(2,"img",4),r(),a(3,"div",5),l(4),r()()}if(i&2){let e=p.$implicit,t=d();o(2),s("src","/assets/flags/4x3/"+t.getFlag(e.lang)+".svg",St),o(2),m(" ",e.shortDescription," ")}}var ar=(()=>{class i{dialog;productView;product;locales;set setProduct(e){this.product=e}constructor(e,t){this.dialog=e,this.productView=t}ngOnInit(){}getFlag(e){if(!this.locales)return"";var t=this.locales.filter(n=>n.localeId==e);return t[0]?t[0].lang:""}edit(e){var t=this.dialog.open(zi);t.componentInstance.contentId=e.name,t.componentInstance.product=this.product,t.componentInstance.selectedLocale=e.lang,t.componentInstance.description.setValue(e.description),t.componentInstance.formControl.setValue(e.shortDescription)}static \u0275fac=function(t){return new(t||i)(h(q),h(_i))};static \u0275cmp=w({type:i,selectors:[["app-extra-description-list"]],inputs:{locales:"locales",setProduct:[0,"product","setProduct"]},decls:4,vars:4,consts:[[1,"box-header"],["class","row",3,"click",4,"ngFor","ngForOf"],[1,"row",3,"click"],[1,"col","col1"],[1,"",3,"src"],[1,"col","col2"]],template:function(t,n){t&1&&(a(0,"div",0),l(1),u(2,"translate"),r(),f(3,Tp,5,2,"div",1)),t&2&&(o(),m(" ",v(2,2,"commerce.productview.extradescriptions.1"),`
`),o(2),s("ngForOf",n.product.extras))},dependencies:[T,E],styles:[".box-header[_ngcontent-%COMP%]{text-align:center;font-weight:500;font-size:20px;padding-bottom:15px;margin-bottom:15px}.col[_ngcontent-%COMP%]{display:inline-block;vertical-align:top}.col1[_ngcontent-%COMP%]   img[_ngcontent-%COMP%]{width:30px;margin-right:30px}.col2[_ngcontent-%COMP%]{line-height:30px}"]})}return i})();var Di=(()=>{class i{httpService;urlService;constructor(e,t){this.httpService=e,this.urlService=t}getAccountingReport(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/reportcontroller/accounting",e,{headers:t})}getAccountingReportRaw(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/reportcontroller/accountingraw",e,{headers:t})}getBankInvoiceTransferReport(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/reportcontroller/bankinvoicetransferreport",e,{headers:t})}getCoverageReport(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/reportcontroller/coverage",e,{headers:t})}getDayEntries(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/reportcontroller/dayentries",e,{headers:t})}getEconomyReport(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/reportcontroller/economy",e,{headers:t})}getEndOfDayReport(){return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/reportcontroller/endofday",null)}getOpenInvoices(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/reportcontroller/open_invoices",e,{headers:t})}getOpenPrePayments(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/reportcontroller/open_prepayments",e,{headers:t})}getRawCoverageReport(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/reportcontroller/coverageraw",e,{headers:t})}getRawEconomyReport(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/reportcontroller/economyraw",e,{headers:t})}getUnbilledRevenueReport(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/reportcontroller/unbilled_revenue",e,{headers:t})}static \u0275fac=function(t){return new(t||i)(Y(_e),Y(ve))};static \u0275prov=re({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();function kp(i,p){if(i&1&&(a(0,"div",2)(1,"div",3),l(2),r(),a(3,"div",4),l(4),r(),a(5,"div",5),l(6),r(),a(7,"div",6),l(8),u(9,"number"),r()()),i&2){let e=p.$implicit,t=d();o(2),m(" ",t.getReceptText(e.account)," "),o(2),m(" ",t.getStart(e.account)," "),o(2),m(" ",t.getEnd(e.account)," "),o(2),m(" ",v(9,4,e.amount)," ")}}var nn=(()=>{class i{datePipe;unbilledRevenue;constructor(e){this.datePipe=e}getStart(e){if(!e)return"deleted";let t=e.entries.filter(n=>n.product.type=="hotel")[0];return t?this.datePipe.transform(t.startDate,"short"):""}getEnd(e){if(!e)return"deleted";let t=e.entries.filter(n=>n.product.type=="hotel")[0];return t?this.datePipe.transform(t.endDate,"short"):""}getReceptText(e){if(!e)return"deleted";let t=e.entries.filter(n=>n.product.type=="hotel")[0];return t?t.receiptSubText:""}get total(){let e=0;return this.unbilledRevenue.forEach(t=>{e+=t.amount}),e}getRows(){let e=[];e.push(["account id","description","checkin","checkout","amount"]);for(let t of this.unbilledRevenue){let n=[];n.push(t.account.id),n.push(this.getReceptText(t.account)),n.push(this.getStart(t.account)),n.push(this.getEnd(t.account)),n.push(t.amount),e.push(n)}return e}static \u0275fac=function(t){return new(t||i)(h(Yt))};static \u0275cmp=w({type:i,selectors:[["app-unbilled-revenue"]],inputs:{unbilledRevenue:[0,"unbilled","unbilledRevenue"]},decls:4,vars:4,consts:[["class","row",4,"ngFor","ngForOf"],[1,"summary"],[1,"row"],[1,"info"],[1,"start"],[1,"end"],[1,"amount"]],template:function(t,n){t&1&&(f(0,kp,10,6,"div",0),a(1,"div",1),l(2),u(3,"number"),r()),t&2&&(s("ngForOf",n.unbilledRevenue),o(2),m(" Total: ",v(3,2,n.total),`
`))},dependencies:[T,me],styles:[".row[_ngcontent-%COMP%]{display:flex;border-bottom:solid 1px #DDD}.end[_ngcontent-%COMP%], .start[_ngcontent-%COMP%]{padding:5px;flex:0 0 130px}.amount[_ngcontent-%COMP%]{flex:0 0 50px;padding:5px;text-align:right}.info[_ngcontent-%COMP%]{flex:1 1 50%;padding:5px}.summary[_ngcontent-%COMP%]{font-size:20px;padding:20px;margin-top:20px;border-radius:5px;text-align:center;background-color:#efefef}"]})}return i})();function Op(i,p){if(i&1){let e=S();a(0,"div",7),C("click",function(){let n=y(e).$implicit,c=d(2);return b(c.navigate(n.id))}),a(1,"div"),l(2),r(),a(3,"div"),l(4),r(),a(5,"div"),l(6),r()()}if(i&2){let e=p.$implicit,t=d(2);o(2),I(t.getStart(e)),o(2),I(t.getEnd(e)),o(2),I(t.getReceptText(e))}}function Fp(i,p){if(i&1){let e=S();a(0,"div",1)(1,"div",2),l(2),r(),a(3,"div",3),l(4),u(5,"number"),a(6,"i",4),C("click",function(){let n=y(e).$implicit,c=d();return b(c.navigateToPayment(n.payment))}),r()(),a(7,"div",5),f(8,Op,7,3,"div",6),r()()}if(i&2){let e=p.$implicit;o(2),m(" ",e.payment.type.name," "),o(2),m(" ",v(5,3,e.amount)," "),o(4),s("ngForOf",e.accounts)}}var cr=(()=>{class i{datePipe;bookingController;prePayments;constructor(e,t){this.datePipe=e,this.bookingController=t}get total(){if(!this.prePayments)return 0;let e=0;return this.prePayments.forEach(t=>{e+=t.amount}),e}getStart(e){if(!e)return"deleted";let t=e.entries.filter(n=>n.product.type=="hotel")[0];return t?this.datePipe.transform(t.startDate,"short"):"N/A"}getEnd(e){if(!e)return"deleted";let t=e.entries.filter(n=>n.product.type=="hotel")[0];return t?this.datePipe.transform(t.endDate,"short"):"N/A"}getReceptText(e){if(!e)return"deleted";let t=e.entries.filter(n=>n.product.type=="hotel")[0];return t?t.receiptSubText:"N/A"}navigateToPayment(e){let t="/front/"+sessionStorage.getItem("tenant")+"/commerce/payment/"+e.id;window.open(t,"_blank")}navigate(e){this.bookingController.getGroupsByAccountId([e]).subscribe(t=>{console.log(t);let n=t[0],c="/front/"+sessionStorage.getItem("tenant")+"/booking/group/"+n.id+"/"+e;window.open(c,"_blank")})}static \u0275fac=function(t){return new(t||i)(h(Yt),h(ft))};static \u0275cmp=w({type:i,selectors:[["app-open-pre-payments"]],inputs:{prePayments:"prePayments"},decls:4,vars:4,consts:[["class","row",4,"ngFor","ngForOf"],[1,"row"],[1,"type"],[1,"amount"],[1,"fa","fa-dollar",3,"click"],[1,"accountsums"],["class","accountsum",3,"click",4,"ngFor","ngForOf"],[1,"accountsum",3,"click"]],template:function(t,n){t&1&&(f(0,Fp,9,5,"div",0),a(1,"div"),l(2),u(3,"number"),r()),t&2&&(s("ngForOf",n.prePayments),o(2),m(" Sum: ",v(3,2,n.total),`
`))},dependencies:[T,me],styles:[".row[_ngcontent-%COMP%]{display:flex;gap:5px;margin-bottom:20px;flex-wrap:wrap;background-color:#efefef;padding:10px}.type[_ngcontent-%COMP%]{flex:1 1 30%;padding:5px}.amount[_ngcontent-%COMP%]{flex:0 0 100px;text-align:right;padding:5px}.accountsum[_ngcontent-%COMP%]{display:flex;gap:10px}.accountsums[_ngcontent-%COMP%]{flex:1 1 100%;background-color:#fff;padding:10px;border-radius:5px}"]})}return i})();function Bp(i,p){i&1&&(a(0,"div"),_(1,"i",1),r())}function Rp(i,p){if(i&1){let e=S();a(0,"i",11),C("click",function(){y(e);let n=d().$implicit,c=d(4);return b(c.changeValue(n,!1))}),r()}}function Np(i,p){if(i&1){let e=S();a(0,"i",11),C("click",function(){y(e);let n=d().$implicit,c=d(4);return b(c.changeValue(n,!0))}),r()}}function Lp(i,p){if(i&1&&(a(0,"div",4),_(1,"div",9),a(2,"div",6),f(3,Rp,1,0,"i",10),l(4),u(5,"number"),r(),a(6,"div",6),f(7,Np,1,0,"i",10),l(8),u(9,"number"),r()()),i&2){let e=p.$implicit,t=d().$implicit,n=d(3);o(),s("innerHTML",n.getDescription(t,e),ht),o(2),s("ngIf",e.id&&n.isSupport()),o(),m(" ",F(5,5,e.totalChangesExTaxes,"1.2-2")," "),o(3),s("ngIf",e.id&&n.isSupport()),o(),m(" ",F(9,8,e.totalChangesIncTaxes,"1.2-2")," ")}}function jp(i,p){if(i&1&&(a(0,"div"),f(1,Lp,10,11,"div",8),r()),i&2){let e=p.$implicit;o(),s("ngForOf",e.groupPayments)}}function Up(i,p){if(i&1&&(a(0,"div",3),l(1),a(2,"div",4)(3,"div",5),l(4,"Description"),r(),a(5,"div",6),l(6,"Ex tax"),r(),a(7,"div",6),l(8,"Inc tax"),r()(),f(9,jp,2,1,"div",7),r()),i&2){let e=p.$implicit;o(),ge(" ",e.account.accountNumber," - ",e.account.description," "),o(8),s("ngForOf",e.entries)}}function Hp(i,p){if(i&1&&(a(0,"div"),f(1,Up,10,3,"div",2),r()),i&2){let e=d();o(),s("ngForOf",e.day)}}var lr=(()=>{class i{accountingController;receiptController;userService;accountController;paymentController;cell;data;day;loaded=!1;accounts;payments;constructor(e,t,n,c,g){this.accountingController=e,this.receiptController=t,this.userService=n,this.accountController=c,this.paymentController=g}ngAfterViewInit(){this.loadAll()}loadAll(){this.loaded=!1,this.accountingController.getAccountingDay(this.cell.dayId).subscribe(e=>{this.day=e,this.loadData()})}loadData(){this.loaded=!1;let e=this.getDistinctAccountIds();Qe([this.accountController.getAccounts(e),this.paymentController.getPaymentsForAccounts(e)]).subscribe(t=>{this.accounts=t[0],this.payments=t[1],this.loaded=!0})}getDistinctAccountIds(){let e=[];return this.day.forEach(t=>{t.entries.forEach(n=>{n.groupPayments.forEach(c=>{c.accountId&&e.indexOf(c.accountId)<0&&e.push(c.accountId)})})}),e}getDescription(e,t){let n="<div class='title1'>"+e.type+"</div>";return e.type=="AccountingDayProductEntry"&&(n=this.getAccountingDayProductEntryDescription(t)),e.type=="AccountingDayAccruedRevenueEntry"&&t.type=="unit"&&(n=this.getAccountingDayProductEntryDescription(t)),e.type=="AccountingDayAccruedRevenueEntry"&&t.type=="receipt"&&(n=this.getPaymentInformation(t)),e.type=="AccountingDayPrepaid"&&(n=this.getPaymentInformation(t)),e.type=="AccountingDayPaymentEntry"&&(n=this.getPaymentInformation(t)),t.transferredToAccountingSystem?n+="transferred":n+="open",n}getPaymentInformation(e){let t=this.payments.filter(g=>g.id==e.refId)[0],n=this.accounts.filter(g=>g.id==e.accountId)[0],c="";return t?(c+="<div class='title1'>"+t.type.name+"</div>",c+="<div class='subInfo'>Payment id: "+t.id+"</div>",n&&(c+="<div class='accountid'>Account id: "+n.id+"</div>")):c+="<div class='title1'>"+e.refId+"</div>",c}getAccountingDayProductEntryDescription(e){let t=this.accounts.filter(c=>c.id==e.accountId)[0],n="";for(let c of t.entries)for(let g of c.units)g.accountUnitId==e.refId&&(n+="<div class='title1'>"+c.product.defaultName+"</div>",n+="<div class='subInfo'>"+c.receiptSubText+"</div>",n+="<div class='accountid'> Account: "+t.id+"</div>");return n}isSupport(){return this.userService.getUserObject().email.indexOf("yalidian.com")>-1}changeValue(e,t){let n=prompt("new val");if(n){let c=parseFloat(n);this.accountingController.changeValueOfGroupRecord(e.id,c,t).subscribe(g=>{this.loadAll()})}}static \u0275fac=function(t){return new(t||i)(h(De),h(Je),h(Ze),h(Ae),h(We))};static \u0275cmp=w({type:i,selectors:[["app-accounting-day-view"]],inputs:{cell:"cell"},decls:2,vars:2,consts:[[4,"ngIf"],[1,"fa","fa-spin","fa-spinner"],["class","account",4,"ngFor","ngForOf"],[1,"account"],[1,"row"],[1,"title1"],[1,"value"],[4,"ngFor","ngForOf"],["class","row",4,"ngFor","ngForOf"],[3,"innerHTML"],["class","fa fa-edit",3,"click",4,"ngIf"],[1,"fa","fa-edit",3,"click"]],template:function(t,n){t&1&&f(0,Bp,2,0,"div",0)(1,Hp,2,1,"div",0),t&2&&(s("ngIf",!n.loaded),o(),s("ngIf",n.day&&n.loaded))},dependencies:[T,M,me],styles:[".row[_ngcontent-%COMP%]{padding:5px;display:flex;gap:10px;border-bottom:solid 1px #DDD}.account[_ngcontent-%COMP%]{padding:20px;background-color:#efefef;margin-bottom:10px;border-radius:5px}[_nghost-%COMP%]     .title1, [_nghost-%COMP%]     .subInfo{width:350px}.value[_ngcontent-%COMP%]{flex:0 0 100px}"]})}return i})();function Gp(i,p){if(i&1&&_(0,"app-accounting-day-view",4),i&2){let e=d(3);s("cell",e.cell)}}function qp(i,p){if(i&1&&_(0,"app-unbilled-revenue",5),i&2){let e=d(3);s("unbilled",e.cell.unbilledRevenue)}}function Qp(i,p){if(i&1&&_(0,"app-open-pre-payments",6),i&2){let e=d(3);s("prePayments",e.cell.prePayments)}}function zp(i,p){if(i&1&&(a(0,"div"),f(1,Gp,1,1,"app-accounting-day-view",1)(2,qp,1,1,"app-unbilled-revenue",2)(3,Qp,1,1,"app-open-pre-payments",3),r()),i&2){let e=d(2);o(),s("ngIf",e.cell.dayId),o(),s("ngIf",e.cell.unbilledRevenue&&e.cell.unbilledRevenue.length>0),o(),s("ngIf",e.cell.prePayments&&e.cell.prePayments.length>0)}}function Wp(i,p){if(i&1&&(a(0,"div"),f(1,zp,4,3,"div",0),r()),i&2){let e=d();o(),s("ngIf",e.cell)}}var sr=(()=>{class i{reportController;row;cell;constructor(e){this.reportController=e}loadData(e,t){this.row=e,this.cell=t}static \u0275fac=function(t){return new(t||i)(h(Di))};static \u0275cmp=w({type:i,selectors:[["app-detailed-view"]],decls:2,vars:1,consts:[[4,"ngIf"],[3,"cell",4,"ngIf"],[3,"unbilled",4,"ngIf"],[3,"prePayments",4,"ngIf"],[3,"cell"],[3,"unbilled"],[3,"prePayments"]],template:function(t,n){t&1&&(a(0,"mat-dialog-content"),f(1,Wp,2,1,"div",0),r()),t&2&&(o(),s("ngIf",n.cell))},dependencies:[M,K,nn,cr,lr]})}return i})();var Kp=["excel"],Xp=()=>["../accounting2"];function Yp(i,p){if(i&1&&(a(0,"span"),l(1),u(2,"date"),r()),i&2){let e=d();o(),m(", information after ",F(2,1,e.settings.accountingReportCutoffDate,"shortDate")," will only be displayed in the new report ")}}var fh=(()=>{class i{reportController;userService;accountController;dialog;accountingController;data;range;excel;settings;constructor(e,t,n,c,g){this.reportController=e,this.userService=t,this.accountController=n,this.dialog=c,this.accountingController=g,this.accountController.getSettings().subscribe(x=>{this.settings=x,console.log(x)}),this.accountingController.getOpenEntries("").subscribe(x=>{console.log(x)})}ngAfterViewInit(){this.excel.onCellClicked.subscribe(e=>{this.dialog.open(sr).componentInstance.loadData(e.row,e.cell)}),this.excel.onHeaderClicked.subscribe(e=>{this.userService.getUserObject().email.indexOf("yalidian.com")<0||!confirm("Are you sure you want to reset the day ?")||this.accountingController.resetAccountingDay(e.dayId).subscribe(c=>{alert("Deleted")})})}ngOnInit(){}loadData(e,t,n,c){this.excel&&(this.excel.data=null);let g=this.getRequestData(e,t,n,c);this.reportController.getAccountingReport(g).subscribe(x=>{this.data=x})}getRequestData(e,t,n,c){var g={};return g.start=this.range.value.start,g.end=this.range.value.end,g.sumAllDays=!e,g.incTaxes=t,g.department=n,g.groupByAccounts=c,g}static \u0275fac=function(t){return new(t||i)(h(Di),h(Ze),h(Ae),h(q),h(De))};static \u0275cmp=w({type:i,selectors:[["app-accounting-report"]],viewQuery:function(t,n){if(t&1&&N(Kp,5),t&2){let c;L(c=j())&&(n.excel=c.first)}},inputs:{range:"range"},decls:11,vars:4,consts:[["excel",""],[1,"deprecated_warning"],[1,"fa","fa-warning"],[4,"ngIf"],["mat-flat-button","","color","primary",3,"routerLink"],[3,"data"]],template:function(t,n){t&1&&(a(0,"div",1),_(1,"i",2),l(2," This report has been replaced with a new one and will not be updated with new accounting report"),f(3,Yp,3,4,"span",3),_(4,"i",2)(5,"br")(6,"br"),a(7,"button",4),l(8," Open new report "),r()(),_(9,"app-excel-view",5,0)),t&2&&(o(3),s("ngIf",n.settings&&n.settings.accountingReportCutoffDate),o(4),s("routerLink",Pe(3,Xp)),o(2),s("data",n.data))},dependencies:[mt,M,O,Hi,ue],styles:["[_nghost-%COMP%]     .missingmap{color:red}.deprecated_warning[_ngcontent-%COMP%]{background-color:red;color:#fff;padding:20px;border-radius:5px;text-align:center}"]})}return i})();var on=(()=>{class i{httpService;urlService;constructor(e,t){this.httpService=e,this.urlService=t}createDepartment(e){let t=[];t.push({name:"name",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/departmentcontroller/create",{params:n})}delete(e){let t=[];t.push({name:"departmentId",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/departmentcontroller/delete",{params:n})}getDepartment(e){let t=[];t.push({name:"departmentId",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/departmentcontroller/getdepartment",{params:n})}getDepartments(){return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/departmentcontroller/getdepartments")}static \u0275fac=function(t){return new(t||i)(Y(_e),Y(ve))};static \u0275prov=re({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();function Jp(i,p){if(i&1){let e=S();a(0,"div",3),C("click",function(){let n=y(e).$implicit,c=d();return b(c.selectDepartment(n))}),l(1),r()}if(i&2){let e=p.$implicit;o(),m(" ",e.name," ")}}function Zp(i,p){if(i&1&&(a(0,"span",11),l(1),r()),i&2){let e=d(2);o(),m('"',e.searchController.value,'"')}}function ed(i,p){if(i&1){let e=S();a(0,"button",8),C("click",function(){y(e);let n=d();return b(n.createDepartment())}),_(1,"i",9),l(2),u(3,"translate"),f(4,Zp,2,1,"span",10),r()}if(i&2){let e=d();s("disabled",!e.searchController.valid),o(2),m(" ",v(3,3,"commerce.privatecustomer.6")," "),o(2),s("ngIf",e.searchController.value)}}function td(i,p){if(i&1){let e=S();a(0,"button",12),C("click",function(){y(e);let n=d();return b(n.saveCustomer())}),l(1),u(2,"translate"),r()}i&2&&(o(),m(" ",v(2,1,"commerce.privatecustomer.9")," "))}var hh=(()=>{class i{departmentController;dialogRef;searchController=new R("",[ce.required]);department;departments;constructor(e,t){this.departmentController=e,this.dialogRef=t}ngOnInit(){this.load()}load(){this.departmentController.getDepartments().subscribe(e=>{this.departments=e})}createDepartment(e){this.departmentController.createDepartment(this.searchController.value).subscribe(t=>{this.selectDepartment(t)})}selectDepartment(e){this.dialogRef.close(e)}static \u0275fac=function(t){return new(t||i)(h(on),h(te))};static \u0275cmp=w({type:i,selectors:[["app-department-picker-dialog"]],decls:11,vars:10,consts:[[1,"mat-typography"],["value","",1,"searchfield",3,"formControl","placeholder"],[1,"searchresult"],[1,"departmentrow",3,"click"],["class","departmentrow",3,"click",4,"ngFor","ngForOf"],["align","end"],["mat-flat-button","","color","primary",3,"disabled","click",4,"ngIf"],["mat-flat-button","",3,"click",4,"ngIf"],["mat-flat-button","","color","primary",3,"click","disabled"],[1,"fal","fa-plus"],["style","display: inline-block; vertical-align: top;",4,"ngIf"],[2,"display","inline-block","vertical-align","top"],["mat-flat-button","",3,"click"]],template:function(t,n){t&1&&(a(0,"mat-dialog-content",0),_(1,"input",1),u(2,"translate"),a(3,"div",2)(4,"div",3),C("click",function(){return n.selectDepartment(null)}),l(5),u(6,"translate"),r(),f(7,Jp,2,1,"div",4),r()(),a(8,"mat-dialog-actions",5),f(9,ed,5,5,"button",6)(10,td,3,3,"button",7),r()),t&2&&(o(),Ri("placeholder",v(2,6,"commerce.departmentpicker.1")),s("formControl",n.searchController),o(4),m(" ",v(6,8,"commerce.departmentpicker.2")," "),o(2),s("ngForOf",n.departments),o(2),s("ngIf",!n.department),o(),s("ngIf",n.department))},dependencies:[T,M,oe,K,U,V,le,O,E],styles:[".searchfield[_ngcontent-%COMP%]{padding:10px;border:solid 1px #DDD;width:100%;box-sizing:border-box}.editcustomerheader[_ngcontent-%COMP%]{font-size:18px;font-weight:400;padding-bottom:30px;text-align:center}  .mat-mdc-paginator-page-size,   thead{display:none!important}  tbody{min-height:254px;display:block}.departmentrow[_ngcontent-%COMP%]{padding:10px;cursor:pointer}.searchresult[_ngcontent-%COMP%]{min-width:300px;height:310px;border:solid 1px #DDD;margin-top:5px}.selectable[_ngcontent-%COMP%]{cursor:pointer}.selectable[_ngcontent-%COMP%]:hover{background-color:#efefef}.tt_table[_ngcontent-%COMP%]{width:100%}table.mat-mdc-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]{width:252px}"]})}return i})();function id(i,p){if(i&1){let e=S();a(0,"div")(1,"i",3),C("click",function(){y(e);let n=d().$implicit,c=d();return b(c.deleteContact(n))}),r(),a(2,"span",4),l(3),r(),a(4,"span",5),l(5),r(),a(6,"span",6),l(7),r(),a(8,"span",7),l(9),r(),a(10,"span",8),l(11),r(),a(12,"i",9),C("click",function(){y(e);let n=d().$implicit,c=d();return b(c.editContact(n))}),r()()}if(i&2){let e=d().$implicit;o(3),I(e.firstName),o(2),I(e.lastName),o(2),m("(",e.phonePrefix,")"),o(2),I(e.phoneNumber),o(2),I(e.email)}}function nd(i,p){if(i&1&&(a(0,"div",1),f(1,id,13,5,"div",2),r()),i&2){let e=p.$implicit;o(),s("ngIf",e)}}var dr=(()=>{class i{dialog;contacts=[];set address(e){this.contacts=e}deleteContact(e){var t=new ct("Delete list","Are you sure you want to delete the list named "+e.firstName+" "+e.lastName),n=this.dialog.open(Oe,{data:t}).afterClosed().subscribe(c=>{if(c){let g=[];for(let x of this.contacts)x.contactId!=e.contactId&&g.push(x);this.contacts=g}})}editContact(e){var t=this.dialog.open(Ji,{});t.componentInstance.contact=e,t.componentInstance.updatingContact=!0,t.afterClosed().subscribe(n=>{})}constructor(e){this.dialog=e}ngOnInit(){}static \u0275fac=function(t){return new(t||i)(h(q))};static \u0275cmp=w({type:i,selectors:[["app-company-contacts"]],inputs:{address:[0,"contacts","address"]},decls:1,vars:1,consts:[["class","contact",4,"ngFor","ngForOf"],[1,"contact"],[4,"ngIf"],[1,"fa","fa-trash-o",3,"click"],[1,"firstName"],[1,"lastName"],[1,"phonePrefix"],[1,"phoneNumber"],[1,"email"],[1,"fa","fa-edit",3,"click"]],template:function(t,n){t&1&&f(0,nd,2,1,"div",0),t&2&&s("ngForOf",n.contacts)},dependencies:[T,M],styles:[".contact[_ngcontent-%COMP%]{line-height:30px;position:relative}.fa-edit[_ngcontent-%COMP%]{position:absolute;right:0;cursor:pointer}.fa-trash-o[_ngcontent-%COMP%]{margin-right:10px;cursor:pointer}.lastName[_ngcontent-%COMP%], .phoneNumber[_ngcontent-%COMP%]{margin-right:30px}"]})}return i})();var mr=(()=>{class i{dialogRef;_product;childrenControl=new Ee;adultsControl=new Ee;constructor(e){this.dialogRef=e}set product(e){this._product=e,this.childrenControl.patchValue(this._product.maxNumberOfChildren),this.adultsControl.patchValue(this._product.maxNumberOfAdults)}save(){this._product.maxNumberOfAdults=this.adultsControl.value,this._product.maxNumberOfChildren=this.childrenControl.value,this.dialogRef.close(!0)}static \u0275fac=function(t){return new(t||i)(h(te))};static \u0275cmp=w({type:i,selectors:[["app-edit-guest-info"]],decls:19,vars:16,consts:[[1,"example-full-width"],["matInput","","placeholder","","value","",3,"formControl"],[3,"align"],["mat-button","",3,"mat-dialog-close"],["mat-button","",3,"click"]],template:function(t,n){t&1&&(a(0,"mat-dialog-content")(1,"mat-form-field",0)(2,"mat-label"),l(3),u(4,"translate"),r(),_(5,"input",1),r(),_(6,"br"),a(7,"mat-form-field",0)(8,"mat-label"),l(9),u(10,"translate"),r(),_(11,"input",1),r()(),a(12,"mat-dialog-actions",2)(13,"button",3),l(14),u(15,"translate"),r(),a(16,"button",4),C("click",function(){return n.save()}),l(17),u(18,"translate"),r()()),t&2&&(o(3),m(" ",v(4,8,"commerce.productview.guestinfo.2")," "),o(2),s("formControl",n.adultsControl),o(4),m(" ",v(10,10,"commerce.productview.guestinfo.3")," "),o(2),s("formControl",n.childrenControl),o(),s("align","end"),o(),s("mat-dialog-close",!1),o(),m(" ",v(15,12,"booking.groupview.edit_addon.2")," "),o(3),m(" ",v(18,14,"booking.groupview.edit_addon.3")," "))},dependencies:[de,oe,K,B,H,G,U,V,le,O,E]})}return i})();var od=(i,p)=>({adults:i,children:p}),ur=(()=>{class i{dialog;product;productView;set setProduct(e){this.product=e}selectedLocale="";constructor(e){this.dialog=e}showEditGuests(){let e=this.dialog.open(mr);e.componentInstance.product=this.product,e.afterClosed().subscribe(t=>{t&&this.productView.save()})}static \u0275fac=function(t){return new(t||i)(h(q))};static \u0275cmp=w({type:i,selectors:[["app-guest-info"]],inputs:{productView:[0,"productview","productView"],setProduct:[0,"product","setProduct"],selectedLocale:"selectedLocale"},decls:16,vars:12,consts:[[1,"box-header"],[1,"fa","fa-edit",3,"click"],[1,"count",3,"click"],[1,"fa-thin","fa-user"],[1,"fa","fa-children"]],template:function(t,n){t&1&&(a(0,"div",0),l(1),u(2,"translate"),r(),a(3,"div")(4,"i",1),C("click",function(){return n.showEditGuests()}),r(),l(5),u(6,"translate"),_(7,"br"),a(8,"div",2),C("click",function(){return n.showEditGuests()}),_(9,"i",3),a(10,"div"),l(11),r()(),a(12,"div",2),C("click",function(){return n.showEditGuests()}),_(13,"i",4),a(14,"div"),l(15),r()()()),t&2&&(o(),m(" ",v(2,4,"commerce.productview.guestinfo.1"),`
`),o(4),m(" ",F(6,6,"commerce.productview.guestinfo.4",fi(9,od,n.product.maxNumberOfAdults,n.product.maxNumberOfChildren))," "),o(6),m(" ",n.product.maxNumberOfAdults," "),o(4),m(" ",n.product.maxNumberOfChildren," "))},dependencies:[E],styles:[".box-header[_ngcontent-%COMP%]{text-align:center;font-weight:500;font-size:20px;padding-bottom:15px;margin-bottom:15px}.count[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]{font-size:30px}.count[_ngcontent-%COMP%]{padding:10px;border-radius:30px;background-color:#efefef;display:inline-block;width:50px;text-align:center;margin:10px}"]})}return i})();function rd(i,p){i&1&&(a(0,"div"),l(1," No accounts created. "),r())}function ad(i,p){if(i&1){let e=S();a(0,"div",9)(1,"div",10),C("click",function(){let n=y(e).$implicit,c=d();return b(c.changeNumber(n))}),l(2),r(),a(3,"div",11),C("click",function(){let n=y(e).$implicit,c=d();return b(c.changeName(n))}),l(4),r()()}if(i&2){let e=p.$implicit;o(2),m(" ",e.accountNumber," "),o(2),m(" ",e.description," ")}}var Ph=(()=>{class i{accountingController;products;accounts;createFormGroup=new gi({number:new Ee("",[ce.required]),desc:new Ee("",[ce.required])});constructor(e){this.accountingController=e,this.loadData()}changeName(e){let t=prompt("Account name");t&&(e.description=t,this.accountingController.saveAccount(e).subscribe(n=>{alert("Saved")}))}changeNumber(e){let t=prompt("Account name");t&&(e.accountNumber=t,this.accountingController.saveAccount(e).subscribe(n=>{alert("Saved")}))}loadData(){this.accountingController.getAccounts().subscribe(e=>{this.accounts=e})}create(){let e={};e.accountNumber=this.createFormGroup.value.number,e.description=this.createFormGroup.value.desc,this.accountingController.saveAccount(e).subscribe(t=>{this.loadData()})}static \u0275fac=function(t){return new(t||i)(h(De))};static \u0275cmp=w({type:i,selectors:[["app-accounting-accounts"]],decls:19,vars:4,consts:[[1,"accounts"],[4,"ngIf"],["class","accountrow",4,"ngFor","ngForOf"],[1,"createnewform"],[1,"example-form",3,"formGroup"],[1,"example-full-width"],["matInput","","placeholder","","value","","formControlName","number"],["matInput","","placeholder","","value","","formControlName","desc"],["mat-flat-button","","color","primary",3,"click","disabled"],[1,"accountrow"],[1,"number",3,"click"],[3,"click"]],template:function(t,n){t&1&&(a(0,"div",0)(1,"h2"),l(2,"Accounts"),r(),f(3,rd,2,0,"div",1)(4,ad,5,2,"div",2),r(),a(5,"div",3)(6,"form",4)(7,"mat-form-field",5)(8,"mat-label"),l(9,"Account number"),r(),_(10,"input",6),r(),l(11," \xA0 "),a(12,"mat-form-field",5)(13,"mat-label"),l(14,"Description"),r(),_(15,"input",7),r(),l(16," \xA0 "),a(17,"button",8),C("click",function(){return n.create()}),l(18," Create "),r()()()),t&2&&(o(3),s("ngIf",!n.accounts),o(),s("ngForOf",n.accounts),o(2),s("formGroup",n.createFormGroup),o(11),s("disabled",!n.createFormGroup.valid))},dependencies:[T,M,B,H,G,Ce,U,V,ae,xe,ye,O],styles:[".accounts[_ngcontent-%COMP%], .createnewform[_ngcontent-%COMP%]{background-color:#fff;padding:20px;margin-top:20px;border-radius:5px}.accountrow[_ngcontent-%COMP%]{display:flex;gap:20px;border-bottom:solid 1px #DDD;padding:5px}.accountrow[_ngcontent-%COMP%]   .number[_ngcontent-%COMP%]{flex:0 0 100px}"]})}return i})();function cd(i,p){i&1&&(a(0,"div",5),l(1),u(2,"translate"),r()),i&2&&(o(),m(" ",v(2,1,"commerce.mapping.4"),`
`))}function ld(i,p){i&1&&(a(0,"div",6),l(1),u(2,"translate"),r()),i&2&&(o(),m(" ",v(2,1,"commerce.productlist.3"),`
`))}function sd(i,p){if(i&1&&(Q(0),l(1),u(2,"date"),z()),i&2){let e=d(2).$implicit;o(),m(" ",F(2,1,e.end,"shortDate")," ")}}function pd(i,p){i&1&&(Q(0),l(1," infinity "),z())}function dd(i,p){if(i&1&&(a(0,"div",12)(1,"div",13),l(2),r(),l(3),u(4,"date"),f(5,sd,3,4,"ng-container",14)(6,pd,2,0,"ng-container",14),r()),i&2){let e=d().$implicit,t=d().$implicit;o(2),m(" ",e.percent," % "),o(),ge(" ",t.description," ",F(4,5,e.from,"shortDate")," - "),o(2),s("ngIf",e.end),o(),s("ngIf",!e.end)}}function md(i,p){if(i&1&&(Q(0),f(1,dd,7,8,"div",11),z()),i&2){let e=p.$implicit,t=d(3);o(),s("ngIf",t.isAfterCreatedDate(e))}}function ud(i,p){if(i&1&&(Q(0),f(1,md,2,1,"ng-container",10),z()),i&2){let e=p.$implicit;o(),s("ngForOf",e.periodes)}}function fd(i,p){if(i&1&&_(0,"app-account-product-map",17),i&2){let e=d().$implicit,t=d().$implicit,n=d(2).$implicit;s("product",n)("tax",t)("taxperiode",e)}}function gd(i,p){if(i&1&&(Q(0),f(1,fd,1,3,"app-account-product-map",16),z()),i&2){let e=p.$implicit,t=d(5);o(),s("ngIf",t.isAfterCreatedDate(e))}}function _d(i,p){if(i&1&&(Q(0),f(1,gd,2,1,"ng-container",10),z()),i&2){let e=p.$implicit;o(),s("ngForOf",e.periodes)}}function vd(i,p){if(i&1&&(a(0,"div",8)(1,"div",9),l(2),r(),f(3,_d,2,1,"ng-container",10),r()),i&2){let e=d().$implicit,t=d(2);o(2),m(" ",e.defaultName," "),o(),s("ngForOf",t.allTaxesWithoutZero)}}function hd(i,p){if(i&1&&(Q(0),f(1,vd,4,2,"div",15),z()),i&2){let e=p.$implicit,t=d(2);o(),s("ngIf",t.hasAnyProduct(e))}}function Cd(i,p){if(i&1&&(a(0,"div",7)(1,"div",8)(2,"div",9),l(3," \xA0 "),r(),f(4,ud,2,1,"ng-container",10),r(),f(5,hd,2,1,"ng-container",10),r()),i&2){let e=d();ee("inverted",e.filter!=null&&e.filter.length>0),o(4),s("ngForOf",e.allTaxesWithoutZero),o(),s("ngForOf",e.products)}}function xd(i,p){i&1&&(a(0,"div",6),l(1),u(2,"translate"),r()),i&2&&(o(),m(" ",v(2,1,"commerce.productview.4"),`
`))}function yd(i,p){if(i&1&&(a(0,"div"),_(1,"app-tax-mapping",18),r()),i&2){let e=d().$implicit;o(),s("tax",e)}}function bd(i,p){if(i&1&&(a(0,"div"),f(1,yd,2,1,"div",14),r()),i&2){let e=p.$implicit,t=d(2);o(),s("ngIf",e.category!=0&&t.shouldShowTax(e))}}function wd(i,p){if(i&1&&(a(0,"div",7),f(1,bd,2,1,"div",10),r()),i&2){let e=d();ee("inverted",e.filter!=null&&e.filter.length>0),o(),s("ngForOf",e.allTaxes.taxes)}}function Sd(i,p){i&1&&(a(0,"div",6),l(1),u(2,"translate"),r()),i&2&&(o(),m(" ",v(2,1,"commerce.mapping.1"),`
`))}function Id(i,p){if(i&1&&_(0,"app-payment-mapping",20),i&2){let e=d().$implicit;s("type",e)}}function Md(i,p){if(i&1&&(a(0,"div"),f(1,Id,1,1,"app-payment-mapping",19),r()),i&2){let e=p.$implicit,t=d(2);o(),s("ngIf",t.shouldShowPayment(e))}}function Dd(i,p){if(i&1&&(a(0,"div",7),f(1,Md,2,1,"div",10),r()),i&2){let e=d();ee("inverted",e.filter!=null&&e.filter.length>0),o(),s("ngForOf",e.paymentTypes)}}function Pd(i,p){i&1&&(a(0,"div",6),l(1),u(2,"translate"),r()),i&2&&(o(),m(" ",v(2,1,"commerce.mapping.2"),`
`))}function Ed(i,p){if(i&1&&_(0,"app-other-mapping",20),i&2){let e=d().$implicit;s("type",e)}}function Td(i,p){if(i&1&&(Q(0),f(1,Ed,1,1,"app-other-mapping",19),z()),i&2){let e=p.$implicit,t=d(2);o(),s("ngIf",t.shouldShowOther(e))}}function kd(i,p){if(i&1&&(a(0,"div",7),f(1,Td,2,1,"ng-container",10),r()),i&2){let e=d();ee("inverted",e.filter!=null&&e.filter.length>0),o(),s("ngForOf",e.otherMappings)}}function Ad(i,p){i&1&&(a(0,"div",6),l(1),u(2,"translate"),r()),i&2&&(o(),m(" ",v(2,1,"commerce.mapping.3"),`
`))}function Od(i,p){if(i&1&&(a(0,"div"),_(1,"app-department-mapping",21),r()),i&2){let e=p.$implicit;o(),s("department",e)}}function Fd(i,p){if(i&1&&(a(0,"div",7),f(1,Od,2,1,"div",10),r()),i&2){let e=d();ee("inverted",e.filter!=null&&e.filter.length>0),o(),s("ngForOf",e.departments)}}var vt=(()=>{class i{accountingController;userService;productController;paymentController;taxesController;departmentController;loaded=!1;accounts;taxes=new Map;products;productMappings;allTaxes;paymentTypes;taxMappings;paymentTypeMappings;otherTypes;departments;departmentMappings;otherMappings=["unbilled","prepaid","bankaccount","fee","rounding"];callbackto;filter=[];constructor(e,t,n,c,g,x){this.accountingController=e,this.userService=t,this.productController=n,this.paymentController=c,this.taxesController=g,this.departmentController=x,this.loadData()}loadData(){let e=[this.accountingController.getAccounts(),this.taxesController.getTaxes(),this.productController.getAllProducts(),this.accountingController.getAllMappings(),this.paymentController.getActivatedPaymentTypes(),this.departmentController.getDepartments(),this.accountingController.getAllDepartmentMappings()];Qe(e).subscribe(t=>{this.accounts=t[0],t[1].taxes.forEach(n=>{this.taxes.set(n.category,n)}),this.allTaxes=t[1],this.products=t[2],this.loaded=!0,this.paymentTypes=t[4],this.departments=t[5],this.productMappings=t[3].filter(n=>n.type=="ProductAccountMapping"),this.taxMappings=t[3].filter(n=>n.type=="TaxMapping"),this.paymentTypeMappings=t[3].filter(n=>n.type=="PaymentTypeMapping"),this.otherTypes=t[3].filter(n=>n.type=="OtherAccountMapping"),this.departmentMappings=t[6]})}isAfterCreatedDate(e){return e.end?new Date(this.userService.getTenant().created)<new Date(e.end):!0}getTaxCategories(e){let t=[];return this.productMappings.filter(n=>n.productId==e.id).forEach(n=>{t.indexOf(n.taxCategory)<0&&t.push(n.taxPeriodeId)}),t}hasAnyProducts(){for(let e of this.products)if(this.hasAnyProduct(e))return!0;return!1}hasAnyProduct(e){for(let t of this.allTaxes.taxes)for(let n of t.periodes)if(this.shouldShowProduct(e,t,n))return!0;return!1}shouldShowProduct(e,t,n){let c=this.filter;return!c||c.length==0?!0:c.filter(x=>x.productId==e.id&&x.periodeNumber==n.periodeNumber&&x.taxCategory==t.category&&x.type=="ProductAccountMapping").length>0}hasAnyTaxes(){for(let e of this.allTaxes.taxes)if(this.shouldShowTax(e))return!0;return!1}shouldShowTax(e){let t=this.filter;return!t||t.length==0?!0:t.filter(c=>c.type=="TaxMapping"&&c.category==e.category).length>0}shouldShowPayment(e){let t=this.filter;return!t||t.length==0?!0:t.filter(c=>c.type=="PaymentTypeMapping"&&c.paymentTypeId==e.id).length>0}shouldShowAnyPayments(){for(let e of this.paymentTypes)if(this.shouldShowPayment(e))return!0;return!1}shouldShowAnyOthers(){for(let e of this.otherMappings)if(this.shouldShowOther(e))return!0;return!1}shouldShowOther(e){let t=this.filter;return!t||t.length==0?!0:t.filter(c=>c.type=="OtherAccountMapping"&&c.mapType==e).length>0}shouldShowDepartment(){return this.filter==null||this.filter.length==0}finished(){if(!this.callbackto){alert("missing callbackto, contact developer");return}this.callbackto.mappingCompleted()}get allTaxesWithoutZero(){return this.allTaxes.taxes}static \u0275fac=function(t){return new(t||i)(h(De),h(Ze),h(ke),h(We),h(Wi),h(on))};static \u0275cmp=w({type:i,selectors:[["app-account-mappings"]],inputs:{callbackto:"callbackto",filter:"filter"},decls:15,vars:14,consts:[["class","missingmappingwarning",4,"ngIf"],["class","head",4,"ngIf"],["class","productmapping",3,"inverted",4,"ngIf"],[1,"finishbutton"],["mat-flat-button","","color","primary",3,"click"],[1,"missingmappingwarning"],[1,"head"],[1,"productmapping"],[1,"productrow"],[1,"productname"],[4,"ngFor","ngForOf"],["class","productmappingrow header",4,"ngIf"],[1,"productmappingrow","header"],[1,"taxpercent"],[4,"ngIf"],["class","productrow",4,"ngIf"],["class","productmappingrow",3,"product","tax","taxperiode",4,"ngIf"],[1,"productmappingrow",3,"product","tax","taxperiode"],[3,"tax"],[3,"type",4,"ngIf"],[3,"type"],[3,"department"]],template:function(t,n){t&1&&(f(0,cd,3,3,"div",0)(1,ld,3,3,"div",1)(2,Cd,6,4,"div",2)(3,xd,3,3,"div",1)(4,wd,2,3,"div",2)(5,Sd,3,3,"div",1)(6,Dd,2,3,"div",2)(7,Pd,3,3,"div",1)(8,kd,2,3,"div",2)(9,Ad,3,3,"div",1)(10,Fd,2,3,"div",2),a(11,"div",3)(12,"button",4),C("click",function(){return n.finished()}),l(13),u(14,"translate"),r()()),t&2&&(s("ngIf",n.filter!=null&&n.filter.length>0),o(),s("ngIf",n.loaded&&n.hasAnyProducts()),o(),s("ngIf",n.loaded&&n.accounts&&n.hasAnyProducts()),o(),s("ngIf",n.loaded&&n.hasAnyTaxes()),o(),s("ngIf",n.loaded&&n.hasAnyTaxes()),o(),s("ngIf",n.loaded&&n.shouldShowAnyPayments()),o(),s("ngIf",n.loaded&&n.shouldShowAnyPayments()),o(),s("ngIf",n.loaded&&n.shouldShowAnyOthers()),o(),s("ngIf",n.loaded&&n.shouldShowAnyOthers()),o(),s("ngIf",n.loaded&&n.shouldShowDepartment()),o(),s("ngIf",n.loaded&&n.shouldShowDepartment()),o(3),m(" ",v(14,12,"commerce.mapping.5")," "))},styles:[".productrow[_ngcontent-%COMP%]{display:flex;border-bottom:solid 1px #DDD}.productname[_ngcontent-%COMP%]{flex:1 1 30%}div.productrow[_ngcontent-%COMP%]:last-child{border-bottom:solid 0px #DDD}.productmapping[_ngcontent-%COMP%]{background-color:#fff;padding:20px;border-radius:5px}.productname[_ngcontent-%COMP%]{flex:1 1 100%}.productmappingrow[_ngcontent-%COMP%]{display:block;padding-bottom:5px;padding-top:5px;padding-left:10px;flex:0 0 130px;border-left:solid 1px #DDD}.productrow[_ngcontent-%COMP%]:hover{background-color:#efefef}.head[_ngcontent-%COMP%]{font-size:16px;margin-top:20px;padding-left:10px;padding-bottom:10px}app-account-product-map[_ngcontent-%COMP%]:last-child{border-bottom:solid 0px #DDD!important;margin-bottom:0;padding-bottom:0}.productmappingrow.header[_ngcontent-%COMP%]{font-size:12px;color:#666}.taxpercent[_ngcontent-%COMP%]{color:#333;font-size:15px;font-weight:500}.missingmappingwarning[_ngcontent-%COMP%]{background-color:red;color:#fff;text-align:center;padding:10px;border-radius:5px}.productmapping.inverted[_ngcontent-%COMP%]{background-color:#efefef}.finishbutton[_ngcontent-%COMP%]{padding:20px;text-align:center}"]})}return i})();function Vd(i,p){if(i&1&&(a(0,"div",2)(1,"div",3)(2,"div",4),l(3),r(),a(4,"div",5),l(5),r()(),a(6,"div",6),l(7," Select "),r()()),i&2){let e=p.$implicit;o(3),m(" ",e.accountNumber," "),o(2),m(" ",e.description," "),o(),s("mat-dialog-close",e)}}var mi=(()=>{class i{accountingController;accounts;constructor(e){this.accountingController=e,this.accountingController.getAccounts().subscribe(t=>{this.accounts=t})}static \u0275fac=function(t){return new(t||i)(h(De))};static \u0275cmp=w({type:i,selectors:[["app-accounting-account-picker-dialog"]],decls:15,vars:3,consts:[["mat-dialog-title",""],["class","row",4,"ngFor","ngForOf"],[1,"row"],[1,"desc"],[1,"number"],[1,"description"],[1,"button",3,"mat-dialog-close"],[3,"align"],["mat-flat-button","",3,"mat-dialog-close"]],template:function(t,n){t&1&&(a(0,"h2",0),l(1," Select account "),r(),a(2,"mat-dialog-content"),f(3,Vd,8,3,"div",1),a(4,"div",2)(5,"div",3)(6,"div",4),l(7," None "),r(),a(8,"div",5),l(9," Will be unselected "),r()(),a(10,"div",6),l(11," Select "),r()()(),a(12,"mat-dialog-actions",7)(13,"button",8),l(14," Close "),r()()),t&2&&(o(3),s("ngForOf",n.accounts),o(7),s("mat-dialog-close",!1),o(2),s("align","end"))},dependencies:[T,de,be,oe,K,O],styles:[".row[_ngcontent-%COMP%]{display:flex;border-bottom:solid 1px #DDD;padding-bottom:10px;margin-bottom:10px;gap:10px}div.row[_ngcontent-%COMP%]:last-child{border-bottom:solid 0px}.row[_ngcontent-%COMP%]   .button[_ngcontent-%COMP%]{flex:0 0 40px;height:15px;padding:10px;border-radius:5px;cursor:pointer}.description[_ngcontent-%COMP%]{font-size:13px;color:#666}.row[_ngcontent-%COMP%]   .button[_ngcontent-%COMP%]:hover{background-color:#efefef}.row[_ngcontent-%COMP%]   .desc[_ngcontent-%COMP%]{flex:1 1 90%}"]})}return i})();function Bd(i,p){if(i&1&&(a(0,"span"),l(1),r()),i&2){let e=d(3);o(),m(" ",e.selectedAccount.accountNumber," ")}}function Rd(i,p){i&1&&(a(0,"span"),l(1," Not selected "),r())}function Nd(i,p){if(i&1){let e=S();a(0,"div",4),C("click",function(){y(e);let n=d(2);return b(n.pickAccount())}),_(1,"i",5),f(2,Bd,2,1,"span",1)(3,Rd,2,0,"span",1),r()}if(i&2){let e=d(2);o(2),s("ngIf",e.selectedAccount),o(),s("ngIf",!e.selectedAccount)}}function Ld(i,p){i&1&&(a(0,"div"),l(1," - "),r())}function jd(i,p){if(i&1&&(a(0,"div",2),f(1,Nd,4,2,"div",3)(2,Ld,2,0,"div",1),r()),i&2){let e=d();ee("missing",!e.selectedAccount),o(),s("ngIf",e.exists),o(),s("ngIf",!e.exists)}}function Ud(i,p){i&1&&(a(0,"div"),l(1,` -
`),r())}var fr=(()=>{class i{dialog;accountingController;parent;product;tax;taxPeriode;selectedAccount;exists=!1;constructor(e,t,n){this.dialog=e,this.accountingController=t,this.parent=n}ngAfterViewInit(){let e=this.parent.productMappings.filter(t=>t.taxCategory==this.tax.category&&t.productId==this.product.id&&t.periodeNumber==this.taxPeriode.periodeNumber);e&&e.length&&(this.selectedAccount=this.parent.accounts.filter(t=>t.id==e[0].accountId)[0]),this.exists=this.isInProductMappings()}pickAccount(){this.dialog.open(mi).afterClosed().subscribe(t=>{if(t!=null){let n={};n.accountId=t===!1?"":t.id,n.periodeNumber=this.taxPeriode.periodeNumber,n.taxCategory=this.tax.category,n.productId=this.product.id,this.accountingController.saveProductMapping(n).subscribe(c=>{this.selectedAccount=t})}})}shouldShow(){return this.parent.shouldShowProduct(this.product,this.tax,this.taxPeriode)}isInProductMappings(){let e=this.parent.getTaxCategories(this.product);return console.log(this.product.defaultName,e,this.taxPeriode.id),e.indexOf(this.taxPeriode.id)>-1}static \u0275fac=function(t){return new(t||i)(h(q),h(De),h(vt))};static \u0275cmp=w({type:i,selectors:[["app-account-product-map"]],inputs:{product:"product",tax:"tax",taxPeriode:[0,"taxperiode","taxPeriode"]},decls:2,vars:2,consts:[["class","row",3,"missing",4,"ngIf"],[4,"ngIf"],[1,"row"],["class","selectaccount",3,"click",4,"ngIf"],[1,"selectaccount",3,"click"],[1,"fa","fa-edit"]],template:function(t,n){t&1&&f(0,jd,3,4,"div",0)(1,Ud,2,0,"div",1),t&2&&(s("ngIf",n.shouldShow()),o(),s("ngIf",!n.shouldShow()))},dependencies:[M],styles:[".row[_ngcontent-%COMP%]{display:flex;gap:20px;font-size:14px}.productinfo[_ngcontent-%COMP%]{flex:0 0 300px}.tax[_ngcontent-%COMP%]{font-size:12px;font-style:italic;color:#666}.row[_ngcontent-%COMP%]{cursor:pointer}.missing[_ngcontent-%COMP%]{color:red}"]})}return i})();function Hd(i,p){i&1&&(a(0,"div"),l(1," Not selected "),r())}function $d(i,p){if(i&1&&(a(0,"div"),l(1),r()),i&2){let e=d();o(),m(" ",e.account.accountNumber," ")}}var gr=(()=>{class i{dialog;accountingController;parent;tax;selectedMapping;constructor(e,t,n){this.dialog=e,this.accountingController=t,this.parent=n}ngAfterViewInit(){this.selectedMapping=this.parent.taxMappings.filter(e=>e.category==this.tax.category)[0]}get account(){return this.selectedMapping?this.parent.accounts.filter(e=>e.id==this.selectedMapping.accountId)[0]:null}showAccountPicker(){this.dialog.open(mi).afterClosed().subscribe(t=>{let n={};n.accountId=t.id,n.category=this.tax.category,this.accountingController.saveTaxMapping(n).subscribe(c=>{this.selectedMapping=n})})}static \u0275fac=function(t){return new(t||i)(h(q),h(De),h(vt))};static \u0275cmp=w({type:i,selectors:[["app-tax-mapping"]],inputs:{tax:"tax"},decls:8,vars:3,consts:[[1,"row"],[1,"name"],[1,"fa","fa-edit",3,"click"],[1,"fa","fa-arrows-h"],[4,"ngIf"]],template:function(t,n){t&1&&(a(0,"div",0)(1,"div",1)(2,"i",2),C("click",function(){return n.showAccountPicker()}),r(),l(3),r(),a(4,"div"),_(5,"i",3),r(),f(6,Hd,2,0,"div",4)(7,$d,2,1,"div",4),r()),t&2&&(o(3),m(" ",n.tax.description," "),o(3),s("ngIf",!n.selectedMapping),o(),s("ngIf",n.selectedMapping&&n.account))},dependencies:[M],styles:[".row[_ngcontent-%COMP%]{display:flex;gap:10px}.name[_ngcontent-%COMP%]{flex:0 0 200px}"]})}return i})();function Gd(i,p){i&1&&(a(0,"div"),l(1," Not selected "),r())}function qd(i,p){if(i&1&&(a(0,"div"),l(1),r()),i&2){let e=d();o(),m(" ",e.account.accountNumber," ")}}var _r=(()=>{class i{dialog;accountingController;parent;paymentType;selectedMapping;constructor(e,t,n){this.dialog=e,this.accountingController=t,this.parent=n}ngAfterViewInit(){this.selectedMapping=this.parent.paymentTypeMappings.filter(e=>e.paymentTypeId==this.paymentType.id)[0]}get account(){return this.selectedMapping?this.parent.accounts.filter(e=>e.id==this.selectedMapping.accountId)[0]:null}showAccountPicker(){this.dialog.open(mi).afterClosed().subscribe(t=>{let n={};n.accountId=t.id,n.paymentTypeId=this.paymentType.id,this.accountingController.savePaymentTypeMapping(n).subscribe(c=>{this.selectedMapping=n})})}static \u0275fac=function(t){return new(t||i)(h(q),h(De),h(vt))};static \u0275cmp=w({type:i,selectors:[["app-payment-mapping"]],inputs:{paymentType:[0,"type","paymentType"]},decls:8,vars:3,consts:[[1,"row"],[1,"name"],[1,"fa","fa-edit",3,"click"],[1,"fa","fa-arrows-h"],[4,"ngIf"]],template:function(t,n){t&1&&(a(0,"div",0)(1,"div",1)(2,"i",2),C("click",function(){return n.showAccountPicker()}),r(),l(3),r(),a(4,"div"),_(5,"i",3),r(),f(6,Gd,2,0,"div",4)(7,qd,2,1,"div",4),r()),t&2&&(o(3),m(" ",n.paymentType.name," "),o(3),s("ngIf",!n.selectedMapping),o(),s("ngIf",n.selectedMapping&&n.account))},dependencies:[M],styles:[".row[_ngcontent-%COMP%]{display:flex;gap:10px}.name[_ngcontent-%COMP%]{flex:0 0 200px}"]})}return i})();function Qd(i,p){i&1&&(a(0,"div"),l(1," Not selected "),r())}function zd(i,p){if(i&1&&(a(0,"div"),l(1),r()),i&2){let e=d();o(),m(" ",e.account.accountNumber," ")}}var vr=(()=>{class i{dialog;parent;accountingController;mapType="";selectedMapping;constructor(e,t,n){this.dialog=e,this.parent=t,this.accountingController=n}ngAfterViewInit(){this.selectedMapping=this.parent.otherTypes.filter(e=>e.mapType==this.mapType)[0]}get account(){return this.selectedMapping?this.parent.accounts.filter(e=>e.id==this.selectedMapping.accountId)[0]:null}showAccountPicker(){this.dialog.open(mi).afterClosed().subscribe(t=>{let n={};n.accountId=t.id,n.mapType=this.mapType,this.accountingController.saveOtherMapping(n).subscribe(c=>{this.selectedMapping=n})})}static \u0275fac=function(t){return new(t||i)(h(q),h(vt),h(De))};static \u0275cmp=w({type:i,selectors:[["app-other-mapping"]],inputs:{mapType:[0,"type","mapType"]},decls:9,vars:5,consts:[[1,"row"],[1,"name"],[1,"fa","fa-edit",3,"click"],[1,"fa","fa-arrows-h"],[4,"ngIf"]],template:function(t,n){t&1&&(a(0,"div",0)(1,"div",1)(2,"i",2),C("click",function(){return n.showAccountPicker()}),r(),l(3),u(4,"translate"),r(),a(5,"div"),_(6,"i",3),r(),f(7,Qd,2,0,"div",4)(8,zd,2,1,"div",4),r()),t&2&&(o(3),m(" ",v(4,3,"commerce.symantics."+n.mapType)," "),o(4),s("ngIf",!n.selectedMapping),o(),s("ngIf",n.selectedMapping&&n.account))},dependencies:[M,E],styles:[".row[_ngcontent-%COMP%]{display:flex;gap:10px}.name[_ngcontent-%COMP%]{flex:0 0 200px}"]})}return i})();var rn=(()=>{class i{httpService;urlService;constructor(e,t){this.httpService=e,this.urlService=t}deleteDayInvoicePaymentLinesBatch(e){let t=[];t.push({name:"id",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/accountingsystem/deleteDayInvoicePaymentLinesBatch",null,{params:n})}deleteTransfer(e){let t=[];t.push({name:"id",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/accountingsystem/undo",null,{params:n})}disconnect(){return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/accountingsystem/disconnect",null)}getAll(){return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/accountingsystem/all")}getTransferHistory(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/accountingsystem/history",e,{headers:t})}getTransferHistoryBankTransfer(e){let t=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/accountingsystem/history_bank",e,{headers:t})}init(e,t){let n=[];n.push({name:"id",value:e});let c=new $;for(let x of n)c=c.append(x.name,x.value);let g=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/accountingsystem/init",t,{headers:g,params:c})}retransferBatch(e){let t=[];t.push({name:"batchId",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/accountingsystem/retransfer",null,{params:n})}transferRemaining(){return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/accountingsystem/transferRemaining",null)}uploadRemaining(){return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/accountingsystem/uploadRemaining",null)}static \u0275fac=function(t){return new(t||i)(Y(_e),Y(ve))};static \u0275prov=re({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();function Wd(i,p){if(i&1){let e=S();a(0,"div",7),C("click",function(){let n=y(e).$implicit,c=d(2);return b(c.selectSystem(n))}),l(1),a(2,"div",8),l(3),r()()}if(i&2){let e=p.$implicit;o(),m(" ",e.name," "),o(2),m(" ",e.description," ")}}function Kd(i,p){if(i&1&&(a(0,"div"),f(1,Wd,4,2,"div",6),r()),i&2){let e=d();o(),s("ngForOf",e.systems)}}function Xd(i,p){i&1&&(a(0,"div"),l(1," You will now be transferred to your accounting system where you need to authenticate yourself. "),_(2,"br")(3,"br"),r())}function Yd(i,p){if(i&1&&(a(0,"mat-form-field",13)(1,"mat-label"),l(2),r(),_(3,"input",14),r()),i&2){let e=d().$implicit,t=d(2);o(2),m(" ",t.selectedSystem.configVariables[e]," "),o(),s("formControlName",e)}}function Jd(i,p){if(i&1&&(a(0,"div"),f(1,Yd,4,2,"mat-form-field",12),r()),i&2){let e=p.$implicit;o(),s("ngIf",e!="oauthurl")}}function Zd(i,p){i&1&&(a(0,"div",15),l(1),u(2,"translate"),r()),i&2&&(o(),m(" ",v(2,1,"commerce.accountingapiconnect.9")," "))}function em(i,p){if(i&1&&(a(0,"div"),f(1,Xd,4,0,"div",1),a(2,"div")(3,"form",9),f(4,Jd,2,1,"div",10),r()(),f(5,Zd,3,3,"div",11),r()),i&2){let e=d();o(),s("ngIf",e.isOauth()),o(2),s("formGroup",e.formGroup),o(),s("ngForOf",e.variables),o(),s("ngIf",e.failed)}}function tm(i,p){if(i&1){let e=S();a(0,"button",16),C("click",function(){y(e);let n=d();return b(n.testAndSave())}),l(1," Next "),r()}if(i&2){let e=d();s("disabled",!e.formGroup.valid)}}function im(i,p){if(i&1){let e=S();a(0,"button",17),C("click",function(){y(e);let n=d();return b(n.redirectToOauth())}),l(1," Authenticate "),r()}}var Cr=(()=>{class i{accountingSystemController;dialogRef;systems;formGroup=new gi({});selectedSystem;failed=!1;constructor(e,t){this.accountingSystemController=e,this.dialogRef=t,this.accountingSystemController.getAll().subscribe(n=>{this.systems=n})}selectSystem(e){this.selectedSystem=e,this.formGroup=new gi({}),this.variables.forEach(t=>{this.formGroup.addControl(t,new Ee("",[ce.required]))})}get variables(){return Object.keys(this.selectedSystem.configVariables)}testAndSave(){let e={};this.variables.forEach(t=>{e[t]=this.formGroup.value[t]}),this.failed=!1,this.accountingSystemController.init(this.selectedSystem.id,e).subscribe(t=>{t?this.dialogRef.close(!0):this.failed=!0})}isOauth(){return!this.selectedSystem||!this.selectedSystem.configVariables?!1:Object.keys(this.selectedSystem.configVariables).indexOf("oauthurl")>-1}redirectToOauth(){let e={};this.variables.forEach(t=>{e[t]=this.formGroup.value[t]}),this.accountingSystemController.init(this.selectedSystem.id,e).subscribe(t=>{Fn()?document.location="http://localhost:8080"+this.selectedSystem.configVariables.oauthurl:document.location="https://auth.thundertech.no"+this.selectedSystem.configVariables.oauthurl})}static \u0275fac=function(t){return new(t||i)(h(rn),h(te))};static \u0275cmp=w({type:i,selectors:[["app-accounting-system-picker"]],decls:12,vars:12,consts:[["mat-dialog-title",""],[4,"ngIf"],[3,"align"],["mat-flat-button","",3,"mat-dialog-close"],["mat-flat-button","","color","primary",3,"disabled","click",4,"ngIf"],["mat-flat-button","",3,"click",4,"ngIf"],["class","system",3,"click",4,"ngFor","ngForOf"],[1,"system",3,"click"],[1,"description"],[3,"formGroup"],[4,"ngFor","ngForOf"],["class","failed",4,"ngIf"],["class","example-full-width",4,"ngIf"],[1,"example-full-width"],["matInput","","placeholder","","value","",3,"formControlName"],[1,"failed"],["mat-flat-button","","color","primary",3,"click","disabled"],["mat-flat-button","",3,"click"]],template:function(t,n){t&1&&(a(0,"div",0),l(1),u(2,"translate"),r(),a(3,"mat-dialog-content"),f(4,Kd,2,1,"div",1)(5,em,6,4,"div",1),r(),a(6,"mat-dialog-actions",2)(7,"button",3),l(8),u(9,"translate"),r(),f(10,tm,2,1,"button",4)(11,im,2,0,"button",5),r()),t&2&&(o(),m(" ",v(2,8,"commerce.accountingapiconnect.8"),`
`),o(3),s("ngIf",!n.selectedSystem),o(),s("ngIf",n.selectedSystem),o(),s("align","end"),o(),s("mat-dialog-close",!1),o(),m(" ",v(9,10,"common.activate_feature.4")," "),o(2),s("ngIf",!n.isOauth()&&n.selectedSystem),o(),s("ngIf",n.isOauth()))},dependencies:[T,M,de,be,oe,K,B,H,G,Ce,U,V,ae,xe,ye,O,E],styles:[".description[_ngcontent-%COMP%]{font-size:12px;color:#666;padding:5px}.system[_ngcontent-%COMP%]{border-radius:5px;padding:10px;cursor:pointer}.system[_ngcontent-%COMP%]:hover{background-color:#efefef}.failed[_ngcontent-%COMP%]{color:red;padding:10px;max-width:189px;margin:0 auto;display:block;border:solid 1px red}"]})}return i})();var nm=i=>({type:i});function om(i,p){i&1&&(a(0,"div"),_(1,"i",7),r())}function rm(i,p){if(i&1&&(a(0,"div",10),l(1),r()),i&2){let e=d().$implicit,t=d(2);o(),dt(" Product - ",t.products.get(e.productId).defaultName," - ",t.getTax(t.getTaxPeriode(e.taxPeriodeId).taxCategory).description," - ",t.getTaxPeriode(e.taxPeriodeId).percent,"% ")}}function am(i,p){if(i&1&&(a(0,"div",10),l(1),r()),i&2){let e=d().$implicit,t=d(2);o(),ge(" Tax mapping - ",t.getTax(t.getTaxPeriode(e.taxPeriodeId).taxCategory).description," - ",t.getTaxPeriode(e.taxPeriodeId).percent,"% ")}}function cm(i,p){if(i&1&&(a(0,"div",10),l(1),r()),i&2){let e=d().$implicit;o(),m(" Payment method - ",e.paymentTypeId," ")}}function lm(i,p){if(i&1&&(a(0,"div"),l(1),u(2,"translate"),r()),i&2){let e=d().$implicit;o(),m(" ",F(2,1,"commerce.transferaccountingsystemfailed.3",nt(4,nm,e.type))," ")}}function sm(i,p){if(i&1&&(a(0,"div"),f(1,rm,2,3,"div",9)(2,am,2,2,"div",9)(3,cm,2,1,"div",9)(4,lm,3,6,"div",3),r()),i&2){let e=p.$implicit;o(),s("ngIf",e.type=="AccountingDayProductEntry"),o(),s("ngIf",e.type=="AccountingDayTaxEntry"),o(),s("ngIf",e.type=="AccountingDayPaymentEntry"),o(),s("ngIf",e.type!="AccountingDayProductEntry"&&e.type!="AccountingDayTaxEntry"&&e.type!="AccountingDayPaymentEntry")}}function pm(i,p){if(i&1&&(a(0,"div"),f(1,sm,5,4,"div",8),r()),i&2){let e=d();o(),s("ngForOf",e.errors)}}var xr=(()=>{class i{productController;taxController;userService;router;dialogRef;route;_errors;loading=!0;products=new Map;taxes;set errors(e){this._errors=e,this.loadData()}get errors(){return this._errors}constructor(e,t,n,c,g,x){this.productController=e,this.taxController=t,this.userService=n,this.router=c,this.dialogRef=g,this.route=x}loadData(){let e=this.errors.filter(n=>n.type=="AccountingDayProductEntry").map(n=>n.productId),t=[this.productController.getProductsById(e),this.taxController.getTaxes()];Qe(t).subscribe(n=>{n[0].forEach(c=>{this.products.set(c.id,c)}),this.taxes=n[1].taxes,this.loading=!1,console.log(n)})}getTaxPeriode(e){for(let t of this.taxes)for(let n of t.periodes)if(n.id==e)return n;return null}getTax(e){for(let t of this.taxes)if(t.category==e)return t;return null}goToMapping(){this.router.navigate(["/front/"+this.userService.getTenant().id+"/booking/settings/accountingplus/mapping"]),this.dialogRef.close()}static \u0275fac=function(t){return new(t||i)(h(ke),h(Wi),h(Ze),h(Zt),h(te),h(Jt))};static \u0275cmp=w({type:i,selectors:[["app-transfer-accounting-system-failed-dialog"]],decls:14,vars:9,consts:[["mat-dialog-title",""],["mat-dialog-content",""],[1,"info"],[4,"ngIf"],["mat-dialog-actions","",3,"align"],["mat-button","","mat-dialog-close",""],["mat-flat-button","",3,"click"],[1,"fa","fa-spin","fa-spinner"],[4,"ngFor","ngForOf"],["class","missingrow",4,"ngIf"],[1,"missingrow"]],template:function(t,n){t&1&&(a(0,"h1",0),l(1),u(2,"translate"),r(),a(3,"div",1)(4,"div",2),l(5),u(6,"translate"),r(),f(7,om,2,0,"div",3)(8,pm,2,1,"div",3),r(),a(9,"div",4)(10,"button",5),l(11," Maybe later "),r(),a(12,"button",6),C("click",function(){return n.goToMapping()}),l(13," Go to mapping "),r()()),t&2&&(o(),m(" ",v(2,5,"commerce.transferaccountingsystemfailed.1"),`
`),o(4),m(" ",v(6,7,"commerce.transferaccountingsystemfailed.2")," "),o(2),s("ngIf",n.loading),o(),s("ngIf",!n.loading),o(),s("align","end"))},dependencies:[T,M,de,be,oe,K,O,E],styles:[".missingrow[_ngcontent-%COMP%]{color:red;padding:5px;margin-top:5px}.info[_ngcontent-%COMP%]{background-color:#eaffa3;border-radius:5px;margin-bottom:10px;padding:5px}"]})}return i})();function dm(i,p){i&1&&(a(0,"mat-error"),l(1),u(2,"translate"),r()),i&2&&(o(),m(" ",v(2,1,"booking.availability.4")," "))}function mm(i,p){i&1&&(a(0,"mat-error"),l(1),u(2,"translate"),r()),i&2&&(o(),m(" ",v(2,1,"booking.availability.5")," "))}var yr=(()=>{class i{controller;dialogRef;constructor(e,t){this.controller=e,this.dialogRef=t}range=new Me({start:new R,end:new R});markAsTransferred(){this.controller.markAsTransferred(this.range.value.start,this.range.value.end).subscribe(e=>{this.dialogRef.close()})}static \u0275fac=function(t){return new(t||i)(h(wt),h(te))};static \u0275cmp=w({type:i,selectors:[["app-mark-periode-as-transferred-dialog"]],decls:19,vars:9,consts:[["picker",""],[1,"form"],[1,"",3,"formGroup"],[1,"daterangepicker",3,"formGroup","rangePicker"],["matStartDate","","formControlName","start","placeholder","Start date"],["matEndDate","","formControlName","end","placeholder","End date"],["matSuffix","",3,"for"],[4,"ngIf"],[2,"max-width","300px"],["mat-flat-button","","color","primary",3,"click"]],template:function(t,n){if(t&1){let c=S();a(0,"mat-dialog-content")(1,"div",1)(2,"mat-form-field",2)(3,"mat-label"),l(4),u(5,"translate"),r(),a(6,"mat-date-range-input",3),_(7,"input",4)(8,"input",5),r(),_(9,"mat-datepicker-toggle",6)(10,"mat-date-range-picker",null,0),f(12,dm,3,3,"mat-error",7)(13,mm,3,3,"mat-error",7),r(),a(14,"div",8),l(15," If you have data that you dont want to transmit, use this form and select the timeframe you want to be marked as transferred. If you do this the days for this periode will not be transferred. "),r(),_(16,"br"),a(17,"button",9),C("click",function(){return y(c),b(n.markAsTransferred())}),l(18," Mark as transferred "),r()()()}if(t&2){let c=fe(11);o(2),s("formGroup",n.range),o(2),I(v(5,7,"booking.availability.3")),o(2),s("formGroup",n.range)("rangePicker",c),o(3),s("for",c),o(3),s("ngIf",n.range.controls.start.hasError("matStartDateInvalid")),o(),s("ngIf",n.range.controls.end.hasError("matEndDateInvalid"))}},dependencies:[M,K,B,H,Ni,rt,at,Ot,kt,At,Ft,U,V,ae,xe,ye,O,E],styles:[".form[_ngcontent-%COMP%]{text-align:center}"]})}return i})();function um(i,p){i&1&&(a(0,"div"),_(1,"i",3),l(2,` Loading...
`),r())}function fm(i,p){if(i&1&&(a(0,"div"),_(1,"app-account-mappings",4),r()),i&2){let e=d();o(),s("callbackto",e)("filter",e.missingMappingsAccount)}}function gm(i,p){if(i&1){let e=S();a(0,"div",5)(1,"button",6)(2,"mat-icon"),l(3,"more_vert"),r()(),a(4,"mat-menu",null,0)(6,"button",7),C("click",function(){y(e);let n=d();return b(n.uploadRemainingRecords())}),a(7,"mat-icon"),l(8,"upload"),r(),a(9,"span"),l(10,"Transfer to accounting system"),r()(),a(11,"button",7),C("click",function(){y(e);let n=d();return b(n.showMarkPeriodeAsTransferred())}),a(12,"mat-icon"),l(13,"edit"),r(),a(14,"span"),l(15,"Mark periode as transferred"),r()(),a(16,"button",7),C("click",function(){y(e);let n=d();return b(n.undoTransferredToAccounting())}),a(17,"mat-icon"),l(18,"undo"),r(),a(19,"span"),l(20,"Undo transfer from economy to accounting for none transferred records"),r()()(),a(21,"div",8),l(22),r()()}if(i&2){let e=fe(5),t=d();o(),s("matMenuTriggerFor",e),o(21),m(" You have ",t.getDaysNotTransferred().length," day(s) that has not yet been transferred. ")}}function _m(i,p){if(i&1&&(a(0,"div",13)(1,"div",14),l(2),r(),a(3,"div",15),l(4),r(),a(5,"div",16),l(6),r()()),i&2){let e=p.$implicit;o(2),m(" ",e.account.accountNumber," "),o(2),m(" ",e.debitAmount," "),o(2),m(" ",e.creditAmount," ")}}function vm(i,p){if(i&1&&(a(0,"div",11)(1,"div"),l(2),r(),a(3,"div"),f(4,_m,7,3,"div",12),r()()),i&2){let e=p.$implicit,t=d(3);o(2),m(" ",e," "),o(2),s("ngForOf",t.daysToTransfer[e])}}function hm(i,p){if(i&1&&(a(0,"div"),f(1,vm,5,2,"div",10),r()),i&2){let e=d(2);o(),s("ngForOf",e.getDaysNotTransferred())}}function Cm(i,p){i&1&&(a(0,"div"),l(1," All records has been transferred. "),r())}function xm(i,p){if(i&1){let e=S();a(0,"div")(1,"div")(2,"i",17),C("click",function(){let n=y(e).$implicit,c=d(2);return b(c.undo(n.batchId))}),r(),l(3),r()()}if(i&2){let e=p.$implicit;o(3),ge(" ",e.batchId," | ",e.docCreatedDate," ")}}function ym(i,p){if(i&1&&(a(0,"div"),f(1,hm,2,1,"div",1)(2,Cm,2,0,"div",1)(3,xm,4,2,"div",9),r()),i&2){let e=d();o(),s("ngIf",e.getDaysNotTransferred().length>0),o(),s("ngIf",e.getDaysNotTransferred().length==0),o(),s("ngForOf",e.batches)}}var br=(()=>{class i{accountingController;dialog;batches=[];daysToTransfer;loaded=!1;missingMappings;constructor(e,t){this.accountingController=e,this.dialog=t,this.load()}load(){this.accountingController.getMissingMappings().subscribe(e=>{this.missingMappings=e,e.length?this.loaded=!0:this.accountingController.getDaysToTransfer().subscribe(t=>{this.daysToTransfer=t,this.loaded=!0})}),this.accountingController.getTransferredBatches().subscribe(e=>{this.batches=e})}get missingMappingsAccount(){return this.missingMappings.map(e=>e.mapping)}uploadRemainingRecords(){this.accountingController.uploadRemaning().subscribe(e=>{this.load()})}undo(e){prompt("Are you sure? enter yes if so")=="yes"&&this.accountingController.undoBatch(e).subscribe(n=>{this.load()})}getDaysNotTransferred(){return this.daysToTransfer?Object.keys(this.daysToTransfer):[]}showMarkPeriodeAsTransferred(){this.dialog.open(yr).afterClosed().subscribe(t=>{this.load()})}mappingCompleted(){this.load()}undoTransferredToAccounting(){prompt("This should never be done, do alt your own risk. type yes if you are sure!")=="yes"&&this.accountingController.undoTransferredToAccounting().subscribe(t=>{this.load()})}static \u0275fac=function(t){return new(t||i)(h(wt),h(q))};static \u0275cmp=w({type:i,selectors:[["app-accounting-transfer"]],decls:4,vars:4,consts:[["menu","matMenu"],[4,"ngIf"],["class","menubox",4,"ngIf"],[1,"fa","fa-spin","fa-spinner"],[3,"callbackto","filter"],[1,"menubox"],["mat-icon-button","","aria-label","Example icon-button with a menu",3,"matMenuTriggerFor"],["mat-menu-item","",3,"click"],[1,"text"],[4,"ngFor","ngForOf"],["class","day",4,"ngFor","ngForOf"],[1,"day"],["class","accountrow",4,"ngFor","ngForOf"],[1,"accountrow"],[1,"accountnumber"],[1,"debit"],[1,"credit"],[1,"fa","fa-undo",3,"click"]],template:function(t,n){t&1&&f(0,um,3,0,"div",1)(1,fm,2,2,"div",1)(2,gm,23,2,"div",2)(3,ym,4,3,"div",1),t&2&&(s("ngIf",!n.loaded),o(),s("ngIf",n.loaded&&n.missingMappings.length>0),o(),s("ngIf",n.loaded&&n.missingMappings.length==0),o(),s("ngIf",n.loaded&&n.missingMappings.length==0))},dependencies:[T,M,ze,yt,Tt,bt,ii,vt],styles:[".accountrow[_ngcontent-%COMP%]{display:flex;gap:20px;border-bottom:solid 1px #DDD;padding-left:20px}.accountrow[_ngcontent-%COMP%]   .accountnumber[_ngcontent-%COMP%], .accountrow[_ngcontent-%COMP%]   .credit[_ngcontent-%COMP%], .accountrow[_ngcontent-%COMP%]   .debit[_ngcontent-%COMP%]{flex:0 0 200px}.day[_ngcontent-%COMP%]{margin-top:20px;padding:10px}.menubox[_ngcontent-%COMP%]{background-color:#efefef;vertical-align:top;border-radius:5px}.menubox[_ngcontent-%COMP%]   .text[_ngcontent-%COMP%]{display:inline-block;vertical-align:top;margin-top:14px}"]})}return i})();var wm=["paginator"],Sm=["sorter"],Im=["paginatorBank"],Mm=["sorterBank"],wr=()=>[5,10,25,100,500];function Dm(i,p){if(i&1){let e=S();a(0,"div",13)(1,"div",14),l(2),u(3,"translate"),r(),a(4,"div",15),_(5,"i",16)(6,"br"),l(7),u(8,"translate"),_(9,"br"),a(10,"button",12),C("click",function(){y(e);let n=d();return b(n.setupAccountingSystem())}),l(11),u(12,"translate"),r()()()}i&2&&(o(2),m(" ",v(3,3,"commerce.accountingapiconnect.7")," "),o(5),m(" ",v(8,5,"commerce.accountingapiconnect.4")," "),o(4),m(" ",v(12,7,"commerce.accountingapiconnect.5")," "))}function Pm(i,p){if(i&1){let e=S();a(0,"div")(1,"button",17),C("click",function(){y(e);let n=d();return b(n.disconnect())}),l(2,"Disconnect system"),r()()}}function Em(i,p){if(i&1&&(a(0,"div",18),l(1),r()),i&2){let e=d();o(),m(" ",e.activatedSystem.name,`
`)}}function Tm(i,p){if(i&1){let e=S();a(0,"div",18)(1,"mat-slide-toggle",19),Ie("ngModelChange",function(n){y(e);let c=d();return Se(c.autoTransfer,n)||(c.autoTransfer=n),b(n)}),C("change",function(n){y(e);let c=d();return b(c.changeAutoTransfer(n.checked))}),l(2),u(3,"translate"),r(),_(4,"br")(5,"br")(6,"br"),a(7,"mat-form-field",20)(8,"mat-label"),l(9),u(10,"translate"),r(),a(11,"input",21),Ie("ngModelChange",function(n){y(e);let c=d();return Se(c.overrideAccountingNumber,n)||(c.overrideAccountingNumber=n),b(n)}),r()(),l(12," \xA0 "),a(13,"mat-form-field",20)(14,"mat-label"),l(15),u(16,"translate"),r(),a(17,"input",21),Ie("ngModelChange",function(n){y(e);let c=d();return Se(c.overrideInvoiceNumber,n)||(c.overrideInvoiceNumber=n),b(n)}),r()(),_(18,"br"),a(19,"button",22),C("click",function(){y(e);let n=d();return b(n.save())}),l(20),u(21,"translate"),r()()}if(i&2){let e=d();o(),we("ngModel",e.autoTransfer),o(),m(" ",v(3,7,"commerce.accountingapiconnect.10")," "),o(7),m(" ",v(10,9,"commerce.accountingapiconnect.11")," "),o(2),we("ngModel",e.overrideAccountingNumber),o(4),m(" ",v(16,11,"commerce.accountingapiconnect.12")," "),o(2),we("ngModel",e.overrideInvoiceNumber),o(3),m(" ",v(21,13,"commerce.listview.5")," ")}}function km(i,p){i&1&&(a(0,"div",43),_(1,"i",44),l(2," No records found "),r())}function Am(i,p){i&1&&_(0,"i",53)}function Om(i,p){i&1&&_(0,"i",35)}function Fm(i,p){i&1&&_(0,"i",53)}function Vm(i,p){i&1&&_(0,"i",35)}function Bm(i,p){if(i&1&&(a(0,"div",48)(1,"div",49),f(2,Am,1,0,"i",50)(3,Om,1,0,"i",51),r(),a(4,"div",49),f(5,Fm,1,0,"i",50)(6,Vm,1,0,"i",51),r(),a(7,"div",52),l(8),u(9,"date"),r()()),i&2){let e=p.$implicit;o(2),s("ngIf",!e.transferredToAccountingSystem),o(),s("ngIf",e.transferredToAccountingSystem),o(2),s("ngIf",!e.invoicePaymentsTransferredToAccounting),o(),s("ngIf",e.invoicePaymentsTransferredToAccounting),o(2),m(" ",v(9,5,e.start)," ")}}function Rm(i,p){i&1&&(Q(0),l(1," Upload remaining records. "),z())}function Nm(i,p){i&1&&(Q(0),_(1,"i",54),z())}function Lm(i,p){if(i&1){let e=S();a(0,"div"),f(1,Bm,10,7,"div",45),a(2,"div",46)(3,"button",47),C("click",function(){y(e);let n=d(3);return b(n.upload())}),f(4,Rm,2,0,"ng-container",8)(5,Nm,2,0,"ng-container",8),r()()()}if(i&2){let e=d(3);o(),s("ngForOf",e.days),o(2),s("disabled",e.transferring),o(),s("ngIf",!e.transferring),o(),s("ngIf",e.transferring)}}function jm(i,p){if(i&1&&(a(0,"div",23)(1,"div",14),l(2),u(3,"translate"),r(),a(4,"div",34),_(5,"i",35),l(6),r(),a(7,"div",36)(8,"div"),_(9,"mat-datepicker-toggle",37),r(),a(10,"div",38)(11,"mat-date-range-input",39),_(12,"input",40)(13,"input",41),r()(),_(14,"mat-date-range-picker",null,4),r(),a(16,"div"),f(17,km,3,0,"div",42)(18,Lm,6,4,"div",8),r()()),i&2){let e=fe(15),t=d(2);o(2),m(" ",v(3,7,"commerce.accountingapiconnect.6")," "),o(4),m(" ",t.activatedSystem.name," "),o(3),s("for",e),o(2),s("formGroup",t.range)("rangePicker",e),o(6),s("ngIf",!t.days||!t.days.length),o(),s("ngIf",t.days&&t.days.length)}}function Um(i,p){i&1&&(a(0,"th",55),l(1,"Batch number"),r())}function Hm(i,p){if(i&1&&(a(0,"td",56),l(1),r()),i&2){let e=p.$implicit;o(),m(" ",e.batchNumber," ")}}function $m(i,p){i&1&&(a(0,"th",55),l(1,"Date created"),r())}function Gm(i,p){if(i&1&&(a(0,"td",56),l(1),u(2,"date"),r()),i&2){let e=p.$implicit;o(),m(" ",F(2,1,e.docCreatedDate,"short")," ")}}function qm(i,p){i&1&&(a(0,"th",55),l(1,"Date created"),r())}function Qm(i,p){if(i&1){let e=S();a(0,"td",56)(1,"i",57),C("click",function(){let n=y(e).$implicit,c=d(2);return b(c.resend(n))}),r(),l(2," \xA0\xA0\xA0 "),a(3,"i",58),C("click",function(){let n=y(e).$implicit,c=d(2);return b(c.delete(n))}),r()()}}function zm(i,p){i&1&&_(0,"tr",59)}function Wm(i,p){i&1&&_(0,"tr",60)}function Km(i,p){i&1&&(a(0,"tr",61)(1,"td",62),l(2," No data matching the filter "),r()())}function Xm(i,p){i&1&&(a(0,"th",55),l(1,"Batch number"),r())}function Ym(i,p){if(i&1&&(a(0,"td",56),l(1),r()),i&2){let e=p.$implicit;o(),m(" ",e.batchId," ")}}function Jm(i,p){i&1&&(a(0,"th",55),l(1,"Date created"),r())}function Zm(i,p){if(i&1&&(a(0,"td",56),l(1),u(2,"date"),r()),i&2){let e=p.$implicit;o(),m(" ",F(2,1,e.docCreatedDate,"short")," ")}}function e0(i,p){i&1&&(a(0,"th",55),l(1,"Date created"),r())}function t0(i,p){if(i&1){let e=S();a(0,"td",56)(1,"i",57),C("click",function(){let n=y(e).$implicit,c=d(2);return b(c.resendBank(n))}),r(),l(2," \xA0\xA0\xA0 "),a(3,"i",58),C("click",function(){let n=y(e).$implicit,c=d(2);return b(c.deleteBankTransfer(n))}),r()()}}function i0(i,p){i&1&&_(0,"tr",59)}function n0(i,p){i&1&&_(0,"tr",60)}function o0(i,p){i&1&&(a(0,"tr",61)(1,"td",62),l(2," No data matching the filter "),r()())}function r0(i,p){if(i&1&&(a(0,"div"),f(1,jm,19,9,"div",10),_(2,"br"),a(3,"div",23)(4,"h2"),l(5,"Transfer history"),r(),a(6,"table",24,0),Q(8,25),f(9,Um,2,0,"th",26)(10,Hm,2,1,"td",27),z(),Q(11,28),f(12,$m,2,0,"th",26)(13,Gm,3,4,"td",27),z(),Q(14,29),f(15,qm,2,0,"th",26)(16,Qm,4,0,"td",27),z(),f(17,zm,1,0,"tr",30)(18,Wm,1,0,"tr",31)(19,Km,3,0,"tr",32),r(),_(20,"mat-paginator",33,1),r(),a(22,"div",23)(23,"h2"),l(24,"Transfer history Bank"),r(),a(25,"table",24,2),Q(27,25),f(28,Xm,2,0,"th",26)(29,Ym,2,1,"td",27),z(),Q(30,28),f(31,Jm,2,0,"th",26)(32,Zm,3,4,"td",27),z(),Q(33,29),f(34,e0,2,0,"th",26)(35,t0,4,0,"td",27),z(),f(36,i0,1,0,"tr",30)(37,n0,1,0,"tr",31)(38,o0,3,0,"tr",32),r(),_(39,"mat-paginator",33,3),r()()),i&2){let e=d();o(),s("ngIf",e.connected),o(5),s("dataSource",e.dataSource),o(11),s("matHeaderRowDef",e.displayedColumns),o(),s("matRowDefColumns",e.displayedColumns),o(2),s("pageSizeOptions",Pe(9,wr)),o(5),s("dataSource",e.dataSourceBank),o(11),s("matHeaderRowDef",e.displayedColumnsBank),o(),s("matRowDefColumns",e.displayedColumnsBank),o(2),s("pageSizeOptions",Pe(10,wr))}}function a0(i,p){i&1&&(a(0,"div",23),_(1,"app-accounting-transfer"),r())}var tC=(()=>{class i{dialog;accountingController;accountController;accountingSystemController;systems;activatedSystem;dataSource;dataSourceBank;displayedColumns=["name","created","resend"];displayedColumnsBank=["name","created","resend"];paginator;sorter;paginatorBank;sorterBank;showNewVersion=!0;range=new Me({start:new R,end:new R});days;transferring=!1;autoTransfer=!1;overrideAccountingNumber;overrideInvoiceNumber;constructor(e,t,n,c){this.dialog=e,this.accountingController=t,this.accountController=n,this.accountingSystemController=c,this.loadAllData()}ngAfterViewInit(){setTimeout(()=>{this.dataSource=new Te(this.accountingSystemController,"getTransferHistory",this.paginator,25,this.sorter,!0),this.dataSourceBank=new Te(this.accountingSystemController,"getTransferHistoryBankTransfer",this.paginatorBank,25,this.sorterBank,!0)},100)}loadAllData(){this.accountController.getSettings().subscribe(e=>{this.autoTransfer=e.autoTransferToAccountingSystem,this.overrideAccountingNumber=e.overrideAccountingSerieNumber?""+e.overrideAccountingSerieNumber:null,this.overrideInvoiceNumber=e.overrideInvoiceAccountingNumber?""+e.overrideInvoiceAccountingNumber:null}),this.accountingSystemController.getAll().subscribe(e=>{this.systems=e,this.activatedSystem=e.filter(n=>n.activated)[0];let t=new Date;t.setDate(t.getDate()-30),this.range.valueChanges.subscribe(n=>{this.loadAccountingDays(n.start,n.end)}),this.range.patchValue({start:t,end:new Date})})}save(){let e=this.overrideAccountingNumber==""?null:this.overrideAccountingNumber,t=e?parseInt(e):null,n=this.overrideInvoiceNumber==""?null:this.overrideInvoiceNumber,c=n?parseInt(n):null;this.accountController.changeAccountingSystemSettings(this.autoTransfer,t,c).subscribe(g=>{})}loadAccountingDays(e,t){this.connected&&this.accountingController.getAccountintDays(e,t).subscribe(n=>{this.days=n})}setupAccountingSystem(){this.dialog.open(Cr).afterClosed().subscribe(t=>{t&&this.loadAllData()})}get connected(){return this.activatedSystem!=null}upload(){this.transferring=!0,this.accountingSystemController.uploadRemaining().subscribe(e=>{this.transferring=!1,this.loadAllData(),this.dataSource.refresh(),this.dataSourceBank.refresh()},e=>{if(this.transferring=!1,e.status==424){let t=this.dialog.open(xr);t.componentInstance.errors=e.error}},()=>{console.log("yay")})}disconnect(){let e=new ct("Are you sure?","You are about to disconnect your accounting system, no further data will be transferred");this.dialog.open(Oe,{data:e}).afterClosed().subscribe(n=>{n&&this.accountingSystemController.disconnect().subscribe(c=>{this.activatedSystem=null})})}resend(e){this.accountingSystemController.retransferBatch(e.id).subscribe(t=>{alert("done")})}delete(e){let t=new ct("Are you sure?","You are about to disconnect your accounting system, no further data will be transferred");this.dialog.open(Oe,{data:t}).afterClosed().subscribe(c=>{c&&this.accountingSystemController.deleteTransfer(e.id).subscribe(g=>{this.dataSource.refresh(),this.dataSourceBank.refresh(),this.loadAllData()})})}deleteBankTransfer(e){let t=new ct("Are you sure?","This will make the payments available for modifications and be marked as not transferred");this.dialog.open(Oe,{data:t}).afterClosed().subscribe(c=>{c&&this.accountingSystemController.deleteDayInvoicePaymentLinesBatch(e.id).subscribe(g=>{this.dataSource.refresh(),this.dataSourceBank.refresh(),this.loadAllData()})})}resendBank(e){}get newVersion(){return this.showNewVersion}static \u0275fac=function(t){return new(t||i)(h(q),h(De),h(Ae),h(rn))};static \u0275cmp=w({type:i,selectors:[["app-accounting-api-connect"]],viewQuery:function(t,n){if(t&1&&(N(wm,5),N(Sm,5),N(Im,5),N(Mm,5)),t&2){let c;L(c=j())&&(n.paginator=c.first),L(c=j())&&(n.sorter=c.first),L(c=j())&&(n.paginatorBank=c.first),L(c=j())&&(n.sorterBank=c.first)}},decls:18,vars:12,consts:[["sorter","matSort"],["paginator",""],["sorterBank","matSort"],["paginatorBank",""],["picker",""],[1,"header"],[1,"header_sub_info"],["class","box systembox",4,"ngIf"],[4,"ngIf"],["class","box",4,"ngIf"],["class","box connected",4,"ngIf"],[2,"text-align","center"],["mat-button","","color","primary",3,"click"],[1,"box","systembox"],[1,"title"],[1,"notconnected"],[1,"fa-thin","fa-link-slash"],["mat-flat-button","",3,"click"],[1,"box"],[3,"ngModelChange","change","ngModel"],[1,"example-full-width"],["matInput","","placeholder","","value","",3,"ngModelChange","ngModel"],["mat-raised-button","","color","primary",3,"click"],[1,"box","connected"],["mat-table","","matSort","",1,"tt_table",2,"width","100%",3,"dataSource"],["matColumnDef","name"],["mat-header-cell","","mat-sort-header","",4,"matHeaderCellDef"],["mat-cell","",4,"matCellDef"],["matColumnDef","created"],["matColumnDef","resend"],["mat-header-row","",4,"matHeaderRowDef"],["mat-row","","class","row",4,"matRowDef","matRowDefColumns"],["class","mat-row",4,"matNoDataRow"],[3,"pageSizeOptions"],[1,"systemstatus"],[1,"fa","fa-check"],[1,"datepicker"],["matSuffix","",3,"for"],[2,"padding-top","14px","flex","0 0 175px"],[1,"daterangepicker",3,"formGroup","rangePicker"],["matStartDate","","formControlName","start","placeholder","Start date"],["matEndDate","","formControlName","end","placeholder","End date"],["class","notfound",4,"ngIf"],[1,"notfound"],[1,"fa-light","fa-face-thinking"],["class","dayrow",4,"ngFor","ngForOf"],[1,"buttons"],["mat-button","","color","primary",3,"click","disabled"],[1,"dayrow"],[1,"icon"],["class","fa fa-close",4,"ngIf"],["class","fa fa-check",4,"ngIf"],[1,"date"],[1,"fa","fa-close"],[1,"fa","fa-spin","fa-spinner"],["mat-header-cell","","mat-sort-header",""],["mat-cell",""],[1,"fa","fa-upload",3,"click"],[1,"fa","fa-trash",3,"click"],["mat-header-row",""],["mat-row","",1,"row"],[1,"mat-row"],["colspan","4",1,"mat-cell"]],template:function(t,n){t&1&&(a(0,"div",5),l(1),u(2,"translate"),r(),a(3,"div",6),l(4),u(5,"translate"),r(),f(6,Dm,13,9,"div",7)(7,Pm,3,0,"div",8),_(8,"br"),f(9,Em,2,1,"div",9)(10,Tm,22,15,"div",9),_(11,"br"),f(12,r0,41,11,"div",8)(13,a0,2,0,"div",10),a(14,"div",11),_(15,"br"),a(16,"button",12),C("click",function(){return n.showNewVersion=!n.showNewVersion}),l(17," Switch versions "),r()()),t&2&&(o(),m(" ",v(2,8,"commerce.accountingapiconnect.1"),`
`),o(3),m(" ",v(5,10,"commerce.accountingapiconnect.2"),`
`),o(2),s("ngIf",!n.connected),o(),s("ngIf",n.connected),o(2),s("ngIf",n.connected),o(),s("ngIf",n.connected),o(2),s("ngIf",!n.newVersion),o(),s("ngIf",n.newVersion))},dependencies:[T,M,Xe,B,H,rt,G,Fe,Be,je,Re,Ve,Ue,Ne,Le,He,$e,Ge,qe,Ke,at,Ot,kt,At,Ft,U,V,ae,et,xe,ye,O,ni,br,E,ue],styles:[".header[_ngcontent-%COMP%]{font-size:20px;font-weight:500;margin-bottom:10px;display:block}.header_sub_info[_ngcontent-%COMP%]{color:#4a5073;font-size:13px;font-weight:500;margin-bottom:30px;padding-right:150px}.box[_ngcontent-%COMP%]{background-color:#fff;padding:20px;border-radius:5px;position:relative}.title[_ngcontent-%COMP%]{font-size:20px;font-weight:500}.systembox[_ngcontent-%COMP%], .notconnected[_ngcontent-%COMP%]{text-align:center}.notconnected[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]{font-size:40px;margin:30px}.connected[_ngcontent-%COMP%]   i.fa-check[_ngcontent-%COMP%]{color:green}.connected[_ngcontent-%COMP%]   i.fa-close[_ngcontent-%COMP%]{color:red}.datepicker[_ngcontent-%COMP%]{display:flex;background-color:#efefef;border-radius:5px;margin-top:10px;margin-bottom:10px;justify-content:center}.notfound[_ngcontent-%COMP%]{padding:20px;text-align:center}.notfound[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]{font-size:30px;display:block}.dayrow[_ngcontent-%COMP%]{display:flex;gap:10px;padding:10px;border-bottom:solid 1px #DDD}div.dayrow[_ngcontent-%COMP%]:last-child{border-bottom:solid 0px #DDD}.dayrow[_ngcontent-%COMP%]{flex:0 0 20px;text-align:center}.systemstatus[_ngcontent-%COMP%]{position:absolute;right:0;top:0;background-color:#efefef;border-radius:0 5px;font-size:12px;padding:5px}.buttons[_ngcontent-%COMP%]{padding:10px;border-radius:5px;text-align:center;margin-top:20px}"]})}return i})();var Er=kn(Dn());var an=(()=>{class i{bookingController;receiptController;dialogRef;emailControl=new Ee("",[ce.required]);receipt;account;creditNote=!1;constructor(e,t,n){this.bookingController=e,this.receiptController=t,this.dialogRef=n}setEmail(e){this.emailControl.patchValue(e)}send(){let e={};e.email=this.emailControl.value,e.receiptId=this.receipt.id;let t="";this.account&&(t=this.account.id),this.bookingController.sendReceipt(this.emailControl.value,this.receipt.id,t,this.creditNote).subscribe(n=>{this.dialogRef.close(!0),this.receiptController.saveReceiptEmail(this.receipt.id,this.emailControl.value).subscribe(c=>{})})}static \u0275fac=function(t){return new(t||i)(h(ft),h(Je),h(te))};static \u0275cmp=w({type:i,selectors:[["app-send-receipt-dialog"]],decls:13,vars:12,consts:[[1,"example-full-width"],["matInput","","placeholder","","value","",3,"formControl"],[3,"align"],["mat-button","","color","primary",3,"mat-dialog-close"],["mat-button","","color","primary",3,"click"]],template:function(t,n){t&1&&(a(0,"mat-dialog-content")(1,"mat-form-field",0)(2,"mat-label"),l(3),u(4,"translate"),r(),_(5,"input",1),r()(),a(6,"mat-dialog-actions",2)(7,"button",3),l(8),u(9,"translate"),r(),a(10,"button",4),C("click",function(){return n.send()}),l(11),u(12,"translate"),r()()),t&2&&(o(3),I(v(4,6,"commerce.sendreceiptdialog.3")),o(2),s("formControl",n.emailControl),o(),s("align","end"),o(),s("mat-dialog-close",!1),o(),m(" ",v(9,8,"commerce.sendreceiptdialog.2")," "),o(3),m(" ",v(12,10,"commerce.sendreceiptdialog.1")," "))},dependencies:[de,oe,K,B,H,G,U,V,le,O,E]})}return i})();var cn=(()=>{class i{httpService;urlService;constructor(e,t){this.httpService=e,this.urlService=t}isValid(e){let t=[];t.push({name:"vatnumber",value:e.toString()});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/elmacontroller/isvalid",{params:n})}static \u0275fac=function(t){return new(t||i)(Y(_e),Y(ve))};static \u0275prov=re({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();var ln=(()=>{class i{httpService;urlService;constructor(e,t){this.httpService=e,this.urlService=t}getEhfLog(e){let t=[];t.push({name:"receiptId",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/ehfcontroller/history",{params:n})}sendEhf(e){let t=[];t.push({name:"receiptId",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/ehfcontroller/send",{params:n})}static \u0275fac=function(t){return new(t||i)(Y(_e),Y(ve))};static \u0275prov=re({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();var Dr=kn(Dn());var Mr=(()=>{class i{constructor(){}ngOnInit(){}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=w({type:i,selectors:[["app-cancel-payment-dialog"]],decls:36,vars:31,consts:[["mat-dialog-title",""],[1,"mat-typography"],[1,"subcontent"],[2,"color","red","font-weight","500"],["align","end"],["mat-button","","mat-dialog-close","","cdkFocusInitial",""],["mat-button","",3,"mat-dialog-close"]],template:function(t,n){t&1&&(a(0,"h2",0),l(1),u(2,"translate"),r(),a(3,"mat-dialog-content",1)(4,"b"),l(5),u(6,"translate"),r(),a(7,"div",2),l(8),u(9,"translate"),_(10,"br")(11,"br"),a(12,"div",3),l(13),u(14,"translate"),r()(),_(15,"br"),a(16,"b"),l(17),u(18,"translate"),r(),a(19,"div",2),l(20),u(21,"translate"),r(),_(22,"br"),a(23,"b"),l(24),u(25,"translate"),r(),a(26,"div",2),l(27),u(28,"translate"),r()(),a(29,"mat-dialog-actions",4)(30,"button",5),l(31),u(32,"translate"),r(),a(33,"button",6),l(34),u(35,"translate"),r()()),t&2&&(o(),I(v(2,11,"pos.cancel.payment.dialog.0")),o(4),I(v(6,13,"pos.cancel.payment.dialog.1")),o(3),m("\xA0",v(9,15,"pos.cancel.payment.dialog.2")," "),o(5),m(" ",v(14,17,"pos.cancel.payment.dialog.9")," "),o(4),I(v(18,19,"pos.cancel.payment.dialog.3")),o(3),m("\xA0",v(21,21,"pos.cancel.payment.dialog.4")," "),o(4),I(v(25,23,"pos.cancel.payment.dialog.5")),o(3),m("\xA0",v(28,25,"pos.cancel.payment.dialog.6")," "),o(4),I(v(32,27,"pos.cancel.payment.dialog.7")),o(2),s("mat-dialog-close",!0),o(),I(v(35,29,"pos.cancel.payment.dialog.8")))},dependencies:[de,be,oe,K,O,E],styles:[".subcontent[_ngcontent-%COMP%]{padding:10px}"]})}return i})();function c0(i,p){i&1&&(a(0,"span"),l(1,"_c"),r())}function l0(i,p){if(i&1&&(a(0,"div",24),l(1),u(2,"date"),r()),i&2){let e=d(2);o(),m(" Created date: ",F(2,1,e.receipt.docCreatedDate,"short")," ")}}function s0(i,p){if(i&1&&(a(0,"div",24),l(1),u(2,"date"),r()),i&2){let e=d(2);o(),m(" Credit date: ",F(2,1,e.receipt.creditDate,"short")," ")}}function p0(i,p){i&1&&(Q(0),_(1,"i",28),l(2," Sending..."),z())}function d0(i,p){i&1&&(Q(0),_(1,"i",29),l(2),u(3,"translate"),z()),i&2&&(o(2),m(" ",v(3,1,"commerce.invoice.29")," "))}function m0(i,p){if(i&1){let e=S();Q(0),a(1,"div",25),f(2,p0,3,0,"ng-container",1)(3,d0,4,3,"ng-container",1),r(),a(4,"mat-menu",null,0)(6,"button",26),C("click",function(){y(e);let n=d(2);return b(n.send())}),l(7),u(8,"translate"),r(),a(9,"button",27),C("click",function(){y(e);let n=d(2);return b(n.sendEhf())}),l(10),u(11,"translate"),r()(),z()}if(i&2){let e=fe(5),t=d(2);o(),s("matMenuTriggerFor",e),o(),s("ngIf",t.sending),o(),s("ngIf",!t.sending),o(4),m(" ",v(8,6,"commerce.invoice.30")," "),o(2),s("disabled",!(t.canSendEhf&&(!t.sendingEhf||!t.invoiceDto.receipt.isCanceled))),o(),m(" ",v(11,8,"commerce.invoice.22")," ")}}function u0(i,p){if(i&1){let e=S();Q(0),a(1,"div",5),C("click",function(){y(e);let n=d(2);return b(n.send())}),_(2,"i",29),l(3),u(4,"translate"),r(),z()}i&2&&(o(3),m(" ",v(4,1,"commerce.invoice.29")," "))}function f0(i,p){if(i&1){let e=S();a(0,"div",5),C("click",function(){y(e);let n=d(2);return b(n.credit())}),_(1,"i",30),l(2),u(3,"translate"),r()}i&2&&(o(2),m(" ",v(3,1,"pos.account.payements.2")," "))}function g0(i,p){if(i&1&&(a(0,"div"),l(1),r()),i&2){let e=d(3);o(),I(e.customerInfo.name)}}function _0(i,p){if(i&1&&(a(0,"div"),l(1),r()),i&2){let e=d(3);o(),I(e.customerInfo.address)}}function v0(i,p){if(i&1&&(a(0,"div"),l(1),r()),i&2){let e=d(3);o(),I(e.customerInfo.email)}}function h0(i,p){if(i&1&&(a(0,"div"),l(1),r()),i&2){let e=d(3);o(),I(e.customerInfo.postcode)}}function C0(i,p){if(i&1&&(a(0,"div"),l(1),r()),i&2){let e=d(3);o(),I(e.customerInfo.city)}}function x0(i,p){if(i&1&&(a(0,"div"),l(1),r()),i&2){let e=d(3);o(),I(e.customerInfo.phone)}}function y0(i,p){if(i&1&&(a(0,"div"),l(1),r()),i&2){let e=d(3);o(),I(e.customerInfo.prefix)}}function b0(i,p){if(i&1&&(a(0,"div",31)(1,"div",32),l(2," Customer "),r(),f(3,g0,2,1,"div",1)(4,_0,2,1,"div",1)(5,v0,2,1,"div",1)(6,h0,2,1,"div",1)(7,C0,2,1,"div",1)(8,x0,2,1,"div",1)(9,y0,2,1,"div",1),r()),i&2){let e=d(2);o(3),s("ngIf",e.customerInfo.name),o(),s("ngIf",e.customerInfo.address),o(),s("ngIf",e.customerInfo.email),o(),s("ngIf",e.customerInfo.postcode),o(),s("ngIf",e.customerInfo.city),o(),s("ngIf",e.customerInfo.phone),o(),s("ngIf",e.customerInfo.prefix)}}function w0(i,p){if(i&1&&(a(0,"div",35)(1,"div",17),l(2),_(3,"div",36),u(4,"nl2br"),r(),a(5,"div",18),l(6),r(),a(7,"div",19),l(8),u(9,"number"),r()()),i&2){let e=p.$implicit;o(2),m(" ",e.text," "),o(),s("innerHTML",v(4,4,e.subText),ht),o(3),I(e.count),o(2),I(F(9,6,e.averageUnitPrice,"1.2-2"))}}function S0(i,p){if(i&1&&(a(0,"div",33),f(1,w0,10,9,"div",34),r()),i&2){let e=p.$implicit,t=d(2);o(),s("ngForOf",t.entries(e))}}function I0(i,p){if(i&1&&(a(0,"div",35)(1,"div",17),l(2),r(),a(3,"div",18),l(4," \xA0"),r(),a(5,"div",19),l(6),u(7,"number"),r()()),i&2){let e=p.$implicit,t=d(3);o(2),ge(" ",e.value.tax.description," ",e.value.taxPeriode.percent," % "),o(4),m(" ",F(7,3,t.showCreditNote?e.value.total*-1:e.value.total,"1.2-2")," ")}}function M0(i,p){if(i&1&&(a(0,"div",37)(1,"div",32),l(2," Taxes "),r(),f(3,I0,8,6,"div",34),u(4,"keyvalue"),r()),i&2){let e=d(2);o(3),s("ngForOf",v(4,1,e.taxSummary))}}function D0(i,p){if(i&1&&(a(0,"div",35)(1,"div",17),l(2),a(3,"div",40),l(4),u(5,"date"),r()(),a(6,"div",18),l(7," \xA0"),r(),a(8,"div",19),l(9),u(10,"number"),r()()),i&2){let e=p.$implicit,t=d().$implicit;o(2),m(" ",t.type.name," "),o(2),m(" ",F(5,3,e.date,"short")," "),o(5),m(" ",F(10,6,e.totalCharged,"1.2-2")," ")}}function P0(i,p){if(i&1&&(a(0,"div"),f(1,D0,11,9,"div",34),r()),i&2){let e=p.$implicit;o(),s("ngForOf",e.charges)}}function E0(i,p){if(i&1&&(a(0,"div",38)(1,"div",32),l(2," Payments "),r(),f(3,P0,2,1,"div",39),r()),i&2){let e=d(2);o(3),s("ngForOf",e.receipt.payments)}}function T0(i,p){if(i&1){let e=S();a(0,"div",41),C("click",function(){y(e);let n=d(2);return b(n.showCreditNote=!0)}),l(1," Note this has been creditted "),_(2,"br")(3,"br"),l(4," Show creditnote "),r()}}function k0(i,p){if(i&1){let e=S();a(0,"div",42),C("click",function(){y(e);let n=d(2);return b(n.showCreditNote=!1)}),l(1," This is a credinote "),_(2,"br")(3,"br"),l(4," Show original "),r()}}function A0(i,p){if(i&1){let e=S();a(0,"div")(1,"div",2)(2,"div"),l(3),f(4,c0,2,0,"span",1),r(),f(5,l0,3,4,"div",3)(6,s0,3,4,"div",3),r(),a(7,"div",4)(8,"div",5),C("click",function(){y(e);let n=d();return b(n.download())}),_(9,"i",6),l(10),u(11,"translate"),r(),f(12,m0,12,10,"ng-container",1)(13,u0,5,3,"ng-container",1)(14,f0,4,3,"div",7),r(),f(15,b0,10,7,"div",8),a(16,"div")(17,"div",9)(18,"div",10),l(19,"Description"),r(),a(20,"div",11),l(21,"Count"),r(),a(22,"div",12),l(23,"Price"),r()()(),a(24,"div",13),f(25,S0,2,1,"div",14),a(26,"div",15)(27,"div",16)(28,"div",17),l(29,"Total"),r(),a(30,"div",18),l(31,"\xA0"),r(),a(32,"div",19),l(33),u(34,"number"),r()()()(),f(35,M0,5,3,"div",20)(36,E0,4,1,"div",21)(37,T0,5,0,"div",22)(38,k0,5,0,"div",23),r()}if(i&2){let e=d();o(3),ge(" ",e.receipt.type=="invoice"?"Invoice":"Receipt",": ",e.receipt.incrementalReceiptNumber,""),o(),s("ngIf",e.showCreditNote),o(),s("ngIf",!e.showCreditNote),o(),s("ngIf",e.showCreditNote),o(4),m(" ",v(11,18,"pos.account.payements.1")," "),o(2),s("ngIf",e.canSendEhf),o(),s("ngIf",!e.canSendEhf),o(),s("ngIf",!e.receipt.isCanceled),o(),s("ngIf",e.customerInfo),o(9),ee("inverted",e.inverted),o(),s("ngForOf",e.receipt.accountPayments),o(8),m(" ",F(34,20,e.sumTotal,"1.2-2")," "),o(2),s("ngIf",e.taxSummary),o(),s("ngIf",e.receipt.type!="invoice"),o(),s("ngIf",e.receipt.isCanceled&&!e.showCreditNote),o(),s("ngIf",e.showCreditNote)}}var pn=(()=>{class i{receiptController;dialog;ehfController;elmaController;taxSummary;showCreditNote=!1;creditted=new it;ehfSentSubject=new it;emailSentSubject=new it;inverted=!1;sending;ngAfterViewInit(){this.receiptController.getTaxSummary(this.receipt.id).subscribe(e=>{this.taxSummary=e})}receipt;account;overrideEmail;constructor(e,t,n,c){this.receiptController=e,this.dialog=t,this.ehfController=n,this.elmaController=c}get customerInfo(){return this.receipt.customer?this.receipt.customer:this.receipt.company?this.receipt.company:null}entries(e){let t=[];return e.entries.filter(n=>this.showCreditNote?n.isCreditNote:!n.isCreditNote).forEach(n=>{t.push(n)}),t}get sumTotal(){let e=0;return this.receipt.accountPayments.forEach(t=>{e+=t.totalWithoutCreditNotesInForignCurrency}),this.showCreditNote?e*-1:e}download(){this.receiptController.downloadReceipt(this.receipt.id,this.showCreditNote).subscribe(e=>{let t=window.atob(e.base64),c=new Uint8Array(t.length).map((P,k)=>t.charCodeAt(k)),g=new Blob([c],{type:"application/pdf"}),x=this.receipt.type+" "+this.receipt.incrementalReceiptNumber;this.showCreditNote&&(x+="_c"),x+=".pdf",(0,Dr.saveAs)(g,x)})}send(){this.receiptController.getEmailAddressForReceipt(this.receipt.id).subscribe(e=>{let t=this.dialog.open(an);t.componentInstance.receipt=this.receipt,t.componentInstance.account=this.account,t.componentInstance.creditNote=this.showCreditNote,e.email&&t.componentInstance.setEmail(e.email),e.invoiceEmail&&t.componentInstance.setEmail(e.invoiceEmail),this.overrideEmail&&t.componentInstance.setEmail(this.overrideEmail),t.afterClosed().subscribe(n=>{n&&this.emailSentSubject.next(!0)})})}credit(){var e=this.dialog.open(Mr);e.afterClosed().subscribe(t=>{t&&this.receiptController.cancelReceipt(this.receipt.id).subscribe(n=>{this.creditted.next(!0)})})}afterCreditted(){return this.creditted.asObservable()}afterEhfSent(){return this.ehfSentSubject.asObservable()}afterEmailSent(){return this.emailSentSubject.asObservable()}sendEhf(){let e=+this.receipt.company.vatNumber.replace(/\D/g,"");this.elmaController.isValid(e).subscribe(t=>{if(t)this.sending=!0,this.ehfController.sendEhf(this.receipt.id).subscribe(g=>{this.sending=!1,g==null?this.ehfSentSubject.next(!0):this.ehfSentSubject.next(!1)});else{var n={};n.informationOnly=!0,n.title="commerce.invoice.41",n.message="commerce.invoice.42";var c=this.dialog.open(Oe,{data:n})}})}get canSendEhf(){return this.receipt.type!="invoice"||this.showCreditNote?!1:this.receipt.company!=null&&this.receipt.company.vatNumber}static \u0275fac=function(t){return new(t||i)(h(Je),h(q),h(ln),h(cn))};static \u0275cmp=w({type:i,selectors:[["app-receipt-view"]],inputs:{inverted:"inverted",receipt:"receipt",account:"account",overrideEmail:"overrideEmail"},decls:1,vars:1,consts:[["sendmenu","matMenu"],[4,"ngIf"],[1,"tophead"],["class","dates",4,"ngIf"],[1,"actions"],[1,"action",3,"click"],[1,"fa","fa-download"],["class","action",3,"click",4,"ngIf"],["class","customer",4,"ngIf"],[1,"entryrow","header"],[1,"desc","headline"],[1,"count","headline"],[1,"amount","headline"],[1,"entries"],["class","foraccount",4,"ngFor","ngForOf"],[2,"padding","5px"],[1,"entryrow","sumtotalrow"],[1,"desc"],[1,"count"],[1,"amount"],["class","taxSummary",4,"ngIf"],["class","payments",4,"ngIf"],["class","creditted",3,"click",4,"ngIf"],["class","showingcreditnote",3,"click",4,"ngIf"],[1,"dates"],[1,"action",3,"matMenuTriggerFor"],["mat-flat-button","",3,"click"],["mat-flat-button","",3,"click","disabled"],[1,"fa","fa-spin","fa-spinner"],[1,"fa","fa-envelope"],[1,"fa","fa-cancel"],[1,"customer"],[1,"headline"],[1,"foraccount"],["class","entryrow",4,"ngFor","ngForOf"],[1,"entryrow"],[1,"subtext",3,"innerHTML"],[1,"taxSummary"],[1,"payments"],[4,"ngFor","ngForOf"],[1,"date"],[1,"creditted",3,"click"],[1,"showingcreditnote",3,"click"]],template:function(t,n){t&1&&f(0,A0,39,23,"div",1),t&2&&s("ngIf",n.receipt)},dependencies:[T,M,yt,bt,O,E,me,xi,ue,Vt],styles:[".entryrow[_ngcontent-%COMP%]{display:flex;margin-top:5px;margin-bottom:5px;box-sizing:border-box;min-width:420px;padding:5px}.foraccount[_ngcontent-%COMP%]{margin-top:10px;padding-left:4px}.foraccount[_ngcontent-%COMP%]   .entryrow[_ngcontent-%COMP%]{border-bottom:solid 1px #FFF;padding-bottom:10px}.count[_ngcontent-%COMP%]{flex:0 0 54px;text-align:center}.desc[_ngcontent-%COMP%]{flex:1 1 30%}.amount[_ngcontent-%COMP%]{flex:0 0 80px;text-align:right}.taxSummary[_ngcontent-%COMP%]{margin-top:30px;padding:5px;margin-bottom:30px}.headline[_ngcontent-%COMP%]{font-weight:500;font-size:15px}.tophead[_ngcontent-%COMP%]{margin-bottom:20px;padding:5px}.customer[_ngcontent-%COMP%]{margin-bottom:30px;padding:5px}.entries[_ngcontent-%COMP%]{border-radius:5px;background-color:#f5f8fb;padding-top:5px;padding-bottom:5px}.entries.inverted[_ngcontent-%COMP%]{background-color:#fff}.sumtotalrow[_ngcontent-%COMP%]{padding-top:5px;padding-bottom:5px}.payments[_ngcontent-%COMP%]{margin-top:20px;padding:30px 5px 5px}.date[_ngcontent-%COMP%]{color:#666;font-size:12px}.creditted[_ngcontent-%COMP%]{background-color:#ffe774;text-align:center;padding:5px;border-radius:5px;margin-bottom:20px;cursor:pointer}.showingcreditnote[_ngcontent-%COMP%]{text-align:center;padding:5px;border-radius:5px;margin-bottom:20px;cursor:pointer}.subtext[_ngcontent-%COMP%]{font-size:13px;padding-left:4px}.actions[_ngcontent-%COMP%]{text-align:center;width:100%;margin-bottom:20px}.actions[_ngcontent-%COMP%]   .action[_ngcontent-%COMP%]{width:80px;height:50px;text-align:center;font-size:11px;box-sizing:border-box;padding:10px 5px 5px;border-radius:5px;display:inline-block;cursor:pointer;background-color:#0e4dc0;color:#fff;margin-left:5px;margin-right:5px}.actions[_ngcontent-%COMP%]   .action[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]{display:block;font-size:16px;margin-bottom:5px}"]})}return i})();var O0=["receiptview"],F0=i=>({invoiceNumber:i});function V0(i,p){if(i&1&&(a(0,"div",9),_(1,"i",16),a(2,"span",11),l(3," Credit date "),r(),a(4,"span",12),l(5),u(6,"date"),r()()),i&2){let e=d(2);o(5),m(" ",F(6,1,e._invoiceDto.receipt.creditDate,"shortDate")," ")}}function B0(i,p){i&1&&(a(0,"div",9),_(1,"i",31),a(2,"span",11),l(3," External "),r(),a(4,"span",12),l(5," Collection "),r()())}function R0(i,p){if(i&1){let e=S();a(0,"button",32),C("click",function(){y(e);let n=d(2);return b(n.sendToDebtCollector())}),l(1),u(2,"translate"),r()}i&2&&(o(),m(" ",v(2,1,"commerce.invoice.46")," "))}function N0(i,p){i&1&&(a(0,"div",33),l(1),u(2,"translate"),r()),i&2&&(o(),m(" ",v(2,1,"commerce.invoice.15")," "))}function L0(i,p){if(i&1){let e=S();a(0,"i",40),C("click",function(){y(e);let n=d().$implicit,c=d(3);return b(c.undoRegisterOfPayment(n))}),r()}}function j0(i,p){if(i&1&&(a(0,"div",36),f(1,L0,1,0,"i",37),a(2,"div",38),l(3),u(4,"date"),r(),a(5,"div",39),l(6),u(7,"number"),r(),l(8," \xA0 "),a(9,"div",39),l(10),r()()),i&2){let e=p.$implicit;o(),s("ngIf",!e.transferredToAccount&&(e.type=="manual"||e.type=="fee")),o(2),m(" ",F(4,4,e.date,"shortDate")," "),o(3),m(" ",v(7,7,e.amount)," "),o(4),m(" ( ",e.type," ) ")}}function U0(i,p){if(i&1&&(a(0,"div",34),f(1,j0,11,9,"div",35),r()),i&2){let e=d(2);o(),s("ngForOf",e.invoiceDto.receipt.invoicePayments)}}function H0(i,p){i&1&&(a(0,"span"),l(1),u(2,"translate"),r()),i&2&&(o(),m(" ",v(2,1,"commerce.invoice.44")," "))}function $0(i,p){i&1&&(a(0,"span"),l(1),u(2,"translate"),r()),i&2&&(o(),m(" ",v(2,1,"commerce.invoice.45")," "))}function G0(i,p){if(i&1){let e=S();a(0,"div",41)(1,"form",42)(2,"mat-form-field",43)(3,"mat-label"),l(4),u(5,"translate"),r(),_(6,"input",44)(7,"mat-datepicker-toggle",45)(8,"mat-datepicker",null,1),r(),a(10,"mat-form-field",43)(11,"mat-label"),l(12),u(13,"translate"),r(),_(14,"input",46),r(),a(15,"button",47),C("click",function(){y(e);let n=d(2);return n.registerPayment=!1,b(n.registerFee=!1)}),l(16),u(17,"translate"),r(),l(18," \xA0 "),a(19,"button",48),C("click",function(){y(e);let n=d(2);return b(n.savePayment())}),l(20),u(21,"translate"),f(22,H0,3,3,"span",26)(23,$0,3,3,"span",26),r()()()}if(i&2){let e=fe(9),t=d(2);o(),s("formGroup",t.registerPaymentForm),o(3),m(" ",v(5,10,"commerce.invoice.17")," "),o(2),s("matDatepicker",e),o(),s("for",e),o(5),m(" ",v(13,12,"commerce.invoice.10")," "),o(4),m(" ",v(17,14,"commerce.privatecustomer.5")," "),o(3),s("disabled",!t.registerPaymentForm.valid),o(),m(" ",v(21,16,"commerce.invoice.18")," "),o(2),s("ngIf",t.registerPayment),o(),s("ngIf",t.registerFee)}}function q0(i,p){if(i&1){let e=S();a(0,"button",49),C("click",function(){y(e);let n=d(2);return b(n.registerPayment=!0)}),l(1),u(2,"translate"),r()}i&2&&(o(),m(" ",v(2,1,"commerce.invoice.16")," "))}function Q0(i,p){if(i&1){let e=S();a(0,"button",49),C("click",function(){y(e);let n=d(2);return b(n.registerFee=!0)}),l(1),u(2,"translate"),r()}i&2&&(o(),m(" ",v(2,1,"commerce.invoice.43")," "))}function z0(i,p){i&1&&(a(0,"div"),_(1,"i",50),r())}function W0(i,p){i&1&&(a(0,"div"),l(1),u(2,"translate"),r()),i&2&&(o(),m(" ",v(2,1,"commerce.invoice.32")," "))}function K0(i,p){if(i&1&&(a(0,"div",51),l(1),u(2,"date"),r()),i&2){let e=p.$implicit;o(),ge(" ",F(2,2,e.date,"short"),", Sent to: ",e.sentTo," ")}}function X0(i,p){i&1&&(a(0,"div",51),l(1),u(2,"translate"),r()),i&2&&(o(),m(" ",v(2,1,"commerce.invoice.20")," "))}function Y0(i,p){i&1&&(a(0,"div"),l(1," Could not send the EHF, please check the company details. "),r())}function J0(i,p){i&1&&(a(0,"div"),_(1,"i",50),l(2),u(3,"translate"),r()),i&2&&(o(2),m(" ",v(3,1,"commerce.invoice.40")," "))}function Z0(i,p){if(i&1&&(a(0,"div",6)(1,"div")(2,"div",7)(3,"div",8),l(4),r(),a(5,"div",9),_(6,"i",10),a(7,"span",11),l(8),u(9,"translate"),r(),a(10,"span",12),l(11),u(12,"number"),r()(),a(13,"div",9),_(14,"i",13),a(15,"span",11),l(16),u(17,"translate"),r(),a(18,"span",12),l(19),u(20,"number"),r()(),a(21,"div",9),_(22,"i",14),a(23,"span",11),l(24),u(25,"translate"),r(),a(26,"span",12),l(27),u(28,"number"),r()(),f(29,V0,7,4,"div",15),a(30,"div",9),_(31,"i",16),a(32,"span",11),l(33," Invoice date "),r(),a(34,"span",12),l(35),u(36,"date"),r()(),f(37,B0,6,0,"div",15),a(38,"div",17),f(39,R0,3,3,"button",18),r()(),a(40,"div",19)(41,"h3"),l(42),u(43,"translate"),r(),f(44,N0,3,3,"div",20)(45,U0,2,1,"div",21)(46,G0,24,18,"div",22),a(47,"div",23),f(48,q0,3,3,"button",24),l(49," \xA0 "),f(50,Q0,3,3,"button",24),r()(),a(51,"div",25),f(52,z0,2,0,"div",26),a(53,"h2"),l(54),u(55,"translate"),r(),f(56,W0,3,3,"div",26)(57,K0,3,5,"div",27)(58,X0,3,3,"div",28),_(59,"br"),f(60,Y0,2,0,"div",26)(61,J0,4,3,"div",26),r()(),a(62,"div",29),_(63,"app-receipt-view",30,0),r()()),i&2){let e=d();o(4),m(" ",e._invoiceDto.receipt.id," "),o(4),m(" ",v(9,26,"commerce.invoice.9")," "),o(3),m(" ",v(12,28,e.invoiceDto.receipt.totalBilledIncTaxes)," "),o(5),m(" ",v(17,30,"commerce.invoice.10")," "),o(3),m(" ",v(20,32,e.calcTotalPaid())," "),o(5),m(" ",v(25,34,"commerce.invoice.11")," "),o(3),m(" ",v(28,36,e.invoiceDto.unsettledPayment)," "),o(2),s("ngIf",e._invoiceDto.receipt.isCanceled),o(6),m(" ",F(36,38,e._invoiceDto.receipt.docCreatedDate,"shortDate")," "),o(2),s("ngIf",e.externalDebtCollectorActivated&&e._invoiceDto.receipt.externalDebtCollecting),o(2),s("ngIf",e.externalDebtCollectorActivated&&!e._invoiceDto.receipt.externalDebtCollecting),o(3),m(" ",v(43,41,"commerce.invoice.12")," "),o(2),s("ngIf",e.invoiceDto.receipt.invoicePayments.length==0),o(),s("ngIf",e.invoiceDto.receipt.invoicePayments.length>0),o(),s("ngIf",e.registerPayment||e.registerFee),o(2),s("ngIf",!e.registerPayment&&!e.registerFee),o(2),s("ngIf",!e.registerPayment&&!e.registerFee),o(2),s("ngIf",e.loadingEhfHistory),o(2),m(" ",v(55,43,"commerce.invoice.37")," "),o(2),s("ngIf",e.invoiceDto.receipt.sentTo.length==0),o(),s("ngForOf",e.invoiceDto.receipt.sentTo),o(),s("ngIf",!e.loadingEhfHistory&&e.ehfLogHistory.length==0),o(2),s("ngIf",e.ehfFailed),o(),s("ngIf",e.sendingEhf),o(2),s("receipt",e.invoiceDto.receipt)("inverted",!0)}}var dn=(()=>{class i{receiptController;dialog;userService;elmaController;ehfController;_invoiceDto;registerPayment=!1;registerFee=!1;loadingEhfHistory=!1;ehfLogHistory;sendingEhf=!1;ehfFailed=!1;parent;receiptView;get invoiceDto(){return this._invoiceDto}set invoiceDto(e){this._invoiceDto=e,this.registerPaymentForm.patchValue({date:new Date,amount:this.invoiceDto.unsettledPayment}),this.loadEhfHistory()}patchUnsettledAmount(){this.registerPaymentForm.patchValue({amount:this.invoiceDto.unsettledPayment})}loadEhfHistory(){this.loadingEhfHistory=!0,this.ehfController.getEhfLog(this._invoiceDto.receipt.id).subscribe(e=>{this.ehfLogHistory=e,this.loadingEhfHistory=!1})}undoRegisterOfPayment(e){this.receiptController.undoInvoicePayment(this._invoiceDto.receipt.id,e.paymentId).subscribe(t=>{this._invoiceDto=t,this.parent.dataSource.refresh(),this.patchUnsettledAmount()})}constructor(e,t,n,c,g){this.receiptController=e,this.dialog=t,this.userService=n,this.elmaController=c,this.ehfController=g}ngAfterViewInit(){this.receiptView.afterCreditted().subscribe(e=>{this.refresh()}),this.receiptView.afterEhfSent().subscribe(e=>{e?(this.refresh(),this.loadEhfHistory()):this.ehfFailed=!0}),this.receiptView.afterEmailSent().subscribe(e=>{e&&this.refresh()})}registerPaymentForm=new gi({date:new Ee(new Date,[ce.required]),amount:new Ee(0,[ce.required])});calcTotalPaid(){let e=0;return this.invoiceDto&&this.invoiceDto.receipt.invoicePayments.forEach(t=>{e+=t.amount}),e}savePayment(){let e=this.registerFee?"fee":"manual";this.receiptController.registerInvoicePayment(this.invoiceDto.receipt.id,this.registerPaymentForm.value.date,this.registerPaymentForm.value.amount,e).subscribe(t=>{this.invoiceDto.receipt.invoicePayments=t.receipt.invoicePayments,this.invoiceDto.unsettledPayment=t.unsettledPayment,this.invoiceDto.receipt.invoiceFullySettled=t.receipt.invoiceFullySettled,this.invoiceDto.receipt.sentTo=t.receipt.sentTo,this.registerPayment=!1,this.registerFee=!1,this.patchUnsettledAmount()})}download(e){let t=this._invoiceDto.receipt;this.receiptController.downloadReceipt(t.id,e).subscribe(n=>{let c=window.atob(n.base64),x=new Uint8Array(c.length).map((k,A)=>c.charCodeAt(A)),P=new Blob([x],{type:"application/pdf"});(0,Er.saveAs)(P,t.type+" "+t.incrementalReceiptNumber+".pdf")})}sendEmail(e){let t=this.dialog.open(an);t.componentInstance.receipt=this.invoiceDto.receipt,t.componentInstance.creditNote=e;let n="";this.invoiceDto.receipt.customer&&(n=this.invoiceDto.receipt.customer.email),this.invoiceDto.receipt.company&&(n=this.invoiceDto.receipt.company.email),t.componentInstance.emailControl.setValue(n),t.afterClosed().subscribe(c=>{this.receiptController.getInvoice(this._invoiceDto.receipt.id).subscribe(g=>{this._invoiceDto=g})})}refresh(){this.parent&&this.parent.dataSource&&this.parent.dataSource.refresh(),this.receiptController.getInvoice(this._invoiceDto.receipt.id).subscribe(e=>{this._invoiceDto=e})}creditInvoice(){let e=new ct("Are you sure","Please confirm that you want to credit the invoice.");this.dialog.open(Oe,{data:e}).afterClosed().subscribe(n=>{n&&this.receiptController.cancelReceipt(this.invoiceDto.receipt.id).subscribe(c=>{this.refresh()})})}sendToDebtCollector(){let e=new ct("commerce.invoice.47","commerce.invoice.48");this.dialog.open(Oe,{data:e}).afterClosed().subscribe(n=>{n&&this.receiptController.sendToDebtCollector(this._invoiceDto.receipt.id).subscribe(c=>{this.refresh()})})}get externalDebtCollectorActivated(){return this.userService.isAppActivated("commerce_external_debt_collector")}static \u0275fac=function(t){return new(t||i)(h(Je),h(q),h(Ze),h(cn),h(ln))};static \u0275cmp=w({type:i,selectors:[["app-invoice-view-dialog"]],viewQuery:function(t,n){if(t&1&&N(O0,5),t&2){let c;L(c=j())&&(n.receiptView=c.first)}},decls:10,vars:16,consts:[["receiptview",""],["picker",""],["mat-dialog-title",""],["class","contentbox",4,"ngIf"],[3,"align"],["mat-button","","color","primary","cdkFocusInitial","",3,"mat-dialog-close"],[1,"contentbox"],[1,"topbox","paymentsummary"],[1,"id"],[1,"sub"],[1,"fa","fa-dollar"],[1,"col"],[1,"price"],[1,"fa-thin","fa-handshake"],[1,"fa-regular","fa-money-bill"],["class","sub",4,"ngIf"],[1,"fa-thin","fa-calendar"],[1,"summarybuttons"],["mat-button","","color","primary","style","margin-left: 10px;",3,"click",4,"ngIf"],[1,"payments"],["class","no_payments_found",4,"ngIf"],["class","paymentrows",4,"ngIf"],["class","registerpayment",4,"ngIf"],[1,"paymentbuttons"],["mat-button","","color","primary",3,"click",4,"ngIf"],[1,"ehfview"],[4,"ngIf"],["class","historrow",4,"ngFor","ngForOf"],["class","historrow",4,"ngIf"],[1,"receiptview"],[3,"receipt","inverted"],[1,"fa-thin","fa-check"],["mat-button","","color","primary",2,"margin-left","10px",3,"click"],[1,"no_payments_found"],[1,"paymentrows"],["class","paymentrow",4,"ngFor","ngForOf"],[1,"paymentrow"],["class","fa fa-trash","style","margin-right: 10px",3,"click",4,"ngIf"],[1,"date"],[1,"amount"],[1,"fa","fa-trash",2,"margin-right","10px",3,"click"],[1,"registerpayment"],[3,"formGroup"],[1,"full-width"],["matInput","","formControlName","date",3,"matDatepicker"],["matIconSuffix","",3,"for"],["matInput","","placeholder","","value","","formControlName","amount"],["mat-flat-button","","color","primary",3,"click"],["mat-flat-button","","color","primary",3,"click","disabled"],["mat-button","","color","primary",3,"click"],[1,"fa","fa-spin","fa-spinner"],[1,"historrow"]],template:function(t,n){t&1&&(a(0,"div",2),l(1),u(2,"translate"),u(3,"date"),r(),a(4,"mat-dialog-content"),f(5,Z0,65,45,"div",3),r(),a(6,"mat-dialog-actions",4)(7,"button",5),l(8),u(9,"translate"),r()()),t&2&&(o(),ge(" ",F(2,6,"commerce.invoice.8",nt(14,F0,n.invoiceDto.receipt.incrementalReceiptNumber)),", Duedate: ",F(3,9,n.invoiceDto.receipt.dueDate,"shortDate")," "),o(4),s("ngIf",n.invoiceDto),o(),s("align","end"),o(),s("mat-dialog-close",!1),o(),m(" ",v(9,12,"commerce.productpicker.3")," "))},dependencies:[T,M,de,be,oe,K,B,H,rt,G,yi,bi,at,Ce,U,V,ae,xe,ye,O,pn,E,me,ue],styles:[".contentbox[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:20px}.topbox[_ngcontent-%COMP%]{background-color:#f5f8fb;padding:20px;border-radius:5px;margin-bottom:20px;overflow:hidden}.historrow[_ngcontent-%COMP%]{margin-bottom:5px}.id[_ngcontent-%COMP%]{font-size:10px;color:#666;position:absolute;right:10px;bottom:10px}.sendbyemailbutton[_ngcontent-%COMP%]{margin-right:20px}.sentToLog[_ngcontent-%COMP%]{margin-top:20px;background-color:#f5f8fb;padding:5px 20px 20px;border-radius:5px}.receiptview[_ngcontent-%COMP%]{background-color:#f5f8fb;padding:20px}.topbox[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]{display:inline-block;width:30px;text-align:center}.topbox[_ngcontent-%COMP%]   .main[_ngcontent-%COMP%], .topbox[_ngcontent-%COMP%]   .sub[_ngcontent-%COMP%]{margin-bottom:5px}.contactdetails[_ngcontent-%COMP%], .paymentsummary[_ngcontent-%COMP%]{flex:1 1 33%;position:relative}.topbox[_ngcontent-%COMP%]   .sub[_ngcontent-%COMP%]   .col[_ngcontent-%COMP%]{display:inline-block;width:100px}.topbox[_ngcontent-%COMP%]   .sub[_ngcontent-%COMP%]   .price[_ngcontent-%COMP%]{display:inline-block;width:50px;text-align:right}.payments[_ngcontent-%COMP%]{flex:1 1 100%;background-color:#f5f8fb;padding:20px;border-radius:5px;margin-bottom:20px}.no_payments_found[_ngcontent-%COMP%]{color:red;margin-bottom:20px}.registerpayment[_ngcontent-%COMP%]{background-color:#f5f8fb;padding:20px;max-width:271px;margin:0 auto;border-radius:5px}.full-width[_ngcontent-%COMP%]{width:100%}.paymentrow[_ngcontent-%COMP%]{display:flex;padding:3px}.paymentrow[_ngcontent-%COMP%]   .date[_ngcontent-%COMP%]{flex:0 0 100px}.paymentrows[_ngcontent-%COMP%]{margin-bottom:20px}.ehfview[_ngcontent-%COMP%]{background-color:#f5f8fb;padding:20px;flex:1 1 100%}.ehftitle[_ngcontent-%COMP%]{font-size:17px;font-weight:700;margin-bottom:20px}.summarybuttons[_ngcontent-%COMP%]{text-align:center;padding-top:20px}.paymentbuttons[_ngcontent-%COMP%]{text-align:center}"]})}return i})();var eu=["paginator"],tu=["sorter"],iu=()=>[5,10,25,100,500];function nu(i,p){i&1&&(a(0,"th",14),l(1," Invoice "),r())}function ou(i,p){i&1&&_(0,"i",19)}function ru(i,p){i&1&&_(0,"i",20)}function au(i,p){if(i&1&&(a(0,"td",15),f(1,ou,1,0,"i",16)(2,ru,1,0,"i",17),l(3),a(4,"span",18),l(5),r()()),i&2){let e=p.$implicit;o(),s("ngIf",e.receipt.invoiceFullySettled),o(),s("ngIf",!e.receipt.invoiceFullySettled),o(),m(" ",e.receipt.incrementalReceiptNumber," "),o(2),m("(",e.receipt.sentTo.length,")")}}function cu(i,p){i&1&&(a(0,"th",14),l(1," Customer "),r())}function lu(i,p){if(i&1&&(a(0,"div",22)(1,"div",23),_(2,"i",24),l(3),r(),a(4,"div",25),l(5),r(),a(6,"div",25),l(7),r()()),i&2){let e=d().$implicit;o(3),m(" ",e.receipt.customer.details.fullName," "),o(2),m(" ",e.receipt.customer.details.email," "),o(2),m(" ",e.receipt.customer.details.phoneNumber," ")}}function su(i,p){if(i&1&&(a(0,"div",22)(1,"div",23),_(2,"i",26),l(3),r(),a(4,"div",25),l(5),r()()),i&2){let e=d().$implicit;o(3),m(" ",e.receipt.company.name," "),o(2),m(" ",e.receipt.company.companyAddress.email," ")}}function pu(i,p){if(i&1&&(a(0,"td",15),f(1,lu,8,3,"div",21)(2,su,6,2,"div",21),r()),i&2){let e=p.$implicit;o(),s("ngIf",e.receipt.customer),o(),s("ngIf",e.receipt.company)}}function du(i,p){i&1&&(a(0,"th",14),l(1," Total "),r())}function mu(i,p){if(i&1&&(a(0,"div",29),l(1),r()),i&2){let e=d().$implicit;o(),ge(" ",e.receipt.totalAmountInForignCurrency," ",e.receipt.currency," ")}}function uu(i,p){if(i&1&&(a(0,"td",15),l(1),u(2,"number"),a(3,"span",27),l(4),u(5,"translate"),r(),f(6,mu,2,2,"div",28),r()),i&2){let e=p.$implicit,t=d();o(),m(" ",F(2,3,e.receipt.totalExCreditNote,"1.2-2")," "),o(3),m(" ",v(5,6,"commerce.invoice.36")," "),o(2),s("ngIf",e.receipt.currency&&e.receipt.currency!=t.localCurrency)}}function fu(i,p){i&1&&(a(0,"th",14),l(1," Rest amount "),r())}function gu(i,p){if(i&1&&(a(0,"td",15),l(1),u(2,"number"),r()),i&2){let e=p.$implicit;o(),m(" ",F(2,1,e.unsettledPayment,"1.2-2")," ")}}function _u(i,p){i&1&&(a(0,"th",14),l(1," Due date "),r())}function vu(i,p){if(i&1&&(a(0,"td",15),l(1),u(2,"date"),r()),i&2){let e=p.$implicit;o(),m(" ",F(2,1,e.receipt.dueDate,"shortDate")," ")}}function hu(i,p){i&1&&_(0,"tr",30)}function Cu(i,p){if(i&1){let e=S();a(0,"tr",31),C("click",function(){let n=y(e).$implicit,c=d();return b(c.showInvoice(n))}),r()}if(i&2){let e=p.$implicit,t=d();ee("creditted",t.isCreditted(e))}}function xu(i,p){i&1&&(a(0,"div",35),_(1,"i",36),l(2),u(3,"translate"),r()),i&2&&(o(2),m(" ",v(3,1,"commerce.invoice.7")," "))}function yu(i,p){if(i&1&&(a(0,"tr",32)(1,"td",33),f(2,xu,4,3,"div",34),r()()),i&2){let e=d();o(2),s("ngIf",e.dataSource.loaded)}}var Tr=(()=>{class i{dashboard;receiptController;dialog;userService;localCurrency;cancelCustomerFilter(){this.dataSource.setSearchMap({})}paymentMethod;dataSource;paginator;sorter;displayedColumns=["incrementalReceiptNumber","name","amount","rest","duedate"];constructor(e,t,n,c){this.dashboard=e,this.receiptController=t,this.dialog=n,this.userService=c,this.paymentMethod=this.dashboard.paymentTypes[0],this.localCurrency=this.userService.getTenant().companyInformation.currency}ngOnInit(){}ngAfterViewInit(){setTimeout(()=>{this.dataSource=new Te(this.receiptController,"getInvoices",this.paginator,20,this.sorter,!0),this.dataSource.getBehaviorSubject().subscribe(e=>{console.log(e)})},100)}isCreditted(e){return e.receipt.isCanceled}showInvoice(e){let t=this.dialog.open(dn);t.componentInstance.invoiceDto=e,t.componentInstance.parent=this}filterByCustomer(e){this.dataSource.setSearchMap({customerId:e.id})}filterByCopany(e){this.dataSource.setSearchMap({companyId:e.id})}static \u0275fac=function(t){return new(t||i)(h(di),h(Je),h(q),h(Ze))};static \u0275cmp=w({type:i,selectors:[["app-invoice-list"]],viewQuery:function(t,n){if(t&1&&(N(eu,5),N(tu,5)),t&2){let c;L(c=j())&&(n.paginator=c.first),L(c=j())&&(n.sorter=c.first)}},decls:22,vars:5,consts:[["sorter","matSort"],["paginator",""],["mat-table","","matSort","","matSortActive","incrementalReceiptNumber","matSortDirection","desc",1,"tt_table",2,"width","100%",3,"dataSource"],["matColumnDef","incrementalReceiptNumber"],["mat-header-cell","","mat-sort-header","",4,"matHeaderCellDef"],["mat-cell","",4,"matCellDef"],["matColumnDef","name"],["matColumnDef","amount"],["matColumnDef","rest"],["matColumnDef","duedate"],["mat-header-row","",4,"matHeaderRowDef"],["mat-row","",3,"creditted","click",4,"matRowDef","matRowDefColumns"],["class","mat-row",4,"matNoDataRow"],[3,"pageSizeOptions"],["mat-header-cell","","mat-sort-header",""],["mat-cell",""],["class","fa fa-check",4,"ngIf"],["class","fa-light fa-hand-holding-dollar",4,"ngIf"],["title","Number of times sent"],[1,"fa","fa-check"],[1,"fa-light","fa-hand-holding-dollar"],["class","contactdetails",4,"ngIf"],[1,"contactdetails"],[1,"main"],[1,"fa-thin","fa-person"],[1,"sub"],[1,"fa-regular","fa-industry"],[1,"refunded"],["class","currencyrow",4,"ngIf"],[1,"currencyrow"],["mat-header-row",""],["mat-row","",3,"click"],[1,"mat-row"],["colspan","4",1,"mat-cell"],["class","nodatafound",4,"ngIf"],[1,"nodatafound"],[1,"fa-thin","fa-face-monocle"]],template:function(t,n){t&1&&(a(0,"table",2,0),Q(2,3),f(3,nu,2,0,"th",4)(4,au,6,4,"td",5),z(),Q(5,6),f(6,cu,2,0,"th",4)(7,pu,3,2,"td",5),z(),Q(8,7),f(9,du,2,0,"th",4)(10,uu,7,8,"td",5),z(),Q(11,8),f(12,fu,2,0,"th",4)(13,gu,3,4,"td",5),z(),Q(14,9),f(15,_u,2,0,"th",4)(16,vu,3,4,"td",5),z(),f(17,hu,1,0,"tr",10)(18,Cu,1,2,"tr",11)(19,yu,3,1,"tr",12),r(),_(20,"mat-paginator",13,1)),t&2&&(s("dataSource",n.dataSource),o(17),s("matHeaderRowDef",n.displayedColumns),o(),s("matRowDefColumns",n.displayedColumns),o(2),s("pageSizeOptions",Pe(4,iu)))},dependencies:[M,Xe,Fe,Be,je,Re,Ve,Ue,Ne,Le,He,$e,Ge,qe,Ke,E,me,ue],styles:[".contactdetails[_ngcontent-%COMP%]   .main[_ngcontent-%COMP%]{font-size:16px;font-weight:400}.contactdetails[_ngcontent-%COMP%]   .sub[_ngcontent-%COMP%]{color:#666}tr[_ngcontent-%COMP%]{cursor:pointer}tr[_ngcontent-%COMP%]:hover{background-color:#efefef}.creditted[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]{color:#777}.refunded[_ngcontent-%COMP%]{display:none}.creditted[_ngcontent-%COMP%]   .refunded[_ngcontent-%COMP%]{display:block;color:red;font-style:italic}.nodatafound[_ngcontent-%COMP%]{padding:20px;text-align:center}.nodatafound[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]{font-size:50px;display:block;text-align:center;margin:15px}.fa-check[_ngcontent-%COMP%]{color:green}.fa-hand-holding-dollar[_ngcontent-%COMP%]{color:red}.currencyrow[_ngcontent-%COMP%]{color:#888}"]})}return i})();function wu(i,p){i&1&&(a(0,"div",8),_(1,"i",9),r())}function Su(i,p){if(i&1&&(a(0,"div",21),l(1),_(2,"br"),l(3),u(4,"date"),u(5,"date"),r()),i&2){let e=d().$implicit;o(),m(" ",e.hotelBookingAccountEntry.receiptSubText," "),o(2),ge(" ",F(4,3,e.hotelBookingAccountEntry.startDate,"shortDate")," - ",F(5,6,e.hotelBookingAccountEntry.endDate,"shortDate")," ")}}function Iu(i,p){if(i&1){let e=S();a(0,"div",19),C("click",function(){y(e);let n=d().$implicit;return d(2).openReservation(n),b(!1)}),l(1),u(2,"translate"),r()}i&2&&(o(),m(" ",v(2,1,"commerce.accoutpickerdialog.6")," "))}function Mu(i,p){i&1&&(a(0,"span"),l(1),u(2,"translate"),r()),i&2&&(o(),m(" ",v(2,1,"commerce.accoutpickerdialog.7")," "))}function Du(i,p){i&1&&(a(0,"span"),l(1),u(2,"translate"),r()),i&2&&(o(),m(" ",v(2,1,"commerce.accoutpickerdialog.8")," "))}function Pu(i,p){if(i&1){let e=S();a(0,"div")(1,"mat-checkbox",13),C("change",function(){let n=y(e).$implicit,c=d(2);return b(c.select(n))}),a(2,"div",14),f(3,Su,6,9,"div",15),a(4,"div",16),l(5),u(6,"translate"),u(7,"number"),r()(),a(8,"div",17),f(9,Iu,3,3,"div",18),a(10,"div",19),C("click",function(){let n=y(e).$implicit,c=d(2);return b(c.toggleHide(n))}),f(11,Mu,3,3,"span",20)(12,Du,3,3,"span",20),r()()()()}if(i&2){let e=p.$implicit;o(),ee("hidden",e.hideFromInvoiceList),o(2),s("ngIf",e.hotelBookingAccountEntry),o(2),ge(" ",v(6,8,"commerce.accoutpickerdialog.3")," ",v(7,10,e.restAmountIncTax)," "),o(4),s("ngIf",e.hotelBookingAccountEntry),o(2),s("ngIf",!e.hideFromInvoiceList),o(),s("ngIf",e.hideFromInvoiceList)}}function Eu(i,p){if(i&1&&(a(0,"div",10)(1,"div",11),l(2),r(),f(3,Pu,13,12,"div",12),r()),i&2){let e=p.$implicit;o(2),m(" ",e.key.name," "),o(),s("ngForOf",e.value)}}var kr=(()=>{class i{accountController;customerController;bookingController;dialogRef;companyController;accounts;sorted=new Map;selectedAccounts=[];loading=!0;filter={};constructor(e,t,n,c,g){if(this.accountController=e,this.customerController=t,this.bookingController=n,this.dialogRef=c,this.companyController=g,this.filter.showOnlyExpired=!1,localStorage.getItem("account_picker_dialog_filter"))try{this.filter=JSON.parse(localStorage.getItem("account_picker_dialog_filter"))}catch{}this.loadAll()}loadAll(){this.saveFilter(),this.accountController.getOpenAccounts(this.filter).subscribe(e=>{this.accounts=e,this.loadCompanyAndCustomers()})}select(e){this.selectedAccounts.indexOf(e)>-1?this.selectedAccounts=this.selectedAccounts.filter(t=>t.id!=e.id):this.selectedAccounts.push(e)}loadCompanyAndCustomers(){let e=this.accounts.map(g=>g.customerId),t=this.accounts.map(g=>g.companyId),n=this.customerController.getByIds(e),c=this.companyController.getByIds(t);this.sorted.clear(),Qe([n,c]).subscribe(g=>{g[0].forEach(x=>{let P=this.accounts.filter(k=>k.customerId==x.id);this.sorted.set(x,P)}),g[1].forEach(x=>{let P=this.accounts.filter(k=>k.companyId==x.id);this.sorted.set(x,P)}),this.sortMapByName(),this.loading=!1})}sortMapByName(){let e=new Map([...this.sorted].sort(([t],[n])=>t.name.localeCompare(n.name)));this.sorted=e}save(){this.dialogRef.close(this.selectedAccounts)}openReservation(e){this.bookingController.getGroupsByAccountId([e.id]).subscribe(t=>{let n=t[0],c=n.bookings.filter(x=>x.accountId==e.id)[0].bookingId,g="/front/"+sessionStorage.getItem("tenant")+"/booking/group/"+n.id+"/"+c;window.open(g,"_blank")})}toggleHide(e){this.accountController.hideFromInvoiceList(e.id,!e.hideFromInvoiceList).subscribe(t=>{this.loadAll()})}saveFilter(){let e=JSON.stringify(this.filter);localStorage.setItem("account_picker_dialog_filter",e)}static \u0275fac=function(t){return new(t||i)(h(Ae),h(pi),h(ft),h(te),h(pt))};static \u0275cmp=w({type:i,selectors:[["app-account-picker-dialog"]],decls:22,vars:23,consts:[["mat-dialog-title",""],[1,"actions"],[1,"example-margin",2,"width","100%",3,"ngModelChange","change","ngModel"],["class","loading",4,"ngIf"],["class","customer",4,"ngFor","ngForOf"],[3,"align"],["mat-button","","color","primary",3,"mat-dialog-close"],["mat-button","","color","primary",3,"click"],[1,"loading"],[1,"fa","fa-spin","fa-spinner"],[1,"customer"],[1,"customerName"],[4,"ngFor","ngForOf"],[1,"account",3,"change"],[1,"entrycontent"],["class","hotelaccountinfo",4,"ngIf"],[1,"amount"],[1,"custactions"],["class","quickaction",3,"click",4,"ngIf"],[1,"quickaction",3,"click"],[4,"ngIf"],[1,"hotelaccountinfo"]],template:function(t,n){t&1&&(a(0,"div",0),l(1),u(2,"translate"),r(),a(3,"mat-dialog-content")(4,"div",1)(5,"mat-checkbox",2),Ie("ngModelChange",function(g){return Se(n.filter.showOnlyExpired,g)||(n.filter.showOnlyExpired=g),g}),C("change",function(){return n.loadAll()}),l(6),u(7,"translate"),r(),_(8,"br"),a(9,"mat-checkbox",2),Ie("ngModelChange",function(g){return Se(n.filter.showHidden,g)||(n.filter.showHidden=g),g}),C("change",function(){return n.loadAll()}),l(10),u(11,"translate"),r()(),f(12,wu,2,0,"div",3)(13,Eu,4,2,"div",4),u(14,"keyvalue"),r(),a(15,"mat-dialog-actions",5)(16,"button",6),l(17),u(18,"translate"),r(),a(19,"button",7),C("click",function(){return n.save()}),l(20),u(21,"translate"),r()()),t&2&&(o(),m(" ",v(2,11,"commerce.accoutpickerdialog.1"),`
`),o(4),we("ngModel",n.filter.showOnlyExpired),o(),m(" ",v(7,13,"commerce.accoutpickerdialog.4")," "),o(3),we("ngModel",n.filter.showHidden),o(),m(" ",v(11,15,"commerce.accoutpickerdialog.5")," "),o(2),s("ngIf",n.loading),o(),s("ngForOf",v(14,17,n.sorted)),o(2),s("align","end"),o(),s("mat-dialog-close",!1),o(),m(" ",v(18,19,"booking.closeroomdialog.6")," "),o(3),m(" ",v(21,21,"commerce.accoutpickerdialog.2")," "))},dependencies:[T,M,de,be,oe,K,V,et,Ui,O,E,me,xi,ue],styles:[".entrycontent[_ngcontent-%COMP%]{margin:10px}.customer[_ngcontent-%COMP%]{background-color:#f5f8fb;margin-bottom:30px;padding:10px;border-radius:5px}.account[_ngcontent-%COMP%]{width:100%;border-top:solid 1px #FFF;position:relative}.entrycontent[_ngcontent-%COMP%]{width:100%}.entrycontent[_ngcontent-%COMP%]   .hotelaccountinfo[_ngcontent-%COMP%], .entrycontent[_ngcontent-%COMP%]   .amount[_ngcontent-%COMP%]{font-size:12px}.loading[_ngcontent-%COMP%]{text-align:center;font-size:15px}.actions[_ngcontent-%COMP%]{margin-bottom:20px;background-color:#efefef;border-radius:5px;padding:10px}.customerName[_ngcontent-%COMP%]{padding:10px}.account[_ngcontent-%COMP%]   .custactions[_ngcontent-%COMP%]{display:none;position:absolute;right:0;top:0;height:100px}.account[_ngcontent-%COMP%]:hover   .custactions[_ngcontent-%COMP%]{display:block}.account[_ngcontent-%COMP%]   .quickaction[_ngcontent-%COMP%]{font-size:10px;background-color:#fff;border-radius:5px;margin-top:5px;display:block;width:60px;text-align:center;padding:5px;line-height:13px;color:#00f}.account.hidden[_ngcontent-%COMP%]   .entrycontent[_ngcontent-%COMP%]{color:#666}"]})}return i})();var Ar=(()=>{class i{accountController;account;orderSubject=new it;loadingAccountId;deleteAccount(){}constructor(e){if(this.accountController=e,sessionStorage.getItem("currentAccount")!=null){var t=sessionStorage.getItem("currentAccount");this.load(t)}}onAccountChange(){return this.orderSubject.asObservable()}changeAccount(e){this.account=null,this.load(e)}load(e,t=!1){this.account&&this.account.id==e&&!t||e!=this.loadingAccountId&&(this.loadingAccountId=e,this.accountController.getAccount(e).subscribe(n=>{this.loadingAccountId=null,this.setAccount(n)}))}setAccount(e){this.account=e,this.account!=null?sessionStorage.setItem("currentAccount",this.account.id):sessionStorage.removeItem("currentAccount"),this.orderSubject.next(this.account)}getAccount(){return this.account}getCurrentAccountId(){return this.account?this.account.id:""}hasAccount(){return this.account!=null}add(e,t,n=null){this.account?(t.currency=this.account.currency,this.accountController.addToAccount(this.account.id,t).subscribe(c=>{this.setAccount(c)})):this.accountController.createAccount(n).subscribe(c=>{this.setAccount(c),this.add(e,t)})}reload(){this.account&&this.account.id&&this.load(this.account.id,!0)}refreshForced(){this.account&&this.account.id&&this.load(this.account.id,!0)}getTotal(e,t=!0){var n=0;return e.entries.forEach(c=>{c.units.forEach(g=>{t?n+=Math.round((g.totalIncTaxes+Number.EPSILON)*100)/100:n+=Math.round((g.totalExTaxes+Number.EPSILON)*100)/100})}),n}static \u0275fac=function(t){return new(t||i)(Y(Ae))};static \u0275prov=re({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();var ku=["receiptview"],Or=(()=>{class i{accountService;matDialogRef;receipt;account;receiptview;sub;overrideSendEmail;constructor(e,t){this.accountService=e,this.matDialogRef=t}ngOnDestroy(){this.sub.unsubscribe()}ngAfterViewInit(){this.receiptview.overrideEmail=this.overrideSendEmail,this.sub=this.receiptview.afterCreditted().subscribe(()=>{this.accountService.reload(),this.matDialogRef.close()})}static \u0275fac=function(t){return new(t||i)(h(Ar),h(te))};static \u0275cmp=w({type:i,selectors:[["app-receipt-view-dialog"]],viewQuery:function(t,n){if(t&1&&N(ku,5),t&2){let c;L(c=j())&&(n.receiptview=c.first)}},decls:3,vars:2,consts:[["receiptview",""],[3,"receipt","account"]],template:function(t,n){t&1&&(a(0,"mat-dialog-content"),_(1,"app-receipt-view",1,0),r()),t&2&&(o(),s("receipt",n.receipt)("account",n.account))},dependencies:[K,pn]})}return i})();var Fr=(()=>{class i{productController;productMap;add(e){this.productMap.set(e.id,e)}constructor(e){this.productController=e,this.productMap=new Map}triggerSubject(e,t){var n=[];e.forEach(c=>{n.push(this.productMap.get(c))}),t.next(n)}load(e){var t=new it,n=[];for(var c of e)this.productMap.get(c)||n.push(c);return n.length>0?this.productController.getProductsById(n).subscribe(g=>{g.forEach(x=>{this.productMap.set(x.id,x)}),this.triggerSubject(e,t)}):setTimeout(g=>{this.triggerSubject(e,t)},0),t.asObservable()}getProduct(e){return this.productMap.get(e)}clearCache(){this.productMap.clear()}static \u0275fac=function(t){return new(t||i)(Y(ke))};static \u0275prov=re({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();var Ou=["itemselector"],Fu=["paymentselector"];function Vu(i,p){if(i&1&&(a(0,"div"),_(1,"app-online-payment-request",8),r()),i&2){let e=d();o(),s("payment",e.payment)("parent",e)}}function Bu(i,p){if(i&1&&(a(0,"div"),_(1,"app-refund",9),r()),i&2){let e=d();o(),s("payment",e.payment)("parent",e)("account",e.data.account)}}function Ru(i,p){i&1&&(a(0,"div"),_(1,"app-customer-select-stage"),r())}function Nu(i,p){i&1&&(a(0,"div"),_(1,"app-invoice-payment"),r())}function Lu(i,p){i&1&&(a(0,"div"),_(1,"app-payment-selector",null,1),r())}function ju(i,p){if(i&1){let e=S();a(0,"mat-dialog-actions",10)(1,"button",11),l(2," Cancel "),r(),a(3,"button",12),C("click",function(){y(e);let n=d();return b(n.next())}),l(4," Next "),r()()}if(i&2){let e=d();s("align","end"),o(),s("mat-dialog-close",!1),o(2),s("disabled",!e.valid)}}var ui=(()=>{class i{dialogRef;dialog;receiptController;productService;data;payment={};onlinePaymentRequest=!1;prePayments=[];paymentType=null;paymentSelected=!1;configurateRefund=!1;configurePayment=!1;selector;paymentSelector;selectCustomer=!1;selectedCompany;selectedCustomer;invoicePayment;get title(){return this.stage=="preselect"?"pos.paymentprocessdialog.6":this.stage=="itemselector"?"pos.paymentprocessdialog.4":this.stage=="refundconfig"?"pos.paymentprocessdialog.13":this.stage=="onlinepaymentrequest"?"pos.paymentprocessdialog.23":this.stage=="configurepayment"?"pos.paymentprocessdialog.29":this.stage=="invoice"?"pos.paymentprocessdialog.34":""}getAccountPayments(){return this.selector.accountPayments}get stage(){return this.onlinePaymentRequest?"onlinepaymentrequest":this.configurateRefund?"refundconfig":this.configurePayment&&this.invoicePayment?"invoice":this.configurePayment?"configurepayment":"itemselector"}constructor(e,t,n,c,g){this.dialogRef=e,this.dialog=t,this.receiptController=n,this.productService=c,this.data=g;for(let x of g.accounts)for(let P of x.entries)this.productService.add(P.product);g.payment&&this.handlePayment(g.payment),g.paymentToRefund&&this.showRefund(g.paymentToRefund),g.type=="paymentlink"&&this.startOnlinePaymentRequest(),g.type=="invoice"&&(this.invoicePayment=!0)}ngAfterViewInit(){}next(){if(this.stage=="itemselector"){if(this.selectedCompanyAndCustomerIds.length>1){this.selectCustomer=!0;return}this.configurePayment=!0;return}if(this.stage=="configurepayment"){this.createReceipt();return}}get valid(){return this.stage=="itemselector"&&this.selector?this.selector.valid:this.stage=="configurepayment"?this.paymentSelector?this.paymentSelector.isOk:!1:!0}ngOnInit(){}selectPaymentType(e){this.selectCustomer=this.selectedCompanyAndCustomerIds.length>1,this.payment=this.selector.payment,this.paymentType=e}handlePayment(e){this.paymentSelected=!0,this.payment=e}showRefund(e){this.payment=e,this.configurateRefund=!0,this.paymentSelected=!0}cancelRefund(){this.payment=null,this.configurateRefund=!1,this.paymentSelected=!1}getTotalPrepaid(){let e=0;return this.prePayments.forEach(t=>{e+=t.totalCharged}),e}startPayment(e){this.prePayments=e,this.paymentSelected=!0}onlyUnique(e,t,n){return n.indexOf(e)===t}get selectedCompanyAndCustomerIds(){return this.getAccountPayments().map(e=>{let t=this.data.accounts.filter(n=>n.id==e.accountId)[0];if(t.companyId)return t.companyId;if(t.customerId)return t.customerId}).filter(this.onlyUnique)}createReceipt(e="receipt",t=0,n="",c=null,g=null){var x={};if(x.accountPayments=this.getAccountPayments(),e=="invoice"){let P={};P.paymentId=c.id,P.selected=!0,x.paymentSetups=[P]}else x.paymentSetups=this.paymentSelector.payments;x.invoiceDate=g,x.type=e,x.dueDays=t,x.invoiceNote=n,x.companyId=this.selectedCompany?this.selectedCompany.id:null,x.customerId=this.selectedCustomer?this.selectedCustomer.id:null,this.receiptController.createReceipt(x).subscribe(P=>{P.type=="invoice"?this.receiptController.getInvoice(P.id).subscribe(k=>{let A=this.dialog.open(dn);A.componentInstance.invoiceDto=k,this.dialogRef.close(!0)}):(this.dialogRef.close(!0),this.showReceipt(P))})}showReceipt(e){let t=this.dialog.open(Or);if(t.componentInstance.receipt=e,this.data.paymentLinkData.accountId){let n=this.data.accounts.filter(c=>c.id==this.data.paymentLinkData.accountId)[0];t.componentInstance.account=n}}startOnlinePaymentRequest(){this.onlinePaymentRequest=!0}static \u0275fac=function(t){return new(t||i)(h(te),h(q),h(Je),h(Fr),h(ut))};static \u0275cmp=w({type:i,selectors:[["app-payment-process-dialog"]],viewQuery:function(t,n){if(t&1&&(N(Ou,5),N(Fu,5)),t&2){let c;L(c=j())&&(n.selector=c.first),L(c=j())&&(n.paymentSelector=c.first)}},decls:14,vars:14,consts:[["itemselector",""],["paymentselector",""],["mat-dialog-title",""],[1,"mat-typography"],[4,"ngIf"],[3,"hidden"],[3,"payment","data","parent"],[3,"align",4,"ngIf"],[3,"payment","parent"],[3,"payment","parent","account"],[3,"align"],["mat-flat-button","",3,"mat-dialog-close"],["mat-flat-button","",3,"click","disabled"]],template:function(t,n){t&1&&(a(0,"h2",2),l(1),u(2,"translate"),r(),a(3,"mat-dialog-content",3),f(4,Vu,2,2,"div",4)(5,Bu,2,3,"div",4),a(6,"div",5)(7,"div",5),_(8,"app-item-selector",6,0),r(),f(10,Ru,2,0,"div",4),r(),f(11,Nu,2,0,"div",4)(12,Lu,3,0,"div",4),r(),f(13,ju,5,3,"mat-dialog-actions",7)),t&2&&(o(),m(" ",v(2,12,n.title),`
`),o(3),s("ngIf",n.stage=="onlinepaymentrequest"),o(),s("ngIf",n.stage=="refundconfig"),o(),s("hidden",n.stage!="itemselector"),o(),s("hidden",n.paymentType||n.selectCustomer),o(),s("payment",n.payment)("data",n.data)("parent",n),o(2),s("ngIf",n.selectCustomer),o(),s("ngIf",n.stage=="invoice"),o(),s("ngIf",n.stage=="configurepayment"),o(),s("ngIf",n.stage=="itemselector"||n.stage=="configurepayment"))}})}return i})(),Lt=class{account;accounts=[];prePayments=[];payment;paymentToRefund;selectedAccounts=[];paymentLinkData=new Pn;activatedPaymentTypes;type="";invoiceType},Pn=class{subject="";body="";email="";prefix="";phone="";accountId=""};var Vr=(()=>{class i{dialogRef;heading="booking.groupview.changecustomerdialog.1";desc="booking.groupview.changecustomerdialog.5";constructor(e){this.dialogRef=e}ngOnInit(){}static \u0275fac=function(t){return new(t||i)(h(te))};static \u0275cmp=w({type:i,selectors:[["app-change-customer-dialog"]],decls:19,vars:16,consts:[["mat-dialog-title",""],[1,"mat-typography"],[1,"option","company",3,"click"],[1,"fal","fa-industry-alt"],[1,"option","private",3,"click"],[1,"fal","fa-user"],["align","end"],["mat-button","",3,"mat-dialog-close"]],template:function(t,n){t&1&&(a(0,"h2",0),l(1),u(2,"translate"),r(),a(3,"mat-dialog-content",1)(4,"p"),l(5),u(6,"translate"),r(),a(7,"div",2),C("click",function(){return n.dialogRef.close("company")}),_(8,"i",3),l(9),u(10,"translate"),r(),a(11,"div",4),C("click",function(){return n.dialogRef.close("private")}),_(12,"i",5),l(13),u(14,"translate"),r()(),a(15,"mat-dialog-actions",6)(16,"button",7),l(17),u(18,"translate"),r()()),t&2&&(o(),I(v(2,6,n.heading)),o(4),m(" ",v(6,8,n.desc)," "),o(4),m(" ",v(10,10,"booking.groupview.changecustomerdialog.3")," "),o(4),m(" ",v(14,12,"booking.groupview.changecustomerdialog.2")," "),o(3),s("mat-dialog-close",!1),o(),I(v(18,14,"booking.groupview.changecustomerdialog.4")))},dependencies:[de,be,oe,K,O,E],styles:[".option[_ngcontent-%COMP%]{display:inline-block;text-align:center;width:100px;margin:20px;cursor:pointer}.option[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]{font-size:30px;display:block}.option.company[_ngcontent-%COMP%]:hover{color:#2d31b8}.option.private[_ngcontent-%COMP%]:hover{color:green}"]})}return i})();var Uu=(i,p)=>({totalUnsettled:i,unsettledInvoices:p}),Hu=(i,p)=>({overdue:i,overDueInvoices:p});function $u(i,p){if(i&1){let e=S();a(0,"button",8),C("click",function(){let n=y(e).$implicit,c=d();return b(c.createNewInvoice(n))}),_(1,"i",16),l(2),r()}if(i&2){let e=p.$implicit;o(2),m(" ",e.name," ")}}function Gu(i,p){i&1&&(a(0,"span"),l(1),u(2,"translate"),r()),i&2&&(o(),m(" ",v(2,1,"commerce.invoice.34")," "))}function qu(i,p){i&1&&(a(0,"span"),l(1),u(2,"translate"),r()),i&2&&(o(),m(" ",v(2,1,"commerce.invoice.33")," "))}var Br=(()=>{class i{receiptController;dialog;paymentController;dashboard;summary;searchControl=new Ee("");overdue=new Ee(!1);unsettled=new Ee(!1);filteredByCustomer=!1;invoicePaymenTypes=[];constructor(e,t,n,c){this.receiptController=e,this.dialog=t,this.paymentController=n,this.dashboard=c,this.receiptController.getInvoiceSummary().subscribe(g=>{this.summary=g,this.paymentController.getActivatedPaymentTypes().subscribe(x=>{this.invoicePaymenTypes=x.filter(P=>P.type=="INVOICE"&&!P.deleted)})}),this.searchControl.valueChanges.subscribe(g=>{g||this.dashboard.invoiceList.dataSource.setSearchMap({searchword:g})}),this.overdue.valueChanges.subscribe(g=>{this.dashboard.invoiceList.paginator.pageIndex=0,g?(this.unsettled.patchValue(!1,{emitEvent:!1,onlySelf:!0}),this.searchControl.disable({emitEvent:!1,onlySelf:!0})):this.searchControl.enable(),this.search()}),this.unsettled.valueChanges.subscribe(g=>{this.dashboard.invoiceList.paginator.pageIndex=0,g?(this.overdue.patchValue(!1,{emitEvent:!1,onlySelf:!0}),this.searchControl.disable({emitEvent:!1,onlySelf:!0})):this.searchControl.enable(),this.search()})}createNewInvoice(e){this.dialog.open(kr).afterClosed().subscribe(n=>{if(n){var c=new Lt;c.accounts=n,c.selectedAccounts=n,c.invoiceType=e,c.type="invoice",c.prePayments=[],console.log(c.activatedPaymentTypes);var g=this.dialog.open(ui,{data:c});g.afterClosed().subscribe(x=>{this.dashboard.invoiceList.dataSource.refresh()})}})}search(){if(this.unsettled.value){this.dashboard.invoiceList.dataSource.setSearchMap({type:"unsetteled"});return}if(this.overdue.value){this.dashboard.invoiceList.dataSource.setSearchMap({type:"overdue"});return}let e=this.searchControl.value;this.dashboard.invoiceList.dataSource.setSearchMap({searchword:e})}filterByCustomer(){if(this.filteredByCustomer)this.dashboard.invoiceList.cancelCustomerFilter(),this.filteredByCustomer=!1;else{var e=this.dialog.open(Vr);e.afterClosed().subscribe(t=>{if(t=="company"){var n=new Zi;n.singleSelect=!0;var c=this.dialog.open(Si,{data:n});c.afterClosed().subscribe(P=>{P&&(this.dashboard.invoiceList.filterByCopany(P),this.filteredByCustomer=!0)})}if(t=="private"){var g=new hi;g.singleSelect=!0;var x=this.dialog.open(Fi,{data:g});x.afterClosed().subscribe(P=>{if(P){var k=P;this.dashboard.invoiceList.filterByCustomer(k),this.filteredByCustomer=!0}})}})}}static \u0275fac=function(t){return new(t||i)(h(Je),h(q),h(We),h(di))};static \u0275cmp=w({type:i,selectors:[["app-summary"]],decls:39,vars:35,consts:[[1,"boxes"],[1,"summary","box"],[1,"title"],[1,"row"],[1,"fa-regular","fa-sensor-on"],[1,"fa-thin","fa-alarm-clock"],[1,"row","buttonsrow"],["mat-flat-button","","color","primary",3,"click",4,"ngFor","ngForOf"],["mat-flat-button","","color","primary",3,"click"],[1,"fa","fa-filter"],[4,"ngIf"],[1,"search","box"],[1,"filtermenu"],[1,"example-full-width"],["matInput","","placeholder","","value","",3,"keydown.enter","formControl"],[3,"formControl"],[1,"fa","fa-plus"]],template:function(t,n){t&1&&(a(0,"div",0)(1,"div",1)(2,"div",2),l(3),u(4,"translate"),r(),a(5,"div",3),_(6,"i",4),l(7),u(8,"translate"),r(),a(9,"div",3),_(10,"i",5),l(11),u(12,"translate"),r(),a(13,"div",6),f(14,$u,3,1,"button",7),l(15," \xA0 "),a(16,"button",8),C("click",function(){return n.filterByCustomer()}),_(17,"i",9),f(18,Gu,3,3,"span",10)(19,qu,3,3,"span",10),r()()(),a(20,"div",11)(21,"div",2),l(22),u(23,"translate"),r(),a(24,"div",12)(25,"div")(26,"mat-form-field",13)(27,"mat-label"),l(28),u(29,"translate"),r(),a(30,"input",14),C("keydown.enter",function(){return n.search()}),r()()(),a(31,"div")(32,"mat-slide-toggle",15),l(33),u(34,"translate"),r(),_(35,"br"),a(36,"mat-slide-toggle",15),l(37),u(38,"translate"),r()()()()()),t&2&&(o(3),m(" ",v(4,13,"commerce.invoice.3")," "),o(4),m(" ",F(8,15,"commerce.invoice.5",fi(29,Uu,n.summary.totalUnsettled,n.summary.unsettledInvoices))," "),o(4),m(" ",F(12,18,"commerce.invoice.2",fi(32,Hu,n.summary.totalDue,n.summary.overDueInvoices))," "),o(3),s("ngForOf",n.invoicePaymenTypes),o(4),s("ngIf",n.filteredByCustomer),o(),s("ngIf",!n.filteredByCustomer),o(3),m(" ",v(23,21,"booking.bookinglist.filter.9")," "),o(6),m(" ",v(29,23,"commerce.productpicker.4")," "),o(2),s("formControl",n.searchControl),o(2),s("formControl",n.unsettled),o(),m(" ",v(34,25,"commerce.invoice.6")," "),o(3),s("formControl",n.overdue),o(),m(" ",v(38,27,"commerce.invoice.4")," "))},dependencies:[T,M,B,H,G,U,V,le,O,ni,E],styles:[".filtermenu[_ngcontent-%COMP%], .boxes[_ngcontent-%COMP%]{display:flex;gap:20px}.boxes[_ngcontent-%COMP%]   .box[_ngcontent-%COMP%]{background-color:#fff;border-radius:5px;padding:20px;flex:1 1 49%}.title[_ngcontent-%COMP%]{font-size:18px;font-weight:500;margin-bottom:10px}.row[_ngcontent-%COMP%]{font-size:14px;margin-bottom:5px}.row[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]{width:30px;text-align:center;display:inline-block}.row.buttonsrow[_ngcontent-%COMP%]{text-align:center;padding:10px}mat-slide-toggle[_ngcontent-%COMP%]{margin-bottom:10px}"]})}return i})();var Rr=(()=>{class i{httpService;urlService;checkPayment(e){let t=[];t.push({name:"paymentId",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/externalapi/easybynets/checkPayment",{params:n})}constructor(e,t){this.httpService=e,this.urlService=t}getSettings(e){let t=[];t.push({name:"id",value:e});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/externalapi/easybynets/getPayment",{params:n})}handleWebHook(e,t){let n=[];n.push({name:"tid",value:t});let c=new $;for(let x of n)c=c.append(x.name,x.value);let g=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/externalapi/easybynets/webhook",e,{headers:g,params:c})}savePayment(e,t,n,c,g){let x=[];x.push({name:"liveKey",value:t}),x.push({name:"testKey",value:n}),x.push({name:"production",value:c.toString()}),x.push({name:"useForPaymentLink",value:g.toString()});let P=new $;for(let A of x)P=P.append(A.name,A.value);let k=new Z().set("Content-type","application/json");return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/externalapi/easybynets/savePayment",e,{headers:k,params:P})}static \u0275fac=function(t){return new(t||i)(Y(_e),Y(ve))};static \u0275prov=re({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();var zu=(i,p)=>["../../group",i,p];function Wu(i,p){i&1&&(a(0,"div"),_(1,"i",13),r())}function Ku(i,p){if(i&1&&(a(0,"div"),l(1),r()),i&2){let e=d().$implicit;o(),m(" ",e.group.incrementalId," ")}}function Xu(i,p){if(i&1&&(a(0,"span",19)(1,"a",20),l(2),r()()),i&2){let e=p.$implicit;o(),s("routerLink",fi(3,zu,e.groupId,e.accountId)),o(),ge(" ",e.name," - ",e.stay," ")}}function Yu(i,p){if(i&1){let e=S();a(0,"div",16)(1,"div")(2,"i",17),C("click",function(){let n=y(e).$implicit,c=d(2);return b(c.openPayment(n))}),r(),l(3),u(4,"date"),r(),a(5,"div"),l(6),r(),a(7,"div"),l(8),r(),a(9,"div"),l(10),r(),a(11,"div"),f(12,Ku,2,1,"div",11),r(),a(13,"div"),l(14),r(),a(15,"div"),f(16,Xu,3,6,"span",18),r(),a(17,"div"),l(18),r()()}if(i&2){let e=p.$implicit;ee("isRefunded",e.isRefunded),o(3),m(" ",F(4,10,e.chargeDate,"short")," "),o(3),m(" ",e.id," "),o(2),m(" ",e.paymentId," "),o(2),m(" ",e.paymentType," "),o(2),s("ngIf",e.group),o(2),m(" ",e.bookingOwner," "),o(2),s("ngForOf",e.guests),o(2),m(" ",e.amount," ")}}function Ju(i,p){if(i&1&&(a(0,"div",14),f(1,Yu,19,13,"div",15),r()),i&2){let e=d();o(),s("ngForOf",e.rowsToShow)}}var HC=(()=>{class i{paymentController;dialog;userService;bookingController;companyController;customerController;datePipe;accountController;easyByNetsController;searchField=new Ee("");accounts=new Map;groups=new Map;companies=new Map;customers=new Map;loading=!1;rows=[];subscribeRangeChange(){this.range.valueChanges.subscribe(e=>{e.start&&e.end&&this.loadData()})}loadData(){this.loading=!0,this.paymentController.getPaymentCharges(this.range.value.start,this.range.value.end).subscribe(e=>{this.createList(e)})}createList(e){let t=[];e.forEach(g=>{g.payment.accountIds.forEach(x=>{t.indexOf(x)<0&&t.push(x)})});let n=this.bookingController.getGroupsByAccountId(t),c=this.accountController.getAccounts(t);Qe([c,n]).subscribe(g=>{g[0].forEach(k=>{this.accounts.set(k.id,k)}),g[1].forEach(k=>{k.bookings.forEach(A=>{this.groups.set(A.accountId,k)})});let x=g[0].map(k=>k.customerId),P=g[0].map(k=>k.companyId);Qe([this.companyController.getByIds(P),this.customerController.getByIds(x)]).subscribe(k=>{k[0].forEach(A=>{this.companies.set(A.id,A)}),k[1].forEach(A=>{this.customers.set(A.id,A)}),this.rows=e.map(A=>{let ie=new Tn;return ie.id=A.charge.chargeId,ie.paymentId=A.payment.id,ie.chargeId=A.charge.chargeId,ie.paymentType=A.payment.type.name,ie.chargeDate=A.charge.chargeDate,ie.guests=this.getGuest(A),ie.amount=A.charge.totalCharged,ie.bookingOwner=this.getBookerOwner(A),ie.group=this.getGroup(A),ie.isRefunded=A.payment.totalCharged<.02&&A.payment.totalCharged>-.02,ie}),this.loading=!1})})}openPayment(e){this.paymentController.getPaymentById(e.paymentId).subscribe(t=>{let n=new Lt;n.paymentToRefund=t,n.type="receipt",n.accounts=[];let c=this.dialog.open(ui,{data:n})})}getGroup(e){return e.payment.accountIds.length==0?null:this.groups.get(e.payment.accountIds[0])}getBookerOwner(e){if(e.payment.accountIds.length==0)return"";let t=this.accounts.get(e.payment.accountIds[0]);return t.companyId?this.companies.get(t.companyId).name:t.customerId?this.customers.get(t.customerId).name:""}getGuest(e){let t=[];return e.payment.accountIds.forEach(n=>{let c=this.accounts.get(n),g=c.entries.filter(P=>P.product.type=="hotel")[0];if(g==null)return;let x=new En;x.stay=g.product.defaultName+" ( "+this.datePipe.transform(g.startDate,"shortDate")+" - "+this.datePipe.transform(g.endDate,"shortDate")+" ) ",x.name=g.receiptSubText,x.accountId=c.id,this.groups.get(c.id)&&(x.groupId=this.groups.get(c.id).id),t.push(x)}),t}downloadExcel(){let e=Ye.book_new(),t=[];t.push(["Date","Payment type","Payment id","Charge id","Group id","Owner","Guests","Account ids","Amount"]),this.rowsToShow.forEach(k=>{let A=k.guests.map(tt=>tt.name+" - "+tt.stay).join(`
`),ie=k.guests.map(tt=>tt.accountId).join(","),Pt=[this.datePipe.transform(k.chargeDate,"short"),k.paymentType,k.paymentId,k.chargeId,k.group?k.group.incrementalId:-1,k.bookingOwner,A,ie,k.amount];t.push(Pt)});let n=Ye.aoa_to_sheet(t);Ye.book_append_sheet(e,n,"sheetName");let c=wi(e,{bookType:"xlsx",type:"array"}),g=new Blob([c],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),x=window.URL.createObjectURL(g),P=document.createElement("a");P.href=x,P.download="data.xlsx",P.click(),window.URL.revokeObjectURL(x)}range=new Me({start:new R,end:new R});constructor(e,t,n,c,g,x,P,k,A){this.paymentController=e,this.dialog=t,this.userService=n,this.bookingController=c,this.companyController=g,this.customerController=x,this.datePipe=P,this.accountController=k,this.easyByNetsController=A;var ie=new Date;ie.setDate(ie.getDate()-14);let Pt=new Date;this.subscribeRangeChange(),this.range.patchValue({start:ie,end:Pt})}ngAfterViewInit(){}showData(e){let t=new wo;t.cell={},t.cell.invoicePayments={},t.cell.accountIds={},t.cell.paymentCharges=e.charges;let n=this.dialog.open(bo,{data:t,width:"600px"})}search(){let e=this.searchField.value.toLowerCase();this.rows.forEach(t=>{if(e.length==0)t.hidden=!1;else{let n=JSON.stringify(t).toLowerCase().indexOf(e)>-1;t.hidden=!n}})}get rowsToShow(){return this.rows.filter(e=>!e.hidden)}attachPaymentToAccount(e){let n=prompt("Enter account id(s) comma seperated").split(",");this.paymentController.attachPayment(n,e.id).subscribe(c=>{this.loadData()})}checkEasyPayment(e){this.easyByNetsController.checkPayment(e.id).subscribe(t=>{this.loadData()})}static \u0275fac=function(t){return new(t||i)(h(We),h(q),h(Ze),h(ft),h(pt),h(pi),h(Yt),h(Ae),h(Rr))};static \u0275cmp=w({type:i,selectors:[["app-payments-list"]],decls:22,vars:12,consts:[["picker",""],[1,"header"],[1,"header_sub_info"],[1,"example-full-width"],["matInput","","placeholder","","value","",3,"keyup","formControl"],[1,"daterange"],[1,"daterangepicker",3,"formGroup","rangePicker"],["matStartDate","","formControlName","start","placeholder","Start date"],["matEndDate","","formControlName","end","placeholder","End date"],["matSuffix","",3,"for"],["mat-flat-button","","color","primary",3,"click"],[4,"ngIf"],["class","box",4,"ngIf"],[1,"fa","fa-spin","fa-spinner"],[1,"box"],["class","row",3,"isRefunded",4,"ngFor","ngForOf"],[1,"row"],[1,"fa","fa-edit",3,"click"],["class","guestrow","style","color: blue",4,"ngFor","ngForOf"],[1,"guestrow",2,"color","blue"],[3,"routerLink"]],template:function(t,n){if(t&1){let c=S();a(0,"div",1),l(1),u(2,"translate"),r(),a(3,"div",2),l(4),u(5,"translate"),r(),a(6,"mat-form-field",3)(7,"mat-label"),l(8,"Search"),r(),a(9,"input",4),C("keyup",function(){return y(c),b(n.search())}),r()(),a(10,"mat-form-field",5)(11,"mat-date-range-input",6),_(12,"input",7)(13,"input",8),r(),_(14,"mat-datepicker-toggle",9)(15,"mat-date-range-picker",null,0),r(),l(17,` \xA0\xA0
`),a(18,"button",10),C("click",function(){return y(c),b(n.downloadExcel())}),l(19,` Download Excel
`),r(),f(20,Wu,2,0,"div",11)(21,Ju,2,1,"div",12)}if(t&2){let c=fe(16);o(),m(" ",v(2,8,"commerce.payments.1"),`
`),o(3),m(" ",v(5,10,"commerce.payments.2"),`
`),o(5),s("formControl",n.searchField),o(2),s("formGroup",n.range)("rangePicker",c),o(3),s("for",c),o(6),s("ngIf",n.loading),o(),s("ngIf",!n.loading)}},dependencies:[mt,T,M,B,H,rt,G,at,Ot,kt,At,Ft,U,V,ae,le,xe,ye,O,E,ue],styles:[".header[_ngcontent-%COMP%]{font-size:20px;font-weight:500;margin-bottom:10px;display:block}.header_sub_info[_ngcontent-%COMP%]{color:#4a5073;font-size:13px;font-weight:500;margin-bottom:30px;padding-right:150px}.daterange[_ngcontent-%COMP%]{vertical-align:top;margin-left:10px}.isRefunded[_ngcontent-%COMP%]{color:#666;text-decoration:line-through}div.row[_ngcontent-%COMP%]:nth-child(odd){background-color:#efefef}.row[_ngcontent-%COMP%]{display:flex;gap:10px;padding:10px;font-size:14px;border-radius:5px}.row[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]{vertical-align:top}.row[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]:nth-child(1){flex:0 0 150px}.row[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]:nth-child(2){flex:0 0 350px;display:none}.row[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]:nth-child(3){flex:0 0 220px;display:none}.row[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]:nth-child(4){flex:0 0 150px}.row[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]:nth-child(5){flex:0 0 70px}.row[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]:nth-child(6){flex:0 0 150px}.row[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]:nth-child(7){flex:1 1 100px}.guestrow[_ngcontent-%COMP%]{margin-bottom:5px;display:block}"]})}return i})(),En=class{name="";stay="";accountId="";groupId=""},Tn=class{id="";paymentId="";paymentType="";chargeDate=null;chargeId="";amount=0;bookingOwner="";group;guests=[];hidden=!1;isRefunded=!1};var Lr=(()=>{class i extends Ln{constructor(e,t){super(e,t)}getBetween(e,t,n){let c=[];c.push({name:"fromDate",value:e.toString()}),c.push({name:"toDate",value:t.toString()}),c.push({name:"account",value:n});let g=new $;for(let x of c)g=g.append(x.name,x.value);return this.httpService.get(this.urlService.getBackendUrl()+"/api/ocrcontroller/records/between",{params:g})}getNewSince(e,t,n){let c=[];c.push({name:"daysback",value:e.toString()}),c.push({name:"account",value:t}),c.push({name:"password",value:n});let g=new $;for(let x of c)g=g.append(x.name,x.value);return this.httpService.get(this.urlService.getBackendUrl()+"/api/ocrcontroller/records/new",{params:g})}static \u0275fac=function(t){return new(t||i)(Y(_e),Y(Nn))};static \u0275prov=re({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();function ef(i,p){if(i&1&&(a(0,"div",5)(1,"span",3),l(2),u(3,"date"),r(),a(4,"span",3),l(5),r(),a(6,"span",3),l(7),r(),a(8,"span",3),l(9),r(),a(10,"span",3),l(11),r(),a(12,"span",3),l(13),r(),a(14,"span",3),l(15),r(),a(16,"span",3),l(17),u(18,"date"),r(),a(19,"span",3),l(20),r(),a(21,"span",3),l(22),r(),a(23,"span",3),l(24),r()()),i&2){let e=p.$implicit;o(2),I(F(3,11,e.docCreatedDate,"short")),o(3),I(e.fortegn),o(2),I(e.belop),o(2),I(e.kid),o(2),I(e.konto),o(2),I(e.lopenummer),o(2),I(e.oppdragsnummer),o(2),I(F(18,14,e.oppgjorsdato,"short")),o(3),I(e.recordType),o(2),I(e.transaksjonsNummer),o(2),I(e.transaksjonsType)}}function tf(i,p){if(i&1&&(a(0,"div",1)(1,"div",2)(2,"span",3),l(3,"Registrert"),r(),a(4,"span",3),l(5,"Fortegn"),r(),a(6,"span",3),l(7,"Belop"),r(),a(8,"span",3),l(9,"KID"),r(),a(10,"span",3),l(11,"Konto"),r(),a(12,"span",3),l(13,"L\xF8penummer"),r(),a(14,"span",3),l(15,"Oppdragsnummer"),r(),a(16,"span",3),l(17,"Oppgj\xF8rsdato"),r(),a(18,"span",3),l(19,"Record type"),r(),a(20,"span",3),l(21,"Trans.numm"),r(),a(22,"span",3),l(23,"Trans.type"),r()(),f(24,ef,25,17,"div",4),r()),i&2){let e=d();o(24),s("ngForOf",e.ocrRecords)}}function nf(i,p){i&1&&(a(0,"div",1)(1,"p"),l(2),u(3,"translate"),r()()),i&2&&(o(2),I(v(3,1,"commerce.settings.ocr.2")))}var jr=(()=>{class i{ocrController;paymentController;ocrRecords=[];constructor(e,t){this.ocrController=e,this.paymentController=t;let n=new Date;n.setDate(n.getDate()-365);let c=new Date;this.ocrRecords=[],t.getActivatedPaymentTypes().subscribe(g=>{for(let x of g)if(x.type=="INVOICE"){let k=x;k.accountNumber&&e.getBetween(n,c,k.accountNumber).subscribe(A=>{this.ocrRecords.push(...A),this.ocrRecords=A,console.log(this.ocrRecords)})}})}static \u0275fac=function(t){return new(t||i)(h(Lr),h(We))};static \u0275cmp=w({type:i,selectors:[["app-ocr-debug-display"]],decls:5,vars:5,consts:[["class","table",4,"ngIf"],[1,"table"],[1,"header"],[1,"column"],["class","row",4,"ngFor","ngForOf"],[1,"row"]],template:function(t,n){t&1&&(a(0,"p"),l(1),u(2,"translate"),r(),f(3,tf,25,1,"div",0)(4,nf,4,3,"div",0)),t&2&&(o(),I(v(2,3,"commerce.settings.ocr.1")),o(2),s("ngIf",n.ocrRecords.length>0),o(),s("ngIf",n.ocrRecords.length==0))},dependencies:[T,M,E,ue],styles:[".table[_ngcontent-%COMP%]{display:flex;flex-direction:column;padding:5px;background-color:#fff;border-color:#eaedf2!important;border-radius:.5rem}.header[_ngcontent-%COMP%]{display:flex;font-weight:700}.row[_ngcontent-%COMP%]{display:flex}.column[_ngcontent-%COMP%]{flex:1;padding:5px}"]})}return i})();function of(i,p){i&1&&(a(0,"div"),l(1," Not selected "),r())}function rf(i,p){if(i&1&&(a(0,"div"),l(1),r()),i&2){let e=d(2);o(),m(" ",e.selectedMapping.deparmentNumber," ")}}function af(i,p){if(i&1){let e=S();a(0,"div",1)(1,"div",2)(2,"i",3),C("click",function(){y(e);let n=d();return b(n.changeDepartmentMapping())}),r(),l(3),r(),a(4,"div"),_(5,"i",4),r(),f(6,of,2,0,"div",5)(7,rf,2,1,"div",5),r()}if(i&2){let e=d();o(3),m(" ",e.department.name," "),o(3),s("ngIf",!e.selectedMapping),o(),s("ngIf",e.selectedMapping)}}var Ur=(()=>{class i{accountingController;parent;department;selectedMapping;constructor(e,t){this.accountingController=e,this.parent=t}ngAfterViewInit(){this.setSelected()}setSelected(){this.selectedMapping=this.parent.departmentMappings.filter(e=>e.departmentId==this.department.id)[0]}changeDepartmentMapping(){let e=prompt("Enter department code");e||alert("Only numbers allowed");let t={};t.departmentId=this.department.id,t.deparmentNumber=e,this.accountingController.saveDepartmentMapping(t).subscribe(n=>{this.parent.departmentMappings=this.parent.departmentMappings.filter(c=>c.departmentId!=this.department.id),this.parent.departmentMappings.push(t),this.setSelected()})}static \u0275fac=function(t){return new(t||i)(h(De),h(vt))};static \u0275cmp=w({type:i,selectors:[["app-department-mapping"]],inputs:{department:"department"},decls:1,vars:1,consts:[["class","row",4,"ngIf"],[1,"row"],[1,"name"],[1,"fa","fa-edit",3,"click"],[1,"fa","fa-arrows-h"],[4,"ngIf"]],template:function(t,n){t&1&&f(0,af,8,3,"div",0),t&2&&s("ngIf",n.department)},dependencies:[M],styles:[".row[_ngcontent-%COMP%]{display:flex;gap:10px}.name[_ngcontent-%COMP%]{flex:0 0 200px}"]})}return i})();function cf(i,p){if(i&1&&(a(0,"span",14),l(1),r()),i&2){let e=d();o(),ge(" ",(e.selectedAddons.value==null?null:e.selectedAddons.value.length)||0," ",(e.selectedAddons.value==null?null:e.selectedAddons.value.length)===1?"addon":"addons"," selected ")}}function lf(i,p){if(i&1&&(a(0,"mat-option",15),l(1),r()),i&2){let e=p.$implicit;s("value",e),o(),I(e.defaultName)}}function sf(i,p){if(i&1){let e=S();a(0,"button",16),C("click",function(){let n=y(e).$implicit,c=d();return b(c.removeAddon(n))}),l(1),r()}if(i&2){let e=p.$implicit;o(),m(" ",e.defaultName," ")}}function pf(i,p){i&1&&_(0,"i",26)}function df(i,p){if(i&1&&(a(0,"div",27),l(1),r()),i&2){let e=p.$implicit;o(),I(e.name)}}function mf(i,p){if(i&1&&(a(0,"span"),l(1),r()),i&2){let e=d().$implicit;o(),I(e.company.name)}}function uf(i,p){if(i&1&&(a(0,"div",17)(1,"div",18)(2,"div",19)(3,"span",20),l(4),r(),a(5,"span",21),l(6),r()(),a(7,"span"),f(8,pf,1,0,"i",22)(9,df,2,1,"div",23),r(),a(10,"div",24),l(11),u(12,"date"),f(13,mf,2,1,"span",25),r()()()),i&2){let e=p.$implicit,t=d();o(4),I(e.room),o(2),dt(" ",e.count," x ",e.name," (",e.priceEx,",-) "),o(2),s("ngIf",t.loadingBookings),o(),s("ngForOf",e.guests),o(2),m(" ",F(12,8,e.date,"shortDate")," "),o(2),s("ngIf",e.company)}}var XC=(()=>{class i{productController;bookingController;companyController;accountController;selectedAddons;addonsProducts=[];startDate;endDate;allAccounts=[];cachedResult=[];isCached=!1;loadingCustomers=!1;loadingBookings=!1;productIdsFound=[];constructor(e,t,n,c){this.productController=e,this.bookingController=t,this.companyController=n,this.accountController=c,this.startDate=new Date,this.endDate=new Date,this.selectedAddons=new Ee([]),e.getAllProducts().subscribe(g=>{g=g.filter(x=>x.type!=="hotel"),this.addonsProducts=g,this.selectedAddons.patchValue(g),this.selectDateRange(),console.log(g)})}ngOnInit(){}getSelectedAddons(){let e=[],t=this.selectedAddons.value;for(let n of t)this.productIdsFound.includes(n.id)&&e.push(n);return e}isFoundInList(e){return!1}getSelectedUnits(){if(this.isCached)return this.cachedResult;let e=[];this.productIdsFound=[];let t=new Set(this.selectedAddons.value.map(x=>x.id));this.startDate.setHours(0,0,0,0),this.endDate.setHours(23,59,59,999);let n=new mn;for(let x of this.allAccounts)for(let P of x.entries)for(let k of P.units)if(t.has(P.product.id)&&k.count!=0&&new Date(k.start)>=this.startDate&&new Date(k.start)<=this.endDate){let A=new mn;this.productIdsFound.push(P.product.id),A.date=k.start,A.priceEx=k.unitPriceExTaxes,A.priceInc=k.unitPriceIncTax,A.name=P.product.defaultName,A.count=k.count,A.accountId=x.id;for(let ie of x.entries)ie.rentalObjectInfo&&(A.room=ie.rentalObjectInfo);n.count+=A.count,A.priceInc&&(n.priceInc+=A.priceInc),A.priceEx&&(n.priceEx+=A.priceEx),e.push(A)}e.sort((x,P)=>{let k=new Date(x.date).getTime(),A=new Date(P.date).getTime();return k<A?-1:k>A?1:x.room.localeCompare(P.room)}),this.cachedResult=e,this.isCached=!0;let c=e.map(x=>`${x.accountId}`),g=this.bookingController.findFlatBookingsByAccountIds(c);return this.loadingBookings=!0,this.loadingCustomers=!0,g.subscribe(x=>{for(let k of e){let A=x.find(ie=>ie.booking.accountId===k.accountId);A&&(k.guests=A.booking.guests,k.companyId=A.group.customerCompanyId,k.privateId=A.group.customerPrivateId)}this.loadingBookings=!1;let P=x.map(k=>`${k.group.customerCompanyId}`);this.companyController.getByIds(P).subscribe(k=>{for(let A of e){let ie=k.find(Pt=>Pt.id===A.companyId);A.company=ie}this.loadingCustomers=!1})}),e.push(n),e}removeAddon(e){let n=this.selectedAddons.value.filter(c=>c.id!==e.id);this.selectedAddons.patchValue(n),this.selectDateRange()}removeSelectedAddons(){this.selectedAddons.patchValue([])}selectDateRange(){this.accountController.getAllBetweenDate(this.startDate,this.endDate).subscribe(t=>{this.allAccounts=t,this.isCached=!1})}static \u0275fac=function(t){return new(t||i)(h(ke),h(ft),h(pt),h(Ae))};static \u0275cmp=w({type:i,selectors:[["app-addons-list-overview"]],decls:28,vars:9,consts:[["picker",""],[3,"rangePicker"],["matStartDate","","placeholder","Start date",3,"ngModelChange","ngModel"],["matEndDate","","placeholder","End date",3,"ngModelChange","ngModel"],["matSuffix","",3,"for"],["multiple","",3,"formControl"],["class","example-additional-selection",4,"ngIf"],[3,"value",4,"ngFor","ngForOf"],["mat-raised-button","","color","primary",3,"click"],[1,"example-button-container"],["mat-mini-fab","",1,"selectedAddons",3,"click"],["mat-stroked-button","","class","selectedAddons",3,"click",4,"ngFor","ngForOf"],[1,"grid-container"],["class","grid-item",4,"ngFor","ngForOf"],[1,"example-additional-selection"],[3,"value"],["mat-stroked-button","",1,"selectedAddons",3,"click"],[1,"grid-item"],[1,"grid-cell"],[1,"toprow"],[1,"roomname"],[1,"extrainfo"],["class","fa fa-spin fa-spinner",4,"ngIf"],["class","guestinfo",4,"ngFor","ngForOf"],[1,"daterow"],[4,"ngIf"],[1,"fa","fa-spin","fa-spinner"],[1,"guestinfo"]],template:function(t,n){if(t&1){let c=S();a(0,"mat-form-field")(1,"mat-label"),l(2,"Enter a date range"),r(),a(3,"mat-date-range-input",1)(4,"input",2),Ie("ngModelChange",function(x){return y(c),Se(n.startDate,x)||(n.startDate=x),b(x)}),r(),a(5,"input",3),Ie("ngModelChange",function(x){return y(c),Se(n.endDate,x)||(n.endDate=x),b(x)}),r()(),_(6,"mat-datepicker-toggle",4)(7,"mat-date-range-picker",null,0),r(),l(9," \xA0 "),a(10,"mat-form-field")(11,"mat-label"),l(12,"Addons"),r(),a(13,"mat-select",5)(14,"mat-select-trigger"),f(15,cf,2,2,"span",6),r(),f(16,lf,2,2,"mat-option",7),r()(),l(17," \xA0 "),a(18,"button",8),C("click",function(){return y(c),b(n.selectDateRange())}),l(19,"Load"),r(),a(20,"div")(21,"div",9)(22,"button",10),C("click",function(){return y(c),b(n.removeSelectedAddons())}),a(23,"mat-icon"),l(24,"delete"),r()(),f(25,sf,2,1,"button",11),r(),a(26,"div",12),f(27,uf,14,11,"div",13),r()()}if(t&2){let c=fe(8);o(3),s("rangePicker",c),o(),we("ngModel",n.startDate),o(),we("ngModel",n.endDate),o(),s("for",c),o(7),s("formControl",n.selectedAddons),o(2),s("ngIf",((n.selectedAddons.value==null?null:n.selectedAddons.value.length)||0)>0),o(),s("ngForOf",n.addonsProducts),o(9),s("ngForOf",n.getSelectedAddons()),o(2),s("ngForOf",n.getSelectedUnits())}},dependencies:[T,M,B,H,rt,ze,ri,no,ti,at,Ot,kt,At,Ft,U,V,et,le,O,zn,ue],styles:[".selectedAddons[_ngcontent-%COMP%]{margin-right:10px;margin-bottom:10px}.header[_ngcontent-%COMP%]   .grid-cell[_ngcontent-%COMP%]{font-weight:700}.grid-container[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(5,1fr);gap:5px}.grid-cell[_ngcontent-%COMP%]{border:1px solid #ccc;padding:10px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;background-color:#fff;border-radius:5px;margin-bottom:1px;display:block}.daterow[_ngcontent-%COMP%], .extrainfo[_ngcontent-%COMP%]{font-size:12px;color:#bbb;margin-top:5px}.extrainfo[_ngcontent-%COMP%]{float:right}.roomname[_ngcontent-%COMP%]{font-weight:700}.guestinfo[_ngcontent-%COMP%]{font-size:14px;padding-top:5px}.toprow[_ngcontent-%COMP%]{padding:10px 10px 10px 0;border-bottom:dashed 1px #DDD;position:relative}.fa-spinner[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_spin 2s linear infinite}@keyframes _ngcontent-%COMP%_spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@media (max-width: 1500px){.grid-container[_ngcontent-%COMP%]{grid-template-columns:repeat(4,1fr)}}@media (max-width: 1300px){.grid-container[_ngcontent-%COMP%]{grid-template-columns:repeat(3,1fr)}}@media (max-width: 1100px){.grid-container[_ngcontent-%COMP%]{grid-template-columns:repeat(2,1fr)}}@media (max-width: 900px){.grid-container[_ngcontent-%COMP%]{grid-template-columns:repeat(1,1fr)}}"]})}return i})(),mn=class{date;name="";room="";count=0;priceEx=0;priceInc=0;accountId="";guests;company};function ff(i,p){i&1&&(a(0,"div"),_(1,"i",12),r())}function gf(i,p){i&1&&(a(0,"div",5),l(1," No records found, please select a different date "),r())}function _f(i,p){if(i&1&&(a(0,"div",8)(1,"div",9),l(2),r(),a(3,"div",10),l(4),r()()),i&2){let e=p.$implicit;o(2),m(" ",e.receipt.incrementalReceiptNumber," "),o(2),m(" ",e.paymentRecord.amount," ")}}function vf(i,p){i&1&&(a(0,"div"),l(1," Waiting for end of day report "),r())}function hf(i,p){if(i&1&&(a(0,"div"),l(1),r()),i&2){let e=d().$implicit,t=d(2);o(),m(" ",t.getAccountingAmountForBatch(e)," ")}}function Cf(i,p){i&1&&_(0,"i",18)}function xf(i,p){i&1&&_(0,"i",19)}function yf(i,p){if(i&1&&(a(0,"div",5)(1,"div",6),l(2),u(3,"date"),r(),a(4,"div",7),f(5,_f,5,2,"div",15),r(),a(6,"div",10),f(7,vf,2,0,"div",11)(8,hf,2,1,"div",11),r(),a(9,"div"),f(10,Cf,1,0,"i",16)(11,xf,1,0,"i",17),r()()),i&2){let e=p.$implicit,t=d(2);o(2),m(" ",F(3,6,e.date,"shortDate")," "),o(3),s("ngForOf",e.records),o(2),s("ngIf",!e.transferredToAccounting),o(),s("ngIf",e.transferredToAccounting),o(2),s("ngIf",t.isTransferredToAccountingSystem(e)),o(),s("ngIf",!t.isTransferredToAccountingSystem(e))}}function bf(i,p){if(i&1&&(a(0,"div"),f(1,gf,2,0,"div",13)(2,yf,12,9,"div",14),r()),i&2){let e=d();o(),s("ngIf",!e.batches),o(),s("ngForOf",e.batches)}}var Hr=(()=>{class i{reportController;today;sixMonthsAgo;batches;loading=!1;constructor(e){this.reportController=e,this.today=new Date,this.sixMonthsAgo=new Date,this.sixMonthsAgo.setMonth(this.today.getMonth()-6)}openDatePicker(e){e.open()}closeDatePicker(e,t){let n={};n.start=new Date(e),n.end=new Date(e.getFullYear(),e.getMonth()+1),this.loading=!0,this.reportController.getBankInvoiceTransferReport(n).subscribe(c=>{this.batches=c,this.loading=!1}),t.close()}getAccountingAmountForBatch(e){let t=0;return e.records.forEach(n=>{n.paymentRecord.transferredToAccount&&(t+=n.paymentRecord.amount)}),t}isTransferredToAccountingSystem(e){if(e.bankAccountEntry==null)return!1;let t=!1;return e.bankAccountEntry.groupPayments.forEach(n=>{n.accountId==e.batchId&&n.transferredToAccountingSystem&&(t=!0)}),t}static \u0275fac=function(t){return new(t||i)(h(Di))};static \u0275cmp=w({type:i,selectors:[["app-invoice-payment-list"]],decls:23,vars:4,consts:[["dp2",""],[1,"topinfo"],["matInput","","placeholder","Select a month",3,"click","matDatepicker"],["matSuffix","",3,"for"],["startView","multi-year",3,"monthSelected"],[1,"row"],[1,"date"],[1,"invoices"],[1,"invoice"],[1,"invoicenumber"],[1,"amount"],[4,"ngIf"],[1,"fa","fa-spin","fa-spinner"],["class","row",4,"ngIf"],["class","row",4,"ngFor","ngForOf"],["class","invoice",4,"ngFor","ngForOf"],["class","fa fa-check",4,"ngIf"],["class","fa fa-cancel",4,"ngIf"],[1,"fa","fa-check"],[1,"fa","fa-cancel"]],template:function(t,n){if(t&1){let c=S();a(0,"div",1)(1,"mat-form-field")(2,"input",2),C("click",function(){y(c);let x=fe(5);return b(n.openDatePicker(x))}),r(),_(3,"mat-datepicker-toggle",3),a(4,"mat-datepicker",4,0),C("monthSelected",function(x){y(c);let P=fe(5);return b(n.closeDatePicker(x,P))}),r()(),_(6,"br"),l(7," Please select the month you want to see the records for. "),r(),a(8,"div",5)(9,"div",6),l(10," Date "),r(),a(11,"div",7)(12,"div",8)(13,"div",9),l(14," Invoice "),r(),a(15,"div",10),l(16," Amount "),r()()(),a(17,"div",10),l(18," Accounting report "),r(),a(19,"div",10),l(20," Transferred to accountingsystem "),r()(),f(21,ff,2,0,"div",11)(22,bf,3,2,"div",11)}if(t&2){let c=fe(5);o(2),s("matDatepicker",c),o(),s("for",c),o(18),s("ngIf",n.loading),o(),s("ngIf",!n.loading)}},dependencies:[T,M,B,rt,G,yi,bi,at,ue],styles:[".row[_ngcontent-%COMP%]{display:flex;gap:20px;padding:5px;border-radius:5px}.row[_ngcontent-%COMP%]   .date[_ngcontent-%COMP%], .row[_ngcontent-%COMP%]   .invoices[_ngcontent-%COMP%], .row[_ngcontent-%COMP%]   .amount[_ngcontent-%COMP%]{flex:0 0 200px}.row[_ngcontent-%COMP%]   .invoice[_ngcontent-%COMP%]{display:flex;gap:20px}.row[_ngcontent-%COMP%]   .invoice[_ngcontent-%COMP%]   .invoicenumber[_ngcontent-%COMP%]{flex:0 0 100px}div.row[_ngcontent-%COMP%]:nth-child(odd){background-color:#efefef}.topinfo[_ngcontent-%COMP%]{background-color:#fff;text-align:center;padding:20px;border-radius:5px;margin-bottom:20px;margin-top:20px}"]})}return i})();var wf=["searchInputField"];function Sf(i,p){if(i&1){let e=S();a(0,"div",9),C("click",function(){let n=y(e).$implicit,c=d(2);return b(c.chooseResult(n))}),l(1),a(2,"span",10),l(3),r(),a(4,"div",11),l(5),r()()}if(i&2){let e=p.$implicit;o(),m(" ",e.name," "),o(2),I(e.vatNumber),o(2),dt(" ",e.address," ",e.postcode," ",e.city," ")}}function If(i,p){if(i&1){let e=S();a(0,"div",4)(1,"mat-form-field",5)(2,"mat-label"),l(3),u(4,"translate"),r(),a(5,"input",6,0),Ie("ngModelChange",function(n){y(e);let c=d();return Se(c.searchCompanyName,n)||(c.searchCompanyName=n),b(n)}),C("keyup.enter",function(){y(e);let n=d();return b(n.searchForCompany())}),r()(),a(7,"button",7),C("click",function(){y(e);let n=d();return b(n.searchForCompany())}),_(8,"i",2),r(),f(9,Sf,6,5,"div",8),r()}if(i&2){let e=d();o(3),I(v(4,3,"commerce.brreg.1")),o(2),we("ngModel",e.searchCompanyName),o(4),s("ngForOf",e.searchResults)}}var $r=(()=>{class i{companyController;elementRef;renderer;isSearchingBrreg=!1;searchCompanyName="";searchResults=[];companyDialogComponent;searchInputField;toggleSearchingBrreg(){this.isSearchingBrreg=!this.isSearchingBrreg,this.isSearchingBrreg&&this.searchInputField&&this.searchInputField.nativeElement.focus()}constructor(e,t,n){this.companyController=e,this.elementRef=t,this.renderer=n}searchForCompany(){this.companyController.searchBrreg(this.searchCompanyName).subscribe(t=>{this.searchResults=t})}chooseResult(e){this.companyDialogComponent.company=e,this.companyDialogComponent.companyContactsRef.contacts=e.contacts,this.companyDialogComponent.companyAddressRef.update(e.companyAddress),this.companyDialogComponent.invoiceAddressRef.update(e.invoiceAddress),this.companyDialogComponent.patchValues(),this.isSearchingBrreg=!1,this.searchCompanyName="",this.searchResults=[]}static \u0275fac=function(t){return new(t||i)(h(pt),h(Vi),h(An))};static \u0275cmp=w({type:i,selectors:[["app-brreg"]],viewQuery:function(t,n){if(t&1&&N(wf,5),t&2){let c;L(c=j())&&(n.searchInputField=c.first)}},inputs:{companyDialogComponent:"companyDialogComponent"},decls:4,vars:1,consts:[["searchInputField",""],["mat-raised-button","","color","primary",1,"searchbbregbutton",3,"click"],[1,"fa-sharp","fa-thin","fa-magnifying-glass"],["class","searchfield",4,"ngIf"],[1,"searchfield"],[1,"example-full-width"],["matInput","","placeholder","Locky AS","value","",3,"ngModelChange","keyup.enter","ngModel"],["mat-raised-button","","color","primary",1,"search",3,"click"],["class","searchresult",3,"click",4,"ngFor","ngForOf"],[1,"searchresult",3,"click"],[1,"vatnumber"],[1,"address"]],template:function(t,n){t&1&&(a(0,"button",1),C("click",function(){return n.toggleSearchingBrreg()}),_(1,"i",2),l(2," BRREG "),r(),f(3,If,10,5,"div",3)),t&2&&(o(3),s("ngIf",n.isSearchingBrreg))},dependencies:[T,M,B,H,G,U,V,et,O,E],styles:[".searchbbregbutton[_ngcontent-%COMP%]{position:absolute;right:3px;top:3px}.searchfield[_ngcontent-%COMP%]{position:absolute;background-color:#fff;border:solid 1px #bbb;padding:10px;right:3px;z-index:2;border-radius:3px}.searchresult[_ngcontent-%COMP%]{border-bottom:solid 1px #bbb;padding-bottom:10px;cursor:pointer;padding-top:10px}.searchresult[_ngcontent-%COMP%]:hover{font-weight:700}.search[_ngcontent-%COMP%]{margin-left:10px}.vatnumber[_ngcontent-%COMP%]{float:right;margin-left:10px}.address[_ngcontent-%COMP%]{font-size:12px;padding-left:10px}"]})}return i})();function Mf(i,p){if(i&1){let e=S();a(0,"div",2),C("click",function(){let n=y(e).$implicit,c=d();return b(c.selectPrinter(n))}),_(1,"i",3),a(2,"div"),l(3),r()()}if(i&2){let e=p.$implicit;o(3),m(" ",e.name," ")}}var tx=(()=>{class i{dialogRef;printers;constructor(e,t){this.dialogRef=t,e.getPrinters().subscribe(n=>{this.printers=n})}selectPrinter(e){this.dialogRef.close(e)}static \u0275fac=function(t){return new(t||i)(h(tn),h(te))};static \u0275cmp=w({type:i,selectors:[["app-printer-select-dialog"]],decls:3,vars:1,consts:[[1,"printers"],["class","printerbox",3,"click",4,"ngFor","ngForOf"],[1,"printerbox",3,"click"],[1,"fa","fa-print"]],template:function(t,n){t&1&&(a(0,"mat-dialog-content")(1,"div",0),f(2,Mf,4,1,"div",1),r()()),t&2&&(o(2),s("ngForOf",n.printers))},dependencies:[T,K],styles:[".printers[_ngcontent-%COMP%]{display:flex;gap:20px;flex-wrap:wrap}.printerbox[_ngcontent-%COMP%]{width:100px;height:100px;background-color:#efefef;border-radius:5px;padding:20px;text-align:center;box-sizing:border-box;cursor:pointer}.printerbox[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]{font-size:30px;margin-bottom:10px}"]})}return i})();function Df(i,p){i&1&&(a(0,"div",2),_(1,"i",3),r())}function Pf(i,p){if(i&1){let e=S();a(0,"div",15),C("click",function(){y(e);let n=d().$implicit,c=d(2);return b(c.showPayment(n[0]))}),_(1,"div",16),u(2,"nl2br"),r()}if(i&2){let e=p.$implicit,t=p.index;jt("cell"+t),o(),s("innerHTML",v(2,4,e),ht)("title",e)}}function Ef(i,p){if(i&1&&(a(0,"div",13),f(1,Pf,3,6,"div",14),r()),i&2){let e=p.$implicit;ee("first",e[0]),o(),s("ngForOf",e)}}function Tf(i,p){if(i&1&&(a(0,"div",4)(1,"div",5)(2,"div",6),l(3,"Payment id"),r(),a(4,"div",7),l(5,"Accountid"),r(),a(6,"div",8),l(7,"Description"),r(),a(8,"div",9),l(9,"Checkin"),r(),a(10,"div",10),l(11,"Checkout"),r(),a(12,"div",11),l(13,"Amount"),r()(),f(14,Ef,2,3,"div",12),r()),i&2){let e=d();o(14),s("ngForOf",e.rows)}}var un=(()=>{class i{dialog;decimalPipe;locale;loaded=!1;data;rows=[];constructor(e,t,n){this.dialog=e,this.decimalPipe=t,this.locale=n}setData(e,t=!0){this.data=e,this.createRows(t),this.loaded=!0}createRows(e=!0){this.data.forEach(t=>{!t.accounts||t.accounts.length==0?this.handle(t,null,e,!0):e?t.accounts.forEach(n=>{let c=t.accounts.indexOf(n)==0;this.handle(t,n,e,c)}):this.handle(t,t.firstAccount,e,!0)})}handle(e,t,n=!0,c){let g=[];c?g[0]=e.payment.id:g[0]="",this.getAccountInfo(t).forEach(P=>{g.push(P)});let x=n?this.decimalPipe.transform(e.amount,"1.2-2"):e.amount;c?g.push(x):g.push(""),this.rows.push(g)}showPayment(e){let t=this.data.filter(g=>g.payment.id==e)[0].payment,n=new Lt;n.paymentToRefund=t,n.type="receipt",n.accounts=[];let c=this.dialog.open(ui,{data:n})}getRows(){return this.rows}getRowsWithHeader(){let e=[];return e.push(["Payment id","Account id","Description","Checkin","Checkout","Amount"]),this.rows.forEach(t=>{e.push(t)}),e}getAccountInfo(e){let t=[],n=!1;if(e){for(let c of e.entries)if(c.product.type=="hotel"){let g=c.startDate?Ht(c.startDate,"dd.MM.yyyy",this.locale):"-",x=c.endDate?Ht(c.endDate,"dd.MM.yyyy",this.locale):"-",P=e.deletedBy?" ( deleted ) ":"";t[0]=e.id,t[1]=c.product.defaultName+" "+c.receiptSubText+P,t[2]=g,t[3]=x,n=!0}}return n||(t[0]="N/A",t[1]="N/A",t[2]="N/A",t[3]="N/A"),t}get total(){let e=0;return this.data.forEach(t=>{e+=t.amount}),e}static \u0275fac=function(t){return new(t||i)(h(q),h(me),h(xt))};static \u0275cmp=w({type:i,selectors:[["app-open-prepaid-report"]],decls:5,vars:3,consts:[["class","loading",4,"ngIf"],["class","rows",4,"ngIf"],[1,"loading"],[1,"fa","fa-spin","fa-spinner"],[1,"rows"],[1,"row","header"],[1,"cell0"],[1,"cell1"],[1,"cell2"],[1,"cell3"],[1,"cell4"],[1,"cell5"],["class","row",3,"first",4,"ngFor","ngForOf"],[1,"row"],[3,"class","click",4,"ngFor","ngForOf"],[3,"click"],[3,"innerHTML","title"]],template:function(t,n){t&1&&(a(0,"mat-dialog-content"),f(1,Df,2,0,"div",0)(2,Tf,15,1,"div",1),a(3,"div"),l(4),r()()),t&2&&(o(),s("ngIf",!n.loaded),o(),s("ngIf",n.loaded),o(2),m(" Total out: ",n.total," "))},dependencies:[T,M,K,Vt],styles:[".rows[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap}.row[_ngcontent-%COMP%]{flex:1 1 100%;display:flex;gap:20px;width:100%;padding-bottom:5px}.row.first[_ngcontent-%COMP%]{border-top:solid 1px #DDD;margin-top:5px;padding-top:5px}.cell0[_ngcontent-%COMP%]{flex:0 0 230px;cursor:pointer;color:#00f}.cell1[_ngcontent-%COMP%]{flex:0 0 230px}.cell2[_ngcontent-%COMP%]{flex:1 1 300px;position:relative}.cell3[_ngcontent-%COMP%], .cell4[_ngcontent-%COMP%], .cell5[_ngcontent-%COMP%]{flex:0 0 90px}.header[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]{font-weight:700}.loading[_ngcontent-%COMP%]{padding:20px;text-align:center}"]})}return i})();function kf(i,p){i&1&&(a(0,"div",2),_(1,"i",3),r())}function Af(i,p){if(i&1){let e=S();a(0,"div",13),C("click",function(){y(e);let n=d().$implicit,c=d(2);return b(c.showPayment(n[0]))}),_(1,"div",14),u(2,"nl2br"),r()}if(i&2){let e=p.$implicit,t=p.index;jt("cell"+t),o(),s("innerHTML",v(2,4,e),ht)("title",e)}}function Of(i,p){if(i&1&&(a(0,"div",11),f(1,Af,3,6,"div",12),r()),i&2){let e=p.$implicit;ee("first",e[0]),o(),s("ngForOf",e)}}function Ff(i,p){if(i&1&&(a(0,"div",4)(1,"div",5)(2,"div",6),l(3,"Invoice id"),r(),a(4,"div",7),l(5,"Customer info"),r(),a(6,"div",8),l(7,"Due date"),r(),a(8,"div",9),l(9,"Amount"),r()(),f(10,Of,2,3,"div",10),r()),i&2){let e=d();o(10),s("ngForOf",e.rows)}}var fn=(()=>{class i{dialog;decimalPipe;locale;loaded=!1;data;rows=[];constructor(e,t,n){this.dialog=e,this.decimalPipe=t,this.locale=n}setData(e,t=!0){this.data=e,this.createRows(t),this.loaded=!0}createRows(e=!0){this.data.forEach(t=>{!t.accounts||t.accounts.length==0?this.handle(t,null,e,!0):e?t.accounts.forEach(n=>{let c=t.accounts.indexOf(n)==0;this.handle(t,n,e,c)}):this.handle(t,t.firstAccount,e,!0)})}handle(e,t,n=!0,c){let g=[];g[0]=e.invoice.incrementalReceiptNumber,g.push(this.getCustomerInfo(e.invoice)),g.push(new Date(e.invoice.dueDate).toLocaleDateString("default",{day:"2-digit",month:"short",year:"numeric"}));let x=n?this.decimalPipe.transform(e.amount,"1.2-2"):e.amount;g.push(x),this.rows.push(g)}getCustomerInfo(e){return e.customer?e.customer.name:e.company?e.company.name:"n/a"}getRows(){return this.rows}getRowsWithHeader(){let e=[];return e.push(["Invoice id","Customer","Due Date","Amount"]),this.rows.forEach(t=>{e.push(t)}),e}get total(){let e=0;return this.data.forEach(t=>{e+=t.amount}),e}static \u0275fac=function(t){return new(t||i)(h(q),h(me),h(xt))};static \u0275cmp=w({type:i,selectors:[["app-open-invoice-report"]],decls:5,vars:3,consts:[["class","loading",4,"ngIf"],["class","rows",4,"ngIf"],[1,"loading"],[1,"fa","fa-spin","fa-spinner"],[1,"rows"],[1,"row","header"],[1,"cell0"],[1,"cell1"],[1,"cell2"],[1,"cell3"],["class","row",3,"first",4,"ngFor","ngForOf"],[1,"row"],[3,"class","click",4,"ngFor","ngForOf"],[3,"click"],[3,"innerHTML","title"]],template:function(t,n){t&1&&(a(0,"mat-dialog-content"),f(1,kf,2,0,"div",0)(2,Ff,11,1,"div",1),a(3,"div"),l(4),r()()),t&2&&(o(),s("ngIf",!n.loaded),o(),s("ngIf",n.loaded),o(2),m(" Total out: ",n.total," "))},dependencies:[T,M,K,Vt],styles:[".rows[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap}.row[_ngcontent-%COMP%]{flex:1 1 100%;display:flex;gap:20px;width:100%;padding-bottom:5px}.row.first[_ngcontent-%COMP%]{border-top:solid 1px #DDD;margin-top:5px;padding-top:5px}.cell0[_ngcontent-%COMP%]{flex:0 0 100px}.cell1[_ngcontent-%COMP%]{flex:1 1 300px;position:relative}.cell2[_ngcontent-%COMP%], .cell3[_ngcontent-%COMP%]{flex:0 0 100px}.header[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]{font-weight:700}.loading[_ngcontent-%COMP%]{padding:20px;text-align:center}"]})}return i})();var Vf=["colnames"],Bf=["in"],Rf=["out"],Nf=["accountingreportday"],Lf=["days"];function jf(i,p){i&1&&(a(0,"mat-error"),l(1),u(2,"translate"),r()),i&2&&(o(),m(" ",v(2,1,"booking.availability.4")," "))}function Uf(i,p){i&1&&(a(0,"mat-error"),l(1),u(2,"translate"),r()),i&2&&(o(),m(" ",v(2,1,"booking.availability.5")," "))}function Hf(i,p){i&1&&(a(0,"div",20),_(1,"i",21),r())}function $f(i,p){i&1&&(a(0,"div",27),_(1,"app-accounting-day",29,3),r()),i&2&&(o(),s("invalues",!0))}function Gf(i,p){if(i&1&&(a(0,"div",27),_(1,"app-accounting-day",30,4),r()),i&2){let e=p.$implicit;o(),s("day",e)}}function qf(i,p){if(i&1&&(a(0,"div",20)(1,"div",22),_(2,"app-accounting-day",23,1),r(),a(4,"div",24),f(5,$f,3,1,"div",25)(6,Gf,3,1,"div",26),a(7,"div",27),_(8,"app-accounting-day",28,2),r()()()),i&2){let e=d();o(2),s("rowname",!0),o(3),s("ngIf",!e.isByAccounts),o(),s("ngForOf",e.data.ledgerDays),o(2),s("outvalues",!0)("day",e.wholePeriodeLedgerDay)}}function Qf(i,p){i&1&&(a(0,"div",20),_(1,"app-accounting-account-report",null,5),r())}var Ei=(()=>{class i{accountingController;datePipe;dialog;decimalPipe;locale;accountingAccountController;_data;showPeriode=!0;groupByAccounts=!1;allDays;colnames;inday;outday;colDays;accountingReportDay;range=new Me({start:new R,end:new R});loading=!1;myFilter=e=>(e||new Date).getTime()<=new Date().getTime();accounts;accountingAccountReport;get filter(){let e={};return e.start=this.range.value.start,e.end=this.range.value.end,e.accountIds=this.byAccounts,e}ledgerDays;byAccounts=[];get isByAccounts(){return this.byAccounts.length>0}constructor(e,t,n,c,g,x){this.accountingController=e,this.datePipe=t,this.dialog=n,this.decimalPipe=c,this.locale=g,this.accountingAccountController=x,this.accountingAccountController.getAccounts().subscribe(P=>{this.accounts=P;let k={};k.accountNumber="0",k.id="unmapped",k.description="unmapped",this.accounts.push(k)}),this.range.patchValue(this.getMonthBounds(new Date)),this.loadData()}loadData(){this.loading=!0,Qe([this.accountingController.getAccountReport(this.filter),this.accountingController.getAccountingAccountReport(this.filter)]).subscribe(e=>{this._data=e[0],this.allDays=[],this.ledgerDays=this._data.ledgerDays,this._data.ledgerDays.forEach(t=>{t.ledgers.forEach(n=>{this.allDays.push(n)})}),this.showPeriode&&(this.data.ledgerDays=[],this.data.ledgerDays.push(this.wholePeriodeLedgerDay)),this.accountingAccountReport=e[1],this.loading=!1})}get data(){return this._data?(this.showPeriode?(this._data.ledgerDays=[],this._data.ledgerDays.push(this.wholePeriodeLedgerDay)):this._data.ledgerDays=this.ledgerDays,this._data):null}get wholePeriodeLedgerDay(){if(!this.filter.start||!this.filter.end)return;let e={};return e.ledgers=this.allDays,e.date=this.filter.end.toLocaleDateString(),e}closePeriode(){this.accountingController.closeperiode().subscribe(e=>{this.loadData()})}getMonthBounds(e){let t=new Date,n=e.getFullYear(),c=e.getMonth(),g=new Date(n,c,1,0,0,0,0),x=new Date(n,c+1,0,23,59,59,999),P=x>t?t:x;return{start:g,end:P}}downloadExcel(){let e=Ye.book_new();Qe([this.accountingController.getOpenLedgers("unbilled",this.filter),this.accountingController.getOpenLedgers("prepaid",this.filter),this.accountingController.getOpenLedgers("invoices",this.filter)]).subscribe(t=>{this.groupByAccounts?this.addByAccounts("Report",e):this.addSheetNormal("Report",e),this.addUnbilled(e,t[0]),this.addPrePaid(e,t[1]),this.addInvoices(e,t[2]);let n=wi(e,{bookType:"xlsx",type:"array"}),c=new Blob([n],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),g=window.URL.createObjectURL(c),x=document.createElement("a");x.href=g,x.download="data.xlsx",x.click(),window.URL.revokeObjectURL(g)})}addInvoices(e,t){let n=new fn(this.dialog,this.decimalPipe,this.locale);n.setData(t,!1),console.log(n.getRows());let c=Ye.aoa_to_sheet(n.getRowsWithHeader());Ye.book_append_sheet(e,c,"Invoices")}addUnbilled(e,t){console.log(t);let n=new nn(this.datePipe);n.unbilledRevenue=t,console.log(n.getRows());let c=Ye.aoa_to_sheet(n.getRows());Ye.book_append_sheet(e,c,"Unbilled")}addPrePaid(e,t){console.log(t);let n=new un(this.dialog,this.decimalPipe,this.locale);n.setData(t,!1),console.log(n.getRows());let c=Ye.aoa_to_sheet(n.getRowsWithHeader());Ye.book_append_sheet(e,c,"Prepaid")}transposeColsToRows(e){let t=e[0].length,n=e.length,c=[];for(let g=0;g<t;g++){let x=[];for(let P=0;P<n;P++)x.push(e[P][g]);c.push(x)}return c}addSheetNormal(e,t){let n=[];n.push(this.colnames.getCols()),n.push(this.inday.getCols());for(let g of this.colDays)n.push(g.getCols());n.push(this.outday.getCols());let c=Ye.aoa_to_sheet(this.transposeColsToRows(n));Ye.book_append_sheet(t,c,e)}addByAccounts(e,t){let n=this.accountingReportDay.getRows(),c=Ye.aoa_to_sheet(n);Ye.book_append_sheet(t,c,e)}static \u0275fac=function(t){return new(t||i)(h(wt),h(Yt),h(q),h(me),h(xt),h(De))};static \u0275cmp=w({type:i,selectors:[["app-accounting-report2"]],viewQuery:function(t,n){if(t&1&&(N(Vf,5),N(Bf,5),N(Rf,5),N(Nf,5),N(Lf,5)),t&2){let c;L(c=j())&&(n.colnames=c.first),L(c=j())&&(n.inday=c.first),L(c=j())&&(n.outday=c.first),L(c=j())&&(n.accountingReportDay=c.first),L(c=j())&&(n.colDays=c)}},decls:39,vars:26,consts:[["picker",""],["colnames",""],["out",""],["in",""],["days",""],["accountingreportday",""],[1,"topfilter"],[1,"title"],["appearance","fill",1,"fullwidthmobile"],[1,"daterangepicker",3,"formGroup","dateFilter","rangePicker"],["matStartDate","","formControlName","start","placeholder","Start date"],["matEndDate","","formControlName","end","placeholder","End date"],["matSuffix","",3,"for"],[4,"ngIf"],[3,"ngModelChange","ngModel"],[1,"buttons"],["mat-flat-button","","color","primary",3,"click"],[1,"fa","fa-refresh"],[1,"fa","fa-download"],["class","days",4,"ngIf"],[1,"days"],[1,"fa","fa-spin","fa-spinner"],[1,"day","colname"],[3,"rowname"],[1,"dataset"],["class","day",4,"ngIf"],["class","day",4,"ngFor","ngForOf"],[1,"day"],[3,"outvalues","day"],[3,"invalues"],[3,"day"]],template:function(t,n){if(t&1){let c=S();a(0,"div",6)(1,"div")(2,"div",7),l(3),u(4,"translate"),r(),a(5,"mat-form-field",8)(6,"mat-label"),l(7),u(8,"translate"),r(),a(9,"mat-date-range-input",9),_(10,"input",10)(11,"input",11),r(),_(12,"mat-datepicker-toggle",12)(13,"mat-date-range-picker",null,0),f(15,jf,3,3,"mat-error",13)(16,Uf,3,3,"mat-error",13),r()(),a(17,"div")(18,"div",7),l(19),u(20,"translate"),r(),a(21,"mat-slide-toggle",14),Ie("ngModelChange",function(x){return y(c),Se(n.groupByAccounts,x)||(n.groupByAccounts=x),b(x)}),l(22,"By accounts"),r(),_(23,"br"),a(24,"mat-slide-toggle",14),Ie("ngModelChange",function(x){return y(c),Se(n.showPeriode,x)||(n.showPeriode=x),b(x)}),l(25,"Accumulated"),r()(),a(26,"div",15)(27,"button",16),C("click",function(){return y(c),b(n.loadData())}),_(28,"i",17),l(29),u(30,"translate"),r(),_(31,"br"),a(32,"button",16),C("click",function(){return y(c),b(n.downloadExcel())}),_(33,"i",18),l(34),u(35,"translate"),r()()(),f(36,Hf,2,0,"div",19)(37,qf,10,5,"div",19)(38,Qf,3,0,"div",19)}if(t&2){let c=fe(14);o(3),m(" ",v(4,16,"commerce.accountingreport2.2")," "),o(4),I(v(8,18,"booking.availability.3")),o(2),s("formGroup",n.range)("dateFilter",n.myFilter)("rangePicker",c),o(3),s("for",c),o(3),s("ngIf",n.range.controls.start.hasError("matStartDateInvalid")),o(),s("ngIf",n.range.controls.end.hasError("matEndDateInvalid")),o(3),m(" ",v(20,20,"commerce.accountingreport2.3")," "),o(2),we("ngModel",n.groupByAccounts),o(3),we("ngModel",n.showPeriode),o(5),m(" ",v(30,22,"commerce.accountingreport2.1")," "),o(5),m(" ",v(35,24,"commerce.accountingreport2.4")," "),o(2),s("ngIf",n.loading),o(),s("ngIf",n.data&&!n.groupByAccounts&&!n.loading),o(),s("ngIf",n.data&&n.groupByAccounts&&!n.loading)}},styles:[".days[_ngcontent-%COMP%]{display:flex;background-color:#fff;overflow-x:scroll;position:relative;padding:20px;border-radius:5px}.dataset[_ngcontent-%COMP%]{display:flex;overflow-x:scroll}.colname[_ngcontent-%COMP%]{flex:0 0 300px;font-size:12px;line-height:20px;background-color:#fff}div.day[_ngcontent-%COMP%]:nth-child(2n){background-color:#f5f8fb}.topfilter[_ngcontent-%COMP%]{margin-bottom:20px;border-radius:5px;display:flex;gap:20px}.topfilter[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]{padding:10px;background-color:#fff;border-radius:5px}.buttons[_ngcontent-%COMP%]   button[_ngcontent-%COMP%]{margin-top:15px;width:100%}mat-slide-toggle[_ngcontent-%COMP%]{margin-bottom:10px}.group[_ngcontent-%COMP%]{border:solid 1px #000!important}.title[_ngcontent-%COMP%]{color:#666;text-align:center}"]})}return i})();function zf(i,p){i&1&&(a(0,"div",2),_(1,"i",3),r())}function Wf(i,p){if(i&1&&(_(0,"div",16),u(1,"nl2br")),i&2){let e=d(),t=e.$implicit,n=e.index;jt("cell"+n),s("innerHTML",v(1,4,t),ht)("title",t)}}function Kf(i,p){if(i&1&&(Q(0),f(1,Wf,2,6,"div",15),z()),i&2){let e=p.index;o(),s("ngIf",e<4)}}function Xf(i,p){if(i&1&&(_(0,"div",16),u(1,"nl2br")),i&2){let e=d(),t=e.$implicit,n=e.index;jt("cell"+n),s("innerHTML",v(1,4,t),ht)("title",t)}}function Yf(i,p){if(i&1&&(Q(0),f(1,Xf,2,6,"div",15),z()),i&2){let e=p.index;o(),s("ngIf",e>=4&&e<=7)}}function Jf(i,p){if(i&1){let e=S();a(0,"div",12),C("click",function(){let n=y(e),c=n.$implicit,g=n.index,x=d(2);return b(x.showRow(g,c))}),f(1,Kf,2,1,"ng-container",13),_(2,"div",14),f(3,Yf,2,1,"ng-container",13),r()}if(i&2){let e=p.$implicit,t=p.index,n=d(2);ee("clickable",n.isClickable(t)),o(),s("ngForOf",e),o(2),s("ngForOf",e)}}function Zf(i,p){if(i&1){let e=S();a(0,"div",4)(1,"div",5)(2,"div",6),l(3,"Ledger"),r(),a(4,"div",7),l(5,"Description "),a(6,"i",8),C("click",function(){y(e);let n=d();return b(n.downloadExcel())}),r()(),a(7,"div",9),l(8,"Amount"),r(),a(9,"div",10),l(10,"Accounting date"),r()(),f(11,Jf,4,4,"div",11),r()}if(i&2){let e=d();o(11),s("ngForOf",e.rows)}}var gn=(()=>{class i{accountController;paymentController;receiptController;dialog;decimalPipe;locale;row;showAll=!1;accounts=new Map;payments=new Map;paymentAccountMapping;rows=[];loaded=!1;receiptsForPayment;batches;ledgerRows;constructor(e,t,n,c,g,x){this.accountController=e,this.paymentController=t,this.receiptController=n,this.dialog=c,this.decimalPipe=g,this.locale=x}setLedgerRows(e){this.load(e)}load(e){let t=[],n=[],c=[];for(let g of e)g.ledgerRow.accountId&&t.push(g.ledgerRow.accountId),g.ledgerRow.paymentId&&n.push(g.ledgerRow.paymentId),g.ledgerRow.paymentBatchId&&c.push(g.ledgerRow.paymentBatchId);n=[...new Set(n)],c=[...new Set(c)],Qe([this.accountController.getAccounts(t),this.paymentController.getPaymentsByIds(n),this.accountController.getPaymentAccountMapping(n),this.receiptController.getInvoicesByPaymentIds(n),this.receiptController.getBatchPaymentInfos(c)]).subscribe(g=>{g[0].forEach(x=>{this.accounts.set(x.id,x)}),g[1].forEach(x=>{this.payments.set(x.id,x)}),this.paymentAccountMapping=g[2],this.receiptsForPayment=g[3],this.batches=g[4],this.ledgerRows=e,e.forEach(x=>this.createRow(x)),this.loaded=!0})}set ledgers(e){let t=[];e.forEach(n=>{for(let c of n.all){let g={};g.accountingDate=n.accountingDate,g.ledgerId=n.id,g.ledgerNumber=n.ledgerNumber,g.ledgerRow=c,t.push(g)}}),t=t.filter(n=>this.shouldShow(n)),this.load(t)}shouldShow(e){return e.ledgerRow.typeId==this.row.ledgerTypeId}getSubText(e){let t=this.accounts.get(e.accountId);if(!t)return"";let n="";return t.entries.forEach(c=>{c.units.forEach(g=>{g.accountUnitId==e.accountUnitId&&(n=c.receiptSubText)})}),n}createRow(e){let t=[],n=e.ledgerRow;t[0]=e.ledgerNumber,t.push(this.getDetails(e)),t.push(n.amount),t.push(e.accountingDate),this.getAccountInfo(e).forEach(c=>{t.push(c)}),this.rows.push(t)}getDetails(e){if(e.ledgerRow.type=="revenue")return this.getProductDesc(e);if(e.ledgerRow.type=="payment")return this.getPaymentInfo(e);if(e.ledgerRow.type=="tax")return"Tax for "+this.getProductDesc(e);if(e.ledgerRow.type=="prepaid")return this.getPaymentInfo(e);if(e.ledgerRow.type=="unbilled")return this.getProductDesc(e);if(e.ledgerRow.type=="invoice_paymentrecord_ocr"||e.ledgerRow.type=="invoice_paymentrecord_manual"||e.ledgerRow.type=="invoice_paymentrecord_fee"){let t="Payment for ";return e.ledgerRow.type=="invoice_paymentrecord_fee"&&(t="Fee for "),this.batches[e.ledgerRow.paymentBatchId].forEach(n=>{t+=n.invoiceNumber+" (Amount: "+n.amount+") => "}),t+=e.ledgerRow.type=="invoice_paymentrecord_ocr"?" registered by ocr ":" registred manually ",t}return"Missing implementation for "+e.ledgerRow.type}getPaymentInfo(e){let t=this.payments.get(e.ledgerRow.paymentId),n="Payment "+t.type.name+", id: "+t.id;if(t.remotePaymentId&&(n+=", remoteid: "+t.remotePaymentId),t.type.type=="INVOICE"){let c=this.receiptsForPayment[t.id][0];n="Invoice",c?n+=": "+c.incrementalReceiptNumber:n+="missing for : "+e.ledgerRow.receiptId}return n}getProductDesc(e){let t=this.accounts.get(e.ledgerRow.accountId);for(let n of t.entries)for(let c of n.units)if(c.accountUnitId==e.ledgerRow.accountUnitId){let g=n.product.defaultName;return n.receiptSubText&&(g+=" - "+n.receiptSubText),g}return"-"}getAccountInfo(e){let t=[];if(this.paymentAccountMapping[e.ledgerRow.paymentId])for(let c of this.paymentAccountMapping[e.ledgerRow.paymentId])t.push(c.id),this.accounts.set(c.id,c);e.ledgerRow.accountId&&t.push(e.ledgerRow.accountId);let n=[];for(let c=0;c<4;c++)n[c]="";return t.forEach(c=>{let g=this.accounts.get(c);if(!g)return[];let x=!1;for(let P of g.entries)if(P.product.type=="hotel"){let k=P.startDate?Ht(P.startDate,"dd.MM.yyyy",this.locale):"-",A=P.endDate?Ht(P.endDate,"dd.MM.yyyy",this.locale):"-";n[0]=n[0]+c+`
`,n[1]=n[1]+P.product.defaultName+" "+P.receiptSubText+`
`,n[2]=n[2]+k+`
`,n[3]=n[3]+A+`
`,x=!0}}),n}downloadExcel(){let e=Ye.book_new(),t=Ye.aoa_to_sheet(this.rows);Ye.book_append_sheet(e,t,"Sheet 1");let n=wi(e,{bookType:"xlsx",type:"array"}),c=new Blob([n],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),g=window.URL.createObjectURL(c),x=document.createElement("a");x.href=g,x.download="data.xlsx",x.click(),window.URL.revokeObjectURL(g)}showRow(e,t){let n=this.ledgerRows[e];console.log(t,n,e),n.ledgerRow.type=="payment"&&this.paymentController.getPaymentById(n.ledgerRow.paymentId).subscribe(c=>{let g=new Lt;g.paymentToRefund=c,g.type="receipt",g.accounts=[];let x=this.dialog.open(ui,{data:g})})}isClickable(e){return this.ledgerRows[e].ledgerRow.type=="payment"}static \u0275fac=function(t){return new(t||i)(h(Ae),h(We),h(Je),h(q),h(me),h(xt))};static \u0275cmp=w({type:i,selectors:[["app-accounting-cell-viewer-dialog"]],decls:3,vars:2,consts:[["class","loading",4,"ngIf"],["class","rows",4,"ngIf"],[1,"loading"],[1,"fa","fa-spin","fa-spinner"],[1,"rows"],[1,"row","header"],[1,"cell0"],[1,"cell1"],[1,"fa","fa-download",3,"click"],[1,"cell2"],[1,"cell3"],["class","row",3,"clickable","click",4,"ngFor","ngForOf"],[1,"row",3,"click"],[4,"ngFor","ngForOf"],[1,"accountinfo"],[3,"innerHTML","title","class",4,"ngIf"],[3,"innerHTML","title"]],template:function(t,n){t&1&&(a(0,"mat-dialog-content"),f(1,zf,2,0,"div",0)(2,Zf,12,1,"div",1),r()),t&2&&(o(),s("ngIf",!n.loaded),o(),s("ngIf",n.loaded))},dependencies:[T,M,K,Vt],styles:[".rows[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap}.row[_ngcontent-%COMP%]{flex:1 1 100%;display:flex;margin-bottom:10px;margin-top:10px;width:100%;padding-bottom:3px;flex-wrap:wrap}.row[_ngcontent-%COMP%]:nth-child(2n){background-color:#efefef}.cell0[_ngcontent-%COMP%]{flex:0 0 50px;padding:5px}.cell1[_ngcontent-%COMP%]{flex:1 1 300px;padding:5px}.cell2[_ngcontent-%COMP%]{flex:0 0 90px;position:relative;padding:5px}.cell3[_ngcontent-%COMP%]{flex:0 0 90px;padding:5px}.cell4[_ngcontent-%COMP%]{flex:0 0 230px;padding:5px 5px 5px 14px;color:#666}.cell5[_ngcontent-%COMP%]{flex:1 1 50%;padding:5px;color:#666}.cell6[_ngcontent-%COMP%]{flex:0 0 80px;padding:5px;color:#666}.cell7[_ngcontent-%COMP%]{flex:0 0 80px;padding:5px 14px 5px 5px;color:#666}.accountinfo[_ngcontent-%COMP%]{flex:100%;display:flex;padding-left:10px;padding-right:10px;border-radius:5px;color:#666}.cell2[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]{position:absolute;inset:0;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.header[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]{font-weight:700}.loading[_ngcontent-%COMP%]{padding:20px;text-align:center}.accountinfo[_ngcontent-%COMP%]   span[_ngcontent-%COMP%]{display:block;padding:5px}.subrow[_ngcontent-%COMP%]{display:flex}.clickable[_ngcontent-%COMP%]{color:#00f;cursor:pointer}"]})}return i})();function eg(i,p){i&1&&(a(0,"div",2),_(1,"i",3),r())}function tg(i,p){if(i&1&&(a(0,"div"),_(1,"div",14),u(2,"nl2br"),r()),i&2){let e=p.$implicit,t=p.index;jt("cell"+t),o(),s("innerHTML",v(2,4,e),ht)("title",e)}}function ig(i,p){if(i&1&&(a(0,"div",12),f(1,tg,3,6,"div",13),r()),i&2){let e=p.$implicit;o(),s("ngForOf",e)}}function ng(i,p){if(i&1&&(a(0,"div",4)(1,"div",5)(2,"div",6),l(3,"Accountid"),r(),a(4,"div",7),l(5,"Description"),r(),a(6,"div",8),l(7,"Checkin"),r(),a(8,"div",9),l(9,"Checkout"),r(),a(10,"div",10),l(11,"Amount"),r()(),f(12,ig,2,1,"div",11),r()),i&2){let e=d();o(12),s("ngForOf",e.rows)}}var qr=(()=>{class i{decimalPipe;locale;loaded=!1;data;rows=[];constructor(e,t){this.decimalPipe=e,this.locale=t}setData(e){this.data=e,this.createRows(),this.loaded=!0}createRows(){this.rows=[],this.data.forEach(e=>{let t=[];this.getAccountInfo(e.account).forEach(n=>{t.push(n)}),t.push(this.decimalPipe.transform(e.amount,"1.2-2")),e.payment&&t.push(e.payment.id),this.rows.push(t)})}getAccountInfo(e){if(!e)return[];let t=[],n=!1;for(let c=0;c<4;c++)t[c]="";t[0]=t[0]+e.id+`
`;for(let c of e.entries)if(c.product.type=="hotel"){let g=c.startDate?Ht(c.startDate,"dd.MM.yyyy",this.locale):"-",x=c.endDate?Ht(c.endDate,"dd.MM.yyyy",this.locale):"-";t[1]=t[1]+c.product.defaultName+" "+c.receiptSubText+`
`,t[2]=t[2]+g+`
`,t[3]=t[3]+x+`
`,n=!0}return n||(t[1]="N/A",t[2]="N/A",t[3]="N/A"),t}get total(){let e=0;return this.data.forEach(t=>{e+=t.amount}),e}static \u0275fac=function(t){return new(t||i)(h(me),h(xt))};static \u0275cmp=w({type:i,selectors:[["app-open-unbilled-report"]],decls:5,vars:3,consts:[["class","loading",4,"ngIf"],["class","rows",4,"ngIf"],[1,"loading"],[1,"fa","fa-spin","fa-spinner"],[1,"rows"],[1,"row","header"],[1,"cell0"],[1,"cell1"],[1,"cell2"],[1,"cell3"],[1,"cell4"],["class","row",4,"ngFor","ngForOf"],[1,"row"],[3,"class",4,"ngFor","ngForOf"],[3,"innerHTML","title"]],template:function(t,n){t&1&&(a(0,"mat-dialog-content"),f(1,eg,2,0,"div",0)(2,ng,13,1,"div",1),a(3,"div"),l(4),r()()),t&2&&(o(),s("ngIf",!n.loaded),o(),s("ngIf",n.loaded),o(2),m(" Total out: ",n.total," "))},dependencies:[T,M,K,Vt],styles:[".rows[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap}.row[_ngcontent-%COMP%]{flex:1 1 100%;display:flex;gap:20px;border-bottom:solid 1px #DDD;margin-bottom:10px;width:100%;padding-bottom:3px}.cell0[_ngcontent-%COMP%]{flex:0 0 230px}.cell1[_ngcontent-%COMP%]{flex:1 1 300px;position:relative}.cell2[_ngcontent-%COMP%], .cell3[_ngcontent-%COMP%], .cell4[_ngcontent-%COMP%]{flex:0 0 90px}.header[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]{font-weight:700}.loading[_ngcontent-%COMP%]{padding:20px;text-align:center}"]})}return i})();function og(i,p){i&1&&(a(0,"div"),l(1," \xA0 "),r())}function rg(i,p){i&1&&(a(0,"div"),l(1," In "),r())}function ag(i,p){i&1&&(a(0,"div"),l(1," Out "),r())}function cg(i,p){if(i&1&&(a(0,"div"),l(1),r()),i&2){let e=d(2);o(),m("",e.day.date," ")}}function lg(i,p){i&1&&(a(0,"div"),l(1," Periode "),r())}function sg(i,p){if(i&1&&(a(0,"div"),f(1,cg,2,1,"div",1)(2,lg,2,0,"div",1),r()),i&2){let e=d();o(),s("ngIf",!e.accountingReport.showPeriode),o(),s("ngIf",e.accountingReport.showPeriode)}}function pg(i,p){if(i&1&&(a(0,"div"),l(1),u(2,"translate"),r()),i&2){let e=d(2).$implicit;o(),m(" ",v(2,1,"commerce.account_day_report."+e)," ")}}function dg(i,p){i&1&&(a(0,"div"),l(1," \xA0 "),r())}function mg(i,p){i&1&&(a(0,"div"),l(1," \xA0 "),r())}function ug(i,p){i&1&&(a(0,"div"),l(1," \xA0"),r())}function fg(i,p){if(i&1&&(a(0,"div",10),l(1),r()),i&2){let e=d(2).$implicit;o(),m(" ",e.subName," ")}}function gg(i,p){if(i&1&&(a(0,"div")(1,"div"),l(2),r(),f(3,fg,2,1,"div",9),r()),i&2){let e=d().$implicit;o(),ee("proudcttitle",e.subName),o(),m(" ",e.name," "),o(),s("ngIf",e.subName)}}function _g(i,p){if(i&1&&(a(0,"div"),l(1),u(2,"number"),r()),i&2){let e=d().$implicit,t=d(3);o(),m(" ",F(2,1,t.getInValue(e),"1.0-0")," ")}}function vg(i,p){if(i&1){let e=S();a(0,"div",11),C("click",function(){y(e);let n=d().$implicit,c=d(3);return b(c.showDay(n))}),l(1),u(2,"number"),r()}if(i&2){let e=d().$implicit,t=d(3);ee("clickable",t.hasAnyRecords(e)),o(),m(" ",F(2,3,t.getValue(e),"1.0-0")," ")}}function hg(i,p){if(i&1){let e=S();a(0,"div",11),C("click",function(){y(e);let n=d().$implicit,c=d(3);return b(c.showOutValues(n))}),l(1),u(2,"number"),r()}if(i&2){let e=d().$implicit,t=d(3);ee("clickable",t.isOutClickable(e)),o(),m(" ",F(2,3,t.getOutValue(e),"1.0-0")," ")}}function Cg(i,p){if(i&1&&(a(0,"div",7),f(1,gg,4,4,"div",1)(2,_g,3,4,"div",1)(3,vg,3,6,"div",8)(4,hg,3,6,"div",8),r()),i&2){let e=d(3);ee("rowname",e.type=="rowname"),o(),s("ngIf",e.type=="rowname"),o(),s("ngIf",e.type=="invalues"),o(),s("ngIf",e.type=="standard"),o(),s("ngIf",e.type=="out")}}function xg(i,p){if(i&1&&(a(0,"div")(1,"div",4),f(2,pg,3,3,"div",1)(3,dg,2,0,"div",1)(4,mg,2,0,"div",1)(5,ug,2,0,"div",1),r(),f(6,Cg,5,6,"div",5),_(7,"div",6),r()),i&2){let e=d().$implicit,t=d();o(2),s("ngIf",t.type=="rowname"),o(),s("ngIf",t.type=="invalues"),o(),s("ngIf",t.type=="out"),o(),s("ngIf",t.type=="standard"),o(),s("ngForOf",t.accountingReport.data.allLedgerRowTypeIds[e])}}function yg(i,p){if(i&1&&(a(0,"div",3),f(1,xg,8,5,"div",1),r()),i&2){let e=p.$implicit,t=d();o(),s("ngIf",t.accountingReport.data.allLedgerRowTypeIds[e])}}function bg(i,p){i&1&&(a(0,"div"),l(1," \xA0 "),r())}function wg(i,p){i&1&&(a(0,"div"),l(1," \xA0 "),r())}function Sg(i,p){i&1&&(a(0,"div"),l(1," \xA0 "),r())}function Ig(i,p){if(i&1&&(a(0,"div"),l(1),u(2,"number"),r()),i&2){let e=d();o(),m(" ",v(2,1,e.getTotal())," ")}}var Qr=(()=>{class i{accountingReport;translateService;accountingController;dialog;day;rowname=!1;invalues=!1;outvalues=!1;groups=["revenue","taxes","tax","payment","unbilled","prepaid","invoice"];constructor(e,t,n,c){this.accountingReport=e,this.translateService=t,this.accountingController=n,this.dialog=c}getOutValue(e){return this.getInValue(e)+this.getValue(e)}getInValue(e){return e.inValue}showDay(e){let t=this.dialog.open(gn);t.componentInstance.row=e,t.componentInstance.ledgers=this.day.ledgers}hasAnyRecords(e){if(!this.day||!this.day.ledgers)return!1;let t=!1;return this.day.ledgers.forEach(n=>{n.all.forEach(c=>{c.typeId==e.ledgerTypeId&&(t=!0)})}),t}getValue(e){let t=0;return!this.day||!this.day.ledgers?0:(this.day.ledgers.forEach(n=>{n.all.forEach(c=>{c.typeId==e.ledgerTypeId&&(t+=c.amount)})}),t)}get type(){return this.rowname?"rowname":this.invalues?"invalues":this.outvalues?"out":"standard"}getTotal(){let e=0;return!this.day||!this.day.ledgers?0:(this.day.ledgers.forEach(t=>{t.all.forEach(n=>{e+=n.amount})}),e)}showOutValues(e){if(!this.isOutClickable(e))return;let t=new Date(this.day.date),n=null;e.ledgerTypeId=="unbilled"?n=this.dialog.open(qr):e.ledgerTypeId=="prepaid"?n=this.dialog.open(un):n=this.dialog.open(fn),this.accountingController.getOpenLedgers(e.ledgerTypeId,this.accountingReport.filter).subscribe(c=>{n.componentInstance.setData(c)})}getCols(){let e=[];if(this.type=="standard"){let t=this.accountingReport.showPeriode?"Periode":this.day.date;e.push(t)}else this.type=="invalues"?e.push("In"):this.type=="out"?e.push("Out"):e.push("");for(let t of this.groups)if(this.accountingReport.data.allLedgerRowTypeIds[t]){this.type=="rowname"?e.push(this.translateService.instant("commerce.account_day_report."+t)):e.push("");for(let n of this.accountingReport.data.allLedgerRowTypeIds[t]){if(this.type=="rowname"){let c=n.name;n.subName&&(c+=" ( "+n.subName+" )"),e.push(c)}if(this.type=="standard"){let c=this.getValue(n),g=Math.round(c*1)/1;e.push(g)}if(this.type=="invalues"){let c=this.getInValue(n),g=Math.round(c*1)/1;e.push(g)}if(this.type=="out"){let c=this.getOutValue(n),g=Math.round(c*1)/1;e.push(g)}}e.push("")}return e}isOutClickable(e){return e&&e.ledgerTypeId=="unbilled"||e.ledgerTypeId=="prepaid"||e.subType=="INVOICE"}static \u0275fac=function(t){return new(t||i)(h(Ei),h(Xn),h(wt),h(q))};static \u0275cmp=w({type:i,selectors:[["app-accounting-day"]],inputs:{day:"day",rowname:"rowname",invalues:"invalues",outvalues:"outvalues"},decls:11,vars:9,consts:[[1,"cell","header"],[4,"ngIf"],["class","group",4,"ngFor","ngForOf"],[1,"group"],[1,"cell","header","rowname","groupname"],["class","cell",3,"rowname",4,"ngFor","ngForOf"],[2,"height","40px"],[1,"cell"],[3,"clickable","click",4,"ngIf"],["class","taxdesc",4,"ngIf"],[1,"taxdesc"],[3,"click"]],template:function(t,n){t&1&&(a(0,"div",0),f(1,og,2,0,"div",1)(2,rg,2,0,"div",1)(3,ag,2,0,"div",1)(4,sg,3,2,"div",1),r(),f(5,yg,2,1,"div",2),a(6,"div",0),f(7,bg,2,0,"div",1)(8,wg,2,0,"div",1)(9,Sg,2,0,"div",1)(10,Ig,3,3,"div",1),r()),t&2&&(o(),s("ngIf",n.type=="rowname"),o(),s("ngIf",n.type=="invalues"),o(),s("ngIf",n.type=="out"),o(),s("ngIf",n.type=="standard"),o(),s("ngForOf",n.groups),o(2),s("ngIf",n.type=="rowname"),o(),s("ngIf",n.type=="invalues"),o(),s("ngIf",n.type=="out"),o(),s("ngIf",n.type=="standard"))},dependencies:[T,M,E,me],styles:[".cell[_ngcontent-%COMP%]{font-size:14px;line-height:20px;padding:5px 10px;line-height:26px;text-align:right}.group[_ngcontent-%COMP%]   .cell[_ngcontent-%COMP%]{border-bottom:solid 1px #DDD}.cell.header[_ngcontent-%COMP%]{border-right:solid 1px transparent;text-align:center}.cell.rowname[_ngcontent-%COMP%]{text-align:left!important}.proudcttitle[_ngcontent-%COMP%]{font-size:14px;padding:0;margin:0;line-height:16px}.taxdesc[_ngcontent-%COMP%]{font-size:12px;padding:0;margin:0;line-height:10px;color:#666}.groupname[_ngcontent-%COMP%]{font-weight:700}.clickable[_ngcontent-%COMP%]{color:#00f;cursor:pointer}"]})}return i})();function Mg(i,p){if(i&1&&(a(0,"div",3),l(1),r()),i&2){let e=p.$implicit;o(),m(" ",e," ")}}function Dg(i,p){if(i&1){let e=S();a(0,"div",11),C("click",function(){let n=y(e).$implicit,c=d().$implicit,g=d(2);return b(g.showDay(c,n))}),l(1),u(2,"number"),r()}if(i&2){let e=p.$implicit,t=d().$implicit,n=d(2);ee("cell",n.hasData(t,e)),o(),m(" ",F(2,3,n.getAmount(t,e),"1.0-0")," ")}}function Pg(i,p){if(i&1&&(a(0,"div",6)(1,"div",7)(2,"div",2)(3,"div",8),l(4),r(),a(5,"div",9),l(6),r()(),a(7,"div",3),l(8),u(9,"number"),r(),f(10,Dg,3,6,"div",10),a(11,"div",3),l(12),u(13,"number"),r()()()),i&2){let e=p.$implicit,t=d(2);ee("groupchange",t.isGroupChange(e)),o(4),m(" ",e.accountNumber," "),o(2),m(" ",e.description," "),o(2),m(" ",F(9,7,t.getInValue(e),"1.0-0")," "),o(2),s("ngForOf",t.getDays()),o(2),m(" ",F(13,10,t.getOutValue(e),"1.0-0")," ")}}function Eg(i,p){if(i&1&&(a(0,"div")(1,"div",1)(2,"div",2),l(3," \xA0 "),r(),a(4,"div",3),l(5,"In"),r(),f(6,Mg,2,1,"div",4),a(7,"div",3),l(8,"Out"),r()(),f(9,Pg,14,13,"div",5),r()),i&2){let e=d();o(6),s("ngForOf",e.getDays()),o(3),s("ngForOf",e.parent.accounts)}}var zr=(()=>{class i{parent;dialog;days;values=new Map;constructor(e,t){this.parent=e,this.dialog=t,this.days=this.createDaysMap(),this.days.sort(),this.createValues()}createValues(){console.log(this.parent.accountingAccountReport),this.parent.accounts.forEach(e=>{for(let t of this.parent.accountingAccountReport){let n=[];if(t.account.id==e.id){let c=[],g=0;this.days.forEach(x=>{let P=0;t.ledgers[x]&&(t.ledgers[x].forEach(k=>{c.push(k),P+=k.ledgerRow.amount}),g+=P,n.push({day:x,amount:P,ledgers:t.ledgers[x]}))}),n.push({day:"Periode",amount:g,ledgers:c}),this.values.set(e.id,n)}}})}getValue(e,t){let n=this.values.get(e.id);return n?n.filter(c=>c.day==t)[0]:null}getAmount(e,t){let n=this.getValue(e,t);return console.log(n),n==null?0:n.amount}get(e){return this.parent.accountingAccountReport.filter(t=>t.account.id==e.id)[0]}showDay(e,t){let n=this.getValue(e,t),c=this.dialog.open(gn);c.componentInstance.showAll=!0,c.componentInstance.setLedgerRows(n.ledgers)}createDaysMap(){let e=[];for(let t of this.parent.accountingAccountReport)Object.keys(t.ledgers).forEach(n=>{e.indexOf(n)<0&&e.push(n)});return e}getDays(){return this.parent.showPeriode?["Periode"]:this.days}getInValue(e){for(let t of this.parent.accountingAccountReport)if(t.account.id==e.id)return t.inValue;return 0}getOutValue(e){let t=this.getInValue(e),n=0;return this.values.get(e.id)&&this.getDays().forEach(c=>{this.values.get(e.id).forEach(g=>{g.amount&&g.day==c&&(n+=g.amount)})}),t+n}isGroupChange(e){let t="";for(let n of this.parent.accounts){let c=(""+n.accountNumber)[0];if(c!=t&&n.id==e.id)return!0;t=c}return!1}hasData(e,t){let n=this.getValue(e,t);return n?n.ledgers.length>0:!1}getRows(){let e=[],t=["Account","Description","In"];for(let n of this.getDays())t.push(n);t.push("Out"),e.push(t);for(let n of this.parent.accounts){let c=[];c.push(n.accountNumber),c.push(n.description),c.push(Math.round(this.getInValue(n)*1)/1);for(let g of this.getDays())c.push(Math.round(this.getAmount(n,g)*1)/1);c.push(Math.round(this.getOutValue(n)*1)/1),e.push(c)}return e}static \u0275fac=function(t){return new(t||i)(h(Ei),h(q))};static \u0275cmp=w({type:i,selectors:[["app-accounting-account-report"]],decls:1,vars:1,consts:[[4,"ngIf"],[1,"row","header"],[1,"first"],[1,"col"],["class","col",4,"ngFor","ngForOf"],["style","border-bottom: solid 1px #FFF",3,"groupchange",4,"ngFor","ngForOf"],[2,"border-bottom","solid 1px #FFF"],[1,"row","data"],[1,"title"],[1,"description"],["class","col",3,"cell","click",4,"ngFor","ngForOf"],[1,"col",3,"click"]],template:function(t,n){t&1&&f(0,Eg,10,2,"div",0),t&2&&s("ngIf",n.parent.accountingAccountReport)},dependencies:[T,M,me],styles:["[_nghost-%COMP%]{display:block}.header[_ngcontent-%COMP%]{margin-bottom:-20px;font-weight:400}.title[_ngcontent-%COMP%]{font-size:14px}.description[_ngcontent-%COMP%]{font-size:12px;color:#666}.row[_ngcontent-%COMP%]{display:flex}.groupchange[_ngcontent-%COMP%]   .col[_ngcontent-%COMP%]{border-top:solid 1px #DDD}.header[_ngcontent-%COMP%]   .col[_ngcontent-%COMP%]{border:solid 0px;border-left:solid 1px transparent}.first[_ngcontent-%COMP%]{flex:0 0 150px}.col[_ngcontent-%COMP%]{padding:5px;font-size:14px;flex:0 0 90px;text-align:center;border-bottom:solid 1px #DDD;border-left:solid 1px #DDD}.cell[_ngcontent-%COMP%]{cursor:pointer;color:#00f}.groupchange[_ngcontent-%COMP%]{margin-top:30px}"]})}return i})();var Tg=["amount"],kg=i=>({groupId:i});function Ag(i,p){i&1&&(a(0,"mat-dialog-content"),_(1,"i",2),r())}function Og(i,p){if(i&1&&(a(0,"span"),l(1),r()),i&2){let e=d().$implicit;o(),m(" - ",e.value.hotelBookingAccountEntry.rentalObjectInfo," ")}}function Fg(i,p){if(i&1){let e=S();a(0,"div",10)(1,"div",11)(2,"div",12),l(3),f(4,Og,2,1,"span",1),r(),a(5,"div",13),l(6),u(7,"date"),u(8,"date"),r()(),a(9,"div",14)(10,"input",15,0),Ie("ngModelChange",function(n){let c=y(e).$implicit;return Se(c.value.registeredAmount,n)||(c.value.registeredAmount=n),b(n)}),r()()()}if(i&2){let e=p.$implicit,t=d(2);ee("selected",e.value.id==t.account.id),o(3),m(" ",e.value.hotelBookingAccountEntry.product.defaultName," "),o(),s("ngIf",e.value.hotelBookingAccountEntry.rentalObjectInfo),o(2),dt(" ",e.value.hotelBookingAccountEntry.receiptSubText," ( ",F(7,8,e.value.hotelBookingAccountEntry.startDate,"shortDate")," - ",F(8,11,e.value.hotelBookingAccountEntry.endDate,"shortDate")," ) "),o(4),we("ngModel",e.value.registeredAmount)}}function Vg(i,p){if(i&1){let e=S();a(0,"button",16),C("click",function(){let n=y(e).$implicit,c=d(2);return b(c.createPayment(n))}),l(1),r()}if(i&2){let e=p.$implicit,t=d(2);s("disabled",!t.total),o(),m(" ",e.name," ")}}function Bg(i,p){if(i&1&&(Q(0),a(1,"h2",3),l(2),u(3,"translate"),r(),a(4,"mat-dialog-content")(5,"div",4),_(6,"i",5),l(7),u(8,"translate"),r(),f(9,Fg,12,14,"div",6),u(10,"keyvalue"),a(11,"div",7),l(12),u(13,"number"),r(),a(14,"div",8),f(15,Vg,2,2,"button",9),r()(),z()),i&2){let e=d();o(2),m(" ",F(3,5,"commerce.registerpayment.1",nt(15,kg,e.group.incrementalId))," "),o(5),m(" ",v(8,8,"commerce.registerpayment.2")," "),o(2),s("ngForOf",v(10,10,e.accounts)),o(3),m(" Total: ",F(13,12,e.total,"1.2-2")," "),o(3),s("ngForOf",e.paymentTypes)}}var $x=(()=>{class i{bookingController;paymentController;dialogRef;accountController;currentAccount;group;loaded=!1;flatBookings;accounts=new Map;amountInputs;paymentTypes;constructor(e,t,n,c){this.bookingController=e,this.paymentController=t,this.dialogRef=n,this.accountController=c}setFocus(){let e=0;for(let t of this.accounts.values())t.id==this.currentAccount.id&&this.amountInputs.get(e).nativeElement.focus(),e++}set account(e){this.currentAccount=e,this.load()}get account(){return this.currentAccount}load(){this.bookingController.getGroupsByAccountId([this.account.id]).subscribe(e=>{if(e&&e.length>0){this.group=e[0];let t=this.group.bookings.map(n=>n.accountId);Qe([this.bookingController.findFlatBookingsByAccountIds(t),this.accountController.getAccounts(t),this.paymentController.getActivatedPaymentTypes()]).subscribe(n=>{this.flatBookings=n[0],n[1].forEach(c=>{this.accounts.set(c.id,c)}),this.paymentTypes=n[2].filter(c=>!c.deleted&&c.type!="INVOICE"),this.loaded=!0,setTimeout(()=>{this.setFocus()},300)})}})}get total(){let e=0;for(let t of this.accounts.values()){let n=t;if(n.registeredAmount){n.registeredAmount=n.registeredAmount.replace(",",".");let c=parseFloat(n.registeredAmount);e+=c}}return e}createPayment(e){let t={};t.paymentTypeId=e.id,t.accountPayments=[],t.createCharged=!0,t.manual=!0;for(let n of this.accounts.values()){let c=n;if(c.registeredAmount){c.registeredAmount=c.registeredAmount.replace(",",".");let g=parseFloat(c.registeredAmount),x={};x.accountId=n.id,x.overrideTotal=g,t.accountPayments.push(x)}}this.paymentController.startPayment(t).subscribe(n=>{this.dialogRef.close(!0)})}static \u0275fac=function(t){return new(t||i)(h(ft),h(We),h(te),h(Ae))};static \u0275cmp=w({type:i,selectors:[["app-register-payment-dialog"]],viewQuery:function(t,n){if(t&1&&N(Tg,5),t&2){let c;L(c=j())&&(n.amountInputs=c)}},decls:2,vars:2,consts:[["amount",""],[4,"ngIf"],[1,"fa","fa-spin","fa-spinner"],["mat-dialog-title",""],[1,"info"],[1,"fa","fa-circle-info"],["class","row",3,"selected",4,"ngFor","ngForOf"],[1,"total"],[1,"payments"],["mat-button","","color","primary",3,"disabled","click",4,"ngFor","ngForOf"],[1,"row"],[1,"col1"],[1,"title"],[1,"subtext"],[1,"col2"],["type","text",1,"amount",3,"ngModelChange","ngModel"],["mat-button","","color","primary",3,"click","disabled"]],template:function(t,n){t&1&&f(0,Ag,2,0,"mat-dialog-content",1)(1,Bg,16,17,"ng-container",1),t&2&&(s("ngIf",!n.loaded),o(),s("ngIf",n.loaded))},dependencies:[T,M,be,K,U,V,et,O,E,me,xi,ue],styles:[".row[_ngcontent-%COMP%]{padding:10px;border-bottom:solid 1px #DDD;display:flex}.row[_ngcontent-%COMP%]   .col1[_ngcontent-%COMP%]{flex:1 1 100%}.row[_ngcontent-%COMP%]   .col2[_ngcontent-%COMP%]{flex:0 0 80px;text-align:right}.title[_ngcontent-%COMP%]{font-weight:500}.subtext[_ngcontent-%COMP%]{font-size:12px}.amount[_ngcontent-%COMP%]{width:50px;border:solid 1px #DDD;padding:5px}.selected[_ngcontent-%COMP%]{background-color:#f5f8fb}.info[_ngcontent-%COMP%]{background-color:#f5f8fb;padding:20px;border-radius:5px;margin-bottom:20px;max-width:400px;box-sizing:border-box}.total[_ngcontent-%COMP%]{padding:20px;font-size:16px;text-align:center}.payments[_ngcontent-%COMP%]{max-width:400px;text-align:center;box-sizing:border-box}"]})}return i})();var Wr=(()=>{class i{httpService;urlService;activate(e,t){let n=[];n.push({name:"app-id",value:e}),n.push({name:"refreshToken",value:t});let c=new $;for(let g of n)c=c.append(g.name,g.value);return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/planday/activate",null,{params:c})}constructor(e,t){this.httpService=e,this.urlService=t}deactivate(){return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/planday/deactivate",null)}getSettings(){return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/planday")}getUnits(){return this.httpService.get(this.urlService.getBackendUrl()+"/commerce/planday/revenueunits")}selectRevenueUnit(e){let t=[];e!=null&&t.push({name:"revenueUnit",value:e.toString()});let n=new $;for(let c of t)n=n.append(c.name,c.value);return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/planday/selectRevenueUnit",null,{params:n})}uploadRemaining(){return this.httpService.post(this.urlService.getBackendUrl()+"/commerce/planday/uploadRemaining",null)}static \u0275fac=function(t){return new(t||i)(Y(_e),Y(ve))};static \u0275prov=re({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();var Ng=()=>({appid:"6db2c5a5-dfa4-4334-a8f2-ec59f29d97cb"});function Lg(i,p){if(i&1){let e=S();a(0,"div",1)(1,"div",2),l(2),u(3,"translate"),r(),a(4,"div",3),l(5),u(6,"translate"),_(7,"br")(8,"br"),a(9,"a",4),l(10),u(11,"translate"),r()(),a(12,"mat-form-field",5)(13,"mat-label"),l(14,"App id"),r(),a(15,"input",6),Ie("ngModelChange",function(n){y(e);let c=d();return Se(c.appId,n)||(c.appId=n),b(n)}),r()(),l(16," \xA0\xA0 "),a(17,"mat-form-field",5)(18,"mat-label"),l(19,"Token"),r(),a(20,"input",6),Ie("ngModelChange",function(n){y(e);let c=d();return Se(c.refreshToken,n)||(c.refreshToken=n),b(n)}),r()(),l(21," \xA0\xA0 "),a(22,"button",7),C("click",function(){y(e);let n=d();return b(n.save())}),_(23,"i",8),l(24),u(25,"translate"),r()()}if(i&2){let e=d();o(2),m(" ",v(3,6,"commerce.planday.1")," "),o(3),m(" ",F(6,8,"commerce.planday.8",Pe(15,Ng))," "),o(5),m(" ",v(11,11,"commerce.planday.7")," "),o(5),we("ngModel",e.appId),o(5),we("ngModel",e.refreshToken),o(4),m(" ",v(25,13,"commerce.planday.2"),"")}}function jg(i,p){i&1&&(a(0,"div",12),l(1),u(2,"translate"),r()),i&2&&(o(),m(" ",v(2,1,"commerce.planday.5")," "))}function Ug(i,p){if(i&1){let e=S();a(0,"div",13),C("click",function(){let n=y(e).$implicit,c=d(3);return b(c.select(n))}),l(1),r()}if(i&2){let e=p.$implicit;o(),dt(" ",e.id," - ",e.name," - ",e.description," ")}}function Hg(i,p){if(i&1&&(a(0,"div")(1,"b"),l(2),u(3,"translate"),r(),_(4,"br")(5,"br"),a(6,"div",2),l(7),u(8,"translate"),r(),f(9,jg,3,3,"div",10)(10,Ug,2,3,"div",11),r()),i&2){let e=d(2);o(2),m(" ",v(3,4,"commerce.planday.3")," "),o(5),m(" ",v(8,6,"commerce.planday.4")," "),o(2),s("ngIf",e.revenueUnits!=null&&e.revenueUnits.length==0),o(),s("ngForOf",e.revenueUnits)}}function $g(i,p){if(i&1){let e=S();a(0,"div")(1,"b"),l(2," Planday "),r(),_(3,"br")(4,"br"),a(5,"div"),l(6),u(7,"translate"),r(),_(8,"br"),a(9,"button",14),C("click",function(){y(e);let n=d(2);return b(n.deactivate())}),l(10," Deactivate "),r(),l(11," \xA0 "),a(12,"button",15),C("click",function(){y(e);let n=d(2);return b(n.transferAllData())}),l(13," Transfer remaining data "),r()()}i&2&&(o(6),m(" ",v(7,1,"commerce.planday.6")," "))}function Gg(i,p){if(i&1&&(a(0,"div",1),f(1,Hg,11,8,"div",9)(2,$g,14,3,"div",9),r()),i&2){let e=d();o(),s("ngIf",e.settings.revenueUnit==0),o(),s("ngIf",e.settings.revenueUnit>0)}}var Qx=(()=>{class i{planDayController;settings=null;appId;refreshToken;revenueUnits;constructor(e){this.planDayController=e,this.load()}load(){this.revenueUnits=null,this.planDayController.getSettings().subscribe(e=>{this.settings=e,this.settings.activated&&this.settings.revenueUnit==0&&this.planDayController.getUnits().subscribe(t=>{this.revenueUnits=t})})}save(){this.planDayController.activate(this.appId,this.refreshToken).subscribe(e=>{this.load()})}transferAllData(){this.planDayController.uploadRemaining().subscribe(e=>{alert("DONe")})}deactivate(){this.planDayController.deactivate().subscribe(e=>{this.load()})}select(e){this.planDayController.selectRevenueUnit(e.id).subscribe(t=>{this.load()})}static \u0275fac=function(t){return new(t||i)(h(Wr))};static \u0275cmp=w({type:i,selectors:[["app-plan-day"]],decls:2,vars:2,consts:[["class","configbox",4,"ngIf"],[1,"configbox"],[1,"info"],[1,"instrcutions"],["href","https://help.planday.com/en/articles/30402-how-to-use-open-api-to-integrate-with-planday","target","_blank",2,"color","blue"],[1,"example-full-width"],["matInput","","placeholder","","value","",3,"ngModelChange","ngModel"],["mat-flat-button","","color","primary",3,"click"],[1,"fa","fa-link"],[4,"ngIf"],["class","warning",4,"ngIf"],["class","revunite",3,"click",4,"ngFor","ngForOf"],[1,"warning"],[1,"revunite",3,"click"],["mat-flat-button","","color","warn",3,"click"],["mat-flat-button","",3,"click"]],template:function(t,n){t&1&&f(0,Lg,26,16,"div",0)(1,Gg,3,2,"div",0),t&2&&(s("ngIf",n.settings&&!n.settings.activated),o(),s("ngIf",n.settings&&n.settings.activated))},dependencies:[T,M,B,H,G,U,V,et,O,E],styles:[".revunite[_ngcontent-%COMP%]{background-color:#f5f8fb;padding:10px;border-radius:5px;margin-top:10px;cursor:pointer}.configbox[_ngcontent-%COMP%]{background-color:#fff;padding:20px;border-radius:5px;max-width:500px;text-align:center}.info[_ngcontent-%COMP%]{margin-bottom:40px;text-align:left}.warning[_ngcontent-%COMP%]{background-color:#ff0;padding:20px;border-radius:5px}.instrcutions[_ngcontent-%COMP%]{margin-bottom:20px}"]})}return i})();function qg(i,p){if(i&1&&(a(0,"div",6),l(1),a(2,"div",14),l(3),r()()),i&2){let e=p.$implicit;o(),m(" ",e.accountNumber," "),o(2),m(" ",e.description," ")}}function Qg(i,p){if(i&1){let e=S();a(0,"i",23),C("click",function(){y(e);let n=d().$implicit,c=d(2);return b(c.triggerCreditLedger(n))}),r()}}function zg(i,p){if(i&1){let e=S();a(0,"i",24),C("click",function(){y(e);let n=d().$implicit,c=d(2);return b(c.triggerCorrection(n))}),r()}}function Wg(i,p){if(i&1&&(a(0,"span"),l(1),r()),i&2){let e=d().$implicit;o(),m(" - ",e.entry.receiptSubText," ")}}function Kg(i,p){if(i&1&&(a(0,"div",19),f(1,Qg,1,0,"i",20)(2,zg,1,0,"i",21),l(3),f(4,Wg,2,1,"span",22),l(5),r()),i&2){let e=p.$implicit,t=d(2);ee("deleted",e.matchingCreditId),o(),s("ngIf",e.entry.warning&&!e.matchingCreditId),o(),s("ngIf",e.mismatch&&!e.entry.warning&&!e.matchingCreditId),o(),ge(" ",e.unit.count," x ",e.entry.product.defaultName," "),o(),s("ngIf",e.entry.receiptSubText),o(),m("( ",t.getLastNCharacters(e.entry.correctionId,3)," ) ")}}function Xg(i,p){if(i&1&&(a(0,"div",19),l(1),u(2,"number"),r()),i&2){let e=p.$implicit;ee("deleted",e.matchingCreditId),o(),m(" ",F(2,3,e.unit.totalExTaxes,"1.2-2")," ")}}function Yg(i,p){if(i&1&&(a(0,"div",19),l(1),u(2,"number"),r()),i&2){let e=p.$implicit;ee("deleted",e.matchingCreditId),o(),m(" ",F(2,3,e.unit.totalIncTaxes,"1.2-2")," ")}}function Jg(i,p){if(i&1&&(Q(0),l(1),u(2,"number"),z()),i&2){let e=d().$implicit,t=d().$implicit;o(),m(" ",F(2,1,e.accountAmounts.get(t.id),"1.2-2")," ")}}function Zg(i,p){i&1&&(Q(0),l(1," \xA0 "),z())}function e1(i,p){if(i&1&&(a(0,"div",19),f(1,Jg,3,4,"ng-container",22)(2,Zg,2,0,"ng-container",22),r()),i&2){let e=p.$implicit,t=d().$implicit;ee("deleted",e.matchingCreditId),o(),s("ngIf",e.accountAmounts.get(t.id)),o(),s("ngIf",!e.accountAmounts.get(t.id))}}function t1(i,p){if(i&1&&(a(0,"div",6),f(1,e1,3,4,"div",18),r()),i&2){let e=d().$implicit,t=d();o(),s("ngForOf",t.flats.get(e))}}function i1(i,p){if(i&1&&(a(0,"div",15)(1,"div",16)(2,"div",2),l(3),r(),a(4,"div",17),f(5,Kg,6,8,"div",18),r(),a(6,"div",6),f(7,Xg,3,6,"div",18),r(),a(8,"div",7),f(9,Yg,3,6,"div",18),r(),f(10,t1,2,1,"div",8),r()()),i&2){let e=p.$implicit,t=d();o(3),m(" ",e," "),o(2),s("ngForOf",t.flats.get(e)),o(2),s("ngForOf",t.flats.get(e)),o(2),s("ngForOf",t.flats.get(e)),o(),s("ngForOf",t.usedAccounts)}}function n1(i,p){if(i&1&&(a(0,"div",11),l(1),u(2,"number"),r()),i&2){let e=p.$implicit,t=d();o(),m(" ",F(2,1,t.accountTotalValue(e.id),"1.2-2")," ")}}var Kr=(()=>{class i{parent;accountController;flats=new Map;usedAccounts=[];ledgers;account;accounts;constructor(e,t){this.parent=e,this.accountController=t,this.ledgers=this.parent.ledgers,this.account=this.parent.account,this.accounts=this.parent.accounts,this.addMissingEntries(),this.setup(),this.sortFlats()}addMissingEntries(){this.ledgers.forEach(e=>{if(e.typeIds.findIndex(n=>n.startsWith("revenue"))>-1){let n=!1;this.account.allEntriesIncludedCorrections.forEach(k=>{k.units.forEach(A=>{A.ledgerId==e.id&&(n=!0)})});let[c,g,x]=e.accountingDate.split(".").map(Number),P=new Date(x,g-1,c);if(!n){let k={warning:!0,product:{defaultName:"Unkown - deleted?"},correctionId:"",units:[{ledgerId:e.id,totalExTaxes:0,totalIncTaxes:0,accountingDate:P,count:0}]};this.account.allEntriesIncludedCorrections.push(k)}}})}setup(){let e=[],t=[];this.account.allEntriesIncludedCorrections.forEach(n=>{n.units.forEach(c=>{let g={unit:c,entry:n,accountAmounts:new Map,mismatch:!1,matchingCreditId:""},x=new Date(c.accountingDate),P=x.getDate()+"."+(x.getMonth()+1)+"."+x.getFullYear(),k=this.flats.get(P);if(k||(k=[],this.flats.set(P,k)),c.ledgerId){let A=this.ledgers.filter(ie=>ie.id==c.ledgerId);if(A.length){let ie=[];g.matchingCreditId=A[0].matchingCreditId;let Pt=0;A[0].debits.forEach(tt=>{Pt+=tt.amount}),g.mismatch=Math.abs(g.unit.totalIncTaxes-Pt)>.01&&!c.isCreatedFromOldUnitHistory,A[0].all.forEach(tt=>{tt.accountingAccountId?(t.push(tt.accountingAccountId),ie.push(tt.accountingAccountId)):(t.push("unkown"),ie.push("unkown"))}),ie.forEach(tt=>{let Ti=A[0].all.filter(Et=>Et.accountingAccountId==tt||!Et.accountingAccountId&&tt=="unkown").map(Et=>Et.amount),ki=0;Ti.forEach(Et=>{ki+=Et}),g.accountAmounts.set(tt,ki)})}}k.push(g)})}),e=[...new Set(t)],this.usedAccounts=e.map(n=>{let c=this.accounts.filter(g=>g.id==n);return!c.length||n=="unkown"?{accountNumber:"unkown",description:"unkown"}:c[0]})}sortFlats(){let e=Array.from(this.flats.entries()).sort((t,n)=>{let c=this.parseDate(t[0]),g=this.parseDate(n[0]);return c.getTime()-g.getTime()});this.flats=new Map(e)}parseDate(e){let[t,n,c]=e.split(".").map(Number);return new Date(c,n-1,t)}getLastNCharacters(e,t){return e.substr(Math.max(e.length-t,0))}get sumExTax(){let e=0;return this.flats.forEach((t,n)=>{t.forEach(c=>{e+=c.unit.totalExTaxes})}),e}get sumIncTax(){let e=0;return this.flats.forEach((t,n)=>{t.forEach(c=>{e+=c.unit.totalIncTaxes})}),e}accountTotalValue(e){let t=0;return this.flats.forEach((n,c)=>{n.forEach(g=>{g.accountAmounts.get(e)&&(t+=g.accountAmounts.get(e))})}),t}triggerCorrection(e){this.accountController.correctLedger(e.unit.ledgerId,this.parent.accountId,e.unit.accountUnitId).subscribe(t=>{this.parent.load()})}triggerCreditLedger(e){this.accountController.creditLedger(e.unit.ledgerId).subscribe(t=>{this.parent.load()})}static \u0275fac=function(t){return new(t||i)(h(Nt),h(wt))};static \u0275cmp=w({type:i,selectors:[["app-guest-account-overview"]],decls:35,vars:11,consts:[[1,"entry"],[1,"row","header"],[1,"date","col"],[1,"productname","col"],[1,"economyreport","col"],[1,"accountingreport","col"],[1,"extax","col"],[1,"inctax","col"],["class","extax col",4,"ngFor","ngForOf"],["class","unit",4,"ngFor","ngForOf"],[1,"row","header",2,"border-top","solid 1px #DDD"],[1,"extax","col","sum"],[1,"inctax","col","sum"],["class","extax col sum",4,"ngFor","ngForOf"],[1,"accountdesc"],[1,"unit"],[1,"row","entryrow"],[1,"col","productname"],["class","contentbox",3,"deleted",4,"ngFor","ngForOf"],[1,"contentbox"],["class","button fa fa-trash",3,"click",4,"ngIf"],["class","button fa fa-warning",3,"click",4,"ngIf"],[4,"ngIf"],[1,"button","fa","fa-trash",3,"click"],[1,"button","fa","fa-warning",3,"click"]],template:function(t,n){t&1&&(_(0,"br"),a(1,"div",0)(2,"div",1)(3,"div",2),l(4," \xA0"),r(),a(5,"div",3),l(6," \xA0"),r(),a(7,"div",4),l(8," Economy Report"),r(),a(9,"div",5),l(10," Accounting Report"),r()(),a(11,"div",1)(12,"div",2),l(13," \xA0"),r(),_(14,"div",3),a(15,"div",6),l(16," Ex tax"),r(),a(17,"div",7),l(18," Inc tax"),r(),f(19,qg,4,2,"div",8),r()(),a(20,"div",0),f(21,i1,11,5,"div",9),r(),a(22,"div",0)(23,"div",10)(24,"div",2),l(25," \xA0"),r(),a(26,"div",3),l(27," Total "),r(),a(28,"div",11),l(29),u(30,"number"),r(),a(31,"div",12),l(32),u(33,"number"),r(),f(34,n1,3,4,"div",13),r()()),t&2&&(o(19),s("ngForOf",n.usedAccounts),o(2),s("ngForOf",n.flats.keys()),o(8),m(" ",F(30,5,n.sumExTax,"1.2-2")," "),o(3),m(" ",F(33,8,n.sumIncTax,"1.2-2")," "),o(2),s("ngForOf",n.usedAccounts))},dependencies:[T,M,me],styles:[".entry[_ngcontent-%COMP%]   .row[_ngcontent-%COMP%]{width:100%}.entry[_ngcontent-%COMP%]   .entryrow[_ngcontent-%COMP%]{border-top:solid 1px #DDD}.header[_ngcontent-%COMP%]   .col[_ngcontent-%COMP%]{height:50px;vertical-align:top}.col[_ngcontent-%COMP%]{display:inline-block;padding:5px}.entry[_ngcontent-%COMP%]   .date[_ngcontent-%COMP%]{width:80px;font-size:12px;vertical-align:top}.entry[_ngcontent-%COMP%]   .productname[_ngcontent-%COMP%]{width:400px;line-height:12px}.entry[_ngcontent-%COMP%]   .accountingreport[_ngcontent-%COMP%], .entry[_ngcontent-%COMP%]   .economyreport[_ngcontent-%COMP%]{width:171px;text-align:center;font-size:12px;border-left:solid 1px #DDD;height:12px;border-top:solid 1px #DDD;vertical-align:bottom;margin-top:auto;padding-bottom:5px!important;border-bottom:solid 1px #DDD;line-height:15px}.entry[_ngcontent-%COMP%]   .accountingreport[_ngcontent-%COMP%]{width:353px}.accountdesc[_ngcontent-%COMP%]{font-size:12px;color:#666;line-height:15px;vertical-align:top;text-overflow:ellipsis;overflow:hidden;height:30px}.entry[_ngcontent-%COMP%]   .contentbox[_ngcontent-%COMP%]{text-overflow:ellipsis;overflow:hidden;white-space:nowrap;line-height:18px;font-size:13px}.entry[_ngcontent-%COMP%]   .inctax[_ngcontent-%COMP%], .entry[_ngcontent-%COMP%]   .extax[_ngcontent-%COMP%]{border-left:solid 1px #DDD;width:80px;text-align:right}.row.header[_ngcontent-%COMP%]   .extax[_ngcontent-%COMP%], .row.header[_ngcontent-%COMP%]   .inctax[_ngcontent-%COMP%]{text-align:center}.sum[_ngcontent-%COMP%]{font-size:12px;color:#444;text-align:right!important}.button[_ngcontent-%COMP%]{cursor:pointer}.deleted[_ngcontent-%COMP%]{color:#666;text-decoration:line-through}"]})}return i})();function o1(i,p){if(i&1&&(a(0,"div",10)(1,"div",1),l(2),r(),a(3,"div",6),l(4),r(),a(5,"div",1),l(6),r(),a(7,"div",1),l(8),r(),a(9,"div",1),l(10),r()()),i&2){let e=d().$implicit,t=d(2);o(2),m(" ",e.incrementalReceiptNumber," - creditnote "),o(2),m(" ",t.getTotalAmount(e,!0)," "),o(2),m(" ",t.getAccountingDate(e,!0)," "),o(2),m(" ",t.getCreditAmount(e,!0)," "),o(2),m(" ",t.getDebitAmount(e,!0)," ")}}function r1(i,p){if(i&1&&(a(0,"div")(1,"div",10)(2,"div",1),l(3),r(),a(4,"div",6),l(5),r(),a(6,"div",1),l(7),r(),a(8,"div",1),l(9),r(),a(10,"div",1),l(11),r()(),f(12,o1,11,5,"div",11),r()),i&2){let e=p.$implicit,t=d(2);o(3),m(" ",e.incrementalReceiptNumber," "),o(2),m(" ",t.getTotalAmount(e)," "),o(2),m(" ",t.getAccountingDate(e)," "),o(2),m(" ",t.getCreditAmount(e)," "),o(2),m(" ",t.getDebitAmount(e)," "),o(),s("ngIf",e.creditDate&&t.getTotalAmount(e,!0)!=0)}}function a1(i,p){if(i&1&&(a(0,"div"),f(1,r1,13,6,"div",9),r()),i&2){let e=d();o(),s("ngForOf",e.parent.receipts)}}function c1(i,p){i&1&&(a(0,"div"),l(1,` No receipts created
`),r())}var Xr=(()=>{class i{parent;constructor(e){this.parent=e,this.addMissing()}addMissing(){}getTotalAmount(e,t=!1){return t?e.totalCreditNote*e.accountPaymentsFactors[this.parent.accountId]:e.totalExCreditNote*e.accountPaymentsFactors[this.parent.accountId]}getCreditAmount(e,t=!1){if(!e.ledgerId||t&&!e.creditNoteLedgerId)return 0;let n=t?this.getLedger(e.creditNoteLedgerId):this.getLedger(e.ledgerId),c=0;return n?(n.credits.filter(g=>g.accountId==this.parent.accountId).forEach(g=>{c+=g.amount}),c):0}getDebitAmount(e,t=!1){if(!e.ledgerId||t&&!e.creditNoteLedgerId)return 0;let n=t?this.getLedger(e.creditNoteLedgerId):this.getLedger(e.ledgerId),c=0;return n.debits.filter(g=>g.accountId==this.parent.accountId).forEach(g=>{c+=g.amount}),c}getLedger(e){return this.parent.ledgers.filter(t=>t.id==e)[0]}getAccountingDate(e,t=!1){if(!e.ledgerId)return"";let n=t?this.getLedger(e.creditNoteLedgerId):this.getLedger(e.ledgerId);return n?n.accountingDate:""}total(){let e=0;return this.parent.receipts.forEach(t=>{e+=this.getTotalAmount(t),t.creditDate&&(e+=this.getTotalAmount(t,!0))}),e}get totalDebit(){let e=0;return this.parent.receipts.forEach(t=>{e+=this.getDebitAmount(t),t.creditDate&&(e+=this.getDebitAmount(t,!0))}),e}get totalCredit(){let e=0;return this.parent.receipts.forEach(t=>{e+=this.getCreditAmount(t),t.creditDate&&(e+=this.getCreditAmount(t,!0))}),e}static \u0275fac=function(t){return new(t||i)(h(Nt))};static \u0275cmp=w({type:i,selectors:[["app-account-receipts-overview"]],decls:35,vars:8,consts:[[1,"row","header","ecorow"],[1,"col"],[1,"col",2,"border-left","solid 1px #DDD","border-top","solid 1px #DDD"],[1,"col",2,"border-top","solid 1px #DDD"],[1,"col",2,"border-right","solid 1px #DDD","border-top","solid 1px #DDD"],[1,"row","header"],[1,"col","amount"],[4,"ngIf"],[1,"row","summary"],[4,"ngFor","ngForOf"],[1,"row","content"],["class","row content",4,"ngIf"]],template:function(t,n){t&1&&(_(0,"br"),a(1,"div",0)(2,"div",1),l(3,"\xA0"),r(),a(4,"div",1),l(5,"\xA0"),r(),_(6,"div",2),a(7,"div",3),l(8,"Economy Report"),r(),_(9,"div",4),r(),a(10,"div",5)(11,"div",1),l(12,"Receipt number"),r(),a(13,"div",6),l(14,"Amount"),r(),a(15,"div",1),l(16,"Accounting - Date"),r(),a(17,"div",1),l(18,"Accounting - Unbilled"),r(),a(19,"div",1),l(20,"Accounting - Prepaid"),r()(),f(21,a1,2,1,"div",7),a(22,"div",8)(23,"div",1),l(24,"Total"),r(),a(25,"div",6),l(26),u(27,"number"),r(),a(28,"div",1),l(29,"\xA0"),r(),a(30,"div",1),l(31),r(),a(32,"div",1),l(33),r()(),f(34,c1,2,0,"div",7)),t&2&&(o(21),s("ngIf",n.parent.receipts.length>0),o(5),I(F(27,5,n.total(),"1.2-2")),o(5),I(n.totalCredit),o(2),I(n.totalDebit),o(),s("ngIf",n.parent.receipts.length==0))},dependencies:[T,M,me],styles:[".row[_ngcontent-%COMP%]   .col[_ngcontent-%COMP%]{display:inline-block}.row[_ngcontent-%COMP%]{border-bottom:solid 1px #DDD}.col[_ngcontent-%COMP%]{padding:5px}.col[_ngcontent-%COMP%]:nth-child(1){width:200px;border-left:solid 0px!important}.col[_ngcontent-%COMP%]:nth-child(2){width:100px}.col[_ngcontent-%COMP%]:nth-child(3){width:200px}.col[_ngcontent-%COMP%]:nth-child(4){width:150px}.col[_ngcontent-%COMP%]:nth-child(5){width:150px}div[_ngcontent-%COMP%]   .col[_ngcontent-%COMP%]:last-child{border-right:solid 1px #DDD}.col[_ngcontent-%COMP%]{text-align:center}.ecorow[_ngcontent-%COMP%]   .col[_ngcontent-%COMP%]{height:15px;vertical-align:top;line-height:15px}.amount[_ngcontent-%COMP%]{border-right:solid 1px #DDD}"]})}return i})();function l1(i,p){if(i&1&&(a(0,"div",1)(1,"div"),l(2),u(3,"number"),r(),a(4,"div"),l(5),u(6,"number"),r(),a(7,"div"),l(8),u(9,"number"),r()()),i&2){let e=d();o(2),m(" Total in account: ",v(3,3,e.parent.accountoverview.sumIncTax)," "),o(3),m(" - receipts ",v(6,5,e.parent.receiptsComponent.total())," "),o(3),m(" = Remaining ",v(9,7,e.parent.accountoverview.sumIncTax-e.parent.receiptsComponent.total())," (unbilled) ")}}var Yr=(()=>{class i{parent;constructor(e){this.parent=e}static \u0275fac=function(t){return new(t||i)(h(Nt))};static \u0275cmp=w({type:i,selectors:[["app-account-trace-summary"]],decls:1,vars:1,consts:[["class","content",4,"ngIf"],[1,"content"]],template:function(t,n){t&1&&f(0,l1,10,9,"div",0),t&2&&s("ngIf",n.parent.receiptsComponent&&n.parent.accountoverview)},dependencies:[M,me],styles:[".content[_ngcontent-%COMP%]{padding:20px}"]})}return i})();function s1(i,p){if(i&1){let e=S();a(0,"div")(1,"mat-checkbox",4),C("change",function(n){let c=y(e).$implicit,g=d(2);return b(g.update(n.checked,c))}),l(2),r()()}if(i&2){let e=p.$implicit,t=d(2);o(),s("checked",t.rentalObjectIds&&t.rentalObjectIds.indexOf(e.id)>-1),o(),m(" ",e.name," ")}}function p1(i,p){if(i&1&&(a(0,"div")(1,"div"),l(2),r(),a(3,"div"),f(4,s1,3,2,"div",0),r()()),i&2){let e=p.$implicit;o(2),m(" ",e.defaultName," "),o(2),s("ngForOf",e.rentalObjects)}}var Jx=(()=>{class i{productController;dialogRef;products;rentalObjectIds=[];constructor(e,t){this.productController=e,this.dialogRef=t,this.productController.getProductsByType("hotel").subscribe(n=>{this.products=n})}update(e,t){this.rentalObjectIds=this.rentalObjectIds.filter(n=>n!=t.id),e&&this.rentalObjectIds.push(t.id)}save(){this.dialogRef.close(this.rentalObjectIds)}static \u0275fac=function(t){return new(t||i)(h(ke),h(te))};static \u0275cmp=w({type:i,selectors:[["app-rental-object-picker-dialog"]],decls:9,vars:7,consts:[[4,"ngFor","ngForOf"],["align","end"],["mat-button","","mat-dialog-close",""],["mat-button","","cdkFocusInitial","",3,"click"],[3,"change","checked"]],template:function(t,n){t&1&&(a(0,"mat-dialog-content"),f(1,p1,5,2,"div",0),r(),a(2,"mat-dialog-actions",1)(3,"button",2),l(4),u(5,"translate"),r(),a(6,"button",3),C("click",function(){return n.save()}),l(7),u(8,"translate"),r()()),t&2&&(o(),s("ngForOf",n.products),o(3),m("",v(5,3,"createaccountindialog.2")," "),o(3),m(" ",v(8,5,"booking.groupview.selectbooking.10"),""))},dependencies:[T,de,oe,K,Ui,O,E]})}return i})();Vn(lo);var yw=(()=>{class i{static \u0275fac=function(t){return new(t||i)};static \u0275mod=Xt({type:i});static \u0275inj=Kt({providers:[{provide:xt,useValue:"nb"}],imports:[Yn.forChild(),Qo,Bn,Kn,go,qn,mo,ao,Qn,so,xo,yo,po,Co,oo,ro,Gn,$n,Un,Zn,ho,Hn,co,Wn,tr,to,eo,So]})}return i})();Ut(_i,function(){return[T,M,ze,yt,Tt,bt,O,ii,zo,Ki,Wo,Xo,Zo,nr,rr,ar,ur]},function(){return[E]});Ut(Xi,function(){return[mt,T,O,uo,fo,Yo,Jo,jr]},function(){return[E]});Ut(vi,function(){return[M,de,be,oe,K,B,H,G,Ce,U,V,ae,xe,ye,O,ir,dr,$r]},function(){return[E]});Ut(qi,function(){return[de,_i]},[]);Ut(vt,function(){return[T,M,O,fr,gr,_r,vr,Ur]},function(){return[E,ue]});Ut(di,function(){return[M,hn,Cn,Tr,Br,Hr]},function(){return[E]});Ut(Ei,function(){return[T,M,B,H,Ni,rt,at,Ot,kt,At,Ft,U,V,ae,et,xe,ye,O,ni,Qr,zr]},function(){return[E]});Ut(Nt,function(){return[M,K,hn,Cn,Kr,Xr,Yr]},[]);export{Po as a,Qi as b,gt as c,Wi as d,_i as e,pt as f,vi as g,Bo as h,Si as i,Zi as j,pi as k,Fi as l,hi as m,di as n,wt as o,Nt as p,tn as q,Di as r,fh as s,hh as t,Ph as u,vt as v,rn as w,xr as x,tC as y,Dn as z,an as A,Mr as B,pn as C,dn as D,Ar as E,Or as F,Fr as G,ui as H,Lt as I,Vr as J,Rr as K,HC as L,XC as M,tx as N,Ei as O,$x as P,Qx as Q,Jx as R,yw as S};
