PageSourceSearch

https://members.isrsy.org/9801.629bddbe93d52ccb.js

js isrsy.org collected 2026-10-02 21:08:48 UTC 79,110 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkVeryConnect=self.webpackChunkVeryConnect||[]).push([[9801],{29801:(Ct,F,s)=>{s.r(F),s.d(F,{InvoicingAdminModule:()=>Pi});var a=s(72922),b=s(60611),V=s(92194),x=s(4962),h=s(26454),E=s(50245),R=s(39705),v=s(1964),A=s(71012),M=s(97362),L=s(9812),I=s(74174),W=s(25111),U=s(58994),w=s(87638),D=s(82668),z=s(45302),m=s(5296),t=s(14026),l=s(52805),C=s(91183),Z=s(88886),K=s(23055),st=s(18103),Tt=s(69962),bt=s(87399),ut=s(92706),pt=s(41958),y=s(85597),B=s(3811),H=s(89969),_=s(91696),c=s(35673),u=s(19807),p=s(15859),T=s(67536),k=s(45339),Ut=s(43061),zt=s(59718),Xt=s(95877),mt=s(97482),Dt=s(54074),te=s(47528),ee=s(79662),ne=s(92529),X=s(70840),ie=s(37548),oe=s(92341),se=s(36635),Y=s(3981),xt=s(662),re=s(65224),le=s(69260),ae=s(25336),ce=s(87563),de=s(42809),rt=s(50725),ue=s(78275),pe=s(14289),me=s(21933),At=s(26477),Nt=s(69522),g=s(64177),gt=s(99092),_t=s(26495),G=s(3814),Zt=s(80499),tt=s(61958),O=s(64683);function ge(n,o){if(1&n&&(t.TgZ(0,"div",0,8)(2,"label",2)(3,"tg-info-bubble"),t._uU(4),t.ALo(5,"tr"),t.qZA(),t.TgZ(6,"span"),t._uU(7),t.ALo(8,"tr"),t.qZA()(),t.TgZ(9,"tg-help-block-container",3),t._UZ(10,"tg-dropdown-select",6),t.qZA()()),2&n){const e=t.MAs(1),i=t.oxw();t.Q6J("autoId",!1),t.xp6(2),t.Q6J("ngClass",i.col.left)("for",e.id),t.xp6(2),t.Oqu(t.lcZ(5,12,"recipientsTooltip")),t.xp6(3),t.hij("",t.lcZ(8,14,"recipients"),":"),t.xp6(2),t.Q6J("ngClass",i.col.right),t.xp6(1),t.Q6J("formControl",i.form.controls.recipients)("controlId",e.id)("valueKey","id")("labelKey","fullName")("multi",!0)("items",i.groupRecipients)}}const Lt=new t.OlP("Admin fetch cache");let fe=(()=>{class n{constructor(){this.col={},this.searchCriteria={},this.invoiceCfg=(0,t.f3M)(I.s),this.cache=(0,t.f3M)(Lt,{optional:!0})||new Map,this.cdr=(0,t.f3M)(t.sBO),this.grMemRes=(0,t.f3M)(me.r)}ngOnDestroy(){this._destroyed$&&(0,D.t)(this._destroyed$)}ngOnInit(){this._destroyed$=new ut.c,this.admins=this.groupRecipients=[],this.initAdminFetch(),this.initRecipients();const e=ue.y.getAllClusters().reduce((i,r)=>(r.invoicable&&i.push(r.name),i),[]);e.length&&(this.searchCriteria={cluster:e})}fetchAdmins(e){const i=this.cache.get(e);if(i)return i;const d=this.grMemRes.queryMemberships({groupId:e},{params:{populateUser:1,roles:[pe.V.MANAGER],status:"active"}}
1).pipe((0,re.V)(f=>f.user),(0,ce.K)(()=>(this.cache.delete(e),pt.E)),(0,de.d)(1));return this.cache.set(e,d),d}initAdminFetch(){(0,X.observeControlValue)(this.form.controls.group).pipe((0,_.x)((e,i)=>e?.id===i?.id),(0,B.w)(e=>e?this.fetchAdmins(e.id):(0,ae.of)([])),(0,rt.U)(e=>{const i=e.map(f=>f.id);return[e,(0,le.Z)(this.form.controls.recipients.getRawValue(),i),i.find(f=>f===this.form.controls.user.value)]}),(0,m.H)("[GroupModelSelect.adminFetch]"),(0,y.R)(this._destroyed$)).subscribe((0,xt.e)(([e,i,r])=>{this.admins=this.groupRecipients=e,this.form.patchValue({recipients:i,user:r},{emitEvent:!1}),this.cdr.markForCheck()}))}initRecipients(){this.form.controls.user.valueChanges.pipe((0,rt.U)(e=>{if(!e)return[[],[]];const i=this.form.controls.recipients.value?.filter(d=>d!==e);return[i,this.admins.filter(d=>d.id!==e)]}),(0,m.H)("[GroupModelSelect.recipientReset]"),(0,y.R)(this._destroyed$)).subscribe((0,xt.e)(([e,i])=>{this.groupRecipients=i,this.form.controls.recipients.setValue(e,{emitEvent:!1}),this.cdr.markForCheck()}))}}return n.\u0275fac=function(e){return new(e||n)},n.\u0275cmp=t.Xpm({type:n,selectors:[["tg-invoice-create-group-model-select"]],inputs:{col:"col",form:["fg","form"]},standalone:!0,features:[t.jDz],decls:15,vars:26,consts:[[1,"form-group",3,"autoId"],["idGr","id"],[3,"ngClass","for"],[3,"ngClass"],[3,"controlId","formControl","container","showGroupType","searchCriteria"],["idContact","id"],[3,"formControl","controlId","valueKey","labelKey","multi","items"],["class","form-group",3,"autoId",4,"ngIf"],["idRecipients","id"]],template:function(e,i){if(1&e&&(t.TgZ(0,"div",0,1)(2,"label",2),t._uU(3),t.ALo(4,"tr"),t.qZA(),t.TgZ(5,"tg-help-block-container",3),t._UZ(6,"tg-group-select",4),t.qZA()(),t.TgZ(7,"div",0,5)(9,"label",2),t._uU(10),t.ALo(11,"tr"),t.qZA(),t.TgZ(12,"tg-help-block-container",3),t._UZ(13,"tg-dropdown-select",6),t.qZA()(),t.YNc(14,ge,11,16,"div",7)),2&e){const r=t.MAs(1),d=t.MAs(8);t.Q6J("autoId",!1),t.xp6(2),t.Q6J("ngClass",i.col.left)("for",r.id),t.xp6(1),t.hij("* ",t.lcZ(4,22,"group"),":"),t.xp6(2),t.Q6J("ngClass",i.col.right),t.xp6(1),t.Q6J("controlId",r.id)("formControl",i.form.controls.group)("container","body")("showGroupType",i.invoiceCfg.showGroupType)("searchCriteria",i.searchCriteria),t.xp6(1),t.Q6J("autoId",!1),t.xp6(2),t.Q6J("ngClass",i.col.left)("for",d.id),t.xp6(1),t.hij("* ",t.lcZ(11,24,"contact"),":"),t.xp6(2),t.Q6J("ngClass",i.col.right),t.xp6(1),t.Q6J("formControl",i.form.controls.user)("controlId",d.id)("valueKey","id")("labelKey","fullName")("multi",!1)("items",i.admins),t.xp6(1),t.Q6J("ngIf",i.groupRecipients.length)}},dependencies:[p.GlobalModule,g.mk,g.O5,gt.X,_t.f,G.u0,G.k6,Zt._,tt.y,O.H,l.UX,l.JJ,l.oH,Nt.A,k.W,At.d],encapsulation:2,changeDetection:0}),n})();var ve=s(58847);let Qt=(()=>{class n{constructor(){this.statusMap={[v.a.DRAFT]:"draftLabel",[v.a.NOTPAID]:"notPaidLabel",[v.a.PAID]:"paidLabel",[v.a.SENT]:"sentLabel"},this.elRef=(0,t.f3M)(t.SBq),this.r2=(0,t.f3M)(t.Qsj)}ngOnInit(){const e=this.elRef.nativeElement;this.r2.addClass(e,"panel"),this.r2.addClass(e,"panel-default")}}return n.\u0275fac=function(e){return new(e||n)},n.\u0275dir=t.lG2({type:n}),n})();var ft=s(4678);function he(n,o){if(1&n&&(t.TgZ(0,"tr")(1,"td"),t._uU(2),t.ALo(3,"tr"),t.qZA(),t.TgZ(4,"td"),t._uU(5),t.ALo(6,"date"),t.qZA()()),2&n){const e=o.$implicit,i=t.oxw();t.xp6(2),t.Oqu(t.lcZ(3,2,i.statusMap[e.action])),t.xp6(3),t.Oqu(t.xi3(6,4,e.timestamp,"medium"))}}let Ie=(()=>{class n extends Qt{ngOnChanges(e){"actions"in e&&(this.orderedActions=(0,ve.Z)(this.actions,["timestamp"],["desc"]))}}return n.\u0275fac=function(){let o;return function(i){return(o||(o=t.n5z(n)))(i||n)}}(),n.\u0275cmp=t.Xpm({type:n,selectors:[["tg-invoicing-create-history-panel"]],inputs:{actions:"actions"},standalone:!0,features:[t.qOj,t.TTD,t.jDz],decls:16,vars:10,consts:[[1,"table-responsive"],[1,"table","table-condensed","table-striped","table-bordered","table-hover"],[4,"ngFor","ngForOf"]],template:function(e,i){1&e&&(t.TgZ(0,"tg-panel-heading"),t._uU(1),t.ALo(2,"tr"),t.qZA(),t.TgZ(3,"tg-panel-body")(4,"div",0)(5,"table",1)(6,"thead")(7,"tr")(8,"th"),t._uU(9),t.ALo(10,"tr"),t.qZA(),t.TgZ(11,"th"),t._uU(12),t.ALo(13,"tr"),t.qZA()()(),t.TgZ(14,"tbody"),t.YNc(15,he,7,7,"tr",2),t.qZA()()()()),2&e&&(t.xp6(1),t.Oqu(t.lcZ(2,4,"invHistoryHeading")),t.xp6(8),t.Oqu(t.lcZ(10,6,"invAction")),t.xp6(3),t.Oqu(t.lcZ(13,8,"invActionDate")),t.xp6(3),t.Q6J("ngForOf",i.orderedActions))},dependencies:[p.GlobalModule,g.sg,ft.Av,ft.Nk,g.uU,O.H],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0}),n})();var vt=s(5674),et=s(10218),j=s(50339),lt=s(61143);function Ce(n,o){if(1&n&&(t.TgZ(0,"div",2)(1,"label",3),t._uU(2),t.ALo(3,"tr"),t.qZA(),t.TgZ(4,"span",4),t._uU(5),t.qZA()()),2&n){const e=t.oxw();
1t.xp6(2),t.hij("",t.lcZ(3,2,"documentNumber"),":"),t.xp6(3),t.Oqu(e.model.document_number)}}function Te(n,o){if(1&n&&(t.TgZ(0,"div",2)(1,"label",3),t._uU(2),t.ALo(3,"tr"),t.qZA(),t.TgZ(4,"span",4),t._uU(5),t.ALo(6,"tr"),t.qZA()()),2&n){const e=t.oxw();t.xp6(2),t.hij("",t.lcZ(3,2,"status"),":"),t.xp6(3),t.Oqu(t.lcZ(6,4,e.status))}}function be(n,o){if(1&n&&(t.TgZ(0,"div",2),t._UZ(1,"label",5),t.TgZ(2,"span",4),t._UZ(3,"a",6),t.qZA()()),2&n){const e=t.oxw(2);t.xp6(1),t.Q6J("translate","xeroInvoice"),t.xp6(2),t.Q6J("href",e.invSvc.xeroUrl(e.model.xero_invoice.invoice),t.LSH)("translate","viewOnXero")}}function xe(n,o){if(1&n&&(t.YNc(0,be,4,3,"div",0),t.TgZ(1,"div",2)(2,"label",3),t._uU(3),t.ALo(4,"tr"),t.qZA(),t.TgZ(5,"span",4),t._uU(6),t.ALo(7,"tgCurrency"),t.ALo(8,"cents"),t.qZA()()),2&n){const e=t.oxw();t.Q6J("ngIf",e.xeroEnabled&&e.model.xero_invoice),t.xp6(3),t.hij("",t.lcZ(4,3,"totalAmount"),":"),t.xp6(3),t.Oqu(t.lcZ(7,5,t.lcZ(8,7,e.totalAmount)))}}const Pt=function(n){return{id:n}};function Ae(n,o){if(1&n&&(t.TgZ(0,"div",2)(1,"label",3),t._uU(2),t.ALo(3,"tr"),t.qZA(),t.TgZ(4,"div",4)(5,"a",7)(6,"span"),t._uU(7),t.qZA()()()()),2&n){const e=t.oxw();
1t.xp6(2),t.hij("",t.lcZ(3,4,"parent"),":"),t.xp6(3),t.Q6J("uiSref","admin.invoicing.one.edit")("uiParams",t.VKq(6,Pt,e.parent.id)),t.xp6(2),t.Oqu(e.parent.document_number)}}function _e(n,o){if(1&n&&(t.TgZ(0,"p")(1,"a",7),t._uU(2),t.qZA()()),2&n){const e=o.$implicit;t.xp6(1),t.Q6J("uiSref","admin.invoicing.one.edit")("uiParams",t.VKq(3,Pt,e.id)),t.xp6(1),t.Oqu(e.document_number||e.id)}}function Ze(n,o){if(1&n&&(t.TgZ(0,"div",2)(1,"label",3),t._uU(2),t.ALo(3,"tr"),t.qZA(),t.TgZ(4,"div",4),t.YNc(5,_e,3,5,"p",8),t.qZA()()),2&n){const e=t.oxw();t.xp6(2),t.hij("",t.lcZ(3,2,"children"),":"),t.xp6(3),t.Q6J("ngForOf",e.model.children)}}let ye=(()=>{class n extends Qt{constructor(){super(...arguments),this.invSvc=(0,t.f3M)(L.InvoicingService),this.xeroEnabled=(0,t.f3M)(I.Lh).xero,this.invRes=(0,t.f3M)(M.h)}ngOnChanges(e){if("model"in e){const i=this.invRes.isResponse(this.model)?this.model:this.invRes.instantiate(this.model);this.totalAmount=i.totalAmount,this.status=this.model.status&&this.statusMap[this.model.status]||void 0,this.parent=this.status?this.model.parent:void 0}this.showChildren=this.isLive&&Boolean(this.model.children?.length)}}return n.\u0275fac=function(){let o;return function(i){return(o||(o=t.n5z(n)))(i||n)}}(),n.\u0275cmp=t.Xpm({type:n,selectors:[["tg-invoicing-create-info-panel"]],inputs:{isLive:"isLive",model:"model"},standalone:!0,features:[t.qOj,t.TTD,t.jDz],decls:9,vars:8,consts:[["class","row",4,"ngIf"],[3,"ngIf"],[1,"row"],[1,"col-sm-5","col-xs-12"],[1,"col-sm-7","col-xs-12"],[1,"col-sm-5","col-xs-12",3,"translate"],["target","_blank","rel","noopener",3,"href","translate"],[3,"uiSref","uiParams"],[4,"ngFor","ngForOf"]],template:function(e,i){1&e&&(t.TgZ(0,"tg-panel-heading"),t._uU(1),t.ALo(2,"tr"),t.qZA(),t.TgZ(3,"tg-panel-body"),t.YNc(4,Ce,6,4,"div",0),t.YNc(5,Te,7,6,"div",0),t.YNc(6,xe,9,9,"ng-template",1),t.YNc(7,Ae,8,8,"div",0),t.YNc(8,Ze,6,4,"div",0),t.qZA()),2&e&&(t.xp6(1),t.Oqu(t.lcZ(2,6,"invInfoHeading")),t.xp6(3),t.Q6J("ngIf",i.model.document_number),t.xp6(1),t.Q6J("ngIf",i.status),t.xp6(1),t.Q6J("ngIf",i.isLive),t.xp6(1),t.Q6J("ngIf",i.parent),t.xp6(1),t.Q6J("ngIf",i.showChildren))},dependencies:[p.GlobalModule,g.sg,g.O5,et.P,ft.Av,ft.Nk,j.k,a.UISref,a.AnchorUISref,tt.y,O.H,lt.z,vt.Z],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0}),n})();var Me=s(83375),nt=s(62441);function Oe(n,o){if(1&n){const e=t.EpF();t.TgZ(0,"button",5),t.NdJ("click.passive",function(){t.CHM(e);const r=t.oxw();return t.KtG(r.delete.emit())}),t.qZA(),t.TgZ(1,"button",6),t.NdJ("click.passive",function(){t.CHM(e);const r=t.oxw();return t.KtG(r.submit.emit(r.InvoicingStatus.SENT))}),t.qZA()}if(2&n){const e=t.oxw();t.Q6J("translate","deleteInvoice"),t.xp6(1),t.Q6J("disabled",e.submitting)("translate","sendInvoice")}}function Je(n,o){if(1&n){const e=t.EpF();t.TgZ(0,"button",7),t.NdJ("click.passive",function(){t.CHM(e);const r=t.oxw();return t.KtG(r.submit.emit(r.InvoicingStatus.DRAFT))}),t.qZA()}if(2&n){const e=t.oxw();t.Q6J("disabled",e.submitting)("translate","saveAsDraft")}}function Ee(n,o){if(1&n){const e=t.EpF();t.TgZ(0,"button",8),t.NdJ("click.passive",function(){t.CHM(e);const r=t.oxw();return t.KtG(r.creditNote.emit())}),t.qZA()}2&n&&t.Q6J("translate","issueCreditNote")}function Se(n,o){if(1&n&&t._UZ(0,"a",9),2&n){const e=t.oxw();t.Q6J("href",e.pdfLink,t.LSH)("translate",e.invoice.status===e.InvoicingStatus.DRAFT?"preview":"view")}}function Ue(n,o){if(1&n){const e=t.EpF();t.TgZ(0,"button",10),t.NdJ("click.passive",function(){t.CHM(e);const r=t.oxw();return t.KtG(r.submit.emit())}),t.qZA()}if(2&n){const e=t.oxw();t.Q6J("translate","save")("tr-namespace","common")("disabled",e.submitting)}}function De(n,o){if(1&n){const e=t.EpF();t.TgZ(0,"button",11),t.NdJ("click.passive",function(){t.CHM(e);const r=t.oxw();return t.KtG(r.submit.emit(r.InvoicingStatus.PAID))}),t.qZA(),t.TgZ(1,"button",12),t.NdJ("click.passive",function(){t.CHM(e);const r=t.oxw();return t.KtG(r.submit.emit(r.InvoicingStatus.NOTPAID))}),t.qZA()}if(2&n){const e=t.oxw();t.Q6J("translate","markAsPaid")("disabled",e.submitting),t.xp6(1),t.Q6J("translate","markAsNotPaid")("disabled",e.submitting)}}let Ne=(()=>{class n{constructor(){this.InvoicingStatus=v.a,this.creditNote=new t.vpe,this.delete=new t.vpe,this.submit=new t.vpe,this.intCfg=(0,t.f3M)(I.Lh),this.invSvc=(0,t.f3M)(L.InvoicingService)}ngOnChanges(e){if(!("invoice"in e))return;const{id:i,document_number:r,status:d,type:f}=this.invoice;this.showPayButtons=!(d!==v.a.SENT||this.intCfg.xero&&this.invSvc.canManageOnXero(this.invoice)),this.showIssueCreditNote=!(d!==v.a.SENT&&d!==v.a.PAID||f!==A.d.INVOICE&&f!==A.d.DEBIT_NOTE),d&&(this.pdfLink=`/api/v1/invoicing/${i}/invoice?format=pdf&filename=${r||"invoice"}`)}ngOnDestroy(){(0,Me.completeAll)(this.submit,this.creditNote,this.delete)}}return n.\u0275fac=function(e){return new(e||n)},n.\u0275cmp=t.Xpm({type:n,selectors:[["tg-invoice-edit-actions"]],inputs:{formValid:"formValid",
1invoice:"invoice",submitting:"submitting"},outputs:{creditNote:"creditNote",delete:"delete",submit:"submit"},standalone:!0,features:[t.TTD,t.jDz],decls:6,vars:6,consts:[[3,"ngIf"],["class","btn btn-primary",3,"disabled","translate","click.passive",4,"ngIf"],["class","btn btn-warning",3,"translate","click.passive",4,"ngIf"],["class","btn btn-default","target","_blank",3,"href","translate",4,"ngIf"],["class","btn btn-primary",3,"translate","tr-namespace","disabled","click.passive",4,"ngIf"],[1,"btn","btn-danger",3,"translate","click.passive"],[1,"btn","btn-success",3,"disabled","translate","click.passive"],[1,"btn","btn-primary",3,"disabled","translate","click.passive"],[1,"btn","btn-warning",3,"translate","click.passive"],["target","_blank",1,"btn","btn-default",3,"href","translate"],[1,"btn","btn-primary",3,"translate","tr-namespace","disabled","click.passive"],[1,"btn","btn-success",3,"translate","disabled","click.passive"],[1,"btn","btn-primary",3,"translate","disabled","click.passive"]],template:function(e,i){1&e&&(t.YNc(0,Oe,2,3,"ng-template",0),t.YNc(1,Je,1,2,"button",1),t.YNc(2,Ee,1,1,"button",2),t.YNc(3,Se,1,2,"a",3),t.YNc(4,Ue,1,3,"button",4),t.YNc(5,De,2,4,"ng-template",0)),2&e&&(t.Q6J("ngIf",i.invoice.status===i.InvoicingStatus.DRAFT),t.xp6(1),t.Q6J("ngIf",!i.invoice.status||i.invoice.status===i.InvoicingStatus.DRAFT),t.xp6(1),t.Q6J("ngIf",i.showIssueCreditNote),t.xp6(1),t.Q6J("ngIf",i.invoice.status),t.xp6(1),t.Q6J("ngIf",i.invoice.status&&i.invoice.status!==i.InvoicingStatus.DRAFT),t.xp6(1),t.Q6J("ngIf",i.showPayButtons))},dependencies:[p.GlobalModule,g.O5,et.P,nt.h,j.k],styles:["[_nghost-%COMP%]{display:block}@media (max-width:991px){.btn[_ngcontent-%COMP%]{margin:var(--tg-space-1) 0;width:100%}}@media (min-width:992px){.btn[_ngcontent-%COMP%]{margin:0 var(--tg-space-1)}[_nghost-%COMP%]{float:right}}"],changeDetection:0}),n})();var yt=s(76538),Le=s(94e3),Qe=s(34070),Ft=s(92362);let Pe=(()=>{class n extends Ft.k{constructor(){super(...arguments),this.col={}}normaliseWriteValue(e){const{country:i,number:r}=e||{};return(0,yt.Z)({country:i,number:r},Boolean)}onFieldChange(e,i){const r=(0,yt.Z)({...this.value,[e]:i},Boolean);this.onChange((0,Le.Z)(r)?null:r)}}return n.\u0275fac=function(){let o;return function(i){return(o||(o=t.n5z(n)))(i||n)}}(),n.\u0275cmp=t.Xpm({type:n,selectors:[["tg-invoicing-edit-vat"]],hostVars:2,hostBindings:function(e,i){2&e&&t.ekj("tg-input-error-boundary",!0)},inputs:{col:"col"},standalone:!0,features:[t._Bn([{multi:!0,provide:l.JU,useExisting:(0,t.Gpc)(()=>n)}]),t.qOj,t.jDz],decls:14,vars:22,consts:[[1,"form-group",3,"autoId"],["vatNumberID","id"],[3,"ngClass","for"],[3,"ngClass"],[1,"form-control",3,"id","ngModel","ngModelOptions","disabled","ngModelChange"],["vatCountryID","id"],[3,"controlId","ngModel","ngModelOptions","disabled","ngModelChange"]],template:function(e,i){if(1&e&&(t.TgZ(0,"div",0,1)(2,"label",2),t._uU(3),t.ALo(4,"tr"),t.qZA(),t.TgZ(5,"div",3)(6,"input",4),t.NdJ("ngModelChange",function(d){return i.onFieldChange("number",d)}),t.qZA()()(),t.TgZ(7,"div",0,5)(9,"label",2),t._uU(10),t.ALo(11,"tr"),t.qZA(),t.TgZ(12,"div",3)(13,"tg-country-input",6),t.NdJ("ngModelChange",function(d){return i.onFieldChange("country",d)}),t.qZA()()()),2&e){const r=t.MAs(1),d=t.MAs(8);t.Q6J("autoId",!1),t.xp6(2),t.Q6J("ngClass",i.col.left)("for",r.id),t.xp6(1),t.hij("",t.lcZ(4,18,"vatNumber"),":"),t.xp6(2),t.Q6J("ngClass",i.col.right),t.xp6(1),t.Q6J("id",r.id)("ngModel",null==i.value?null:i.value.number)("ngModelOptions",i.MODEL_OPTS)("disabled",i.disabled),t.xp6(1),t.Q6J("autoId",!1),t.xp6(2),t.Q6J("ngClass",i.col.left)("for",d.id),t.xp6(1),t.hij("",t.lcZ(11,20,"vatCountry"),":"),t.xp6(2),t.Q6J("ngClass",i.col.right),t.xp6(1),t.Q6J("controlId",d.id)("ngModel",null==i.value?null:i.value.country)("ngModelOptions",i.MODEL_OPTS)("disabled",i.disabled)}},dependencies:[p.GlobalModule,g.mk,gt.X,G.u0,G.k6,tt.y,O.H,l.u5,l.Fj,l.JJ,l.On,Qe.I],encapsulation:2,changeDetection:0}),n})();var Vt=s(33606),q=s(74831),Rt=s(78124),Fe=s(28674),wt=s(76473),Ve=s(60057);function Re(n,o){if(1&n&&(t.TgZ(0,"div")(1,"span"),t._uU(2),t.ALo(3,"tr"),t.qZA(),t.TgZ(4,"span"),t._uU(5),t.ALo(6,"tgCurrency"),t.ALo(7,"cents"),t.qZA()()),2&n){const e=o.label,i=o.amt;t.xp6(2),t.hij("",t.lcZ(3,2,e),":"),t.xp6(3),t.Oqu(t.lcZ(6,4,t.lcZ(7,6,i)))}}const we=function(n){return{label:"selectVat",amt:n}
1},Be=function(n){return{label:"gross",amt:n}};function ke(n,o){if(1&n&&t.GkF(0,2)(1,2),2&n){const e=t.oxw(),i=t.MAs(1);t.Q6J("ngTemplateOutlet",i)("ngTemplateOutletContext",t.VKq(4,we,e.computedVat)),t.xp6(1),t.Q6J("ngTemplateOutlet",i)("ngTemplateOutletContext",t.VKq(6,Be,e.computedGross))}}const Ye=function(n){return{label:"net",amt:n}};let Ge=(()=>{class n{ngOnChanges(){const e=this.qty??0;if(this.computedNet=e*(this.amount??0),this.showVat){const i=this.vatAmt??0;this.computedVat="rate"===this.vatKind?this.computedNet*i/100:i*e,this.computedGross=this.computedNet+this.computedVat}else this.computedGross=this.computedNet}}return n.\u0275fac=function(e){return new(e||n)},n.\u0275cmp=t.Xpm({type:n,selectors:[["tg-line-item-computed-tooltip"]],inputs:{amount:"amount",qty:"qty",showVat:"showVat",vatAmt:"vatAmt",vatKind:"vatKind"},standalone:!0,features:[t.TTD,t.jDz],decls:5,vars:5,consts:[["tr",""],[1,"d-tbl"],[3,"ngTemplateOutlet","ngTemplateOutletContext"],[3,"ngIf"]],template:function(e,i){if(1&e&&(t.YNc(0,Re,8,8,"ng-template",null,0,t.W1O),t.TgZ(2,"div",1),t.GkF(3,2),t.YNc(4,ke,2,8,"ng-template",3),t.qZA()),2&e){const r=t.MAs(1);t.xp6(3),t.Q6J("ngTemplateOutlet",r)("ngTemplateOutletContext",t.VKq(3,Ye,i.computedNet)),t.xp6(1),t.Q6J("ngIf",i.showVat)}},dependencies:[g.ez,g.O5,g.tP,Ve.a,O.H,lt.z,vt.Z],styles:[".d-tbl[_ngcontent-%COMP%]{display:table}.d-tbl[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{display:table-row}.d-tbl[_ngcontent-%COMP%] > *[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{display:table-cell;padding:3px}.d-tbl.lastwidth[_ngcontent-%COMP%] > *[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:last-child, .d-tbl[_ngcontent-%COMP%] > .lastwidth[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:last-child{width:100%}"],changeDetection:0}),n})();var it=s(85868),qe=s(7933),at=s(5830);const Ke=["tgLineItem",""];function He(n,o){1&n&&t._UZ(0,"tg-help-block",13),2&n&&t.Q6J("errors",o.ngIf)}function je(n,o){if(1&n&&(t.TgZ(0,"option",18),t._uU(1),t.qZA()),2&n){const e=o.$implicit;t.Q6J("ngValue",e[0]),t.xp6(1),t.Oqu(e[1])}}function $e(n,o){if(1&n&&t._UZ(0,"input",19),2&n){const e=t.oxw(2);t.Q6J("formControl",e.ctrlVat.controls.value),t.uIk("min",0)}}function We(n,o){if(1&n&&t._UZ(0,"input",20),2&n){const e=t.oxw(2);t.Q6J("formControl",e.ctrlVat.controls.value),t.uIk("min",0)}}function ze(n,o){if(1&n&&(t.TgZ(0,"td",14)(1,"tg-help-block-container")(2,"select",3),t.YNc(3,je,2,2,"option",15),t.qZA()()(),t.TgZ(4,"td",4)(5,"tg-help-block-container")(6,"tg-help-block-container"),t.YNc(7,$e,1,2,"ng-template",null,16,t.W1O),t.YNc(9,We,1,2,"input",17),t.qZA()()()),2&n){const e=t.MAs(8),i=t.oxw();t.xp6(2),t.Q6J("formControl",i.ctrlVat.controls.kind),t.xp6(1),t.Q6J("ngForOf",i.vatKinds),t.xp6(6),t.Q6J("ngIf",i.isRateSelected)("ngIfElse",e)}}function Xe(n,o){if(1&n&&t._UZ(0,"tg-line-item-computed-tooltip",21),2&n){const e=t.oxw();t.Q6J("amount",e.ctrl.controls.amount.value)("qty",e.ctrl.controls.quantity.value)("vatAmt",e.ctrlVat.controls.value.value)("vatKind",e.ctrlVat.controls.kind.value)("showVat",e.showVat)}}const tn=["*"];let Mt=(()=>{class n extends wt.S{constructor(){super(),this.actions$=(0,t.f3M)(Vt.eX),this.currencySym=(0,t.f3M)(lt.z).getCurrencySymbol(),this.vatKinds=[["rate","%"],["amount",this.currencySym]];const e=(0,t.f3M)(I.s),i=e.defaultSelectedVAT;this.disableVat=void 0!==i,this.defaultVatKind=i??"rate",this.showVat=e.showVAT}get isRateSelected(){return"rate"===this.ctrlVat.controls.kind.value}get vatValue(){return this.ctrlVat.controls.value.value??0}static defaultValue(e="rate"){return{amount:null,description:null,quantity:1,vat:{kind:e,value:null}}}static isValid(e){return null!=e&&e.amount>0&&Boolean(e.description)&&e.quantity>0&&(!e.vat||Bt(e.vat.rate)&&Bt(e.vat.amount))}ngOnDestroy(){super.ngOnDestroy(),this._sub?.unsubscribe()}ngOnInit(){super.ngOnInit(),this._sub=this.actions$.pipe((0,Vt.l4)("form:mark:touched:all")).subscribe(()=>{this.ctrl.markAllAsTouched(),this.cdr.detectChanges()})}normaliseWriteValue(e){if(!e)return n.defaultValue(this.defaultVatKind);let i;const r=e.vat||{};return i=r.rate?{kind:"rate",value:r.rate}:r.amount?{kind:"amount",value:r.amount}:"rate"in r?{kind:"rate",value:null}:{kind:"amount",value:null},{...n.defaultValue(this.defaultVatKind),...e,vat:i}}setDisabledState(e){super.setDisabledState(e),!e&&this.disableVat&&this.ctrlVat.disable({emitEvent:!1})}createCtrl(){return this.ctrlVat=this.fb.group({kind:this.fb.control(this.defaultVatKind,l.kI.required),value:this.fb.control(null,[l.kI.required,l.kI.min(0)])}),this.disableVat&&this.ctrlVat.disable(),this.fb.group({amount:this.fb.control(null,[l.kI.required,l.kI.min(0)]),description:this.fb.control(null,[l.kI.required]),quantity:this.fb.control(1,[l.kI.required,l.kI.min(1)]),vat:this.ctrlVat})}valueChanges(){return super.valueChanges().pipe((0,rt.U)(e=>({...e,vat:{[e.vat.kind]:e.vat.value}})))}}return n.\u0275fac=function(e){return new(e||n)},n.\u0275cmp=t.Xpm({type:n,selectors:[["tr","tgLineItem",""]],hostVars:2,hostBindings:function(e,i){2&e&&t.ekj("tg-line-item",!0)},inputs:{tgLineItem:"tgLineItem"},standalone:!0,features:[t._Bn([{multi:!0,provide:l.JU,useExisting:(0,t.Gpc)(()=>n)}]),t.qOj,t.jDz],attrs:Ke,ngContentSelectors:tn,decls:21,vars:7,consts:[[2,"min-width","60px"],["type","number","placeholder","0.00",1,"form-control",3,"formControl"],[1,"wide"],[1,"form-control",3,"formControl"],[2,"min-width","90px"],[1,"input-group"],[1,"input-group-addon"],[1,"form-control",3,"formControl","tgWholeCurrencyInput"],[3,"errors",4,"ngIf"],[3,"ngIf"],[1,"narrow","mid"],["tplComputed",""],[1,"hidden-xs","hidden-sm","fa","fa-calculator",3,"tooltip"],[3,"errors"],[2,"min-width","50px"],[3,"ngValue",4,"ngFor","ngForOf"],["tplVatAmt",""],["class","form-control","type","number","placeholder","0.00","step","0.01",3,"formControl",4,"ngIf","ngIfElse"],[3,"ngValue"],["type","number","placeholder","0.00",1,"form-control",3,"formControl","tgWholeCurrencyInput"],["type","number","placeholder","0.00","step","0.01",1,"form-control",3,"formControl"],[3,"amount","qty","vatAmt","vatKind","showVat"]],template:function(e,i){if(1&e&&(t.F$t(),t.TgZ(0,"td",0)(1,"tg-help-block-container")(2,"tg-help-block-container"),t._UZ(3,"input",1),t.qZA()()(),t.TgZ(4,"td",2)(5,"tg-help-block-container")(6,"tg-help-block-container"),t._UZ(7,"input",3),t.qZA()()(),t.TgZ(8,"td",4)(9,"tg-help-block-container")(10,"div",5),t._UZ(11,"tg-currency-symbol",6)(12,"input",7),t.qZA(),t.YNc(13,He,1,1,"tg-help-block",8),t.qZA()(),t.YNc(14,ze,10,4,"ng-template",9),t.TgZ(15,"td",10),t.YNc(16,Xe,1,5,"ng-template",null,11,t.W1O),t._UZ(18,"i",12),t.qZA(),t.TgZ(19,"td",10),t.Hsn(20),t.qZA()),2&e){const r=t.MAs(17);t.xp6(3),t.Q6J("formControl",i.ctrl.controls.quantity),t.uIk("min",0),t.xp6(4),t.Q6J("formControl",i.ctrl.controls.description),t.xp6(5),t.Q6J("formControl",i.ctrl.controls.amount),t.xp6(1),t.Q6J("ngIf",i.ctrl.controls.amount.touched&&i.ctrl.controls.amount.errors),t.xp6(1),t.Q6J("ngIf",i.showVat),t.xp6(4),t.Q6J("tooltip",r)}},dependencies:[p.GlobalModule,g.sg,g.O5,it.G,_t.f,qe._,at.K,l.UX,l.YN,l.Kr,l.Fj,l.wV,l.EJ,l.JJ,l.qQ,l.oH,Fe.WholeCurrencyInputDirective,Rt.CurrencySymbolComponent,q.z8,q.i9,Ge],encapsulation:2,changeDetection:0}),n})();function Bt(n){return null==n||n>=0}var kt=s(64762),Yt=s(78425),en=s(25989),nn=s(64262);function rn(n,o){1&n&&t._UZ(0,"th",7),2&n&&t.Q6J("translate","selectVat")}function ln(n,o){if(1&n){const e=t.EpF();t.TgZ(0,"button",11),t.NdJ("click.passive",function(){t.CHM(e);const r=t.oxw().index,d=t.oxw();return t.KtG(d.rm(r))}),t.ALo(1,"tr"),t._UZ(2,"i",12),t.qZA()}if(2&n){const e=t.oxw(2);t.Q6J("disabled",e.disabled)("tooltip",t.lcZ(1,2,"rmLineItem"))}}function an(n,o){if(1&n){const e=t.EpF();
1t.TgZ(0,"tr",8),t.NdJ("ngModelChange",function(r){const f=t.CHM(e).index,S=t.oxw();return t.KtG(S.onInnerChange(f,r))}),t.TgZ(1,"button",9),t.NdJ("click.passive",function(){const d=t.CHM(e).index,f=t.oxw();return t.KtG(f.add(d))}),t.ALo(2,"tr"),t._uU(3,"+"),t.qZA(),t.YNc(4,ln,3,4,"button",10),t.qZA()}if(2&n){const e=o.$implicit,i=t.oxw();t.Q6J("ngModel",e)("ngModelOptions",i.MODEL_OPTS)("disabled",i.disabled),t.xp6(1),t.Q6J("disabled",i.disabled)("tooltip",t.lcZ(2,6,"addLineItem")),t.xp6(3),t.Q6J("ngIf",i.showRmBtn)}}(0,s(8592).applyGlobalStyle)("invoicing-create-line-items","tg-invoicing-create-line-items{display:block}tg-invoicing-create-line-items .ml-1{margin-left:3px}tg-invoicing-create-line-items td{min-width:65px}tg-invoicing-create-line-items td.mid{vertical-align:middle!important}tg-invoicing-create-line-items td:not(.wide){max-width:80px}tg-invoicing-create-line-items th{white-space:nowrap}tg-invoicing-create-line-items .invis{visibility:hidden}tg-invoicing-create-line-items .narrow{min-width:1px;white-space:nowrap;width:1px}@media (max-width:1199px){tg-invoicing-create-line-items .tg-line-item tg-currency-symbol{display:none}}");class $ extends Ft.k{constructor(){super(),this.showRmBtn=!1,this.total=0,this.trackByIdx=en.Z,this.lineItemVref=(0,t.f3M)(nn.C);const o=(0,t.f3M)(I.s);this.defaultVat=o.defaultSelectedVAT,this.showVat=o.showVAT,this.totalI18nKey=this.showVat?"totalIncVat":"total",this.value=[]}get defaultLineItemValue(){const o=Mt.defaultValue(this.defaultVat);return o.vat={[o.vat.kind]:o.vat.value},o}add(o){if(this.disabled)return;const e=[...this.value];e.splice(o+1,0,this.defaultLineItemValue),this.onChange(e)}normaliseWriteValue(o){return o??[this.defaultLineItemValue]}onChange(o){this.showRmBtn=null!=o&&o.length>1,super.onChange(o),this.total=o.reduce(this.updateTotalReducer,0)}onInnerChange(o,e){const i=[...this.value];i[o]=e,this.onChange(i)}onValueWritten(o){this.showRmBtn=o.length>1,this.total=o.reduce(this.updateTotalReducer,0)}rm(o){if(this.disabled)return;const e=[...this.value];e.splice(o,1),this.onChange(e)}updateTotalReducer(o,e){return o+this.lineItemVref.instantiate(e).totalAmount}}$.\u0275fac=function(o){return new(o||$)},$.\u0275cmp=t.Xpm({type:$,selectors:[["tg-invoicing-create-line-items"]],standalone:!0,features:[t._Bn([{multi:!0,provide:l.JU,useExisting:(0,t.Gpc)(()=>$)}]),t.qOj,t.jDz],decls:20,vars:17,consts:[[1,"table","table-condensed","table-hover"],[3,"translate"],[1,"braced","ml-1","hidden-lg"],["colspan","2",3,"translate",4,"ngIf"],["colspan","2"],[3,"tgLineItem","ngModel","ngModelOptions","disabled","ngModelChange",4,"ngFor","ngForOf","ngForTrackBy"],[1,"text-right","show"],["colspan","2",3,"translate"],[3,"tgLineItem","ngModel","ngModelOptions","disabled","ngModelChange"],[1,"btn","btn-sm","btn-success",3,"disabled","tooltip","click.passive"],["class","btn btn-sm btn-danger ml-1",3,"disabled","tooltip","click.passive",4,"ngIf"],[1,"btn","btn-sm","btn-danger","ml-1",3,"disabled","tooltip","click.passive"],[1,"fa","fa-trash-o"]],template:function(o,e){1&o&&(t.TgZ(0,"table",0)(1,"thead")(2,"tr"),t._UZ(3,"th",1)(4,"th",1),t.TgZ(5,"th")(6,"tg-info-bubble"),t._uU(7),t.ALo(8,"tr"),t.qZA(),t._UZ(9,"span",1)(10,"tg-currency-symbol",2),t.qZA(),t.YNc(11,rn,1,1,"th",3),t._UZ(12,"th",4),t.qZA()(),t.TgZ(13,"tbody"),t.YNc(14,an,5,8,"tr",5),t.qZA()(),t.TgZ(15,"strong",6),t._uU(16),t.ALo(17,"tr"),t.ALo(18,"tgCurrency"),t.ALo(19,"cents"),t.qZA()),2&o&&(t.xp6(3),t.Q6J("translate","qty"),t.xp6(1),t.Q6J("translate","lineItemName"),t.xp6(3),t.Oqu(t.lcZ(8,9,"amountTT")),t.xp6(2),t.Q6J("translate","amount"),t.xp6(2),t.Q6J("ngIf",e.showVat),t.xp6(3),t.Q6J("ngForOf",e.value)("ngForTrackBy",e.trackByIdx),t.xp6(2),t.AsE("",t.lcZ(17,11,e.totalI18nKey),": ",t.lcZ(18,13,t.lcZ(19,15,e.total)),""))},dependencies:[p.GlobalModule,g.sg,g.O5,it.G,et.P,at.K,nt.h,O.H,lt.z,l.u5,l.JJ,l.On,q.z8,q.i9,Mt,At.d,Rt.CurrencySymbolComponent,vt.Z],encapsulation:2,changeDetection:0}),(0,kt.gn)([(0,Yt.h)()],$.prototype,"updateTotalReducer",null);var cn=s(47946),dn=s(16838),un=s(37639),pn=s(49043);function mn(n,o){if(1&n&&t._UZ(0,"tg-invoicing-create-history-panel",25),2&n){const e=t.oxw(2);t.Q6J("actions",e.invoice.actions)}}function gn(n,o){if(1&n&&(t.TgZ(0,"div",22),t._UZ(1,"tg-invoicing-create-info-panel",23),t.YNc(2,mn,1,1,"tg-invoicing-create-history-panel",24),t.qZA()),2&n){const e=t.oxw();
1t.xp6(1),t.Q6J("isLive",e.isLive)("model",e.invoice),t.xp6(1),t.Q6J("ngIf",e.showHistoryPanel)}}function fn(n,o){1&n&&t._uU(0),2&n&&t.hij("*"," ","")}function vn(n,o){if(1&n&&(t.TgZ(0,"div",6,26)(2,"label",8),t.YNc(3,fn,1,1,"ng-template",27),t.ynx(4),t._uU(5),t.ALo(6,"tr"),t.BQk(),t.qZA(),t.TgZ(7,"tg-help-block-container",9),t._UZ(8,"tg-datepicker",28),t.qZA()()),2&n){const e=t.MAs(1),i=t.oxw();t.Q6J("autoId",!1),t.xp6(2),t.Q6J("ngClass",i.col.left)("for",e.id),t.xp6(1),t.Q6J("ngIf",i.dueDateRequired),t.xp6(2),t.hij("",t.lcZ(6,9,"invDueDate"),":"),t.xp6(2),t.Q6J("ngClass",i.col.right),t.xp6(1),t.Q6J("controlId",e.id)("formControl",i.form.controls.due_date)("minDate",i.currDate)}}function hn(n,o){if(1&n&&(t.TgZ(0,"option",32),t._uU(1),t.ALo(2,"tr"),t.qZA()),2&n){const e=o.$implicit;t.Q6J("ngValue",e),t.xp6(1),t.Oqu(t.lcZ(2,2,e))}}function In(n,o){if(1&n&&(t.TgZ(0,"div",6,29)(2,"label",8),t._uU(3),t.ALo(4,"tr"),t.qZA(),t.TgZ(5,"tg-help-block-container",9)(6,"select",30),t.YNc(7,hn,3,4,"option",31),t.qZA()()()),2&n){const e=t.MAs(1),i=t.oxw();t.Q6J("autoId",!1),t.xp6(2),t.Q6J("ngClass",i.col.left)("for",e.id),t.xp6(1),t.hij("* ",t.lcZ(4,8,"selectModel"),":"),t.xp6(2),t.Q6J("ngClass",i.col.right),t.xp6(1),t.Q6J("id",e.id)("formControl",i.selectedModel),t.xp6(1),t.Q6J("ngForOf",i.allowedModels)}}function Cn(n,o){if(1&n&&t._UZ(0,"tg-invoice-create-group-model-select",33),2&n){const e=t.oxw();t.Q6J("col",e.col)("fg",e.form)}}function Tn(n,o){if(1&n&&(t.TgZ(0,"div",16)(1,"strong",9),t._uU(2),t.ALo(3,"tr"),t.qZA(),t.TgZ(4,"tg-help-block-container",9),t._UZ(5,"tg-user-select",34),t.qZA()()),2&n){const e=t.oxw();
1t.xp6(1),t.Q6J("ngClass",e.col.left),t.xp6(1),t.hij("* ",t.lcZ(3,4,"contact"),":"),t.xp6(2),t.Q6J("ngClass",e.col.right),t.xp6(1),t.Q6J("formControl",e.form.controls.user)}}const bn=function(n){return{docId:n}};function xn(n,o){if(1&n&&(t.TgZ(0,"div",16)(1,"strong",9),t._uU(2),t.ALo(3,"tr"),t.qZA(),t.TgZ(4,"div",9)(5,"a",35),t._uU(6),t.qZA()()()),2&n){const e=t.oxw();t.xp6(1),t.Q6J("ngClass",e.col.left),t.xp6(1),t.hij("",t.lcZ(3,7,"contact"),":"),t.xp6(2),t.Q6J("ngClass",e.col.right),t.xp6(1),t.Q6J("uiSref","admin.pending_members.single.view")("uiParams",t.VKq(9,bn,e.invoice.pending_member.id)),t.xp6(1),t.AsE("",e.invoice.pending_member.firstname," ",e.invoice.pending_member.lastname,"")}}function An(n,o){if(1&n&&(t.TgZ(0,"div",6,36)(2,"label",8),t._uU(3),t.ALo(4,"tr"),t.qZA(),t.TgZ(5,"tg-help-block-container",9),t._UZ(6,"input",37),t.ALo(7,"tr"),t.qZA()()),2&n){const e=t.MAs(1),i=t.oxw();t.Q6J("autoId",!1),t.xp6(2),t.Q6J("ngClass",i.col.left)("for",e.id),t.xp6(1),t.hij("",t.lcZ(4,8,"poNumber"),":"),t.xp6(2),t.Q6J("ngClass",i.col.right),t.xp6(1),t.Q6J("id",e.id)("formControl",i.form.controls.po_number)("placeholder",t.lcZ(7,10,"poNumberPlaceholder"))}}function _n(n,o){if(1&n&&t._UZ(0,"tg-invoicing-edit-vat",38),2&n){const e=t.oxw();t.Q6J("col",e.col)("formControl",e.form.controls.vat)}}function Zn(n,o){if(1&n&&t._UZ(0,"tg-wysiwyg-editor",34),2&n){const e=t.oxw();t.Q6J("formControl",e.form.controls.description)}}function yn(n,o){if(1&n&&t._UZ(0,"tg-wysiwyg-viewer",39),2&n){const e=t.oxw();t.Q6J("content",e.invoice.description)}}function Mn(n,o){1&n&&t._uU(0,"*\xa0")}function On(n,o){if(1&n&&(t.TgZ(0,"div",6,40)(2,"label",8),t.YNc(3,Mn,1,0,"ng-template",27),t.ynx(4),t._uU(5),t.BQk(),t.qZA(),t.TgZ(6,"tg-help-block-container",9),t._UZ(7,"tg-custom-fields-control",41),t.qZA()()),2&n){const e=o.$implicit,i=t.MAs(1),r=t.oxw();t.Q6J("autoId",!1),t.xp6(2),t.Q6J("ngClass",r.col.left)("for",i.id),t.xp6(1),t.Q6J("ngIf",e.required),t.xp6(2),t.Oqu(e.label),t.xp6(1),t.Q6J("ngClass",r.col.right),t.xp6(1),t.Q6J("fieldSpec",e)("fieldId",i.id)("formControl",r.formCustom.controls[r.formatCustomFieldName(e.path)])}}const N="invoicing";let Gt=(()=>{class n{constructor(){this.col={left:["col-sm-3","col-xs-12"],right:["col-sm-9","col-xs-12"]},this.filteredCustomFields=[],this.invoice=(0,t.f3M)(I.wp,{optional:!0}),this.invoiceCfg=(0,t.f3M)(I.s),this.submitting=!1,this.alert=(0,t.f3M)(u.c),this.cdr=(0,t.f3M)(t.sBO),this.customFields=(0,t.f3M)(Y.INVOICE_CREATE_CUSTOM_FIELDS),this.fb=(0,t.f3M)(l.qu),this.forceParent=(0,t.f3M)(Y.INVOICING_ADMIN_CREATE_PARENT,{optional:!0}),this.forceType=(0,t.f3M)(Y.INVOICING_ADMIN_CREATE_TYPE,{optional:!0}),this.integrationsCfg=(0,t.f3M)(I.Lh),this.invoiceSvc=(0,t.f3M)(L.InvoicingService),this.invoicingRes=(0,t.f3M)(M.h),this.routing=(0,t.f3M)(b.Z),this.store=(0,t.f3M)(C.yh),this.tgModal=(0,t.f3M)(Ut.U),this.tr=(0,t.f3M)(Dt.D),this.uRes=(0,t.f3M)(te.q)}formatCustomFieldName(e){return e.replace(/^custom\./,"")}ngOnDestroy(){this._destroyed$&&(0,D.t)(this._destroyed$)}ngOnInit(){this._destroyed$=new ut.c,this.initUiVars(),this.initForm(),this.filterCustomFields(),this.patchDisabledStates(),this.initSelectedModelListener(),this.initVatInfo(),this.form.valueChanges.pipe((0,y.R)(this._destroyed$)).subscribe(()=>{this.filterCustomFields(),this.cdr.markForCheck()})}onClickDelete(){const e=this.getTypeTranslation();this.tgModal.confirmTranslated("confirmDelete",N,{type:e}).pipe((0,B.w)(()=>this.invoicingRes.delete(this.invoice.id))).subscribe({error:()=>{this.alert.alertError({key:"errorDeleting",ns:N,placeholders:{type:e}})},next:()=>{this.alert.alertSuccess({key:"invoiceDeleted",ns:N,placeholders:{type:e}}),this.routing.go("admin.invoicing.list.draft").catch(console.error)}})}onClickIssueCreditNote(){this.routing.go("admin.invoicing.one.create",{type:A.d.CREDIT_NOTE,parent:this.invoice.id}).catch(console.error)}submit(e){if(!this.form.valid)return this.form.markAllAsTouched(),this.selectedModel.markAsTouched(),this.store.dispatch({type:"form:mark:touched:all"}),this.cdr.detectChanges(),void this.alert.alertError({key:"correctFormErrors",ns:"customForms"});this.submitting=!0,this.cdr.markForCheck();const i=this.resolveStatusMsg(e),r=this.getTypeTranslation();this.tgModal.confirmTranslated(i.confirmation,N,{type:r}).pipe((0,B.w)(()=>{const d=this.getSanitisedPayload(e);return(d.id?this.invoicingRes.save(d):this.invoicingRes.create(d)).pipe((0,H.b)({error:()=>{this.alert.alertError({key:i.error,ns:N,placeholders:{type:this.getTypeTranslation()}})},next:()=>{this.alert.alertSuccess({key:i.success,ns:N,placeholders:{type:this.getTypeTranslation()}}),this.routing.go("admin.invoicing.list.draft").catch(console.error)}}))}),(0,y.R)(this._destroyed$),(0,m.H)("[InvoicingCreateEdit.submit]")).subscribe((0,z.d)(()=>{this.submitting=!1,this.cdr.markForCheck()}))}filterCustomFields(){if(!this.customFields.length)return;const e=new Set(Object.keys(this.formCustom.controls)),i=[],r=this.form.getRawValue(),d=this.invoice?.custom||{};let f=!1;for(const S of this.customFields){const Q=this.formatCustomFieldName(S.path);if(this.invoiceSvc.isAllowedField(S,r,!0,[])){if(!e.has(Q)){const P=this.fb.control(d[Q]??S.defaultValue,S.required?l.kI.required:null);this.isLive&&P.disable(),this.formCustom.setControl(Q,P,{emitEvent:!1}),f=!0}i.push(S)}
1else e.has(Q)&&(this.formCustom.removeControl(Q,{emitEvent:!1}),f=!0)}f&&(this.formCustom.updateValueAndValidity(),this.filteredCustomFields=i)}getSanitisedPayload(e){const i=(0,K.Z)(this.form.getRawValue());if(!e&&!this.invoice?.status)throw new Error("A status must be provided on un-published invoices");return i.status=e??this.invoice.status,i.user&&(Array.isArray(i.user)?i.user.length?i.user=i.user[0].id:delete i.user:(0,st.Z)(i.user)?i.user=i.user.id:"string"!=typeof i.user&&delete i.user),i.group&&"string"!=typeof i.group&&(i.group=i.group.id),i.pending_member&&"string"!=typeof i.pending_member&&(i.pending_member=i.pending_member.id),this.forceParent?i.parent=this.forceParent.id:delete i.parent,i.id||delete i.id,i}getTypeTranslation(){const e=this.form.controls.type.value;return(e&&this.allowedTypes.find(i=>i.value===e))?.label||""}initForm(){this.dueDateRequired=this.integrationsCfg.xero,this.currDate=bt().startOf("day").toDate();const e=this.invoice||{};let i,r=e.user,d=e.recipients;e.group?(i="group",r&&(r=Z.SP.extractId(r)),d&&(d=d.map(Z.SP.extractId,Z.SP))):r?(i="user",r=this.uRes.instantiate(r)):e.pending_member?i="pending_member":this.invoiceCfg.defaultSelectedModel&&(i=this.invoiceCfg.defaultSelectedModel);const f=this.selectedModel=this.fb.control(i||null,l.kI.required),S=this.fb.control(e.group,P=>"group"===f.value?l.kI.required(P):null),Q=this.fb.control(r,P=>"pending_member"===f.value?null:l.kI.required(P));this.formCustom=this.fb.group({});const dt=e.line_items||[{amount:null,description:null,quantity:1}];this.form=this.fb.group({children:this.fb.control(e.children),custom:this.formCustom,description:this.fb.control(e.description),document_number:this.fb.control(e.document_number),due_date:this.fb.control(e.due_date,this.dueDateRequired?l.kI.required:null),group:S,id:this.fb.control(e.id),line_items:this.fb.control(dt,[ie.isNotEmptyValidator,({value:P})=>Array.isArray(P)&&P.every(Mt.isValid)?null:{inner:!0}]),parent:this.fb.control(e.parent?Z.SP.extractId(e.parent):null),pending_member:this.fb.control(e.pending_member),po_number:this.fb.control(e.po_number),recipients:this.fb.control(d||[]),status:this.fb.control(e.status),type:this.fb.control(this.forceType||e.type,l.kI.required),user:Q,vat:this.fb.control(e.vat),xero_invoice:this.fb.control(e.xero_invoice)})}initSelectedModelListener(){this.isLive||this.invoiceCfg.defaultSelectedModel||(0,X.observeControlValue)(this.selectedModel).pipe((0,_.x)(),(0,c.T)(1),(0,y.R)(this._destroyed$)).subscribe(()=>{this.form.patchValue({group:void 0,pending_member:void 0,recipients:void 0,user:void 0},{emitEvent:!1}),this.filterCustomFields(),this.cdr.markForCheck()})}initUiVars(){if(this.trackByPath=(0,ee.createTrackFn)("path"),this.invoice){const i=["col-xs-12"];this.colLineItem={left:i,right:i}}else this.colLineItem=this.col;const e=this.invoice;this.allowedTypes=[{label:this.tr.translate("invoiceLabel",N),value:A.d.INVOICE},{label:this.tr.translate("creditNoteLabel",N),value:A.d.CREDIT_NOTE},{label:this.tr.translate("debitNoteLabel",N),value:A.d.DEBIT_NOTE}],this.allowedModels=["user","group"],e?(this.isCreateMode=!e.id,this.isLive=null!=e.status&&e.status!==v.a.DRAFT,this.showHistoryPanel=Boolean(e.actions?.length),e.pending_member&&e.status!==v.a.DRAFT&&this.allowedModels.push("pending_member")):(this.isCreateMode=!0,this.isLive=this.showHistoryPanel=!1),this.showDueDate=this.invoiceCfg.showDueDate&&(!this.isLive||Boolean(e?.due_date))}initVatInfo(){const{user:e,group:i}=this.form.controls;(0,X.observeControlValue)(this.selectedModel).pipe((0,B.w)(r=>"user"===r?(0,X.observeControlValue)(e):"group"===r?(0,X.observeControlValue)(i):pt.E),(0,_.x)((r,d)=>r?.id===d?.id),(0,m.H)("[InvoiceCreate.vatMonitor]")).subscribe(r=>{!function Jn(n){if(null==n)return!0;const o=Object.values(n);return!o.length||o.every(ne.isFalsy)}(r?.vat)&&!(0,Tt.Z)(r.vat,this.form.controls.vat.value)&&(this.form.controls.vat.setValue(r.vat),this.cdr.markForCheck())})}patchDisabledStates(){const e=this.form.controls,i=this.isLive;ht(e.type,i||Boolean(this.forceType)),ht(this.selectedModel,i),ht(this.formCustom,i);const r=["description","due_date","group","recipients","line_items","user","vat"];for(const d of r)ht(e[d],i)}resolveStatusMsg(e){switch(e){case v.a.DRAFT:return{confirmation:"confirmSaveAsDraft",error:"errorSavingAsDraft",success:"invoiceSavedDraft"};case v.a.PAID:return{confirmation:"confirmMarkAsPaid",error:"errorMarkAsPaid",success:"invoiceMarkedAsPaid"};case v.a.SENT:return{confirmation:"confirmSend",error:"errorSending",success:"invoiceSent"};case void 0:return{confirmation:"confirmSave",error:"errorSaving",success:"invoiceSaved"};default:return{confirmation:"confirmationDefault",error:"errorDefault",success:"successDefault"}}}}return n.\u0275fac=function(e){return new(e||n)},n.\u0275cmp=t.Xpm({type:n,selectors:[["tg-invoicing-create-edit"]],standalone:!0,features:[t._Bn([],[{provide:mt.z,useValue:N},{provide:Lt,useFactory:()=>new Map}]),t.jDz],decls:36,vars:42,consts:[[1,"page-header"],[3,"translate"],[1,"row"],["class","col-xs-12 col-sm-5 pull-right",4,"ngIf"],[1,"col-xs-12"],[1,"form-horizontal",3,"formGroup"],[1,"form-group",3,"autoId"],["idTypes","id"],[3,"ngClass","for"],[3,"ngClass"],[3,"controlId","formControl","multi","items"],["class","form-group",3,"autoId",4,"ngIf"],[3,"ngSwitch"],[3,"col","fg",4,"ngSwitchCase"],["class","form-group",4,"ngSwitchCase"],[3,"col","formControl",4,"ngIf"],[1,"form-group"],[3,"ngClass","formControl"],["tplDescEditMode",""],[3,"content",4,"ngIf","ngIfElse"],["class","form-group",3,"autoId",4,"ngFor","ngForOf","ngForTrackBy"],[3,"invoice","formValid","submitting","creditNote","delete","submit"],[1,"col-xs-12","col-sm-5","pull-right"],[3,"isLive","model"],[3,"actions",4,"ngIf"],[3,"actions"],["idDue","id"],[3,"ngIf"],[3,"controlId","formControl","minDate"],["idModel","id"],[1,"form-control",3,"id","formControl"],[3,"ngValue",4,"ngFor","ngForOf"],[3,"ngValue"],[3,"col","fg"],[3,"formControl"],[3,"uiSref","uiParams"],["idPoNum","id"],[1,"form-control",3,"id","formControl","placeholder"],[3,"col","formControl"],[3,"content"],["idCtrl","id"],[3,"fieldSpec","fieldId","formControl"]],template:function(e,i){if(1&e&&(t.TgZ(0,"header",0),t._UZ(1,"h1",1),t.qZA(),t.TgZ(2,"div",2),t.YNc(3,gn,3,3,"div",3),t.TgZ(4,"div",4)(5,"form",5)(6,"div",6,7)(8,"label",8),t._uU(9),t.ALo(10,"tr"),t.qZA(),t.TgZ(11,"tg-help-block-container",9),t._UZ(12,"tg-dropdown-select",10),t.qZA()(),t.YNc(13,vn,9,11,"div",11),t.YNc(14,In,8,10,"div",11),t.ynx(15,12),t.YNc(16,Cn,1,2,"tg-invoice-create-group-model-select",13),t.YNc(17,Tn,6,6,"div",14),t.YNc(18,xn,7,11,"div",14),t.BQk(),t.YNc(19,An,8,12,"div",11),t.YNc(20,_n,1,2,"tg-invoicing-edit-vat",15),t.TgZ(21,"div",16)(22,"strong",9),t._uU(23),t.ALo(24,"tr"),t.qZA(),t._UZ(25,"tg-invoicing-create-line-items",17),t.qZA(),t.TgZ(26,"div",16)(27,"label",9),t._uU(28),t.ALo(29,"tr"),t.qZA(),t.TgZ(30,"div",9),t.YNc(31,Zn,1,1,"ng-template",null,18,t.W1O),t.YNc(33,yn,1,1,"tg-wysiwyg-viewer",19),t.qZA()(),t.YNc(34,On,8,9,"div",20),t.qZA()()(),t.TgZ(35,"tg-invoice-edit-actions",21),t.NdJ("creditNote",function(){return i.onClickIssueCreditNote()})("delete",function(){return i.onClickDelete()})("submit",function(d){return i.submit(d)}),t.qZA()),2&e){const r=t.MAs(7),d=t.MAs(32);t.xp6(1),t.Q6J("translate",i.isCreateMode?"createInvoice":"editInvoice"),t.xp6(2),t.Q6J("ngIf",!i.isCreateMode),t.xp6(1),t.ekj("col-sm-7",!i.isCreateMode),t.xp6(1),t.Q6J("formGroup",i.form),t.xp6(1),t.Q6J("autoId",!1),t.xp6(2),t.Q6J("ngClass",i.col.left)("for",r.id),t.xp6(1),t.hij("* ",t.lcZ(10,36,"type"),":"),t.xp6(2),t.Q6J("ngClass",i.col.right),t.xp6(1),t.Q6J("controlId",r.id)("formControl",i.form.controls.type)("multi",!1)("items",i.allowedTypes),t.xp6(1),t.Q6J("ngIf",i.showDueDate),t.xp6(1),t.Q6J("ngIf",!i.invoiceCfg.defaultSelectedModel),t.xp6(1),t.Q6J("ngSwitch",i.selectedModel.value),t.xp6(1),t.Q6J("ngSwitchCase","group"),t.xp6(1),t.Q6J("ngSwitchCase","user"),t.xp6(1),t.Q6J("ngSwitchCase","pending_member"),t.xp6(1),t.Q6J("ngIf",i.invoiceCfg.poNumber),t.xp6(1),t.Q6J("ngIf",i.invoiceCfg.showVAT),t.xp6(2),t.Q6J("ngClass",i.colLineItem.left),t.xp6(1),t.hij("",t.lcZ(24,38,"lineItems"),":"),t.xp6(2),t.Q6J("ngClass",i.colLineItem.right)("formControl",i.form.controls.line_items),t.xp6(2),t.Q6J("ngClass",i.col.left),t.xp6(1),t.hij("",t.lcZ(29,40,"desc"),":"),t.xp6(2),t.Q6J("ngClass",i.col.right),t.xp6(3),t.Q6J("ngIf",i.isLive)("ngIfElse",d),t.xp6(1),t.Q6J("ngForOf",i.filteredCustomFields)("ngForTrackBy",i.trackByPath),t.xp6(1),t.Q6J("invoice",i.invoice||i.form.value)("formValid",
1i.form.valid)("submitting",i.submitting)}},dependencies:[p.GlobalModule,g.mk,g.sg,g.O5,g.RF,g.n9,gt.X,et.P,_t.f,G.u0,G.k6,j.k,a.UISref,a.AnchorUISref,Zt._,tt.y,O.H,l.UX,l._Y,l.YN,l.Kr,l.Fj,l.EJ,l.JJ,l.JL,l.oH,l.sg,l.u5,zt.f,cn.X,dn.s,Ne,fe,$,ye,Ie,Pe,oe.Z,se.n,k.W,T.B,un.e,Xt.Q,pn.U],encapsulation:2,changeDetection:0}),n})();function ht(n,o){const e={emitEvent:!1};o?n.disable(e):n.enable(e)}var En=s(15420),qt=s(78611),Ot=s(90237);function Sn(n,o){1&n&&(t.TgZ(0,"span",10),t._uU(1),t.ALo(2,"tr"),t.qZA()),2&n&&(t.Udp("margin-left","5px"),t.xp6(1),t.Oqu(t.lcZ(2,3,"invSelectFile")))}function Un(n,o){1&n&&(t.TgZ(0,"div",11),t._UZ(1,"tg-loader-spinner",12),t.qZA())}const Jt="invoicing";let Dn=(()=>{class n{constructor(e){this.alert=e,this.event={method:"POST",type:"uploadFile",url:"/api/v1/invoicing/import",withCredentials:!0},this.files=[],this.uploadInput=new t.vpe,this.uploading=!1}ngOnDestroy(){this.uploadInput.complete()}onUploadOutput(e){switch(e.type){case"addedToQueue":typeof e.file<"u"&&(this.event.file=e.file);break;case"uploading":this.uploading=!0;break;case"done":this.uploading=!1,200===(0,En.Z)(e,"file.responseStatus")?this.alert.alertSuccess({key:"invSuccessImporting",ns:Jt}):this.alert.alertError({key:"invErrorImporting",ns:Jt}),this.uploadInput.emit({type:"removeAll"});break;case"removedAll":this.event.file=void 0}}resetFiles(e){e.value=null}startUpload(){this.uploadInput.emit(this.event)}}return n.\u0275fac=function(e){return new(e||n)(t.Y36(u.c))},n.\u0275cmp=t.Xpm({type:n,selectors:[["tg-invoicing-import"]],standalone:!0,features:[t._Bn([],[{provide:mt.z,useValue:Jt}]),t.jDz],decls:19,vars:14,consts:[[1,"panel","panel-default"],[1,"panel-heading"],[1,"panel-title"],[1,"panel-body"],[1,"col-xs-12"],["type","file","ngFileSelect","",3,"accept","uploadInput","click","uploadOutput"],["fileInput",""],["class","text-danger",3,"marginLeft",4,"ngIf"],["class","col-xs-12 text-center",4,"ngIf"],[1,"btn","btn-primary","pull-right",3,"disabled","click"],[1,"text-danger"],[1,"col-xs-12","text-center"],[1,"loading"]],template:function(e,i){if(1&e){const r=t.EpF();t.TgZ(0,"div",0)(1,"div",1)(2,"h3",2)(3,"span"),t._uU(4),t.ALo(5,"tr"),t.qZA()()(),t.TgZ(6,"div",3)(7,"div",4)(8,"label"),t._uU(9),t.ALo(10,"tr"),t.qZA(),t.TgZ(11,"input",5,6),t.NdJ("click",function(){t.CHM(r);const f=t.MAs(12);return t.KtG(i.resetFiles(f))})("uploadOutput",function(f){return i.onUploadOutput(f)}),t.qZA(),t._UZ(13,"div",4),t.YNc(14,Sn,3,5,"span",7),t.qZA(),t.YNc(15,Un,2,0,"div",8),t.TgZ(16,"button",9),t.NdJ("click",function(){return i.startUpload()}),t._uU(17),t.ALo(18,"tr"),t.qZA()()()}2&e&&(t.xp6(4),t.Oqu(t.lcZ(5,8,"invImport")),t.xp6(5),t.Oqu(t.lcZ(10,10,"invFileUpload")),t.xp6(2),t.Q6J("accept",".csv")("uploadInput",i.uploadInput),t.xp6(3),t.Q6J("ngIf",!i.event.file),t.xp6(1),t.Q6J("ngIf",i.uploading),t.xp6(1),t.Q6J("disabled",i.uploading||!i.event.file),t.xp6(1),t.Oqu(t.lcZ(18,12,"invStartUpload")))},dependencies:[p.GlobalModule,g.O5,Ot.I,nt.h,tt.y,O.H,qt.TA,qt.qx],encapsulation:2,changeDetection:0}),n})();var Kt=s(10174),Nn=s(95004),Ln=s(37573),Qn=s(10067),Pn=s(48921),Fn=s(19259),Et=s(92191),Vn=s(70460),Rn=s(89430),wn=s(35951),Ht=s(49389),Bn=s(85960),kn=s(51248),Yn=s(3999),Gn=s(56625);const qn=["tgInvoiceDupe",""];function Kn(n,o){1&n&&t._UZ(0,"i",2)}function Hn(n,o){1&n&&t._UZ(0,"tg-loader-spinner")}let jn=(()=>{class n{constructor(){this.busy=!1,this.duplicated=new t.vpe,this.alert=(0,t.f3M)(u.c),this.cdr=(0,t.f3M)(t.sBO),this.invRes=(0,t.f3M)(M.h)}ngOnDestroy(){this.duplicated.complete()}onClick(){this.busy||!this.invoiceId||(this.busy=!0,this.invRes.duplicate({id:this.invoiceId}).pipe((0,y.R)(this.duplicated.pipe((0,Gn.Z)(null,null))),(0,m.H)("[InvoiceDupeBtn.onClick]"),(0,H.b)({error:this.alert.negotiate,next:e=>{this.alert.alertSuccess({key:"invDuplicateOk",ns:"invoicing"}),this.duplicated.emit(e)}})).subscribe((0,z.d)(()=>{this.busy=!1,this.cdr.markForCheck()})))}}return n.\u0275fac=function(e){return new(e||n)},n.\u0275cmp=t.Xpm({type:n,selectors:[["button","tgInvoiceDupe",""]],hostVars:1,hostBindings:function(e,i){1&e&&t.NdJ("click.passive",function(){return i.onClick()}),2&e&&t.Ikx("disabled",i.busy)},inputs:{invoiceId:["tgInvoiceDupe","invoiceId"]},outputs:{duplicated:"duplicated"},standalone:!0,features:[t.jDz],attrs:qn,decls:3,vars:2,consts:[["tplIdle",""],[4,"ngIf","ngIfElse"],[1,"fa","fa-files-o","fa-fw"]],template:function(e,i){if(1&e&&(t.YNc(0,Kn,1,0,"ng-template",null,0,t.W1O),t.YNc(2,Hn,1,0,"tg-loader-spinner",1)),2&e){const r=t.MAs(1);t.xp6(2),t.Q6J("ngIf",i.busy)("ngIfElse",r)}},dependencies:[p.GlobalModule,g.O5,it.G,Ot.I],encapsulation:2,changeDetection:0}),n})(),$n=(()=>{class n{ngOnChanges(){const e=this.mem;this.srefParams={docId:e.id},this.icon=e.type===Et.PendingMemberType.GROUP?"fa-users":"fa-user",this.name=`${e.firstname} ${e.lastname}`}}return n.\u0275fac=function(e){return new(e||n)},n.\u0275cmp=t.Xpm({type:n,selectors:[["tg-invoice-list-pending-member-link"]],inputs:{mem:"mem"},standalone:!0,features:[t.TTD,t.jDz],decls:5,vars:7,consts:[[3,"uiSref","uiParams"],[1,"fa",3,"ngClass","tooltip"]],template:function(e,i){1&e&&(t.TgZ(0,"a",0),t._UZ(1,"i",1),t.ALo(2,"tr"),t.TgZ(3,"span"),t._uU(4),t.qZA()()),2&e&&(t.Q6J("uiSref","admin.pending_members.single.view")("uiParams",i.srefParams),t.xp6(1),t.Q6J("ngClass",i.icon)("tooltip",t.lcZ(2,5,"membApplicationPending")),t.xp6(3),t.Oqu(i.name))},dependencies:[p.GlobalModule,g.mk,it.G,at.K,j.k,a.UISref,a.AnchorUISref,O.H],encapsulation:2,changeDetection:0}),n})();var Wn=s(17789),zn=s(11336);function ti(n,o){if(1&n&&(t.TgZ(0,"td",1),t._uU(1),t.qZA()),2&n){const e=t.oxw();
1t.xp6(1),t.Oqu(e.invoice.document_number)}}function ei(n,o){if(1&n&&(t.TgZ(0,"td",1),t._uU(1),t.ALo(2,"date"),t.qZA()),2&n){const e=t.oxw();t.xp6(1),t.Oqu(t.xi3(2,1,e.invoice.due_date,"mediumDate"))}}function ni(n,o){if(1&n&&(t.TgZ(0,"a",14),t._uU(1),t.qZA()),2&n){const e=t.oxw(3);t.Q6J("uiSref","groups.group")("uiParams",e.uiParamsGroup),t.xp6(1),t.Oqu(e.invoice.group.name)}}function ii(n,o){if(1&n&&t.YNc(0,ni,2,3,"a",13),2&n){const e=t.oxw(2);t.Q6J("ngIf",e.invoice.group)}}function oi(n,o){if(1&n&&t._UZ(0,"tg-invoice-list-pending-member-link",15),2&n){const e=t.oxw(2);t.Q6J("mem",e.invoice.pending_member)}}function si(n,o){if(1&n&&(t.TgZ(0,"td"),t.YNc(1,ii,1,1,"ng-template",null,12,t.W1O),t.YNc(3,oi,1,1,"tg-invoice-list-pending-member-link",4),t.qZA()),2&n){const e=t.MAs(2),i=t.oxw();t.xp6(3),t.Q6J("ngIf",(null==i.invoice.pending_member?null:i.invoice.pending_member.type)===i.PendingMemberType.GROUP)("ngIfElse",e)}}function ri(n,o){if(1&n&&(t.TgZ(0,"a",14),t._uU(1),t.qZA()),2&n){const e=t.oxw(2);t.Q6J("uiSref","addressbook.profile")("uiParams",e.uiParamsUser),t.xp6(1),t.AsE("",e.invoice.user.firstname," ",e.invoice.user.lastname,"")}}function li(n,o){if(1&n&&t.YNc(0,ri,2,4,"a",13),2&n){const e=t.oxw();t.Q6J("ngIf",e.invoice.user)}}function ai(n,o){if(1&n&&t._UZ(0,"tg-invoice-list-pending-member-link",15),2&n){const e=t.oxw();t.Q6J("mem",e.invoice.pending_member)}}function ci(n,o){if(1&n&&(t.TgZ(0,"a",16),t.ALo(1,"tr"),t._UZ(2,"i",17),t.qZA()),2&n){const e=t.oxw();t.Q6J("href",e.xeroUrl,t.LSH)("tooltip",t.lcZ(1,2,"viewOnXero"))}}class ot{constructor(){this.PendingMemberType=Et.PendingMemberType,this.duplicated=new t.vpe,this.invoiceSvc=(0,t.f3M)(L.InvoicingService),this.xeroEnabled=(0,t.f3M)(I.Lh).xero;const{showDueDate:o,defaultSelectedModel:e}=(0,t.f3M)(I.s);this.showDueDate=o,this.defaultModelIsGroup=!e||"group"===e}ngOnChanges(o){if(!("invoice"in o))return;const e=this.invoice;if(this.totalAmount=e.line_items.reduce(this.updateTotalReducer,0),this.xeroEnabled){const i=e.xero_invoice?.invoice;this.xeroUrl=i?this.invoiceSvc.xeroUrl(i):void 0}e.id!==this.uiParamsInvoice?.id&&(this.uiParamsInvoice={id:e.id}),e.group&&e.group.id!==this.uiParamsGroup?.groupId&&(this.uiParamsGroup={groupId:e.group.id}),e.user&&e.user.id!==this.uiParamsUser?.userId&&(this.uiParamsUser={userId:e.user.id}),this.pdfHref=this.invoiceSvc.invoiceUrl(e.id,e.document_number)}ngOnDestroy(){this.duplicated.complete()}updateTotalReducer(o,e){return o+e.totalAmount}}ot.\u0275fac=function(o){return new(o||ot)},ot.\u0275cmp=t.Xpm({type:ot,selectors:[["tr","invoiceRow",""]],inputs:{invoice:["invoiceRow","invoice"],isDraft:"isDraft"},outputs:{duplicated:"duplicated"},standalone:!0,features:[t.TTD,t.jDz],attrs:["invoiceRow",""],decls:26,vars:28,consts:[["class","text-nowrap",4,"ngIf"],[1,"text-nowrap"],[4,"ngIf"],["tplUser",""],[3,"mem",4,"ngIf","ngIfElse"],[3,"tgMomentAgo"],[1,"btn","btn-xs","btn-default",3,"uiSref","uiParams","tooltip"],[1,"fa","fa-pencil-square-o","fa-fw"],["class","btn btn-xs btn-default","target","_blank","rel","noopener",3,"href","tooltip",4,"ngIf"],["target","_blank",1,"btn","btn-xs","btn-default",3,"href","tooltip"],[1,"fa","fa-eye","fa-fw"],[1,"btn","btn-xs","btn-default",3,"tgInvoiceDupe","tooltip","duplicated"],["tplGroup",""],[3,"uiSref","uiParams",4,"ngIf"],[3,"uiSref","uiParams"],[3,"mem"],["target","_blank","rel","noopener",1,"btn","btn-xs","btn-default",3,"href","tooltip"],[1,"fa","fa-external-link","fa-fw"]],template:function(o,e){if(1&o&&(t.YNc(0,ti,2,1,"td",0),t.TgZ(1,"td",1),t._uU(2),t.ALo(3,"tr"),t.qZA(),t.TgZ(4,"td",1),t._uU(5),t.ALo(6,"tgCurrency"),t.ALo(7,"cents"),t.qZA(),t.YNc(8,ei,3,4,"td",0),t.YNc(9,si,4,2,"td",2),t.TgZ(10,"td"),t.YNc(11,li,1,1,"ng-template",null,3,t.W1O),t.YNc(13,ai,1,1,"tg-invoice-list-pending-member-link",4),t.qZA(),t.TgZ(14,"td",1),t._UZ(15,"time",5),t.qZA(),t.TgZ(16,"td")(17,"a",6),t.ALo(18,"tr"),t._UZ(19,"span",7),t.qZA(),t.YNc(20,ci,3,4,"a",8),t.TgZ(21,"a",9),t.ALo(22,"tr"),t._UZ(23,"span",10),t.qZA(),t.TgZ(24,"button",11),t.NdJ("duplicated",function(r){return e.duplicated.emit(r)}),t.ALo(25,"tr"),t.qZA()()),2&o){const i=t.MAs(12);t.Q6J("ngIf",!e.isDraft),t.xp6(2),t.Oqu(t.lcZ(3,16,e.invoice.type)),t.xp6(3),t.Oqu(t.lcZ(6,18,t.lcZ(7,20,e.totalAmount))),t.xp6(3),t.Q6J("ngIf",e.showDueDate),t.xp6(1),t.Q6J("ngIf",e.defaultModelIsGroup),t.xp6(4),t.Q6J("ngIf",(null==e.invoice.pending_member?null:e.invoice.pending_member.type)===e.PendingMemberType.INDIVIDUAL)("ngIfElse",i),t.xp6(2),t.Q6J("tgMomentAgo",e.invoice.createdAt),t.xp6(2),t.Q6J("uiSref","admin.invoicing.one.edit")("uiParams",e.uiParamsInvoice)("tooltip",t.lcZ(18,22,"invEditView")),t.xp6(3),t.Q6J("ngIf",e.xeroUrl),t.xp6(1),t.Q6J("href",e.pdfHref,t.LSH)("tooltip",t.lcZ(22,24,"invViewPdf")),t.xp6(3),t.Q6J("tgInvoiceDupe",e.invoice.id)("tooltip",t.lcZ(25,26,"invDuplicate"))}},dependencies:[p.GlobalModule,g.O5,it.G,at.K,nt.h,j.k,a.UISref,a.AnchorUISref,g.uU,O.H,lt.z,$n,Yn.b,Wn.U,zn.N,q.z8,q.i9,jn,vt.Z],styles:["a.btn[_ngcontent-%COMP%]{margin:var(--tg-space-1)}.icon[_ngcontent-%COMP%]{height:1rem;width:1rem}td[_ngcontent-%COMP%]{vertical-align:middle!important}"],changeDetection:0}),(0,kt.gn)([(0,Yt.h)()],ot.prototype,"updateTotalReducer",null);var di=s(22009),jt=s(16456),ui=s(41290),pi=s(7670),mi=s(10319),gi=s(49363),fi=s(38207);function vi(n,o){if(1&n&&(t.TgZ(0,"div",4,5)(2,"label",6)(3,"tg-info-bubble"),t._uU(4),t.ALo(5,"tr"),t.qZA(),t.TgZ(6,"span"),t._uU(7),t.ALo(8,"tr"),t.qZA()(),t.TgZ(9,"div",7),t._UZ(10,"input",8),t.ALo(11,"tr"),t.qZA()()),2&n){const e=t.MAs(1);t.Q6J("autoId",!1),t.xp6(2),t.Q6J("for",e.id),t.xp6(2),t.Oqu(t.lcZ(5,7,"documentNumberTip")),t.xp6(3),t.Oqu(t.lcZ(8,9,"documentNumber")),t.xp6(3),t.Q6J("id",e.id)("formControlName","documentNumber")("placeholder",t.lcZ(11,11,"documentNumberPlaceholder"))}}function hi(n,o){if(1&n){const e=t.EpF();t.TgZ(0,"div",9,10)(2,"label",6)(3,"tg-info-bubble"),t._uU(4),t.ALo(5,"tr"),t.qZA(),t.TgZ(6,"span"),t._uU(7),t.ALo(8,"tr"),t.qZA()(),t.TgZ(9,"div",7),t._UZ(10,"tg-dropdown-select",11),t.TgZ(11,"button",12),t.NdJ("click.passive",function(){t.CHM(e);const r=t.oxw(2);return t.KtG(r.ctrl.controls.type.reset([]))}),t.qZA()()()}if(2&n){const e=t.MAs(1),i=t.oxw(2);t.Q6J("autoId",!1),t.xp6(2),t.Q6J("for",e.id),t.xp6(2),t.Oqu(t.lcZ(5,11,"typeTip")),t.xp6(3),t.Oqu(t.lcZ(8,13,"type")),t.xp6(3),t.Q6J("formControlName","type")("controlId",e.id)("valueKey","value")("labelKey","label")("multi",!0)("items",i.types),t.xp6(1),t.Q6J("disabled",i.disabled)}}function Ii(n,o){if(1&n&&(t.TgZ(0,"div",4,13)(2,"label",6)(3,"tg-info-bubble"),t._uU(4),t.ALo(5,"tr"),t.qZA(),t.TgZ(6,"span"),t._uU(7),t.ALo(8,"tr"),t.qZA()(),t.TgZ(9,"div",7),t._UZ(10,"tg-user-id-search",14),t.qZA()()),2&n){const e=t.MAs(1);t.Q6J("autoId",!1),t.xp6(2),t.Q6J("for",e.id),t.xp6(2),t.Oqu(t.lcZ(5,6,"userTip")),t.xp6(3),t.Oqu(t.lcZ(8,8,"user")),t.xp6(3),t.Q6J("controlId",e.id)("formControlName","user")}}function Ci(n,o){if(1&n&&(t.TgZ(0,"div",9,15)(2,"label",6)(3,"tg-info-bubble"),t._uU(4),t.ALo(5,"tr"),t.qZA(),t.TgZ(6,"span"),t._uU(7),t.ALo(8,"tr"),t.qZA()(),t.TgZ(9,"div",7),t._UZ(10,"tg-group-select",16),t.qZA()()),2&n){const e=t.MAs(1);t.Q6J("autoId",!1),t.xp6(2),t.Q6J("for",e.id),t.xp6(2),t.Oqu(t.lcZ(5,8,"groupTip")),t.xp6(3),t.Oqu(t.lcZ(8,10,"group")),t.xp6(3),t.Q6J("controlId",e.id)("formControlName","group")("multi",!0)("container","body")}}function Ti(n,o){if(1&n&&(t.TgZ(0,"div",1),t.YNc(1,vi,12,13,"div",2),t.YNc(2,hi,12,15,"div",3),t.YNc(3,Ii,11,10,"div",2),t.YNc(4,Ci,11,12,"div",3),t.qZA()),2&n){const e=t.oxw();t.Q6J("formGroup",e.ctrl),t.xp6(1),t.Q6J("ngIf",e.searchConfig.fields.documentNumber),t.xp6(1),t.Q6J("ngIf",e.searchConfig.fields.type),t.xp6(1),t.Q6J("ngIf",e.searchConfig.fields.user),t.xp6(1),t.Q6J("ngIf",e.searchConfig.fields.group)}}let bi=(()=>{class n extends wt.S{constructor(e,i){super(),this.tr=e,this.invCfg=i;const r=(0,t.f3M)(I.s,{optional:!0});r&&(this.searchConfig=r.search)}ngOnInit(){super.ngOnInit();const e="invoicing";this.types=[{label:this.tr.translate("invoice",e),value:A.d.INVOICE},{label:this.tr.translate("credit_note",e),value:A.d.CREDIT_NOTE},{label:this.tr.translate("debit_note",e),value:A.d.DEBIT_NOTE}],this.initConfig()}normaliseWriteValue(e){return{...this.resetValue,...e}}createCtrl(){const e=this.fb.group({documentNumber:null,group:[],type:[],user:[]});return this.resetValue=e.getRawValue(),e}valueChanges(){const e=i=>i.id;return(0,X.observeControlValue)(this.ctrl).pipe((0,rt.U)(i=>{const r={...i};return r.user?.length&&(r.user=(0,jt.Z)(r.user.map(e))),r.group?.length&&(r.group=(0,jt.Z)(r.group.map(e))),(0,yt.Z)(r,ui.isNotEmpty)}),(0,Kt.p)(),(0,c.T)(1))}initConfig(){this.searchConfig||this.invCfg.latest("search").subscribe(e=>{this.searchConfig=e,this.cdr.markForCheck()})}}return n.\u0275fac=function(e){return new(e||n)(t.Y36(Dt.D),t.Y36(R.e))},n.\u0275cmp=t.Xpm({type:n,selectors:[["tg-invoice-search"]],hostVars:2,hostBindings:function(e,i){2&e&&t.ekj("row",!0)},features:[t._Bn([{provide:mt.z,useValue:"invoiceSearch"},{multi:!0,provide:l.JU,useExisting:(0,t.Gpc)(()=>n)}]),t.qOj],decls:1,vars:1,consts:[["class","form-horizontal",3,"formGroup",4,"ngIf"],[1,"form-horizontal",3,"formGroup"],["class","form-user-container col-sm-6 col-md-4 col-xs-12",3,"autoId",4,"ngIf"],["class","form-group-container col-sm-6 col-md-4 col-xs-12",3,"autoId",4,"ngIf"],[1,"form-user-container","col-sm-6","col-md-4","col-xs-12",3,"autoId"],["idDocumentNumber","id"],[3,"for"],[1,"flex-container"],["name","documentNumber",1,"form-control",3,"id","formControlName","placeholder"],[1,"form-group-container","col-sm-6","col-md-4","col-xs-12",3,"autoId"],["idType","id"],[1,"field-container",3,"formControlName","controlId","valueKey","labelKey","multi","items"],[1,"btn","btn-default",3,"tg-clear-button","disabled","click.passive"],["idUser","id"],[3,"controlId","formControlName"],["idGroup","id"],[1,"field-container",3,"controlId","formControlName","multi","container"]],template:function(e,i){1&e&&t.YNc(0,Ti,5,5,"div",0),2&e&&t.Q6J("ngIf",i.searchConfig)}
1,dependencies:[g.O5,gt.X,G.u0,G.k6,nt.h,Zt._,tt.y,l.Fj,l.JJ,l.JL,l.sg,l.u,At.d,gi.m,fi.k,Nt.A,O.H],styles:["[_nghost-%COMP%]{display:block}.flex-container[_ngcontent-%COMP%]{margin-bottom:1em}.form-group-container[_ngcontent-%COMP%]   .flex-container[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex-wrap:nowrap}.form-group-container[_ngcontent-%COMP%]   .field-container[_ngcontent-%COMP%]{width:100%}"],data:{animation:[pi.Y,mi.b]},changeDetection:0}),n})();var $t,xi=s(65624),Ai=s(74647);function _i(n,o){if(1&n){const e=t.EpF();t.TgZ(0,"button",8),t.NdJ("click.passive",function(){t.CHM(e);const r=t.oxw();return t.KtG(r.sendAll())}),t.ALo(1,"tr"),t._UZ(2,"span",9),t.TgZ(3,"span"),t._uU(4),t.ALo(5,"tr"),t.qZA()()}if(2&n){const e=t.oxw();t.Q6J("tooltip",t.lcZ(1,3,"invSendAllTooltip"))("disabled",e.sendAllBusy||!e.invoices.length),t.xp6(4),t.Oqu(t.lcZ(5,5,"invSendAll"))}}function Zi(n,o){if(1&n&&(t.TgZ(0,"div",10),t._UZ(1,"tg-invoice-search",11),t.qZA()),2&n){const e=t.oxw();t.xp6(1),t.Q6J("formControl",e.searchCtrl)}}function yi(n,o){1&n&&(t.TgZ(0,"div",12),t._uU(1),t.ALo(2,"tr"),t.qZA()),2&n&&(t.xp6(1),t.Oqu(t.lcZ(2,1,"invNoData")))}function Mi(n,o){1&n&&(t.TgZ(0,"th"),t._uU(1),t.ALo(2,"tr"),t.qZA()),2&n&&(t.xp6(1),t.Oqu(t.lcZ(2,1,"invDocNumber")))}function Oi(n,o){1&n&&(t.TgZ(0,"th"),t._uU(1),t.ALo(2,"tr"),t.qZA()),2&n&&(t.xp6(1),t.Oqu(t.lcZ(2,1,"invDueDate")))}function Ji(n,o){1&n&&(t.TgZ(0,"th"),t._uU(1),t.ALo(2,"tr"),t.qZA()),2&n&&(t.xp6(1),t.Oqu(t.lcZ(2,1,"invGroup")))}function Ei(n,o){if(1&n){const e=t.EpF();t.TgZ(0,"tr",18),t.NdJ("duplicated",function(r){t.CHM(e);const d=t.oxw(2);return t.KtG(d.onDuplicated(r))}),t.qZA()}if(2&n){const e=o.$implicit,i=t.oxw(2);t.Q6J("invoiceRow",e)("isDraft",i.isDraft)}}function Si(n,o){if(1&n){const e=t.EpF();t.TgZ(0,"div",13)(1,"table",14)(2,"thead")(3,"tr"),t.YNc(4,Mi,3,3,"th",15),t.TgZ(5,"th"),t._uU(6),t.ALo(7,"tr"),t.qZA(),t.TgZ(8,"th"),t._uU(9),t.ALo(10,"tr"),t.qZA(),t.YNc(11,Oi,3,3,"th",15),t.YNc(12,Ji,3,3,"th",15),t.TgZ(13,"th"),t._uU(14),t.ALo(15,"tr"),t.qZA(),t.TgZ(16,"th"),t._uU(17),t.ALo(18,"tr"),t.qZA(),t.TgZ(19,"th"),t._uU(20),t.ALo(21,"tr"),t.qZA()()(),t.TgZ(22,"tbody",16),t.NdJ("scrolled",function(){t.CHM(e);const r=t.oxw();return t.KtG(r.scroller.scrolled())}),t.YNc(23,Ei,1,2,"tr",17),t.qZA()()()}if(2&n){const e=t.oxw();
1t.xp6(4),t.Q6J("ngIf",!e.isDraft),t.xp6(2),t.Oqu(t.lcZ(7,13,"invType")),t.xp6(3),t.Oqu(t.xi3(10,15,"amount","common")),t.xp6(2),t.Q6J("ngIf",e.invoicingCfg.showDueDate),t.xp6(1),t.Q6J("ngIf",!e.invoicingCfg.defaultSelectedModel||"group"===e.invoicingCfg.defaultSelectedModel),t.xp6(2),t.Oqu(t.lcZ(15,18,"invUser")),t.xp6(3),t.Oqu(t.lcZ(18,20,"invCreatedAt")),t.xp6(3),t.Oqu(t.lcZ(21,22,"invAction")),t.xp6(2),t.Q6J("immediateCheck",!0)("scrollWindow",!0)("infiniteScrollDisabled",e.busy||e.done),t.xp6(1),t.Q6J("ngForOf",e.invoices)("ngForTrackBy",e.TRACK_BY_ID)}}function Ui(n,o){1&n&&(t.TgZ(0,"div",19),t._UZ(1,"tg-loader-spinner"),t.TgZ(2,"span"),t._uU(3),t.ALo(4,"tr"),t.qZA()()),2&n&&(t.xp6(3),t.hij(" ",t.xi3(4,1,"loading","common"),""))}const ct="invoicing",St=Symbol("subs");class J{constructor(o,e,i,r,d,f,S,Q,dt){this.cdr=o,this.routing=e,this.invoices=i,this.invoicingCfg=r,this.invoicingRes=d,this.scroller=f,this.alert=S,this.modal=Q,this.EXPORT_LINK_BASE="/api/v1/invoicing/csv",this.PendingMemberType=Et.PendingMemberType,this.TRACK_BY_ID=Bn.trackById,this._search={},this[$t]=[],this.searchCtrl=dt.control({})}onDuplicated(o){this.status===o.status&&(this.invoices.unshift(o),this.invoices=[...this.invoices],this.cdr.markForCheck())}ngOnDestroy(){(0,kn.unsubscribeFromAll)(this[St])}ngOnInit(){this.status=this.routing.current.data.status,this.isDraft=this.status===v.a.DRAFT,this.exportAllParams={status:this.status};const o={...this.exportAllParams,...J.BASE_PARAMS};this.scroller.useCursor(!0).setParams(o).setCallable(i=>this.invoicingRes.query({params:i}));let e=this.invoices;this.scroller.mirrorDoneBusy(this.cdr,this,"busy","done"),this.scroller.alertOnErrors(),this[St].push(this.searchCtrl.valueChanges.pipe((0,Qn.b)(250),(0,H.b)(()=>{e=void 0}),(0,Pn.O)(this.searchCtrl.value),(0,rt.U)(i=>i||{}),(0,Kt.p)(),(0,B.w)(i=>(this._search=i,this.exportFilteredParams=(0,Nn.Z)(i,Ln.Z),this.cdr.markForCheck(),this.scroller.setParams({...o,...i}).getData(20,e)))).subscribe((0,xt.e)(i=>{this.invoices=i,this.cdr.markForCheck()})))}sendAll(){if(this.sendAllBusy)return;const o=this.modal.confirmTranslated("inSendAllConfirmation",ct).pipe((0,B.w)(()=>(this.sendAllBusy=!0,this.cdr.markForCheck(),this.invoicingRes.sendAll(this._search).pipe((0,H.b)({error:()=>{this.alert.alertError({key:"sendAllErr",ns:ct})},next:e=>{if(e?.length){const i=new Set(e.map(r=>r.id));this.invoices=this.invoices.filter(r=>!i.has(r.id)),this.cdr.markForCheck(),this.alert.alertSuccess({key:"sendAllOk",ns:ct})}else this.alert.alertError({key:"sendAllNoInvoicesErr",ns:ct})}}),(0,Fn.x)(()=>{this.sendAllBusy=!1,this.cdr.markForCheck()})))),(0,m.H)("[Invoicing.sendAll]"));this.sendAllSub?.unsubscribe(),this.sendAllSub=o.subscribe(V.V)}}function Di(n,o){if(1&n&&(t.TgZ(0,"li",6),t._UZ(1,"a",7),t.qZA()),2&n){const e=o.$implicit;t.Q6J("uiSrefActive","active"),t.xp6(1),t.Q6J("uiSref","admin.invoicing.list."+e.sref)("translate",e.text)("tr-namespace","invoicing")}}$t=St,J.BASE_PARAMS=Object.freeze({limit:20}),J.\u0275fac=function(o){return new(o||J)(t.Y36(t.sBO),t.Y36(b.Z),t.Y36(I.wp),t.Y36(I.s),t.Y36(M.h),t.Y36(Ht.TgInfiniteScroller),t.Y36(u.c),t.Y36(Ut.U),t.Y36(l.QS))},J.\u0275cmp=t.Xpm({type:J,selectors:[["tg-invoicing-list"]],standalone:!0,features:[t._Bn([Ht.TgInfiniteScroller],[{provide:mt.z,useValue:ct}]),t.jDz],decls:11,vars:15,consts:[[1,"row"],[1,"col-xs-12","mb1","text-right"],[1,"btn","btn-default",3,"href","translate"],["class","btn btn-primary",3,"tooltip","disabled","click.passive",4,"ngIf"],["class","well",4,"ngIf"],["class","alert alert-info",4,"ngIf"],["class","table-responsive",4,"ngIf"],["class","alert alert-info text-center",4,"ngIf"],[1,"btn","btn-primary",3,"tooltip","disabled","click.passive"],[1,"fa","fa-paper-plane","fa-fw"],[1,"well"],[3,"formControl"],[1,"alert","alert-info"],[1,"table-responsive"],[1,"table","table-condensed","table-striped","table-bordered","table-hover"],[4,"ngIf"],["infiniteScroll","",3,"immediateCheck","scrollWindow","infiniteScrollDisabled","scrolled"],[3,"invoiceRow","isDraft","duplicated",4,"ngFor","ngForOf","ngForTrackBy"],[3,"invoiceRow","isDraft","duplicated"],[1,"alert","alert-info","text-center"]],template:function(o,e){1&o&&(t.TgZ(0,"div",0)(1,"div",1),t._UZ(2,"a",2),t.ALo(3,"tgQuerystring"),t._UZ(4,"a",2),t.ALo(5,"tgQuerystring"),t.YNc(6,_i,6,7,"button",3),t.qZA()(),t.YNc(7,Zi,2,1,"div",4),t.YNc(8,yi,3,3,"div",5),t.YNc(9,Si,24,24,"div",6),t.YNc(10,Ui,5,4,"div",7)),2&o&&(t.xp6(2),t.Q6J("href",t.xi3(3,9,e.exportAllParams,e.EXPORT_LINK_BASE),t.LSH)("translate","exportAllCSV"),t.xp6(2),t.Q6J("href",t.xi3(5,12,e.exportFilteredParams,e.EXPORT_LINK_BASE),t.LSH)("translate","exportFilteredCSV"),t.xp6(2),t.Q6J("ngIf",e.isDraft),t.xp6(1),t.Q6J("ngIf",e.invoicingCfg.search.enable),t.xp6(1),t.Q6J("ngIf",!e.invoices.length&&!e.busy),t.xp6(1),t.Q6J("ngIf",e.invoices.length),t.xp6(1),t.Q6J("ngIf",e.busy))},dependencies:[p.GlobalModule,g.sg,g.O5,it.G,et.P,Ot.I,at.K,nt.h,di.a,j.k,O.H,q.z8,q.i9,Rn.t,l.JJ,l.oH,bi,Vn.TgInfiniteScrollModule,xi.N,Ai.Ry,wn.A,ot],styles:["a.btn[_ngcontent-%COMP%]{margin-right:5px}.mb1[_ngcontent-%COMP%]{margin-bottom:1em}th[_ngcontent-%COMP%]{white-space:nowrap}"],changeDetection:0});let Ni=(()=>{class n{constructor(){this.TABS=[{sref:"draft",text:"draftLabel"},{sref:"sent",text:"sentLabel"},{sref:"paid",text:"paidLabel"},{sref:"notpaid",text:"notPaidLabel"}]}}return n.\u0275fac=function(e){return new(e||n)},n.\u0275cmp=t.Xpm({type:n,selectors:[["tg-invoicing-admin-tabs"]],standalone:!0,features:[t.jDz],decls:6,vars:2,consts:[[1,"nav","nav-tabs"],["role","presentation",3,"uiSrefActive",4,"ngFor","ngForOf"],[1,"tab-content"],[1,"tab-pane","active"],[1,"panel","panel-default"],[1,"panel-body",3,"ui-view"],["role","presentation",3,"uiSrefActive"],[3,"uiSref","translate","tr-namespace"]],template:function(e,i){1&e&&(t.TgZ(0,"ul",0),t.YNc(1,Di,2,4,"li",1),t.qZA(),t.TgZ(2,"div",2)(3,"div",3)(4,"div",4),t._UZ(5,"div",5),t.qZA()()()),2&e&&(t.xp6(1),t.Q6J("ngForOf",i.TABS),t.xp6(4),t.Q6J("ui-view",""))},dependencies:[p.GlobalModule,g.sg,et.P,j.k,a.UISref,a.AnchorUISref,a.UIView,a.UISrefActive,a.UISrefStatus],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0}),n})();const It={deps:[x.Transition,M.h],resolveFn(n,o){const i={status:n.to().data.status,...J.BASE_PARAMS};return(0,E.n)(o.query({params:i}))},token:I.wp},Li={path:"enableImports",redirect:["admin.invoicing.list.draft"],token:R.e},Wt=(0,U.M)(Y.INVOICE_CREATE_CUSTOM_FIELDS,[I.s,L.InvoicingService],({customFields:n},o)=>n.enable&&n.fields.length?(0,E.n)(o.createModularCustomFields(n)):[]),Qi=[{abstract:!0,component:w.J9,name:"admin.invoicing",url:"/invoicing"},{component:Dn,data:{checkConfigEnabled:Li},name:"admin.invoicing.import",url:"/import"},{abstract:!0,component:Ni,name:"admin.invoicing.list",url:"/list"},{component:J,data:{status:v.a.DRAFT},name:"admin.invoicing.list.draft",resolve:[It],url:"/draft"},{component:J,data:{status:v.a.SENT},name:"admin.invoicing.list.sent",resolve:[It],url:"/sent"},{component:J,data:{status:v.a.PAID},name:"admin.invoicing.list.paid",resolve:[It],url:"/paid"},{component:J,data:{status:v.a.NOTPAID},name:"admin.invoicing.list.notpaid",resolve:[It],url:"/not-paid"},{abstract:!0,component:w.J9,name:"admin.invoicing.one",url:""},{component:Gt,name:"admin.invoicing.one.create",resolve:[{deps:[x.Transition,b.Z],resolveFn(n,o){const e=n.params().type;if(!e||Object.values(A.d).includes(e))return e;n.abort(),o.goHome(n).subscribe(V.V)},token:Y.INVOICING_ADMIN_CREATE_TYPE},{deps:[x.Transition,M.h,Y.INVOICING_ADMIN_CREATE_TYPE],resolveFn(n,o){const e=n.params().parent;if(e)return(0,E.n)(o.get(e))},token:Y.INVOICING_ADMIN_CREATE_PARENT},(0,W.b)([M.h,Y.INVOICING_ADMIN_CREATE_PARENT],(n,o)=>
1{if(o)return n.instantiate((0,h.Z)(o,["line_items","bank_account","po_number","group","user","pending_member","recipients","description","vat","custom"]))}),Wt],url:"/create?{parent:ObjectId}&type"},{component:Gt,name:"admin.invoicing.one.edit",resolve:[(0,W.b)([M.h,x.Transition],(n,o)=>(0,E.n)(n.get(o.params().id))),Wt],url:"/{id:ObjectId}"}];let Pi=(()=>{class n{}return n.\u0275fac=function(e){return new(e||n)},n.\u0275mod=t.oAB({type:n}),n.\u0275inj=t.cJS({imports:[a.UIRouterModule.forChild({config:b.Z.config(Qi)})]}),n})()},49242:(Ct,F,s)=>{s.d(F,{s:()=>y});var a=s(64762),b=s(88990),V=s(662),x=s(5296),h=s(14026),E=s(52805),R=s(61029);var M=s(72335),L=s(25989),I=s(9803),W=s(8194),U=s(25336),w=s(3811),D=s(50725),z=s(60407),m=s(48921),t=s(89969),l=s(35673),C=s(87563),Z=s(42809),K=s(10066),st=s(83375),Tt=s(93327),bt=s(58322),ut=s(85960),pt=s(70486);class y extends Tt.v{constructor(){super(),this.TRACK_BY_ID=ut.trackById,this.emitIds=!1,this.multi=!0,this.selected$=new h.vpe,this.el=(0,h.f3M)(h.SBq).nativeElement,this.r2=(0,h.f3M)(h.Qsj),this.fb=(0,h.f3M)(E.QS)}get value(){return this._value$.value}set value(c){(function v(_,c,u){var p=(u="function"==typeof u?u:void 0)?u(_,c):void 0;return void 0===p?(0,R.Z)(_,c,void 0,u):!!p})(c,this.value,B)||this._value$.next(c)}ngOnDestroy(){this.selected$.complete(),this._value$&&(0,st.completeAll)(this._value$,this._writeValue$)}ngOnInit(){this._value$=new I.X([]),this._writeValue$=new W.x,this.ctrlInp=this.fb.control(null),this.tokens=[],this._selectedIds=new Set,this._responseCache=new Map,this.typeahead$=new bt.Z({debounceTime:200,getParams:()=>this.ctrlInp.value?.trim()??"",query:c=>this.fetch(c)}).pipe((0,w.w)(c=>this._value$.pipe((0,D.U)(()=>c.filter(this.filterTypeahead,this)))),(0,w.w)(c=>this.selected$.pipe((0,z.q)(1),(0,D.U)(()=>[]),(0,m.O)(c)))),this._writeValue$.pipe((0,D.U)(c=>c?Array.isArray(c)?c:[c]:[]),(0,w.w)(c=>{if(!c.length)return(0,U.of)([]);const u=c.filter(this.isResponse,this);if(u.length===c.length)return(0,U.of)(u);const p=c.filter(K.K);return p.length?this.fetchIdsWithCache(p).pipe((0,D.U)(T=>(0,M.Z)([...u,...T],"id"))):(0,U.of)(u)}),(0,x.H)("[AbstractIdSearch.writeValue$]")).subscribe((0,V.e)(c=>{if(c.length){this._selectedIds=new Set;for(const u of c)this._selectedIds.add(u.id)}else this._selectedIds.clear();this.value=c})),this._value$.pipe((0,t.b)(c=>{this.tokens=c,this.cdr.markForCheck()}),(0,l.T)(1)).subscribe(c=>{this._onChangeFn(this.emitIds?this.multi?c.map(H):H(c[0]):this.multi?c:c[0])}),this.r2.addClass(this.el,"tg-input-error-boundary")}rm(c){const u=c.id;this._selectedIds.delete(u);const p=this.value.findIndex(T=>T.id===u);if(-1!==p){const T=[...this.value];T.splice(p,1),this.value=T}this.onTouch()}selected(c){const u=c.item;this._selectedIds.has(u.id)||(this._selectedIds.add(u.id),this.value=[...this.value,u],this.selected$.emit(u)),this.ctrlInp.reset(),this.onTouch()}setDisabledState(c){c!==this.ctrlInp.disabled&&(c?this.ctrlInp.disable():this.ctrlInp.enable(),this.cdr.detectChanges())}writeValue(c){this._writeValue$.next(c)}filterTypeahead(c){return!this._selectedIds.has(c.id)}fetch(c){return c?this.doFetch(c).pipe((0,t.b)(u=>{for(const p of u)this._responseCache.set(p.id,p)}),(0,x.H)(`[${this.conf.logLabel}.fetch(${c})]`),(0,C.K)(()=>(this.fetch[b.y7]?.delete(c),(0,U.of)([]))),(0,Z.d)(1)):(0,U.of)([])}fetchIdsWithCache(c){const u=[],p=c.filter(T=>{const k=this._responseCache.get(T);return!k||(u.push(k),!1)});return p.length?this.fetchIds(p).pipe((0,D.U)(T=>{if(T.length){for(const k of T)this._responseCache.set(k.id,k);u.push(...T)}return u})):(0,U.of)(u)}}function B(_,c){if(_&&c&&!Array.isArray(_)&&!Array.isArray(c))return _.id===c.id}function H(_){return _.id}y.\u0275fac=function(c){return new(c||y)},y.\u0275dir=h.lG2({type:y,contentQueries:function(c,u,p){if(1&c&&h.Suo(p,pt.h,5),2&c){let T;h.iGM(T=h.CRH())&&(u.itemTemplate=T.first)}},inputs:{emitIds:"emitIds",multi:"multi"},outputs:{selected$:"selected"},features:[h.qOj]}),(0,a.gn)([(0,b.qQ)(L.Z)],y.prototype,"fetch",null)},70486:(Ct,F,s)=>{s.d(F,{h:()=>V});var a=s(49731),b=s(14026);let V=(()=>{class x extends a.TemplateContainer{}return x.\u0275fac=function(){let h;
1return function(R){return(h||(h=b.n5z(x)))(R||x)}}(),x.\u0275dir=b.lG2({type:x,selectors:[["","idSearchItem",""]],features:[b.qOj]}),x})()},38207:(Ct,F,s)=>{s.d(F,{k:()=>z});var a=s(14026),b=s(52805),V=s(97482),x=s(49242),h=s(47528),E=s(64177),R=s(61225),v=s(38674),A=s(4678),M=s(36818),L=s(64683);function I(m,t){if(1&m&&a._uU(0),2&m){const l=t.item,C=a.oxw();a.Oqu(l[C.conf.typeaheadOptionField])}}function W(m,t){if(1&m){const l=a.EpF();a.TgZ(0,"input",3),a.NdJ("blur.passive",function(){a.CHM(l);const Z=a.oxw();return a.KtG(Z.onTouch())})("typeaheadOnSelect",function(Z){a.CHM(l);const K=a.oxw();return a.KtG(K.selected(Z))}),a.ALo(1,"tr"),a.qZA()}if(2&m){const l=a.oxw(),C=a.MAs(1);a.Q6J("tgConsumeControlId","id")("formControl",l.ctrlInp)("autocomplete","off")("typeahead",l.typeahead$)("typeaheadAsync",!0)("isAnimated",!1)("typeaheadMinLength",0)("typeaheadItemTemplate",(null==l.itemTemplate?null:l.itemTemplate.template)||C)("typeaheadOptionField",l.conf.typeaheadOptionField)("container","body")("typeaheadLatinize",!0)("placeholder",a.lcZ(1,12,l.conf.placeholder))}}const U=function(m){return{item:m}};function w(m,t){if(1&m){const l=a.EpF();a.TgZ(0,"div",6)(1,"div")(2,"div"),a.GkF(3,7),a.qZA(),a.TgZ(4,"div",8),a.NdJ("click.passive",function(){const K=a.CHM(l).$implicit,st=a.oxw(2);return a.KtG(st.rm(K))}),a._UZ(5,"i",9),a.ALo(6,"tr"),a.qZA()()()}if(2&m){const l=t.$implicit,C=a.oxw(2),Z=a.MAs(1);a.xp6(3),a.Q6J("ngTemplateOutlet",(null==C.itemTemplate?null:C.itemTemplate.template)||Z)("ngTemplateOutletContext",a.VKq(6,U,l)),a.xp6(2),a.uIk("aria-label",a.xi3(6,3,"remove","common"))}}function D(m,t){if(1&m&&(a.TgZ(0,"tg-panel")(1,"tg-panel-body")(2,"div",4),a.YNc(3,w,7,8,"div",5),a.qZA()()()),2&m){const l=a.oxw();a.xp6(3),a.Q6J("ngForOf",l.tokens)("ngForTrackBy",l.TRACK_BY_ID)}}let z=(()=>{class m extends x.s{constructor(l){super(),this.uRes=l,this.conf={logLabel:"UserIdSearch",placeholder:"byIdPlaceholder",typeaheadOptionField:"fullName"}}doFetch(l){return this.uRes.query({params:{name:l}})}fetchIds(l){return this.uRes.query({params:{ids:l}})}isResponse(l){return this.uRes.isResponse(l)}}return m.\u0275fac=function(l){return new(l||m)(a.Y36(h.q))},m.\u0275cmp=a.Xpm({type:m,selectors:[["tg-user-id-search"]],features:[a._Bn([{provide:V.z,useValue:"user-search"},{multi:!0,provide:b.JU,useExisting:(0,a.Gpc)(()=>m)}]),a.qOj],decls:4,vars:2,consts:[["defaultTpl",""],["class","form-control",3,"tgConsumeControlId","formControl","autocomplete","typeahead","typeaheadAsync","isAnimated","typeaheadMinLength","typeaheadItemTemplate","typeaheadOptionField","container","typeaheadLatinize","placeholder","blur.passive","typeaheadOnSelect",4,"ngIf"],[4,"ngIf"],[1,"form-control",3,"tgConsumeControlId","formControl","autocomplete","typeahead","typeaheadAsync","isAnimated","typeaheadMinLength","typeaheadItemTemplate","typeaheadOptionField","container","typeaheadLatinize","placeholder","blur.passive","typeaheadOnSelect"],[1,"item-containers"],["class","item-container",4,"ngFor","ngForOf","ngForTrackBy"],[1,"item-container"],[3,"ngTemplateOutlet","ngTemplateOutletContext"],[1,"text-muted","small",3,"click.passive"],["aria-hidden","false","role","button",1,"fa","fa-times"]],template:function(l,C){1&l&&(a.YNc(0,I,1,1,"ng-template",null,0,a.W1O),a.YNc(2,W,2,14,"input",1),a.YNc(3,D,4,2,"tg-panel",2)),2&l&&(a.xp6(2),a.Q6J("ngIf",C.multi||!C.tokens.length),a.xp6(1),a.Q6J("ngIf",C.tokens.length))},dependencies:[E.sg,E.O5,E.tP,R.c,v.r,A.jl,A.Av,b.Fj,b.JJ,b.oH,M.Bp,L.H],styles:["[_nghost-%COMP%]{display:inline}.item-containers[_ngcontent-%COMP%]{display:flex;flex:1 1 auto;flex-direction:row;flex-wrap:wrap}.item-container[_ngcontent-%COMP%]{border-collapse:collapse;display:inline-table;margin:2px}.item-container[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]{display:table-row}.item-container[_ngcontent-%COMP%] > div[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]{border:1px solid #ccc;display:table-cell;padding:2px;vertical-align:middle}.text-muted.small[_ngcontent-%COMP%]{cursor:pointer}tg-panel-body[_ngcontent-%COMP%]{padding:2px}"],changeDetection:0}),m})()}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.