import{a as ue}from"./chunk-B2ROGAVN.js";import{a as ve,b as he}from"./chunk-N6RWAWPF.js";import{a as _e}from"./chunk-JHZ7AODT.js";import{d as D}from"./chunk-SQMVZU4I.js";import{b as me}from"./chunk-UIGFCYGO.js";import{g as le}from"./chunk-4ENQACUL.js";import{a as pe}from"./chunk-LTUVDLS3.js";import{H as P,J as $}from"./chunk-CWWVHRJU.js";import{c as k}from"./chunk-TFQ3RBKD.js";import{a as se}from"./chunk-7JA7UHZ2.js";import{a as B}from"./chunk-RU43IR5J.js";import{a as de}from"./chunk-LY6HB4BL.js";import{a as N}from"./chunk-HBJ2IG4O.js";import{T as A,m as ce}from"./chunk-FBI7JGZC.js";import{a as ae}from"./chunk-ILYMG6ZI.js";import{f as U,r as oe,x as E}from"./chunk-MXUIPT66.js";import{$b as H,Aa as y,Ab as a,Ba as I,Bb as f,Cb as b,Db as S,E as W,Fb as O,Kb as T,Kd as ne,Lb as d,M as Q,Q as V,Sb as G,Tb as K,Ua as n,Ub as Y,Va as C,Wc as ee,Xb as z,Xc as te,Yb as m,Zb as J,_b as _,a as M,bd as ie,d as x,ib as v,ic as X,jc as F,kc as Z,ob as o,rc as c,sc as p,t as L,ta as q,tc as R,yh as re,zb as s}from"./chunk-N6B2OJOY.js";var Ce=function(t,i,e,r){var l=arguments.length,u=l<3?i:r===null?r=Object.getOwnPropertyDescriptor(i,e):r,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(t,i,e,r);else for(var w=t.length-1;w>=0;w--)(h=t[w])&&(u=(l<3?h(u):l>3?h(i,e,u):h(i,e))||u);return l>3&&u&&Object.defineProperty(i,e,u),u},ge=function(t,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,i)},xe=["placeOrderComponent"],be=(t,i)=>({isLoading:t,areFeesLoading:i}),Se=()=>["/","checkout","shipping-address"],j=t=>({count:t});function we(t,i){if(t&1&&(b(0),m(1),c(2,"cxTranslate"),s(3,"span",26),m(4),c(5,"cxTranslate"),a(),S()),t&2){let e=d(3).ngIf;n(),_("",p(2,2,"checkoutReview.addressNoConstCenter")," "),n(3),_("(",R(5,4,"checkoutReview.products.item",F(7,j,e.length)),")")}}function ye(t,i){if(t&1&&(b(0),m(1),c(2,"cxTranslate"),s(3,"span",26),m(4),c(5,"cxTranslate"),a(),S()),t&2){let e=d(2).ngIf,r=d().ngIf;n(),_(" ",p(2,2,"checkoutReview.addressesAllProducts")," "),n(3),_("(",R(5,4,"checkoutReview.products.item",F(7,j,r.length+e.length)),")")}}function Ie(t,i){if(t&1&&(s(0,"div",12),v(1,we,6,9,"ng-container",1)(2,ye,6,9,"ng-container",1),a()),t&2){let e=d().ngIf,r=d().ngIf;n(),o("ngIf",e.length>0),n(),o("ngIf",r.length>0&&e.length===0)}}function Oe(t,i){if(t&1&&(s(0,"div",20),m(1),c(2,"cxTranslate"),a()),t&2){let e=d(5);n(),H(" ",p(2,2,"checkoutAddress.customerNumber"),": ",e.customerId," ")}}function Te(t,i){if(t&1&&(f(0,"foerch-address",21),c(1,"async")),t&2){let e=d(5);o("address",p(1,2,e.deliveryAddress$))("showAddressName",!1)}}function Fe(t,i){if(t&1&&(s(0,"div",28),m(1),c(2,"cxTranslate"),s(3,"span",29),m(4),a(),s(5,"span",30),m(6),c(7,"cxTranslate"),a(),s(8,"div",31),m(9),a()()),t&2){let e=i.$implicit;n(),_(" ",p(2,4,"checkoutShipping.costCenter")," "),n(3),J(e.name),n(2),_(" (",R(7,6,"checkoutReview.products.item",F(9,j,e.products.length)),") "),n(3),_(" ",e==null?null:e.deliveryAddress.formattedAddress," ")}}function Re(t,i){if(t&1&&(b(0),s(1,"div",12),m(2),c(3,"cxTranslate"),a(),v(4,Fe,10,11,"div",27),S()),t&2){let e=d().ngIf,r=d(4);n(2),_(" ",p(3,3,"checkoutShipping.costCenterTitle")," "),n(2),o("ngForOf",e)("ngForTrackBy",r.trackByIndex)}}function Ee(t,i){if(t&1&&(b(0),v(1,Ie,3,2,"div",23)(2,Oe,3,4,"div",24)(3,Te,2,4,"foerch-address",25)(4,Re,5,5,"ng-container",1),S()),t&2){let e=i.ngIf,r=d().ngIf;n(),o("ngIf",r.length>0),n(),o("ngIf",r.length>0),n(),o("ngIf",r.length>0),n(),o("ngIf",e.length>0)}}function ke(t,i){if(t&1&&(b(0),v(1,Ee,5,4,"ng-container",1),c(2,"async"),S()),t&2){let e=d(3);n(),o("ngIf",p(2,1,e.entries$))}}function Ae(t,i){if(t&1&&(s(0,"div",16)(1,"div",2)(2,"div",17)(3,"div",18),v(4,ke,3,3,"ng-container",1),c(5,"async"),a(),s(6,"div",19)(7,"div",12),m(8),c(9,"cxTranslate"),a(),s(10,"div",20),m(11),c(12,"cxTranslate"),a(),f(13,"foerch-address",21),c(14,"async"),a(),s(15,"div",22)(16,"div",12),m(17),c(18,"cxTranslate"),a(),m(19),c(20,"cxTranslate"),a()()()()),t&2){let e=d(2);n(4),o("ngIf",p(5,8,e.entriesNoCostCenter$)),n(4),_(" ",p(9,10,"checkoutReview.companyAddress")," "),n(3),H(" ",p(12,12,"checkoutAddress.customerNumber"),": ",e.customerId," "),n(2),o("address",p(14,14,e.customerAddress$))("showAddressName",!1),n(4),_(" ",p(18,16,"checkoutReview.paymentTitle")," "),n(2),_(" ",p(20,18,"checkoutReview.paymentInvoice")," ")}}function Be(t,i){if(t&1&&f(0,"foerch-cart-body",32),t&2){let e=d(2);o("cartConfig",e.cartConfig)("items",e.cartEntries)("selectionHelper",e.selectionHelper)}}function Ne(t,i){if(t&1&&f(0,"foerch-cart-mobile-body",32),t&2){let e=d(2);o("cartConfig",e.cartConfig)("items",e.cartEntries)("selectionHelper",e.selectionHelper)}}function Pe(t,i){if(t&1){let e=O();s(0,"button",41),T("click",function(){y(e);let l=d(3);return I(l.placeOrder())}),m(1),c(2,"cxTranslate"),a()}if(t&2){d();let e=z(5);o("disabled",e.tAndCToggler&&e.submitted),n(),_(" ",p(2,2,"checkoutReview.placeOrder")," ")}}function $e(t,i){if(t&1){let e=O();s(0,"button",42),T("click",function(){y(e);let l=d(3);return I(l.placeOrderAndTransfer())}),m(1),c(2,"cxTranslate"),a()}if(t&2){let e=d(3);o("disabled",!e.allowedToOrderIDS),n(),_(" ",p(2,2,"checkoutReview.placeOrderAndTransfer")," ")}}function De(t,i){if(t&1&&(s(0,"div",33)(1,"div",2)(2,"div",17)(3,"div",34),f(4,"foerch-place-order",35,0),a(),s(6,"div",36)(7,"div",37),f(8,"foerch-checkout-order-summary"),s(9,"div",38),v(10,Pe,3,4,"button",39)(11,$e,3,4,"button",40),a()()()()()()),t&2){let e=d(2);n(4),o("isInternalOrderNumberRequired",e.isEProcurementCart&&e.allowedToOrderIDS)("purchaseOrderNumber",e.purchaseOrderNumber),n(6),o("ngIf",!e.isEProcurementCart),n(),o("ngIf",e.isEProcurementCart)}}function Le(t,i){if(t&1){let e=O();b(0),s(1,"div",2)(2,"div",3)(3,"div",4)(4,"div",5)(5,"button",6),f(6,"cx-icon",7),m(7),c(8,"cxTranslate"),a()(),s(9,"div",8)(10,"div",9),m(11),c(12,"cxTranslate"),a()()()()(),v(13,Ae,21,20,"div",10),s(14,"div",11)(15,"div",2)(16,"div",12),m(17),c(18,"cxTranslate"),a(),v(19,Be,1,3,"foerch-cart-body",13),a(),v(20,Ne,1,3,"foerch-cart-mobile-body",13),s(21,"div",2)(22,"button",14),T("click",function(){y(e);let l=d();return I(l.backToCart())}),f(23,"cx-icon",7),m(24),c(25,"cxTranslate"),a()()(),v(26,De,12,4,"div",15),S()}if(t&2){let e=i.ngIf,r=d();n(5),o("disabled",e.areFeesLoading)("routerLink",X(21,Se)),n(),o("type",r.icons.ARROW_LEFT),n(),_(" ",p(8,13,"checkoutReview.editAddress")," "),n(4),_(" ",p(12,15,"checkoutReview.pageTitle")," "),n(2),o("ngIf",!e.isLoading),n(4),_(" ",p(18,17,"checkoutReview.cartTitle")," "),n(2),o("ngIf",r.isDesktop),n(),o("ngIf",!r.isDesktop),n(2),o("disabled",e.areFeesLoading),n(),o("type",r.icons.ARROW_LEFT),n(),_(" ",p(25,19,"checkoutReview.editCart")," "),n(2),o("ngIf",r.allowedToOrder)}}var g,fe=(g=class{constructor(i,e,r,l,u,h,w){this.activeCartService=i,this._breakpointService=e,this._userService=r,this._userAccountService=l,this._eProcurementService=u,this._permissionService=h,this._routingService=w,this.cartConfig={cartMode:ce.CART,isEditable:!1,isSelectable:!1,isToggleable:!0,showAddToCart:!1,showCCM:!1,showPrice:!0,showRememberedAt:!1,showVPE:!0,showPromotions:!1},this.allowedToOrder=!1,this.allowedToOrderIDS=!1,this.isEProcurementCart=!1,this.icons=ae,this.isDesktop=!0,this.selectionHelper=new pe,this.cartEntries=[],this.purchaseOrderNumber="",this.deliveryAddress$=new x(null),this.customerAddress$=new x(null),this.isLoading$=new x(!0),this.entries$=new x([]),this.entriesNoCostCenter$=new x([]),this.areFeesLoading$=new x(!0),this._subs$=new M}ngOnInit(){this._subs$.add(this._userAccountService.get().pipe(W(i=>!!i)).subscribe(i=>{(i?.unit?.displayUid||i?.unit?.uid)&&(this.customerId=i?.unit?.displayUid||i?.unit?.uid)})),this._subs$.add(this.activeCartService.areFeesLoading().pipe(Q(500)).subscribe(this.areFeesLoading$)),this._subs$.add(L([this.activeCartService.getEntries(),this.activeCartService.getDeliveryAddressesForCurrentCart(),this._userService.getB2BUnitContactAddress(),this.activeCartService.getCartDeliveryAddress(),this.activeCartService.getFixedCostCenterAddresses(),this._breakpointService.breakpoint$]).pipe(V()).subscribe(([i,e,r,l,u,h])=>{i.length&&e.length&&(this.cartEntries=i,this.deliveryAddress$.next(l),this.customerAddress$.next(r),this.entries$.next(he(u)),this.entriesNoCostCenter$.next(ve(u)),this.isDesktop=h===U.lg||h===U.xl,this.isLoading$.next(!1))})),this._subs$.add(L([this._permissionService.getPermissionValueAsBoolean(A.COST_CENTER_MANAGEMENT_TOOL),this._permissionService.getPermissionValueAsBoolean(A.ACTIVATE_WEBSHOP_ORDER_FUNCTION),this._permissionService.getPermissionValueAsBoolean(A.EPROCUREMENT_IDS_WITH_ORDER),this._eProcurementService.isEProcurementCart(),this.activeCartService.getActive()]).pipe(V()).subscribe(([i,e,r,l,u])=>{this.cartConfig.showCCM=i,this.isEProcurementCart=l,this.allowedToOrder=e&&(!l||r),this.allowedToOrderIDS=l&&e&&r,this.isEProcurementCart&&this.allowedToOrderIDS&&u&&u.purchaseOrderNumber&&(this.purchaseOrderNumber=u.purchaseOrderNumber)}))}ngOnDestroy(){}trackByIndex(i){return i}placeOrder(){this.placeOrderComponent.placeOrder()}placeOrderAndTransfer(){this.placeOrderComponent.placeOrder(!0)}backToCart(){this.activeCartService.loadCart(),this._routingService.go("cart")}},g.\u0275fac=function(e){return new(e||g)(C($),C(E),C(D),C(k),C(P),C(B),C(N))},g.\u0275cmp=q({type:g,selectors:[["foerch-review-order"]],viewQuery:function(e,r){if(e&1&&G(xe,5),e&2){let l;K(l=Y())&&(r.placeOrderComponent=l.first)}},decls:3,vars:8,consts:[["placeOrderComponent",""],[4,"ngIf"],[1,"container"],[1,"multiStepCheckoutHead"],[1,"row","align-items-center"],[1,"col-12","col-md-4"],["type","button",1,"btn","btn-tertiary","btn-back",3,"disabled","routerLink"],[3,"type"],[1,"col-12","col-md-8","col-lg-4"],[1,"h2","multiStepCheckoutHead-title","text-lg-center"],["class","reviewSubmit",4,"ngIf"],[1,"reviewSubmitCart"],[1,"multiStepCheckout-subheadline"],[3,"cartConfig","items","selectionHelper",4,"ngIf"],[1,"btn","btn-secondary","btn-icon_left","mt-2","mb-4",3,"click","disabled"],["class","reviewSubmitFooter",4,"ngIf"],[1,"reviewSubmit"],[1,"row"],[1,"col-12","col-md-4","reviewSubmit-deliveryAddresses"],[1,"col-12","col-md-4","reviewSubmit-company"],[1,"multiStepCheckout-customerId"],[3,"address","showAddressName"],[1,"col-12","col-md-4","reviewSubmit-payment"],["class","multiStepCheckout-subheadline",4,"ngIf"],["class","multiStepCheckout-customerId",4,"ngIf"],[3,"address","showAddressName",4,"ngIf"],[1,"text-nowrap"],["class","reviewSubmitCostCenter",4,"ngFor","ngForOf","ngForTrackBy"],[1,"reviewSubmitCostCenter"],[1,"reviewSubmitCostCenter-name"],[1,"reviewSubmitCostCenter-count"],[1,"reviewSubmitCostCenter-address"],[3,"cartConfig","items","selectionHelper"],[1,"reviewSubmitFooter"],[1,"col-12","col-md-8"],[3,"isInternalOrderNumberRequired","purchaseOrderNumber"],[1,"col-12","col-md-4","reviewSubmitFooter-summaryWrapper"],[1,"reviewSubmitFooter-summary"],[1,"text-end","mt-2"],["class","btn btn-commerce",3,"disabled","click",4,"ngIf"],["class","btn btn-primary",3,"disabled","click",4,"ngIf"],[1,"btn","btn-commerce",3,"click","disabled"],[1,"btn","btn-primary",3,"click","disabled"]],template:function(e,r){e&1&&(v(0,Le,27,22,"ng-container",1),c(1,"async"),c(2,"async")),e&2&&o("ngIf",Z(5,be,p(1,1,r.isLoading$),p(2,3,r.areFeesLoading$)))},dependencies:[ee,te,oe,ne,le,me,se,_e,ue,ie,re],encapsulation:2,changeDetection:0}),g);fe=Ce([de(),ge("design:paramtypes",[$,E,D,k,P,B,N])],fe);export{fe as a};