import{b as T}from"./chunk-D7EKNLEJ.js";import{a as Z,b as I}from"./chunk-I2S6XGNZ.js";import{H as x}from"./chunk-CWWVHRJU.js";import{b as G,d as O}from"./chunk-ZSVIZXE3.js";import{a as Q,b as X}from"./chunk-ISDPQX42.js";import{a as J}from"./chunk-LY6HB4BL.js";import{a as S}from"./chunk-HBJ2IG4O.js";import{c as $,f as K,l as Y,y as z}from"./chunk-DX7LHTFF.js";import{Ab as a,Bb as M,Cb as B,Db as j,Dc as C,E as A,Kb as y,Kd as U,Lb as L,Ob as D,Ua as o,Va as h,Vc as H,Xc as W,Yb as p,_b as u,a as P,bd as q,cc as k,dc as R,ec as F,ib as _,jc as b,ob as s,rc as c,s as N,sc as d,ta as w,tc as E,yh as V,zb as l}from"./chunk-N6B2OJOY.js";var re=function(i,e,r,t){var m=arguments.length,n=m<3?e:t===null?t=Object.getOwnPropertyDescriptor(e,r):t,f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(i,e,r,t);else for(var v=i.length-1;v>=0;v--)(f=i[v])&&(n=(m<3?f(n):m>3?f(e,r,n):f(e,r))||n);return m>3&&n&&Object.defineProperty(e,r,n),n},ne=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},te=i=>({max:i}),oe=i=>({"ng-invalid ng-touched":i});function ae(i,e){if(i&1&&(M(0,"foerch-help-text",16),c(1,"cxTranslate")),i&2){let r=L();s("dynamicHelpText",E(1,1,"checkoutReview.orderCommentLengthHelpText",b(4,te,r.maxOrderCommentLength)))}}function ce(i,e){i&1&&(l(0,"div",17),p(1),c(2,"cxTranslate"),a()),i&2&&(o(),u(" ",d(2,1,"checkoutReview.agbError")," "))}function le(i,e){if(i&1&&(l(0,"div",19),p(1),a()),i&2){let r=L().ngIf;o(),u(" ",r," ")}}function de(i,e){if(i&1&&(B(0),_(1,le,2,1,"div",18),j()),i&2){let r=e.ngIf;o(),s("ngIf",(r==null?null:r.length)>0)}}var g,ee=(g=class{set purchaseOrderNumber(e){this.internalOrderNumber===""&&(this.internalOrderNumber=e)}get isInvalidInternalOrderNumber(){return this.isInternalOrderNumberRequired?this.submitted&&this.internalOrderNumber.trim().length===0:!1}constructor(e,r,t,m,n,f,v){this._isCordova=e,this._checkoutService=r,this._routingService=t,this._eProcurementService=m,this._cf=n,this._baseSiteService=f,this._contentLinkService=v,this.isInternalOrderNumberRequired=!1,this.termsAndConditionsUrl$=this._contentLinkService.getContentLinkForBaseSite(Z.TERMS_AND_CONDITIONS).pipe(N(ie=>[ie.url])),this.tAndCToggler=!1,this.submitted=!1,this.comment="",this.internalOrderNumber="",this.termsAndConditionLinkTarget=this._isCordova?"_self":"_blank",this.standardStringLength="255",this.maxPurchaseOrderNumberLength=this.standardStringLength,this.maxOrderCommentLength=this.standardStringLength,this._sub$=new P}ngOnInit(){this._sub$.add(this._checkoutService.getOrderDetails().pipe(A(e=>!!e&&Object.keys(e).length!==0)).subscribe(()=>{this.onSuccess()})),this._sub$.add(this._baseSiteService.getActiveBaseSite().pipe(N(e=>e?.stores??[])).subscribe(e=>{Array.isArray(e)&&e.length>0&&(this.maxOrderCommentLength=e[0].orderCommentLength,this.maxPurchaseOrderNumberLength=e[0].purchaseOrderNumberLength,this._cf.detectChanges())}))}ngOnDestroy(){}onToggleTAndC(){this.tAndCToggler=!this.tAndCToggler,this.submitted=!1,this._cf.detectChanges()}onChangeInternalOrderNumber(){this._cf.detectChanges()}placeOrder(e=!1){this.submitted=!0,this.tAndCToggler&&!this.isInvalidInternalOrderNumber&&(e?this._eProcurementService.placeOrder(this.comment,this.internalOrderNumber):this._sub$.add(this._checkoutService.placeOrder(this.comment,this.internalOrderNumber).subscribe({next:()=>this.onSuccess()}))),this._cf.detectChanges()}onSuccess(){this._routingService.go({cxRoute:"orderConfirmation"})}},g.\u0275fac=function(r){return new(r||g)(h(G),h(T),h(S),h(x),h(C),h(O),h(I))},g.\u0275cmp=w({type:g,selectors:[["foerch-place-order"]],inputs:{isInternalOrderNumberRequired:"isInternalOrderNumberRequired",purchaseOrderNumber:"purchaseOrderNumber"},decls:33,vars:45,consts:[[1,"row"],[1,"col-12","col-md-6","reviewSubmitFooter-notes"],[1,"multiStepCheckout-subheadline"],["inputId","orderNr","type","text",3,"ngModelChange","dynamicHelpText","errorMsg","invalid","labelAndPlaceholder","maxLength","ngModel"],[1,"form-group","mb-0"],[1,"form-floating"],["cols","25","id","note",1,"form-control",3,"ngModelChange","maxlength","placeholder","ngModel"],["for","note",1,"form-label"],[3,"dynamicHelpText",4,"ngIf"],[1,"col-12","col-md-6","reviewSubmitFooter-agb"],[1,"form-check","form-checkbox"],["id","toggleTAndC","type","checkbox","role","checkbox",1,"form-check-input",3,"change","ngClass"],["for","toggleTAndC",1,"form-check-label","pt-0"],["class","form-helptext form-helptext_danger",4,"ngIf"],[1,"d-block",3,"target","routerLink"],[4,"ngIf"],[3,"dynamicHelpText"],[1,"form-helptext","form-helptext_danger"],["class","mt-2",4,"ngIf"],[1,"mt-2"]],template:function(r,t){r&1&&(l(0,"div",0)(1,"div",1)(2,"div",2),p(3),c(4,"cxTranslate"),a(),l(5,"foerch-input",3),c(6,"cxTranslate"),c(7,"cxTranslate"),F("ngModelChange",function(n){return R(t.internalOrderNumber,n)||(t.internalOrderNumber=n),n}),y("ngModelChange",function(){return t.onChangeInternalOrderNumber()}),a(),l(8,"div",4)(9,"div",5)(10,"textarea",6),c(11,"cxTranslate"),F("ngModelChange",function(n){return R(t.comment,n)||(t.comment=n),n}),p(12,"        "),a(),l(13,"label",7),p(14),c(15,"cxTranslate"),a()(),_(16,ae,2,6,"foerch-help-text",8),a()(),l(17,"div",9)(18,"div",2),p(19),c(20,"cxTranslate"),a(),l(21,"div",10)(22,"input",11),y("change",function(){return t.onToggleTAndC()}),a(),l(23,"label",12),p(24),c(25,"cxTranslate"),a(),_(26,ce,3,3,"div",13),a(),l(27,"a",14),c(28,"async"),p(29),c(30,"cxTranslate"),a(),_(31,de,2,1,"ng-container",15),c(32,"cxTranslate"),a()()),r&2&&(o(3),u(" ",d(4,20,"checkoutReview.notesTitle")," "),o(2),s("dynamicHelpText",t.maxPurchaseOrderNumberLength<t.standardStringLength?E(6,22,"checkoutReview.internalOrderNumberHelpText",b(41,te,t.maxPurchaseOrderNumberLength)):"")("errorMsg",t.isInvalidInternalOrderNumber?"checkoutReview.internalOrderNumberError":"")("invalid",t.isInvalidInternalOrderNumber)("labelAndPlaceholder",d(7,25,"checkoutReview.placeholderOrderNr")+(t.isInternalOrderNumberRequired?"*":""))("maxLength",t.maxPurchaseOrderNumberLength),k("ngModel",t.internalOrderNumber),o(5),s("maxlength",t.maxOrderCommentLength)("placeholder",d(11,27,"checkoutReview.placeholderMessage")),k("ngModel",t.comment),o(4),u(" ",d(15,29,"checkoutReview.placeholderMessage")," "),o(2),s("ngIf",t.maxOrderCommentLength<t.standardStringLength),o(3),u(" ",d(20,31,"checkoutReview.agbTitle")," "),o(3),s("ngClass",b(43,oe,t.submitted&&!t.tAndCToggler)),o(2),u(" ",d(25,33,"checkoutReview.confirmThatRead")," "),o(2),s("ngIf",t.submitted&&!t.tAndCToggler),o(),D("target",t.termsAndConditionLinkTarget),s("routerLink",d(28,35,t.termsAndConditionsUrl$)),o(2),u(" ",d(30,37,"checkoutReview.termsAndConditions")," "),o(2),s("ngIf",d(32,39,"checkoutReview.specialManufacturerNumber")))},dependencies:[H,W,$,K,z,Y,U,X,Q,q,V],encapsulation:2,changeDetection:0}),g);ee=re([J(),ne("design:paramtypes",[Boolean,T,S,x,C,O,I])],ee);export{ee as a};