1import{h as T,i as Bt,j as Vt,k as $t}from"./chunk-JB6B3RIJ.js";import"./chunk-HGL2ZN6A.js";import"./chunk-BK7WZNAI.js";import{q as kt}from"./chunk-BAZNX2KU.js";import"./chunk-X4X42YA2.js";import{c as wt}from"./chunk-YEIJORLD.js";import"./chunk-LEXO7BWZ.js";import"./chunk-UMRXG5ID.js";import"./chunk-XFJQ2MCP.js";import"./chunk-EDL5HQF4.js";import{D as St,Fa as yt,H as Et,Ha as It,I as Ct,Ia as Lt,J as Ve,Oa as Rt,Za as bt,ab as Ft,b as gt,c as ft,e as At,f as xt,m as ht,nb as Mt,qb as Pt,t as Ot,tb as Tt,u as Dt}from"./chunk-D6JRTJNA.js";import{$g as P,Ae as it,Be as nt,Bf as st,Cc as Qe,Ce as ie,Dc as A,Dd as ee,De as ot,Ec as Xe,Ee as ne,F as y,Fe as at,Gb as v,Hb as s,Ib as l,Jb as ye,Jh as mt,K as J,Kc as a,Lc as p,Mc as Le,Nb as F,Ng as le,Ob as M,Pc as Re,Pf as ae,Ph as we,Qe as pt,Qh as ke,Rd as et,Tb as k,Ug as vt,Vb as C,Vg as ut,Wh as _t,Xb as m,Xe as Me,Zh as ce,_a as n,_h as Be,bf as _,ea as Je,fc as Ie,g as Se,gf as oe,gh as G,hb as R,hh as se,ia as I,jb as Y,kb as b,kc as c,l as Ee,la as W,lc as O,lg as pe,mc as d,n as Z,ne as Fe,ng as ct,ob as h,od as be,pd as Q,pe as te,ra as D,rf as lt,s as f,sa as L,t as Ce,ta as U,tg as dt,ua as g,va as We,vd as X,we as tt,wg as Pe,xb as Ye,xe as rt,xg as Te,ya as S,ye as re,za as E,ze as z}from"./chunk-AOLJ6P6Y.js";import{a as N}from"./chunk-RBO75H4S.js";var rr=(t,o)=>({orderCode:t,orderTotal:o}),ir=t=>({label:t}),nr=()=>({cxRoute:"orderApprovals"});function or(t,o){t&1&&(s(0,"div")(1,"div",3),ye(2,"cx-spinner"),l()())}function ar(t,o){if(t&1&&(s(0,"div",6)(1,"div",7),c(2),a(3,"cxTranslate"),l()()),t&2){let e=m(3).ngIf,r=m();n(2),d(" ",Le(3,1,"orderApprovalDetails.form.title_"+r.approvalDecision,Xe(4,rr,e==null||e.order==null?null:e.order.code,e==null||e.order==null||e.order.totalPriceWithTax==null?null:e.order.totalPriceWithTax.formattedValue))," ")}}function pr(t,o){if(t&1){let e=k();s(0,"form",8),C("ngSubmit",function(){S(e);let i=m(3).ngIf,u=m();return E(u.submitDecision(i))}),s(1,"label"),c(2),a(3,"cxTranslate"),ye(4,"textarea",9)(5,"cx-form-errors",10),a(6,"cxTranslate"),l(),s(7,"div",11)(8,"div",12)(9,"button",13),C("click",function(){S(e);let i=m(4);return E(i.cancelDecisionForm())}),c(10),a(11,"cxTranslate"),l()(),s(12,"div",12)(13,"button",14),c(14),a(15,"cxTranslate"),l()()()()}if(t&2){let e,r=m(4);v("formGroup",r.approvalForm),n(2),d("",p(3,8,"orderApprovalDetails.form.comment_"+r.approvalDecision+".label")," "),n(2),Ye("aria-invalid",((e=r.approvalForm.get("comment"))==null?null:e.touched)&&((e=r.approvalForm.get("comment"))==null?null:e.invalid))("aria-errormessage","commentError"),n(),v("translationParams",A(16,ir,p(6,10,"orderApprovalDetails.form.comment_"+r.approvalDecision+".label")))("control",r.approvalForm.get("comment")),n(5),d(" ",p(11,12,"orderApprovalDetails.form.cancel")," "),n(4),d(" ",p(15,14,"orderApprovalDetails.form.submit_"+r.approvalDecision)," ")}}function lr(t,o){if(t&1&&(F(0),h(1,ar,4,7,"div",4)(2,pr,16,18,"form",5),M()),t&2){let e=m(3);n(),v("ngIf",e.approvalFormVisible),n(),v("ngIf",e.approvalFormVisible)}}function sr(t,o){if(t&1){let e=k();s(0,"div",15)(1,"button",18),C("click",function(){S(e);let i=m(4);return E(i.displayDecisionForm(i.approvalDecisionValue.REJECT))}),c(2),a(3,"cxTranslate"),l()()}t&2&&(n(2),d(" ",p(3,1,"orderApprovalDetails.showForm_REJECT")," "))}function cr(t,o){if(t&1){let e=k();s(0,"div",15)(1,"button",18),C("click",function(){S(e);let i=m(4);return E(i.displayDecisionForm(i.approvalDecisionValue.APPROVE))}),c(2),a(3,"cxTranslate"),l()()}t&2&&(n(2),d(" ",p(3,1,"orderApprovalDetails.showForm_APPROVE")," "))}function dr(t,o){if(t&1&&(F(0),s(1,"div",11)(2,"div",15)(3,"a",16),a(4,"cxUrl"),c(5),a(6,"cxTranslate"),l()(),h(7,sr,4,3,"div",17)(8,cr,4,3,"div",17),l(),M()),t&2){let e=m(2).ngIf;n(3),v("routerLink",p(4,4,Qe(8,nr))),n(2),O(p(6,6,"orderApprovalDetails.back")),n(2),v("ngIf",e==null?null:e.approvalDecisionRequired),n(),v("ngIf",e==null?null:e.approvalDecisionRequired)}}function vr(t,o){if(t&1&&h(0,lr,3,2,"ng-container",1)(1,dr,9,9,"ng-container",1),t&2){let e=m().ngIf,r=m();v("ngIf",e==null?null:e.approvalDecisionRequired),n(),v("ngIf",!r.approvalFormVisible)}}
1function ur(t,o){if(t&1&&(F(0),h(1,or,3,0,"div",2),a(2,"async"),h(3,vr,2,2,"ng-template",null,0,Re),M()),t&2){let e=Ie(4),r=m();n(),v("ngIf",p(2,2,r.loading$))("ngIfElse",e)}}function mr(t,o){if(t&1&&(s(0,"tr")(1,"td",7)(2,"div",8),c(3),a(4,"cxTranslate"),l(),c(5),a(6,"cxTranslate"),l(),s(7,"td",9)(8,"div",8),c(9),a(10,"cxTranslate"),l(),c(11),l(),s(12,"td",10)(13,"div",8),c(14),a(15,"cxTranslate"),l(),c(16),l(),s(17,"td",11)(18,"div",8),c(19),a(20,"cxTranslate"),l(),c(21),a(22,"cxTranslate"),l()()),t&2){let e=o.$implicit;n(3),d(" ",p(4,8,"orderApprovalDetails.permissionResults.permission")," "),n(2),d(" ",p(6,10,"orderApprovalDetails.permissionResults.permissionType_"+(e==null||e.permissionType==null?null:e.permissionType.code))," "),n(4),d(" ",p(10,12,"orderApprovalDetails.permissionResults.approver")," "),n(2),d(" ",e.approverName," "),n(3),d(" ",p(15,14,"orderApprovalDetails.permissionResults.status")," "),n(2),d(" ",e.statusDisplay," "),n(3),d(" ",p(20,16,"orderApprovalDetails.permissionResults.approverComments")," "),n(2),d(" ",e.approverNotes?e.approverNotes:p(22,18,"orderApprovalDetails.permissionResults.noApprovalComments")," ")}}function _r(t,o){if(t&1&&(F(0),s(1,"div",1)(2,"div",2),c(3),a(4,"cxTranslate"),l()(),s(5,"table",3)(6,"thead",4)(7,"tr")(8,"th",5),c(9),a(10,"cxTranslate"),l(),s(11,"th",5),c(12),a(13,"cxTranslate"),l(),s(14,"th",5),c(15),a(16,"cxTranslate"),l(),s(17,"th",5),c(18),a(19,"cxTranslate"),l()()(),s(20,"tbody"),h(21,mr,23,20,"tr",6),l()(),M()),t&2){let e=m().ngIf;n(3),d(" ",p(4,6,"orderApprovalDetails.permissionResults.header")," "),n(6),d(" ",p(10,8,"orderApprovalDetails.permissionResults.permission")," "),n(3),d(" ",p(13,10,"orderApprovalDetails.permissionResults.approver")," "),n(3),d(" ",p(16,12,"orderApprovalDetails.permissionResults.status")," "),n(3),d(" ",p(19,14,"orderApprovalDetails.permissionResults.approverComments")," "),n(3),v("ngForOf",e.permissionResults)}}function gr(t,o){if(t&1&&(F(0),h(1,_r,22,16,"ng-container",0),M()),t&2){let e=o.ngIf;n(),v("ngIf",e.permissionResults==null?null:e.permissionResults.length)}}var B=t=>({approvalCode:t}),V=t=>({cxRoute:"orderApprovalDetails",params:t});function fr(t,o){if(t&1){let e=k();s(0,"tr",16),C("click",function(i){let u=S(e).$implicit,x=m(3);return E(x.goToApprovalDetails(i,u))}),s(1,"td",17)(2,"div",18),c(3),a(4,"cxTranslate"),l(),s(5,"a",19),a(6,"cxUrl"),c(7),l()(),s(8,"td",20)(9,"div",18),c(10),a(11,"cxTranslate"),l(),s(12,"a",19),a(13,"cxUrl"),c(14),a(15,"cxTranslate"),l()(),s(16,"td",21)(17,"div",18),c(18),a(19,"cxTranslate"),l(),s(20,"a",19),a(21,"cxUrl"),c(22),l()(),s(23,"td",22)(24,"div",18),c(25),a(26,"cxTranslate"),l(),s(27,"a",19),a(28,"cxUrl"),c(29),a(30,"cxDate"),l()(),s(31,"td",23)(32,"div",18),c(33),a(34,"cxTranslate"),l(),s(35,"a",19),a(36,"cxUrl"),c(37),a(38,"cxTranslate"),l()(),s(39,"td",24)(40,"div",18),c(41),a(42,"cxTranslate"),l(),s(43,"a",19),a(44,"cxUrl"),c(45),l()()()}if(t&2){let e=o.$implicit;n(3),d(" ",p(4,18,"orderApprovalList.orderCode")," "),n(2),v("routerLink",p(6,20,A(51,V,A(49,B,e==null?null:e.code)))),n(2),d(" ",e.order==null?null:e.order.code),n(3),d(" ",p(11,22,"orderApprovalList.POCode")," "),n(2),v("routerLink",p(13,24,A(55,V,A(53,B,e==null?null:e.code)))),n(2),O((e.order==null?null:e.order.purchaseOrderNumber)||p(15,26,"orderApprovalList.none")),n(4),d(" ",p(19,28,"orderApprovalList.placedBy")," "),n(2),v("routerLink",p(21,30,A(59,V,A(57,B,e==null?null:e.code)))),n(2),O(e.order==null||e.order.orgCustomer==null?null:e.order.orgCustomer.name),n(3),d(" ",p(26,32,"orderApprovalList.date")," "),n(2),v("routerLink",p(28,34,A(63,V,A(61,B,e==null?null:e.code)))),n(2),O(Le(30,36,e.order==null?null:e.order.created,"longDate")),n(4),d(" ",p(34,39,"orderApprovalList.status")," "),n(2),v("routerLink",p(36,41,A(67,V,A(65,B,e==null?null:e.code)))),n(2),d(" ",p(38,43,"orderDetails.statusDisplay_"+(e.order==null?null:e.order.statusDisplay))),n(4),d(" ",p(42,45,"orderApprovalList.total")," "),n(2),v("routerLink",p(44,47,A(71,V,A(69,B,e==null?null:e.code)))),n(2),d(" ",e.order==null||e.order.totalPrice==null?null:e.order.totalPrice.formattedValue)}}
1function Ar(t,o){if(t&1){let e=k();F(0),s(1,"div",3)(2,"div",4)(3,"label",5)(4,"span"),c(5),a(6,"cxTranslate"),l(),s(7,"cx-sorting",6),a(8,"async"),a(9,"cxTranslate"),C("sortListEvent",function(i){S(e);let u=m(2);return E(u.changeSortCode(i))}),l()()(),s(10,"div",7)(11,"cx-pagination",8),C("viewPageEvent",function(i){S(e);let u=m(2);return E(u.pageChange(i))}),l()()(),s(12,"table",9)(13,"caption",10),c(14),a(15,"cxTranslate"),l(),s(16,"thead",11)(17,"tr")(18,"th",12),c(19),a(20,"cxTranslate"),l(),s(21,"th",12),c(22),a(23,"cxTranslate"),l(),s(24,"th",12),c(25),a(26,"cxTranslate"),l(),s(27,"th",12),c(28),a(29,"cxTranslate"),l(),s(30,"th",12),c(31),a(32,"cxTranslate"),l(),s(33,"th",12),c(34),a(35,"cxTranslate"),l()()(),s(36,"tbody"),h(37,fr,46,73,"tr",13),l()(),s(38,"div",14)(39,"div",4)(40,"label",5)(41,"span"),c(42),a(43,"cxTranslate"),l(),s(44,"cx-sorting",6),a(45,"async"),a(46,"cxTranslate"),C("sortListEvent",function(i){S(e);let u=m(2);return E(u.changeSortCode(i))}),l()()(),s(47,"div",7)(48,"cx-pagination",15),C("viewPageEvent",function(i){S(e);let u=m(2);return E(u.pageChange(i))}),l()()(),M()}if(t&2){let e=m().ngIf,r=m();n(5),O(p(6,20,"orderHistory.sortBy")),n(2),v("sortOptions",e.sorts)("sortLabels",p(8,22,r.sortLabels$))("selectedOption",e.pagination.sort)("ariaLabel",p(9,24,"orderHistory.sortOrders")),n(4),v("pagination",e.pagination),n(3),d(" ",p(15,26,"orderApprovalList.orderApprovalList")," "),n(5),d(" ",p(20,28,"orderApprovalList.orderCode")," "),n(3),O(p(23,30,"orderApprovalList.POCode")),n(3),O(p(26,32,"orderApprovalList.placedBy")),n(3),O(p(29,34,"orderApprovalList.date")),n(3),d(" ",p(32,36,"orderApprovalList.status")," "),n(3),O(p(35,38,"orderApprovalList.total")),n(3),v("ngForOf",e.values),n(5),O(p(43,40,"orderHistory.sortBy")),n(2),v("sortOptions",e.sorts)("sortLabels",p(45,42,r.sortLabels$))("selectedOption",e.pagination.sort)("ariaLabel",p(46,44,"orderHistory.sortOrders")),n(4),v("pagination",e.pagination)}}function xr(t,o){t&1&&(s(0,"div",25)(1,"div",26)(2,"div"),c(3),a(4,"cxTranslate"),l()()()),t&2&&(n(3),O(p(4,1,"orderApprovalList.emptyList")))}function hr(t,o){if(t&1&&(F(0),h(1,Ar,49,46,"ng-container",2)(2,xr,5,3,"ng-template",null,0,Re),M()),t&2){let e=o.ngIf,r=Ie(3);n(),v("ngIf",e.pagination&&e.pagination.totalResults&&e.pagination.totalResults>0)("ngIfElse",r)}}var $e=(function(t){return t.APPROVE="APPROVE",t.REJECT="REJECT",t})($e||{}),he="order-approval",Oe="order-approval-entities",De="order-approval-list",w="orderApproval.makeDecision",je="[OrderApproval] Load OrderApproval Data",zt="[OrderApproval] Load OrderApproval Data Fail",Ne="[OrderApproval] Load OrderApproval Data Success",Ue="[OrderApproval] Load OrderApprovals",Gt="[OrderApproval] Load OrderApprovals Fail",ze="[OrderApproval] Load OrderApprovals Success",Ge="[OrderApproval] Make OrderApproval Decision",Kt="[OrderApproval] Make OrderApproval Decision Fail",Ke="[OrderApproval] Make OrderApproval Decision Success",qt="[OrderApproval] Make OrderApproval Decision Reset",q=class extends _.EntityLoadAction{constructor(o){super(Oe,o.orderApprovalCode),this.payload=o,this.type=je}},de=class extends _.EntityFailAction{constructor(o){super(Oe,o.orderApprovalCode,o.error),this.payload=o,this.type=zt}},H=class extends _.EntitySuccessAction{constructor(o){super(Oe,Array.isArray(o)?o.map(e=>e.code??""):o.code??""),this.payload=o,this.type=Ne}},ve=class extends _.EntityLoadAction{constructor(o){super(De,_.serializeSearchConfig(o.params)),this.payload=o,this.type=Ue}},ue=class extends _.EntityFailAction{constructor(o){super(De,_.serializeSearchConfig(o.params),o.error),this.payload=o,this.type=Gt}},me=class extends _.EntitySuccessAction{constructor(o){super(De,_.serializeSearchConfig(o.params)),this.payload=o,this.type=ze}},_e=class extends _.EntityLoadAction{constructor(o){super(G,w),this.payload=o,this.type=Ge}},ge=class extends _.EntityFailAction{constructor(o){super(G,w,o.error),this.payload=o,this.type=Kt}},fe=class extends _.EntitySuccessAction{constructor(o){super(G,w),this.payload=o,this.type=Ke}},Ae=class extends _.EntityLoaderResetAction{constructor(){super(G,w),this.type=qt}},vi=Object.freeze({__proto__:null,LOAD_ORDER_APPROVAL:je,LOAD_ORDER_APPROVALS:Ue,LOAD_ORDER_APPROVALS_FAIL:Gt,LOAD_ORDER_APPROVALS_SUCCESS:ze,LOAD_ORDER_APPROVAL_FAIL:zt,LOAD_ORDER_APPROVAL_SUCCESS:Ne,LoadOrderApproval:q,LoadOrderApprovalFail:de,LoadOrderApprovalSuccess:H,LoadOrderApprovals:ve,LoadOrderApprovalsFail:ue,LoadOrderApprovalsSuccess:me,MAKE_DECISION:Ge,MAKE_DECISION_FAIL:Kt,MAKE_DECISION_RESET:qt,MAKE_DECISION_SUCCESS:Ke,MakeDecision:_e,MakeDecisionFail:ge,MakeDecisionReset:Ae,MakeDecisionSuccess:fe}),Ht=it(he),qe=z(Ht,t=>t[he]),Zt=z(qe,t=>t&&t.entities),Jt=t=>z(Zt,o=>_.entityLoaderStateSelector(o,t)),Wt=t=>z(qe,o=>_.denormalizeSearch(o,t)),ui=Object.freeze({__proto__:null,getOrderApproval:Jt,getOrderApprovalList:Wt,getOrderApprovalManagementState:qe,getOrderApprovalState:Ht,getOrderApprovalsState:Zt}),He=(()=>{class t{constructor(e,r){this.store=e,this.userIdService=r}loadOrderApproval(e){this.userIdService.takeUserId().subscribe(r=>this.store.dispatch(new q({userId:r,orderApprovalCode:e})))}loadOrderApprovals(e){this.userIdService.takeUserId().subscribe(r=>this.store.dispatch(new ve({userId:r,params:e})))}getOrderApproval(e){return this.store.select(Jt(e))}getOrderApprovalList(e){return this.store.select(Wt(e))}get(e){return this.getOrderApproval(e).pipe(Ee(Se),W(r=>{r.loading||r.success||r.error||this.loadOrderApproval(e)}),y(r=>!!(r.success||r.error)),f(r=>r.value))}getOrderApprovalLoading(e){return this.getOrderApproval(e).pipe(f(r=>r.loading??!1))}
1getList(e){return this.getOrderApprovalList(e).pipe(Ee(Se),W(r=>{r.loading||r.success||r.error||this.loadOrderApprovals(e)}),y(r=>!!(r.success||r.error)),f(r=>r.value))}makeDecision(e,r){this.userIdService.takeUserId().subscribe(i=>this.store.dispatch(new _e({userId:i,orderApprovalCode:e,orderApprovalDecision:r})))}getMakeDecisionResultLoading(){return this.store.pipe(re(se.getProcessLoadingFactory(w)))}getMakeDecisionResultError(){return this.store.pipe(re(se.getProcessErrorFactory(w)))}getMakeDecisionResultSuccess(){return this.store.pipe(re(se.getProcessSuccessFactory(w)))}resetMakeDecisionProcessState(){this.store.dispatch(new Ae)}static{this.\u0275fac=function(r){return new(r||t)(g(rt),g(ct))}}static{this.\u0275prov=D({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})(),K=(()=>{class t{constructor(e,r){this.routingService=e,this.orderApprovalService=r,this.approvalCode$=this.routingService.getRouterState().pipe(f(i=>i.state.params.approvalCode)),this.orderApproval$=this.approvalCode$.pipe(y(i=>!!i),W(i=>this.orderApprovalService.loadOrderApproval(i)),I(i=>this.orderApprovalService.get(i)),Je({bufferSize:1,refCount:!0})),this.order$=this.orderApproval$.pipe(f(i=>i?.order))}getOrderApprovalCodeFromRoute(){return this.approvalCode$}getOrderDetails(){return this.order$}getOrderApproval(){return this.orderApproval$}static{this.\u0275fac=function(r){return new(r||t)(g(le),g(He))}}static{this.\u0275prov=D({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})(),jt=(()=>{class t{constructor(e,r,i){this.orderApprovalDetailService=e,this.orderApprovalService=r,this.fb=i,this.approvalDecisionValue=$e,this.approvalFormVisible=!1,this.approvalForm=this.fb.group({comment:[""]}),this.orderApprovalLoading$=this.orderApprovalDetailService.getOrderApprovalCodeFromRoute().pipe(I(u=>this.orderApprovalService.getOrderApprovalLoading(u))),this.decisionResultLoading$=this.orderApprovalService.getMakeDecisionResultLoading(),this.loading$=Ce([this.orderApprovalLoading$,this.decisionResultLoading$]).pipe(f(([u,x])=>u||x)),this.orderApproval$=this.orderApprovalDetailService.getOrderApproval(),this.orderApprovalService.resetMakeDecisionProcessState()}displayDecisionForm(e){this.approvalDecision=e,e===$e.APPROVE?this.approvalForm.controls.comment.clearValidators():this.approvalForm.controls.comment.setValidators([ft.required]),this.approvalFormVisible=!0}cancelDecisionForm(){this.approvalFormVisible=!1,this.approvalForm.reset()}submitDecision(e){this.approvalForm.valid?(this.orderApprovalService.makeDecision(e.code??"",{decision:this.approvalDecision,comment:this.approvalForm.controls.comment.value}),this.approvalFormVisible=!1):this.approvalForm.markAllAsTouched()}ngOnDestroy(){this.orderApprovalService.resetMakeDecisionProcessState()}static{this.\u0275fac=function(r){return new(r||t)(R(K),R(He),R(Et))}}static{this.\u0275cmp=Y({type:t,selectors:[["cx-order-approval-detail-form"]],decls:2,vars:3,consts:[["approvalFormTemplate",""],[4,"ngIf"],[4,"ngIf","ngIfElse"],[1,"cx-spinner"],["class","cx-approval-form-header row",4,"ngIf"],[3,"formGroup","ngSubmit",4,"ngIf"],[1,"cx-approval-form-header","row"],[1,"cx-approval-form-label","col-sm-12"],[3,"ngSubmit","formGroup"],["rows","3","formControlName","comment","maxlength","255",1,"form-control"],["id","commentError",3,"translationParams","control"],[1,"form-group","row"],[1,"col-lg-6","col-md-12"],["type","button",1,"btn","btn-block","btn-secondary",3,"click"],["type","submit",1,"btn","btn-block","btn-primary"],[1,"col-lg-4","col-md-12"],["cxBtnLikeLink","",1,"btn","btn-block","btn-secondary",3,"routerLink"],["class","col-lg-4 col-md-12",4,"ngIf"],[1,"btn","btn-block","btn-primary",3,"click"]],template:function(r,i){r&1&&(h(0,ur,5,4,"ng-container",1),a(1,"async")),r&2&&v("ngIf",p(1,1,i.orderApproval$))},dependencies:[Q,yt,Ct,ht,gt,At,xt,St,Ve,Dt,Ot,bt,It,Fe,X,ce,we],encapsulation:2,changeDetection:0})}}return t})(),$=(()=>{class t{constructor(e,r,i){this.userAccountFacade=e,this.routingService=r,this.globalMessageService=i}canActivate(){return this.userAccountFacade.get().pipe(y(e=>!!e&&Object.keys(e).length>0),f(e=>e?.roles),f(e=>{let r=Array.isArray(e)&&(e.includes(Me.APPROVER)||e.includes(Me.ADMIN));return r||(this.routingService.go({cxRoute:"home"}),this.globalMessageService.add({key:"orderApprovalGlobal.notification.noSufficientPermissions"},ut.MSG_TYPE_WARNING)),r}))}static{this.\u0275fac=function(r){return new(r||t)(g(wt),g(le),g(vt))}}static{this.\u0275prov=D({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})(),Nt=(()=>{class t{constructor(e){this.orderDetailsService=e,this.order$=this.orderDetailsService.getOrderDetails()}static{this.\u0275fac=function(r){return new(r||t)(R(T))}}static{this.\u0275cmp=Y({type:t,selectors:[["cx-order-detail-permission-results"]],decls:2,vars:3,consts:[[4,"ngIf"],[1,"cx-approval-header"],[1,"cx-approval-label"],[1,"table","table-striped","cx-approval-table"],[1,"cx-approval-thead-mobile"],["scope","col"],[4,"ngFor","ngForOf"],[1,"cx-approval-permissionCode"],[1,"cx-approval-table-label"],[1,"cx-approval-approverName"],[1,"cx-approval-statusDisplay"],[1,"cx-approval-approvalNotes"]],template:function(r,i){r&1&&(h(0,gr,2,1,"ng-container",0),a(1,"async")),r&2&&v("ngIf",p(1,1,i.order$))},dependencies:[Q,be,X,ce],encapsulation:2,changeDetection:0})}}return t})(),Or=(()=>{class t{static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275mod=b({type:t})}static{this.\u0275inj=L({imports:[Ve,ee,Be,ke,Ft,Rt,te,Lt,Pe.withConfig({cmsComponents:{OrderApprovalDetailTotalsComponent:{component:$t,providers:[{provide:T,useExisting:K}],guards:[P,$]},OrderApprovalDetailApprovalDetailsComponent:{component:Nt,providers:[{provide:T,useExisting:K}],guards:[P,$]},AccountOrderDetailsApprovalDetailsComponent:{component:Nt},OrderApprovalDetailShippingComponent:{component:Bt,providers:[{provide:T,useExisting:K}],guards:[P,$]},OrderApprovalDetailItemsComponent:{component:Vt,providers:[{provide:T,useExisting:K}],guards:[P,$]},OrderApprovalDetailFormComponent:{component:jt,guards:[P,$]}}}),Te,jt]})}}return t})(),Ut=(()=>{class t{constructor(e,r,i){this.routing=e,this.orderApprovalService=r,this.translation=i,this.PAGE_SIZE=5}ngOnInit(){this.fetchApprovalListPage({}),this.sortLabels$=Ce([this.translation.translate("sorting.date"),this.translation.translate("sorting.orderNumber")]).pipe(f(([e,r])=>({byDate:e,byOrderNumber:r})))}changeSortCode(e){let r={sort:e,currentPage:0};this.sortType=e,this.fetchApprovalListPage(r)}pageChange(e){let r={sort:this.sortType,currentPage:e};this.fetchApprovalListPage(r)}fetchApprovalListPage(e){e.pageSize=this.PAGE_SIZE,this.orderApprovalService.loadOrderApprovals(e),this.orderApprovals$=this.orderApprovalService.getList(e)}goToApprovalDetails(e,r){e?.target?.nodeName.toLowerCase()!=="a"&&this.routing.go({cxRoute:"orderApprovalDetails",params:{approvalCode:r.code}})}static{this.\u0275fac=function(r){return new(r||t)(R(le),R(He),R(mt))}}static{this.\u0275cmp=Y({type:t,selectors:[["cx-order-approval-list"]],decls:2,vars:3,consts:[["noOrder",""],[4,"ngIf"],[4,"ngIf","ngIfElse"],[1,"cx-order-approval-sort","top","row"],[1,"cx-order-approval-form-group","form-group","col-sm-12","col-md-4","col-lg-4"],[1,"cx-order-approval-form-group-label"],["ariaControl
1s","order-approval-table",3,"sortListEvent","sortOptions","sortLabels","selectedOption","ariaLabel"],[1,"cx-order-approval-pagination"],["paginationID","pagination-top",3,"viewPageEvent","pagination"],["role","table","id","order-approval-table",1,"table","cx-order-approval-table"],[1,"cx-visually-hidden"],[1,"cx-order-approval-thead-mobile"],["scope","col"],["role","row",3,"click",4,"ngFor","ngForOf"],[1,"cx-order-approval-sort","bottom","row"],["paginationID","pagination-bottom",3,"viewPageEvent","pagination"],["role","row",3,"click"],["role","cell",1,"cx-order-approval-code"],[1,"d-md-none","cx-order-approval-label"],[1,"cx-order-approval-value",3,"routerLink"],["role","cell",1,"cx-order-approval-po-code"],["role","cell",1,"cx-order-approval-placed"],["role","cell",1,"cx-order-approval-date"],["role","cell",1,"cx-order-approval-status"],["role","cell",1,"cx-order-approval-total"],[1,"cx-order-approval-no-order","row"],[1,"col-sm-12","col-md-6","col-lg-4"]],template:function(r,i){r&1&&(h(0,hr,4,2,"ng-container",1),a(1,"async")),r&2&&v("ngIf",p(1,1,i.orderApprovals$))},dependencies:[Q,Mt,Pt,be,Fe,X,we,ce,_t],encapsulation:2,changeDetection:0})}}return t})(),Dr=(()=>{class t{static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275mod=b({type:t})}static{this.\u0275inj=L({imports:[ee,Pe.withConfig({cmsComponents:{OrderApprovalListComponent:{component:Ut,guards:[P,$]}}}),ke,te,Tt,Be,Te,Ut]})}}return t})(),Sr=(()=>{class t{static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275mod=b({type:t})}static{this.\u0275inj=L({imports:[te,Dr,Or]})}}return t})(),xe=class{},Yt=(()=>{class t{constructor(e){this.adapter=e}get(e,r){return this.adapter.load(e,r)}getList(e,r){return this.adapter.loadList(e,r)}makeDecision(e,r,i){return this.adapter.makeDecision(e,r,i)}static{this.\u0275fac=function(r){return new(r||t)(g(xe))}}static{this.\u0275prov=D({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})(),Ze=new U("OrderApprovalNormalizer"),Qt=new U("OrderApprovalsListNormalizer"),Xt=new U("OrderApprovalDecisionNormalizer"),Er=(()=>{class t{constructor(e,r,i){this.http=e,this.occEndpoints=r,this.converter=i}load(e,r){return this.http.get(this.getOrderApprovalEndpoint(e,r)).pipe(this.converter.pipeable(Ze))}loadList(e,r){return this.http.get(this.getOrderApprovalsEndpoint(e,r)).pipe(this.converter.pipeable(Qt))}makeDecision(e,r,i){return this.http.post(this.getOrderApprovalDecisionEndpoint(e,r),i).pipe(this.converter.pipeable(Xt))}getOrderApprovalEndpoint(e,r){return this.occEndpoints.buildUrl("orderApproval",{urlParams:{userId:e,orderApprovalCode:r}})}getOrderApprovalsEndpoint(e,r){return this.occEndpoints.buildUrl("orderApprovals",{urlParams:{userId:e},queryParams:r})}getOrderApprovalDecisionEndpoint(e,r){return this.occEndpoints.buildUrl("orderApprovalDecision",{urlParams:{userId:e,orderApprovalCode:r}})}static{this.\u0275fac=function(r){return new(r||t)(g(et),g(st),g(ae))}}static{this.\u0275prov=D({token:t,factory:t.\u0275fac})}}return t})(),Cr=(()=>{class t{constructor(){}convert(e,r){return r===void 0&&(r=N({},e)),r}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275prov=D({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})(),yr=(()=>{class t{constructor(e){this.converter=e}convert(e,r){return r===void 0&&(r=N({},e)),r.values=e.orderApprovals?.map(i=>N({},this.converter.convert(i,Ze)))??[],r}static{this.\u0275fac=function(r){return new(r||t)(g(ae))}}static{this.\u0275prov=D({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})(),Ir=(()=>{class t{constructor(e){this.converter=e}convert(e,r){return r===void 0&&(r=N({},e)),e.order&&(r.order=this.converter.convert(e.order,kt)),r}static{this.\u0275fac=function(r){return new(r||t)(g(ae))}}static{this.\u0275prov=D({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})(),Lr={backend:{occ:{endpoints:{orderApprovals:"/users/${userId}/orderapprovals",orderApproval:"/users/${userId}/orderapprovals/${orderApprovalCode}?fields=FULL",orderApprovalDecision:"/users/${userId}/orderapprovals/${orderApprovalCode}/decision"}}}},Rr=(()=>{class t{static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275mod=b({type:t})}static{this.\u0275inj=L({providers:[pt(Lr),{provide:xe,useClass:Er},{provide:Ze,useExisting:Ir,multi:!0},{provide:Qt,useExisting:yr,multi:!0},{provide:Xt,useExisting:Cr,multi:!0}],imports:[ee]})}}return t})(),br=(()=>{class t{constructor(e,r){this.actions$=e,this.orderApprovalConnector=r,this.logger=We(lt),this.loadOrderApproval$=ie(()=>this.actions$.pipe(ne(je),f(i=>i.payload),y(i=>i.userId!==oe),I(({userId:i,orderApprovalCode:u})=>this.orderApprovalConnector.get(i,u).pipe(f(x=>new H([x])),J(x=>Z(new de({orderApprovalCode:u,error:pe(x,this.logger)}))))))),this.loadOrderApprovals$=ie(()=>this.actions$.pipe(ne(Ue),f(i=>i.payload),y(i=>i.userId!==oe),I(({userId:i,params:u})=>this.orderApprovalConnector.getList(i,u).pipe(I(x=>{let{values:j,page:tr}
1=_.normalizeListPage(x,"code");return[new H(j),new me({page:tr,params:u})]}),J(x=>Z(new ue({params:u,error:pe(x,this.logger)}))))))),this.makeDecision$=ie(()=>this.actions$.pipe(ne(Ge),f(i=>i.payload),y(i=>i.userId!==oe),I(({userId:i,orderApprovalCode:u,orderApprovalDecision:x})=>this.orderApprovalConnector.makeDecision(i,u,x).pipe(I(j=>[new fe({orderApprovalCode:u,orderApprovalDecision:j}),new q({userId:i,orderApprovalCode:u})]),J(j=>Z(new ge({orderApprovalCode:u,error:pe(j,this.logger)})))))))}static{this.\u0275fac=function(r){return new(r||t)(g(ot),g(Yt))}}static{this.\u0275prov=D({token:t,factory:t.\u0275fac})}}return t})(),Fr=[br],Mr=void 0,Pr=void 0;function Tr(t=Mr,o){switch(o.type){case Ne:return o.payload;case Ke:return t}return t}function wr(t=Pr,o){return o.type===ze?o.payload.page:t}function kr(){return{[he]:tt({entities:_.entityLoaderReducer(Oe,Tr),list:_.entityLoaderReducer(De,wr)})}}var er=new U("OrganizationReducers"),Br={provide:er,useFactory:kr};function Vr(t){return function(o,e){return e.type===dt.LOGOUT&&(o=void 0),t(o,e)}}var $r=[Vr],jr=(()=>{class t{static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275mod=b({type:t})}static{this.\u0275inj=L({providers:[Br],imports:[nt.forFeature(he,er,{metaReducers:$r}),at.forFeature(Fr)]})}}return t})(),Nr=(()=>{class t{static forRoot(){return{ngModule:t,providers:[Yt]}}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275mod=b({type:t})}static{this.\u0275inj=L({imports:[jr]})}}return t})(),mi=(()=>{class t{static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275mod=b({type:t})}static{this.\u0275inj=L({imports:[Nr.forRoot(),Rr,Sr]})}}return t})();export{$ as ApproverGuard,Qt as ORDER_APPROVALS_NORMALIZER,Xt as ORDER_APPROVAL_DECISION_NORMALIZER,Oe as ORDER_APPROVAL_ENTITIES,he as ORDER_APPROVAL_FEATURE,De as ORDER_APPROVAL_LIST,w as ORDER_APPROVAL_MAKE_DECISION_PROCESS_ID,Ze as ORDER_APPROVAL_NORMALIZER,Er as OccOrderApprovalAdapter,Cr as OccOrderApprovalDecisionNormalizer,yr as OccOrderApprovalListNormalizer,Ir as OccOrderApprovalNormalizer,vi as OrderApprovalActions,xe as OrderApprovalAdapter,Sr as OrderApprovalComponentsModule,Yt as OrderApprovalConnector,$e as OrderApprovalDecisionValue,jt as OrderApprovalDetailFormComponent,K as OrderApprovalDetailService,Or as OrderApprovalDetailsModule,Ut as OrderApprovalListComponent,Dr as OrderApprovalListModule,mi as OrderApprovalModule,Rr as OrderApprovalOccModule,ui as OrderApprovalSelectors,He as OrderApprovalService,Nt as OrderDetailPermissionResultsComponent};
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.