import{d as tt}from"./chunk-BPP4QS36.js";import{b as nt}from"./chunk-VE2GED4L.js";import{b as oe}from"./chunk-5OZTUYJC.js";import{a as Qe}from"./chunk-BQH6WDEF.js";import{a as qe}from"./chunk-PPPS7MPC.js";import{a as Ze}from"./chunk-6P46GKPE.js";import{a as et}from"./chunk-TRE4H2YK.js";import{a as Ke}from"./chunk-6JC3FZFK.js";import{a as D}from"./chunk-Y7IP5WLG.js";import{r as Xe,t as Ge,u as ze,v as Ye}from"./chunk-SLGBXDUF.js";import{a as Je}from"./chunk-RB3FZ6ZH.js";import{a as re}from"./chunk-LY6HB4BL.js";import{a as $e}from"./chunk-ZKJJJDOZ.js";import{Qo as ne,Ri as Ne,Ui as Ue,Wi as je,Zi as He,_d as ke,aj as We,yb as Ve}from"./chunk-RQDYBYBM.js";import{J as te}from"./chunk-FBI7JGZC.js";import{a as ie}from"./chunk-ILYMG6ZI.js";import{r as j,t as H,x as ee}from"./chunk-MXUIPT66.js";import{I as Pe,f as Le,l as Re}from"./chunk-DX7LHTFF.js";import{$d as Ae,Aa as C,Ab as c,Ba as f,Bb as x,Cb as T,Ce as De,Db as b,Dc as P,E as pe,Eb as q,Fb as O,Ge as N,Jd as K,Kb as I,Kd as Oe,Lb as m,N as me,Og as Z,Ua as a,Va as u,Vc as be,Wc as Q,Wg as Be,Xb as F,Xc as V,Yb as d,Zb as y,_b as h,a as z,ad as Fe,ae as k,bd as we,be as A,cc as Ie,dc as ye,ec as Se,fh as Me,ga as ue,gb as xe,gd as Ee,ib as g,ic as de,jc as _e,la as Y,lc as X,nc as Te,oa as L,ob as l,qb as $,rc as p,rg as J,s as Ce,sc as v,t as fe,ta as R,vc as G,wc as E,yh as U,zb as s}from"./chunk-N6B2OJOY.js";var ae=class{};var it=(()=>{let i=class i{constructor(n){this.adapter=n}loadInventories(n,r){return this.adapter.loadInventories(n,r)}loadInventoriesForChart(n){return this.adapter.loadInventoriesForChart(n)}loadCompletedInventoriesForCostCenter(n,r){return this.adapter.loadCompletedInventoriesForCostCenter(n,r)}addMissingArticlesToCart(n,r,o,_){return this.adapter.addMissingArticlesToCart(n,r,o,_)}getInventoryExportUrl(n,r,o,_){return this.adapter.getInventoryExportUrl(n,r,o,_)}};i.\u0275fac=function(r){return new(r||i)(L(ae))},i.\u0275prov=Y({token:i,factory:i.\u0275fac,providedIn:"root"});let e=i;return e})();var ht=A(ne,e=>e.inventoriesState.chart),rt=A(ht,e=>({inventories:e.inventories,loading:e.loading,loaded:e.loaded,error:e.error}));var ve=A(ne,e=>e.inventoriesState.inventories),ot=A(ve,e=>({results:e.results,pagination:e.pagination,loading:e.loading,loaded:e.loaded,error:e.error})),at=A(ve,e=>e.loaded),ct=A(ve,(e,{costCenterCode:i})=>e.costCenterCompletedListMapping[i]?e.costCenterCompletedListMapping[i]:null);var w=(()=>{let i=class i{constructor(n,r,o,_){this.foerchStore=n,this.userIdService=r,this.connector=o,this.downloadService=_}get(){return this.foerchStore.pipe(k(ot))}load(n,r){this.withUserId(o=>this.foerchStore.dispatch(new Ne({userId:o,query:n,page:r})))}isLoaded(){return this.foerchStore.pipe(k(at))}loadAndAppend(n,r){this.withUserId(o=>this.foerchStore.dispatch(new Ue({userId:o,query:n,page:r})))}getInventoriesForChart(){return this.foerchStore.pipe(k(rt))}loadInventoriesForChart(){this.withUserId(n=>this.foerchStore.dispatch(new je({userId:n})))}getCompletedInventoriesForCostCenter(n){return this.foerchStore.pipe(k(ct,{costCenterCode:n}))}loadCompletedInventoriesForCostCenter(n){this.withUserId(r=>this.foerchStore.dispatch(new He({userId:r,costCenterCode:n})))}addMissingArticlesToCart(n,r){this.withUserId(o=>this.foerchStore.pipe(k($e),ue(_=>{!this.isCreated(_.cartContent)&&!_.cartLoading&&this.foerchStore.dispatch(new Ve({userId:o}))}),pe(_=>this.isCreated(_.cartContent)),Ce(_=>_.cartContent.code),me(1)).subscribe(_=>{this.foerchStore.dispatch(new We({userId:o,cartId:_,costCenterCode:n,inventoryPk:r}))}))}exportInventory(n,r,o){this.withUserId(_=>{let S=this.connector.getInventoryExportUrl(_,n,r,o);this.downloadService.downloadFromEndpoint(S,{loadingMessage:"",modalTitle:"inventoryOverview.exportModal.title",modalMessage:"inventoryOverview.exportModal.message",modalButton:"inventoryOverview.exportModal.button"})})}toggle(n,r){}toggleAll(n){}isCreated(n){return n&&typeof n.guid<"u"}withUserId(n){this.userIdService.getUserId().pipe(pe(r=>r!==De),me(1)).subscribe(r=>n(r))}};i.\u0275fac=function(r){return new(r||i)(L(Ae),L(N),L(it),L(Je))},i.\u0275prov=Y({token:i,factory:i.\u0275fac,providedIn:"root"});let e=i;return e})();var ut=function(e,i,t,n){var r=arguments.length,o=r<3?i:n===null?n=Object.getOwnPropertyDescriptor(i,t):n,_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,i,t,n);else for(var S=e.length-1;S>=0;S--)(_=e[S])&&(o=(r<3?_(o):r>3?_(i,t,o):_(i,t))||o);return r>3&&o&&Object.defineProperty(i,t,o),o},xt=function(e,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,i)};function It(e,i){if(e&1){let t=O();T(0),s(1,"div",8)(2,"div",9)(3,"ng-select",10),p(4,"cxTranslate"),Se("ngModelChange",function(r){C(t);let o=m();return ye(o.selectedCostCenters,r)||(o.selectedCostCenters=r),f(r)}),I("change",function(){C(t);let r=m();return f(r.onChangeSelectedCostCenters())}),c()(),s(5,"div",11)(6,"div",8)(7,"div",12)(8,"button",13),I("click",function(){C(t);let r=m();return f(r.downloadAsPdf())}),x(9,"cx-icon",5),d(10),p(11,"cxTranslate"),c()()()()(),s(12,"div",8)(13,"div",14)(14,"div",15),x(15,"cx-icon",5),s(16,"span"),d(17),p(18,"cxTranslate"),c()()()(),s(19,"div",16)(20,"div",14),x(21,"foerch-bar-chart",17),c()(),b()}if(e&2){let t=m();a(3),l("clearable",!1)("closeOnSelect",!1)("items",t.costCenters)("multiple",!0)("placeholder",v(4,12,"costCenterChart.activeCostCenters")),Ie("ngModel",t.selectedCostCenters),a(6),l("type",t.icons.PDF),a(),h("",v(11,14,"costCenterChart.downloadAsPdf")," "),a(5),l("type",t.icons.INFO),a(2),y(v(18,16,"inventoryChart.noCostCentersWithoutAmounts")),a(4),l("barChartData",t.barChartData)("canvasHeight",t.barChartCanvasHeight)}}function yt(e,i){e&1&&(s(0,"div"),x(1,"cx-spinner",19),d(2),p(3,"cxTranslate"),c()),e&2&&(a(2),h(" ",v(3,1,"costCenterChart.loadingMessage")," "))}function St(e,i){e&1&&(s(0,"div")(1,"div",20),d(2),p(3,"cxTranslate"),c()()),e&2&&(a(2),y(v(3,1,"common.errorMessage")))}function Tt(e,i){if(e&1&&g(0,yt,4,3,"div",18)(1,St,4,3,"div",18),e&2){let t=m();l("ngIf",t.isLoading),a(),l("ngIf",t.isError)}}var B,se=(B=class{constructor(i,t,n,r){this._inventoriesService=i,this._modalService=t,this._translationService=n,this._cd=r,this.icons=ie,this.costCenters=[],this.selectedCostCenters=[],this.isLoaded=!1,this.isLoading=!1,this.isError=!1,this.barChartData=[],this.barChartCanvasHeight="400px",this.titleOptions={textAlign:"left",textVerticalAlign:"top",left:"center",top:"middle",textStyle:{fontSize:24}},this._minBarChartCanvasHeight=400,this._barChartBaseCanvasHeight=97,this._singleBarHeight=94,this._headRow=[],this._inventoriesMapping={},this._subs$=new z}ngOnInit(){this._subs$.add(fe([this._translationService.translate("inventoryChart.targetAmount"),this._translationService.translate("inventoryChart.actualAmount"),this._inventoriesService.getInventoriesForChart()]).subscribe(([i,t,n])=>{this._headRow=["Foerch",i,t],this.handleInventoriesChartDataResult(n)})),this._inventoriesService.loadInventoriesForChart()}ngOnDestroy(){}dismissModal(){this._modalService.dismissActiveModal()}downloadAsPdf(){}onChangeSelectedCostCenters(){this.sortSelectedCostCenters(),this.updateBarChartDataForSelectedCostCenters()}handleInventoriesChartDataResult(i){if(this.isLoaded=i.loaded,this.isLoading=i.loading,this.isError=i.error,i.inventories.length>0){let t=[],n=[],r=i.inventories.reduce((o,_)=>(_.articleActualAmount===0&&_.articleTargetAmount===0||(t.push(_.costCenter),n.push(_.costCenter.code),this._inventoriesMapping[_.costCenter.code]=_,o.push(_)),o),[]);this.costCenters=t,this.selectedCostCenters=n,this.processBarChartDataForSelectedInventories(r)}}updateBarChartDataForSelectedCostCenters(){let i=this.selectedCostCenters.map(t=>this._inventoriesMapping[t]);i.sort((t,n)=>{let r=t.costCenter.name.toLowerCase(),o=n.costCenter.name.toLowerCase();return r>o?1:r<o?-1:0}),this.processBarChartDataForSelectedInventories(i)}sortSelectedCostCenters(){let i=this.selectedCostCenters.map(t=>this._inventoriesMapping[t].costCenter);i=ke(i,"name"),this.selectedCostCenters=i.map(t=>t.code)}processBarChartDataForSelectedInventories(i){let t=i.map(n=>[n.costCenter.name,n.articleTargetAmount,n.articleActualAmount]).reverse();this.barChartData=[this._headRow,...t],this.calculateBarChartCanvasHeight(this.barChartData.length-1)}calculateBarChartCanvasHeight(i){let t=Math.max(this._barChartBaseCanvasHeight+i*this._singleBarHeight,this._minBarChartCanvasHeight);this.barChartCanvasHeight=`${t}px`,this._cd.detectChanges()}},B.\u0275fac=function(t){return new(t||B)(u(w),u(D),u(Z),u(P))},B.\u0275cmp=R({type:B,selectors:[["foerch-inventory-chart-modal"]],decls:11,vars:6,consts:[["loadingOrError",""],[1,"modal-header"],[1,"modal-title"],["aria-label","Close","type","button",1,"close",3,"click"],["aria-hidden","true"],[3,"type"],[1,"modal-body","pt-2"],[4,"ngIf","ngIfElse"],[1,"row"],[1,"col-12","col-lg-8"],["bindLabel","name","bindValue","code",1,"ng-select-multiple_containerLight",3,"ngModelChange","change","clearable","closeOnSelect","items","multiple","placeholder","ngModel"],[1,"col","mt-2","mt-lg-0"],[1,"col","col-lg-12"],["type","button",1,"btn","btn-primary","btn-block","btn-icon_left","mb-2",3,"click"],[1,"col-12"],[1,"helptext","helptext_info"],[1,"row","mt-4"],[3,"barChartData","canvasHeight"],[4,"ngIf"],[1,"mb-4"],[1,"emptyState-text"]],template:function(t,n){if(t&1){let r=O();s(0,"div",1)(1,"h3",2),d(2),p(3,"cxTranslate"),c(),s(4,"button",3),I("click",function(){return C(r),f(n.dismissModal())}),s(5,"span",4),x(6,"cx-icon",5),c()()(),s(7,"div",6),g(8,It,22,18,"ng-container",7),c(),g(9,Tt,2,2,"ng-template",null,0,E)}if(t&2){let r=F(10);a(2),h(" ",v(3,4,"costCenterChart.chartHeadline")," "),a(4),l("type",n.icons.CLOSE),a(2),l("ngIf",!n.isLoading&&!n.isError)("ngIfElse",r)}},dependencies:[V,j,H,Pe,tt,Le,Re,U],encapsulation:2,changeDetection:0}),B);se=ut([re(),xt("design:paramtypes",[w,D,Z,P])],se);var Ft=["foerch-inventories-item",""],le=(e,i,t)=>[e,i,"symbol","1.2",t],wt=e=>({uid:e}),Et=e=>({cxRoute:"countingList",params:e});function Ot(e,i){if(e&1&&x(0,"cx-icon",8),e&2){let t=m();l("type",t.icons.ARROW_RIGHT)}}function At(e,i){if(e&1&&x(0,"cx-icon",8),e&2){let t=m();l("type",t.icons.ARROW_DOWN)}}function Dt(e,i){e&1&&(T(0),s(1,"tr",10)(2,"td",11),x(3,"cx-spinner"),c()(),b())}function Bt(e,i){if(e&1&&x(0,"cx-icon",8),e&2){let t=m(5);l("type",t.icons.ARROW_UP)}}function Mt(e,i){if(e&1&&x(0,"cx-icon",8),e&2){let t=m(5);l("type",t.icons.ARROW_DOWN)}}function Lt(e,i){if(e&1){let t=O();s(0,"tr",10)(1,"td",13)(2,"div",14)(3,"div",15)(4,"div",16),d(5),p(6,"cxTranslate"),c(),d(7),p(8,"cxDate"),c(),s(9,"div",15)(10,"div",16),d(11),p(12,"cxTranslate"),c(),d(13),c()()(),s(14,"td"),d(15),c(),s(16,"td"),d(17),p(18,"currency"),c(),s(19,"td"),d(20),c(),s(21,"td"),d(22),p(23,"currency"),c(),s(24,"td")(25,"div",17)(26,"button",18)(27,"span",19),d(28),p(29,"cxTranslate"),c(),g(30,Bt,1,1,"cx-icon",4)(31,Mt,1,1,"cx-icon",4),c(),s(32,"div",20)(33,"div",21),I("click",function(){let r=C(t).$implicit,o=m(4);return f(o.onSelectInventoryAction(o.inventoryAction.ADD_MISSING_TO_CART,r.pk))}),d(34),p(35,"cxTranslate"),c(),s(36,"div",21),I("click",function(){let r=C(t).$implicit,o=m(4);return f(o.onSelectInventoryAction(o.inventoryAction.EXPORT_AS_PDF,r.pk))}),d(37),p(38,"cxTranslate"),c(),s(39,"div",21),I("click",function(){let r=C(t).$implicit,o=m(4);return f(o.onSelectInventoryAction(o.inventoryAction.EXPORT_AS_XLS,r.pk))}),d(40),p(41,"cxTranslate"),c(),s(42,"div",21),I("click",function(){let r=C(t).$implicit,o=m(4);return f(o.onSelectInventoryAction(o.inventoryAction.REPORT_WITHOUT_AMOUNTS,r.pk))}),d(43),p(44,"cxTranslate"),c()()()()()}if(e&2){let t=i.$implicit,n=m(4);a(5),h(" ",v(6,15,"inventoryOverview.closingDate")," "),a(2),h(" ",v(8,17,t.closingDate)," "),a(4),h(" ",v(12,19,"inventoryOverview.closedBy")," "),a(2),h(" ",(t.user==null?null:t.user.name)||"-"," "),a(2),y(t.articleTargetCount),a(2),h(" ",G(18,21,X(43,le,t.articleTargetAmount,n.currencyCode,n.localeCode))," "),a(3),y(t.articleActualCount),a(2),h(" ",G(23,27,X(47,le,t.articleActualAmount,n.currencyCode,n.localeCode))," "),a(6),y(v(29,33,"common.select")),a(2),l("ngIf",!n.isExpanded),a(),l("ngIf",n.isExpanded),a(3),h(" ",v(35,35,"inventoryOverview.addMissingArticlesToCart")," "),a(3),h(" ",v(38,37,"inventoryOverview.exportInventoryAsPDF")," "),a(3),h(" ",v(41,39,"inventoryOverview.exportInventoryAsXLS")," "),a(3),h(" ",v(44,41,"inventoryOverview.inventoryWithoutAmounts")," ")}}function Rt(e,i){if(e&1&&(T(0),g(1,Lt,45,51,"tr",12),b()),e&2){let t=m(3);a(),l("ngForOf",t.completedInventories)("ngForTrackBy",t.trackByIndex)}}function Pt(e,i){if(e&1&&g(0,Rt,2,2,"ng-container",9),e&2){m();let t=F(5),n=m();l("ngIf",n.completedInventories.length>0)("ngIfElse",t)}}function Vt(e,i){e&1&&(s(0,"tr",10)(1,"td",22),d(2),p(3,"cxTranslate"),c()()),e&2&&(a(2),h(" ",v(3,1,"inventoryOverview.noCompletedInventories")," "))}function kt(e,i){if(e&1&&(T(0),g(1,Dt,4,0,"ng-container",9)(2,Pt,1,2,"ng-template",null,0,E)(4,Vt,4,3,"ng-template",null,1,E),b()),e&2){let t=F(3),n=m();a(),l("ngIf",n.isLoading)("ngIfElse",t)}}var W=function(e){return e[e.ADD_MISSING_TO_CART=1]="ADD_MISSING_TO_CART",e[e.EXPORT_AS_PDF=2]="EXPORT_AS_PDF",e[e.EXPORT_AS_XLS=3]="EXPORT_AS_XLS",e[e.REPORT_WITHOUT_AMOUNTS=4]="REPORT_WITHOUT_AMOUNTS",e}(W||{}),pt=(()=>{let i=class i{constructor(n,r){this.inventoriesService=n,this.cd=r,this.icons=ie,this.isExpanded=!1,this.isRequested=!1,this.isLoaded=!1,this.isLoading=!1,this.completedInventories=[],this.inventoryAction=W,this.subs$=new z}ngOnInit(){this.subs$.add(this.inventoriesService.getCompletedInventoriesForCostCenter(this.item.costCenter.code).subscribe(n=>{n&&(this.isLoading=n.loading,this.isLoaded=n.loaded,this.completedInventories=n.inventories,this.cd.detectChanges())}))}ngOnDestroy(){this.subs$.unsubscribe()}trackByIndex(n){return n}toggleListOfCompletedInventories(){this.isExpanded=!this.isExpanded,this.isExpanded&&!this.isLoading&&!this.isLoaded&&this.inventoriesService.loadCompletedInventoriesForCostCenter(this.item.costCenter.code)}onSelectInventoryAction(n,r){let o=this.item.costCenter.code;switch(n){case W.ADD_MISSING_TO_CART:{this.inventoriesService.addMissingArticlesToCart(this.item.costCenter.code,r);break}case W.EXPORT_AS_PDF:{this.inventoriesService.exportInventory(o,r,te.AS_PDF);break}case W.EXPORT_AS_XLS:{this.inventoriesService.exportInventory(o,r,te.AS_XLS);break}case W.REPORT_WITHOUT_AMOUNTS:{this.inventoriesService.exportInventory(o,r,te.WITHOUT_VALUES);break}default:}}};i.\u0275fac=function(r){return new(r||i)(u(w),u(P))},i.\u0275cmp=R({type:i,selectors:[["","foerch-inventories-item",""]],inputs:{item:"item",currencyCode:"currencyCode",localeCode:"localeCode"},attrs:Ft,decls:24,vars:42,consts:[["listOfCompletedInventories",""],["noCompletedInventories",""],[1,"btn","px-0","py-0","text-start","d-flex","costCenterName",3,"click"],[1,"align-self-start"],[3,"type",4,"ngIf"],[1,"text-small","ms-1"],[1,"btn","btn-primary","btn-block","btn-sm",3,"routerLink"],[4,"ngIf"],[3,"type"],[4,"ngIf","ngIfElse"],[1,"inventories"],["colspan","6"],["class","inventories",4,"ngFor","ngForOf","ngForTrackBy"],[1,"pb-0"],[1,"row"],[1,"col","pb-2"],[1,"text-nowrap","date-label"],["container","body","ngbDropdown","","placement","bottom-right"],["ngbDropdownToggle","",1,"btn","btn-block","btn-sm","dropdown-toggle","d-flex","justify-content-between"],[1,"dropdown-text"],["ngbDropdownMenu","",1,"inventories-dropdown"],["ngbDropdownItem","",1,"btn","btn-link_secondary",3,"click"],["colspan","6",1,"emptyState-text","text-center","py-3"]],template:function(r,o){r&1&&(s(0,"tr")(1,"td")(2,"a",2),I("click",function(){return o.toggleListOfCompletedInventories()}),s(3,"span",3),g(4,Ot,1,1,"cx-icon",4)(5,At,1,1,"cx-icon",4),c(),s(6,"span",5),d(7),c()()(),s(8,"td"),d(9),c(),s(10,"td"),d(11),p(12,"currency"),c(),s(13,"td"),d(14),c(),s(15,"td"),d(16),p(17,"currency"),c(),s(18,"td")(19,"a",6),p(20,"cxUrl"),d(21),p(22,"cxTranslate"),c()()(),g(23,kt,6,2,"ng-container",7)),r&2&&(a(4),l("ngIf",!o.isExpanded),a(),l("ngIf",o.isExpanded),a(2),y(o.item.costCenter.name),a(2),y(o.item.articleTargetCount),a(2),h(" ",G(12,14,X(30,le,o.item.articleTargetAmount,o.currencyCode,o.localeCode))," "),a(2),$("text-secondary",o.item.articleActualCount<o.item.articleTargetCount),a(),h(" ",o.item.articleActualCount," "),a(),$("text-secondary",o.item.articleActualAmount<o.item.articleTargetAmount),a(),h(" ",G(17,20,X(34,le,o.item.articleActualAmount,o.currencyCode,o.localeCode))," "),a(3),l("routerLink",v(20,26,_e(40,Et,_e(38,wt,o.item.costCenter.code)))),a(2),h(" ",v(22,28,"inventoryOverview.countingList")," "),a(2),l("ngIf",o.isExpanded))},dependencies:[Q,V,Oe,j,H,Ye,ze,Ge,Xe,Ee,U,Me,Be],encapsulation:2,changeDetection:0});let e=i;return e})();var Ut=function(e,i,t,n){var r=arguments.length,o=r<3?i:n===null?n=Object.getOwnPropertyDescriptor(i,t):n,_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,i,t,n);else for(var S=e.length-1;S>=0;S--)(_=e[S])&&(o=(r<3?_(o):r>3?_(i,t,o):_(i,t))||o);return r>3&&o&&Object.defineProperty(i,t,o),o},jt=function(e,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,i)},Ht=(e,i,t,n,r)=>({isEmpty:e,isLoaded:i,items:t,currencyCode:n,localeCode:r}),Wt=()=>({isPagingBottom:!1}),$t=()=>({isPagingBottom:!0});function Xt(e,i){e&1&&q(0)}function Gt(e,i){e&1&&q(0)}function zt(e,i){if(e&1&&(T(0),g(1,Gt,1,0,"ng-container",16),b()),e&2){m();let t=F(24);a(),l("ngTemplateOutlet",t)}}function Yt(e,i){if(e&1&&x(0,"tbody",22),e&2){let t=i.$implicit,n=m(2).ngIf;l("currencyCode",n.currencyCode)("item",t)("localeCode",n.localeCode)}}function qt(e,i){e&1&&q(0)}function Qt(e,i){if(e&1&&(T(0),s(1,"div",17)(2,"div",18)(3,"table",19)(4,"thead")(5,"tr")(6,"th"),d(7),p(8,"cxTranslate"),c(),s(9,"th"),d(10),p(11,"cxTranslate"),c(),s(12,"th"),d(13),p(14,"cxTranslate"),c(),s(15,"th"),d(16),p(17,"cxTranslate"),c(),s(18,"th"),d(19),p(20,"cxTranslate"),c(),s(21,"th"),d(22),p(23,"cxTranslate"),c()()(),g(24,Yt,1,3,"tbody",20),c()()(),s(25,"div",17)(26,"div",21),g(27,qt,1,0,"ng-container",14),c()(),b()),e&2){let t=m().ngIf,n=F(26),r=m();a(7),h(" ",v(8,10,"inventoryOverview.costCenter")," "),a(3),y(v(11,12,"inventoryOverview.articleTarget")),a(3),y(v(14,14,"inventoryOverview.articleAmount")),a(3),y(v(17,16,"inventoryOverview.articleActual")),a(3),y(v(20,18,"inventoryOverview.articleAmount")),a(3),y(v(23,20,"inventoryOverview.action")),a(2),l("ngForOf",t.items.results)("ngForTrackBy",r.trackByIndex),a(3),l("ngTemplateOutlet",n)("ngTemplateOutletContext",de(22,$t))}}function Kt(e,i){if(e&1&&(T(0),s(1,"div",23)(2,"div",24)(3,"div",25),d(4),p(5,"cxTranslate"),c()()(),b()),e&2){let t=m(3);a(4),h(" ",v(5,1,t.searchQuery?"inventoryOverview.noInventoriesMatchQuery":"inventoryOverview.noInventories")," ")}}function Jt(e,i){if(e&1&&g(0,Kt,6,3,"ng-container",3),e&2){let t=m().ngIf;l("ngIf",t.isLoaded===!0)}}function Zt(e,i){if(e&1&&(s(0,"div",26),x(1,"cx-spinner",27),c()),e&2){let t=m().ngIf;$("spinnerOverlayWrapper_minHeight",t.isLoaded!==!0)}}function en(e,i){if(e&1){let t=O();s(0,"div",29)(1,"foerch-items-per-page",30),I("itemNumbersChangeEvent",function(r){C(t);let o=m(3);return f(o.onPageSizeChange(r))}),c(),s(2,"foerch-paging",31),I("viewChangePageEvent",function(r){C(t);let o=m(3);return f(o.onPageChange(r))}),c()()}if(e&2){let t=m().isPagingBottom,n=m().ngIf,r=m();l("ngClass",t?"inventories-pagination_bottom":""),a(),l("countOptions",r.countOptions)("disabled",n.isLoaded!==!0)("label","inventoryOverview.costCentersPerPage")("pagination",r.pagination),a(),l("disabled",n.isLoaded!==!0)("isMobile",!1)("isPagingBottom",t)("label","inventoryOverview.pagination.costCenter")("pagination",r.pagination)}}function tn(e,i){if(e&1&&g(0,en,3,10,"div",28),e&2){let t=m().ngIf;l("ngIf",t.isEmpty!==!0)}}function nn(e,i){if(e&1){let t=O();T(0),s(1,"div",4)(2,"div",5)(3,"div",6),d(4),p(5,"cxTranslate"),c()(),s(6,"div",7)(7,"button",8),I("click",function(){C(t);let r=m();return f(r.showDiagramModal())}),d(8),p(9,"cxTranslate"),c(),s(10,"button",9),I("click",function(){C(t);let r=m();return f(r.addCustomerArticleDialog())}),x(11,"cx-icon",10),d(12),p(13,"cxTranslate"),c()()(),s(14,"div",11)(15,"div",12)(16,"foerch-search-input",13),I("searchString",function(r){C(t);let o=m();return f(o.onQueryChange(r))}),c()(),s(17,"div",5),g(18,Xt,1,0,"ng-container",14),c()(),g(19,zt,2,1,"ng-container",3)(20,Qt,28,23,"ng-container",15)(21,Jt,1,1,"ng-template",null,0,E)(23,Zt,2,2,"ng-template",null,1,E)(25,tn,1,1,"ng-template",null,2,E),b()}if(e&2){let t=i.ngIf,n=F(22),r=F(26),o=m();a(4),h(" ",v(5,10,"inventoryOverview.inventory")," "),a(3),l("disabled",!o.isInitialized||t.isEmpty!==!1),a(),h(" ",v(9,12,"inventoryOverview.showDiagram")," "),a(3),l("type",o.icons.PLUS),a(),h(" ",v(13,14,"inventoryOverview.addCustomerArticles")," "),a(6),l("ngTemplateOutlet",r)("ngTemplateOutletContext",de(16,Wt)),a(),l("ngIf",t.isLoaded!==!0&&t.isEmpty!==!0),a(),l("ngIf",t.isLoaded===!0&&t.isEmpty!==!0)("ngIfElse",n)}}var M,mt=(M=class extends qe{constructor(i,t,n,r,o,_,S){super(i,t,n),this.inventoriesService=i,this.userIdService=t,this.breakpointService=n,this.currencyService=r,this.currencyLocaleService=o,this.modalService=_,this.router=S,this.inventories=[],this.currency$=this.currencyService.getActive(),this.locale$=this.currencyLocaleService.getActiveLocaleForCurrencyPipe(),this.sortModel=null}ngOnInit(){this.loadData(null,0)}ngOnDestroy(){}trackByIndex(i){return i}showDiagramModal(){this.modalService.open(se,{centered:!0,size:"xl"})}addCustomerArticleDialog(){let i=this.modalService.open(Ke,{centered:!0});i&&(i.componentInstance.title="customerArticlesOverview.dialog.infoTitle",i.componentInstance.description="customerArticlesOverview.dialog.infoMessage",i.componentInstance.confirmButtonText="customerArticlesOverview.dialog.infoConfirmButton",i.result.then(t=>{t&&this.router.navigate(["my-account","customer-articles","new"],{queryParams:{articleSource:nt.INVENTORY}})}).catch(()=>{}))}},M.\u0275fac=function(t){return new(t||M)(u(w),u(N),u(ee),u(J),u(oe),u(D),u(K))},M.\u0275cmp=R({type:M,selectors:[["foerch-inventories"]],features:[xe],decls:6,vars:17,consts:[["noInventories",""],["loading",""],["desktopPagination",""],[4,"ngIf"],[1,"row","justify-content-between","mb-4"],[1,"col-auto"],[1,"h3"],[1,"col-md-auto"],["type","button",1,"btn","btn-secondary","me-2",3,"click","disabled"],["type","button",1,"btn","btn-primary","btn-icon_left",3,"click"],[3,"type"],[1,"row","justify-content-between","align-items-end"],[1,"col","mb-1"],["placeholder","inventoryOverview.queryForCostCenter",3,"searchString"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],[1,"row"],[1,"col-12","cartTable-wrapper"],[1,"cartTable"],["foerch-inventories-item","",3,"currencyCode","item","localeCode",4,"ngFor","ngForOf","ngForTrackBy"],[1,"col-12","text-end"],["foerch-inventories-item","",3,"currencyCode","item","localeCode"],[1,"row","emptyState"],[1,"col-12"],[1,"emptyState-text"],[1,"spinnerOverlayWrapper"],[1,"spinner_overlay"],["class","inventories-pagination",3,"ngClass",4,"ngIf"],[1,"inventories-pagination",3,"ngClass"],[3,"itemNumbersChangeEvent","countOptions","disabled","label","pagination"],[3,"viewChangePageEvent","disabled","isMobile","isPagingBottom","label","pagination"]],template:function(t,n){t&1&&(g(0,nn,27,17,"ng-container",3),p(1,"async"),p(2,"async"),p(3,"async"),p(4,"async"),p(5,"async")),t&2&&l("ngIf",Te(11,Ht,v(1,1,n.isEmpty$),v(2,3,n.isLoaded$),v(3,5,n.items$),v(4,7,n.currency$),v(5,9,n.locale$)))},dependencies:[be,Q,V,Fe,Ze,et,Qe,j,H,pt,we,U],encapsulation:2,changeDetection:0}),M);mt=Ut([re(),jt("design:paramtypes",[w,N,ee,J,oe,D,K])],mt);export{ae as a,it as b,w as c,pt as d,mt as e};