PageSourceSearch

https://eu.younium.com/chunk-Z55K2SLE.js

js younium.com collected 2026-09-25 18:39:20 UTC 264,858 bytes, 7 lines download raw bytes

1import{a as zn,b as Un,c as Kn,d as io}from"./chunk-TF2BPSXR.js";import{a as ct,b as Hn,c as Wn,d as Xn}from"./chunk-3Z4ECZIC.js";import{a as to}from"./chunk-762V2FFZ.js";import{a as Jn,b as ci,c as Zn}from"./chunk-SVSKWULG.js";import"./chunk-QWZEJOLO.js";import{a as Yn}from"./chunk-M2YTWDCV.js";import{a as qn}from"./chunk-2FYUJRNC.js";import"./chunk-MRKHDCT2.js";import{a as Dn}from"./chunk-MKMBLVOQ.js";import{a as wn}from"./chunk-7JZJDAIK.js";import{a as Sn}from"./chunk-7NEPOK7D.js";import{a as Ln}from"./chunk-6XMURPGO.js";import{a as Bn}from"./chunk-U7NHCEY6.js";import{a as xn}from"./chunk-QY6XSMIH.js";import{e as Tn,f as On,g as Nn,h as Vn,k as Fn,l as Rn}from"./chunk-B2CG2UNV.js";import{b as Mn,c as En,d as kn}from"./chunk-JJB5C2PK.js";import"./chunk-PILUOCIF.js";import"./chunk-RC6FWAGZ.js";import{a as fn}from"./chunk-ND3C3C2D.js";import{a as In}from"./chunk-4YIIXHZS.js";import{a as Cn}from"./chunk-XHSTQDCH.js";import"./chunk-W7PFNUF4.js";import"./chunk-ZIN2SFKV.js";import{a as yn}from"./chunk-PNKRWKSA.js";import"./chunk-7MZMW7ZP.js";import"./chunk-OBEV4A25.js";import{a as Pn}from"./chunk-SPFBN2HL.js";import"./chunk-P3KAPGQS.js";import{a as Gi}from"./chunk-RL23CMKJ.js";import{a as eo}from"./chunk-I67J6GHP.js";import"./chunk-4BODLVOD.js";import"./chunk-IWUMCEFM.js";import"./chunk-6LAHYOKP.js";import{a as Gn}from"./chunk-3GY4PCZP.js";import{a as jn}from"./chunk-O5IAGJVY.js";import{a as Qn}from"./chunk-XCCBRPRK.js";import{b as $n}from"./chunk-ND2V24RR.js";import"./chunk-ZAFQQ3GW.js";import"./chunk-UIWY7XVB.js";import{a as vn}from"./chunk-SQO5JP3M.js";import{a as An}from"./chunk-HQ4WE55T.js";import{b as bn,c as H}from"./chunk-65BZLSLH.js";import"./chunk-U2PNEEEQ.js";import{b as ln}from"./chunk-OXFBVNCT.js";import"./chunk-BMGFM3CX.js";import{a as sn}from"./chunk-WHXWQ5W6.js";import{a as dn}from"./chunk-UFNAYRMQ.js";import{a as an}from"./chunk-CSCL6QKP.js";import"./chunk-HGVCKQRC.js";import{a as st}from"./chunk-4PTAE4FL.js";import"./chunk-EI7S76MX.js";import{a as cn,b as un,c as pn,d as mn,e as _n,f as gn,g as hn}from"./chunk-B2YP676U.js";import{a as tn}from"./chunk-J5Q5SGAO.js";import"./chunk-3RO65GPC.js";import"./chunk-75FF72C3.js";import{a as nn}from"./chunk-R7YZZUMY.js";import{b as ni}from"./chunk-JYENBUHD.js";import{a as ii}from"./chunk-M5AYQI3W.js";import{a as on,b as rn}from"./chunk-FWHBGNFB.js";import"./chunk-I6OTESFY.js";import{E as G,a as Wi,b as Ui}from"./chunk-PHRB2UD4.js";import"./chunk-LZQWAODP.js";import"./chunk-GK2MZPED.js";import"./chunk-GD6SFB5P.js";import{a as en}from"./chunk-6C3DDLFZ.js";import{a as Jt,b as Xt}from"./chunk-UJTXFVLU.js";import"./chunk-MHT4E5X6.js";import{b as qe,c as Zt,d as Qe,e as Ge}from"./chunk-BSL22QOB.js";import"./chunk-NJIOGT5G.js";import{a as Xi,b as Zi}from"./chunk-KSV4K5L7.js";import"./chunk-CPBDRKJF.js";import{a as Be,b as zi}from"./chunk-G24DUSEI.js";import"./chunk-X4BW4SJU.js";import"./chunk-LNJJZS2Z.js";import"./chunk-2NQ7JOGA.js";import"./chunk-2DE3O72C.js";import"./chunk-NGDLRAEG.js";import"./chunk-PCSK5A3J.js";import{a as se}from"./chunk-WBKEXQKE.js";import{n as ve}from"./chunk-DNWKX7ME.js";import{a as je}from"./chunk-7RJ7KBOV.js";import{a as At}from"./chunk-EOY6SAP7.js";import{a as Lt,b as Bt,c as jt,e as qt,f as Qt,h as Gt,i as zt,k as $t,l as Ht,n as Wt,p as Yi,q as Ut}from"./chunk-ZGCK3FI7.js";import"./chunk-GFCJRNG7.js";import{f as Ji}from"./chunk-RVGGNFAO.js";import{J as ie}from"./chunk-YJGV56BU.js";import"./chunk-5LNWRJOG.js";import"./chunk-TZCA4BMQ.js";import{ea as Hi}from"./chunk-UX52FRTR.js";import"./chunk-IWYKCUBW.js";import"./chunk-MZ3B3AQU.js";import"./chunk-GJ3HPRCZ.js";import"./chunk-L77O44AU.js";import"./chunk-XZDAMPUP.js";import"./chunk-L27WCSZV.js";import"./chunk-UWULTQAP.js";import"./chunk-RB2YP5E2.js";import"./chunk-QIIVFJNA.js";import"./chunk-KO7CD6JP.js";import"./chunk-6D27RETG.js";import{C as $,a as Li,e as Bi,h as X,m as Z}from"./chunk-DJ7NG7WZ.js";import{c as j}from"./chunk-KI4XJKCH.js";import{a as dt,c as oe,f as Kt,g as Yt,h as ze,i as ei,j as ti}from"./chunk-NERRRF6P.js";import{a as Ri,k as ji,m as qi,n as Qi,u as at,w as Q}from"./chunk-SXBT3OYT.js";import"./chunk-SN3EPBFH.js";import{b as Ft}from"./chunk-EHPYMWXB.js";import{a as lt}from"./chunk-EUX7SKJZ.js";import{a as Ki}from"./chunk-5SQV5IIR.js";import{a as pe}from"./chunk-NVPTMCVP.js";import{I as si,M as Ii,P as Fi,R as Ct,a as Ni,ea as It,ia as Ai,l as Vt,m as Ee,r as ke,s as N,u as Xe}from"./chunk-7ZFPQAIH.js";import{A as Mt,B as Pt,Ca as Vi,H as Ce,I as Me,J as Et,Q as kt,S as li,Z as Nt,da as ht,e as we,f as di,g as Ti,ja as ye,k as ue,n as J,pa as Pe,q as Oi,r as Mi,ra as Fe,s as Pi,t as it,u as nt,x as Ei,y as Je,z as Oe}from"./chunk-7NPDSOWV.js";import"./chunk-R5IULLQ2.js";import{t as ki,w as fe,x as ot,z as rt}from"./chunk-LEKN3M5J.js";import{a as Rt,b as $i}from"./chunk-KFHTLBNQ.js";import"./chunk-YV5TISNX.js";import{D as Le,m as Tt,q as wi,w as Ot,z as Si}from"./chunk-IDF3EASQ.js";import"./chunk-WJESYQVL.js";import{$c as D,Aa as hi,Ac as ge,B as Ue,Bc as s,Cc as d,Dc as a,Ec as b,F as me,Fa as O,Fc as de,Gc as ce,Gd as z,Hc as vi,Hd as _t,I as Re,Ib as r,Ic as xe,Id as ee,Jc as De,La as p,Lc as y,Ma as m,Mc as Dt,Md as R,Nb as fi,Pa as Ci,Rd as P,Sb as k,Ta as ne,Uc as _,Ud as St,Vc as tt,Vd as Ie,Wc as l,Wd as gt,Xa as v,Z as mi,Zb as I,Zd as Di,_a as Ke,_c as B,a as ae,aa as F,ad as w,b as be,cd as yi,dc as M,dd as bi,ed as x,gd as q,ha as te,jd as c,
1kd as L,l as V,ld as S,md as le,pd as U,qd as K,ra as _i,rd as Y,sa as W,t as Ae,tc as et,u as ai,ua as xt,uc as h,vd as xi,wc as C,wd as he,xd as Te,yd as Ye,za as gi,zc as _e,zd as wt}from"./chunk-K6IHZUMJ.js";var To=["dialog"],Oo=["productTable"],Mo=()=>["productNumber","name","cmrrAmount","tcvAmount","oneTimeFeesAmount","productLineNumber"];function Po(n,u){if(n&1){let e=y();d(0,"div",5)(1,"p"),c(2,"The following products will be cancelled on current order and put into a new order."),a(),b(3,"yon-entity-table",6,2),d(5,"div",7)(6,"yon-field",8,3),Y("ngModelChange",function(t){p(e);let o=l();return K(o.selectedDateForNewOrder,t)||(o.selectedDateForNewOrder=t),m(t)}),a()(),d(8,"small"),c(9," Dates may be restricted because of existing invoices, credits or imported usage or measurement "),a(),d(10,"div",9)(11,"yon-button",10),_("onClick",function(){p(e);let t=l();return m(t.splitOrder())}),c(12," CONFIRM "),a(),d(13,"yon-button",11),_("onClick",function(){p(e),l();let t=x(1);return m(t.close())}),c(14," DISCARD "),a()()()}if(n&2){let e=x(7),i=l();r(3),s("defaultFields",he(9,Mo))("explicitLoad",!0),r(3),s("title","Start date for new order"),U("ngModel",i.selectedDateForNewOrder),s("min",i.startDateForNewOrderMin)("max",i.startDateForNewOrderMax)("isRequired",!0),r(5),s("disabled",!e.isValid||i.isLoading),r(2),s("disabled",i.isLoading)}}var no=(()=>{class n{constructor(e,i,t,o){this.router=e,this.orderService=i,this.notificationService=t,this.dialogService=o,this.goToNewOrderClicked=new ne,this.refreshCurrentOrder=St(),this.showDialog=g=>{!g||g.length===0||(this.productIds=g.map(f=>f.id),this.orderService.getSplitOrderTimeFrames(this.order.id,this.productIds).pipe(F(1)).subscribe(f=>{let T=f;this.startDateForNewOrderMin=new Date(T.earliestSplitDate),this.startDateForNewOrderMax=T.latestSplitDate?new Date(T.latestSplitDate):null}),this.dialog.show(),setTimeout(()=>this.loadProductTable(),0))}}loadProductTable(){if(this.productIds.length===0)return;if(this.productIds.length===1){this.productTable.conditions=[{fieldName:"id",value:this.productIds[0]}],this.productTable.conditionLogic="",this.productTable.refresh();return}let e=[],i="";for(let t=1;t<=this.productIds.length;t++)e.push({fieldName:"id",value:this.productIds[t-1]}),i+=t!==this.productIds.length?`${t} OR `:`${t}`;this.productTable.conditions=e,this.productTable.conditionLogic=i,this.productTable.refresh()}splitOrder(){this.selectedDateForNewOrder&&(this.isLoading=!0,this.orderService.splitOrder(this.order.id,this.productIds,this.selectedDateForNewOrder).pipe(F(1)).subscribe({next:e=>V(this,null,function*(){this.isLoading=!1,this.dialog.close();let i="Order split successfully completed",t=`Order was successfully split and new order ${e.orderNumber} was created with the selected products.`;if(yield this.dialogService.createConfirmDialog(t,i,"Go to new order","")){this.goToNewOrderClicked.emit(),this.router.navigate(["/orders/"+e.id]);return}this.refreshCurrentOrder.emit()}),error:e=>{this.isLoading=!1,this.notificationService.error(e.error.message)}}))}static{this.\u0275fac=function(i){return new(i||n)(k(fe),k(H),k(j),k(se))}}static{this.\u0275cmp=I({type:n,selectors:[["yon-split-order-dialog"]],viewQuery:function(i,t){if(i&1&&B(To,5)(Oo,5),i&2){let o;D(o=w())&&(t.dialog=o.first),D(o=w())&&(t.productTable=o.first)}},inputs:{order:"order"},outputs:{goToNewOrderClicked:"goToNewOrderClicked",refreshCurrentOrder:"refreshCurrentOrder"},decls:4,vars:3,consts:[["dialog",""],["dialogContent",""],["productTable",""],["selectedDateForNewOrderField",""],["dialogSize","xl","backdropOption","static",3,"header","isLoading","containerTemplate"],[1,"p-5"],["entity","orderproduct","viewName","split-order-dialog-table",3,"defaultFields","explicitLoad"],[1,"order-dialogs__date-field"],["type","date",3,"ngModelChange","title","ngModel","min","max","isRequired"],[1,"mt-3","flex","flex-row","content-center","justify-end"],["color","primary",1,"mr-2",3,"onClick","disabled"],["buttonIcon","delete",3,"onClick","disabled"]],template:function(i,t){if(i&1&&(b(0,"yon-dialog-center",4,0),M(2,Po,15,10,"ng-template",null,1,R)),i&2){let o=x(3);s("header","Split order "+(t.order==null?null:t.order.orderNumber))("isLoading",t.isLoading)("containerTemplate",o)}},dependencies:[$,X,Z,G,ie,Q,oe,ve],styles:[".order-dialogs__date-field[_ngcontent-%COMP%]{max-width:200
1px}.order-dialogs__date-field[_ngcontent-%COMP%]  .k-button{background-color:transparent}.order-dialogs__date-field[_ngcontent-%COMP%]  .k-input-solid{border:1px solid #7a7a7a}.cancellation[_ngcontent-%COMP%]{z-index:2;position:relative;margin-top:-50px}.order-dialogs__stepper-container[_ngcontent-%COMP%]  .mat-accordion__no-shadow .mat-expansion-panel{border:none!important}.cancel-order__expand-collapse-table[_ngcontent-%COMP%]{display:block;margin:0 auto 5px;width:fit-content}.cancel-order__expand-collapse-table[_ngcontent-%COMP%]   button[_ngcontent-%COMP%]{height:60px;background-color:transparent;color:#424242;margin-top:-70px}.cancel-order__expand-collapse-table[_ngcontent-%COMP%]   .mat-mdc-button[_ngcontent-%COMP%]{--mat-mdc-button-persistent-ripple-color: none;--mat-mdc-button-ripple-color: none}.cancel-order__expand-collapse-table[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]{margin-top:-20px;font-weight:400}.cancel-order__expand-collapse-table[_ngcontent-%COMP%]  .material-symbols-sharp{position:relative}.cancel-order__expand-collapse-table[_ngcontent-%COMP%]  .mat-button-focus-overlay{display:none}.cancel-order-table-collapsed[_ngcontent-%COMP%]{display:none}.collapsed[_ngcontent-%COMP%]{margin-bottom:-100px}"]})}}return n})();var ko=["dialog"],No=["stepper"],Vo=["specificEndDateField"],Io=["deleteProductDialog"],Fo=()=>[5];function Ao(n,u){n&1&&c(0,"Set cancellation")}function Ro(n,u){if(n&1&&(d(0,"mat-radio-button",11),c(1),z(2,"dateFormat"),a()),n&2){let e=l(2);s("value","orderEffectiveEndDate"),r(),S(" Order effective end date: ",ee(2,2,e.order==null?null:e.order.effectiveEndDate,"shortDate")," ")}}function Lo(n,u){if(n&1&&(d(0,"mat-radio-button",11),c(1),z(2,"dateFormat"),a()),n&2){let e=l(2);s("value","dayBeforeCurrentInvoiceToDate"),r(),S(" At current invoiced to date: ",ee(2,2,e.dayBeforeCurrentInvoiceToDate,"shortDate")," ")}}function Bo(n,u){if(n&1&&b(0,"yon-entity-table",28),n&2){let e=l(2);q("cancel-order-table-collapsed",e.isCollapsed()),s("defaultFields",e.tableDefaultFields)("isManualData",!0)("manualTableData",e.newCreditCharges)("customPageSize",5)("customPaginatorSize",(e.newCreditCharges==null?null:e.newCreditCharges.length)>=5?he(8,Fo):null)("showFirstLastButtons",!1)}}function jo(n,u){if(n&1){let e=y();d(0,"yon-button",29),_("onClick",function(){p(e);let t=l(2);return m(t.toggleCreditTable())}),a()}if(n&2){let e=l(2);q("collapsed",e.isCollapsed()),s("buttonIcon",e.isCollapsed()?"keyboard_double_arrow_down":"keyboard_double_arrow_up")("size",35)("weight",300)("tooltip",e.isCollapsed()?"Expand preview section":"Collapse preview section")}}function qo(n,u){n&1&&(d(0,"div")(1,"i",30),c(2,"No credits will be made from this cancellation"),a()())}function Qo(n,u){n&1&&b(0,"yon-icon",31)}function Go(n,u){n&1&&b(0,"yon-icon",32)}function zo(n,u){if(n&1){let e=y();d(0,"mat-stepper",8,4)(2,"mat-step"),M(3,Ao,1,0,"ng-template",9),d(4,"mat-radio-group",10),Y("ngModelChange",function(t){p(e);let o=l();return K(o.cancellationMode,t)||(o.cancellationMode=t),m(t)}),h(5,Ro,3,5,"mat-radio-button",11),h(6,Lo,3,5,"mat-radio-button",11),d(7,"mat-radio-button",11),c(8,"Specific end date"),a()(),d(9,"div",12)(10,"yon-field",13,5),Y("ngModelChange",function(t){p(e);let o=l();return K(o.specificEndDate,t)||(o.specificEndDate=t),m(t)}),a()(),d(12,"div",14)(13,"yon-button",15),_("onClick",function(){p(e);let t=l();return m(t.onNextClick())}),c(14," NEXT "),a()()(),d(15,"mat-step",16)(16,"div",17)(17,"yon-entity-table-card",18),h(18,Bo,1,9,"yon-entity-table",19),d(19,"span",20),h(20,jo,1,6,"yon-button",21),a()()(),h(21,qo,3,0,"div"),d(22,"div",22)(23,"yon-button",23),_("onClick",function(){p(e);let t=x(1);return m(t.previous())}),c(24," BACK "),a(),d(25,"div")(26,"yon-button",24),_("onClick",function(){p(e);let t=l();return m(t.cancelProduct())}),c(27," CONFIRM CANCELLATION "),a(),d(28,"yon-button",25),_("onClick",function(){p(e),l();let t=x(1);return m(t.close())}),c(29,"DISCARD"),a()()()(),M(30,Qo,1,0,"ng-template",26)(31,Go,1,0,"ng-template",27),a()}if(n&2){let e=l();s("linear",!0),r(4),U("ngModel",e.cancellationMode),r(),C(e.order!=null&&e.order.effectiveEndDate&&e.order.termType===e.OrderTermTypes.Termed?5:-1),r(),C(e.dayBeforeCurrentInvoiceToDate?6:-1),r(),s("value","specificEndDate"),r(3),U("ngModel",e.specificEndDate),s("min",e.dayBeforeOrderStartDate())("max",e.order==null?null:e.order.effectiveEndDate)("isRequired",!0)("disabled",e.cancellationMode!=="specificEndDate"),r(3),s("disabled",e.isLoading),r(3),s("hidden",!((e.newCreditCharges==null?null:e.newCreditCharges.length)>0)),r(),s("header",e.getheaderText)("subheader",e.getSubHeaderText)("hideCardHeaderMenu",!0),r(),C(e.newCreditCharges?18:-1),r(2),C((e.newCreditCharges==null?null:e.newCreditCharges.length)>=5?20:-1),r(),C(!e.newCreditCharges||e.newCreditCharges.length===0?21:-1),r(2),s("disabled",e.isLoading),r(3),s("disabled",e.isLoading),r(2),s("disabled",e.isLoading)}}function $o(n,u){if(n&1){let e=y();d(0,"p"),c(1),a(),d(2,"p"),c(3),a(),d(4,"div",33)(5,"div")(6,"yon-button",24),_("onClick",function(){p(e);let t=l();return m(t.deleteProduct())}),c(7," DELETE "),a(),d(8,"yon-button",25),_("onClick",function(){p(e),l();let t=x(5);return m(t.close())}),c(9,"CANCEL"),a()()()}if(n&2){let e=l();r(),le("Delete ",e.orderProduct==null?null:e.orderProduct.name," ",e.orderProduct==null?null:e.orderProduct.productNumber,"?"),r(2),S(" By deleting current product, order version ",(e.order==null?null:e.order.version)+1," of this order will be created. "),r(3),s("disabled",e.isLoading),r(2),s("disabled",e.isLoading)}}var oo=(()=>{class n{constructor(e,i,t){this.router=e,this.orderService=i,this.notificationService=t,this.dayBeforeOrderStartDate=v(new Date),this.tableDefaultFields=["chargeNumber","name","chargeType","changeState","effectiveStartDate","effectiveEndDate"],this.CancelOrderModes=ye,this.OrderTermTypes=Je,this.isCollapsed=v(!1),this.unsubscribe$=new Ae,this.showCancelDialog=o=>{this.orderProduct=this.order.orderProducts.find(g=>g.id===o.id),this.validate()&&(this.dayBeforeCurrentInvoiceToDate=this.getDayBeforeCurrentInvoiceToDate(),this.dayBeforeOrderStartDate.set(N.subtractDays(this.order.effectiveStartDate,1)),this.specificEndDate=N.getMaxDate([new Date,this.dayBeforeOrderStartDate()]),this.order.effectiveEndDate&&this.order.termType===Je.Termed?this.cancellationMode="orderEffectiveEndDate":this.dayBeforeCurrentInvoiceToDate?this.cancellationMode="dayBeforeCurrentInvoiceToDate":this.cancellationMode="specificEndDate",this.dialog.show())},this.showDeleteDialog=o=>{this.orderProduct=this.order.orderProducts.find(g=>g.id===o.id),this.validate()&&this.deleteProductDialog.show()}}ngOnDestroy(){this.unsubscribe$.next(),this.unsubscribe$.complete()}toggleCreditTable(){this.isCollapsed.set(!this.isCollapsed())}get getSubHeaderText(){return this.subHeadertext=this.newCreditCharges?.length===1?"This credit charge will be created from this cancellation":"The
1se credit charges will be created from this cancellation",this.subHeadertext}get getheaderText(){return this.headerText=this.newCreditCharges?.length===1?"Preview of credit charge ("+this.newCreditCharges?.length+")":"Preview of credit charges ("+this.newCreditCharges?.length+")",this.headerText}validate(){return this.order?.isLastVersion?this.order?.status===ue.Invoiced?(this.notificationService.warning("Cannot modify/cancel product on invoiced order"),!1):this.orderProduct?.status===Nt.Cancelled?(this.notificationService.warning("Cannot modify/cancel cancelled products"),!1):this.order.orderProducts?.length===1&&this.order.orderType===J.SalesOrder?(this.notificationService.warning("Cannot delete product if only one exists"),!1):!0:(this.notificationService.warning("Can only modify/cancel product on last version of order"),!1)}get isValid(){return this.cancellationMode==="specificEndDate"?this.specificEndDateField?.isValid:!0}onNextClick(){switch(this.cancellationMode){case"specificEndDate":this.endDate=this.specificEndDate;break;case"dayBeforeCurrentInvoiceToDate":this.endDate=this.dayBeforeCurrentInvoiceToDate;break;default:this.endDate=this.order.effectiveEndDate;break}let e=Ee.deepCopy(this.order),i=e.orderProducts.find(t=>t.id===this.orderProduct.id);
1e.effectiveChangeDate=N.addDays(this.endDate,1),i.status=Nt.Cancelled,i.charges.forEach(t=>{t.chargeType!==we.OneOff&&(t.effectiveEndDate=this.endDate,t.endOn=kt.SpecificDate,t.changeState=Ce.Cancelled)}),this.isLoading=!0,this.orderService.getInvoicePreview(e).pipe(W(this.unsubscribe$)).subscribe({next:t=>{this.stepper.next();let o=t.orderProducts.find(f=>f.id===this.orderProduct.id),g=o.charges.filter(f=>f.isLastVersion);this.newCreditCharges=o.charges.filter(f=>{if(f.changeState!==Ce.Credit)return!1;let T=g.find(A=>A.chargeNumber==f.chargeNumber);return f.version>T.version}),this.isLoading=!1},error:t=>{this.notificationService.error(t.error.message),this.isLoading=!1}})}cancelProduct(){this.order.effectiveChangeDate=N.addDays(this.endDate,1),this.orderProduct.status=Nt.Cancelled,this.orderProduct.charges.forEach(e=>{(e.changeState!==Ce.Cancelled||e.changeState===Ce.Cancelled&&e.effectiveEndDate>this.endDate)&&(e.chargeType===we.OneOff&&e.revenueRecognitionRule?.isRevenueRecognizableForOneOff?(e.effectiveEndDate=this.endDate,e.endOn=kt.SpecificDate,e.changeState=Ce.Cancelled,e.isDeleted=!0):e.chargeType!==we.OneOff?(e.effectiveEndDate=this.endDate,e.endOn=kt.SpecificDate,e.changeState=Ce.Cancelled):(e.isDeleted=!0,e.changeState=Ce.Cancelled))}),this.isLoading=!0,this.orderService.cancelOrderProduct(this.order).pipe(W(this.unsubscribe$)).subscribe({next:e=>{e&&(this.notificationService.success(`The product ${this.orderProduct.productNumber} was cancelled`),this.dialog.close(),this.isLoading=!1,this.router.navigate(["/orders",e.id]))},error:e=>{this.notificationService.error(e.error.message),this.isLoading=!1}})}deleteProduct(){this.order.orderProducts=this.order.orderProducts.filter(e=>e.id!==this.orderProduct.id),this.order.effectiveChangeDate=this.order.orderDate,this.isLoading=!0,this.orderService.create(this.order).pipe(W(this.unsubscribe$)).subscribe({next:e=>{e&&(this.notificationService.success(`The product ${this.orderProduct.productNumber} was deleted`),this.deleteProductDialog.close(),this.isLoading=!1,this.router.navigate(["/orders",e.id]))},error:e=>{this.notificationService.error(e.message),this.isLoading=!1}})}getDayBeforeCurrentInvoiceToDate(){if(!this.order)return;let e=this.orderProduct.chargeNumbers,i=[];if(e.forEach(o=>{let g=this.orderProduct.getAllVersionsOfCharge(o);for(let f=0;f<=g.length-1;f++)if(g[f].chargedThroughDate){i.push(g[f].chargedThroughDate);break}}),!(i?.length>0))return null;for(let o=1;o<i.length;o++)if(!N.datesAreEqual(i[o],i[o-1]))return null;let t=i[0];return N.subtractDays(t,1)}static{this.\u0275fac=function(i){return new(i||n)(k(fe),k(H),k(j))}}static{this.\u0275cmp=I({type:n,selectors:[["yon-cancel-product-dialog"]],viewQuery:function(i,t){if(i&1&&B(ko,5)(No,5)(Vo,5)(Io,5),i&2){let o;D(o=w())&&(t.dialog=o.first),D(o=w())&&(t.stepper=o.first),D(o=w())&&(t.specificEndDateField=o.first),D(o=w())&&(t.deleteProductDialog=o.first)}},inputs:{order:"order"},decls:8,vars:6,consts:[["dialog",""],["orderProductDialogContent",""],["deleteProductDialog",""],["deleteProductDialogContent",""],["stepper",""],["specificEndDateField",""],["dialogSize","xl","backdropOption","static",3,"header","isLoading","containerTemplate"],["dialogSize","md","backdropOption","static",3,"header","isLoading","containerTemplate"],[1,"order-dialogs__stepper-container","mt-2",3,"linear"],["matStepLabel",""],[1,"mat-radio-group-vertical",3,"ngModelChange","ngModel"],[3,"value"],[1,"order-dialogs__date-field","ml-4","mb-2"],["type","date",3,"ngModelChange","ngModel","min","max","isRequired","disabled"],[1,"flex","flex-row","content-center","justify-end"],["buttonIcon","chevron_right","buttonIconPosition","after",3,"onClick","disabled"],["label","Preview credits and confirm"],[3,"hidden"],[3,"header","subheader","hideCardHeaderMenu"],["entity","orderproductcharge","viewName","cancel-product-credit-charges-preview",3,"defaultFields","isManualData","manualTableData","cancel-order-table-collapsed","customPageSize","customPaginatorSize","showFirstLastButtons"],[1,"cancel-order__expand-collapse-table"],["type","mat-icon-button",3,"collapsed","buttonIcon","size","weight","tooltip"],[1,"mt-3","flex","flex-row","content-center","justify-space-between"],["buttonIcon","chevron_left",3,"onClick","disabled"],["color","primary",1,"mr-2",3,"onClick","disabled"],[3,"onClick","disabled"],["matStepperIcon","edit"],["matStepperIcon","done"],["entity","orderproductcharge","viewName","cancel-product-credit-charges-preview",3,"defaultFields","isManualData","manualTableData","customPageSize","customPaginatorSize","showFirstLastButtons"],["type","mat-icon-button",3,"onClick","buttonIcon","size","weight","tooltip"],[2,"font-size","14px"],["name","edit"],["name","done"],[1,"mt-2"]],template:function(i,t){if(i&1&&(b(0,"yon-dialog-center",6,0),M(2,zo,32,21,"ng-template",null,1,R),b(4,"yon-dialog-center",7,2),M(6,$o,10,5,"ng-template",null,3,R)),i&2){let o=x(3),g=x(7);s("header","Cancel product "+(t.orderProduct==null?null:t.orderProduct.productNumber))("isLoading",t.isLoading)("containerTemplate",o),r(4),s("header","Delete product "+(t.orderProduct==null?null:t.orderProduct.productNumber))("isLoading",t.isLoading)("containerTemplate",g)}},dependencies:[$,X,Z,G,Jt,Xt,Qe,qe,Ge,Zt,ie,oe,Q,ii,ve,dt,ke],styles:[".order-dialogs__date-field[_ngcontent-%COMP%]{max-width:200
1px}.order-dialogs__date-field[_ngcontent-%COMP%]  .k-button{background-color:transparent}.order-dialogs__date-field[_ngcontent-%COMP%]  .k-input-solid{border:1px solid #7a7a7a}.cancellation[_ngcontent-%COMP%]{z-index:2;position:relative;margin-top:-50px}.order-dialogs__stepper-container[_ngcontent-%COMP%]  .mat-accordion__no-shadow .mat-expansion-panel{border:none!important}.cancel-order__expand-collapse-table[_ngcontent-%COMP%]{display:block;margin:0 auto 5px;width:fit-content}.cancel-order__expand-collapse-table[_ngcontent-%COMP%]   button[_ngcontent-%COMP%]{height:60px;background-color:transparent;color:#424242;margin-top:-70px}.cancel-order__expand-collapse-table[_ngcontent-%COMP%]   .mat-mdc-button[_ngcontent-%COMP%]{--mat-mdc-button-persistent-ripple-color: none;--mat-mdc-button-ripple-color: none}.cancel-order__expand-collapse-table[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]{margin-top:-20px;font-weight:400}.cancel-order__expand-collapse-table[_ngcontent-%COMP%]  .material-symbols-sharp{position:relative}.cancel-order__expand-collapse-table[_ngcontent-%COMP%]  .mat-button-focus-overlay{display:none}.cancel-order-table-collapsed[_ngcontent-%COMP%]{display:none}.collapsed[_ngcontent-%COMP%]{margin-bottom:-100px}"]})}}return n})();var Wo=["dialog"],Uo=["chargeTiersTable"],Ko=()=>["chargeNumber","name","chargeType","cmrrAmount","effectiveStartDate","effectiveEndDate","changeState","version","isLastVersion","chargedThroughDate"],Yo=n=>({fieldName:"orderProductid",value:n}),Jo=()=>({fieldName:"isLastVersion",value:!0}),Xo=(n,u)=>[n,u],Zo=n=>({color:n});function er(n,u){if(n&1){let e=y();d(0,"span")(1,"div",37)(2,"div",38)(3,"b"),c(4,"Select date when changes should be effective"),a(),c(5," (for all charges) "),a(),d(6,"div",39)(7,"yon-field",40),_("ngModelChange",function(t){p(e);let o=l(3);return m(o.onEffectiveChangeDateChange(t))}),a()()()()}if(n&2){let e=l(3);r(7),s("title","Effective change date")("ngModel",e.effectiveChangeDateForOrderProduct())("isRequired",!0)}}function tr(n,u){if(n&1&&(d(0,"span")(1,"div",41)(2,"b"),c(3),z(4,"dateFormat"),a(),c(5," (for all charges) "),a()()),n&2){let e=l(3);r(3),S(" Changes will be effective from order date ",ee(4,1,e.order==null?null:e.order.orderDate,"shortDate")," ")}}function ir(n,u){if(n&1&&(d(0,"div",10),h(1,er,8,3,"span"),h(2,tr,6,4,"span"),a()),n&2){let e=l(2);q("head__container",e.uiVersion()=="v3"),r(),C((e.order==null?null:e.order.orderType)===e.OrderTypes.Subscription?1:-1),r(),C((e.order==null?null:e.order.orderType)===e.OrderTypes.SalesOrder?2:-1)}}function nr(n,u){if(n&1){let e=y();d(0,"yon-button",42),_("onClick",function(){p(e);let t=l(2);return m(t.resetAllCharges(!0))}),c(1," RESET ALL CHARGES "),a()}if(n&2){let e=l(2);s("disabled",e.isLoading())}}function or(n,u){if(n&1){let e=y();d(0,"span")(1,"div",37)(2,"div",38)(3,"b"),c(4,"Select date when changes should be effective"),a(),c(5," (for all charges) "),a(),d(6,"div",39)(7,"yon-field",40),_("ngModelChange",function(t){p(e);let o=l(3);return m(o.onEffectiveChangeDateChange(t))}),a()()()()}if(n&2){let e=l(3);r(7),s("title","Effective change date")("ngModel",e.effectiveChangeDateForOrderProduct())("isRequired",!0)}}function rr(n,u){if(n&1&&(d(0,"span")(1,"div",41)(2,"b"),c(3),z(4,"dateFormat"),a(),c(5," (for all charges) "),a()()),n&2){let e=l(3);r(3),S(" Changes will be effective from order date ",ee(4,1,e.order==null?null:e.order.orderDate,"shortDate")," ")}}function ar(n,u){if(n&1&&(d(0,"div",10),h(1,or,8,3,"span"),h(2,rr,6,4,"span"),a()),n&2){let e=l(2);r(),C((e.order==null?null:e.order.orderType)===e.OrderTypes.Subscription?1:-1),r(),C((e.order==null?null:e.order.orderType)===e.OrderTypes.SalesOrder?2:-1)}}function dr(n,u){if(n&1){let e=y();d(0,"yon-button",56),_("onClick",function(){p(e);let t=l(3);return m(t.resetSelectedCharge())}),c(1," Reset Charge "),a()}if(n&2){let e=l(3);s("disabled",e.isLoading())}}function lr(n,u){if(n&1){let e=y();d(0,"div",10)(1,"div",30)(2,"yon-entity-field",57),_("onChange",function(){p(e);let t=l(3);return m(t.changeInCharge())}),a()()()}if(n&2){let e=l(3);r(2),s("entity",e.selectedChargeToModify())("readOnly",!1)("disableBlur",!0)("onChangeDebounceTime",300)}}function sr(n,u){if(n&1){let e=y();d(0,"div",30)(1,"yon-entity-field",58),_("onChange",function(){p(e);let t=l(3);return m(t.changeInCharge())}),a()()}if(n&2){let e=l(3);r(),s("entity",e.selectedChargeToModify())("readOnly",!1)("disableBlur",!0)("onChangeDebounceTime",300)}}function cr(n,u){if(n&1){let e=y();d(0,"div",30)(1,"yon-entity-field",59),_("onChange",function(){p(e);let t=l(3);return m(t.changeInCharge())}),a()()}if(n&2){let e=l(3);r(),s("entity",e.selectedChargeToModify())("readOnly",!1)("disableBlur",!0)("onChangeDebounceTime",300)}}function ur(n,u){if(n&1){let e=y();d(0,"div",30)(1,"yon-entity-field",60),_("onChange",function(){p(e);let t=l(3);return m(t.changeInCharge())}),a()()}if(n&2){let e=l(3);r(),s("isRequired",!0)("entity",e.selectedChargeToModify().orderProductChargeDetails[0])("readOnly",!1)("disableBlur",!0)("onChangeDebounceTime",300)}}function pr(n,u){if(n&1){let e=y();d(0,"div",30)(1,"yon-entity-field",61),_("onChange",function(){p(e);let t=l(3);return m(t.changeInCharge())}),a()()}if(n&2){let e=l(3);r(),s("isRequired",!0)("entity",e.selectedChargeToModify())("readOnly",!1)("disableBlur",!0)("onChangeDebounceTime",300)}}function mr(n,u){if(n&1){let e=y();d(0,"yon-charge-tiers-table",63,3),_("tiersChanged",function(){p(e);let t=l(4);return m(t.changeInCharge())}),a()}if(n&2){let e,i=l(4);s("entityType",i.EntityTypes.Order)("orderProductChargeDetails",i.selectedChargeToModify().orderProductChargeDetails)("currencyCode",i.order.currency.code)("tierDecimalPrecision",((e=i.selectedChargeToModify())==null?null:e.tierDecimalPrecision)??0)}}function _r(n,u){if(n&1&&(d(0,"div",48)(1,"b"),c(2,"Charge tiers for"),a(),c(3),h(4,mr,2,4,"yon-charge-tiers-table",62),a()),n&2){let e,i=l(3);r(3),le(" ",i.selectedChargeToModify()?i.selectedChargeToModify().name:"Charge"," ",i.selectedChargeToModify()?i.selectedChargeToModify().chargeNumber:""," "),r(),C(!((e=i.orderProduct())!=null&&e.isFrameworkProduct)||(e=i.selectedChargeToModify())!=null&&e.isOverridenFrameworkProductCharge?4:-1)}}function gr(n,u){if(n&1){let e=y();d(0,"div",30)(1,"yon-entity-field",64),_("onChange",function(){p(e);let t=l(3);return m(t.changeInCharge())}),a()(),d(2,"div",30)(3,"yon-entity-field",65),_("onChange",function(){p(e);let t=l(3);return m(t.changeInCharge())}),a()()}if(n&2){let e,i=l(3);r(),s("entity",i.selectedChargeToModify())("readOnly",((e=i.orderSettings())==null?null:e.enableOrderBillingPeriod)&&
1(i.order==null?null:i.order.setBillingPeriodOnOrderLevel))("disableBlur",!0)("onChangeDebounceTime",300),r(2),s("entity",i.selectedChargeToModify())("readOnly",!1)("disableBlur",!0)("onChangeDebounceTime",300)}}function hr(n,u){if(n&1){let e=y();d(0,"yon-entity-field",66),_("onChange",function(t){p(e);let o=l(3);return o.changeInCharge(),m(o.specificBillingDayValue.set(t))}),a()}if(n&2){let e=l(3);s("isRequired",!0)("entity",e.selectedChargeToModify())("readOnly",!1)("disableBlur",!0)("onChangeDebounceTime",300)}}function Cr(n,u){if(n&1){let e=y();d(0,"yon-entity-field",67),_("onChange",function(t){p(e);let o=l(3);return o.changeInCharge(),m(o.offSetBillingDayValue.set(t))}),a()}if(n&2){let e=l(3);s("isRequired",!0)("entity",e.selectedChargeToModify())("readOnly",!1)("disableBlur",!0)("onChangeDebounceTime",300)}}function fr(n,u){if(n&1){let e=y();d(0,"div")(1,"div",43)(2,"h4",38)(3,"b"),c(4,"Charge details for"),a(),c(5),a(),h(6,dr,2,1,"yon-button",44),a(),h(7,lr,3,4,"div",10),d(8,"div",45)(9,"div",30)(10,"yon-entity-field",46),_("onChange",function(){p(e);let t=l(2);return m(t.changeInCharge())}),a()(),d(11,"div",30)(12,"yon-field",47),Y("ngModelChange",function(t){p(e);let o=l(2);return K(o.selectedChargeToModify().model,t)||(o.selectedChargeToModify().model=t),m(t)}),_("onChange",function(){p(e);let t=l(2);return m(t.onSyncChargeDetails())}),a()(),h(13,sr,2,4,"div",30),h(14,cr,2,4,"div",30),a(),d(15,"div",45),h(16,ur,2,5,"div",30),h(17,pr,2,5,"div",30),a(),b(18,"hr"),h(19,_r,5,3,"div",48),d(20,"h4",38)(21,"b"),c(22,"Charge financial configuration for"),a(),c(23),a(),d(24,"div",45),h(25,gr,4,8),d(26,"div",49)(27,"yon-entity-field",50),_("onChange",function(t){p(e);let o=l(2);return o.changeInCharge(),m(o.onBillingDayChange(t))}),a()(),d(28,"div",30),h(29,hr,1,5,"yon-entity-field",51),h(30,Cr,1,5,"yon-entity-field",52),a()(),d(31,"div",45)(32,"div",49)(33,"yon-entity-field",53),_("onChange",function(){p(e);let t=l(2);return m(t.changeInCharge())}),a()(),d(34,"div",49)(35,"yon-entity-field",54),_("onChange",function(){p(e);let t=l(2);return m(t.changeInCharge())}),a()(),d(36,"div",49)(37,"yon-entity-field",55),_("onChange",function(){p(e);let t=l(2);return m(t.changeInCharge())}),a()()()()}if(n&2){let e,i,t,o,g,f,T,A,bt,Ze,E=l(2);q("selected-charges__container",E.uiVersion()=="v3"),r(5),le(" ",E.selectedChargeToModify()?E.selectedChargeToModify().name:"Charge"," ",E.selectedChargeToModify()?E.selectedChargeToModify().chargeNumber:""," "),r(),C(E.modifiedCharges.has(E.selectedChargeToModify().id)?6:-1),r(),C(((e=E.orderProduct())==null?null:e.isFrameworkProduct)===!0?7:-1),r(),s("hidden",((i=E.orderProduct())==null?null:i.isFrameworkProduct)&&!!((i=E.selectedChargeToModify())!=null&&i.isOverridenFrameworkProductCharge)),r(2),s("entity",E.selectedChargeToModify())("readOnly",!1)("disableBlur",!0)("onChangeDebounceTime",300),r(2),s("data",E.selectedChargeToModify().filteredChargeModels),U("ngModel",E.selectedChargeToModify().model),s("title","Model")("isRequired",!0)("readOnly",!1)("disableBlur",!0)("onChangeDebounceTime",300),r(),C(E.showQuantityField()?13:-1),r(),C(((t=E.selectedChargeToModify())==null?null:t.model)===E.ChargeModels.Quantity||(t=E.selectedChargeToModify())!=null&&t.isVolumeOrTiered?14:-1),r(),s("hidden",((o=E.orderProduct())==null?null:o.isFrameworkProduct)===!0&&((o=E.selectedChargeToModify())==null?null:o.isOverridenFrameworkProductCharge)===!1),r(),C((g=E.selectedChargeToModify())!=null&&g.isFlatOrQuantity?16:-1),r(),C(((f=E.selectedChargeToModify())==null?null:f.chargeType)!==E.ChargeTypes.OneOff?17:-1),r(2),C((T=E.selectedChargeToModify())!=null&&T.isVolumeOrTiered?19:-1),r(4),le(" ",E.selectedChargeToModify()?E.selectedChargeToModify().name:"Charge"," ",E.selectedChargeToModify()?E.selectedChargeToModify().chargeNumber:""," "),r(),s("hidden",((A=E.orderProduct())==null?null:A.isFrameworkProduct)===!0&&((A=E.selectedChargeToModify())==null?null:A.isOverridenFrameworkProductCharge)===!1),r(),C(((bt=E.selectedChargeToModify())==null?null:bt.chargeType)!==E.ChargeTypes.OneOff?25:-1),r(2),s("isRequired",!0)("entity",E.selectedChargeToModify())("readOnly",!1)("disableBlur",!0)("onChangeDebounceTime",300),r(2),C(E.billingDays()==E.BillingDays.SpecificDay?29:-1),r(),C(E.billingDays()==E.BillingDays.DaysOffset?30:-1),r(),s("hidden",((Ze=E.orderProduct())==null?null:Ze.isFrameworkProduct)===!0&&((Ze=E.selectedChargeToModify())==null?null:Ze.isOverridenFrameworkProductCharge)===!1),r(2),s("entity",E.selectedChargeToModify())("readOnly",!1)("disableBlur",!0)("onChangeDebounceTime",300),r(2),s("entity",E.selectedChargeToModify())("readOnly",!1)("disableBlur",!0)("onChangeDebounceTime",300),r(2),s("entity",E.selectedChargeToModify())("readOnly",!1)("disableBlur",!0)("onChangeDebounceTime",300)}}function vr(n,u){n&1&&(d(0,"th",68),c(1,"Charge number"),a())}function yr(n,u){if(n&1&&(d(0,"td",69),c(1),a()),n&2){let e=u.$implicit;r(),S(" ",e==null?null:e.chargeNumber," ")}}function br(n,u){n&1&&(d(0,"th",68),c(1,"DESCRIPTION"),a())}function xr(n,u){if(n&1&&(d(0,"td",69),c(1),a()),n&2){let e=u.$implicit;r(),L(e==null?null:e.name)}
1}function Dr(n,u){n&1&&(d(0,"th",68),c(1,"CHARGE TYPE"),a())}function wr(n,u){if(n&1&&(d(0,"td",69),c(1),a()),n&2){let e=u.$implicit,i=l(2);r(),L(i.ChargeTypes[e==null?null:e.chargeType])}}function Sr(n,u){n&1&&(d(0,"th",70),c(1,"STATUS"),a())}function Tr(n,u){if(n&1&&(d(0,"td",71),c(1),a()),n&2){let e=u.$implicit,i=l(2);r(),S(" ",i.ChargeChangeStates[e==null?null:e.changeState]," ")}}function Or(n,u){n&1&&(d(0,"th",70),c(1,"EFFECTIVE START"),a())}function Mr(n,u){if(n&1&&(d(0,"td",71),c(1),z(2,"dateFormat"),a()),n&2){let e=u.$implicit;r(),S(" ",ee(2,1,e==null?null:e.effectiveStartDate,"shortDate")," ")}}function Pr(n,u){n&1&&(d(0,"th",70),c(1,"EFFECTIVE END"),a())}function Er(n,u){if(n&1&&(d(0,"td",71),c(1),z(2,"dateFormat"),a()),n&2){let e=u.$implicit;r(),S(" ",ee(2,1,e==null?null:e.effectiveEndDate,"shortDate")," ")}}function kr(n,u){n&1&&(d(0,"th",72),c(1,"PRICE"),a())}function Nr(n,u){if(n&1&&(d(0,"td",73),c(1),z(2,"number"),a()),n&2){let e=u.$implicit;r(),S(" ",ee(2,1,e==null?null:e.displayPrice,"1.2")," ")}}function Vr(n,u){n&1&&b(0,"tr",74)}function Ir(n,u){n&1&&b(0,"tr",75)}function Fr(n,u){if(n&1){let e=y();d(0,"section"),h(1,ir,3,4,"div",5),d(2,"yon-card",6)(3,"yon-card-header-right"),h(4,nr,2,1,"yon-button",7),a(),d(5,"yon-card-header-menu"),b(6,"yon-entity-table-menu-buttons",8),a(),d(7,"yon-entity-table",9,2),_("selectionChanged",function(t){p(e);let o=l();return m(o.onChargeModifySelected(t))}),a(),d(9,"div"),h(10,ar,3,2,"div",10),b(11,"hr"),h(12,fr,38,48,"div",11),b(13,"hr",12),d(14,"div",13)(15,"span",12)(16,"p"),c(17),a(),d(18,"table",14),xe(19,15),M(20,vr,2,0,"th",16)(21,yr,2,1,"td",17),De(),xe(22,18),M(23,br,2,0,"th",16)(24,xr,2,1,"td",17),De(),xe(25,19),M(26,Dr,2,0,"th",16)(27,wr,2,1,"td",17),De(),xe(28,20),M(29,Sr,2,0,"th",21)(30,Tr,2,1,"td",22),De(),xe(31,23),M(32,Or,2,0,"th",21)(33,Mr,3,4,"td",22),De(),xe(34,24),M(35,Pr,2,0,"th",21)(36,Er,3,4,"td",22),De(),xe(37,25),M(38,kr,2,0,"th",26)(39,Nr,3,4,"td",27),De(),M(40,Vr,1,0,"tr",28)(41,Ir,1,0,"tr",29),a()(),d(42,"span",12)(43,"p"),c(44,"No credit charges will be generated"),a(),d(45,"small"),c(46),z(47,"dateFormat"),a()()(),d(48,"div",30)(49,"span",31)(50,"small")(51,"b"),c(52,"TCV"),a(),d(53,"p",32),c(54),z(55,"number"),a(),d(56,"p",32),c(57),z(58,"number"),a(),c(59," Change amount : "),d(60,"span",33),c(61),z(62,"number"),a()()()()(),d(63,"div",34)(64,"yon-button",35),_("onClick",function(){p(e);let t=l();return m(t.previewModifyOrderProduct())}),c(65," PREVIEW "),a(),d(66,"yon-button",36),_("onClick",function(){p(e);let t=l();return m(t.modifyOrderProduct())}),c(67," MODIFY PRODUCT "),a()()()()}if(n&2){let e,i=x(8),t=l();q("dialog__container",t.uiVersion()=="v3"),r(),C(t.uiVersion()=="v3"?1:-1),r(),q("charges__container",t.uiVersion()=="v3"),r(2),C(t.modifiedCharges.size>0?4:-1),r(2),s("entityTable",i),r(),s("defaultFields",he(47,Ko))("conditions",Ye(51,Xo,Te(48,Yo,(e=t.orderProduct())==null?null:e.id),he(50,Jo)))("alwaysSelectFirst",!0)("defaultPageSize",5),r(3),C(t.uiVersion()=="v2"?10:-1),r(2),C(t.selectedChargeToModify()?12:-1),r(),s("hidden",!t.isPreviewModifyOrderProduct()),r(2),s("hidden",!t.showCreditChargesPreview()),r(2),le(" The following credit charges will be on order version ",(t.order==null?null:t.order.version)+1," (current ",t.order==null?null:t.order.version,"). "),r(),s("dataSource",t.creditChargePreview),r(22),s("matHeaderRowDef",t.displayedColumnsForCreditChargePreview),r(),s("matRowDefColumns",t.displayedColumnsForCreditChargePreview),r(),s("hidden",!t.noCreditMessage()),r(4),le(" Changes will take effect on ",ee(47,35,t.effectiveChangeDateForOrderProduct(),"shortDate"),". Order version ",(t.order==null?null:t.order.version)+1," will be created. "),r(3),s("hidden",!t.isPreviewModifyOrderProduct()),r(5),le(" Current : ",ee(55,38,t.roundedTcvOld(),"1.2-2")," ",t.currencyCodeTCV()," "),r(3),le(" After changes : ",ee(58,41,t.roundedTcvNew(),"1.2-2")," ",t.currencyCodeTCV()," "),r(3),s("ngStyle",Te(54,Zo,t.roundedTcvDiff()==0?"black":t.roundedTcvDiff()>0?"green":"red")),r(),le(" ",ee(62,44,t.roundedTcvDiff(),"1.2-2")," ",t.currencyCodeTCV()," "),r(3),s("disabled",t.disablePreview())("hidden",t.isPreviewModifyOrderProduct()),r(2),s("hidden",!t.isPreviewModifyOrderProduct())("disabled",t.isLoading())}}var ro=(()=>{class n{constructor(){this.uiService=O(Ft),this.ChargeTypes=we,this.ChargeChangeStates=Ce,this.ChargeModels=di,this.BillingPeriods=T
1i,this.TermTypes=Ei,this.ChargePricePeriods=Oi,this.EntityTypes=Et,this.OrderTypes=J,this.BillingDays=ht,this.orderProduct=v(void 0),this.selectedChargeToModify=v(void 0),this.effectiveChangeDateForOrderProduct=v(new Date),this.roundedTcvDiff=v(0),this.roundedTcvNew=v(0),this.roundedTcvOld=v(0),this.currencyCodeTCV=v(""),this.orderToModify=v(void 0),this.orderSettings=v(void 0),this.isPreviewModifyOrderProduct=v(!1),this.showCreditChargesPreview=v(!1),this.noCreditMessage=v(!1),this.isLoading=v(!1),this.billingDays=v(0),this.specificBillingDayValue=v(0),this.offSetBillingDayValue=v(0),this.dialogHeaderText=v(""),this.previewOrderProduct=v(void 0),this.creditChargePreview=new Ut,this.displayedColumnsForCreditChargePreview=["chargeNumber","name","chargeType","changeState","effectiveStartDate","effectiveEndDate","price"],this.newOrderWithChanges=v(null),this.modifiedCharges=new Map,this.originalCharges=new Map,this.uiVersion=v(this.uiService.getUiVersion()),this.router=O(fe),this.orderService=O(H),this.notificationService=O(j),this.dialogService=O(se),this.showDialog=e=>{if(this.isLoading.set(!0),this.orderProduct.set(this.order.orderProducts.find(t=>t.id===e.id)),this.setOriginalCharges(),this.dialogHeaderText.set(`Modify product - ${this.orderProduct()?.name} ${this.orderProduct()?.productNumber}`),!this.validate())return;this.orderService.orderSettings().pipe(F(1)).subscribe(t=>this.orderSettings.set(t));let i=this.orderProduct()?.charges[0].billingDay;this.billingDays.set(i),this.order.orderType===J.SalesOrder&&this.effectiveChangeDateForOrderProduct.set(this.order.orderDate),this.dialog.show()},this.disablePreview=P(()=>{let e=this.billingDays()==ht.SpecificDay,i=this.billingDays()==ht.DaysOffset;if(!this.selectedChargeToModify())return"Select a charge";if(!this.modifiedCharges.size)return"No changes made";if(!this.effectiveChangeDateForOrderProduct())return"Invalid change date";if(this.effectiveChangeDateForOrderProduct()<this.order.effectiveStartDate)return"Effective change date cannot be before effective start date";if(this.isLoading())return!0;if(!this.billingDays()&&this.billingDays()!==0)return"Billing Day must have a value";let t=["model","pricePeriod","billingPeriod","periodAlignment","revenueRecognitionRuleId","deferredRevenueId","recognizedRevenueId"],o=e&&this.specificBillingDayValue()==null,g=i&&this.offSetBillingDayValue()==null,f=this.selectedChargeToModify().orderProductChargeDetails[0].price.amount==null;return t.some(T=>this.selectedChargeToModify()[T]===void 0)||o||g||f?"Required fields must have values":!1}),this.showQuantityField=P(()=>{let e=this.selectedChargeToModify();return!(!e||e.model===di.Flat||e.chargeType===we.Usage||e.chargeType===we.Measured||e.isPartitalDelivery&&e.chargeType!==we.Recurring)})}
1get sortedChargeDetails(){if(this.selectedChargeToModify()?.orderProductChargeDetails)return this.selectedChargeToModify().orderProductChargeDetails.sort((e,i)=>e.tier<i.tier?-1:1)}onChargeModifySelected(e){if(!e){this.selectedChargeToModify.set(void 0);return}this.isLoading.set(!0);let i=this.modifiedCharges.get(e.id);if(i)this.selectedChargeToModify.set(i);else{let o=this.orderProduct().charges.find(g=>g.id===e.id);this.selectedChargeToModify.set(o)}this.isLoading.set(!1)}setOriginalCharges(){this.originalCharges.clear();let e=this.order.orderProducts.find(i=>i.id===this.orderProduct().id);e&&e.charges.forEach(i=>{let t=new Ct(Ee.deepCopy(i));this.originalCharges.set(i.id,t)})}validate(){return this.order?.isLastVersion?!0:(this.notificationService.error("Can only modify/cancel product on last version of order"),!1)}previewModifyOrderProduct(){if(this.newOrderWithChanges.set(JSON.parse(JSON.stringify(this.order))),this.newOrderWithChanges().orderType===J.SalesOrder&&this.effectiveChangeDateForOrderProduct.set(this.newOrderWithChanges().orderDate),this.effectiveChangeDateForOrderProduct()<this.newOrderWithChanges().effectiveStartDate){this.notificationService.error("Effective change date cannot be before effective start date");return}if(this.chargeTiersTable&&!this.chargeTiersTable.validateTiers())return;let e=this.newOrderWithChanges().orderProducts.find(i=>i.id===this.orderProduct().id);e.charges=e.charges.map(i=>{let t=this.modifiedCharges.get(i.id);return t||i}),this.orderToModify.set(this.newOrderWithChanges()),this.orderToModify().effectiveChangeDate=this.effectiveChangeDateForOrderProduct(),this.isLoading.set(!0),this.chargeTiersTable&&this.chargeTiersTable.isLoading.set(!0),this.orderService.getInvoicePreview(this.orderToModify()).pipe(F(1),te(()=>{this.isLoading.set(!1),this.chargeTiersTable&&this.chargeTiersTable.isLoading.set(!1)})).subscribe({next:i=>{this.previewOrderProduct.set(i.orderProducts.find(t=>t.id===this.orderProduct().id)),this.previewOrderProduct().charges=this.previewOrderProduct().charges.filter(t=>t.changeState===Ce.Credit),this.previewOrderProduct().charges.length>0?(this.creditChargePreview.data=this.previewOrderProduct().charges,this.showCreditChargesPreview.set(!0),this.noCreditMessage.set(!1)):(this.creditChargePreview.data=[],this.showCreditChargesPreview.set(!1),this.noCreditMessage.set(!0)),this.isPreviewModifyOrderProduct.set(!0),this.roundedTcvOld.set(Vt.round(this.newOrderWithChanges().tcv.amount,2)),this.roundedTcvDiff.set(Vt.round(i.tcv.amount-this.newOrderWithChanges().tcv.amount,2)),this.roundedTcvNew.set(Vt.round(i.tcv.amount,2)),this.currencyCodeTCV.set(i.tcv.currencyCode)},error:i=>{this.isPreviewModifyOrderProduct.set(!1),this.showCreditChargesPreview.set(!1),this.noCreditMessage.set(!1),this.notificationService.error(i.error.message)}})}modifyOrderProduct(){this.isLoading.set(!0),this.orderService.create(this.orderToModify()).pipe(F(1),te(()=>{this.isLoading.set(!1),this.orderProduct.set(void 0)})).subscribe({next:e=>{e&&(this.selectedChargeToModify.set(void 0),this.order=e,this.router.navigate(["/orders",e.id]),this.dialog.close())},error:e=>{this.notificationService.error(e.error.message)}})}changeInCharge(){this.triggerValidation(),this.setResetValues()}onBillingDayChange(e){this.billingDays.set(e),e==ht.DaysOffset?(this.selectedChargeToModify().offsetBillingDays=0,this.offSetBillingDayValue.set(0)):this.selectedChargeToModify().offsetBillingDays=void 0}triggerValidation(){let e=new Ct(ae({},this.selectedChargeToModify()));this.selectedChargeToModify.set(e),this.modifiedCharges.set(e.id,e)}
1onSyncChargeDetails(){if(this.changeInCharge(),!(this.selectedChargeToModify().orderProductChargeDetails?.length>0)){let e=new Fi({price:new Xe({amount:0,currencyCode:this.order.currency.code}),listPrice:new Xe({amount:0,currencyCode:this.order.currency.code}),lineDiscountAmount:new Xe({amount:0,currencyCode:this.order.currency.code})});this.selectedChargeToModify().orderProductChargeDetails=[e]}}resetAllCharges(e=!1){return V(this,null,function*(){if(!(e&&!(yield this.dialogService.confirmYesNo("Reset all charges?")))){if(this.resetAllChargeValues(),this.modifiedCharges.clear(),this.selectedChargeToModify()?.id){let i=this.selectedChargeToModify().id,t=this.orderProduct().charges.find(o=>o.id===i);t&&this.selectedChargeToModify.set(t)}this.setResetValues()}})}resetAllChargeValues(){if(!this.orderProduct())return;let e=this.orderProduct(),i=e.charges.map(g=>{let f=this.originalCharges.get(g.id);return f?new Ct(Ee.deepCopy(f)):g}),t=Ee.deepCopy(e);t.charges=i,this.orderProduct.set(t);let o=this.order.orderProducts.find(g=>g.id===e.id);o&&(o.charges=i)}resetSelectedCharge(){let e=this.selectedChargeToModify()?.id;if(!e){this.notificationService.warning("No charge selected to reset");return}let i=this.originalCharges.get(e);if(!i){this.notificationService.warning("No charge found to reset");return}let t=new Ct(Ee.deepCopy(i));this.modifiedCharges.delete(e),this.selectedChargeToModify.set(t),this.resetChargeInOrderProduct(e,t),this.setResetValues()}resetChargeInOrderProduct(e,i){let t=this.orderProduct(),o=t.charges.map(f=>f.id===e?i:f),g=Ee.deepCopy(t);g.charges=o,this.orderProduct.set(g)}onEffectiveChangeDateChange(e){this.effectiveChangeDateForOrderProduct.set(e),this.isPreviewModifyOrderProduct.set(!1),this.noCreditMessage.set(!1)}setResetValues(){this.isPreviewModifyOrderProduct.set(!1),this.showCreditChargesPreview.set(!1),this.noCreditMessage.set(!1),this.roundedTcvOld.set(0),this.roundedTcvDiff.set(0),this.roundedTcvNew.set(0)}static{this.\u0275fac=function(i){return new(i||n)}}static{this.\u0275cmp=I({type:n,selectors:[["yon-modify-product-dialog"]],viewQuery:function(i,t){if(i&1&&B(Wo,5)(Uo,5),i&2){let o;D(o=w())&&(t.dialog=o.first),D(o=w())&&(t.chargeTiersTable=o.first)}},inputs:{order:"order"},decls:4,vars:4,consts:[["dialog",""],["dialogContent",""],["chargeModifyTable",""],["chargeTiersTable",""],["dialogSize","xxl",3,"onClose","header","isLoading","containerTemplate","customClass"],[1,"row",3,"head__container"],["header","Charges","headerFontSize","sm","headerFontWeight","bold"],["buttonIcon","restart_alt",3,"disabled"],["exportFileName","Charges",3,"entityTable"],["entity","orderproductcharge","viewName","modify-product-dialog-charges",3,"selectionChanged","defaultFields","conditions","alwaysSelectFirst","defaultPageSize"],[1,"row"],[3,"selected-charges__container"],[3,"hidden"],[1,"flex","flex-column"],["mat-table","",1,"mat-elevation-z8",2,"width","100%","transition","none !important","box-shadow","none !important","padding","10px","margin-bottom","30px",3,"dataSource"],["matColumnDef","chargeNumber"],["mat-header-cell","",4,"matHeaderCellDef"],["mat-cell","",4,"matCellDef"],["matColumnDef","name"],["matColumnDef","chargeType"],["matColumnDef","changeState"],["style","text-align: right","mat-header-cell","",4,"matHeaderCellDef"],["style","text-align: right","mat-cell","",4,"matCellDef"],["matColumnDef","effectiveStartDate"],["matColumnDef","effectiveEndDate"],["matColumnDef","price"],["class","price-column-header","mat-header-cell","",4,"matHeaderCellDef"],["class","price-column-cell","mat-cell","",4,"matCellDef"],["mat-header-row","",4,"matHeaderRowDef"],["mat-row","",4,"matRowDef","matRowDefColumns"],[1,"col-md-3"],[2,"white-space","pre-wrap",3,"hidden"],[2,"margin-bottom","0px"],[3,"ngStyle"],[1,"flex","justify-end"],["color","primary",3,"onClick","disabled","hidden"],["mat-raised-button","","color","primary",3,"onClick","hidden","disabled"],[1,"col-md-12","row"],[1,"mb-1"],[1,"col-md-4"],["type","date",3,"ngModelChange","title","ngModel","isRequired"],[1,"col-md-12","mb-1"],["buttonIcon","restart_alt",3,"onClick","disabled"],[1,"flex","justify-space-between"],[3,"disabled"],[1,"row",3,"hidden"],["entityName","orderproductcharge","fieldName","name",3,"onChange","entity","readOnly","disableBlur","onChangeDebounceTime"],["textField","displayValue","valueField","id","type","select",3,"ngModelChange","onChange","data","ngModel","title","isRequired","readOnly","disableBlur","onChangeDebounceTime"],[2,"margin-bottom","30px"],[1,"col-md-3","mb-1"],["entityName","orderproductcharge","fieldName","billingDay",3,"onChange","isRequired","entity","readOnly","disableBlur","onChangeDebounceTime"],["entityName","orderproductcharge","fieldName","specificBillingDay",3,"isRequired","entity","readOnly","disableBlur","onChangeDebounceTime"],["entityName","orderproductcharge","fieldName","offsetBillingDays",3,"isRequired","entity","readOnly","disableBlur","onChangeDebounceTime"],["entityName","orderproductcharge","fieldName","revenueRecognitionRuleId",3,"onChange","entity","readOnly","disableBlur","onChangeDebounceTime"],["entityName","orderproductcharge","fieldName","deferredRevenueId",3,"onChange","entity","readOnly","disableBlur","onChangeDebounceTime"],["entityName","orderproductcharge","fieldName","recognizedRevenueId",3,"onChange","entity","readOnly","disableBlur","onChangeDebounceTime"],[3,"onClick","disabled"],["entityName","orderproductcharge","fieldName","isOverridenFrameworkProductCharge",3,"onChange","entity","readOnly","disableBlur","onChangeDebounceTime"],["entityName","orderproductcharge","fieldName","quantity",3,"onChange","entity","readOnly","disableBlur","onChangeDebounceTime"],["entityName","orderproductcharge","fieldName","unitOfMeasureId",3,"onChange","entity","readOnly","disableBlur","onChangeDebounceTime"],["entityName","orderproductchargedetails","fieldName","price",3,"onChange","isRequired","entity","readOnly","disableBlur","onChangeDebounceTime"],["entityName","orderproductcharge","fieldName","pricePeriod",3,"onChange","isRequired","entity","readOnly","disableBlur","onChangeDebounceTime"],["editableFields","all",3,"entityType","orderProductChargeDetails","currencyCode","tierDecimalPrecision"],["editableFields","all",3,"tiersChanged","entityType","orderProductChargeDetails","currencyCode","tierDecimalPrecision"],["entityName","orderproductcharge","fieldName","billingPeriod",3,"onChange","entity","readOnly","disableBlur","onChangeDebounceTime"],["entityName","orderproductcharge","fieldName","periodAlignment",3,"onChange","entity","readOnly","disableBlur","onChangeDebounceTime"],["entityName","orderproductcharge","fieldName","specificBillingDay",3,"onChange","isRequired","entity","readOnly","disableBlur","onChangeDebounceTime"],["entityName","orderproductcharge","fieldName","offsetBillingDays",3,"onChange","isRequired","entity","readOnly","disableBlur","onChangeDebounceTime"],["mat-header-cell",""],["mat-cell",""],["mat-header-cell","",2,"text-align","right"],["mat-cell","",2,"text-align","right"],["mat-header-cell","",1,"price-column-header"],["mat-cell","",1,"price-column-cell"],["mat-header-row",""],["mat-row",""]],template:function(i,t){if(i&1){let o=y();d(0,"yon-dialog-center",4,0),_("onClose",function(){return p(o),t.selectedChargeToModify.set(void 0),m(t.resetAllCharges())}),a(),M(2,Fr,68,56,"ng-template",null,1,R)}if(i&2){let o=x(3);s("header",t.dialogHeaderText())("isLoading",t.isLoading())("containerTemplate",o)("customClass",t.uiVersion()=="v3"&&!t.uiService.darkMode()?"layout-bg-color":"")}},dependencies:[Le,wi,$,X,Z,Yi,Lt,jt,zt,qt,Bt,$t,Qt,Gt,Ht,Wt,oe,ze,ti,Q,ei,ni,ve,st,qn,ie,Si,ke],styles:['section.dialog__container[_ngcontent-%COMP%]   .head__container[_ngcontent-%COMP%]{padding-top:1rem;padding-left:20px;padding-bottom:5px;border:1px solid var(--color-inverted-contrast-medium);border-radius:var(--layout-card-radius)}section.dialog__container[_ngcontent-%COMP%]   .head__container[_ngcontent-%COMP%]   yon-field[_ngcontent-%COMP%]     .field-title{font-size:14px;color:var(--color-mono-contrast-high);font-weight:400;padding-bottom:5px}section.dialog__container[_ngcontent-%COMP%]   .head__container[_ngcontent-%COMP%]   yon-field[_ngcontent-%COMP%]     kendo-dateinput input{background-color:var(--layout-bg-color-card)!important}section.dialog__container[_ngcontent-%COMP%]   .charges__container[_ngcontent-%COMP%]{margin-top:var(--layout-card-padding);background-color:var(--layout-bg-color-card);display:block;padding:var(--layout-card-padding);border-radius:var(--layout-card-radius);padding-bottom:0;margin-bottom:-1rem}section.dialog__container[_ngcontent-%COMP%]   .charges__container[_ngcontent-%COMP%]   yon-entity-table[_ngcontent-%COMP%]     .entity-table__container{overflow:auto}section.dialog__container[_ngcontent-%COMP%]   .charges__container[_ngcontent-%COMP%]   yon-entity-table[_ngcontent-%COMP%]     .entity-table__container mat-row.selected mat-cell, section.dialog__container[_ngcontent-%COMP%]   .charges__container[_ngcontent-%COMP%]   yon-entity-table[_ngcontent-%COMP%]     .entity-table__container mat-row:hover mat-cell{background-color:var(--color-bg-table-drilled-level1)}section.dialog__container[_ngcontent-%COMP%]   .charges__container[_ngcontent-%COMP%]   yon-entity-table[_ngcontent-%COMP%]     .entity-table__container mat-row mat-cell:first-child, section.dialog__container[_ngcontent-%COMP%]   .charges__container[_ngcontent-%COMP%]   yon-entity-table[_ngcontent-%COMP%]     .entity-table__container mat-row mat-header-cell:first-child{padding-left:25px}section.dialog__container[_ngcontent-%COMP%]   .charges__container[_ngcontent-%COMP%]   .selected-charges__container[_ngcontent-%COMP%]{background-color:var(--color-bg-table-drilled-level1);border-radius:var(--layout-card-radius);padding:var(--layout-card-padding);margin-bottom:1rem}section.dialog__container[_ngcontent-%COMP%]   .charges__container[_ngcontent-%COMP%]   .selected-charges__container[_ngcontent-%COMP%] > h4[_ngcontent-%COMP%]{padding-left:12px}section.dialog__container[_ngcontent-%COMP%]   .charges__container[_ngcontent-%COMP%]     mat-row.selected mat-cell:first-child:before, section.dialog__container[_ngcontent-%COMP%]   .selected-charges__container[_ngcontent-%COMP%] > h4[_ngcontent-%COMP%]:before{content:"";width:3px;display:block;height:12px;margin-top:14px;margin-bottom:-26px;margin-left:-12px;background-color:#32cd32}section.dialog__container[_ngcontent-%COMP%]   .selected-charges__container[_ngcontent-%COMP%] > h4[_ngcontent-%COMP%]:before{margin-bottom:-18px}.price-column-header[_ngcontent-%COMP%], .price-column-cell[_ngcontent-%COMP%]{text-align:right;padding-right:20px}'],changeDetection:0})}}return n})();var Ar=(n,u)=>u.id;function Rr(n,u){if(n&1&&(d(0,"div",3)(1,"small"),c(2,"Effective date:"),a()(),d(3,"div",3)(4,"small"),c(5),z(6,"date"),a()()),n&2){let e=l().$implicit;r(5),L(_t(6,1,e==null?null:e.effectiveChangeDate))}}function Lr(n,u){n&1&&b(0,"mat-divider")}function Br(n,u){if(n&1&&(d(0,"li")(1,"div",2)(2,"div",3)(3,"a",4),c(4),a()(),d(5,"div",3)(6,"small"),c(7),z(8,"date"),a()(),h(9,Rr,7,3),a(),h(10,Lr,1,0,"mat-divider"),a()),n&2){let e=u.$implicit,i=u.$index,t=u.$count;r(),q("mt-1",i!==0)("mb-1",i!==t-1),r(2),s("routerLink","/orders/"+e.id),r(),S(" Version ",e.version," "),r(3),L(_t(8,9,e==null?null:e.created)),r(2),C(i!==0?9:-1),r(),C(i!==t-1?10:-1)}}var ao=(()=>{class n{constructor(){this.orderService=O(H),this.notificationService=O(j),this.queryService=O(lt),this.orderNumber=Ie(),this.onVersionsLoadedEmitLastId=new ne,this.orderVersions=v([]),Ke(()=>{this.orderNumber()&&this.loadOrderVersions()})}
1loadOrderVersions(){this.queryService.query({entity:"order",displayFields:["version","effectiveChangeDate","created"],conditions:[{fieldName:"orderNumber",value:this.orderNumber()}]}).pipe(Re(e=>e.result),F(1)).subscribe({next:e=>{let i=e.sort((t,o)=>t.version-o.version);if(this.orderVersions.set(i),i.length>0){let t=i[i.length-1];this.onVersionsLoadedEmitLastId.emit(t.id)}},error:()=>{this.notificationService.error("Failed to load Order versions")}})}static{this.\u0275fac=function(i){return new(i||n)}}static{this.\u0275cmp=I({type:n,selectors:[["yon-order-versions-card"]],inputs:{orderNumber:[1,"orderNumber"]},outputs:{onVersionsLoadedEmitLastId:"onVersionsLoadedEmitLastId"},decls:4,vars:0,consts:[["header","Versions"],[1,"scrollable-when-high","mb-0"],[1,"row"],[1,"col-sm-6","col-lg-3","col-xl-12","col-xxl-6"],["href","#",2,"font-size","14px",3,"routerLink"]],template:function(i,t){i&1&&(d(0,"yon-card",0)(1,"ul",1),_e(2,Br,11,11,"li",null,Ar),a()()),i&2&&(r(2),ge(t.orderVersions()))},dependencies:[rt,ot,G,Be,ze,Ot],encapsulation:2})}}return n})();var jr=["dialog"],qr=["stepper"],Qr=["effectiveEndDateField"],Gr=["customDatesTable"],zr=["customDateDialog"],$r=()=>[5];function Hr(n,u){if(n&1&&c(0),n&2){let e=l(2);S(" ",e.mode()===e.CancellationCardMode.Cancellation?"Set cancellation":"Set new end date"," ")}}function Wr(n,u){if(n&1){let e=y();d(0,"yon-button",41),_("onClick",function(){p(e);let t=l(2);return m(t.toggleCreditTable())}),a()}if(n&2){let e=l(2);q("collapsed",e.isCollapsed()),s("buttonIcon",e.isCollapsed()?"keyboard_double_arrow_down":"keyboard_double_arrow_up")("size",35)("weight",300)("tooltip",e.isCollapsed()?"Expand preview section":"Collapse preview section")}}function Ur(n,u){if(n&1&&(d(0,"div")(1,"i",42),c(2),a()()),n&2){let e=l(2);r(2),S(" ",e.mode()===e.CancellationCardMode.Cancellation?"No credits will be made from this cancellation":"No credits charges will be applied for this change"," ")}}function Kr(n,u){n&1&&b(0,"yon-icon",43)}function Yr(n,u){n&1&&b(0,"yon-icon",44)}function Jr(n,u){if(n&1){let e=y();d(0,"mat-stepper",10,4)(2,"mat-step"),M(3,Hr,1,1,"ng-template",11),d(4,"mat-radio-group",12,5),_("change",function(t){p(e);let o=l();return m(o.onOuterRadioGroupChanged(t.value))}),d(6,"mat-radio-button",13),c(7),a(),d(8,"div",14)(9,"yon-field",15,6),_("ngModelChange",function(t){p(e);let o=l();return m(o.selectedEffectiveEndDate.set(t))})("onBlur",function(){p(e);let t=l();return t.cancellationMode.set("sameDateForAllCharges"),m(t.cancelOrderRequest().cancellationMode=t.CancelOrderModes.OnOrderCancellationDate)}),a()(),d(11,"mat-radio-button",16),c(12),a()(),d(13,"div",17)(14,"mat-radio-group",18),_("change",function(){p(e);let t=l();return m(t.onCancellationModeChange())})("ngModelChange",function(t){p(e);let o=l();return m(o.cancelOrderRequest().cancellationMode=t)}),d(15,"mat-radio-button",16)(16,"span",19),c(17," On each invoiced to date "),a()(),d(18,"mat-radio-button",16)(19,"span",20),c(20," On each effective end date "),a()(),d(21,"mat-radio-button",16)(22,"span",21),c(23," On custom dates "),a()()(),d(24,"div",22)(25,"i",23),c(26,"Click on each row to change end date for charge"),a(),d(27,"yon-entity-table",24,7),_("selectionChanged",function(t){p(e);let o=l();return m(o.customDateDialogOpen()?void 0:o.openChargeEndDateDialog(t))}),a()()(),d(29,"div",25)(30,"yon-button",26),_("onClick",function(){p(e);let t=l();return m(t.onNextClick())}),c(31," NEXT "),a()()(),d(32,"mat-step",27)(33,"div",28)(34,"yon-entity-table-card",29),b(35,"yon-entity-table",30),d(36,"span",31),h(37,Wr,1,6,"yon-button",32),a()()(),h(38,Ur,3,1,"div"),d(39,"div",33)(40,"yon-field",34),_("ngModelChange",function(t){p(e);let o=l();return m(o.cancelOrderRequest().cancellationDate=t)}),a()(),d(41,"div",35)(42,"yon-button",36),_("onClick",function(){p(e);let t=x(1);return m(t.previous())}),c(43," BACK "),a(),d(44,"div")(45,"yon-button",37),_("onClick",function(){p(e);let t=l();return m(t.onConfirmCancelClick())}),c(46),a(),d(47,"yon-button",38),_("onClick",function(){p(e),l();let t=x(1);return m(t.close())}),c(48,"DISCARD"),a()()()(),M(49,Kr,1,0,"ng-template",39)(50,Yr,1,0,"ng-template",40),a()}if(n&2){let e,i,t,o,g=l();s("linear",!0),r(6),s("checked",!0)("value","sameDateForAllCharges"),r(),S(" ",g.mode()===g.CancellationCardMode.Cancellation?"Cancel with a fixed end date for all charges":"Set a new end date for all charges"," "),r(2),s("ngModel",g.selectedEffectiveEndDate())("min",g.dayBeforeOrderStartDate())("max",g.maxEffectiveEndDate())("isRequired",!0)("disabled",g.cancellationMode()!=="sameDateForAllCharges"),r(2),s("value","differentDateForAllCharges"),r(),S(" ",g.mode()===g.CancellationCardMode.Cancellation?"Cancel with different end date for individual charges":"Set a new end date for individual charges"," "),r(2),s("ngModel",g.cancelOrderRequest
1().cancellationMode)("disabled",g.cancellationMode()!=="differentDateForAllCharges"),r(),s("value",g.CancelOrderModes.OnChargesInvoiceToDates),r(3),s("value",g.CancelOrderModes.OnChargesEffectiveEndDates),r(3),s("value",g.CancelOrderModes.OnCustomDates),r(3),s("hidden",g.cancelOrderRequest().cancellationMode!==g.CancelOrderModes.OnCustomDates),r(3),s("isManualData",!0),r(3),s("disabled",g.invalidCancelDate()||g.isLoading()),r(3),s("hidden",!(((e=g.newCreditCharges())==null?null:e.length)>0)),r(),s("header",g.getheaderText())("subheader",g.getSubHeaderText())("hideCardHeaderMenu",!0),r(),q("cancel-order-table-collapsed",g.isCollapsed()),s("defaultFields",g.tableDefaultFields())("isManualData",!0)("manualTableData",g.newCreditCharges())("customPageSize",5)("customPaginatorSize",((i=g.newCreditCharges())==null?null:i.length)>=5?he(43,$r):null)("showFirstLastButtons",!1),r(2),C(((t=g.newCreditCharges())==null?null:t.length)>=5?37:-1),r(),C(!g.newCreditCharges()||g.newCreditCharges().length===0?38:-1),r(),q("cancellation",((o=g.newCreditCharges())==null?null:o.length)>0),r(),s("title",g.mode()===g.CancellationCardMode.Cancellation?"Cancellation date":"Booking effective date")("tooltip",g.mode()===g.CancellationCardMode.Cancellation?"Enter date when cancellation was received, used for booking and reporting":"Enter the booking effective date for the new end date, used for booking and reporting")("ngModel",g.cancelOrderRequest().cancellationDate)("isRequired",!0),r(2),s("disabled",g.isLoading()),r(3),s("disabled",!g.cancelOrderRequest().cancellationDate||g.isLoading()),r(),S(" ",g.mode()===g.CancellationCardMode.Cancellation?"CONFIRM CANCELLATION":"CONFIRM NEW END DATES"," "),r(),s("disabled",g.isLoading())}}function Xr(n,u){if(n&1){let e=y();d(0,"p"),c(1," Set "),d(2,"i"),c(3,"effective end date"),a(),c(4),a(),d(5,"div",33)(6,"yon-field",45),_("ngModelChange",function(t){p(e);let o=l();return m(o.selectedChargeCancellationDate.set(t))}),a()(),d(7,"div",46)(8,"yon-button",37),_("onClick",function(){p(e);let t=l();return m(t.onSaveChargeEndDate())}),c(9," SAVE "),a(),d(10,"yon-button",47),_("onClick",function(){p(e);let t=l();return m(t.onCancelChargeEndDate())}),c(11,"CANCEL"),a()()}if(n&2){let e,i=l();r(4),S(" for charge ",(e=i.selectedCharge())==null?null:e.chargeNumber," "),r(2),s("title","Charge effective end date")("min",i.dayBeforeOrderStartDate())("max",i.selectedChargeMaxEndDate())("ngModel",i.selectedChargeCancellationDate())("isRequired",!0),r(2),s("disabled",i.invalidCustomDate())}}var Se=(function(n){return n[n.Cancellation=0]="Cancellation",n[n.Shortening=1]="Shortening",n})(Se||{}),so=(()=>{class n{constructor(e,i,t,o,g,f){this.router=e,this.orderService=i,this.bookingService=t,this.notificationService=o,this.fieldConfigurationService=g,this.dialogService=f,this.cancelOrderRequest=v(new bn),this.newCreditCharges=v([]),this.dayBeforeOrderStartDate=v(new Date),this.tableDefaultFields=v(["chargeNumber","name","chargeType","changeState","effectiveStartDate","effectiveEndDate"]),this.customDatesTableDefaultFields=v(["chargeNumber","name","chargeType","effectiveStartDate","effectiveEndDate","chargedThroughDate"]),this.selectedCharge=v(void 0),this.selectedChargeCancellationDate=v(new Date),this.selectedChargeMaxEndDate=v(new Date),this.cancellationMode=v("sameDateForAllCharges"),this.isLoading=v(void 0),this.isInitialized=v(!1),this.customDateDialogOpen=v(!1),this.selectedEffectiveEndDate=v(new Date),this.CancelOrderModes=ye,this.OrderTermTypes=Je,this.subHeadertext=v(""),this.headerText=v(""),this.mode=v(Se.Cancellation),this.CancellationCardMode=Se,this.dialogTitle=P(()=>this.mode()===Se.Cancellation?"Cancel order ":"Shorten order "),this.maxEffectiveEndDate=P(()=>this.mode()===Se.Shortening&&this.order?.effectiveEndDate?N.subtractDays(this.order.effectiveEndDate,1):this.order?.effectiveEndDate),this.isCollapsed=v(!1),this.get
1SubHeaderText=P(()=>{let T=this.mode()===Se.Cancellation;return this.newCreditCharges()?.length===1?T?"This credit charge will be created from this cancellation":"This credits charge will be created for this change":T?"These credit charges will be created from this cancellation":"These credits charges will be created for this change"}),this.getheaderText=P(()=>this.newCreditCharges()?.length===1?"Preview of credit charge ("+this.newCreditCharges()?.length+")":"Preview of credit charges ("+this.newCreditCharges()?.length+")"),this.invalidCancelDate=P(()=>this.cancellationMode()==="sameDateForAllCharges"&&(this.selectedEffectiveEndDate()<this.dayBeforeOrderStartDate()||this.selectedEffectiveEndDate()>this.order.effectiveEndDate)?this.mode()===Se.Shortening?"Shorten date must be between one day before order effective start date and current effective end date":"Cancel date must be between one day before order effective start date and order effective end date":this.cancellationMode()===void 0||this.cancelOrderRequest().cancellationMode===void 0?!0:this.cancelOrderRequest().cancellationMode===ye.OnOrderCancellationDate&&this.effectiveEndDateField?!this.effectiveEndDateField?.isValid:!1),this.invalidCustomDate=P(()=>{if(!this.selectedChargeCancellationDate())return"Provide a effective End date";if(this.selectedChargeCancellationDate()<this.dayBeforeOrderStartDate()||this.selectedChargeCancellationDate()>this.order.effectiveEndDate)return"Date must be between one day before order effective start date and order effective end date"})}showDialog(e){this.mode.set(e?.mode??Se.Cancellation),this.isInitialized()||(this.dayBeforeOrderStartDate.set(N.subtractDays(this.order.effectiveStartDate,1)),this.initDates(),this.isInitialized.set(!0)),this.mode()===Se.Shortening&&this.selectedEffectiveEndDate.set(this.maxEffectiveEndDate()),this.dialog.show()}toggleCreditTable(){this.isCollapsed.set(!this.isCollapsed())}initDates(){let e=N.getMaxDate(this.order.notDeletedCharges.map(i=>i.chargedThroughDate));this.selectedEffectiveEndDate.set(this.order.effectiveEndDate??N.subtractDays(e,1)??this.dayBeforeOrderStartDate()),this.bookingService.getBookingRule().subscribe(i=>{let t=i.bookingTiming===Pi.OnOrderActivationDate;this.cancelOrderRequest().cancellationDate=t?new Date:this.order.effectiveEndDate})}onOuterRadioGroupChanged(e){this.cancellationMode.set(e),this.cancellationMode()==="sameDateForAllCharges"?this.cancelOrderRequest().cancellationMode=ye.OnOrderCancellationDate:this.cancelOrderRequest().cancellationMode=ye.OnChargesInvoiceToDates}onCancellationModeChange(){this.cancelOrderRequest().cancellationMode===ye.OnCustomDates&&(this.initCustomDatesTable(),this.dialogService.info("Click on each row to change end date for charge","INFORMATION","400px","cancel-order_custom-dates"))}clearSelectionOnClose(){this.cancellationMode.set("sameDateForAllCharges"),this.cancelOrderRequest().cancellationMode=ye.OnOrderCancellationDate}initCustomDatesTable(){return V(this,null,function*(){this.customDatesTable.manualFields=yield this.getCustomDatesTableFields(),this.customDatesTable.manualTableData=yield this.getCustomDatedTableData()})}getCustomDatesTableFields(){return V(this,null,function*(){let e=[],i=yield me(this.fieldConfigurationService.fieldConfigurationsForEntity("orderproductcharge"));return this.customDatesTableDefaultFields().forEach(t=>{e.push(new si(i.find(o=>o.fieldName===t)))}),e.find(t=>t.fieldName==="effectiveEndDate").fieldDescription+=" (current)",e.push(new si({fieldDescription:"Effective end date (new)",fieldName:"chargeEndDate",fieldType:Mi.Date})),new Promise(t=>t(e))})}getCustomDatedTableData(){return V(this,null,function*(){let e=[];return this.order.notDeletedLastVersionCharges.filter(i=>!i.isOneOff).forEach(i=>{let o=this.order.orderProducts.find(g=>g.charges.some(f=>f.id===i.id)).getAllVersionsOfCharge(i.chargeNumber);i.effectiveStartDate=N.getMinDate(o.map(g=>g.effectiveStartDate)),i.chargedThroughDate=N.getMaxDate(o.map(g=>g.chargedThroughDate)),i.chargeEndDate=this.getChargeDefaultEndDate(i),e.push(i)}),new Promise(i=>i(e))})}getChargeDefaultEndDate(e){return e.effectiveEndDate??N.subtractDays(e.chargedThroughDate,1)??N.subtractDays(e.effectiveStartDate,1)}openChargeEndDateDialog(e){this.selectedChargeMaxEndDate.set(e?.effectiveEndDate??this.order.effectiveEndDate),this.selectedCharge.set(e),this.selectedChargeCancellationDate.set(e?.chargeEndDate),e&&!this.customDateDialogOpen()&&(this.customDateDialogOpen.set(!0),this.customDateDialog.show())}onSaveChargeEndDate(){this.selectedCharge().chargeEndDate=this.selectedChargeCancellationDate(),this.customDatesTable.refresh(),this.customDateDialog.close()}onCancelChargeEndDate(){this.customDateDialog.close()}
1onNextClick(){if(this.cancelOrderRequest().cancellationMode===ye.OnOrderCancellationDate){if(!this.selectedEffectiveEndDate())return;this.cancelOrderRequest().endDate=this.selectedEffectiveEndDate()}else this.cancelOrderRequest().cancellationMode===ye.OnChargesInvoiceToDates?this.cancelOrderRequest().endDate=N.subtractDays(N.getMaxDate(this.order.notDeletedCharges.map(e=>e.chargedThroughDate)),1)??this.order.effectiveStartDate:this.cancelOrderRequest().cancellationMode===ye.OnChargesEffectiveEndDates?this.cancelOrderRequest().endDate=N.getMaxDate(this.order.notDeletedCharges.map(e=>e.effectiveEndDate))??this.order.effectiveEndDate??this.order.effectiveStartDate:this.cancelOrderRequest().cancellationMode===ye.OnCustomDates&&(this.cancelOrderRequest().cancellationDatePerCharges={},this.customDatesTable.manualTableData.forEach(e=>{this.cancelOrderRequest().cancellationDatePerCharges[e.chargeNumber]=e.chargeEndDate}),this.cancelOrderRequest().endDate=N.getMaxDate(this.customDatesTable.manualTableData.map(e=>e.chargeEndDate)));this.isLoading.set(!0),this.orderService.cancelPreview(this.order.id,this.cancelOrderRequest()).subscribe({next:e=>{this.stepper.next(),this.newCreditCharges.set(e),this.isLoading.set(!1)},error:e=>{this.notificationService.error(e.error.message),this.isLoading.set(!1)}})}onConfirmCancelClick(){this.cancelOrderRequest().cancellationDate&&(this.isLoading.set(!0),this.orderService.cancelOrder(this.order.id,this.cancelOrderRequest()).subscribe({next:e=>{this.isLoading.set(!1),this.dialog.close(),this.router.navigate(["/orders/"+e.id])},error:e=>{this.notificationService.error(e.error.message),this.isLoading.set(!1)}}))}static{this.\u0275fac=function(i){return new(i||n)(k(fe),k(H),k(Cn),k(j),k(It),k(se))}}static{this.\u0275cmp=I({type:n,selectors:[["yon-cancel-order-dialog"]],viewQuery:function(i,t){if(i&1&&B(jr,5)(qr,5)(Qr,5)(Gr,5)(zr,5),i&2){let o;D(o=w())&&(t.dialog=o.first),D(o=w())&&(t.stepper=o.first),D(o=w())&&(t.effectiveEndDateField=o.first),D(o=w())&&(t.customDatesTable=o.first),D(o=w())&&(t.customDateDialog=o.first)}},inputs:{order:"order"},decls:8,vars:4,consts:[["dialog",""],["dialogContent",""],["customDateDialog",""],["customDateDialogContent",""],["stepper",""],["radioGroupOuter",""],["effectiveEndDateField",""],["customDatesTable",""],["dialogSize","xl","backdropOption","static",3,"onClose","header","isLoading","containerTemplate"],["dialogSize","md","header","Set end date","backdropOption","true",3,"onClose","containerTemplate"],[1,"order-dialogs__stepper-container","mt-2",3,"linear"],["matStepLabel",""],[1,"mat-radio-group-vertical",3,"change"],[3,"checked","value"],[1,"order-dialogs__date-field","ml-4","mb-2"],["type","date","tooltip","Effective end date",3,"ngModelChange","onBlur","ngModel","min","max","isRequired","disabled"],[3,"value"],[1,"ml-4"],[1,"mat-radio-group-vertical",3,"change","ngModelChange","ngModel","disabled"],["matTooltip","Cancel all charges on each invoiced to date. The charges with no invoiced to date will be cancelled on effective start. ","matTooltipShowDelay","500"],["matTooltip","Cancel all charges on each effective end date. The charges with no effective end date will be cancelled on invoiced to date, or effective start date if the charge is not invoiced.","matTooltipShowDelay","500"],["matTooltip","Cancel all charges on custom dates. Set/change dates by clicking on corresponding charge row.","matTooltipShowDelay","500"],[1,"mt-2",3,"hidden"],[2,"font-size","12px"],["viewName","custom-dates-cancellation","entity","orderproductcharge",3,"selectionChanged","isManualData"],[1,"flex","flex-row","content-center","justify-end"],["buttonIcon","chevron_right","buttonIconPosition","after",3,"onClick","disabled"],["label","Preview credits and confirm"],[3,"hidden"],[3,"header","subheader","hideCardHeaderMenu"],["entity","orderproductcharge","viewName","cancel-order-credit-charges-preview",3,"defaultFields","isManualData","manualTableData","customPageSize","customPaginatorSize","showFirstLastButtons"],[1,"cancel-order__expand-collapse-table"],["type","mat-icon-button",3,"collapsed","buttonIcon","size","weight","tooltip"],[1,"order-dialogs__date-field"],["type","date",3,"ngModelChange","title","tooltip","ngModel","isRequired"],[1,"flex","flex-row","content-center","justify-space-between"],["buttonIcon","chevron_left",3,"onClick","disabled"],["color","primary",1,"mr-2",3,"onClick","disabled"],[3,"onClick","disabled"],["matStepperIcon","edit"],["matStepperIcon","done"],["type","mat-icon-button",3,"onClick","buttonIcon","size","weight","tooltip"],[2,"font-size","14px"],["name","edit"],["name","done"],["type","date",3,"ngModelChange","title","min","max","ngModel","isRequired"],[1,"mt-2"],[3,"onClick"]],template:function(i,t){if(i&1&&(d(0,"yon-dialog-center",8,0),_("onClose",function(){return t.clearSelectionOnClose()}),a(),M(2,Jr,51,44,"ng-template",null,1,R),d(4,"yon-dialog-center",9,2),_("onClose",function(){return t.customDateDialogOpen.set(!1)}),a(),M(6,Xr,12,7,"ng-template",null,3,R)),i&2){let o=x(3),g=x(7);s("header",t.dialogTitle()+(t.order==null?null:t.order.orderNumber))("isLoading",t.isLoading())("containerTemplate",o),r(4),s("containerTemplate",g)}},dependencies:[$,X,Z,G,Jt,Xt,Qe,qe,Ge,Zt,at,ie,oe,ve,Q,ii,dt],styles:[".order-dialogs__date-field[_ngcontent-%COMP%]{max-width:200
1px}.order-dialogs__date-field[_ngcontent-%COMP%]  .k-button{background-color:transparent}.order-dialogs__date-field[_ngcontent-%COMP%]  .k-input-solid{border:1px solid #7a7a7a}.cancellation[_ngcontent-%COMP%]{z-index:2;position:relative;margin-top:-50px}.order-dialogs__stepper-container[_ngcontent-%COMP%]  .mat-accordion__no-shadow .mat-expansion-panel{border:none!important}.cancel-order__expand-collapse-table[_ngcontent-%COMP%]{display:block;margin:0 auto 5px;width:fit-content}.cancel-order__expand-collapse-table[_ngcontent-%COMP%]   button[_ngcontent-%COMP%]{height:60px;background-color:transparent;color:#424242;margin-top:-70px}.cancel-order__expand-collapse-table[_ngcontent-%COMP%]   .mat-mdc-button[_ngcontent-%COMP%]{--mat-mdc-button-persistent-ripple-color: none;--mat-mdc-button-ripple-color: none}.cancel-order__expand-collapse-table[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]{margin-top:-20px;font-weight:400}.cancel-order__expand-collapse-table[_ngcontent-%COMP%]  .material-symbols-sharp{position:relative}.cancel-order__expand-collapse-table[_ngcontent-%COMP%]  .mat-button-focus-overlay{display:none}.cancel-order-table-collapsed[_ngcontent-%COMP%]{display:none}.collapsed[_ngcontent-%COMP%]{margin-bottom:-100px}"],data:{animation:[Gi.slideInOut]}})}}return n})();var Zr=(n,u)=>u.value;function ea(n,u){if(n&1&&(de(0,"div",4)(1,"span",11),c(2),ce()()),n&2){let e=l().$implicit;r(2),L(e.icon)}}function ta(n,u){if(n&1&&(de(0,"span",7),c(1),ce()),n&2){let e=l().$implicit;r(),L(e.description)}}function ia(n,u){if(n&1&&(de(0,"span",12),c(1),ce()),n&2){let e=l(2).$implicit;r(),S(" ",e.footerIcon," ")}}function na(n,u){if(n&1&&(de(0,"div",10),h(1,ia,2,1,"span",12),de(2,"span"),c(3),ce()()),n&2){let e=l().$implicit;r(),C(e.footerIcon?1:-1),r(2),L(e.footer)}}function oa(n,u){if(n&1){let e=y();de(0,"div",2),tt("click",function(){let t=p(e).$implicit,o=l();return m(!t.disabled&&o.onSelect(t.value))})("keydown.enter",function(){let t=p(e).$implicit,o=l();return m(!t.disabled&&o.onSelect(t.value))})("keydown.space",function(t){let o=p(e).$implicit,g=l();return!o.disabled&&g.onSelect(o.value),m(t.preventDefault())}),de(1,"div",3),h(2,ea,3,1,"div",4),de(3,"div",5)(4,"span",6),c(5),ce(),h(6,ta,2,1,"span",7),ce(),de(7,"div",8),vi(8,"div",9),ce()(),h(9,na,4,2,"div",10),ce()}if(n&2){let e=u.$implicit,i=l();q("card-radio-group__card--selected",i.selected()===e.value)("card-radio-group__card--disabled",e.disabled),et("aria-checked",i.selected()===e.value)("aria-disabled",e.disabled||null)("tabindex",e.disabled?-1:0),r(2),C(e.icon?2:-1),r(3),L(e.label),r(),C(e.description?6:-1),r(3),C(e.footer?9:-1)}}var ri=(()=>{class n{constructor(){this.options=Ie([]),this.selected=Di(void 0),this.selectionChange=St()}onSelect(e){this.selected.set(e),this.selectionChange.emit(e)}static{this.\u0275fac=function(i){return new(i||n)}}static{this.\u0275cmp=I({type:n,selectors:[["yon-card-radio-group"]],inputs:{options:[1,"options"],selected:[1,"selected"]},outputs:{selected:"selectedChange",selectionChange:"selectionChange"},decls:3,vars:0,consts:[["role","radiogroup",1,"card-radio-group"],["role","radio",1,"card-radio-group__card",3,"card-radio-group__card--selected","card-radio-group__card--disabled"],["role","radio",1,"card-radio-group__card",3,"click","keydown.enter","keydown.space"],[1,"card-radio-group__row"],[1,"card-radio-group__icon-container"],[1,"card-radio-group__text"],[1,"card-radio-group__label"],[1,"card-radio-group__description"],[1,"card-radio-group__radio"],[1,"card-radio-group__radio-dot"],[1,"card-radio-group__footer"],[1,"card-radio-group__icon","material-symbols-sharp"],[1,"material-symbols-sharp","card-radio-group__footer-icon"]],template:function(i,t){i&1&&(de(0,"div",0),_e(1,oa,10,11,"div",1,Zr),ce()),i&2&&(r(),ge(t.options()))},styles:["[_nghost-%COMP%]{display:block;width:100%}.card-radio-group[_ngcontent-%COMP%]{display:flex;gap:8px;width:100%;padding:6px;background-color:color-mix(in srgb,var(--color-mono-contrast-max) 5%,transparent);border-radius:10px}.card-radio-group__card[_ngcontent-%COMP%]{display:flex;flex-direction:column;padding:12px 16px;border:1px solid transparent;border-radius:8px;
1cursor:pointer;transition:border-color .2s,background-color .2s,box-shadow .2s;flex:1 1 0;min-width:0}.card-radio-group__card[_ngcontent-%COMP%]:hover{background-color:color-mix(in srgb,var(--color-primary, #1976d2) 4%,transparent)}.card-radio-group__card--selected[_ngcontent-%COMP%], .card-radio-group__card--selected[_ngcontent-%COMP%]:hover{background-color:var(--layout-bg-color-card, #fff);border-color:var(--color-grey-border, #e0e0e0);box-shadow:0 1px 2px color-mix(in srgb,var(--color-mono-contrast-max) 8%,transparent)}.card-radio-group__card--selected[_ngcontent-%COMP%]   .card-radio-group__radio[_ngcontent-%COMP%], .card-radio-group__card--selected[_ngcontent-%COMP%]:hover   .card-radio-group__radio[_ngcontent-%COMP%]{border-color:var(--color-primary, #1976d2)}.card-radio-group__card--selected[_ngcontent-%COMP%]   .card-radio-group__radio-dot[_ngcontent-%COMP%], .card-radio-group__card--selected[_ngcontent-%COMP%]:hover   .card-radio-group__radio-dot[_ngcontent-%COMP%]{background-color:var(--color-primary, #1976d2);transform:scale(1)}.card-radio-group__card--selected[_ngcontent-%COMP%]   .card-radio-group__icon-container[_ngcontent-%COMP%], .card-radio-group__card--selected[_ngcontent-%COMP%]:hover   .card-radio-group__icon-container[_ngcontent-%COMP%]{border-color:color-mix(in srgb,var(--color-primary, #1976d2) 20%,transparent);background-color:color-mix(in srgb,var(--color-primary, #1976d2) 5%,transparent)}.card-radio-group__card--disabled[_ngcontent-%COMP%]{opacity:.5;cursor:not-allowed}.card-radio-group__card--disabled[_ngcontent-%COMP%]:hover{border-color:var(--color-grey-border, #e0e0e0);background-color:transparent}.card-radio-group__row[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;gap:14px;width:100%}.card-radio-group__icon-container[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:40px;height:40px;min-width:40px;border-radius:10px;border:1px solid var(--color-grey-border, #e0e0e0);background-color:var(--color-mono-contrast-lowest, #fafafa);transition:border-color .2s,background-color .2s}.card-radio-group__icon[_ngcontent-%COMP%]{font-size:20px;color:var(--color-mono-contrast-low, #757575)}.card-radio-group__text[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}.card-radio-group__label[_ngcontent-%COMP%]{font-size:14px;font-weight:600;color:var(--color-mono-contrast-high, #424242);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.card-radio-group__description[_ngcontent-%COMP%]{font-size:12px;color:var(--color-mono-contrast-low, #757575);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.card-radio-group__radio[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:20px;height:20px;min-width:20px;border-radius:50%;border:2px solid var(--color-grey-border, #bdbdbd);transition:border-color .2s}.card-radio-group__radio-dot[_ngcontent-%COMP%]{width:10px;height:10px;border-radius:50%;background-color:transparent;transform:scale(0);transition:background-color .2s,transform .2s}.card-radio-group__footer[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;gap:4px;font-size:11px;color:var(--color-red-error, #d32f2f);margin-top:8px;padding-top:8px;border-top:1px solid var(--color-grey-border, #e0e0e0)}.card-radio-group__footer-icon[_ngcontent-%COMP%]{font-size:14px}"],changeDetection:0})}}return n})();var ra=["input"];function aa(n,u){if(n&1&&(de(0,"span",5),c(1),ce()),n&2){let e=l();r(),L(e.suffix)}}var da={provide:Li,useExisting:gi(()=>vt),multi:!0},vt=(()=>{class n{constructor(){this.min=null,this.max=null,this.step=1,this.disabled=!1,this.valueChange=new ne,this.value=null,this.onChange=()=>{},this.onTouched=()=>{}}writeValue(e){this.value=e}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}setDisabledState(e){this.disabled=e}get canDecrement(){return this.disabled?!1:this.value==null?!0:this.min==null||this.value-this.step>=this.min}get canIncrement(){return this.disabled?!1:this.value==null?!0:this.max==null||this.value+this.step<=this.max}
1decrement(){this.canDecrement&&this.commit((this.value??0)-this.step)}increment(){this.canIncrement&&this.commit((this.value??0)+this.step)}onInput(e){if(e===""||e==null){this.commit(null);return}let i=Number(e);Number.isNaN(i)||this.commit(i)}onKeydown(e){e.key==="ArrowUp"?(e.preventDefault(),this.increment()):e.key==="ArrowDown"&&(e.preventDefault(),this.decrement())}onBlur(){this.onTouched()}commit(e){let i=e;i!=null&&(Number.isInteger(this.step)&&(i=Math.trunc(i)),this.min!=null&&i<this.min&&(i=this.min),this.max!=null&&i>this.max&&(i=this.max)),this.value=i;let t=i==null?"":String(i);this.inputEl&&this.inputEl.nativeElement.value!==t&&(this.inputEl.nativeElement.value=t),this.onChange(i),i!=null&&this.valueChange.emit(i)}static{this.\u0275fac=function(i){return new(i||n)}}static{this.\u0275cmp=I({type:n,selectors:[["yon-number-stepper"]],viewQuery:function(i,t){if(i&1&&B(ra,5),i&2){let o;D(o=w())&&(t.inputEl=o.first)}},inputs:{min:"min",max:"max",step:"step",suffix:"suffix",disabled:"disabled",ariaLabel:"ariaLabel"},outputs:{valueChange:"valueChange"},features:[xi([da])],decls:8,vars:13,consts:[["input",""],[1,"yon-number-stepper"],["type","button",1,"yon-number-stepper__btn","yon-number-stepper__btn--left",3,"click","disabled"],["type","number","inputmode","numeric",1,"yon-number-stepper__input",3,"input","keydown","blur","step","min","max","disabled","value"],["type","button",1,"yon-number-stepper__btn","yon-number-stepper__btn--right",3,"click","disabled"],[1,"yon-number-stepper__suffix"]],template:function(i,t){i&1&&(de(0,"div",1)(1,"button",2),tt("click",function(){return t.decrement()}),c(2," \u2212 "),ce(),de(3,"input",3,0),tt("input",function(g){return t.onInput(g.target.value)})("keydown",function(g){return t.onKeydown(g)})("blur",function(){return t.onBlur()}),ce(),de(5,"button",4),tt("click",function(){return t.increment()}),c(6," + "),ce()(),h(7,aa,2,1,"span",5)),i&2&&(q("yon-number-stepper--disabled",t.disabled),r(),Dt("disabled",!t.canDecrement),et("aria-label","Decrease "+(t.ariaLabel||"value")),r(2),Dt("step",t.step)("min",t.min)("max",t.max)("disabled",t.disabled)("value",t.value??""),et("aria-label",t.ariaLabel),r(2),Dt("disabled",!t.canIncrement),et("aria-label","Increase "+(t.ariaLabel||"value")),r(2),C(t.suffix?7:-1))},dependencies:[$],styles:["[_nghost-%COMP%]{display:inline-flex;align-items:center;white-space:nowrap}.yon-number-stepper[_ngcontent-%COMP%]{display:inline-flex;align-items:stretch;border:1px solid var(--color-input-border);border-radius:10px;overflow:hidden;background:var(--layout-bg-color-card);transition:border-color .12s ease,box-shadow .12s ease;height:36px}.yon-number-stepper[_ngcontent-%COMP%]:focus-within{border-color:var(--color-primary);box-shadow:0 0 0 3px var(--color-primary-bg, rgba(41, 98, 255, .16))}.yon-number-stepper--disabled[_ngcontent-%COMP%]{opacity:.6;pointer-events:none}.yon-number-stepper__btn[_ngcontent-%COMP%]{appearance:none;border:0;background:transparent;font:600 16px var(--font-sans, inherit);color:var(--color-mono-contrast-low);width:24px;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;transition:background .12s ease,color .12s ease}.yon-number-stepper__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-button-filter);color:var(--color-primary)}.yon-number-stepper__btn[_ngcontent-%COMP%]:disabled{cursor:not-allowed;color:var(--color-mono-contrast-min)}.yon-number-stepper__btn--left[_ngcontent-%COMP%]{border-right:1px solid var(--color-input-border)}.yon-number-stepper__btn--right[_ngcontent-%COMP%]{border-left:1px solid var(--color-input-border)}.yon-number-stepper__input[_ngcontent-%COMP%]{width:36px;text-align:center;font:500 14px var(--font-sans, inherit);color:var(--color-mono-contrast-high);border:0;outline:none;background:transparent;appearance:none}.yon-number-stepper__input[_ngcontent-%COMP%]::-webkit-outer-spin-button, .yon-number-stepper__input[_ngcontent-%COMP%]::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.yon-number-stepper__input[type=number][_ngcontent-%COMP%]{-moz-appearance:textfield;appearance:textfield}  #ui.v3 input.yon-number-stepper__input.yon-number-stepper__input,   :root.dark input.yon-number-stepper__input.yon-number-stepper__input,   :root.light input.yon-number-stepper__input.yon-number-stepper__input{padding:0;margin:0;min-height:0}  #ui.v3 input.yon-number-stepper__input.yon-number-stepper__input
1:focus,   #ui.v3 input.yon-number-stepper__input.yon-number-stepper__input:focus-visible,   #ui.v3 input.yon-number-stepper__input.yon-number-stepper__input:empty,   :root.dark input.yon-number-stepper__input.yon-number-stepper__input:focus,   :root.dark input.yon-number-stepper__input.yon-number-stepper__input:focus-visible,   :root.dark input.yon-number-stepper__input.yon-number-stepper__input:empty,   :root.light input.yon-number-stepper__input.yon-number-stepper__input:focus,   :root.light input.yon-number-stepper__input.yon-number-stepper__input:focus-visible,   :root.light input.yon-number-stepper__input.yon-number-stepper__input:empty{padding:0}.yon-number-stepper__suffix[_ngcontent-%COMP%]{margin-left:8px;color:var(--color-mono-contrast-low);font-size:12px;align-self:center}"],changeDetection:0})}}return n})();var co=(()=>{class n{constructor(){this.orderService=O(H)}getEligibleCharges(e){return e?.effectiveEndDate?e.notDeletedLastVersionCharges.filter(i=>i.chargeType!==we.OneOff):[]}getFullTerm(e){return!e?.effectiveStartDate||!e?.effectiveEndDate?Ue(null):this.orderService.getFullTerm(e.effectiveStartDate,e.effectiveEndDate).pipe(Re(i=>i??null))}computeProlongedEndDate(e,i,t){return!e?.effectiveEndDate||!i||i<1?Ue(null):t!=null&&e.effectiveStartDate?this.orderService.calculateEndDateForOrder(e.effectiveStartDate,t+i):this.orderService.calculateEndDateForOrder(N.addDays(e.effectiveEndDate,1),i)}prolong(e,i,t){return this.orderService.prolong(e.id,{endDate:i,chargeIds:t})}static{this.\u0275fac=function(i){return new(i||n)}}static{this.\u0275prov=hi({token:n,factory:n.\u0275fac,providedIn:"root"})}}return n})();var ca=["dialog"],ua=["stepper"],pa=["chargeSelectionTable"],ma=n=>({effectiveEndDate:n}),_a=(n,u)=>u.key;function ga(n,u){if(n&1&&(d(0,"span",8)(1,"span"),c(2),a(),d(3,"span",9),c(4,"\xB7"),a(),d(5,"span"),c(6),a()()),n&2){let e=l();r(2),S("Order ",e.order==null?null:e.order.orderNumber),r(4),L(e.order==null||e.order.account==null?null:e.order.account.name)}}function ha(n,u){if(n&1&&(d(0,"span",10)(1,"span",11),c(2),z(3,"dateFormat"),a()()),n&2){let e=l();r(2),L(ee(3,1,e.newEndDate(),"shortDate"))}}function Ca(n,u){n&1&&c(0,"Select action")}function fa(n,u){n&1&&c(0,"Set date & charges")}function va(n,u){if(n&1){let e=y();d(0,"button",33),_("click",function(){let t=p(e).$implicit,o=l(3);return m(o.pickPreset(t))}),c(1),a()}if(n&2){let e=u.$implicit,i=l(3);q("adjust-end-date__chip--on",i.selectedPresetKey()===e.key),r(),S(" ",e.label," ")}}function ya(n,u){if(n&1){let e=y();d(0,"span",34),c(1,"or"),a(),d(2,"yon-field",35),_("ngModelChange",function(t){p(e);let o=l(3);return m(o.onNewEndDateChanged(t))}),a()}if(n&2){let e=l(3);r(2),s("ngModel",e.newEndDate())("min",e.minProlongDate())("isRequired",!0)}}function ba(n,u){if(n&1){let e=y();d(0,"div",32)(1,"yon-entity-table",36,6),_("checkboxSelectionChanged",function(t){p(e);let o=l(3);return m(o.onChargeSelectionChanged(t))}),a()()}if(n&2){let e=l(3);r(),s("isManualData",!0)("manualTableData",e.eligibleCharges())("defaultFields",e.chargeTableFields)("defaultPageSize",10)("checkboxConfig",e.chargeCheckboxConfig)}}function xa(n,u){if(n&1){let e=y();d(0,"div",22)(1,"div",23)(2,"span",24),c(3,"End date"),a(),d(4,"span",25),c(5),z(6,"dateFormat"),a(),d(7,"mat-icon",26),c(8,"arrow_forward"),a(),d(9,"span",27),c(10),z(11,"dateFormat"),a()(),d(12,"div",28),_e(13,va,2,3,"button",29,_a),b(15,"span",30),d(16,"yon-number-stepper",31),_("valueChange",function(t){p(e);let o=l(2);return m(o.onProlongMonthsChanged(t))}),a(),h(17,ya,3,3),a()(),h(18,ba,3,5,"div",32)}if(n&2){let e=l(2);r(5),S(" ",ee(6,6,e.order==null?null:e.order.effectiveEndDate,"shortDate")," "),r(5),S(" ",ee(11,9,e.newEndDate(),"shortDate")," "),r(3),ge(e.prolongPresets),r(3),s("ngModel",e.prolongMonths())("min",1),r(),C(e.orderSettings!=null&&e.orderSettings.enableSpecificEffectiveEndDate?17:-1),r(),C(e.eligibleCharges().length>0?18:-1)}}function Da(n,u){n&1&&c(0,"Review")}function wa(n,u){if(n&1&&(d(0,"div",32),b(1,"yon-entity-table",41),a()),n&2){let e=l(3),i=x(5);r(),s("isManualData",!0)("manualTableData",e.selectedCharges())("defaultFields",e.chargeTableFields)("defaultPageSize",10)("customCellTemplates",Te(5,ma,i))}}function Sa(n,u){n&1&&(d(0,"p",40)(1,"i"),c(2,"No charges selected \u2014 only the order end date will be updated."),a()())}function Ta(n,u){if(n&1&&(d(0,"div",23)(1,"span",24),c(2,"End date"),a(),d(3,"span",25),c(4),z(5,"dateFormat"),a(),d(6,"mat-icon",26),c(7,"arrow_forward"),a(),d(8,"span",27),c(9),z(10,"dateFormat"),a()(),d(11,"div",37)(12,"h3",38),c(13,"Charges to prolong"),a(),d(14,"span",39),c(15),a()(),h(16,wa,2,7,"div",32)(17,Sa,3,0,"p",40)),n&2){let e=l(2);r(4),S(" ",ee(5,5,e.order==null?null:e.order.effectiveEndDate,"shortDate")," "),r(5),S(" ",ee(10,8,e.
1newEndDate(),"shortDate")," "),r(6),le(" ",e.eligibleCharges().length," charges \xB7 ",e.selectedCharges().length," selected "),r(),C(e.selectedCharges().length>0?16:17)}}function Oa(n,u){if(n&1){let e=y();d(0,"div",12)(1,"div",13)(2,"mat-stepper",14,5)(4,"mat-step",15),M(5,Ca,1,0,"ng-template",16),d(6,"div",17)(7,"h2",18),c(8,"How do you want to adjust this order?"),a(),d(9,"p",19),c(10," Pick whether you're moving the end date later or earlier. You'll set the new date next. "),a(),d(11,"yon-card-radio-group",20),_("selectionChange",function(t){p(e);let o=l();return m(o.onActionSelected(t))}),a()()(),d(12,"mat-step",15),M(13,fa,1,0,"ng-template",16),d(14,"div",21),h(15,xa,19,12),a()(),d(16,"mat-step",15),M(17,Da,1,0,"ng-template",16),d(18,"div",21),h(19,Ta,18,11),a()()()()()}if(n&2){let e=l();r(2),s("selectedIndex",e.prolongStep()),r(2),s("editable",!e.isLoading())("completed",e.prolongStep()>e.ProlongStep.Mode),r(7),s("options",e.actionOptions)("selected",e.selectedAction()),r(),s("editable",!e.isLoading())("completed",e.prolongStep()>e.ProlongStep.Charges),r(3),C(e.selectedAction()===e.AdjustAction.Prolong&&e.prolongStep()===e.ProlongStep.Charges?15:-1),r(),s("editable",!e.isLoading())("completed",!1),r(3),C(e.selectedAction()===e.AdjustAction.Prolong&&e.prolongStep()===e.ProlongStep.Confirm?19:-1)}}function Ma(n,u){if(n&1){let e=y();d(0,"yon-button",46),_("onClick",function(){p(e);let t=l(2);return m(t.onModeNext())}),c(1," Next "),a()}if(n&2){let e=l(2);s("disabled",e.isLoading())}}function Pa(n,u){if(n&1){let e=y();d(0,"yon-button",46),_("onClick",function(){p(e);let t=l(2);return m(t.onConfirmShorten())}),c(1," Continue "),a()}if(n&2){let e=l(2);s("disabled",e.isLoading())}}function Ea(n,u){if(n&1){let e=y();d(0,"yon-button",43),_("onClick",function(){p(e);let t=l(2);return m(t.onBackToMode())}),c(1,"Back"),a(),d(2,"yon-button",47),_("onClick",function(){p(e);let t=l(2);return m(t.onChargesNext())}),c(3," Next "),a()}if(n&2){let e=l(2);s("disabled",e.isLoading()),r(2),s("disabled",!!e.invalidProlongDate()||e.isLoading()||e.isCalculatingEndDate())("tooltip",e.invalidProlongDate()||"")}}function ka(n,u){if(n&1){let e=y();d(0,"yon-button",43),_("onClick",function(){p(e);let t=l(2);return m(t.onBackToCharges())}),c(1,"Back"),a(),d(2,"yon-button",47),_("onClick",function(){p(e);let t=l(2);return m(t.onConfirmProlong())}),c(3," Confirm "),a()}if(n&2){let e=l(2);s("disabled",e.isLoading()),r(2),s("disabled",!!e.invalidProlongDate()||e.isLoading()||e.isCalculatingEndDate())("tooltip",e.invalidProlongDate()||"")}}function Na(n,u){if(n&1){let e=y();d(0,"div",42)(1,"yon-button",43),_("onClick",function(){p(e),l();let t=x(1);return m(t.close())}),c(2,"Cancel"),a(),d(3,"div",44),h(4,Ma,2,1,"yon-button",45),h(5,Pa,2,1,"yon-button",45),h(6,Ea,4,3),h(7,ka,4,3),a()()}if(n&2){let e=l();r(),s("disabled",e.isLoading()),r(3),C(e.prolongStep()===e.ProlongStep.Mode&&e.selectedAction()===e.AdjustAction.Prolong?4:-1),r(),C(e.prolongStep()===e.ProlongStep.Mode&&e.selectedAction()===e.AdjustAction.Shorten?5:-1),r(),C(e.prolongStep()===e.ProlongStep.Charges?6:-1),r(),C(e.prolongStep()===e.ProlongStep.Confirm?7:-1)}}var We=(function(n){return n.Prolong="prolong",n.Shorten="shorten",n})(We||{}),Ve=(function(n){return n[n.Mode=0]="Mode",n[n.Charges=1]="Charges",n[n.Confirm=2]="Confirm",n})(Ve||{}),uo=(()=>{class n{constructor(e,i,t){this.notificationService=e,this.adjustEndDateService=i,this.orderService=t,this.onOrderProlonged=new ne,this.AdjustAction=We,this.ProlongStep=Ve,this.actionOptions=[{value:We.Prolong,label:"Prolong",description:"Extend the order end date",icon:"event"},{value:We.Shorten,label:"Shorten",description:"Set an earlier end date",icon:"event_busy"}],this.prolongPresets=[{key:"1m",label:"+1 month",months:1},{key:"3m",label:"+3 months",months:3},{key:"6m",label:"+6 months",months:6}],this.chargeTableFields=["chargeNumber","name","effectiveEndDate"],this.chargeCheckboxConfig={enable:!0,entityDescription:"charge",initialMasterCheck:!0,rowDisableCondition:o=>!this.order?.effectiveEndDate||!N.datesAreEqual(o.effectiveEndDate,this.order.effectiveEndDate),rowDisableTooltip:"Only charges ending on the same date as the order 
1can be prolonged"},this.selectedAction=v(void 0),this.prolongStep=v(Ve.Mode),this.isLoading=v(!1),this.isCalculatingEndDate=v(!1),this.prolongMonths=v(1),this.newEndDate=v(void 0),this.selectedPresetKey=v("1m"),this.fullTerm=v(void 0),this.eligibleCharges=v([]),this.selectedCharges=v([]),this.maxProlongDate=new Date(2100,0,1),this.minProlongDate=P(()=>{if(this.order?.effectiveEndDate)return N.addDays(this.order.effectiveEndDate,1)}),this.invalidProlongDate=P(()=>{if(this.selectedAction()!==We.Prolong)return"";if(!this.newEndDate())return"Provide a new end date";if(!this.order?.effectiveEndDate)return"";let o=N.parse(this.newEndDate()),g=N.parse(this.order.effectiveEndDate);return o<=g?"New end date must be after the current effective end date":o>this.maxProlongDate?"New end date cannot be after January 1, 2100":""}),this.cancelPendingRequest$=new Ae}showDialog(){this.resetDialog(),this.selectedAction.set(We.Prolong),this.loadEligibleCharges(),this.calculateNewEndDate(),this.dialog.show()}resetDialog(){this.cancelPendingRequest$.next(),this.selectedAction.set(void 0),this.fullTerm.set(void 0),this.isCalculatingEndDate.set(!1),this.prolongStep.set(Ve.Mode),this.prolongMonths.set(1),this.selectedPresetKey.set("1m"),this.newEndDate.set(void 0),this.eligibleCharges.set([]),this.selectedCharges.set([])}onActionSelected(e){this.selectedAction.set(e),this.prolongStep.set(Ve.Mode),e===We.Prolong&&(this.loadEligibleCharges(),this.calculateNewEndDate())}onModeNext(){this.selectedAction()===We.Prolong&&this.prolongStep.set(Ve.Charges)}onChargesNext(){let e=this.chargeSelectionTable?.checkedEntities()??[];this.selectedCharges.set(e),this.prolongStep.set(Ve.Confirm)}onBackToMode(){this.prolongStep.set(Ve.Mode)}onBackToCharges(){this.prolongStep.set(Ve.Charges)}onConfirmShorten(){this.dialog.close(),this.orderCancelOrder?.showDialog({mode:Se.Shortening})}pickPreset(e){this.selectedPresetKey.set(e.key),this.prolongMonths.set(e.months),this.calculateNewEndDate()}onProlongMonthsChanged(e){this.prolongMonths.set(e),this.selectedPresetKey.set(null),e>0&&this.calculateNewEndDate()}onNewEndDateChanged(e){this.cancelPendingRequest$.next(),this.newEndDate.set(e),this.prolongMonths.set(null),this.selectedPresetKey.set(null)}calculateNewEndDate(){if(this.cancelPendingRequest$.next(),!this.order?.effectiveEndDate||!this.prolongMonths())return;this.isCalculatingEndDate.set(!0),(this.fullTerm()===void 0?this.adjustEndDateService.getFullTerm(this.order).pipe(xt(i=>this.fullTerm.set(i))):Ue(this.fullTerm()??null)).pipe(_i(i=>this.adjustEndDateService.computeProlongedEndDate(this.order,this.prolongMonths(),i)),W(this.cancelPendingRequest$),te(()=>this.isCalculatingEndDate.set(!1))).subscribe({next:i=>this.newEndDate.set(i??void 0),error:i=>{this.newEndDate.set(void 0),this.notificationService.error(i?.error?.message??"Failed to calculate the new end date")}})}loadEligibleCharges(){let e=this.adjustEndDateService.getEligibleCharges(this.order);this.eligibleCharges.set(e),this.selectedCharges.set(e.filter(i=>!this.chargeCheckboxConfig.rowDisableCondition?.(i)))}onChargeSelectionChanged(e){if(this.prolongStep()!==Ve.Charges)return;let i=Array.isArray(e)?e:[];if(i.length===0&&this.selectedCharges().length===this.eligibleCharges().length)return;let t=new Set(i);this.selectedCharges.set(this.eligibleCharges().filter(o=>t.has(o.id)||t.has(o.uniqueRowId)))}onConfirmProlong(){!this.newEndDate()||!this.order||(this.isLoading.set(!0),this.adjustEndDateService.prolong(this.order,this.newEndDate(),this.selectedCharges().map(e=>e.id)).pipe(te(()=>this.isLoading.set(!1))).subscribe({next:e=>{this.orderService.fetchById(e.id).subscribe(i=>this.onOrderProlonged.emit(i)),this.notificationService.success(`Order ${e.orderNumber} has been prolonged until ${N.getDayFormatted(e.effectiveEndDate)}`),this.dialog.close()},error:e=>this.notificationService.error(e?.error?.message??"Failed to prolong order")}))}static{this.\u0275fac=function(i){return new(i||n)(k(j),k(co),k(H))}}static{this.\u0275cmp=I({type:n,selectors:[["yon-adjust-end-date-dialog"]],viewQuery:function(i,t){if(i&1&&B(ca,5)(ua,5)(pa,5),i&2){let o;D(o=w())&&(t.dialog=o.first),D(o=w())&&(t.stepper=o.first),D(o=w())&&(t.chargeSelectionTable=o.first)}},inputs:{order:"order",orderSettings:"orderSettings",orderCancelOrder:"orderCancelOrder"},outputs:{onOrderProlonged:"onOrderProlonged"},decls:10,vars:5,consts:[["dialog",""],["dialogSubheader",""],["effectiveEndDateDiff",""],["dialogContent",""],["dialogFooter",""],["stepper",""],["chargeSelectionTable",""],["dialogSize","lg","customClass","adjust-end-date-dialog",3,"header","isLoading","containerTemplate","subheaderTemplate","footerTemplate"],[1,"adjust-end-date__subheader"],[1,"adjust-end-date__subheader-sep"],[1,"adjust-end-date__diff-cell"],[1,"adjust-end-date__diff-new"],[1,"adjust-end-date__body"],[1,"adjust-end-date__scroll"],["labelPosition","end",1,"adjust-end-date__stepper","stepper--label-end",3,"selectedIndex"],[3,"editable","completed"],["matStepLabel",""],[1,"adjust-end-date__step"],[1,"adjust-end-date__step-title"],[1,"adjust-end-date__step-subtitle"],[3,"selectionChange","options","selected"],[1,"adjust-end-date__step","adjust-end-date__step--tall"],[1,"adjust-end-date__field"],[1,"adjust-end-date__date-pair"],[1,"adjust-end-date__date-pair-label"],[1,"adjust-end-date__date-old"],[1,"adjust-end-date__date-arrow"],[1,"adjust-end-date__date-new"],[1,"adjust-end-date__chips-row"],["type","button",1,"adjust-end-date__chip",3,"adjust-end-date__chip--on"],["aria-hidden","true",1,"adjust-end-date__chips-vsep"],["suffix","months","ariaLabel","Prolong by months",3,"valueChange","ngModel","min"],[1,"adjust-end-date__charges-table-wrap"],["type","button",1,"adjust-end-date__chip",3,"click"],[1,"adjust-end-date__chips-divider"],["type","date",3,"ngModelChange","ngModel","min","isRequired"],["entity","orderproductcharge",3,"checkboxSelectionChanged","isManualData","manualTableData","defaultFields","defaultPageSize","checkboxConfig"],[1,"adjust-end-date__review-head"],[1,"adjust-end-date__review-title"],[1,"adjust-end-date__review-meta"],[1,"adjust-end-date__empty"],["entity","orderproductcharge",3,"isManualData","manualTableData","defaultFields","defaultPageSize","customCellTemplates"],[1,"adjust-end-date__footer"],[3,"onClick","disabled"],[1,"adjust-end-date__footer-right"],["color","primary",3,"disabled"],["color","primary",3,"onClick","disabled"],["color","primary",3,"onClick","disabled","tooltip"]],template:function(i,t){if(i&1&&(b(0,"yon-dialog-center",7,0),M(2,ga,7,2,"ng-template",null,1,R)(4,ha,4,4,"ng-template",null,2,R)(6,Oa,20,11,"ng-template",null,3,R)(8,Na,8,5,"ng-template",null,4,R)),i&2){let o=x(3),g=x(7),f=x(9);s("header","Adjust end date")("isLoading",t.isLoading())("containerTemplate",g)("subheaderTemplate",o)("footerTemplate",f)}},dependencies:[$,X,Z,Le,G,Kt,Qe,qe,Ge,ie,oe,Q,ri,ve,vt,Yt,ke],styles:[".order-dialogs__date-field[_ngcontent-%COMP%]{max-width:200
1px}.order-dialogs__date-field[_ngcontent-%COMP%]  .k-button{background-color:transparent}.order-dialogs__date-field[_ngcontent-%COMP%]  .k-input-solid{border:1px solid #7a7a7a}.cancellation[_ngcontent-%COMP%]{z-index:2;position:relative;margin-top:-50px}.order-dialogs__stepper-container[_ngcontent-%COMP%]  .mat-accordion__no-shadow .mat-expansion-panel{border:none!important}.cancel-order__expand-collapse-table[_ngcontent-%COMP%]{display:block;margin:0 auto 5px;width:fit-content}.cancel-order__expand-collapse-table[_ngcontent-%COMP%]   button[_ngcontent-%COMP%]{height:60px;background-color:transparent;color:#424242;margin-top:-70px}.cancel-order__expand-collapse-table[_ngcontent-%COMP%]   .mat-mdc-button[_ngcontent-%COMP%]{--mat-mdc-button-persistent-ripple-color: none;--mat-mdc-button-ripple-color: none}.cancel-order__expand-collapse-table[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]{margin-top:-20px;font-weight:400}.cancel-order__expand-collapse-table[_ngcontent-%COMP%]  .material-symbols-sharp{position:relative}.cancel-order__expand-collapse-table[_ngcontent-%COMP%]  .mat-button-focus-overlay{display:none}.cancel-order-table-collapsed[_ngcontent-%COMP%]{display:none}.collapsed[_ngcontent-%COMP%]{margin-bottom:-100px}",".adjust-end-date__subheader[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:8px;font-size:12px;color:var(--color-text-secondary, #99a1aa);font-weight:400}.adjust-end-date__subheader-sep[_ngcontent-%COMP%]{color:var(--color-text-secondary, #c0c4ca)}.adjust-end-date__body[_ngcontent-%COMP%]{display:flex;flex-direction:column;max-height:75vh}.adjust-end-date__scroll[_ngcontent-%COMP%]{flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden}.adjust-end-date__stepper[_ngcontent-%COMP%]{display:block;font-family:Roboto,Helvetica Neue,sans-serif}.adjust-end-date__stepper[_ngcontent-%COMP%]     .mat-step-label, .adjust-end-date__stepper[_ngcontent-%COMP%]     .mat-step-icon{font-family:Roboto,Helvetica Neue,sans-serif}.adjust-end-date__stepper[_ngcontent-%COMP%]     .mat-horizontal-content-container{padding:0}.adjust-end-date__stepper.mat-stepper-horizontal[_ngcontent-%COMP%]  .mat-step-header .mat-step-icon.mat-step-icon-state-done{background-color:var(--color-success-100, #dcfce7);color:var(--color-success-700, #15803d)}.adjust-end-date__step[_ngcontent-%COMP%]{padding:28px 32px;overflow-x:hidden}.adjust-end-date__step--tall[_ngcontent-%COMP%]{min-height:calc(75vh - 130px);padding-bottom:0}.adjust-end-date__step--tall[_ngcontent-%COMP%]   .adjust-end-date__charges-table-wrap[_ngcontent-%COMP%]{height:calc(75vh - 280px);max-height:none}.adjust-end-date__step-title[_ngcontent-%COMP%]{font-size:18px;font-weight:600;color:var(--color-mono-contrast-high);margin:0 0 6px}.adjust-end-date__step-subtitle[_ngcontent-%COMP%]{font-size:13px;color:var(--color-mono-contrast-low);margin:0 0 20px}.adjust-end-date__field[_ngcontent-%COMP%]{display:flex;flex-direction:column}.adjust-end-date__field[_ngcontent-%COMP%] + .adjust-end-date__field[_ngcontent-%COMP%]{margin-top:22px}.adjust-end-date__date-pair[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px;background:var(--color-bg-modal-details-box);border:1px solid var(--color-input-border);border-radius:12px;padding:10px 16px;min-height:40px}.adjust-end-date__date-pair-label[_ngcontent-%COMP%]{font-size:11px;font-weight:700;color:var(--color-text-secondary, #66707a);text-transform:uppercase;letter-spacing:.08em;flex-shrink:0}.adjust-end-date__date-old[_ngcontent-%COMP%]{font-size:14px;font-weight:500;color:var(--color-text-secondary, #99a1aa);text-decoration:line-through}.adjust-end-date__date-new[_ngcontent-%COMP%]{display:inline-block;padding:0 14px;border-radius:6px;background:var(--color-success-50, #e6f4ec);color:var(--color-success-700, #1f7a4f);font-size:14px;font-weight:600;line-height:22px}.adjust-end-date__date-arrow[_ngcontent-%COMP%]{color:var(--color-text-secondary, #99a1aa);font-size:18px;width:18px;height:18px}.adjust-end-date__chips-row[_ngcontent-%COMP%]{display:flex;flex-wrap:nowrap;align-items:center;gap:8px;margin-top:14px;line-height:normal}.adjust-end-date__chips-row[_ngcontent-%COMP%]   yon-field[_ngcontent-%COMP%]{width:140px}.adjust-end-date__chips-row[_ngcontent-%COMP%]   yon-field[_ngcontent-%COMP%]    , .adjust-end-date__chips-row[_ngcontent-%COMP%]   yon-field[_ngcontent-%COMP%]     *{line-height:normal}.adjust-end-date__chip[_ngcontent-%COMP%]{appearance:none;border:1px solid var(--color-input-border);background:var(--layout-bg-color-card);color:var(--color-mono-contrast-high);border-radius:999px;padding:1px 7px;font:500 10px Roboto,Helvetica Neue,sans-serif;white-space:nowrap;flex-shrink:0;cursor:pointer;transition:background .12s ease,border-color .12s ease,color .12s ease}.adjust-end-date__chip--on[_ngcontent-%COMP%]{background:var(--color-primary);border-color:var(--color-primary);color:var(--color-txt-btn-raised)}
1.adjust-end-date__chips-vsep[_ngcontent-%COMP%]{display:inline-block;width:1px;height:20px;background:var(--color-input-border);margin:0 4px}.adjust-end-date__chips-divider[_ngcontent-%COMP%]{color:var(--color-mono-contrast-low);font-size:12px;margin:0 4px}.adjust-end-date__charges-table-wrap[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex:1 1 auto;min-height:0;max-height:400px;margin-top:16px}.adjust-end-date__charges-table-wrap[_ngcontent-%COMP%]   yon-entity-table[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex:1 1 auto;min-height:0}.adjust-end-date__charges-table-wrap[_ngcontent-%COMP%]   yon-entity-table[_ngcontent-%COMP%]    >div{display:flex;flex-direction:column;flex:1 1 auto;min-height:0}  #ui.v3 .adjust-end-date__charges-table-wrap .entity-table__container{flex:1 1 auto;min-height:0;overflow-x:auto;overflow-y:auto}  #ui.v3 .adjust-end-date__charges-table-wrap yon-entity-table mat-table.mat-mdc-table mat-header-row.mat-mdc-header-row{position:sticky;top:0;z-index:3;background:var(--layout-bg-color-card)}  :is(:root.light,:root.dark) .adjust-end-date-dialog.dialog-center .mat-mdc-dialog-container .mat-mdc-dialog-title+.mat-mdc-dialog-content{padding-top:0;padding-bottom:0}.adjust-end-date__review-head[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:baseline;margin-top:20px;margin-bottom:14px}.adjust-end-date__review-title[_ngcontent-%COMP%]{font-family:Roboto,Helvetica Neue,sans-serif;font-size:18px;font-weight:700;color:var(--color-text-primary, #112134);margin:0;letter-spacing:-.01em}.adjust-end-date__review-meta[_ngcontent-%COMP%]{font-size:12px;color:var(--color-text-secondary, #66707a)}.adjust-end-date__diff-cell[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:8px}.adjust-end-date__diff-old[_ngcontent-%COMP%]{display:inline-block;padding:0 14px;border-radius:6px;background:var(--color-error-50, #fde8ea);color:var(--color-error-700, #c0322b);font-weight:500;text-decoration:line-through;text-decoration-color:currentColor;line-height:18px}.adjust-end-date__diff-arrow[_ngcontent-%COMP%]{font-size:16px;width:16px;height:16px;color:var(--color-text-secondary, #99a1aa)}.adjust-end-date__diff-new[_ngcontent-%COMP%]{display:inline-block;padding:0 14px;border-radius:6px;background:var(--color-success-50, #e6f4ec);color:var(--color-success-700, #1f7a4f);font-weight:500;line-height:18px}.adjust-end-date__empty[_ngcontent-%COMP%]{margin-top:16px;color:var(--color-text-secondary, #66707a)}.adjust-end-date__footer[_ngcontent-%COMP%]{padding:16px 28px;display:flex;justify-content:space-between;align-items:center;gap:10px}.adjust-end-date__footer-right[_ngcontent-%COMP%]{display:flex;gap:10px}"]})}}return n})();var Aa=["dialog"],Ra=["stepper"],po=(n,u)=>u.id;function La(n,u){if(n&1&&(d(0,"span",6)(1,"span"),c(2),a(),d(3,"span",7),c(4,"\xB7"),a(),d(5,"span"),c(6),a()()),n&2){let e=l();r(2),S("Order ",e.order==null?null:e.order.orderNumber),r(4),L(e.order==null||e.order.account==null?null:e.order.account.name)}}function Ba(n,u){n&1&&c(0,"Select charges")}function ja(n,u){if(n&1&&(d(0,"div",27),c(1),a()),n&2){let e=l().$implicit;r(),le(" Partial \xB7 ",e.remaining-e.qty," ",e.remaining-e.qty===1?"unit":"units"," left ")}}function qa(n,u){if(n&1){let e=y();d(0,"tr")(1,"td",16)(2,"mat-checkbox",24),_("change",function(t){let o=p(e).$implicit,g=l(2);return m(g.onRowSelectionChanged(o.id,t.checked))}),a()(),d(3,"td")(4,"span",25),c(5),a()(),d(6,"td")(7,"span",25),c(8),a()(),d(9,"td",18),c(10),a(),d(11,"td",19)(12,"yon-number-stepper",26),_("valueChange",function(t){let o=p(e).$implicit,g=l(2);return m(g.onRowQtyChanged(o.id,t))}),a(),h(13,ja,2,2,"div",27),a(),d(14,"td",20)(15,"mat-checkbox",28),_("change",function(t){let o=p(e).$implicit,g=l(2);return m(g.onRowCloseChanged(o.id,t.checked))}),a()()()}if(n&2){let e=u.$implicit,i=!e.selected||e.qty===0,t=e.qty>0&&e.qty<e.remaining;q("bulk-delivery__row--skipped",i),r(2),s("checked",e.selected),r(3),L(e.productName),r(3),L(e.chargeName),r(2),L(e.remaining),r(2),s("ngModel",e.qty)("min",0)("max",e.remaining)("disabled",!e.selected),r(),C(t?13:-1),r(2),s("checked",e.close)("disabled",i)}}function Qa(n,u){n&1&&c(0,"Result")}function Ga(n,u){if(n&1&&(d(0,"div",22),b(1,"mat-progress-spinner",29),d(2,"h3",30),c(3,"Processing deliveries"),a(),d(4,"p",31),c(5),a(),b(6,"mat-progress-bar",32),a()),n&2){let e=l(2);r(5),le(" ",e.done()," of ",e.total()," charges processed "),r(),s("value",e.progressPct())}}function za(n,u){if(n&1&&(d(0,"div",45),c(1),a()),n&2){let e=l().$implicit;r(),L(e.reason)}}function $a(n,u){if(n&1&&(d(0,"div",40)(1,"mat-icon",41),c(2),a(),d(3,"div",42)(4,"div",43)(5,"span",44),c(6),a(),d(7,"span",44),c(8),a()(),h(9,za,2,1,"div",45),a(),d(10,"span",46),c(11),a()()),n&2){let e=u.$implicit;q("bulk-delivery__result-row--ok",e.success)("bulk-delivery__result-row--err",!e.success),r(2),S(" ",e.success?"check_circle":"error"," "),r(4),L(e.productName),r(2),L(e.chargeName),r(),C(e.reason?9:-1),r(2),S("",e.qty," units")}}function Ha(n,u){if(n&1&&(d(0,"div",23)(1,"div",33)(2,"div",34)(3,"div",35),c(4),a(),d(5,"div",36),c(6,"Delivered"),a()(),d(7,"div",37)(8,"div",35),c(9),a(),d(10,"div",36),c(11,"Failed"),a()()(),d(12,"div",38),_e(13,$a,12,9,"div",39,po),a()()),n&2){let e=l(2);r(4),L(e.successCount()),r(5),L(e.failCount()),r(4),ge(e.results())}}function Wa(n,u){if(n&1){let e=y();d(0,"div",8)(1,"div",9)(2,"mat-stepper",10,4)(4,"mat-step",11),M(5,Ba,1,0,"ng-template",12),d(6,"div",13)(7,"div",14)(8,"table",15)(9,"thead")(10,"tr")(11,"th",16)(12,"mat-checkbox",17),_("change",function(t){p(e);let o=l();return m(o.onMasterToggle(t.checked))}),a()(),d(13,"th"),c(14,"Product"),a(),d(15,"th"),c(16,"Charge"),a(),d(17,"th",18),c(18,"Remaining"),a(),d(19,"th",19),c(20,"Qty to deliver"),a(),d(21,"th",20),c(22,"Close"),a()()(),d(23,"tbody"),_e(24,qa,16,13,"tr",21,po),a()()()()(),d(26,"mat-step",11),M(27,Qa,1,0,"ng-template",12),d(28,"div",13),h(29,Ga,7,3,"div",22)(30,Ha,15,2,"div",23),a()()()()()}if(n&2){let e=l();r(2),s("selectedIndex",e.step()),r(2),s("editable",!e.isLoading())("completed",e.step()>e.BulkDeliveryStep.Select),r(8),s("checked",e.masterChecked())("indeterminate",e.masterIndeterminate()),r(12),ge(e.rows()),r(2),s("editable",!1)("completed",e.phase()==="result"),r(3),C(e.phase()==="processing"?29:30)}}function Ua(n,u){if(n&1){let e=y();d(0,"yon-button",49),_("onClick",function(){p(e);let t=l(2);return m(t.onCancel())}),c(1,"Cancel"),a(),d(2,"div",50)(3,"yon-button",51),_("onClick",function(){p(e);let t=l(2);return m(t.onDeliver())}),c(4," Confirm "),a()()}if(n&2){let e=l(2);s("disabled",e.isLoading()),r(3),s("disabled",!e.canDeliver()||e.isLoading())}}function Ka(n,u){if(n&1){let e=y();d(0,"yon-button",49),_("onClick",function(){p(e);let t=l(2);return m(t.onCancel())}),c(1,"Cancel"),a()}n&2&&s("disabled",!0)}function Ya(n,u){if(n&1){let e=y();d(0,"yon-button",52),_("onClick",function(){p(e);let t=l(2);return m(t.onCancel())}),c(1,"Close"),a(),d(2,"div",50)(3,"yon-button",53),_("onClick",function(){p(e);let t=l(2);return m(t.onDone())}),c(4,"Done"),a()()}}function Ja(n,u){if(n&1&&(d(0,"div",47),h(1,Ua,5,2)(2,Ka,2,1,"yon-button",48)(3,Ya,5,0),a()),n&2){let e=l();r(),C(e.step()===e.BulkDeliveryStep.Select?1:e.phase()==="processing"?2:3)}}var yt=(function(n){return n[n.Select=0]="Select",n[n.Result=1]="Result",n})(yt||{}),mo=(()=>{class n{constructor(e,i){this.orderProductChargeService=e,this.dialogService=i,this.eligibleCharges=[],this.deliveriesCompleted=new ne,this.BulkDeliveryStep=yt,this.step=v(yt.Select),this.phase=v("processing"),this.rows=v([]),this.total=v(0),this.done=v(0),this.results=v([]),this.isLoading=v(!1),this.selectedRows=P(()=>this.rows().filter(t=>t.selected&&t.qty>0)),this.canDeliver=P(()=>this.selectedRows().length>0),this.successCount=P(()=>this.results().filter(t=>t.success).length),this.failCount=P(()=>this.results().filter(t=>!t.success).length),this.progressPct=P(()=>{let t=this.total();return t>0?Math.round(this.done()/t*100):0}),this.masterChecked=P(()=>this.rows().length>0&&this.rows().every(t=>t.selected&&t.qty>0)),this.masterIndeterminate=P(()=>this.rows().some(o=>o.selected&&o.qty>0)&&!this.masterChecked())}showDialog(){this.resetState(),this.populateRows(),this.dialog.show()}resetState(){this.step.set(yt.Select),this.phase.set("processing"),this.total.set(0),this.done.set(0),this.results.set([]),this.isLoading.set(!1)}populateRows(){let e=(this.eligibleCharges??[]).map(i=>{let t=this.findProduct(i),o=i.remainingQuantity??0;return{id:i.id,chargeName:i.name??"",productName:t?.chargePlan?.product?.name??"",remaining:o,selected:!0,qty:o,close:!0}});this.rows.set(e)}findProduct(e){return this.order?.orderProducts?.find(i=>i.charges?.some(t=>t.id===e.id))}onMasterToggle(e){this.rows.update(i=>i.map(t=>be(ae({},t),{selected:e,qty:e?t.remaining:0,close:e})))}onRowSelectionChanged(e,i){this.rows.update(t=>t.map(o=>o.id===e?be(ae({},o),{selected:i,qty:i?o.remaining:0,close:i}):o))}onRowQtyChanged(e,i){let t=i??0;this.rows.update(o=>o.map(g=>g.id===e?be(ae({},g),{qty:Math.max(0,Math.min(g.remaining,t)),selected:t>0,close:t===g.remaining}):g))}onRowCloseChanged(e,i){return V(this,null,function*(){let t=this.rows().find(T=>T.id===e),o=i&&t&&t.qty>0&&t.qty<t.remaining;if(this.rows.update(T=>T.map(A=>A.id===e?be(ae({},A),{close:i}):A)),!o)return;(yield this.dialogService.confirmYesNo("By closing the charge you will not be able to register additional deliveries. Continue?"))||this.rows.update(T=>T.map(A=>A.id===e?be(ae({},A),{close:!1}):A))})}onDeliver(){return V(this,null,function*(){let e=this.selectedRows();if(e.length===0)return;this.step.set(yt.Result),this.stepper?.next(),this.phase.set("processing"),this.isLoading.set(!0),this.total.set(e.length),this.done.set(0);let i=[];for(let t of e){try{yield me(this.orderProductChargeService.createParti
1alDelivery(t.id,t.qty,t.close)),i.push({id:t.id,chargeName:t.chargeName,productName:t.productName,qty:t.qty,success:!0})}catch(o){i.push({id:t.id,chargeName:t.chargeName,productName:t.productName,qty:t.qty,success:!1,reason:this.extractMessage(o)})}this.done.update(o=>o+1)}this.results.set(i),this.phase.set("result"),this.isLoading.set(!1)})}onDone(){this.deliveriesCompleted.emit(),this.dialog.close()}onCancel(){this.dialog.close()}extractMessage(e){return e?.error?.message??e?.message??"Delivery failed"}static{this.\u0275fac=function(i){return new(i||n)(k(ct),k(se))}}static{this.\u0275cmp=I({type:n,selectors:[["yon-bulk-delivery-dialog"]],viewQuery:function(i,t){if(i&1&&B(Aa,5)(Ra,5),i&2){let o;D(o=w())&&(t.dialog=o.first),D(o=w())&&(t.stepper=o.first)}},inputs:{order:"order",eligibleCharges:"eligibleCharges"},outputs:{deliveriesCompleted:"deliveriesCompleted"},decls:8,vars:5,consts:[["dialog",""],["dialogSubheader",""],["dialogContent",""],["dialogFooter",""],["stepper",""],["dialogSize","lg","customClass","bulk-delivery-dialog",3,"header","isLoading","containerTemplate","subheaderTemplate","footerTemplate"],[1,"bulk-delivery__subheader"],[1,"bulk-delivery__subheader-sep"],[1,"bulk-delivery__body"],[1,"bulk-delivery__scroll"],["labelPosition","end",1,"bulk-delivery__stepper","stepper--label-end",3,"selectedIndex"],[3,"editable","completed"],["matStepLabel",""],[1,"bulk-delivery__step","bulk-delivery__step--tall"],[1,"bulk-delivery__charges-table-wrap"],[1,"bulk-delivery__table"],[1,"bulk-delivery__col-check"],[3,"change","checked","indeterminate"],[1,"bulk-delivery__col-num"],[1,"bulk-delivery__col-qty"],[1,"bulk-delivery__col-close"],[3,"bulk-delivery__row--skipped"],[1,"bulk-delivery__processing"],[1,"bulk-delivery__result"],[3,"change","checked"],[1,"bulk-delivery__product-name"],["ariaLabel","Quantity to deliver",3,"valueChange","ngModel","min","max","disabled"],[1,"bulk-delivery__helper-warn"],[3,"change","checked","disabled"],["mode","indeterminate","diameter","56"],[1,"bulk-delivery__processing-title"],[1,"bulk-delivery__processing-sub"],["mode","determinate",3,"value"],[1,"bulk-delivery__result-stats"],[1,"bulk-delivery__result-stat","bulk-delivery__result-stat--ok"],[1,"bulk-delivery__result-stat-num"],[1,"bulk-delivery__result-stat-label"],[1,"bulk-delivery__result-stat","bulk-delivery__result-stat--err"],[1,"bulk-delivery__result-list"],[1,"bulk-delivery__result-row",3,"bulk-delivery__result-row--ok","bulk-delivery__result-row--err"],[1,"bulk-delivery__result-row"],[1,"bulk-delivery__result-icon"],[1,"bulk-delivery__result-body"],[1,"bulk-delivery__result-head"],[1,"bulk-delivery__result-product"],[1,"bulk-delivery__result-reason"],[1,"bulk-delivery__result-qty"],[1,"bulk-delivery__footer"],[3,"disabled"],[3,"onClick","disabled"],[1,"bulk-delivery__footer-right"],["color","primary",3,"onClick","disabled"],[3,"onClick"],["color","primary",3,"onClick"]],template:function(i,t){if(i&1&&(b(0,"yon-dialog-center",5,0),M(2,La,7,2,"ng-template",null,1,R)(4,Wa,31,8,"ng-template",null,2,R)(6,Ja,4,1,"ng-template",null,3,R)),i&2){let o=x(3),g=x(5),f=x(7);s("header","Deliver stock")("isLoading",t.isLoading())("containerTemplate",g)("subheaderTemplate",o)("footerTemplate",f)}},dependencies:[$,X,Z,G,At,Kt,Rt,Hi,Qe,qe,Ge,oe,Q,vt,Yt],styles:[".order-dialogs__date-field[_ngcontent-%COMP%]{max-width:200px}.order-dialogs__date-field[_ngcontent-%COMP%]  .k-button{background-color:transparent}.order-dialogs__date-field[_ngcontent-%COMP%]  .k-input-solid{border:1px solid #7a7a7a}.cancellation[_ngcontent-%COMP%]{z-index:2;position:relative;margin-top:-50px}.order-dialogs__stepper-container[_ngcontent-%COMP%]  .mat-accordion__no-shadow .mat-expansion-panel{border:none!important}.cancel-order__expand-collapse-table[_ngcontent-%COMP%]{display:block;margin:0 auto 5px;width:fit-content}.cancel-order__expand-collapse-table[_ngcontent-%COMP%]   button[_ngcontent-%COMP%]{height:60px;background-color:transparent;color:#424242;margin-top:-70px}.cancel-order__expand-collapse-table[_ngcontent-%COMP%]   .mat-mdc-button[_ngcontent-%COMP%]{--mat-mdc-button-persistent-ripple-color: none;--mat-mdc-button-ripple-color: none}.cancel-order__expand-collapse-table[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]{margin-top:-20px;font-weight:400}.cancel-order__expand-collapse-table[_ngcontent-%COMP%]  .material-symbols-sharp{position:relative}.cancel-order__expand-collapse-table[_ngcontent-%COMP%]  .mat-button-focus-overlay{display:none}.cancel-order-table-collapsed[_ngcontent-%COMP%]{display:none}.collapsed[_ngcontent-%COMP%]{margin-bottom:-100px}",".bulk-delivery__subheader[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:8px;font-size:12px;color:var(--color-text-secondary, #99a1aa);font-weight:400}.bulk-delivery__subheader-sep[_ngcontent-%COMP%]{color:var(--color-text-secondary, #c0c4ca)}.bulk-delivery__body[_ngcontent-%COMP%]{display:flex;flex-direction:column;max-height:75vh}.bulk-delivery__scroll[_ngcontent-%COMP%]{flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden}.bulk-delivery__stepper[_ngcontent-%COMP%]{display:block;font-family:Roboto,Helvetica Neue,sans-serif}.bulk-delivery__stepper[_ngcontent-%COMP%]     .mat-step-label, .bulk-delivery__stepper[_ngcontent-%COMP%]     .mat-step-icon{font-family:Roboto,Helvetica Neue,sans-serif}.bulk-delivery__stepper[_ngcontent-%COMP%]     .mat-horizontal-content-container{padding:0}.bulk-delivery__stepper.mat-stepper-horizontal[_ngcontent-%COMP%]  .mat-step-header .mat-step-icon.mat-step-icon-state-done{background-color:var(--color-success-100, #dcfce7);color:var(--color-success-700, #15803d)}.bulk-delivery__step[_ngcontent-%COMP%]{padding:28px 32px;overflow-x:hidden}.bulk-delivery__step--tall[_ngcontent-%COMP%]{min-height:calc(75vh - 130px);padding-bottom:0}.bulk-delivery__charges-table-wrap[_ngcontent-%COMP%]{border:1px solid var(--color-input-border, #e1e3e7);border-radius:12px;overflow:auto;
1max-height:calc(75vh - 220px)}.bulk-delivery__table[_ngcontent-%COMP%]{width:100%;border-collapse:collapse;font-size:13px}.bulk-delivery__table[_ngcontent-%COMP%]   thead[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]{position:sticky;top:0;z-index:3;background:var(--color-bg-modal-details-box, #f7f8fa);text-align:left;font-weight:600;font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:var(--color-text-secondary, #66707a);padding:10px 14px;border-bottom:1px solid var(--color-input-border, #e1e3e7)}.bulk-delivery__table[_ngcontent-%COMP%]   tbody[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]{padding:12px 14px;border-top:1px solid var(--color-input-border, #eef0f3);vertical-align:middle;position:relative;z-index:0;isolation:isolate}.bulk-delivery__table[_ngcontent-%COMP%]   tbody[_ngcontent-%COMP%]   tr[_ngcontent-%COMP%]:first-child   td[_ngcontent-%COMP%]{border-top:none}.bulk-delivery__col-check[_ngcontent-%COMP%]{width:40px;text-align:center}.bulk-delivery__col-num[_ngcontent-%COMP%]{text-align:right;font-variant-numeric:tabular-nums}.bulk-delivery__col-qty[_ngcontent-%COMP%]{width:200px}.bulk-delivery__col-close[_ngcontent-%COMP%]{width:80px;text-align:center}.bulk-delivery__row--skipped[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]{opacity:.55}.bulk-delivery__mono[_ngcontent-%COMP%]{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px;color:var(--color-mono-contrast-high, #1f2933)}.bulk-delivery__product-name[_ngcontent-%COMP%]{font-weight:600;color:var(--color-mono-contrast-high, #1f2933)}.bulk-delivery__helper-warn[_ngcontent-%COMP%]{margin-top:4px;font-size:11px;color:var(--color-warning-700, #b45309)}.bulk-delivery__processing[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;padding:60px 20px;text-align:center}.bulk-delivery__processing[_ngcontent-%COMP%]   mat-progress-bar[_ngcontent-%COMP%]{width:320px;max-width:100%}.bulk-delivery__processing-title[_ngcontent-%COMP%]{font-size:18px;font-weight:600;color:var(--color-mono-contrast-high);margin:0}.bulk-delivery__processing-sub[_ngcontent-%COMP%]{font-size:13px;color:var(--color-mono-contrast-low);margin:0}.bulk-delivery__result[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:20px}.bulk-delivery__result-stats[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(2,1fr);gap:16px}.bulk-delivery__result-stat[_ngcontent-%COMP%]{border:1px solid var(--color-input-border, #e1e3e7);border-radius:12px;padding:16px 20px;display:flex;flex-direction:column;gap:4px}.bulk-delivery__result-stat--ok[_ngcontent-%COMP%]{border-color:var(--color-success-200, #bbf7d0);background:var(--color-success-50, #f0fdf4)}.bulk-delivery__result-stat--err[_ngcontent-%COMP%]{border-color:var(--color-error-200, #fecaca);background:var(--color-error-50, #fef2f2)}.bulk-delivery__result-stat-num[_ngcontent-%COMP%]{font-size:28px;font-weight:800;letter-spacing:-.01em}.bulk-delivery__result-stat--ok[_ngcontent-%COMP%]   .bulk-delivery__result-stat-num[_ngcontent-%COMP%]{color:var(--color-success-700, #15803d)}.bulk-delivery__result-stat--err[_ngcontent-%COMP%]   .bulk-delivery__result-stat-num[_ngcontent-%COMP%]{color:var(--color-error-700, #b91c1c)}.bulk-delivery__result-stat-label[_ngcontent-%COMP%]{font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--color-text-secondary, #66707a);font-weight:600}.bulk-delivery__result-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:8px}.bulk-delivery__result-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px;padding:10px 14px;border-radius:10px;background:var(--color-bg-modal-details-box, #f7f8fa);border-left:3px solid transparent}.bulk-delivery__result-row--ok[_ngcontent-%COMP%]{border-left-color:var(--color-success-500, #22c55e)}.bulk-delivery__result-row--err[_ngcontent-%COMP%]{border-left-color:var(--color-error-500, #ef4444)}.bulk-delivery__result-icon[_ngcontent-%COMP%]{flex:0 0 auto;font-size:20px;width:20px;height:20px}.bulk-delivery__result-row--ok[_ngcontent-%COMP%]   .bulk-delivery__result-icon[_ngcontent-%COMP%]{color:var(--color-success-600, #16a34a)}.bulk-delivery__result-row--err[_ngcontent-%COMP%]   .bulk-delivery__result-icon[_ngcontent-%COMP%]{color:var(--color-error-600, #dc2626)}.bulk-delivery__result-body[_ngcontent-%COMP%]{flex:1 1 auto;display:flex;flex-direction:column;gap:2px;min-width:0}.bulk-delivery__result-head[_ngcontent-%COMP%]{display:flex;align-items:center;gap:10px}.bulk-delivery__result-product[_ngcontent-%COMP%]{font-weight:600;color:var(--color-mono-contrast-high, #1f2933)}.bulk-delivery__result-reason[_ngcontent-%COMP%]{font-size:12px;color:var(--color-error-700, #b91c1c)}.bulk-delivery__result-qty[_ngcontent-%COMP%]{flex:0 0 auto;font-size:12px;font-weight:600;color:var(--color-text-secondary, #66707a)}.bulk-delivery__footer[_ngcontent-%COMP%]{padding:16px 28px;display:flex;justify-content:space-between;align-items:center;gap:10px}.bulk-delivery__footer-right[_ngcontent-%COMP%]{display:flex;gap:10px}"]})}}return n})();var Xa=["dialog"];function Za(n,u){if(n&1){let e=y();d(0,"yon-field",3),_("ngModelChange",function(t){p(e);let o=l();return m(o.renewalTerm.set(t))}),a(),d(1,"yon-field",4),_("ngModelChange",function(t){p(e);let o=l();return m(o.nextRenewalTerm.set(t))}),a(),d(2,"div",5)(3,"yon-button",6),_("onClick",function(){p(e);let t=l();return m(t.onClickRenewOrder())}),c(4," RENEW ORDER "),a(),d(5,"yon-button",7),_("onClick",function(){p(e),l();let t=x(1);return m(t.close())}),c(6,"CANCEL"),a()()}if(n&2){let e=l();
1s("title","Renewal term (months)")("ngModel",e.renewalTerm())("min",e.maxNegativeMonths()),r(),s("title","Next renewal term (months)")("ngModel",e.nextRenewalTerm()),r(2),s("disabled",e.isLoading()),r(2),s("disabled",e.isLoading())}}var _o=(()=>{class n{constructor(e,i){this.orderService=e,this.notificationService=i,this.onOrderRenewed=new ne,this.renewalTerm=v(0),this.maxNegativeMonths=v(0),this.nextRenewalTerm=v(0),this.isLoading=v(!1)}show(){this.renewalTerm.set(this.order.renewalTerm),this.nextRenewalTerm.set(this.order.renewalTerm),this.maxNegativeMonthsCalc(),this.dialog.show()}onClickRenewOrder(){this.isLoading.set(!0),this.orderService.renewOrder(this.order.id,this.renewalTerm(),this.nextRenewalTerm()).pipe(F(1)).subscribe({next:e=>{this.orderService.fetchById(e.id).pipe(F(1)).subscribe(i=>this.onOrderRenewed.emit(i)),this.notificationService.success(`Order ${e.orderNumber} was renewed until ${N.getDayFormatted(e.effectiveEndDate)}`),this.dialog.close(),this.isLoading.set(!1)},error:e=>{this.notificationService.error(e.error.message),this.isLoading.set(!1)}})}maxNegativeMonthsCalc(){let e=this.getMonthsDifference(this.order.effectiveEndDate,this.order.effectiveStartDate);this.isFirstDayOfMonth(this.order.effectiveStartDate)&&this.isLastDayOfMonth(this.order.effectiveEndDate)?this.maxNegativeMonths.set(e-1):this.order.effectiveStartDate.getDate()>this.order.effectiveEndDate.getDate()?this.maxNegativeMonths.set(e+1):this.maxNegativeMonths.set(e)}getMonthsDifference(e,i){return(i.getFullYear()-e.getFullYear())*12+i.getMonth()-e.getMonth()}isFirstDayOfMonth(e){return e.getDate()===1}isLastDayOfMonth(e){let i=new Date(e);return i.setDate(e.getDate()+1),i.getMonth()>e.getMonth()||i.getFullYear()>e.getFullYear()}static{this.\u0275fac=function(i){return new(i||n)(k(H),k(j))}}static{this.\u0275cmp=I({type:n,selectors:[["yon-renew-order-dialog"]],viewQuery:function(i,t){if(i&1&&B(Xa,5),i&2){let o;D(o=w())&&(t.dialog=o.first)}},inputs:{order:"order"},outputs:{onOrderRenewed:"onOrderRenewed"},decls:4,vars:2,consts:[["dialog",""],["dialogContent",""],["header","Renew order",3,"isLoading","containerTemplate"],["type","integer","matTooltip","The number of months this order will be renewed this time (the contracted number of months on the order is the standard value)","matTooltipPosition","before",3,"ngModelChange","title","ngModel","min"],["type","integer","matTooltip","The number of contracted months this order will be renewed for next time up for renewal","matTooltipPosition","before",3,"ngModelChange","title","ngModel"],[1,"mt-2"],["mat-raised-button","","color","primary",1,"mr-2",3,"onClick","disabled"],[3,"onClick","disabled"]],template:function(i,t){if(i&1&&(b(0,"yon-dialog",2,0),M(2,Za,7,7,"ng-template",null,1,R)),i&2){let o=x(3);s("isLoading",t.isLoading())("containerTemplate",o)}},dependencies:[$,X,Z,G,at,ie,je,Q],encapsulation:2})}}return n})();var ed=["dialog"],td=["productSelectionTable"],id=()=>({enable:!0,entityDescription:"product"});function nd(n,u){if(n&1){let e=y();d(0,"yon-field",16),_("ngModelChange",function(t){p(e);let o=l(4);return m(o.onEndDateChange(t))}),a()}if(n&2){let e=l(4);s("title","New order end date")("ngModel",e.calculatedEndDate())("readOnly",!e.enableSpecificEffectiveEndDate())}}function od(n,u){if(n&1){let e=y();d(0,"p"),c(1,"How many months would you like to reactivate and renew your order with?"),a(),d(2,"div",13)(3,"yon-field",14),_("ngModelChange",function(t){p(e);let o=l(3);return m(o.onRenewalMonthsChange(t))}),a(),h(4,nd,1,3,"yon-field",15),a()}if(n&2){let e=l(3);r(3),s("title","Renewal months")("ngModel",e.renewalMonths())("min",0),r(),C(e.calculatedEndDate()?4:-1)}}function rd(n,u){if(n&1){let e=y();d(0,"div",12)(1,"h6"),c(2,"Products to reactivate"),a(),d(3,"yon-entity-table",17,2),_("checkboxSelectionChanged",function(){p(e);let t=l(3);return m(t.onProductSelectionChanged())}),a()()}if(n&2){let e=l(3);r(3),s("isManualData",!0)("manualTableData",e.products())("defaultFields",e.productTableFields)("defaultPageSize",10)("checkboxConfig",he(5,id))}}function ad(n,u){if(n&1&&(d(0,"div",10),h(1,od,5,4),h(2,rd,5,6,"div",12),a()),n&2){let e=l(2);r(),C(e.isCustom()&&e.isTermed()?1:-1),r(),C(e.isCustom()?2:-1)}}function dd(n,u){if(n&1){let e=y();d(0,"yon-button",20),_("onClick",function(){p(e);let t=l(3);return m(t.onClickReactivateSimple())}),c(1," Reactivate "),a()}if(n&2){let e=l(3);s("disabled",e.isLoading())}}function ld(n,u){if(n&1){let e=y();d(0,"yon-button",20),_("onClick",function(){p(e);let t=l(3);return m(t.onClickContinueCustom())}),c(1," Continue "),a()}if(n&2){let e=l(3);s("disabled",e.isLoading()||!e.isCustom()&&!e.calculatedEndDate())}}function sd(n,u){if(n&1){let e=y();d(0,"div",11),h(1,dd,2,1,"yon-button",18),h(2,ld,2,1,"yon-button",18),d(3,"yon-button",19),_("onClick",function(){p(e),l(2);let t=x(1);return m(t.close())}),c(4,"Cancel"),a()()}if(n&2){let e=l(2);r(),C(e.isSimple()?1:-1),r(),C(e.isCustom()?2:-1),r(),s("disabled",e.isLoading())}}function cd(n,u){if(n&1){let e=y();d(0,"div",4)(1,"yon-card-radio-group",5),_("selectionChange",function(t){p(e);let o=l();return m(o.onModeSelected(t))}),a(),d(2,"div",6)(3,"span",7),c(4,"event_repeat"),a(),d(5,"span",8),c(6,"Order will be reactivated from"),a(),d(7,"span",9),c(8),z(9,"dateFormat"),a()(),h(10,ad,3,2,"div",10),h(11,sd,5,3,"div",11),a()}if(n&2){let e=l();r(),s("options",e.modeOptions)("selected",e.reactivationMode()),r(7),S(" ",ee(9,5,e.reactivationDate(),"mediumDate")," "),r(2),C(e.reactivationMode()?10:-1),r(),C(e.reactivationMode()?11:-1)}}var go=(()=>{class n{constructor(){this.order=Ie(),this.canSimpleReactivate=Ie(!1),this.reactivationMode=v(void 0),this.renewalMonths=v(0),this.calculatedEndDate=v(void 0),this.enableSpecificEffectiveEndDate=v(!1),this.isLoading=v(!1),this.selectedProductIds=v([]),this.isTermed=P(()=>
1this.order()?.termType===Je.Termed),this.isCustom=P(()=>this.reactivationMode()===Fe.Custom),this.isSimple=P(()=>this.reactivationMode()===Fe.Simple),this.renewalDate=P(()=>{let e=this.order()?.effectiveEndDate;return e?N.addDays(e,1):void 0}),this.reactivationDate=P(()=>this.renewalDate()),this.injector=O(Ci),this.orderService=O(H),this.orderReactivationService=O(io),this.router=O(fe),this.notificationService=O(j),this.modeOptions=[],this.productTableFields=["name","productNumber"],this.products=v([])}set productSelectionTable(e){e&&fi(()=>e.onMasterCheckBoxChange(!0),{injector:this.injector})}show(){this.renewalMonths.set(this.order()?.renewalTerm||this.order()?.term||12),this.calculatedEndDate.set(void 0),this.enableSpecificEffectiveEndDate.set(!1),this.products.set(this.order()?.orderProducts??[]),this.selectedProductIds.set(this.products().map(e=>e.id)),this.modeOptions=[{value:Fe.Simple,label:"Simple",description:"Reactivate all products",icon:"flash_on",disabled:!this.canSimpleReactivate(),footer:this.canSimpleReactivate()?void 0:"Changes have been made to a cancelled order",footerIcon:this.canSimpleReactivate()?void 0:"warning"},{value:Fe.Custom,label:"Custom",description:"Customize before reactivating",icon:"tune"}],this.canSimpleReactivate()?this.reactivationMode.set(Fe.Simple):(this.reactivationMode.set(Fe.Custom),this.onModeSelected(Fe.Custom)),this.dialog.show()}onModeSelected(e){this.reactivationMode.set(e),this.isCustom()&&this.isTermed()&&this.loadTermedSettings()}loadTermedSettings(){this.isLoading.set(!0),this.orderService.orderSettings().pipe(te(()=>this.isLoading.set(!1))).subscribe({next:e=>{this.enableSpecificEffectiveEndDate.set(e?.enableSpecificEffectiveEndDate??!1),this.calculateEndDate()}})}onRenewalMonthsChange(e){this.renewalMonths.set(e),this.calculateEndDate()}onEndDateChange(e){this.calculatedEndDate.set(e),this.renewalMonths.set(null)}calculateEndDate(){let e=this.order()?.effectiveEndDate;if(e){if(!this.renewalMonths()){this.calculatedEndDate.set(e);return}this.isLoading.set(!0),this.orderService.calculateEndDateForOrder(this.renewalDate(),this.renewalMonths()).pipe(te(()=>this.isLoading.set(!1))).subscribe({next:i=>{this.calculatedEndDate.set(i),this.isLoading.set(!1)}})}}onProductSelectionChanged(){this.selectedProductIds.set(this.products().filter(e=>e.isChecked).map(e=>e.id))}onClickReactivateSimple(){this.isLoading.set(!0);let e=this.order();
1e?.effectiveEndDate&&(e.effectiveChangeDate=N.addDays(e.effectiveEndDate,1)),this.orderReactivationService.simpleReactivateOrder(e).pipe(te(()=>this.isLoading.set(!1))).subscribe({next:i=>{this.dialog.close(),this.router.navigate(["/orders",i.id]),this.notificationService.success(`Order ${i.orderNumber} has been reactivated`)},error:i=>{this.notificationService.error(i.error?.message??"Error reactivating order")}})}onClickContinueCustom(){let e={mode:Fe.Custom,selectedProductIds:this.selectedProductIds()};this.isTermed()&&(e.effectiveEndDate=this.calculatedEndDate(),e.renewalMonths=this.renewalMonths()),this.orderReactivationService.setReactivateContext(e),this.dialog.close(),this.router.navigate(["/orders/update",this.order()?.id])}static{this.\u0275fac=function(i){return new(i||n)}}static{this.\u0275cmp=I({type:n,selectors:[["yon-reactivate-order-dialog"]],viewQuery:function(i,t){if(i&1&&B(ed,5)(td,5),i&2){let o;D(o=w())&&(t.dialog=o.first),D(o=w())&&(t.productSelectionTable=o.first)}},inputs:{order:[1,"order"],canSimpleReactivate:[1,"canSimpleReactivate"]},decls:4,vars:3,consts:[["dialog",""],["dialogContent",""],["productSelectionTable",""],["dialogSize","lg","customClass","reactivate-order-dialog",3,"header","isLoading","containerTemplate"],[1,"p-3"],[3,"selectionChange","options","selected"],[1,"reactivation-info-banner","mt-1"],[1,"material-symbols-sharp","reactivation-info-banner__icon"],[1,"reactivation-info-banner__label"],[1,"reactivation-info-banner__date"],[1,"mt-1"],[1,"mt-3","flex","flex-row","justify-end"],[1,"mt-2"],[1,"flex","flex-row"],["type","integer","matTooltip","The number of months the reactivated order will run","matTooltipPosition","before",1,"flex-1","mr-3",3,"ngModelChange","title","ngModel","min"],["type","date",1,"flex-1",3,"title","ngModel","readOnly"],["type","date",1,"flex-1",3,"ngModelChange","title","ngModel","readOnly"],["entity","orderproduct",3,"checkboxSelectionChanged","isManualData","manualTableData","defaultFields","defaultPageSize","checkboxConfig"],["color","primary",1,"mr-2",3,"disabled"],[3,"onClick","disabled"],["color","primary",1,"mr-2",3,"onClick","disabled"]],template:function(i,t){if(i&1&&(b(0,"yon-dialog-center",3,0),M(2,cd,12,8,"ng-template",null,1,R)),i&2){let o,g=x(3);s("header","Reactivate Order "+((o=t.order())==null?null:o.orderNumber))("isLoading",t.isLoading())("containerTemplate",g)}},dependencies:[Le,$,X,Z,G,at,ie,oe,Q,ri,ve,ke],encapsulation:2})}}return n})();var ud=["dialog"];function pd(n,u){if(n&1){let e=y();d(0,"yon-field",5),Y("ngModelChange",function(t){p(e);let o=l(2);return K(o.targetDate,t)||(o.targetDate=t),m(t)}),a()}if(n&2){let e=l(2);U("ngModel",e.targetDate),s("title","Target date")}}function md(n,u){if(n&1){let e=y();d(0,"yon-field",5),Y("ngModelChange",function(t){p(e);let o=l(2);return K(o.targetDates.oneOff,t)||(o.targetDates.oneOff=t),m(t)}),a(),d(1,"yon-field",5),Y("ngModelChange",function(t){p(e);let o=l(2);return K(o.targetDates.recurringInAdvance,t)||(o.targetDates.recurringInAdvance=t),m(t)}),a(),d(2,"yon-field",5),Y("ngModelChange",function(t){p(e);let o=l(2);return K(o.targetDates.recurringInArrears,t)||(o.targetDates.recurringInArrears=t),m(t)}),a(),d(3,"yon-field",5),Y("ngModelChange",function(t){p(e);let o=l(2);return K(o.targetDates.usage,t)||(o.targetDates.usage=t),m(t)}),a(),d(4,"yon-field",5),Y("ngModelChange",function(t){p(e);let o=l(2);return K(o.targetDates.measured,t)||(o.targetDates.measured=t),m(t)}),a()}if(n&2){let e=l(2);U("ngModel",e.targetDates.oneOff),s("title","Target date one-off"),r(),U("ngModel",e.targetDates.recurringInAdvance),s("title","Target date recurring in advance"),r(),U("ngModel",e.targetDates.recurringInArrears),s("title","Target date recurring in arrears"),r(),U("ngModel",e.targetDates.usage),s("title","Target date usage"),r(),U("ngModel",e.targetDates.measured),s("title","Target date measured")}}function _d(n,u){if(n&1){let e=y();d(0,"div",4)(1,"yon-button",9),_("onClick",function(){p(e);let t=l(2);return m(t.toggleAdvancedTargetsDates())}),c(2),a()()}if(n&2){let e=l(2);r(),s("buttonIcon",e.isAdvancedTargetsDates?"calendar_today":"calendar_add_on"),r(),S(" ",e.isAdvancedTargetsDates?"Single target date":"Customized target dates"," ")}}function gd(n,u){if(n&1){let e=y();h(0,pd,1,2,"yon-field",3),h(1,md,5,10),h(2,_d,3,2,"div",4),d(3,"yon-field",5),Y("ngModelChange",function(t){p(e);let o=l();return K(o.invoiceDate,t)||(o.invoiceDate=t),m(t)}
1),a(),d(4,"div",6)(5,"yon-button",7),_("onClick",function(){p(e);let t=l();return m(t.onClickInvoiceOrder())}),c(6," CREATE INVOICE "),a(),d(7,"yon-button",8),_("onClick",function(){p(e),l();let t=x(1);return m(t.close())}),c(8,"CANCEL"),a()()}if(n&2){let e=l();C((e.order==null?null:e.order.orderType)===e.OrderTypes.Subscription&&!e.isAdvancedTargetsDates?0:-1),r(),C((e.order==null?null:e.order.orderType)===e.OrderTypes.Subscription&&e.isAdvancedTargetsDates?1:-1),r(),C((e.order==null?null:e.order.orderType)===e.OrderTypes.Subscription?2:-1),r(),U("ngModel",e.invoiceDate),s("title","Invoice date"),r(2),s("disabled",e.isLoading)("permission",e.ApplicationPermissions.InvoiceCreate)}}var ho=(()=>{class n{constructor(e,i,t,o){this.notificationService=e,this.dialogService=i,this.invoiceService=t,this.router=o,this.targetDates=new Ii,this.targetDate=new Date,this.invoiceDate=new Date,this.OrderTypes=J,this.ApplicationPermissions=pe}show(){this.dialog.show()}onClickInvoiceOrder(){this.isLoading=!0,this.order.orderType===J.SalesOrder&&(this.targetDate=this.invoiceDate),this.isAdvancedTargetsDates||(this.targetDates.oneOff=this.targetDate,this.targetDates.recurringInAdvance=this.targetDate,this.targetDates.recurringInArrears=this.targetDate,this.targetDates.usage=this.targetDate,this.targetDates.measured=this.targetDate);let e={invoiceDate:this.invoiceDate,targetDates:this.targetDates,accountIds:void 0,allAccounts:!1,orderId:this.order.id,invoiceBatchGroupIds:void 0,allBatchGroups:!1,minimumInvoiceAmount:null};this.invoiceService.generateInvoices(e).pipe(F(1)).subscribe({next:i=>V(this,null,function*(){switch(this.isLoading=!1,i?.invoices?.length){case 0:this.notificationService.warning("There was nothing to invoice");break;case 1:this.dialog.close();let t=i.invoices[0];this.router.navigate(["invoices",t.id]);break;default:this.dialog.close();let o=`Successfully created ${i.invoices.length} invoice drafts`;(yield this.dialogService.createConfirmDialog(o,"Go to invoice batch?","SEE BATCH","STAY"))&&this.router.navigate(["invoices/create"])}}),error:i=>{this.isLoading=!1,this.notificationService.error(i?.error?.message??"An error occurred when creating the invoice")}})}toggleAdvancedTargetsDates(){this.isAdvancedTargetsDates=!this.isAdvancedTargetsDates,this.isAdvancedTargetsDates&&(this.targetDates.oneOff=this.targetDate,this.targetDates.recurringInAdvance=this.targetDate,this.targetDates.recurringInArrears=this.targetDate,this.targetDates.usage=this.targetDate,this.targetDates.measured=this.targetDate)}static{this.\u0275fac=function(i){return new(i||n)(k(j),k(se),k($n),k(fe))}}static{this.\u0275cmp=I({type:n,selectors:[["yon-create-invoice-dialog"]],viewQuery:function(i,t){if(i&1&&B(ud,5),i&2){let o;D(o=w())&&(t.dialog=o.first)}},inputs:{order:"order"},decls:4,vars:2,consts:[["dialog",""],["dialogContent",""],["header","Invoice order",3,"isLoading","containerTemplate"],["type","date",3,"ngModel","title"],[1,"mb-2","mt-1-v3"],["type","date",3,"ngModelChange","ngModel","title"],[1,"mt-2"],["color","primary",1,"mr-2",3,"onClick","disabled","permission"],[3,"onClick"],[3,"onClick","buttonIcon"]],template:function(i,t){if(i&1&&(b(0,"yon-dialog",2,0),M(2,gd,9,7,"ng-template",null,1,R)),i&2){let o=x(3);s("isLoading",t.isLoading)("containerTemplate",o)}},dependencies:[$,X,Z,G,ie,je,Q],encapsulation:2})}}return n})();var hd=["dialog"];function Cd(n,u){if(n&1&&b(0,"yon-entity-field",6),n&2){let e=l(2);s("entity",e.charge)("readOnly",!0)}}function fd(n,u){if(n&1&&b(0,"yon-entity-field",7),n&2){let e=l(2);s("entity",e.charge)("readOnly",!0)}}function vd(n,u){if(n&1){let e=y();b(0,"yon-entity-field",4)(1,"yon-entity-field",5),h(2,Cd,1,2,"yon-entity-field",6),h(3,fd,1,2,"yon-entity-field",7),b(4,"yon-entity-field",8),d(5,"mat-checkbox",9,2),c(7," Close charge after this delivery "),a(),d(8,"div",10)(9,"yon-button",11),_("onClick",function(){p(e);let t=x(6),o=l();return m(o.onCreatePartialDelivery(t.checked))}),c(10," DELIVER "),a(),d(11,"yon-button",12),_("onClick",function(){p(e);let t=l(),o=x(1);return t.charge.quantity=null,m(o.close())}),c(12," CANCEL "),a()()}if(n&2){let e=l();s("entity",e.charge)("readOnly",!0),r(),s("entity",e.charge)("readOnly",!0),r(),C((e.charge==null?null:e.charge.orderedQuantity)!=null?2:-1),r(),C((e.charge==null?null:e.charge.remainingQuantity)!=null?3:-1),r(),s("entity",e.charge)("min",0)("max",e.charge==null?null:e.charge.remainingQuantity),r(),s("checked",(e.charge==null?null:e.charge.quantity)===0||(e.charge==null?null:e.charge.quantity)===(e.charge==null?null:e.charge.remainingQuantity))("disabled",(e.charge==null?null:e.charge.quantity)===0||(e.charge==null?null:e.charge.quantity)===(e.charge==null?null:e.charge.remainingQuantity)),r(4),s("disabled",e.isLoading),r(2),s("disabled",e.isLoading)}}var Co=(()=>{class n{constructor(e,i,t){this.dialogService=e,this.notificationService=i,this.orderProductChargeService=t,this.onPartialDeliveryCreated=new ne}show(){this.charge.quantity=this.charge.remainingQuantity,this.dialog.show()}
1onCreatePartialDelivery(e){return V(this,null,function*(){e&&this.charge.quantity<this.charge.remainingQuantity&&!(yield this.dialogService.confirmYesNo("By closing the charge you will not be able to register additional deliveries. Continue?"))||(this.isLoading=!0,this.orderProductChargeService.createPartialDelivery(this.charge.id,this.charge.quantity,e).pipe(F(1)).subscribe({next:t=>{this.onPartialDeliveryCreated.emit(t),this.dialog.close(),this.isLoading=!1},error:t=>{this.notificationService.error(t.error.message),this.isLoading=!1}}))})}static{this.\u0275fac=function(i){return new(i||n)(k(se),k(j),k(ct))}}static{this.\u0275cmp=I({type:n,selectors:[["yon-partial-delivery-dialog"]],viewQuery:function(i,t){if(i&1&&B(hd,5),i&2){let o;D(o=w())&&(t.dialog=o.first)}},inputs:{charge:"charge"},outputs:{onPartialDeliveryCreated:"onPartialDeliveryCreated"},decls:4,vars:2,consts:[["dialog",""],["dialogContent",""],["closeCharge",""],["header","Delivery",3,"isLoading","containerTemplate"],["entityName","orderproductcharge","fieldName","chargeNumber",3,"entity","readOnly"],["entityName","orderproductcharge","fieldName","name",3,"entity","readOnly"],["entityName","orderproductcharge","fieldName","orderedQuantity",3,"entity","readOnly"],["entityName","orderproductcharge","fieldName","remainingQuantity",3,"entity","readOnly"],["entityName","orderproductcharge","fieldName","quantity",3,"entity","min","max"],[3,"checked","disabled"],[1,"mt-2"],["color","primary",1,"mr-2",3,"onClick","disabled"],[3,"onClick","disabled"]],template:function(i,t){if(i&1&&(b(0,"yon-dialog",3,0),M(2,vd,13,13,"ng-template",null,1,R)),i&2){let o=x(3);s("isLoading",t.isLoading)("containerTemplate",o)}},dependencies:[G,At,je,st,Q],encapsulation:2})}}return n})();var yd=["dialog"];function bd(n,u){if(n&1){let e=y();d(0,"yon-field",13),Y("ngModelChange",function(t){p(e);let o=l(2);return K(o.selectedTemplateLookup,t)||(o.selectedTemplateLookup=t),m(t)}),_("onChange",function(){p(e);let t=l(2);return m(t.onSelectTemplate())}),a()}if(n&2){let e=l(2);s("valuePrimitive",!1),U("ngModel",e.selectedTemplateLookup),s("data",e.documentTemplateLookups)("title","Select template")}}function xd(n,u){if(n&1){let e=y();b(0,"mat-divider",14),d(1,"h5",15),c(2),a(),b(3,"yon-email-list-input",16,2),d(5,"div",10)(6,"yon-button",17),_("onClick",function(){p(e);let t=x(4),o=l(2);return m(o.onClickEmailConfirmation(t.list))}),c(7," SEND EMAIL "),a()(),b(8,"mat-divider",14)}if(n&2){let e=x(4),i=l(2);r(2),S(" Send order ",(i.selectedTemplate==null?null:i.selectedTemplate.documentType)===i.DocumentTypes.OrderConfirmation?"confirmation":""," to emails "),r(),s("accountInvoiceEmail",i.order.invoiceAccount==null?null:i.order.invoiceAccount.invoiceEmailAddress),r(3),s("disabled",!(e.list.length>0)||!i.isSuccessful()||i.isLoading())}}function Dd(n,u){if(n&1){let e=y();h(0,bd,1,4,"yon-field",4),d(1,"div",5)(2,"div",6)(3,"yon-field",7),Y("ngModelChange",function(t){p(e);let o=l();return K(o.selectedFileFormat,t)||(o.selectedFileFormat=t),m(t)}),a()(),d(4,"yon-button",8),_("onClick",function(){p(e);let t=l();return m(t.onClickDownloadDocument())}),a(),d(5,"yon-button",9),_("onClick",function(){p(e);let t=l();return m(t.printOrderConfirmationPdf())}),a()(),h(6,xd,9,3),d(7,"div",10)(8,"yon-button",11),_("onClick",function(){p(e);let t=l();return m(t.printOrderConfirmationPdf())}),c(9," PRINT PDF "),a(),d(10,"yon-button",12),_("onClick",function(){p(e),l();let t=x(1);return m(t.close())}),c(11,"CANCEL"),a()()}if(n&2){let e=l();C(e.documentTemplateLookups?0:-1),r(3),s("title","FILE EXTENSION"),U("ngModel",e.selectedFileFormat),s("data",e.ApplicationEnums.fileFormat)("valuePrimitive",!0)("isRequired",!0),r(),s("buttonIcon","download")("tooltip","Download order document")("weight",350)("disabled",!e.isSuccessful()||e.isLoading()),r(),s("tooltip","Print order document PDF")("buttonIcon","print")("weight",350)("disabled",e.selectedFileFormat!==e.FileFormats.Pdf||!e.isSuccessful()||e.isLoading()),r(),C((e.selectedTemplate==null?null:e.selectedTemplate.documentType)===e.DocumentTypes.OrderConfirmation||(e.selectedTemplate==null?null:e.selectedTemplate.documentType)===e.DocumentTypes.OrderGeneric?6:-1),r(2),s("disabled",!e.isSuccessful()||e.isLoading())}}var fo=(()=>{class n{constructor(){this.isLoading=v(!1),this.isSuccessful=v(!1),this.unsubscribe$=new Ae,this.DocumentTypes=Me,this.ApplicationEnums=Pe,this.Validators=Bi,this.FileFormats=li,this.notificationService=O(j),this.documentTemplateService=O(rn),this.orderService=O(H)}ngOnDestroy(){this.unsubscribe$.next()}
1show(){(!this.documentTemplateLookups||!this.isSuccessful())&&(this.loadDocumentTemplate(),this.selectedFileFormat=Pe.fileFormat[0].id),this.dialog.show()}loadDocumentTemplate(){this.isLoading.set(!0);let e=Ni.fromNameAndValueKey("DocumentTemplate","Description");e.condition=`DocumentType == ${Me.OrderConfirmation} || DocumentType == ${Me.PackingSlip} || DocumentType == ${Me.OrderGeneric}`,this.documentTemplateService.lookupQuery(e,i=>on.map(i,"description")).pipe(W(this.unsubscribe$),te(()=>this.isLoading.set(!1))).subscribe({next:i=>{if(!(i?.length>0)){this.notificationService.warning("Please add an order document template in the Settings page");return}this.documentTemplateLookups=i,this.selectedTemplateLookup=this.documentTemplateLookups[0],this.onSelectTemplate(),this.isSuccessful.set(!0)},error:i=>{this.notificationService.error(i.error?.message??"Could not load document"),this.isSuccessful.set(!1)}})}onSelectTemplate(){return V(this,null,function*(){this.selectedTemplate=yield me(this.documentTemplateService.fetchById(this.selectedTemplateLookup.id)),this.selectedTemplate&&(this.isLoading.set(!0),this.documentTemplateService.getOrderConfirmationPreview(this.order.id,this.selectedTemplate.id,li.Pdf).pipe(W(this.unsubscribe$),te(()=>this.isLoading.set(!1))).subscribe({next:e=>{this.pdfBlobToPrint=e,this.pdfSrc=URL.createObjectURL(e),this.isSuccessful.set(!0)},error:e=>{this.notificationService.error(e),this.isSuccessful.set(!1)}}))})}onClickDownloadDocument(){return V(this,null,function*(){let e="";switch(this.isLoading.set(!0),this.selectedTemplate.documentType){case Me.OrderConfirmation:e=`Order_Confirmation_${this.order.orderNumber}_${Pe.fileFormat[this.selectedFileFormat].displayValue}`,yield this.documentTemplateService.getOrderConfirmationById(this.order.id,this.selectedTemplate.id,e,this.selectedFileFormat);break;case Me.PackingSlip:e=`Packing_Slip_${this.order.orderNumber}_${Pe.fileFormat[this.selectedFileFormat].displayValue}`,yield this.documentTemplateService.getPackingSlip(this.order.id,this.selectedTemplate.id,e,this.selectedFileFormat);break;case Me.OrderGeneric:e=`Order_${this.selectedTemplate.description}_${this.order.orderNumber}_${Pe.fileFormat[this.selectedFileFormat].displayValue}`,yield this.documentTemplateService.getOrderGeneric(this.order.id,this.selectedTemplate.id,e,this.selectedFileFormat);break}this.isLoading.set(!1)})}onClickEmailConfirmation(e){if(this.emailError=!1,e?.length>0){if(this.isLoading.set(!0),this.selectedTemplate.documentType===Me.OrderConfirmation||this.selectedTemplate.documentType===Me.OrderGeneric){let i={documentId:this.selectedTemplate.id,accountId:this.order.accountId,orderId:this.order.id,userInputEmail:e};this.orderService.sendOrderConfirmationEmail(i,this.selectedTemplate.documentType).pipe(W(this.unsubscribe$)).subscribe({next:t=>{this.dialog.close(),this.isLoading.set(!1),this.notificationService.info("Email was sent")},error:t=>{this.notificationService.error(t.error?.message??"Could not send email, try again or contact younium support if the problem persists."),this.isLoading.set(!1)}})}}else this.emailError=!0}printOrderConfirmationPdf(){let e=new Blob([this.pdfBlobToPrint],{type:"application/pdf"}),i=URL.createObjectURL(e),t=document.createElement("iframe");t.style.display="none",t.src=i,document.body.appendChild(t),t.contentWindow.print()}static{this.\u0275fac=function(i){return new(i||n)}}static{this.\u0275cmp=I({type:n,selectors:[["yon-order-documents-dialog"]],viewQuery:function(i,t){if(i&1&&B(yd,5),i&2){let o;D(o=w())&&(t.dialog=o.first)}},inputs:{order:"order"},decls:4,vars:3,consts:[["dialog",""],["dialogContent",""],["toEmails",""],["header","Order documents",3,"documentPreviewPdfSrc","isLoading","containerTemplate"],["type","select","textField","displayValue","valueField","id",3,"valuePrimitive","ngModel","data","title"],[1,"mb-2","flex","flex-row","items-center","justify-start"],[2,"width","50%"],["type","select","textField","displayValue","valueField","id",3,"ngModelChange","title","ngModel","data","valuePrimitive","isRequired"],["type","mat-icon-button","download","",1,"ml-2",3,"onClick","buttonIcon","tooltip","weight","disabled"],["type","mat-icon-button",1,"ml-2",3,"onClick","tooltip","buttonIcon","weight","disabled"],[1,"mt-2"],["color","primary",1,"mr-2",3,"onClick","disabled"],[3,"onClick"],["type","select","textField","displayValue","valueField","id",3,"ngModelChange","onChange","valuePrimitive","ngModel","data","title"],[1,"my-2"],[1,"mb-2"],["fieldTitle","To Emails",3,"accountInvoiceEmail"],["color","primary",3,"onClick","disabled"]],template:function(i,t){if(i&1&&(b(0,"yon-dialog",3,0),M(2,Dd,12,16,"ng-template",null,1,R)),i&2){let o=x(3);s("documentPreviewPdfSrc",t.pdfSrc)("isLoading",t.isLoading())("containerTemplate",o)}},dependencies:[$,X,Z,G,Be,ie,je,Q,an],encapsulation:2})}}return n})();var wd=["dialog"],Sd=["table"],Td=n=>({selected:n});function Od(n,u){n&1&&(d(0,"mat-header-cell"),c(1,"LINE NUMBER"),a())}function Md(n,u){if(n&1&&(d(0,"mat-cell",15),c(1),a()),n&2){let e=u.$implicit;r(),S(" ",e.productLineNumber," ")}}function Pd(n,u){n&1&&(d(0,"mat-header-cell"),c(1,"PRODUCT NAME"),a())}function Ed(n,u){if(n&1&&(d(0,"mat-cell",15),c(1),a()),n&2){let e=u.$implicit;r(),S(" ",e.name," ")}}function kd(n,u){n&1&&(d(0,"mat-header-cell"),c(1,"PRODUCT NUMBER"),a())}function Nd(n,u){if(n&1&&(d(0,"mat-cell",15),c(1),a()),n&2){let e=u.$implicit;r(),S(" ",e.productNumber," ")}}function Vd(n,u){n&1&&b(0,"mat-header-row")}function Id(n,u){if(n&1){let e=y();d(0,"mat-row",16),_("click",function(){let t=p(e).$implicit,o=l(2);return m(o.highlightProduct(t))}),a()}if(n&2){let e=u.$implicit,i=l(2);s("cdkDragData",e)("ngClass",Te(2,Td,i.selectedRowIndex==e.productLineNumber))}}function Fd(n,u){if(n&1){let e=y();d(0,"p"),c(1," Invoices from this order will follow the line order below. Drag and drop lines to re-arrange lines. "),a(),d(2,"mat-table",4,2),_("cdkDropListDropped",function(t){p(e);let o=l();return m(o.dropTable(t))}),xe(4,5),M(5,Od,2,0,"mat-header-cell",6)(6,Md,2,1,"mat-cell",7),De(),xe(7,8),M(8,Pd,2,0,"mat-header-cell",6)(9,Ed,2,1,"mat-cell",7),De(),xe(10,9),M(11,kd,2,0,"mat-header-cell",6)(12,Nd,2,1,"mat-cell",7),De(),M(13,Vd,1,0,"mat-header-row",10)(14,Id,1,4,"mat-row",11),a(),d(15,"div",12)(16,"yon-button",13),_("onClick",function(){p(e);let t=l();return m(t.onClickSaveProductLineNumbers())}),c(17," SAVE "),a(),d(18,"yon-button",14),_("onClick",function(){p(e);let t=l();return m(t.onCancel())}),c(19,"CANCEL"),a()()}if(n&2){let e=l();r(2),s("dataSource",e.productsToArrange)("cdkDropListData",e.productsToArrange),r(11),s("matHeaderRowDef",e.displayedColumns),r(),s("matRowDefColumns",e.displayedColumns),r(2),s("disabled",e.isLoading),r(2),s("disabled",e.isLoading)}}var vo=(()=>{class n{constructor(e,i){this.orderService=e,this.notificationService=i,this.productLineNumbersReordered=new ne,this.productsToArrange=new Ut,this.displayedColumns=["productLineNumber","name","productNumber"]}show(){let e=this.order.orderProducts.filter(i=>!i.isAddedCharge);this.orderProducts=Ee.sort(e,"productLineNumber").map(i=>ae({},i)),this.productsToArrange.data=this.orderProducts,this.dialog.show()}onClickSaveProductLineNumbers(){this.isLoading=!0,this.orderService.saveProductLineNumbers(this.orderProducts).subscribe({next:e=>
1{e&&(this.isLoading=!1,this.orderProducts.forEach(i=>{let t=this.order.orderProducts.find(o=>o.id===i.id);t&&(t.productLineNumber=i.productLineNumber)}),this.productLineNumbersReordered.emit(),this.notificationService.info(`Products for order ${this.order.orderNumber} were arranged`),this.dialog.close())},error:e=>{this.isLoading=!1,this.notificationService.error(e.error.message)}})}dropTable(e){let i=e.previousIndex,t=e.currentIndex;ji(this.orderProducts,i,t);let o=1;this.orderProducts.forEach(g=>g.productLineNumber=o++),this.productsToArrange.data=this.orderProducts,this.selectedRowIndex=t+1,this.table.renderRows()}highlightProduct(e){let t=this.productsToArrange.data.findIndex(o=>o===e)+1;this.selectedRowIndex==t?this.selectedRowIndex=void 0:this.selectedRowIndex=t}onCancel(){this.dialog.close(),this.resetDialog()}resetDialog(){this.orderProducts=[],this.productsToArrange.data=[],this.selectedRowIndex=void 0}static{this.\u0275fac=function(i){return new(i||n)(k(H),k(j))}}static{this.\u0275cmp=I({type:n,selectors:[["yon-reorder-products-dialog"]],viewQuery:function(i,t){if(i&1&&B(wd,5)(Sd,5),i&2){let o;D(o=w())&&(t.dialog=o.first),D(o=w())&&(t.table=o.first)}},inputs:{order:"order"},outputs:{productLineNumbersReordered:"productLineNumbersReordered"},decls:4,vars:2,consts:[["dialog",""],["dialogContent",""],["table",""],["header","Arrange products","dialogSize","lg",3,"isLoading","containerTemplate"],["cdkDropList","",2,"width","100%",3,"cdkDropListDropped","dataSource","cdkDropListData"],["matColumnDef","productLineNumber"],[4,"matHeaderCellDef"],["style","text-align: left",4,"matCellDef"],["matColumnDef","name"],["matColumnDef","productNumber"],[4,"matHeaderRowDef"],["cdkDrag","",3,"cdkDragData","ngClass","click",4,"matRowDef","matRowDefColumns"],[1,"mt-2"],["color","primary",1,"mr-2",3,"onClick","disabled"],[3,"onClick","disabled"],[2,"text-align","left"],["cdkDrag","",3,"click","cdkDragData","ngClass"]],template:function(i,t){if(i&1&&(b(0,"yon-dialog-center",3,0),M(2,Fd,20,6,"ng-template",null,1,R)),i&2){let o=x(3);s("isLoading",t.isLoading)("containerTemplate",o)}},dependencies:[G,Tt,Qi,qi,Lt,jt,zt,qt,Bt,$t,Qt,Gt,Ht,Wt,oe,Q],styles:[".mat-row[_ngcontent-%COMP%]:hover{cursor:move}"]})}}return n})();var Ad=["setInvoiceToDateDialog"];function Rd(n,u){if(n&1){let e=y();d(0,"yon-button",8),_("onClick",function(){p(e);let t=l(2);return m(t.onClearInvoicedTo())}),c(1," CLEAR DATE "),a()}}function Ld(n,u){if(n&1){let e=y();d(0,"p"),c(1," Set new "),d(2,"i"),c(3,"invoiced to date"),a(),c(4),a(),d(5,"yon-field",3),Y("ngModelChange",function(t){p(e);let o=l();return K(o.newChargedThroughDate,t)||(o.newChargedThroughDate=t),m(t)}),a(),d(6,"div",4)(7,"yon-button",5),_("onClick",function(){p(e);let t=l();return m(t.onUpdateInvoicedToDateValidation())}),c(8," SAVE "),a(),h(9,Rd,2,0,"yon-button",6),d(10,"yon-button",7),_("onClick",function(){p(e),l();let t=x(1);return m(t.close())}),c(11,"CANCEL"),a()()}if(n&2){let e=l();r(4),S(" for charge ",e.charge==null?null:e.charge.chargeNumber," "),r(),U("ngModel",e.newChargedThroughDate),s("isRequired",!0)("min",e.charge==null?null:e.charge.effectiveStartDate),r(2),s("disabled",!e.newChargedThroughDate),r(2),C(e.chargeThroughDateBeforeEdit?9:-1)}}var yo=(()=>{class n{constructor(e,i,t){this.notificationService=e,this.dialogService=i,this.orderService=t,this.onInvoicesToChanged=new ne}show(){this.chargeThroughDateBeforeEdit=this.charge?.chargedThroughDate,this.newChargedThroughDate=this.charge?.chargedThroughDate,this.setInvoiceToDateDialog.show()}onUpdateInvoicedToDateValidation(e=!1){if(!this.charge||!e&&!this.newChargedThroughDate)return;let i=e?null:this.newChargedThroughDate,t=be(ae({},this.charge),{chargedThroughDate:i});e?this.updateInvoicedToDate(null):this.orderService.canUpdateInvoicedTo(t,this.orderId).pipe(F(1)).subscribe({next:o=>V(this,null,function*(){o.error===!1&&o.message?(yield this.dialogService.confirmYesNo("You are updating the invoiced-to date to an earlier value. This change may impact your billing data. Do you want to continue?"))&&this.updateInvoicedToDate(i):this.updateInvoicedToDate(i)}),error:o=>{this.notificationService.error(o.error.message)}})}updateInvoicedToDate(e){this.charge.chargedThroughDate=e,this.orderService.updateInvoicedToDate(this.charge,this.orderId).pipe(F(1)).subscribe({next:i=>
1{let t=e?`Updated invoice to date to ${N.getDayFormatted(this.charge.chargedThroughDate)} on charge ${this.charge.chargeNumber}`:`Cleared invoice to date on charge ${this.charge.chargeNumber}`;this.notificationService.info(t),this.setInvoiceToDateDialog.close(),this.onInvoicesToChanged.emit()},error:i=>{this.charge.chargedThroughDate=this.chargeThroughDateBeforeEdit,this.notificationService.error(i.error.message)}})}onClearInvoicedTo(){return V(this,null,function*(){if(!this.charge)return;let e=`Do you want to clear invoice to date for charge ${this.charge.chargeNumber}`;(yield this.dialogService.confirmYesNo(e))&&this.updateInvoicedToDate(null)})}static{this.\u0275fac=function(i){return new(i||n)(k(j),k(se),k(H))}}static{this.\u0275cmp=I({type:n,selectors:[["yon-set-invoiced-to-date-dialog"]],viewQuery:function(i,t){if(i&1&&B(Ad,5),i&2){let o;D(o=w())&&(t.setInvoiceToDateDialog=o.first)}},inputs:{orderId:"orderId",charge:"charge"},outputs:{onInvoicesToChanged:"onInvoicesToChanged"},decls:4,vars:1,consts:[["setInvoiceToDateDialog",""],["setInvoiceToDateDialogContent",""],["header","Set invoiced to date",3,"containerTemplate"],["type","date",3,"ngModelChange","ngModel","isRequired","min"],[1,"mt-2"],["color","primary",1,"mr-2",3,"onClick","disabled"],["buttonIcon","delete",1,"mr-2"],[3,"onClick"],["buttonIcon","delete",1,"mr-2",3,"onClick"]],template:function(i,t){if(i&1&&(b(0,"yon-dialog-center",2,0),M(2,Ld,12,6,"ng-template",null,1,R)),i&2){let o=x(3);s("containerTemplate",o)}},dependencies:[$,X,Z,G,ie,oe,Q],encapsulation:2})}}return n})();var Bd=(n,u)=>u.id;
1function jd(n,u){n&1&&b(0,"mat-divider")}function qd(n,u){if(n&1&&(d(0,"li")(1,"div",2)(2,"div",3)(3,"a",4)(4,"span",5),c(5),a()()(),d(6,"div",3)(7,"small"),c(8),z(9,"date"),a()(),d(10,"div",3),b(11,"yon-amount",6),a(),d(12,"div",3),b(13,"yon-amount",7),a()(),h(14,jd,1,0,"mat-divider"),a()),n&2){let e=u.$implicit,i=u.$index,t=u.$count,o=l();r(),q("mt-1",i!==0),r(2),s("routerLink","/bookings/"+e.id),r(2),S(" ",o.ApplicationEnums.bookingTypes[e==null?null:e.bookingType].displayValue," "),r(3),L(_t(9,8,e.effectiveDate)),r(3),s("amount",e==null?null:e.cmrr),r(2),s("amount",e==null?null:e.acv),r(),C(i!==t-1?14:-1)}}var bo=(()=>{class n{constructor(e){this.queryService=e,this.notificationService=O(j),this.orderNumber=Ie(),this.bookings=v([]),this.ApplicationEnums=Pe,Ke(()=>{this.orderNumber()&&this.loadOrderBookings()})}loadOrderBookings(){this.queryService.query({entity:"booking",displayFields:["id","bookingType","effectiveDate","cmrrAmount","cmrrCurrencyCode","acvAmount","acvCurrencyCode"],conditions:[{fieldName:"orderorderNumber",value:this.orderNumber()}]}).pipe(Re(e=>e.result),F(1)).subscribe({next:e=>{e.forEach(t=>{t.cmrr=new Xe(null,t.cmrrAmount,t.cmrrCurrencyCode),t.acv=new Xe(null,t.acvAmount,t.acvCurrencyCode)});let i=e.sort((t,o)=>{let g=new Date(t.effectiveDate).getTime(),f=new Date(o.effectiveDate).getTime();return g-f});this.bookings.set(i)},error:()=>{this.notificationService.error("Failed to load Order bookings")}})}static{this.\u0275fac=function(i){return new(i||n)(k(lt))}}static{this.\u0275cmp=I({type:n,selectors:[["yon-order-bookings-card"]],inputs:{orderNumber:[1,"orderNumber"]},decls:4,vars:0,consts:[["header","Bookings"],[1,"scrollable-when-high"],[1,"row","mb-1"],[1,"col-sm-6","col-lg-3","col-xl-12","col-xxl-6"],["href","#",3,"routerLink"],[2,"font-size","14px"],["label","CMRR",2,"font-size","14px",3,"amount"],["label","ACV",2,"font-size","14px",3,"amount"]],template:function(i,t){i&1&&(d(0,"yon-card",0)(1,"ul",1),_e(2,qd,15,10,"li",null,Bd),a()()),i&2&&(r(2),ge(t.bookings()))},dependencies:[rt,ot,G,Be,ze,fn,Ot],encapsulation:2})}}return n})();var Qd=["productTable"],Gd=["allChargesTable"],zd=["invoicesTable"],$d=["invoiceLinesTable"],Hd=["productTableFilter"],Wd=["chargeTable"],Ud=["allChargesTableFilter"],Kd=["orderProductChargeDetailsCard"],Yd=["orderCancelProduct"],Jd=["orderModifyProduct"],Xd=["orderSplitOrder"],Zd=["orderMassUpdateCharges"],el=["detailsLayoutRightModalGroupFields"],tl=["tabsRightModal"],il=["milestonesCard"],nl=["activationDialog"],ol=["setInvoicedToDate"],rl=["partialDelivery"],al=["bulkDelivery"],dl=n=>["/orders/",n],Do=()=>["splitToOrderId"],wo=(n,u,e)=>({enable:n,entityDescription:"product",checkboxSelectionFields:u,actionButtons:e}),ll=(n,u)=>({fieldName:"orderorderNumber",operator:n,value:u}),xo=(n,u)=>({fieldName:"invoicestatus",operator:n,value:u}),sl=(n,u,e)=>[n,u,e],cl=n=>({"tab-charges":n}),ul=(n,u)=>[n,u],So=(n,u)=>u.fieldName;function pl(n,u){n&1&&b(0,"mat-progress-bar",27)}function ml(n,u){if(n&1){let e=y();d(0,"yon-button",62),_("onClick",function(){p(e),l(3);let t=x(8);return m(t.show())}),c(1," Renew "),a()}if(n&2){let e=l(3);s("permission",e.ApplicationPermissions.OrderUpdate)("disabled",e.disableOrderHeaderButtons())}}function _l(n,u){if(n&1&&(d(0,"yon-button",46),c(1," Change "),a()),n&2){let e,i=l(3);s("permission",i.ApplicationPermissions.OrderActivate)("disabled",i.disableOrderHeaderButtons())("link","/orders/update/"+((e=i.order())==null?null:e.id))}}function gl(n,u){if(n&1){let e=y();d(0,"yon-button",63),_("onClick",function(){p(e),l(3);let t=x(4);return m(t.showDialog())}),c(1," Cancel "),a()}if(n&2){let e=l(3);s("permission",e.ApplicationPermissions.OrderUpdate)("disabled",e.disableOrderHeaderButtons())}}function hl(n,u){if(n&1){let e=y();d(0,"yon-button",64),_("onClick",function(){p(e);let t=l(3);return m(t.onClickRevertOrder())}),c(1," Revert "),a()}if(n&2){let e=l(3);s("permission",e.ApplicationPermissions.OrderUpdate)("disabled",e.disableOrderHeaderButtons())}}function Cl(n,u){if(n&1){let e=y();d(0,"yon-button",65),_("onClick",function(){p(e);let t=l(3);return m(t.onClickDeleteOrder())}),c(1," Delete "),a()}if(n&2){let e=l(3);s("disabled",e.disableOrderHeaderButtons())("permission",e.ApplicationPermissions.OrderDelete)}}function fl(n,u){if(n&1){let e=y();d(0,"yon-button",66),_("onClick",function(){p(e);let t=l(3);return m(t.milestonesCard.showSetMilestoneDialog())}),c(1),a()}if(n&2){let e=l(3);s("disabled",e.disableSetMilestoneButton())("permission",e.ApplicationPermissions.OrderMilestone),r(),S(" ",e.uiVersion()==="v3"?"Milestone":"Set Milestone"," ")}}function vl(n,u){if(n&1){let e=y();d(0,"yon-request-stripe-details-button",67),_("stripeCredentialStatusChange",function(){p(e);let t=l(3);return m(t.updateOrderFieldGroups())}),a()}if(n&2){let e=l(3);s("account",e.order().invoiceAccount)("isLoading",e.isLoading())("stripeCredentialStatus",e.stripeCredentialStatus())}}function yl(n,u){if(n&1){let e=y();
1d(0,"yon-details-layout-header-left"),h(1,ml,2,2,"yon-button",45),h(2,_l,2,3,"yon-button",46),h(3,gl,2,2,"yon-button",47),h(4,hl,2,2,"yon-button",58),d(5,"yon-button",59),_("onClick",function(){p(e);let t=l(2);return m(t.onClickCloneOrder())}),c(6," Clone "),a(),h(7,Cl,2,2,"yon-button",60),h(8,fl,2,3,"yon-button",61),h(9,vl,1,3,"yon-request-stripe-details-button",51),a()}if(n&2){let e,i=l(2);r(),C(i.order().canBeRenewed?1:-1),r(),C(i.order().canBeChanged?2:-1),r(),C(i.order().canBeCancelled?3:-1),r(),C(i.orderAvailableActions().canRevertOrder?4:-1),r(),s("permission",i.ApplicationPermissions.OrderCreate)("disabled",i.disableCloneOrderButton()),r(2),C(i.orderAvailableActions().canDeleteOrder?7:-1),r(),C(i.order().canSetMilestone?8:-1),r(),C(i.stripeIsActive()&&((e=i.order())==null?null:e.orderPaymentMethod)===i.OrderPaymentMethods.Stripe&&((e=i.order())!=null&&e.invoiceAccount)?9:-1)}}function bl(n,u){if(n&1){let e=y();d(0,"yon-button",68),_("onClick",function(){p(e);let t=l(2);return m(t.onSaveCharges())}),c(1," Save Changes "),a()}if(n&2){let e=l(2);s("disabled",e.invalidOpcFieldMessage())}}function xl(n,u){if(n&1&&(d(0,"yon-button",42),c(1," Edit Draft "),a()),n&2){let e,i=l(2);s("permission",i.ApplicationPermissions.OrderUpdate)("disabled",i.isLoading()||i.showSaveChangesButton()||i.editMode())("link","/orders/update/"+((e=i.order())==null?null:e.id))}}function Dl(n,u){if(n&1&&(d(0,"yon-button",43),c(1," View Invoices "),a()),n&2){let e=l(2);s("disabled",e.editMode()||e.showSaveChangesButton())("permission",e.ApplicationPermissions.InvoiceView)("link","/orders/"+e.order().id+"/invoices")}}function wl(n,u){if(n&1){let e=y();d(0,"yon-button",69),_("onClick",function(){p(e),l(2);let t=x(12);return m(t.show())}),c(1," Create Invoice "),a()}if(n&2){let e=l(2);s("disabled",e.disableCreateInvoiceButton()||e.editMode())("permission",e.ApplicationPermissions.InvoiceCreate)}}function Sl(n,u){if(n&1){let e=y();d(0,"yon-button",69),_("onClick",function(){p(e);let t=l(2);return m(t.onClickActivateOrder())}),c(1," Activate Order "),a()}if(n&2){let e=l(2);s("disabled",e.isLoading()||e.showSaveChangesButton()||e.editMode())("permission",e.ApplicationPermissions.OrderActivate)}}function Tl(n,u){if(n&1){let e=y();d(0,"yon-button",62),_("onClick",function(){p(e),l(2);let t=x(8);return m(t.show())}),c(1," Renew "),a()}if(n&2){let e=l(2);s("permission",e.ApplicationPermissions.OrderUpdate)("disabled",e.disableOrderHeaderButtons())}}function Ol(n,u){if(n&1&&(d(0,"yon-button",46),c(1," Change "),a()),n&2){let e,i=l(2);s("permission",i.ApplicationPermissions.OrderActivate)("disabled",i.disableOrderHeaderButtons())("link","/orders/update/"+((e=i.order())==null?null:e.id))}}function Ml(n,u){if(n&1){let e=y();d(0,"yon-button",63),_("onClick",function(){p(e),l(2);let t=x(4);return m(t.showDialog())}),c(1," Cancel "),a()}if(n&2){let e=l(2);s("permission",e.ApplicationPermissions.OrderUpdate)("disabled",e.disableOrderHeaderButtons())}}function Pl(n,u){if(n&1){let e=y();d(0,"yon-button",70),_("onClick",function(){p(e),l(2);let t=x(10);return m(t.show())}),c(1," Reactivate "),a()}if(n&2){let e=l(2);s("permission",e.ApplicationPermissions.OrderUpdate)("disabled",e.disableOrderHeaderButtons())}}function El(n,u){if(n&1){let e=y();d(0,"yon-button",71),_("onClick",function(){p(e),l(2);let t=x(12);return m(t.show())}),c(1," Invoice "),a()}if(n&2){let e=l(2);s("disabled",e.disableCreateInvoiceButton())("permission",e.ApplicationPermissions.InvoiceCreate)}}function kl(n,u){if(n&1){let e=y();d(0,"yon-button",72),_("onClick",function(){p(e);let t=l(2);return m(t.openBulkDelivery())}),c(1," Delivery "),a()}if(n&2){let e=l(2);s("permission",e.ApplicationPermissions.OrderUpdate)("disabled",e.disableOrderHeaderButtons())}}function Nl(n,u){if(n&1){let e=y();d(0,"yon-button",78),_("onClick",function(){p(e),l(3);let t=x(6);return m(t.showDialog())}),c(1," Adjust end date "),a()}if(n&2){let e=l(3);s("permission",e.ApplicationPermissions.OrderUpdate)("disabled",e.disableOrderHeaderButtons())}}function Vl(n,u){if(n&1&&(d(0,"yon-button",77),c(1," Change "),a()),n&2){let e,i=l(3);s("permission",i.ApplicationPermissions.OrderActivate)("disabled",i.disableOrderHeaderButtons())("link","/orders/update/"+((e=i.order())==null?null:e.id))}}function Il(n,u){if(n&1){let e=y();d(0,"yon-button",73),_("onClick",function(){p(e);let t=l(2);return m(t.onClickRevertOrder())}),c(1," Revert "),a(),d(2,"yon-button",74),_("onClick",function(){p(e);let t=l(2);return m(t.onClickCloneOrder())}),c(3," Clone "),a(),d(4,"yon-button",75),_("onClick",function(){p(e);let t=l(2);return m(t.showMilestoneDialog())}),c(5," Set Milestone "),a(),h(6,Nl,2,2,"yon-button",76),h(7,Vl,2,3,"yon-button",77)}if(n&2){let e=l(2);s("permission",e.ApplicationPermissions.OrderUpdate)("disabled",e.disableOrderHeaderButtons()||!e.orderAvailableActions().canRevertOrder),r(2),s("permission",e.ApplicationPermissions.OrderCreate)("disabled",e.disableCloneOrderButton()),r(2),s("disabled",e.disableSetMilestoneButton()||!e.order().canSetMilestone)("permission",e.ApplicationPermissions.OrderMilestone),r(2),C(e.order().canAdjustEndDate?6:-1),r(),C(e.order().canBeChanged&&e.order().isCancellationPending?7:-1)}}function Fl(n,u){if(n&1){let e=y();d(0,"yon-request-stripe-details-button",67),_("stripeCredentialStatusChange",function(){p(e);let t=l(2);return m(t.updateOrderFieldGroups())}),a()}if(n&2){let e=l(2);s("account",e.order().invoiceAccount)("isLoading",e.isLoading())("stripeCredentialStatus",e.stripeCredentialStatus())}}function Al(n,u){if(n&1){let e=y();d(0,"yon-button",79),_("onClick",function(){p(e);let t=l(2);return m(t.onClickDeleteOrder())}),c(1," Delete Order "),a()}if(n&2){let e=l(2);s("disabled",e.disableOrderHeaderButtons()||!e.orderAvailableActions().canDeleteOrder)("permission",e.ApplicationPermissions.OrderDelete)}}function Rl(n,u){if(n&1){let e=y();
1d(0,"yon-button",80),_("onClick",function(){p(e);let t=l(2);return m(t.onClickApplyPriceAdjustment())}),c(1," Apply Price Adjustment "),a()}if(n&2){let e=l(2);s("permission",e.ApplicationPermissions.OrderUpdate)("disabled",e.disableOrderHeaderButtons())}}function Ll(n,u){if(n&1&&(d(0,"h5",86),c(1,"Not latest version"),a(),d(2,"div")(3,"a",87),c(4,"Go to latest version"),a()()),n&2){let e=l(4);r(3),s("routerLink",Te(1,dl,e.lastOrderVersionId()))}}function Bl(n,u){n&1&&(d(0,"h5",84),c(1,"A newer order version exists"),a())}function jl(n,u){if(n&1&&(d(0,"div"),h(1,Ll,5,3),h(2,Bl,2,0,"h5",84),b(3,"mat-divider",85),a()),n&2){let e=l(3);r(),C(e.order().isDraftOrDeleted?-1:1),r(),C(e.order().isDraft?2:-1)}}function ql(n,u){if(n&1){let e=y();d(0,"yon-entity-fields-expandable",88),_("saveClick",function(){p(e);let t=l(3);return m(t.saveOrderProperties())})("cancelClick",function(){p(e);let t=l(3);return m(t.cancelOrderProperties())}),a()}if(n&2){let e=l(3);s("fieldGroups",e.orderFieldGroups())("entity",e.order())("readOnly",!e.editOrderMode())("showSaveAndCancelButtons",e.editOrderMode())("disableSaveAndCancelButtons",e.isLoading())}}function Ql(n,u){if(n&1){let e=y();d(0,"yon-card",55)(1,"yon-card-header-right")(2,"yon-button",81),_("onClick",function(){p(e);let t=l(2);return m(t.editOrderMode.set(!0))}),a(),d(3,"yon-button",82),_("onClick",function(){p(e);let t=l(2),o=x(33);return m(t.order().isDraftOrDeleted?o.showById("order",t.order().id):o.showForOrder(t.order().orderNumber))}),a()(),h(4,jl,4,2,"div"),h(5,ql,1,5,"yon-entity-fields-expandable",83),a()}if(n&2){let e,i,t=l(2);s("header",t.uiVersion()=="v3"?"Order Info":"Order Information"),r(2),s("permission",t.ApplicationPermissions.OrderUpdate)("disabled",t.editMode()),r(2),C((e=t.order())!=null&&e.isLastVersion?-1:4),r(),C(((i=t.orderFieldGroups())==null?null:i.length)>0?5:-1)}}function Gl(n,u){if(n&1&&b(0,"yon-addresses-card",56),n&2){let e,i,t=l(2);s("invoiceAddress",(e=t.order())==null?null:e.invoiceAddress)("deliveryAddress",(i=t.order())==null?null:i.deliveryAddress)("readOnly",!0)("hidden",t.uiVersion()!=="v2")}}function zl(n,u){if(n&1){let e=y();d(0,"yon-button",104),_("onClick",function(){p(e);let t=l(4),o=x(26);return m(o==null?null:o.showCancelDialog(t.selectedProduct()))}),c(1," Cancel product "),a()}if(n&2){let e=l(4);s("disabled",e.editMode()||!e.selectedProduct()||e.isSelectedProductAllChargesCancelled())("permission",e.ApplicationPermissions.OrderUpdate)}}function $l(n,u){if(n&1){let e=y();d(0,"yon-button",105),_("onClick",function(){p(e);let t=l(4),o=x(26);return m(o==null?null:o.showCancelDialog(t.selectedProduct()))}),c(1," Delete product "),a()}if(n&2){let e=l(4);s("disabled",e.editMode()||!e.selectedProduct())("permission",e.ApplicationPermissions.OrderUpdate)}}function Hl(n,u){if(n&1){let e=y();d(0,"yon-button",101),_("onClick",function(){p(e);let t=l(3),o=x(24);return m(o==null?null:o.showDialog(t.selectedProduct()))}),c(1," Modify product "),a(),h(2,zl,2,2,"yon-button",102),h(3,$l,2,2,"yon-button",103),b(4,"mat-divider")}if(n&2){let e=l(3);s("disabled",e.editMode()||!e.selectedProduct())("permission",e.ApplicationPermissions.OrderUpdate),r(2),C(e.order().orderType===e.OrderTypes.Subscription?2:-1),r(),C(e.order().orderType===e.OrderTypes.SalesOrder?3:-1)}}function Wl(n,u){if(n&1&&(d(0,"div",108),b(1,"yon-entity-field",111),a()),n&2){let e=u.$implicit,i=l(4);r(),s("entity",i.selectedProduct())("fieldName",e.fieldName)("isCustom",e.isCustom)("readOnly",!i.editOrderProductMode())}}function Ul(n,u){if(n&1){let e=y();d(0,"yon-card",94)(1,"yon-card-header-right")(2,"yon-button",106),_("onClick",function(){p(e);let t=l(3);return m(t.onEditClick())}),a()(),d(3,"div",107),_e(4,Wl,2,4,"div",108,So),a(),d(6,"yon-button",109),_("onClick",function(){p(e);let t=l(3);return m(t.saveOrderProductProperties())}),c(7," SAVE "),a(),d(8,"yon-button",110),_("onClick",function(){p(e);let t=l(3);return m(t.onCancelClick())}),c(9," CANCEL "),a()()}if(n&2){let e,i,t=l(3);s("header",t.selectedProduct().name+" custom fields"),r(2),s("disabled",t.editMode()),r(2),ge(t.orderProductCustomFields()),r(2),s("hidden",!t.editOrderProductMode()||((e
1=t.order())==null?null:e.status)>t.OrderStatuses.Cancelled)("disabled",t.isLoading()),r(2),s("hidden",!t.editOrderProductMode()||((i=t.order())==null?null:i.status)>t.OrderStatuses.Cancelled)("disabled",t.isLoading())}}function Kl(n,u){if(n&1){let e=y();d(0,"yon-button",112),_("onClick",function(){p(e);let t=l(3);return m(t.onClickRevenueSchedule())}),c(1," Revenue schedule "),a()}if(n&2){let e=l(3);s("disabled",e.editMode()||!e.selectedCharge())("tooltip",e.selectedCharge()?null:"No charge selected")}}function Yl(n,u){if(n&1){let e=y();d(0,"yon-button",113),_("onClick",function(){p(e),l(3);let t=x(14);return m(t.show())}),c(1," Delivery "),a()}if(n&2){let e=l(3);s("permission",e.ApplicationPermissions.OrderUpdate)}}function Jl(n,u){if(n&1){let e=y();d(0,"yon-order-product-charge-details-card",114,18),_("editModeChange",function(t){p(e);let o=l(3);return m(o.editOrderProductChargeMode.set(t))})("orderProductChargeSave",function(){p(e),l();let t=x(21);return m(t.refresh())}),a()}if(n&2){let e=l(3);s("order",e.order())("orderProductCharge",e.selectedCharge())("orderDetailsIsInEditMode",e.editMode())}}function Xl(n,u){if(n&1){let e=y();
1d(0,"yon-details-layout-main-col")(1,"yon-card",89)(2,"yon-entity-table-filter",90,15),_("filterActivate",function(t){p(e);let o=l(2);return m(o.onProductFilterActivate(t))}),a(),d(4,"yon-card-header-menu")(5,"yon-button",91),_("onClick",function(){p(e),l(2);let t=x(20);return m(t.show())}),c(6," Arrange products "),a(),h(7,Hl,5,4),b(8,"yon-entity-table-menu-buttons",92),a(),d(9,"yon-entity-table",93,16),_("selectionChanged",function(t){p(e);let o=l(2);return m(o.onProductSelectionChanged(t))}),a()(),h(11,Ul,10,6,"yon-card",94),d(12,"yon-card",95)(13,"yon-card-header-menu")(14,"yon-button",96),_("onClick",function(){p(e),l(2);let t=x(22);return m(t.show())}),c(15),a(),h(16,Kl,2,2,"yon-button",97),h(17,Yl,2,1,"yon-button",98),b(18,"mat-divider")(19,"yon-entity-table-menu-buttons",92),a(),d(20,"yon-entity-table",99,17),_("dataLoaded",function(){p(e);let t=l(2);return m(t.updatePCGroupOnTableChanges())})("selectionChanged",function(t){p(e);let o=l(2);return m(o.onChargeSelectionChanged(t))})("fieldConfigChange",function(){p(e);let t=l(2);return m(t.onChargeFieldConfigChange())}),a()(),h(22,Jl,2,3,"yon-order-product-charge-details-card",100),a()}if(n&2){let e,i,t,o,g=x(10),f=x(21),T=l(2);r(2),s("entityTable",g)("defaultFilters",T.productTableFilters()),r(3),s("disabled",T.editMode())("permission",T.ApplicationPermissions.OrderUpdate),r(2),C(T.order().canBeChanged?7:-1),r(),s("entityTable",g)("exportFileName",((e=T.order())==null?null:e.orderNumber)+"-Products"),r(),s("defaultFields",T.productDefaultFields)("requiredFields",T.productRequiredFields())("conditions",T.productTableConditions())("alwaysSelectFirst",!0)("disableSelection",T.editMode())("rowActionButtons",T.productTableRowButtons())("checkboxConfig",wt(29,wo,((i=T.productTableCheckboxButtons())==null?null:i.length)>0,he(28,Do),T.productTableCheckboxButtons())),r(2),C(T.uiVersion()==="v2"&&T.showEditCustomFields()?11:-1),r(),s("hidden",!T.selectedProduct()),r(2),s("disabled",T.order().cannotSetInvoiceToDate||T.editMode()||!T.selectedCharge())("permission",T.ApplicationPermissions.OrderUpdate),r(),S(" ",(t=T.selectedCharge())!=null&&t.chargedThroughDate?"Edit":"Set"," invoiced to date "),r(),C(T.order().isDraft?-1:16),r(),C(T.isPartialDeliveryEnable()?17:-1),r(2),s("entityTable",f)("exportFileName",((o=T.order())==null?null:o.orderNumber)+"-Charges"),r(),s("defaultFields",T.chargeDefaultFields)("alwaysSelectFirst",!0)("explicitLoad",!0)("disableSelection",T.editMode()),r(2),C(T.selectedCharge()?22:-1)}}function Zl(n,u){n&1&&(d(0,"span",142),c(1,":"),a())}function es(n,u){if(n&1&&(d(0,"div",139)(1,"span",141),c(2),a(),h(3,Zl,2,0,"span",142),b(4,"yon-entity-field",143),a()),n&2){let e=u.$implicit,i=l(5);r(2),L(e.fieldName),r(),C(i.editMode()?-1:3),r(),s("entity",i.selectedProduct())("fieldName",e.fieldName)("isCustom",e.isCustom)("readOnly",!i.editOrderProductMode())("hideTitle",!0)}}function ts(n,u){if(n&1){let e=y();d(0,"section",133)(1,"div",134)(2,"span",135)(3,"span",136),c(4),a(),b(5,"yon-icon",137),d(6,"span"),c(7,"Custom Fields"),a()(),d(8,"yon-button",138),_("onClick",function(){p(e);let t=l(4);return m(t.onCancelClick())}),a()(),d(9,"div",107),_e(10,es,5,7,"div",139,So),d(12,"yon-button",140),_("onClick",function(){p(e);let t=l(4);return m(t.onEditClick())}),a()(),d(13,"yon-button",109),_("onClick",function(){p(e);let t=l(4);return m(t.saveOrderProductProperties())}),c(14," Save "),a(),d(15,"yon-button",110),_("onClick",function(){p(e);let t=l(4);return m(t.onCancelClick())}),c(16," Cancel "),a()()}if(n&2){let e,i,t=l(4);q("custom-fields__editmode",t.editMode()),r(4),L(t.selectedProduct().name),r(),s("weight",500),r(5),ge(t.orderProductCustomFields()),r(2),s("hidden",t.editMode()),r(),s("hidden",!t.editOrderProductMode()||((e=t.order())==null?null:e.status)>t.OrderStatuses.Cancelled)("disabled",t.isLoading()),r(2),s("hidden",!t.editOrderProductMode()||((i=t.order())==null?null:i.status)>t.OrderStatuses.Cancelled)("disabled",t.isLoading())}}function is(n,u){if(n&1){let e=y();d(0,"yon-button",112),_("onClick",function(){p(e);let t=l(4);return m(t.onClickRevenueSchedule())}),c(1," Revenue schedule "),a()}if(n&2){let e=l(4);s("disabled",e.editMode()||!e.selectedCharge())("tooltip",e.selectedCharge()?null:"No charge selected")}}function ns(n,u){if(n&1){let e=y();d(0,"yon-button",113),_("onClick",function(){p(e),l(4);let t=x(14);return m(t.show())}),c(1," Delivery "),a()}if(n&2){let e=l(4);s("permission",e.ApplicationPermissions.OrderUpdate)}}function os(n,u){if(n&1){let e=y();d(0,"yon-entity-table",129,16),_("selectionChanged",function(t){p(e);let o=l(3);return m(o.onProductSelectionChanged(t))}),a(),h(2,ts,17,9,"section",130),d(3,"yon-card",131)(4,"yon-card-header-menu")(5,"yon-button",96),_("onClick",function(){p(e),l(3);let t=x(22);return m(t.show())}),c(6),a(),h(7,is,2,2,"yon-button",97),h(8,ns,2,1,"yon-button",98),b(9,"mat-divider")(10,"yon-entity-table-menu-buttons",92),a(),d(11,"yon-entity-table",132,17),_("selectionChanged",function(t){p(e);let o=l(3);return m(o.onChargeSelectionChanged(t))})("dataLoaded",function(){p(e);let t=l(3);return m(t.updatePCGroupOnTableChanges())})("fieldConfigChange",function(){p(e);let t=l(3);return m(t.onChargeFieldConfigChange())}),a()()}if(n&2){let e,i,t,o,g=x(12),f=l(3);s("defaultFields",f.productDefaultFields)("requiredFields",f.productRequiredFields())("conditions",f.productTableConditions())("alwaysSelectFirst",!0)("explicitLo
1ad",!0)("disableSelection",f.editMode())("rowActionButtons",f.productTableRowButtons())("checkboxConfig",wt(25,wo,((e=f.productTableCheckboxButtons())==null?null:e.length)>0,he(24,Do),f.productTableCheckboxButtons())),r(2),C(f.showEditCustomFields()?2:-1),r(),s("header",(i=f.selectedProduct())==null?null:i.name)("headerCrumb","Charges")("hidden",!f.selectedProduct()||f.productCount()===0),r(2),s("disabled",f.order().cannotSetInvoiceToDate||f.editMode()||!f.selectedCharge())("permission",f.ApplicationPermissions.OrderUpdate),r(),S(" ",(t=f.selectedCharge())!=null&&t.chargedThroughDate?"Edit":"Set"," invoiced to date "),r(),C(f.order().isDraft?-1:7),r(),C(f.isPartialDeliveryEnable()?8:-1),r(2),s("entityTable",g)("exportFileName",((o=f.order())==null?null:o.orderNumber)+"-Charges"),r(),s("defaultFields",f.chargeDefaultFields)("alwaysSelectFirst",f.alwaysSelectFirstCharge()||f.uiVersion()==="v2")("explicitLoad",!0)("disableSelection",f.editMode())("rowActionButtons",f.getRowActionButtons())}}function rs(n,u){if(n&1){let e=y();d(0,"yon-entity-table",144,19),_("selectionChanged",function(t){p(e);let o=l(3);return m(o.onChargeSelectionChanged(t))})("dataLoaded",function(t){p(e);let o=l(3);return m(o.onAllChargesTableDataLoaded(t))}),a()}if(n&2){let e=l(3);s("defaultFields",e.chargeDefaultFields)("conditions",e.allChargesTableConditions())("explicitLoad",!0)("disableSelection",e.editMode())("rowActionButtons",e.getRowActionButtons())}}function as(n,u){if(n&1&&b(0,"yon-entity-table",125,20),n&2){let e=l(3);s("defaultFields",e.invoiceDefaultFields)("isManualData",!0)("isManualDataLoading",e.isInvoicesLoading())}}function ds(n,u){if(n&1&&b(0,"yon-entity-table",126,21),n&2){let e=l(3);s("defaultFields",e.invoiceLineDefaultFields)("conditions",wt(11,sl,Ye(2,ll,e.QueryConditionOperators.Equals,e.order().orderNumber),Ye(5,xo,e.QueryConditionOperators.NotEquals,e.InvoiceStatuses.Cancelled),Ye(8,xo,e.QueryConditionOperators.NotEquals,e.InvoiceStatuses.Draft)))}}function ls(n,u){if(n&1){let e=y();d(0,"yon-button",104),_("onClick",function(){p(e);let t=l(5),o=x(26);return m(o==null?null:o.showCancelDialog(t.selectedProduct()))}),c(1," Cancel product "),a()}if(n&2){let e=l(5);s("disabled",e.editMode()||!e.selectedProduct()||e.isSelectedProductAllChargesCancelled())("permission",e.ApplicationPermissions.OrderUpdate)}}function ss(n,u){if(n&1){let e=y();d(0,"yon-button",105),_("onClick",function(){p(e);let t=l(5),o=x(26);return m(o==null?null:o.showCancelDialog(t.selectedProduct()))}),c(1," Delete product "),a()}if(n&2){let e=l(5);s("disabled",e.editMode()||!e.selectedProduct())("permission",e.ApplicationPermissions.OrderUpdate)}}function cs(n,u){if(n&1){let e=y();d(0,"yon-button",101),_("onClick",function(){p(e);let t=l(4),o=x(24);return m(o==null?null:o.showDialog(t.selectedProduct()))}),c(1," Modify product "),a(),h(2,ls,2,2,"yon-button",102),h(3,ss,2,2,"yon-button",103),b(4,"mat-divider")}if(n&2){let e=l(4);s("disabled",e.editMode()||!e.selectedProduct())("permission",e.ApplicationPermissions.OrderUpdate),r(2),C(e.order().orderType===e.OrderTypes.Subscription?2:-1),r(),C(e.order().orderType===e.OrderTypes.SalesOrder?3:-1)}}function us(n,u){if(n&1){let e=y();d(0,"yon-entity-table-filter",145,15),_("filterActivate",function(t){p(e);let o=l(3);return m(o.onProductFilterActivate(t))}),a(),d(2,"yon-card-header-menu")(3,"yon-button",91),_("onClick",function(){p(e),l(3);let t=x(20);return m(t.show())}),c(4," Arrange products "),a(),h(5,cs,5,4),b(6,"yon-entity-table-menu-buttons",92),a()}if(n&2){let e,i,t=l(3);s("entityTable",t.productTable())("defaultFilters",t.productTableFilters())("explicitTableLoad",!0),r(3),s("disabled",t.editMode())("permission",t.ApplicationPermissions.OrderUpdate),r(2),C((e=t.order())!=null&&e.canBeChanged?5:-1),r(),s("entityTable",t.productTable())("exportFileName",((i=t.order())==null?null:i.orderNumber)+"-Products")}}function ps(n,u){if(n&1){let e=y();d(0,"yon-button",112),_("onClick",function(){p(e);let t=l(4);return m(t.onClickRevenueSchedule())}),c(1," Revenue schedule "),a()}if(n&2){let e=l(4);s("disabled",e.editMode()||!e.selectedCharge())("tooltip",e.selectedCharge()?null:"No charge selected")}}function ms(n,u){if(n&1){let e=y();d(0,"yon-button",113),_("onClick",function(){p(e),l(4);let t=x(14);return m(t.show())}),c(1," Delivery "),a()}if(n&2){let e=l(4);s("permission",e.ApplicationPermissions.OrderUpdate)}}function _s(n,u){if(n&1){let e=y();d(0,"yon-entity-table-filter",145,22),_("filterActivate",function(t){p(e);let o=l(3);return m(o.onAllChargesFilterActivate(t))}),a(),d(2,"yon-card-header-menu")(3,"yon-button",96),_("onClick",function(){p(e),l(3);let t=x(22);return m(t.show())}),c(4),a(),h(5,ps,2,2,"yon-button",97),h(6,ms,2,1,"yon-button",98),b(7,"mat-divider")(8,"yon-entity-table-menu-buttons",92),a()}if(n&2){let e,i,t=l(3);s("entityTable",t.allChargesTable())("defaultFilters",t.allChargesTableFilters())("explicitTableLoad",!0),r(3),s("disabled",t.order().cannotSetInvoiceToDate||t.editMode()||!t.selectedCharge())("permission",t.ApplicationPermissions.OrderUpdate),r(),S(" ",(e=t.selectedCharge())!=null&&e.chargedThroughDate?"Edit":"Set"," invoiced to date "),r(),C(t.order().isDraft?-1:5),r(),C(t.isPartialDeliveryEnable()?6:-1),r(2),s("entityTable",t.allChargesTable())("exportFileName",((i=t.order())==null?null:i.orderNumber)+"-AllCharges")}}function gs(n,u){if(n&1&&(d(0,"div",128),b(1,"yon-entity-table-search",146),d(2,"yon-card-header-menu"),b(3,"yon-entity-table-menu-buttons",92),a()()),n&2){let e,i=l(3);r(),s("target",(e=i.invoicesTable())==null?null:e.searchFilter),r(2),s("entityTable",i.invoicesTable())("exportFileName","Invoices for order "+i.order().orderNumber)}}function hs(n,u){if(n&1&&(d(0,"div",128),b(1,"yon-entity-table-search",146),d(2,"yon-card-header-menu"),b(3,"yon-entity-table-menu-buttons",92),a()()),n&2){let e,i=l(3);r(),s("target",(e=i.invoiceLinesTable())==null?null:e.searchFilter),r(2),s("entityTable",i.invoiceLinesTable())("exportFileName","Invoice lines for order "+i.order().orderNumber)}}function Cs(n,u){if(n&1){let e=y();
1d(0,"yon-details-layout-main-col")(1,"div",115)(2,"div",116)(3,"mat-button-toggle-group",117),_("change",function(t){p(e);let o=l(2);return m(o.onSelectedViewChange(t.value))}),d(4,"mat-button-toggle",118),c(5," Products "),b(6,"span",119),a(),d(7,"mat-button-toggle",120),c(8," Charges "),b(9,"span",119),a(),d(10,"mat-button-toggle",121),c(11," Invoices "),b(12,"span",119),a(),d(13,"mat-button-toggle",122),c(14," Invoice Lines "),b(15,"span",119),a()()(),d(16,"div",123),h(17,os,13,29)(18,rs,2,5,"yon-entity-table",124)(19,as,2,3,"yon-entity-table",125)(20,ds,2,15,"yon-entity-table",126),a(),d(21,"div",127),h(22,us,7,8),h(23,_s,9,10),h(24,gs,4,3,"div",128),h(25,hs,4,3,"div",128),a()()()}if(n&2){let e,i=l(2);r(3),s("value",i.selectedView()),r(3),s("matBadge",i.productCount()),r(3),s("matBadge",i.chargeCount()),r(3),s("matBadge",i.invoiceCount()),r(3),s("matBadge",i.invoiceLineCount()),r(2),C((e=i.selectedView())==="products"?17:e==="charges"?18:e==="invoices"?19:e==="invoiceLines"?20:-1),r(5),C(i.showProductFilter()?22:-1),r(),C(i.showChargesFilter()?23:-1),r(),C(i.showInvoicesFilter()?24:-1),r(),C(i.showInvoiceLinesFilter()?25:-1)}}function fs(n,u){if(n&1){let e=y();
1d(0,"yon-details-layout-right-modal",147),_("onCloseClick",function(){p(e);let t=l(2);return m(t.onModalCloseClick())})("nextOrPreviousCharge",function(t){p(e);let o=x(2);return m(o.nextOrPreviousCharge(t))}),d(1,"yon-details-layout-right-modal-group-fields",148,23),_("pageChanged",function(t){p(e);let o=l(2);return m(o.onPageChanged(t))})("chargeChanged",function(t){p(e);let o=l(2);return m(o.currentTable().selectById(t))})("opcReverted",function(t){p(e);let o=l(2);return m(o.onOpcReverted(t))})("updateChargeTable",function(t){p(e);let o=l(2);return m(o.updateChargeTableValue(t))}),a()()}if(n&2){let e,i=l(2);s("ngClass",Te(9,cl,i.selectedView()==="charges"))("breadCrumbs",Ye(11,ul,((e=i.selectedProduct())==null?null:e.name)||"",(e=i.selectedCharge())!=null&&e.name?((e=i.selectedCharge())==null?null:e.name)+" (v"+((e=i.selectedCharge())==null?null:e.version)+")":""))("productChargeGroup",i.productChargeGroup())("entityName","Charge"),r(),s("order",i.order())("entityType",i.EntityTypes.Order)("chargeSettings",i.chargeSettings())("productChargeGroup",i.productChargeGroup())("isDetailOrderView",!0)}}function vs(n,u){if(n&1&&b(0,"yon-metrics-card",149),n&2){let e=l(3);s("cmrr",e.order().cmrr)("acv",e.order().acv)("otf",e.order().oneTimeFees)("tcv",e.order().tcv)}}function ys(n,u){if(n&1&&b(0,"yon-order-bookings-card",150),n&2){let e=l(3);s("orderNumber",e.order().orderNumber)}}function bs(n,u){if(n&1){let e=y();d(0,"yon-order-versions-card",157),_("onVersionsLoadedEmitLastId",function(t){p(e);let o=l(3);return m(o.lastOrderVersionId.set(t))}),a()}if(n&2){let e=l(3);s("orderNumber",e.order().orderNumber)}}function xs(n,u){if(n&1&&b(0,"yon-order-discounts-card",151),n&2){let e=l(3);s("order",e.order())("isNewOrChangeOrder",!1)}}function Ds(n,u){if(n&1&&b(0,"yon-order-associated-charges-card",29),n&2){let e=l(3);s("order",e.order())}}function ws(n,u){if(n&1&&b(0,"yon-order-measurements-card",156),n&2){let e=l(3);s("orderId",e.order().id)}}function Ss(n,u){if(n&1&&b(0,"yon-order-preprocessing-rules-card",29),n&2){let e=l(3);s("order",e.order())}}function Ts(n,u){if(n&1){let e=y();
1d(0,"yon-details-layout-right-col"),h(1,vs,1,4,"yon-metrics-card",149),h(2,ys,1,1,"yon-order-bookings-card",150),h(3,bs,1,1,"yon-order-versions-card",150),h(4,xs,1,2,"yon-order-discounts-card",151),b(5,"yon-notes-card",152),M(6,Ds,1,1,"yon-order-associated-charges-card",153),b(7,"yon-file-attachments-card",154),d(8,"yon-milestones-card",155,24),Y("milestonesChange",function(t){p(e);let o=l(2);return K(o.order().orderMilestones,t)||(o.order().orderMilestones=t),m(t)}),_("milestoneSet",function(t){p(e);let o=l(2);return m(o.onMilestoneSet(t))}),a(),h(10,ws,1,1,"yon-order-measurements-card",156),h(11,Ss,1,1,"yon-order-preprocessing-rules-card",29),a()}if(n&2){let e,i,t,o,g,f,T,A=l(2);r(),C(A.order()?1:-1),r(),C((e=A.order())!=null&&e.isDraftOrDeleted?-1:2),r(),C((i=A.order())!=null&&i.isDraftOrDeleted?-1:3),r(),C((t=A.orderSettings())!=null&&t.hasOrderDiscount?4:-1),r(),s("entityId",(o=A.order())==null?null:o.id)("entityNumber",(g=A.order())==null?null:g.orderNumber),r(),s("hasFeature","Associated Charges"),r(),s("entityType",A.EntityTypes.Order)("entity",A.order())("permission",A.ApplicationPermissions.OrderUpdate),r(),s("showAddItemButton",!1)("order",A.order()),U("milestones",A.order().orderMilestones),s("canSetMilestone",A.order().canSetMilestone)("orderAvailableActions",A.orderAvailableActions()),r(2),C((f=A.order())!=null&&f.isDraftOrDeleted?-1:10),r(),C(((T=A.order())==null||T.preprocessingRules==null?null:T.preprocessingRules.length)>0?11:-1)}}function Os(n,u){if(n&1){let e=y();
1d(0,"yon-details-layout-right-col")(1,"yon-tabs-right-modal",158,25),_("milestoneSet",function(t){p(e);let o=l(2);return m(o.onMilestoneSet(t))})("onAssociatedChargesChanged",function(){p(e);let t=l(2);return m(t.onAssociatedChargesChanged())}),a()()}if(n&2){let e=l(2);r(),s("order",e.order())("orderAvailableActions",e.orderAvailableActions())("orderSettings",e.orderSettings())}}function Ms(n,u){if(n&1){let e=y();d(0,"yon-details-layout",40),h(1,yl,10,9,"yon-details-layout-header-left"),d(2,"yon-details-layout-header-right"),h(3,bl,2,1,"yon-button",41),h(4,xl,2,3,"yon-button",42),h(5,Dl,2,3,"yon-button",43),h(6,wl,2,2,"yon-button",44),h(7,Sl,2,2,"yon-button",44),h(8,Tl,2,2,"yon-button",45),h(9,Ol,2,3,"yon-button",46),h(10,Ml,2,2,"yon-button",47),h(11,Pl,2,2,"yon-button",48),h(12,El,2,2,"yon-button",49),h(13,kl,2,2,"yon-button",50),a(),d(14,"yon-details-layout-header-menu"),h(15,Il,8,8),h(16,Fl,1,3,"yon-request-stripe-details-button",51),h(17,Al,2,2,"yon-button",52),h(18,Rl,2,2,"yon-button",53),d(19,"yon-button",54),_("onClick",function(){p(e),l();let t=x(18);return m(t.show())}
1),c(20," Order documents "),a()(),d(21,"yon-details-layout-left-col"),h(22,Ql,6,5,"yon-card",55),h(23,Gl,1,4,"yon-addresses-card",56),a(),h(24,Xl,23,33,"yon-details-layout-main-col"),h(25,Cs,26,10,"yon-details-layout-main-col"),h(26,fs,3,14,"yon-details-layout-right-modal",57),h(27,Ts,12,17,"yon-details-layout-right-col"),h(28,Os,3,3,"yon-details-layout-right-col"),a()}if(n&2){let e,i,t,o,g,f=l();q("right-modal-open",f.selectedCharge()),s("entityName","orders")("contextHeader",f.contextHeader())("header",(f.uiVersion()==="v2"?"Order ":"")+f.order().orderNumber)("headerPrefix",f.uiVersion()==="v3"?"Order ":"")("subheader","Version "+f.order().version)("badge",f.displayStatus())("scheduledPriceAdjustmentStatus",f.scheduledPriceAdjustmentStatus())("effectiveRange",f.effectiveRange())("isSalesOrder",f.order().orderType===f.OrderTypes.SalesOrder)("rightPanelWidth",f.uiService.rightPanelWidth())("menuButtonLabel",f.uiVersion()==="v3"?"Actions":null),r(),C(f.uiVersion()==="v2"?1:-1),r(2),C(f.showSaveChangesButton()?3:-1),r(),C(f.order().isDraft&&f.order().isLastVersion?4:-1),r(),C(!((e=f.order())!=null&&e.isDraftOrDeleted)&&f.uiVersion()==="v2"?5:-1),r(),C(!((i=f.order())!=null&&i.isDraftOrDeleted)&&f.uiVersion()==="v2"?6:-1),r(),C(f.order().isDraft&&f.order().isLastVersion?7:-1),r(),C(f.order().canBeRenewed&&f.uiVersion()==="v3"?8:-1),r(),C(f.order().canBeChanged&&f.uiVersion()==="v3"&&!f.order().isCancellationPending?9:-1),r(),C(f.order().canBeCancelled&&f.uiVersion()==="v3"?10:-1),r(),C((t=f.orderAvailableActions())!=null&&t.canReactivate?11:-1),r(),C(!((o=f.order())!=null&&o.isDraftOrDeleted)&&f.uiVersion()==="v3"?12:-1),r(),C(f.eligibleStockCharges().length>0&&f.uiVersion()==="v3"?13:-1),r(2),C(f.uiVersion()==="v3"?15:-1),r(),C(f.uiVersion()==="v3"&&f.stripeIsActive()&&((g=f.order())==null?null:g.orderPaymentMethod)===f.OrderPaymentMethods.Stripe&&((g=f.order())!=null&&g.invoiceAccount)?16:-1),r(),C(f.uiVersion()==="v3"?17:-1),r(),C(f.scheduledPriceAdjustmentStatus()==="Scheduled"?18:-1),r(),s("disabled",f.editMode()),r(3),C(f.order()?22:-1),r(),C(f.order()?23:-1),r(),C(f.order()&&f.uiVersion()==="v2"?24:-1),r(),C(f.order()&&f.uiVersion()==="v3"?25:-1),r(),C(f.uiVersion()==="v3"&&f.selectedCharge()?26:-1),r(),C(f.order()&&f.uiVersion()==="v2"?27:-1),r(),C(f.order()&&f.uiVersion()==="v3"?28:-1)}}
1function Ps(n,u){n&1&&b(0,"yon-details-layout-loading")}function Es(n,u){n&1&&b(0,"div")}function ks(n,u){if(n&1&&(d(0,"section"),h(1,Ps,1,0,"yon-details-layout-loading"),h(2,Es,1,0,"div"),a()),n&2){let e=l();r(),C(e.uiVersion()==="v3"?1:-1),r(),C(e.uiVersion()==="v2"?2:-1)}}function Ns(n,u){if(n&1){let e=y();d(0,"yon-activation-dialog",159,26),_("onConfirm",function(t){p(e);let o=l();return m(o.onActivationDialogConfirm(t))})("onCancel",function(){p(e);let t=l();return m(t.onActivationDialogCancel())}),a()}if(n&2){let e=l();s("order",e.order())("originalOrderKPIs",e.originalOrderKPIs())("orderCharges",e.orderChargesForActivationDialog())}}var mt=(function(n){return n.Products="products",n.Charges="charges",n.Invoices="invoices",n.InvoiceLines="invoiceLines",n})(mt||{}),nh=(()=>{class n{constructor(){this.uiService=O(Ft),this.uiVersion=v(this.uiService.getUiVersion()),this.entityQueryService=O(lt),this.changeStateService=O(Wn),this.productTable=gt("productTable"),this.allChargesTable=gt("allChargesTable"),this.invoicesTable=gt("invoicesTable"),this.invoiceLinesTable=gt("invoiceLinesTable"),this.showProductFilter=P(()=>!!this.productTable()),this.showChargesFilter=P(()=>!!this.allChargesTable()),this.showInvoicesFilter=P(()=>!!this.invoicesTable()),this.showInvoiceLinesFilter=P(()=>!!this.invoiceLinesTable()),this.ApplicationPermissions=pe,this.EntityTypes=Et,this.OrderPaymentMethods=Oe,this.OrderStatuses=ue,this.OrderTypes=J,this.StripeCredentialStatuses=Mt,this.QueryConditionOperators=it,this.InvoiceStatuses=nt,this.productDefaultFields=["name","orderProductChargePlanname","cmrrAmount","acvAmount","oneTimeFeesAmount","tcvAmount"],this.chargeDefaultFields=["name","changeState","effectiveStartDate","effectiveEndDate","chargedThroughDate","chargeType","totalPriceAmount"],this.invoiceDefaultFields=["invoiceNumber","accountname","status","totalAmountAmount","invoiceDate","paymentTerm","dueDate","daysPastDue","settledAmountInTable","unsettledAmountInTable"],this.invoiceLineDefaultFields=["chargeDescription","servicePeriodStartDate","servicePeriodEndDate","invoiceinvoiceNumber","invoiceinvoiceDate","orderproductchargechargeType","quantity","unitofmeasuredisplayName","subtotalAmount"],this.showNewSearchAndSelect=v(!1),this.orderChargesForActivationDialog=v({new:[],changed:[],cancelled:[]}),this.originalOrderKPIs=v(null),this.order=v(void 0),this.orderFieldGroups=v([]),this.orderCustomFields=v([]),this.orderAvailableActions=v(void 0),this.orderProductCustomFields=v([]),this.lastOrderVersionId=v(void 0),this.selectedProduct=v(void 0),this.selectedProductCopy=v(void 0),this.selectedCharge=v(void 0),this.isSelectedProductAllChargesCancelled=P(()=>this.areAllChargesCancelled(this.selectedProduct())),this.isEInvoiceEnabled=v(!1),this.isPartialDeliveryEnable=v(!1),this.stripeIsActive=v(!1),this.stripeCredentialStatus=v(void 0),this.goCardlessSettings=v(null),this.orderInvoiceAccountMandateStatus=v(Pt.NoMandate),this.orderSettings=v(void 0),this.stripeSettings=v(void 0),this.integrationSettings=v(void 0),this.countries=v([]),this.deliveryAddress$=new ai("No address is set"),this.invoiceAddress$=new ai("No address is set"),this.productTableRowButtons=v([]),this.productTableCheckboxButtons=v([]),this.onlinePaymentDetails=v(void 0),this.isLoading=v(!1),this.editOrderMode=v(!1),this.editOrderProductMode=v(!1),this.editOrderProductChargeMode=v(!1),this.alwaysSelectFirstCharge=v(this.uiVersion()==="v2"),this.productTableConditions=v([]),this.productTableFilters=v([{name:"Billable",conditions:[{fieldName:"anyBillableCharges",value:!0}],matTooltip:"Has charges that can be billed"},{name:"Current & future",conditions:[{fieldName:"anyCurrentAndFutureCharges",value:!0}],matTooltip:`Has active charges from ${N.getTodayFormatted()}`},...this.uiVersion()==="v3"?[{name:"Current",conditions:[{fieldName:"anyCurrentCharges",value:!0}],matTooltip:`Has active charges starting ${N.getTodayFormatted()} or earlier`},{name:"Future",conditions:[{fieldName:"anyFutureCharges",value:!0}],matTooltip:`Has active charges starting after ${N.getTodayFormatted()}`}]:[],{name:"For renewal",conditions:[{fieldName:"anyRenewalCharges",value:!0}],matTooltip:"Has charges that can be renewed"}]),this.allChargesTableFilters=v([{name:"Billable",conditions:[{fieldName:"isBillable",value:!0},{fieldName:"orderProductisAddedCharge",value:!1}],matTooltip:"Not fully billed charges"},{name:"Current & future",conditions:[{fieldName:"isCurrentAndFuture",value:!0}],matTooltip:`Active charges from ${N.getTodayFormatted()}`},{name:"Current",conditions:[{fieldName:"isCurrent",value:!0}],matTooltip:`Active charges starting ${N.getTodayFormatted()} or earlier`},{name:"Future",conditions:[{fieldName:"isFuture",value:!0}],matTooltip:`Active charges starting after ${N.getTodayFormatted()}`},{name:"For renewal",conditions:[{fieldName:"isRenewal",value:!0}
1],matTooltip:"Charges that can be renewed"}]),this.unsubscribe$=new Ae,this.scheduledPriceAdjustmentService=O(An),this.chargeDetailsService=O(Jn),this.permissionService=O(Ri),this.canViewAccounts=this.permissionService.hasPermission(pe.AccountView),this.accountLoadFailed=!1,this.productService=O(Qn),this.revenueRecognitionService=O(Gn),this.revenueRecognitionSettingsService=O(jn),this.unitService=O(vn),this.userPreferencesService=O(Vi),this.chargeSettings=v(void 0),this.selectedProductCharges=v([]),this.revenueRecognitionRules=v(void 0),this.orderPricingPermission=v(this.permissionService.hasPermission(pe.OrderEditPriceDetails)),this.chargeProduct=v(void 0),this.productChargeGroup=v(void 0),this.addressFormatPipe=new Ln,this.OrderDetailsEntityViews=mt,this.selectedView=v(mt.Products),this.orderInvoices=v([]),this.productCount=v(0),this.chargeCount=v(0),this.invoiceCount=v(0),this.invoiceLineCount=v(0),this.isInvoicesLoading=v(!0),this.showCustomFields=v(this.uiVersion()==="v2"),this.invalidOpcFieldMessage=v(""),this.scheduledPriceAdjustmentStatus=P(()=>{let e=this.scheduledPriceAdjustmentService.currentSchedulePriceAdjustment()?.aggregateStatus;return Pe.schedulingStatuses.find(i=>i.id===e)?.displayValue??"Not scheduled"}),this.notificationService=O(j),this.entityFactory=O(Ai),this.fieldConfigurationService=O(It),this.settingsService=O(sn),this.electronicInvoiceService=O(to),this.countryService=O(en),this.goCardlessService=O(Bn),this.route=O(ki),this.router=O(fe),this.orderService=O(H),this.orderProductChargeService=O(ct),this.dialogService=O(se),this.accountService=O(Ki),this.invoiceBatchGroupService=O(eo),this.stripeService=O(xn),this.dataService=O(yn),this.productsWithChargedThroughDate=new Set,this.toggleCustomFields=()=>{this.onEditClick(),this.showCustomFields.set(!this.showCustomFields())},this.onUseAccountBatchGroupChange=()=>{this.order().useAccountInvoiceBatchGroup?this.accountService.getById(this.order().accountId).pipe(W(this.unsubscribe$)).subscribe(e=>{this.invoiceBatchGroupService.fetchById(e.invoiceBatchGroupId).pipe(W(this.unsubscribe$)).subscribe(i=>{this.order().invoiceBatchGroupId=i?.id})}):this.order().invoiceBatchGroupId=null,this.updateOrderFieldGroups()},this.onNoticePeriodChanged=()=>{this.order().noticePeriodDate=N.getNoticePeriodDate(this.order().effectiveEndDate,this.order().noticePeriod)},this.updateOrderFieldGroups=()=>V(this,null,function*(){if(!this.order()?.account&&!this.accountLoadFailed||!this.orderSettings()||!this.orderCustomFields()||this.stripeIsActive()===void 0){setTimeout(()=>this.updateOrderFieldGroups(),50);return}let i=[],t=this.uiVersion();t==="v2"?(i.push({header:"Order details",fields:[{fieldName:"description",fullWidth:!0,readOnly:this.order().status==ue.Deleted},{fieldName:"accountId",readOnly:!0},{fieldName:"invoiceAccountId",readOnly:!0},{fieldName:"orderType",readOnly:!0},{fieldName:"currencyId",readOnly:!0},{fieldName:"currencyCodeToUseWhenInvoice",readOnly:!0,condition:this.orderSettings().useInvoiceCurrencyCodeOnOrder},{fieldName:"status",readOnly:!0}]}),i.push({header:"Terms",fields:[{fieldName:"termType",fullWidth:!0,readOnly:!0,condition:this.order().orderType===J.Subscription},{fieldName:"effectiveStartDate",readOnly:!0,condition:this.order().orderType===J.Subscription},{fieldName:"effectiveEndDate",readOnly:!0,condition:this.order().isTermedSubscription||this.order().isCancelledEvergreen},{fieldName:"cancellationDate",readOnly:!0,condition:this.order().status===ue.Cancelled,fullWidth:!0},{fieldName:"term",readOnly:!0,condition:this.order().isTermedSubscription},{fieldName:"renewalTerm",readOnly:!0,condition:this.order().isTermedSubscription},{fieldName:"isAutoRenewed",readOnly:!0,condition:this.order().isTermedSubscription},{fieldName:"noticePeriod",onChange:this.onNoticePeriodChanged,condition:this.order().isTermedSubscription&&this.order().status!==ue.Cancelled},{fieldName:"noticePeriodDate",readOnly:!0,condition:this.order().isTermedSubscription&&this.order().status!==ue.Cancelled},{fieldName:"orderDate",readOnly:!0}]}),i.push({header:"Invoice settings",fields:[{fieldName:"setBillingPeriodOnOrderLevel",condition:this.orderSettings()?.enableOrderBillingPeriod&&this.order().orderType!==J.SalesOrder,readOnly:!0,fullWidth:!this.order()?.setBillingPeriodOnOrderLevel},{fieldName:"orderBillingPeriod",condition:this.orderSettings()?.enableOrderBillingPeriod&&this.order().setBillingPeriodOnOrderLevel&&this.order().orderType!==J.SalesOrder,readOnly:!0},{fieldName:"invoiceSeparatly",readOnly:!this.canEditInvoiceSeparately(),onChange:this.updateOrderFieldGroups},{fieldName:"yourOrderNumber"},this.stripeIsActive()?{fieldName:"orderPaymentMethod",readOnly:!this.order().invoiceSeparatly,onChange:this.updateOrderFieldGroups,icon:this.order()?.orderPaymentMethod===Oe.Stripe?this.stripeService.getStripeIcon(this.stripeCredentialStatus(),this.onlinePaymentDetails()):null}:{fieldName:"orderPaymentMethod",readOnly:!0},this.order().invoiceSeparatly?{fieldName:"paymentTermId"}:{fieldName:"defaultPaymentTermId",entity:this.order().invoiceAccount,entityName:"account",readOnly:!0},{fieldName:"invoiceBatchGroupId",readOnly:this.order().status>2||this.order().useAccountInvoiceBatchGroup},{fieldName:"useAccountInvoiceBatchGroup",readOnly:this.order().status>2,onChange:this.onUseAccountBatchGroupChange},{fieldName:"disableInvoicing",readOnly:!1},this.order().invoiceSeparatly?{fieldName:"invoiceTemplateId"}:{fieldName:"invoiceTemplateId",entity:this.order().account,entityName:"account",readOnly:!0},this.order().accountsReceivableId?{fieldName:"accountsReceivableId",readOnly:!0,condition:this.orderSettings().useAccountsReceivableOnOrder}
1:{fieldName:"accountsReceivableId",entity:this.order().invoiceAccount,entityName:"account",readOnly:!0,condition:this.orderSettings().useAccountsReceivableOnOrder},{fieldName:"salesReference"},{fieldName:"accountReference",readOnly:!this.order().invoiceSeparatly},{fieldName:"referenceNumber",fullWidth:!0,condition:this.isEInvoiceEnabled()},{fieldName:"remarks",fullWidth:!0},{fieldName:"externalCRMId",condition:this.integrationSettings().showExternalCRMId},{fieldName:"externalERPId",condition:this.integrationSettings().showExternalERPId}]}),this.orderCustomFields()?.length>0&&i.push({header:"Custom fields",fields:this.orderCustomFields().map(o=>({fieldName:o.fieldName,isCustom:o.isCustom}))})):t==="v3"&&(i.push({header:"Account",fields:[{fieldName:"accountId",readOnly:!0},{fieldName:"invoiceAccountId",readOnly:!0},{fieldName:"accountReference",readOnly:!this.order().invoiceSeparatly},{fieldName:"salesReference"},{type:"readOnly",title:"Delivery address",value$:this.deliveryAddress$,isMultiLine:!0},{type:"readOnly",title:"Invoice address",value$:this.invoiceAddress$,isMultiLine:!0}]}),i.push({header:"Terms",fields:[{fieldName:"effectiveStartDate",readOnly:!0,condition:this.order().orderType===J.Subscription},{fieldName:"effectiveEndDate",readOnly:!0,condition:this.order().isTermedSubscription||this.order().isCancelledEvergreen},{fieldName:"cancellationDate",readOnly:!0,condition:this.order().status===ue.Cancelled,fullWidth:!0},{fieldName:"term",readOnly:!0,condition:this.order().isTermedSubscription},{fieldName:"renewalTerm",readOnly:!0,condition:this.order().isTermedSubscription},{fieldName:"noticePeriod",onChange:this.onNoticePeriodChanged,condition:this.order().isTermedSubscription&&this.order().status!==ue.Cancelled},{fieldName:"noticePeriodDate",readOnly:!0,condition:this.order().isTermedSubscription&&this.order().status!==ue.Cancelled},{fieldName:"isAutoRenewed",readOnly:!0,condition:this.order().isTermedSubscription},{fieldName:"orderDate",readOnly:!0},{fieldName:"orderType",readOnly:!0},{fieldName:"termType",readOnly:!0,condition:this.order().orderType===J.Subscription},{fieldName:"currencyId",readOnly:!0}]}),i.push({header:"Invoice settings",fields:[{fieldName:"setBillingPeriodOnOrderLevel",condition:this.orderSettings()?.enableOrderBillingPeriod&&this.order().orderType!==J.SalesOrder,readOnly:!0,fullWidth:!this.order()?.setBillingPeriodOnOrderLevel},{fieldName:"orderBillingPeriod",condition:this.orderSettings()?.enableOrderBillingPeriod&&this.order().setBillingPeriodOnOrderLevel&&this.order().orderType!==J.SalesOrder,readOnly:!0},this.stripeIsActive()||this.goCardlessSettings()?.active?{fieldName:"orderPaymentMethod",readOnly:!this.order().invoiceSeparatly,onChange:this.updateOrderFieldGroups,fullWidth:!0,icon:this.getIcon()}:{fieldName:"orderPaymentMethod",readOnly:!0},this.order().invoiceSeparatly?{fieldName:"paymentTermId"}:{fieldName:"defaultPaymentTermId",entity:this.order().invoiceAccount,entityName:"account",readOnly:!0},{fieldName:"invoiceSeparatly",readOnly:!this.canEditInvoiceSeparately(),onChange:this.updateOrderFieldGroups},this.order().invoiceSeparatly?{fieldName:"invoiceTemplateId"}:{fieldName:"invoiceTemplateId",entity:this.order().account,entityName:"account",readOnly:!0},this.order().accountsReceivableId?{fieldName:"accountsReceivableId",readOnly:!0,condition:this.orderSettings().useAccountsReceivableOnOrder}:{fieldName:"accountsReceivableId",entity:this.order().invoiceAccount,entityName:"account",readOnly:!0,condition:this.orderSettings().useAccountsReceivableOnOrder},{fieldName:"referenceNumber",fullWidth:!0,condition:this.isEInvoiceEnabled()},{fieldName:"disableInvoicing",readOnly:!1},{fieldName:"invoiceBatchGroupId",readOnly:this.order().status>2||this.order().useAccountInvoiceBatchGroup},{fieldName:"useAccountInvoiceBatchGroup",readOnly:this.order().status>2,onChange:this.onUseAccountBatchGroupChange},{fieldName:"currencyCodeToUseWhenInvoice",readOnly:!0,condition:this.orderSettings().useInvoiceCurrencyCodeOnOrder}]}),i.push({header:"Details",fields:[{fieldName:"yourOrderNumber"},{fieldName:"description",readOnly:this.order().status==ue.Deleted,fullWidth:!0},{fieldName:"remarks",fullWidth:!0},{fieldName:"externalERPId",condition:this.integrationSettings().showExternalERPId},{fieldName:"externalCRMId",condition:this.integrationSettings().showExternalCRMId}]}),this.orderCustomFields()?.length>0&&i.push({header:"Custom fields",fields:this.orderCustomFields().map(o=>({fieldName:o.fieldName,isCustom:o.isCustom}))})),this.orderFieldGroups.set(i)}),this.editMode=P(()=>this.editOrderMode()||this.editOrderProductMode()||this.editOrderProductChargeMode()),this.showEditCustomFields=P(()=>this.showCustomFields()&&this.selectedProduct()&&this.orderProductCustomFields()?.length>0),this.showSaveChangesButton=P(()=>this.orderService.chargesToUpdate().length>0),this.setInvoicedToDateRowClick=e=>{this.setInvoicedToDate.charge=this.order().notDeletedCharges.find(i=>i.id===e.id),this.setInvoicedToDate.show()},this.onClickRevenueScheduleRowClick=e=>{this.router.navigate(["orders/chargerevenueschedule",e.id])},this.partialDeliveryRowClick=e=>{this.partialDelivery.charge=this.order().notDeletedCharges.find(i=>i.id===e.id),this.partialDelivery.show()},this.eligibleStockCharges=P(()=>{let e=this.order();return e?e.notDeletedCharges.filter(i=>this.orderProductChargeService.checkPartialDeliveryEnable(i,e)):[]}),this.openBulkDelivery=()=>{this.bulkDelivery&&(this.bulkDelivery.order=this.order(),this.bulkDelivery.eligibleCharges=this.eligibleStockCharges(),this.bulkDelivery.showDialog())},this.onBulkDeliveriesCompleted=()=>V(this,null,function*(){let e=yield me(this.orderService.fetchById(this.order().id));this.onPartialDeliveryCreated(e)}),this.invoicedToDateButton={description:e=>(e?.chargedThroughDate?"Edit":"Set")+" invoiced to date",icon:"edit_calendar",permission:pe.OrderUpdate,simpleDisable:!1,onClick:e=>this.setInvoicedToDateRowClick(e)},this.revenueScheduleButton={description:"Revenue schedule",icon:"event",condition:!1,permission:pe.OrderUpdate,simpleDisable:!1,onClick:this.onClickRevenueScheduleRowClick},this.deliveryButton={description:"Delivery",icon:"shop_two",rowCondition:e=>this.orderProductChargeService.checkPartialDeliveryEnable(e,this.order()),permission:pe.OrderUpdate,onClick:e=>this.partialDeliveryRowClick(e)},this.getRowActionButtons=P(()=>(this.invoicedToDateButton.simpleDisable=this.order().cannotSetInvoiceToDate||this.editMode(),this.revenueScheduleButton.condition=!this.order().isDraft,this.revenueScheduleButton.simpleDisable=this.editMode(),this.deliveryButton.condition=this.isPartialDeliveryEnable(),[this.invoicedToDateButton,this.revenueScheduleButton,this.deliveryButton])),this.disableSplitOrder=()=>this.order()?.orderType===J.SalesOrder?"Split is not available for sales orders":this.order()?.isLastVersion?this.order()?.activeProducts?.length<2?"Must have at least 2 active products":this.order()?.status!==ue.Active?"Can only split active orders":this.productTable()?.allCheckboxesAreChecked()?"Cannot split all order products":this.productTable()?.checkedEntities().some(e=>e.splitToOrderId)?"Cannot split product that has already been split":this.editMode()?"Complete or cancel current change action":!1:"Can only split last version of order",this.disableOrderHeaderButtons=P(()=>{let e="";return this.isLoading()||this.orderService.chargesToUpdate().length>0?!0:(this.orderInvoices().some(t=>t.status===nt.Draft)&&(e="Order has a draft invoice that is not posted"),this.editMode()&&(e="Complete or cancel current change action"),this.orderAvailableActions().canChangeOrder||(e="Cannot change, renew, cancel or delete order with active change quote"),e!=""?e:!1)}),this.disableSetMilestoneButton=P(()=>this.editMode()?"Complete or cancel current change action":this.orderAvailableActions().canChangeOrder?!1:"Cannot set milestone date while a change-order Quote is open."),this.disableCloneOrderButton=P(()=>this.isLoading()||this.orderService.chargesToUpdate().length>0?!0:this.editMode()?"Complete or cancel current change action":!1),this.disableCreateInvoiceButton=P(()=>{let e="";return this.isLoading()||this.orderService.chargesToUpdate().length>0?!0:(this.orderInvoices().some(t=>t.status===nt.Draft)&&(e="Order has a draft invoice that is not posted"),this.editMode()&&(e="Complete or cancel current change action"),this.orderAvailableActions()?.canBeInvoiced?this.order().disableInvoicing&&(e="Order cannot be invoiced because invoicing is disabled"):e="Order cannot be invoiced",this.order()?.orderPaymentMethod===Oe.Stripe&&this.stripeCredentialStatus()!==Mt.CredentialCollected&&this.stripeSettings()?.allowInvoiceCreationWithoutDetails===!1&&(e="Not possible to invoice order with Stripe before payment details is collected"),this.order()?.orderPaymentMethod===Oe.GoCardless&&(!this.onlinePaymentDetails()||this.onlinePaymentDetails()?.goCardlessMandateStatus!==Pt.MandateApproved&&this.onlinePaymentDetails()?.goCardlessMandateStatus!==Pt.MandateApprovedByCustomer)&&(e="Not possible to invoice this order before GoCardless payment details are collected"),e!=""?e:!1)}),this.canEditInvoiceSeparately=P(()=>!(this.order().currencyCodeToUseWhenInvoice!==null&&this.orderSettings().useInvoiceCurrencyCodeOnOrder||this.order().orderPaymentMethod===Oe.Stripe||this.order().orderPaymentMethod===Oe.GoCardless)),this.productRequiredFields=P(()=>{let e=[];
1return this.order().isCreatedFromSplit&&e.push("splitFromOrderNumber"),this.order().hasBeenSplit&&e.push("splitToOrderNumber"),e}),this.currentTable=P(()=>this.selectedView()===mt.Charges?this.allChargesTable():this.chargeTable),this.allChargesTableConditions=P(()=>{let e;return e=[{fieldName:"orderid",value:this.order().id},{fieldName:"chargeid",operator:it.NotEquals,value:null,allowNull:!0}],e}),this.effectiveRange=P(()=>({from:this.order().effectiveStartDate,to:this.order().effectiveEndDate})),this.displayStatus=P(()=>{let e=this.order();if(!e)return"";if(e.status===ue.Active){if(!e.isLastVersion)return"Old Version";let i=N.getTodayWithoutTime();if(e.effectiveEndDate){let t=new Date(e.effectiveEndDate);if(t.setHours(0,0,0,0),t<i)return"Expired"}if(e.effectiveStartDate){let t=new Date(e.effectiveStartDate);if(t.setHours(0,0,0,0),t>i)return"Not Started"}return"Active"}return e.status===ue.Order?"Ordered":e.status}),this.contextHeader=P(()=>{if(this.order())return{tooltipMessage:"Open account",linkUrl:`/accounts/${this.order().accountId}`,linkText:this.order().account?.name}}),Ke(()=>{if(this.uiVersion()==="v2")return;this.selectedCharge()&&this.updateProductChargeGroup();let e=this.orderProductChargeService.invalidOpcFields();e.length>0?this.invalidOpcFieldMessage.set(e.join(", ")+(e.length===1?" must have a value":" must have values")):this.invalidOpcFieldMessage.set("")}),Ke(()=>{let e=this.invoicesTable(),i=this.orderInvoices();e&&i.length>0&&(e.manualTableData=i)})}ngOnInit(){return V(this,null,function*(){this.route.data.pipe(xt(()=>{this.isLoading.set(!0),this.order.set(null)}),Re(e=>e.orderDetails),W(this.unsubscribe$)).pipe(mi(this.electronicInvoiceService.isEnabled(),this.fieldConfigurationService.customFieldsForEntity("order"),this.fieldConfigurationService.customFieldsForEntity("orderproduct"),this.settingsService.get("integrationSettings"),this.orderService.orderSettings(),this.countryService.getCountries(),this.chargeDetailsService.getOrderChargeSettings(),this.revenueRecognitionService.read(),this.goCardlessService.getSettings(),this.revenueRecognitionSettingsService.getSettings())).subscribe({next:([e,i,t,o,g,f,T,A,bt,Ze,E])=>{if(!e?.id){this.notificationService.notifyAndRedirect("Order could not be found in current legal entity","/orders");return}this.isEInvoiceEnabled.set(i),this.setProductTableConditions(e.id),this.orderCustomFields.set(t),this.orderProductCustomFields.set(o),this.integrationSettings.set(g),this.orderSettings.set(f),this.countries.set(T),this.orderLoaded(e),this.setStripeStatus(e),this.filterAndSaveInvoicedProducts(),A.isContractAssetEnabled=(E?.enableOrderBasedRevenueRecognition??!1)&&!(E?.bookDeferredRevenueAndContractAssetOnOrderEvent??!0),this.chargeSettings.set(A),this.revenueRecognitionRules.set(bt),this.getOnlinePaymentDetails(),this.goCardlessSettings.set(Ze),this.loadProductCount(),this.loadAllChargesCount()},error:e=>{this.notificationService.error(e.error?.message??"Error fetching Order Data"),this.router.navigate(["/orders"])}})})}ngOnDestroy(){this.unsubscribe$.next(),this.unsubscribe$.complete(),this.scheduledPriceAdjustmentService.currentSchedulePriceAdjustment.set(void 0),this.changeStateService.clearOriginalCharges("order"),this.userPreferencesService.updatePreferences({entitySelectedTabs:be(ae({},this.userPreferencesService.entitySelectedTabs()),{order:this.selectedView()})})}loadProductCount(){let e=this.userPreferencesService.activeFilters()["activeFilter-order-details-products"],i;e&&(i=this.productTableFilters().find(t=>t.name===e)),i&&i.name!=="All"?this.updateProductTabCount(i):this.productCount.set(this.order().orderProducts?.filter(t=>!t.isAddedCharge).length||0)}loadAllChargesCount(){let e=this.userPreferencesService.activeFilters()["activeFilter-order-details-all-charges"],i;e&&(i=this.allChargesTableFilters().find(t=>t.name===e)),i&&i.name!=="All"?this.updateAllChargesTabCount(i):this.entityQueryService.query({entity:"orderproductcharge",displayFields:["id"],conditions:this.allChargesTableConditions()}).pipe(F(1)).subscribe(t=>{this.chargeCount.set(t.totalCount)})}onProductFilterActivate(e){this.updateProductTabCount(e)}updateProductTabCount(e){if(this.uiVersion()==="v2")return;let i=[...this.productTableConditions(),...e.conditions??[]];this.entityQueryService.query({entity:"orderproduct",displayFields:["id"],conditions:i}).pipe(F(1)).subscribe(t=>
1{this.productCount.set(t.totalCount),t.totalCount===0&&this.selectedProduct()&&this.onProductSelectionChanged(null)})}onAllChargesFilterActivate(e){e&&this.updateAllChargesTabCount(e)}updateAllChargesTabCount(e){let i=[...this.allChargesTableConditions(),...e.conditions??[]];this.entityQueryService.query({entity:"orderproductcharge",displayFields:["id"],conditions:i}).pipe(F(1)).subscribe(t=>{this.chargeCount.set(t.totalCount)})}updatePCGroupOnTableChanges(){if(!this.selectedCharge()||this.uiVersion()==="v2")return;let e=new ci(be(ae({},this.productChargeGroup()),{tableProperties:be(ae({},this.productChargeGroup().tableProperties),{chargeIds:this.chargeTable?.dataSource.data.map(i=>i.id)??[],tablePage:this.chargeTable?.paginator.pageIndex??0})}));e.tableProperties.chargeIds.includes(this.selectedCharge()?.id)&&this.chargeTable.selectById(this.selectedCharge().id),this.productChargeGroup.set(e)}updateProductChargeGroup(){return V(this,null,function*(){this.detailsLayoutRightModalGroupFields?.isLoading.set(!0),this.selectedCharge().unitOfMeasure=yield me(this.unitService.fetchById(this.selectedCharge().unitOfMeasureId));let e=new ci({selectedOrderCharge:this.selectedCharge(),orderProduct:this.selectedProduct(),tableProperties:new Zn({chargeIds:this.currentTable()?.dataSource.data.map(i=>i.id)??[],tableTotalChargeCount:this.currentTable()?.totalCount(),tablePage:this.currentTable()?.paginator.pageIndex,totalPages:this.currentTable()?.paginator.getNumberOfPages()})});this.productChargeGroup.set(e)})}onAllChargesTableDataLoaded(e){if(e&&this.selectedCharge()){this.allChargesTable()?.selectFirstRow();let i=this.allChargesTable()?.dataSource.data[0];if(i){let t=this.order().orderProducts.find(o=>o.charges.some(g=>g.id===i.id));t&&this.selectedProduct.set(t)}}}onSelectedViewChange(e){this.selectedCharge()&&(e==="invoices"||e==="invoiceLines")&&this.currentTable().selectById(null),this.selectedView.set(e),e==="invoices"&&this.loadInvoices()}onPageChanged(e){this.currentTable().paginator.pageIndex+=e==="next"?1:-1,this.currentTable().loadAndSetData().pipe(F(1)).subscribe(()=>{let i=this.currentTable().dataSource.data,t=e==="next"?i[0]:i[i.length-1];this.selectedCharge.set(t),this.currentTable().selectById(t.id),this.detailsLayoutRightModalGroupFields.isLoading.set(!1)})}updateChargeTableValue(e){this.currentTable()&&this.chargeDetailsService.updateChargeTableValue(e,this.currentTable())}onChargeFieldConfigChange(){this.uiVersion()!=="v2"&&(this.currentTable().isManualData=!1,this.currentTable().refresh().then(()=>{this.setChangedChargeValuesOnTable()}))}setChangedChargeValuesOnTable(){this.chargeDetailsService.updateChargeValuesOnSelect(this.orderService.chargesToUpdate(),this.currentTable())}onOpcReverted(e){let t=this.productChargeGroup().orderProduct.charges.findIndex(o=>o.id===e.id);this.productChargeGroup().orderProduct.charges[t]=e,this.selectedCharge.set(e),this.productChargeGroup().selectedOrderCharge=e}setProductTableConditions(e){this.productTableConditions.set([{fieldName:"orderid",value:e},{fieldName:"isAddedCharge",value:!1}])}orderLoaded(e){return V(this,null,function*(){if(e){if(this.order.set(this.orderService.createEntity(e)),yield this.loadOrderAccounts(),this.orderAvailableActions.set(yield me(this.orderService.availableActions(this.order().id??e.id))),this.setProductTableButtons(),this.updateOrderFieldGroups(),this.uiVersion()==="v3"){this.loadInvoices(!0),this.loadLastVersionId(e.orderNumber);let i=this.userPreferencesService.entitySelectedTabs().order;i?this.selectedView.set(i):this.selectedView.set(mt.Products)}this.isLoading.set(!1)}})}loadLastVersionId(e){this.entityQueryService.query({entity:"order",displayFields:["id","version"],conditions:[{fieldName:"orderNumber",value:e}]}).pipe(F(1)).subscribe({next:i=>{let t=i.result;if(t&&t.length>0){let o=t.sort((g,f)=>f.version-g.version)[0];this.lastOrderVersionId.set(o.id)}},error:()=>{this.notificationService.error("Error loading order last version")}})}loadInvoiceAndInvoiceLineCounts(){this.orderService.getInvoices(this.order().orderNumber).pipe(F(1)).subscribe({next:e=>{this.invoiceCount.set(e.length)},error:e=>this.notificationService.error(e.error.message)}),this.entityQueryService.query({entity:"invoiceline",displayFields:["id"],conditions:[{fieldName:"orderorderNumber",operator:it.Equals,value:this.order().orderNumber},{fieldName:"invoicestatus",operator:it.NotEquals,value:nt.Cancelled},{fieldName:"invoicestatus",operator:it.NotEquals,value:nt.Draft}]}).pipe(F(1)).subscribe(e=>{this.invoiceLineCount.set(e.totalCount)})}loadInvoices(e=!1){this.selectedView()!=="invoices"&&this.selectedView()!=="invoiceLines"&&!e||(this.isInvoicesLoading.set(!0),this.orderService.getInvoices(this.order().orderNumber).pipe(F(1),te(()=>this.isInvoicesLoading.set(!1))).subscribe({next:i=>
1{i.forEach(t=>{t.subtotalAmount=t.subtotal.amount,t.subtotalCurrencyCode=t.subtotal.currencyCode,t.subtotalBaseCurrencyAmount=t.subtotal.baseCurrencyAmount,t.subtotalBaseCurrencyCode=t.subtotal.baseCurrencyCode,t.taxAmount=t.tax.amount,t.taxCurrencyCode=t.tax.currencyCode,t.taxBaseCurrencyAmount=t.tax.baseCurrencyAmount,t.taxBaseCurrencyCode=t.tax.baseCurrencyCode,t.totalAmountAmount=t.totalAmount.amount,t.totalAmountCurrencyCode=t.totalAmount.currencyCode,t.totalAmountBaseCurrencyAmount=t.totalAmount.baseCurrencyAmount,t.totalAmountBaseCurrencyCode=t.totalAmount.baseCurrencyCode}),this.orderInvoices.set(i),this.invoicesTable()&&(this.invoicesTable().manualTableData=i),this.loadInvoiceAndInvoiceLineCounts()},error:i=>this.notificationService.error(i.error.message)}))}loadOrderAccounts(){return V(this,null,function*(){let e=this.order().accountAndInvoiceAccountIsSame?[this.tryFetchAccount(this.order().accountId)]:[this.tryFetchAccount(this.order().accountId),this.tryFetchAccount(this.order().invoiceAccountId)],i=yield Promise.all(e);this.order().account=i[0]??this.order().account,this.order().invoiceAccount=(this.order().accountAndInvoiceAccountIsSame?i[0]:i[1])??this.order().invoiceAccount,this.order.set(this.order()),this.setOrderAddresses()})}tryFetchAccount(e){return e?me(this.orderService.fetchAccountDefaults(e)).then(i=>(i||(this.accountLoadFailed=!0),i)).catch(()=>(this.accountLoadFailed=!0,null)):(this.accountLoadFailed=!0,Promise.resolve(null))}setOrderAddresses(){let e=[...this.order().invoiceAccount?.addresses??[],...this.order().account?.addresses??[]];this.order().invoiceAddressId&&(this.order().invoiceAddress=e.find(i=>i.id===this.order().invoiceAddressId),this.invoiceAddress$.next(this.addressFormatPipe.transform(this.order().invoiceAddress,this.countries()))),this.order().deliveryAddressId&&(this.order().deliveryAddress=e.find(i=>i.id===this.order().deliveryAddressId),this.deliveryAddress$.next(this.addressFormatPipe.transform(this.order().deliveryAddress,this.countries())))}filterAndSaveInvoicedProducts(){this.order().orderProducts.filter(i=>i.charges.some(t=>t.chargedThroughDate)).forEach(i=>this.productsWithChargedThroughDate?.add(i.id))}areAllChargesCancelled(e){if(!e?.id)return!1;let i=this.order()?.orderProducts?.find(g=>g.id===e.id);if(!i)return!1;let t=i.notDeletedLastVersionCharges;return!t||t.length===0?!1:!t.some(g=>g.changeState!==Ce.Cancelled&&g.changeState!==Ce.CancelledFromChange)}onOrderRenewed(e){this.orderLoaded(e),this.productTable()?.refresh(),this.chargeTable.refresh(),this.uiVersion()==="v2"&&this.orderProductChargeDetailsCard.refresh(this.selectedCharge())}setProductTableButtons(){let e=this.uiVersion()==="v3"&&this.orderProductCustomFields()?.length>0;this.productTableRowButtons.set([...e?[{description:"Edit Custom Fields",icon:"checklist",permission:pe.OrderUpdate,onClick:this.toggleCustomFields}]:[],...this.order().canBeChanged?[{description:"Modify product",icon:"build",permission:pe.OrderUpdate,onClick:this.orderModifyProduct?.showDialog},this.order().orderType===J.Subscription?{description:"Cancel product",icon:"cancel",permission:pe.OrderUpdate,onClick:this.orderCancelProduct?.showCancelDialog,disable:i=>this.areAllChargesCancelled(i)}:{description:"Delete product",icon:"delete",permission:pe.OrderUpdate,onClick:this.orderCancelProduct?.showDeleteDialog,disable:i=>this.productsWithChargedThroughDate.has(i.id)}]:[]]),this.productTableCheckboxButtons.set([]),this.orderSettings()?.enableSplitOrder&&this.productTableCheckboxButtons().push({icon:"call_split",description:"Split",tooltip:"Split selected products",permission:pe.OrderUpdate,onClick:this.orderSplitOrder.showDialog,disable:this.disableSplitOrder}),this.orderSettings()?.enableMassUpdateChargeFields&&this.productTableCheckboxButtons().push({icon:"library_add_check",description:"Mass update",tooltip:"Mass update charges of selected products",permission:pe.OrderUpdate,onClick:this.orderMassUpdateCharges.showDialog})}saveOrderProperties(){this.isLoading.set(!0),this.orderService.update(this.order()).pipe(W(this.unsubscribe$),te(()=>this.isLoading.set(!1))).subscribe({next:e=>{this.editOrderMode.set(!1),this.orderLoaded(e),this.chargeTable?.refresh()},error:e=>{this.notificationService.error(e.error.message)}})}cancelOrderProperties(){return V(this,null,function*(){this.order.set(yield me(this.orderService.fetchById(this.order().id))),yield this.orderLoaded(this.order()),this.editOrderMode.set(!1)})}saveOrderProductProperties(){this.isLoading.set(!0);let e={};
1this.orderProductCustomFields().forEach(i=>e[i.fieldName]=this.selectedProduct()[i.fieldName]),this.dataService.patchEntity(this.selectedProduct().id,"orderproduct",e).subscribe(()=>{this.editOrderProductMode.set(!1),this.isLoading.set(!1),this.chargeTable&&this.chargeTable.refresh(),this.selectedProductCopy.set(this.entityFactory.createOrderProduct(this.selectedProduct()))})}onSaveCharges(){let e=this.detailsLayoutRightModalGroupFields;e.isLoading.set(!0);let i=this.orderService.chargesToUpdate();this.orderProductChargeService.updateOrderProductCharge(i).pipe(F(1),te(()=>e.isLoading.set(!1))).subscribe({next:()=>{this.changeStateService.clearOriginalCharges("order"),this.orderService.chargesToUpdate.set([]),e.canEditCharge.set(!1),this.currentTable().refresh()},error:t=>{this.notificationService.error(t?.error?.message??"Error saving charges")}})}onEditClick(){this.selectedProductCopy.set(this.entityFactory.createOrderProduct(this.selectedProduct())),this.editOrderProductMode.set(!0)}onCancelClick(){let e=this.order().orderProducts.findIndex(i=>i.id===this.selectedProduct().id);this.order().orderProducts[e]=this.selectedProductCopy(),this.selectedProduct.set(this.selectedProductCopy()),this.editOrderProductMode.set(!1),this.showCustomFields.set(!1)}onClickActivateOrder(){if(this.order().orderProducts.every(i=>i.isAddedCharge===!0))return this.notificationService.warning("Can not activate order with only Associated Charges");this.order().orderProducts.length===0?this.notificationService.warning("Please add a product or save as draft"):this.uiVersion()==="v3"&&this.order().orderType!==J.SalesOrder?this.openDraftActivationDialog():(this.isLoading.set(!0),this.orderService.activateOrder(this.order().id).pipe(W(this.unsubscribe$),te(()=>this.isLoading.set(!1))).subscribe({next:i=>this.router.navigate(["/orders",i.id]),error:i=>{this.notificationService.error(i.error.message)}}))}openDraftActivationDialog(){this.orderChargesForActivationDialog.set({new:this.getDraftActivationChargeRows(),changed:[],cancelled:[]}),this.originalOrderKPIs.set({cmrr:this.order().cmrr,acv:this.order().acv,tcv:this.order().tcv,otf:this.order().oneTimeFees});let e=this.order()?.effectiveStartDate,i=e?new ke().transform(e,"shortDate"):"Specific Date";this.activationDialog?.show(i,!0,void 0,!0,this.orderChargesForActivationDialog(),"activateDraft")}getDraftActivationChargeRows(){let e=this.order();if(!e?.orderProducts)return[];let i=[];for(let t of e.orderProducts){let o=t.charges;if(o)for(let g of o)i.push({rowChangeState:Hn.New,name:g.name,chargeType:g.chargeType,calculatedCmrr:g.calculatedCmrr,calculatedAcv:g.calculatedAcv,oneTimeFees:g.oneTimeFees,calculatedTcv:g.calculatedTcv})}return i}onActivationDialogConfirm(e){this.activationDialog?.close(),this.isLoading.set(!0),this.orderService.activateOrder(this.order().id,{bookingChangeTypeId:e.bookingChangeTypeId,bookingClassificationId:e.bookingClassificationId,bookingNotes:e.bookingNotes}).pipe(W(this.unsubscribe$),te(()=>this.isLoading.set(!1))).subscribe({next:i=>this.router.navigate(["/orders",i.id]),error:i=>this.notificationService.error(i.error?.message??i.message)})}onActivationDialogCancel(){this.activationDialog?.close()}onClickRevertOrder(){return V(this,null,function*(){let e=`Order ${this.order().orderNumber} will be reverted to previous version, all changes since previous version will be lost. Do you want to continue?`;if(yield this.dialogService.confirmYesNo(e)){this.isLoading.set(!0);let t=this.order().orderNumber;this.orderService.revertOrder(this.order().id).pipe(W(this.unsubscribe$)).subscribe({next:o=>{this.isLoading.set(!1),this.router.navigate(["/orders",o]).then(()=>{this.notificationService.success(`The order ${t} was reverted to previous version`)})},error:o=>{this.isLoading.set(!1),this.notificationService.error(o.error.message)}})}})}onClickCloneOrder(){return V(this,null,function*(){(yield this.dialogService.confirmYesNo(`Are you sure you want to clone order 
2${this.order().orderNumber??"Draft"} into a new draft?
3
4Cloning excludes:
5\u2022 Attachments
6\u2022 Notes
7\u2022 Order discounts`))&&(this.isLoading.set(!0),this.orderService.copyOrder(this.order().id).pipe(F(1),te(()=>{this.isLoading.set(!1)})).subscribe({next:i=>{this.notificationService.success("Order cloned successfully"),this.router.navigate(["/orders",i.id])},error:i=>this.notificationService.error(i.error?.message??"Order clone failed")}))})}onClickDeleteOrder(){return V(this,null,function*(){if(yield this.dialogService.confirmYesNo(`Delete order ${this.order().orderNumber}? This cannot be undone`)){if(this.order().version>1){this.notificationService.warning("Not possible to delete an order with multiple versions. Please revert the order to version 1 if possible first.");return}this.isLoading.set(!0),this.orderService.delete(this.order()).pipe(W(this.unsubscribe$)).subscribe({next:()=>{this.isLoading.set(!1),this.notificationService.success(`The order ${this.order().orderNumber} was deleted`),this.router.navigate(["/orders"])},error:i=>{this.isLoading.set(!1),this.notificationService.error(i.error.message??"An error occurred while deleting order")}})}})}onClickApplyPriceAdjustment(){return V(this,null,function*(){if(!(yield this.dialogService.confirmYesNo(`Apply price adjustment to order ${this.order().orderNumber}? This cannot be undone.`)))return;let i=this.order().orderNumber;this.isLoading.set(!0),this.scheduledPriceAdjustmentService.applyScheduledPriceAdjustment(this.order().id).pipe(W(this.unsubscribe$)).subscribe({next:t=>{this.isLoading.set(!1),this.router.navigate(["/orders",t.newOrderId]).then(()=>{this.notificationService.success(`Price adjustment was applied to order ${i}`)})},error:t=>{this.isLoading.set(!1),this.notificationService.error(Pn.toMessage(t,"An error occurred while applying price adjustment"))}})})}onClickRevenueSchedule(){let e=this.currentTable().selection.id;this.router.navigate(["orders/chargerevenueschedule",e])}setStripeStatus(e){return V(this,null,function*(){this.stripeIsActive.set(yield me(this.stripeService.isActive())),this.stripeIsActive()&&this.stripeService.stripeCredentialStatus(e.invoiceAccountId).pipe(W(this.unsubscribe$)).subscribe(i=>{this.stripeCredentialStatus.set(i?.stripeCredentialStatus??Mt.MissingCredential),this.onlinePaymentDetails.set(i),this.stripeService.getSettings().pipe(W(this.unsubscribe$)).subscribe(t=>this.stripeSettings.set(t)),this.updateOrderFieldGroups()})})}getOnlinePaymentDetails(){return V(this,null,function*(){this.canViewAccounts&&this.accountService.getOnlinePaymentsDetails(this.order()?.invoiceAccountId).pipe(W(this.unsubscribe$)).subscribe(e=>{this.onlinePaymentDetails.set(e)})})}onPartialDeliveryCreated(e){this.orderLoaded(e),this.onProductSelectionChanged(this.selectedProduct()),this.detailsLayoutRightModalGroupFields&&this.detailsLayoutRightModalGroupFields.onPriceDetailFieldChangeOpc("price").pipe(F(1)).subscribe()}onProductSelectionChanged(e){e?(this.selectedProduct.set(this.order().orderProducts.find(i=>i.id===e.id)),this.chargeTablesCondition().pipe(F(1)).subscribe(i=>{this.chargeTable.conditions=i,this.chargeTable.isManualData=!1,this.applyMatchingChargeFilter(),this.chargeTable.refresh().then(()=>
7{if(this.uiVersion()==="v2")return;let t=this.order().orderProducts.flatMap(o=>o.charges).map(o=>o.id);this.orderService.chargesToUpdate().find(o=>t.includes(o.id))&&this.setChangedChargeValuesOnTable()})})):(this.selectedProduct.set(null),this.chargeTable.clear())}applyMatchingChargeFilter(){let e=this.productTableFilter?.activeFilter(),i=e?this.allChargesTableFilters().find(t=>t.name===e.name):void 0;this.chargeTable.conditionsFromFilters=i?[...i.conditions??[]]:[],this.chargeTable.conditionLogicFromFilters=i?.conditionsLogic}onChargeSelectionChanged(e){return V(this,null,function*(){if(e){if(this.selectedView()===mt.Charges){let t=this.order().orderProducts.flatMap(g=>g.charges).find(g=>g.id===e.id),o=this.order().orderProducts.find(g=>g.charges.some(f=>f.id===e.id));this.selectedCharge.set(t),this.selectedProduct.set(o)}else{let t=this.selectedProduct().charges?.find(o=>o.id===e.id);this.selectedCharge.set(t)}let i=this.orderProductChargeService.checkPartialDeliveryEnable(e,this.order());this.isPartialDeliveryEnable.set(i),this.selectedCharge().orderProductId=this.selectedProduct().id,this.alwaysSelectFirstCharge.set(!0)}else this.selectedCharge.set(null),this.isPartialDeliveryEnable.set(!1),this.alwaysSelectFirstCharge.set(!1),this.uiService.hasMainRightModalOpen.set(!1)})}onProductLineNumbersReordered(){this.productTable().sort.active="productLineNumber",this.productTable().sort.direction="asc",this.productTable().refresh()}onMilestoneSet(e){return V(this,null,function*(){this.order().notDeletedCharges.some(t=>t.startMilestoneId===e.id||t.endMilestoneId===e.id)&&(this.order.set(this.orderService.createEntity(yield me(this.orderService.getById(this.order().id)))),this.chargeTable?.refresh(),this.uiVersion()==="v3"&&this.productTable()?.refresh(),this.orderProductChargeDetailsCard?.refresh(this.selectedCharge()))})}showMilestoneDialog(){this.tabsRightModal?.showSetMilestoneDialog()}refreshOrderFromSplit(){window.location.reload()}chargeTablesCondition(){let e=[{fieldName:"orderid",value:this.order().id}];return this.selectedProduct()&&e.push({fieldName:"orderProductId",value:this.selectedProduct().id}),Ue(e)}onModalCloseClick(){let e=this.chargeTable??this.allChargesTable();e&&e.selectById(null)}getIcon(){switch(this.order()?.orderPaymentMethod){case Oe.Invoice:return null;case Oe.Stripe:return this.stripeService.getStripeIcon(this.stripeCredentialStatus(),this.onlinePaymentDetails());case Oe.GoCardless:return this.goCardlessService.getGoCardlessIcon(this.onlinePaymentDetails()?.goCardlessMandateStatus,this.onlinePaymentDetails());default:return null}}onAssociatedChargesChanged(){this.orderService.getById(this.order().id).pipe(W(this.unsubscribe$)).subscribe({next:e=>{this.order.set(e)},error:e=>{this.notificationService.error(e.error?.message??"Error refreshing order data")}})}static{this.\u0275fac=function(i){return new(i||n)}}static{this.\u0275cmp=I({type:n,selectors:[["yon-order-details"]],viewQuery:function(i,t){if(i&1&&(yi(t.productTable,Qd,5)(t.allChargesTable,Gd,5)(t.invoicesTable,zd,5)(t.invoiceLinesTable,$d,5),B(Hd,5)(Wd,5)(Ud,5)(Kd,5)(Yd,5)(Jd,5)(Xd,5)(Zd,5)(el,5)(tl,5)(il,5)(nl,5)(ol,5)(rl,5)(al,5)),i&2){bi(4);let o;D(o=w())&&(t.productTableFilter=o.first),D(o=w())&&(t.chargeTable=o.first),D(o=w())&&(t.allChargesTableFilter=o.first),D(o=w())&&(t.orderProductChargeDetailsCard=o.first),D(o=w())&&(t.orderCancelProduct=o.first),D(o=w())&&(t.orderModifyProduct=o.first),D(o=w())&&(t.orderSplitOrder=o.first),D(o=w())&&(t.orderMassUpdateCharges=o.first),D(o=w())&&(t.detailsLayoutRightModalGroupFields=o.first),D(o=w())&&(t.tabsRightModal=o.first),D(o=w())&&(t.milestonesCard=o.first),D(o=w())&&(t.activationDialog=o.first),D(o=w())&&(t.setInvoicedToDate=o.first),D(o=w())&&(t.partialDelivery=o.first),D(o=w())&&(t.bulkDelivery=o.first)}},decls:34,vars:20,consts:[["orderCancelOrder",""],["adjustEndDate",""],["renewOrder",""],["reactivateOrder",""],["createInvoice",""],["partialDelivery",""],["bulkDelivery",""],["orderDocuments",""],["reorderProducts",""],["setInvoicedToDate",""],["orderModifyProduct",""],["orderCancelProduct",""],["orderSplitOrder",""],["orderMassUpdateCharges",""],["logViewer",""],["productTableFilter",""],["productTable",""],["chargeTable",""],["orderProductChargeDetailsCard",""],["allChargesTable",""],["invoicesTable",""],["invoiceLinesTable",""],["allChargesTableFilter",""],["detailsLayoutRightModalGroupFields",""],["milestonesCard",""],["tabsRightModal",""],["activationDialog",""],["mode","indeterminate",1,"mat-progress-bar__main"],[3,"entityName","contextHeader","header","headerPrefix","subheader","badge","scheduledPriceAdjustmentStatus","effectiveRange","isSalesOrder","right-modal-open","rightPanelWidth","menuButtonLabel"],[3,"order"],[3,"onOrderProlonged","order","orderSettings","orderCancelOrder"],[3,"onOrderRenewed","order"],[3,"order","canSimpleReactivate"],[3,"onPartialDeliveryCreated","charge"],[3,"deliveriesCompleted"],[3,"productLineNumbersReordered","order"],[3,"onInvoicesToChanged","charge","orderId"],[3,"goToNewOrderClicked","refreshCurrentOrder","order"],[3,"chargesUpdated","order"],[3,"order","originalOrderKPIs","orderCharges"],[3,"entityName","contextHeader","header","headerPrefix","subheader","badge","scheduledPriceAdjustmentStatus","effectiveRange","isSalesOrder","rightPanelWidth","menuButtonLabel"],["color","primary","tooltip","Save all charge changes",1,"save-changes-button",3,"disabled"],["buttonIcon","edit",3,"permission","disabled","link"],["mat-raised-button","","buttonIcon","visibility",3,"disabled","permission","link"],["color","primary",3,"disabled","permission"],["buttonIcon","autorenew","tooltip","Renew order",3,"permission","disabled"],["buttonIcon","edit","tooltip","Change order",3,"permission","disabled","link"],["buttonIcon","cancel","tooltip","Cancel order",3,"permission","disabled"],["buttonIcon","replay","tooltip","Reactivate cancelled order",3,"permission","disabled"],["buttonIcon","add",3,"disabled","permission"],["buttonIcon","local_shipping","tooltip","Deliver stock for multiple charges",3,"permission","disabled"],[3,"account","
7isLoading","stripeCredentialStatus"],["buttonIcon","delete","tooltip","Delete order","type","mat-menu-item",3,"disabled","permission"],["buttonIcon","price_change","tooltip","Apply price adjustment","type","mat-menu-item",3,"permission","disabled"],["type","mat-menu-item","buttonIcon","description",3,"onClick","disabled"],["headerFontSize","sm","headerFontWeight","bold",3,"header"],[3,"invoiceAddress","deliveryAddress","readOnly","hidden"],[1,"panel-main-right-modal","panel-scrollable",3,"ngClass","breadCrumbs","productChargeGroup","entityName"],["buttonIcon","undo","tooltip","Revert order to previous version",3,"permission","disabled"],["buttonIcon","content_copy","tooltip","Clone order into a new draft",3,"onClick","permission","disabled"],["buttonIcon","delete","tooltip","Delete order",3,"disabled","permission"],["buttonIcon","event_available","tooltip","Set milestone date",3,"disabled","permission"],["buttonIcon","autorenew","tooltip","Renew order",3,"onClick","permission","disabled"],["buttonIcon","cancel","tooltip","Cancel order",3,"onClick","permission","disabled"],["buttonIcon","undo","tooltip","Revert order to previous version",3,"onClick","permission","disabled"],["buttonIcon","delete","tooltip","Delete order",3,"onClick","disabled","permission"],["buttonIcon","event_available","tooltip","Set milestone date",3,"onClick","disabled","permission"],[3,"stripeCredentialStatusChange","account","isLoading","stripeCredentialStatus"],["color","primary","tooltip","Save all charge changes",1,"save-changes-button",3,"onClick","disabled"],["color","primary",3,"onClick","disabled","permission"],["buttonIcon","replay","tooltip","Reactivate cancelled order",3,"onClick","permission","disabled"],["buttonIcon","add",3,"onClick","disabled","permission"],["buttonIcon","local_shipping","tooltip","Deliver stock for multiple charges",3,"onClick","permission","disabled"],["type","mat-menu-item","buttonIcon","undo","tooltip","Revert order to previous version",3,"onClick","permission","disabled"],["buttonIcon","content_copy","tooltip","Clone order into a new draft","type","mat-menu-item",3,"onClick","permission","disabled"],["buttonIcon","event_available","tooltip","Set milestone date","type","mat-menu-item",3,"onClick","disabled","permission"],["type","mat-menu-item","buttonIcon","date_range","tooltip","Adjust order end date",3,"permission","disabled"],["type","mat-menu-item","buttonIcon","edit","tooltip","Change order",3,"permission","disabled","link"],["type","mat-menu-item","buttonIcon","date_range","tooltip","Adjust order end date",3,"onClick","permission","disabled"],["buttonIcon","delete","tooltip","Delete order","type","mat-menu-item",3,"onClick","disabled","permission"],["buttonIcon","price_change","tooltip","Apply price adjustment","type","mat-menu-item",3,"onClick","permission","disabled"],["type","mat-icon-button","buttonIcon","edit","tooltip","Edit information",3,"onClick","permission","disabled"],["type","mat-icon-button","tooltip","Order timeline","buttonIcon","history",3,"onClick"],["entityName","order","initExpandOptions","allGroups",3,"fieldGroups","entity","readOnly","showSaveAndCancelButtons","disableSaveAndCancelButtons"],[1,"text-danger"],[1,"my-1"],[1,"not-latest-version"],[3,"routerLink"],["entityName","order","initExpandOptions","allGroups",3,"saveClick","cancelClick","fieldGroups","entity","readOnly","showSaveAndCancelButtons","disableSaveAndCancelButtons"],["header","Products"],["layout","pill-buttons",3,"filterActivate","entityTable","defaultFilters"],["type","mat-menu-item","buttonIcon","shuffle",3,"onClick","disabled","permission"],[3,"entityTable","exportFileName"],["entity","orderproduct","viewName","order-details-products",3,"selectionChanged","defaultFields","requiredFields","conditions","alwaysSelectFirst","disableSelection","rowActionButtons","checkboxConfig"],[3,"header"],["header","Charges",1,"panel-second-table",3,"hidden"],["type","mat-menu-item","buttonIcon","edit_calendar",3,"onClick","disabled","permission"],["type","mat-menu-item","buttonIcon","event",3,"disabled","tooltip"],["type","mat-menu-item","buttonIcon","shop_two",3,"permission"],["entity","orderproductcharge","viewName","order-details-charges",3,"dataLoaded","selectionChanged","fieldConfigChange","defaultFields","alwaysSelectFirst","explicitLo
7ad","disableSelection"],[3,"order","orderProductCharge","orderDetailsIsInEditMode"],["type","mat-menu-item","buttonIcon","build",3,"onClick","disabled","permission"],["type","mat-menu-item","buttonIcon","cancel",3,"disabled","permission"],["type","mat-menu-item","buttonIcon","delete",3,"disabled","permission"],["type","mat-menu-item","buttonIcon","cancel",3,"onClick","disabled","permission"],["type","mat-menu-item","buttonIcon","delete",3,"onClick","disabled","permission"],["type","mat-icon-button","buttonIcon","edit",3,"onClick","disabled"],[1,"row"],[1,"col-md-3"],["color","primary",1,"mr-2",3,"onClick","hidden","disabled"],[3,"onClick","hidden","disabled"],["entityName","orderproduct",3,"entity","fieldName","isCustom","readOnly"],["type","mat-menu-item","buttonIcon","event",3,"onClick","disabled","tooltip"],["type","mat-menu-item","buttonIcon","shop_two",3,"onClick","permission"],[3,"editModeChange","orderProductChargeSave","order","orderProductCharge","orderDetailsIsInEditMode"],[1,"tabs-row"],["id","order-tabs",1,"tabs__container"],["color","primary","hideSingleSelectionIndicator","",3,"change","value"],["value","products"],["matBadgeOverlap","false",1,"ml-2",3,"matBadge"],["value","charges"],["value","invoices"],["value","invoiceLines"],[1,"tabs-row__content"],["entity","orderproductcharge","viewName","order-details-all-charges",3,"defaultFields","conditions","explicitLoad","disableSelection","rowActionButtons"],["entity","invoice","viewName","order-details-invoices-table",3,"defaultFields","isManualData","isManualDataLoading"],["entity","invoiceline","viewName","order-details-invoice-lines-table",3,"defaultFields","conditions"],[1,"tab-actions"],[1,"actions__container"],["entity","orderproduct","viewName","order-details-products",3,"selectionChanged","defaultFields","requiredFields","conditions","alwaysSelectFirst","explicitLoad","disableSelection","rowActionButtons","checkboxConfig"],["id","custom-fields",1,"flex","justify-content-between","custom-fields__container",3,"custom-fields__editmode"],[1,"panel-second-table",3,"header","headerCrumb","hidden"],["entity","orderproductcharge","viewName","order-details-charges-v3",3,"selectionChanged","dataLoaded","fieldConfigChange","defaultFields","alwaysSelectFirst","explicitLoad","disableSelection","rowActionButtons"],["id","custom-fields",1,"flex","justify-content-between","custom-fields__container"],[1,"flex","justify-content-between","custom-fields__header"],[1,"custom-fields__title"],[1,"product-name"],["name","chevron_right",1,"mx-1",3,"weight"],["type","mat-icon-button","buttonIcon","close",3,"onClick"],[1,"custom-field__tag","col-sm-6","col-md-4","col-xxxl-3"],["type","mat-icon-button","buttonIcon","edit",3,"onClick","hidden"],[1,"custom-field__label"],[1,"custom-fields__divider"],["entityName","orderproduct",3,"entity","fieldName","isCustom","readOnly","hideTitle"],["entity","orderproductcharge","viewName","order-details-all-charges",3,"selectionChanged","dataLoaded","defaultFields","conditions","explicitLoad","disableSelection","rowActionButtons"],["layout","pill-buttons",3,"filterActivate","entityTable","defaultFilters","explicitTableLoad"],[3,"target"],[1,"panel-main-right-modal","panel-scrollable",3,"onCloseClick","nextOrPreviousCharge","ngClass","breadCrumbs","productChargeGroup","entityName"],[3,"pageChanged","chargeChanged","opcReverted","updateChargeTable","order","entityType","chargeSettings","productChargeGroup","isDetailOrderView"],[3,"cmrr","acv","otf","tcv"],[3,"orderNumber"],[3,"order","isNewOrChangeOrder"],["entityName","order",3,"entityId","entityNumber"],[3,"order",4,"hasFeature"],[3,"entityType","entity","permission"],["entityName","order",3,"milestonesChange","milestoneSet","showAddItemButton","order","milestones","canSetMilestone","orderAvailableActions"],[3,"orderId"],[3,"onVersionsLoadedEmitLastId","orderNumber"],[3,"milestoneSet","onAssociatedChargesChanged","order","orderAvailableActions","orderSettings"],[3,"onConfirm","onCancel","order","originalOrderKPIs","orderCharges"]],template:function(i,t){if(i&1){let o=y();
7h(0,pl,1,0,"mat-progress-bar",27),h(1,Ms,29,37,"yon-details-layout",28)(2,ks,3,2,"section"),b(3,"yon-cancel-order-dialog",29,0),d(5,"yon-adjust-end-date-dialog",30,1),_("onOrderProlonged",function(f){return t.onOrderRenewed(f)}),a(),d(7,"yon-renew-order-dialog",31,2),_("onOrderRenewed",function(f){return t.onOrderRenewed(f)}),a(),b(9,"yon-reactivate-order-dialog",32,3)(11,"yon-create-invoice-dialog",29,4),d(13,"yon-partial-delivery-dialog",33,5),_("onPartialDeliveryCreated",function(f){return t.onPartialDeliveryCreated(f)}),a(),d(15,"yon-bulk-delivery-dialog",34,6),_("deliveriesCompleted",function(){return t.onBulkDeliveriesCompleted()}),a(),b(17,"yon-order-documents-dialog",29,7),d(19,"yon-reorder-products-dialog",35,8),_("productLineNumbersReordered",function(){return t.onProductLineNumbersReordered()}),a(),d(21,"yon-set-invoiced-to-date-dialog",36,9),_("onInvoicesToChanged",function(){let f;return p(o),m((f=t.currentTable())==null?null:f.refresh())}),a(),b(23,"yon-modify-product-dialog",29,10)(25,"yon-cancel-product-dialog",29,11),d(27,"yon-split-order-dialog",37,12),_("goToNewOrderClicked",function(){return p(o),t.selectedProduct.set(null),m(t.selectedCharge.set(null))})("refreshCurrentOrder",function(){return t.refreshOrderFromSplit()}),a(),d(29,"yon-mass-update-charges-dialog",38,13),_("chargesUpdated",function(){return t.orderProductChargeDetailsCard==null?null:t.orderProductChargeDetailsCard.refresh(t.selectedCharge())}),a(),h(31,Ns,2,3,"yon-activation-dialog",39),b(32,"yon-event-log-viewer",null,14)}if(i&2){let o,g,f=x(4);C(t.isLoading()&&t.uiVersion()==="v2"?0:-1),r(),C(t.order()&&t.orderAvailableActions()&&(!t.isLoading()||t.uiVersion()==="v2")?1:2),r(2),s("order",t.order()),r(2),s("order",t.order())("orderSettings",t.orderSettings())("orderCancelOrder",f),r(2),s("order",t.order()),r(2),s("order",t.order())("canSimpleReactivate",(o=t.orderAvailableActions())==null?null:o.canSimpleReactivate),r(2),s("order",t.order()),r(2),s("charge",t.selectedCharge()),r(4),s("order",t.order()),r(2),s("order",t.order()),r(2),s("charge",t.selectedCharge())("orderId",(g=t.order())==null?null:g.id),r(2),s("order",t.order()),r(2),s("order",t.order()),r(2),s("order",t.order()),r(2),s("order",t.order()),r(2),C(t.uiVersion()==="v3"?31:-1)}},dependencies:[$,Le,Tt,In,zn,bo,ao,On,Tn,Nn,Vn,so,uo,mo,_o,go,ho,Co,fo,vo,yo,ro,oo,no,Kn,rt,ot,cn,un,Q,Dn,pn,mn,_n,ze,ti,dn,ln,gn,tn,ei,ni,ve,st,Yn,hn,Fn,Mn,En,kn,wn,Sn,zi,Be,$i,Rt,Xn,Ji,Xi,Zi,Ui,Wi,dt,nn,Rn,Un],styles:['.color__yon-orange[_ngcontent-%COMP%]{color:var(--color-primary)}.mat-button-toggle-appearance-standard[_ngcontent-%COMP%], .mat-button-toggle[_ngcontent-%COMP%]:hover{background-color:var(--layout-bg-color-card)}.mat-button-toggle-appearance-standard.mat-button-toggle-checked[_ngcontent-%COMP%]{border-bottom:3px solid var(--color-primary);background-color:var(--layout-bg-color-card)}  .tabs__container .mat-button-toggle-appearance-standard .mat-button-toggle-label-content{margin-right:12px}  #order-tabs.tabs__container>mat-button-toggle-group .mat-button-toggle-label-content span.mat-badge{margin-left:4px}  #order-tabs.tabs__container>mat-button-toggle-group .mat-button-toggle-label-content span.mat-badge span.mat-badge-content{top:9px}  #order-tabs.tabs__container>mat-button-toggle-group mat-button-toggle.mat-button-toggle-appearance-standard:not(:last-child){margin-right:.6vw}.mat-button-toggle-group-appearance-standard[_ngcontent-%COMP%]   .mat-button-toggle-appearance-standard[_ngcontent-%COMP%] + .mat-button-toggle-appearance-standard[_ngcontent-%COMP%]{border-left:none}  .mat-button-toggle-group{box-shadow:none}.tabs-row[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;row-gap:7px;min-width:0;min-height:0}.tabs-row[_ngcontent-%COMP%]   .tabs__container[_ngcontent-%COMP%]{flex:0 0 auto;order:1;min-width:0}.tabs-row[_ngcontent-%COMP%]   .tabs-row__content[_ngcontent-%COMP%]{flex:0 0 100%;order:3;margin-top:4px;min-width:0}.tabs-row[_ngcontent-%COMP%]     .tab-actions{flex:0 0 auto;margin-left:auto;order:2;display:flex;align-items:center;min-width:0}.tabs-row[_ngcontent-%COMP%]     .tab-actions yon-entity-table-filter>yon-button{vertical-align:top}.tabs-row[_ngcontent-%COMP%]     .tab-actions yon-entity-table-filter>yon-button button{background-color:transparent;width:40px}.tabs-row[_ngcontent-%COMP%]     .tab-actions yon-card-header-menu>yon-button{vertical-align:top;margin-top:-5px}.tabs-row[_ngcontent-%COMP%]     .tab-actions .actions__container{display:flex;align-items:flex-start;gap:0}.tabs-row[_ngcontent-%COMP%]     .tab-actions .actions__container yon-entity-table-search{margin-top:-
77px;overflow:hidden}.tabs-row[_ngcontent-%COMP%]     .tab-actions .actions__container yon-entity-table-search .material-symbols-sharp.search{font-variation-settings:"wght" 500!important;font-size:23px!important}@media(max-width:1919px){  .tab-actions .actions__container yon-entity-table-search mat-form-field{max-width:40px}  .tab-actions .actions__container yon-entity-table-search mat-form-field .mat-mdc-form-field-bottom-align{display:none}  .tab-actions .actions__container yon-entity-table-search mat-form-field.mat-focused{max-width:200px;background-color:var(--color-bg-table-drilled-level2);padding:10px 20px 15px;border-radius:var(--layout-card-radius);margin-top:-8px}}  mat-button-toggle-group span.mat-badge-content{top:8px}section#custom-fields.custom-fields__container[_ngcontent-%COMP%]{display:block;margin-bottom:2rem;padding:var(--layout-card-padding);padding-top:20px;background-color:var(--color-bg-table-drilled-level1);border-radius:10px}section#custom-fields.custom-fields__container[_ngcontent-%COMP%]   .custom-fields__header[_ngcontent-%COMP%]{align-items:center}section#custom-fields.custom-fields__container[_ngcontent-%COMP%]   span.custom-fields__title[_ngcontent-%COMP%]{font-weight:500}section#custom-fields.custom-fields__container[_ngcontent-%COMP%]   div.custom-field__tag[_ngcontent-%COMP%]{display:block}section#custom-fields.custom-fields__container[_ngcontent-%COMP%]   div.custom-field__tag[_ngcontent-%COMP%]{border-radius:10px;border:1px solid var(--color-bg-table-drilled-level3);padding:15px}section#custom-fields.custom-fields__container[_ngcontent-%COMP%]   div.row[_ngcontent-%COMP%]{grid-gap:10px;margin:1rem 0}@media(max-width:1780px){  #order-tabs.tabs__container>mat-button-toggle-group .mat-button-toggle-label-content{font-size:15px;margin-right:9px}  #order-tabs.tabs__container>mat-button-toggle-group .mat-button-toggle-label-content span.mat-badge span.mat-badge-content{font-size:10px;height:18px;min-width:18px;line-height:18px;margin-top:-9px}}h5.not-latest-version[_ngcontent-%COMP%]{color:var(--color-red-error);font-weight:500}']})}}return n})();export{nh as OrderDetailsComponent};

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.