import{a as Y,b as ne}from"./chunk-SSXIUBOK.js";import{b as te}from"./chunk-5RG27LZ2.js";import{a as Z}from"./chunk-WSZCTDHN.js";import{a as ee}from"./chunk-UB23RF7S.js";import{J as X}from"./chunk-CWWVHRJU.js";import{a as K}from"./chunk-6IGMG2LM.js";import{a as z}from"./chunk-RU43IR5J.js";import{a as J}from"./chunk-Y7IP5WLG.js";import{a as G}from"./chunk-SLGBXDUF.js";import{a as $}from"./chunk-SU6CJJJO.js";import{r as Q}from"./chunk-MXUIPT66.js";import{I as q,f as N,l as U}from"./chunk-DX7LHTFF.js";import{Aa as d,Ab as _,Ba as p,Bb as b,Cb as f,Db as h,Dc as D,Fb as v,Kb as C,Lb as a,Ua as o,Va as u,Vc as W,Xc as P,Yb as y,_b as T,bd as O,cc as k,dc as E,ec as B,gb as V,gf as j,ib as x,ic as F,jc as I,kc as R,ob as i,rc as m,sc as g,ta as H,yh as L,zb as s}from"./chunk-N6B2OJOY.js";var re=(t,c)=>({costCenters:t,purchaseReasons:c}),ie=()=>[],oe=t=>({open:t});function ae(t,c){t&1&&b(0,"foerch-approval-box")}function ce(t,c){if(t&1&&b(0,"cx-icon",13),t&2){let e=a(4);i("type",e.iconTypes.ARROW_DOWN)}}function le(t,c){if(t&1&&b(0,"cx-icon",13),t&2){let e=a(4);i("type",e.iconTypes.ARROW_UP)}}function se(t,c){if(t&1){let e=v();f(0),s(1,"div",2)(2,"button",3),C("click",function(){d(e);let n=a(3);return p(n.isCollapsedEditCostCenter=!n.isCollapsedEditCostCenter)}),s(3,"div",4)(4,"div",5),y(5),m(6,"cxTranslate"),_(),s(7,"div",6),x(8,ce,1,1,"cx-icon",7)(9,le,1,1,"cx-icon",7),_()()(),s(10,"div",8)(11,"ng-select",9),m(12,"cxTranslate"),C("change",function(n){d(e);let l=a(3);return p(l.costCenterChanged(n))}),_(),s(13,"ng-select",10),m(14,"cxTranslate"),B("ngModelChange",function(n){d(e);let l=a(3);return E(l.selectedPurchaseReasonValue,n)||(l.selectedPurchaseReasonValue=n),p(n)}),C("change",function(n){d(e);let l=a(3);return p(l.purchaseReasonChanged(n))}),_(),s(15,"button",11),C("click",function(){d(e);let n=a(3);return p(n.applyCostCenter(!0))}),y(16),m(17,"cxTranslate"),_(),s(18,"button",12),C("click",function(){d(e);let n=a(3);return p(n.applyCostCenter(!1))}),y(19),m(20,"cxTranslate"),_()()(),h()}if(t&2){let e=a().ngIf,r=a(2);o(),i("ngClass",I(27,oe,!r.isCollapsedEditCostCenter)),o(4),T(" ",g(6,17,"cartDetails.editCostCenter")," "),o(3),i("ngIf",r.isCollapsedEditCostCenter),o(),i("ngIf",!r.isCollapsedEditCostCenter),o(),i("ngbCollapse",r.isCollapsedEditCostCenter),o(),i("clearable",!1)("items",e.costCenters)("placeholder",g(12,19,"cartDetails.selectCostCenterPlaceHolder")),o(2),i("clearable",!1)("disabled",(e.purchaseReasons||F(29,ie)).length===0)("items",e.purchaseReasons)("placeholder",g(14,21,"cartDetails.selectPurchaseReasonPlaceHolder")),k("ngModel",r.selectedPurchaseReasonValue),o(2),i("disabled",!r.selectedCostCenter),o(),T(" ",g(17,23,"cartHeader.applyCostCenter")," "),o(2),i("disabled",!r.selectedCostCenter),o(),T(" ",g(20,25,"cartHeader.applyForSelected")," ")}}function _e(t,c){if(t&1&&(f(0),x(1,se,21,30,"ng-container",0),h()),t&2){let e=c.ngIf,r=a(2);o(),i("ngIf",!r.isEmptyCart&&r.headerConfig.showCCM&&(e.costCenters||F(1,ie)).length)}}function de(t,c){if(t&1&&(f(0),x(1,_e,2,2,"ng-container",0),m(2,"async"),m(3,"async"),h()),t&2){let e=a();o(),i("ngIf",R(5,re,g(2,1,e.costCenters$),g(3,3,e.purchaseReasons$)))}}function pe(t,c){if(t&1&&b(0,"cx-icon",13),t&2){let e=a(2);i("type",e.iconTypes.ARROW_DOWN)}}function Ce(t,c){if(t&1&&b(0,"cx-icon",13),t&2){let e=a(2);i("type",e.iconTypes.ARROW_UP)}}function me(t,c){if(t&1){let e=v();s(0,"foerch-cart-file-upload",19),C("articlesAdded",function(){d(e);let n=a(3);return p(n.loadCart())}),_()}t&2&&i("buttonClasses","btn btn-link cartBox-link")}function ge(t,c){if(t&1){let e=v();f(0),s(1,"button",20),C("click",function(){d(e);let n=a(4);return p(n.openWatchlistDialog())}),b(2,"cx-icon",13),y(3),m(4,"cxTranslate"),_(),h()}if(t&2){let e=a(4);o(2),i("type",e.iconTypes.WATCHLIST),o(),T(" ",g(4,2,"cartHeader.searchWatchlist")," ")}}function xe(t,c){if(t&1){let e=v();f(0),s(1,"button",20),C("click",function(){d(e);let n=a(4);return p(n.openOrderTemplateDialog())}),b(2,"cx-icon",13),y(3),m(4,"cxTranslate"),_(),h()}if(t&2){let e=a(4);o(2),i("type",e.iconTypes.SAVE),o(),T(" ",g(4,2,"cartDialog.useOrderTemplate")," ")}}function fe(t,c){if(t&1&&(f(0),x(1,ge,5,4,"ng-container",0)(2,xe,5,4,"ng-container",0),h()),t&2){let e=a(3);o(),i("ngIf",e.isLoggedIn&&e.watchlistItems.length>0),o(),i("ngIf",e.isLoggedIn&&e.orderTemplates.length>0)}}function he(t,c){if(t&1&&(f(0),x(1,me,1,1,"foerch-cart-file-upload",18)(2,fe,3,2,"ng-container",0),h()),t&2){let e=a(2);o(),i("ngIf",!e.orderTemplateCode),o(),i("ngIf",e.isLoggedIn)}}function ue(t,c){if(t&1){let e=v();s(0,"div",14)(1,"button",15),C("click",function(){d(e);let n=a();return p(n.isCollapsedAddArticle=!n.isCollapsedAddArticle)}),s(2,"div",16)(3,"div",5),y(4),m(5,"cxTranslate"),_(),s(6,"div",6),x(7,pe,1,1,"cx-icon",7)(8,Ce,1,1,"cx-icon",7),_()()(),s(9,"div",8)(10,"foerch-quick-add-entry",17),C("addToCart",function(n){d(e);let l=a();return p(l.onAddToCart(n))}),_(),x(11,he,3,2,"ng-container",0),_()()}if(t&2){let e=a();i("ngClass",I(9,oe,!e.isCollapsedAddArticle)),o(4),T(" ",g(5,7,"cartHeader.addArticle")," "),o(3),i("ngIf",e.isCollapsedAddArticle),o(),i("ngIf",!e.isCollapsedAddArticle),o(),i("ngbCollapse",e.isCollapsedAddArticle),o(),i("disableAddButton",!e.isCartRefreshed),o(),i("ngIf",e.headerConfig.showDialogLinks)}}function be(t,c){if(t&1){let e=v();f(0),s(1,"foerch-quick-add-entry",17),C("addToCart",function(n){d(e);let l=a();return p(l.onAddToCart(n))}),_(),h()}if(t&2){let e=a();o(),i("disableAddButton",!e.isCartRefreshed)}}var Ge=(()=>{let c=class c extends ne{constructor(r,n,l,w,S,A,M){super(r,n,l,w,S,A,M),this.activeCartService=r,this.watchlistService=n,this.orderTemplateService=l,this.modalService=w,this.authService=S,this.cd=A,this.permissionService=M,this.isCollapsedEditCostCenter=!0,this.isCollapsedAddArticle=!0}openWatchlistDialog(){let r={scrollable:!0},l=this.modalService.open(te,r).componentInstance;l.isWatchList=!0,this.orderTemplateCode&&(l.addToOrderTemplate=!0,l.orderTemplateCode=this.orderTemplateCode),l.watchlistItems=this.watchlistItems}};c.\u0275fac=function(n){return new(n||c)(u(X),u($),u(ee),u(J),u(j),u(D),u(z))},c.\u0275cmp=H({type:c,selectors:[["foerch-cart-mobile-head"]],inputs:{orderTemplateCode:"orderTemplateCode"},features:[V],decls:4,vars:4,consts:[[4,"ngIf"],["class","cartBox mt-2",3,"ngClass",4,"ngIf"],[1,"cartBox",3,"ngClass"],["type","button",1,"btn","btn-block","cartBox-headBtn",3,"click"],[1,"row","justify-content-between","align-items-center"],[1,"col","text-start"],[1,"col-auto"],[3,"type",4,"ngIf"],[1,"cartBox-body",3,"ngbCollapse"],["bindLabel","name","bindValue","code","labelForId","costCenters",3,"change","clearable","items","placeholder"],["bindLabel","name","bindValue","code","labelForId","purchaseReasons",1,"mt-2",3,"ngModelChange","change","clearable","disabled","items","placeholder","ngModel"],["type","button",1,"btn","btn-secondary","btn-block","mt-2",3,"click","disabled"],[1,"btn","btn-secondary","btn-block","mt-2",3,"click","disabled"],[3,"type"],[1,"cartBox","mt-2",3,"ngClass"],["type","button",1,"btn","btn-block","cartBox-headBtn","align-items-center",3,"click"],[1,"row","justify-content-between"],[3,"addToCart","disableAddButton"],[3,"buttonClasses","articlesAdded",4,"ngIf"],[3,"articlesAdded","buttonClasses"],["type","button",1,"btn","btn-link","btn-block","cartBox-link",3,"click"]],template:function(n,l){n&1&&x(0,ae,1,0,"foerch-approval-box",0)(1,de,4,8,"ng-container",0)(2,ue,12,11,"div",1)(3,be,2,1,"ng-container",0),n&2&&(i("ngIf",l.headerConfig.cartMode===l.cartModes.CART),o(),i("ngIf",l.costCenters$),o(),i("ngIf",l.headerConfig.showQuickAddInBox),o(),i("ngIf",!l.headerConfig.showQuickAddInBox))},dependencies:[N,U,W,P,q,G,Q,Z,K,Y,O,L],encapsulation:2,changeDetection:0});let t=c;return t})();export{Ge as a};