import{a as Jt}from"./chunk-IEKNUG5Y.js";import{c as Kt}from"./chunk-7M3X7FU6.js";import{b as Yt}from"./chunk-5OZTUYJC.js";import{d as De}from"./chunk-ICTDV7DB.js";import{J as Be}from"./chunk-CWWVHRJU.js";import{a as jt}from"./chunk-RVI6SOSK.js";import{a as Xt}from"./chunk-6IGMG2LM.js";import{a as qt}from"./chunk-WWYFGPHT.js";import{a as Qt}from"./chunk-BQH6WDEF.js";import{a as Ht}from"./chunk-6P46GKPE.js";import{a as Zt}from"./chunk-TRE4H2YK.js";import{a as Gt,b as zt}from"./chunk-NLWV7OZT.js";import{a as oe}from"./chunk-RU43IR5J.js";import{d as Wt}from"./chunk-ZSVIZXE3.js";import{a as ue}from"./chunk-6JC3FZFK.js";import{a as $}from"./chunk-Y7IP5WLG.js";import{b as ke}from"./chunk-ISDPQX42.js";import{a as re}from"./chunk-SLGBXDUF.js";import{a as $t}from"./chunk-RB3FZ6ZH.js";import{a as we}from"./chunk-LY6HB4BL.js";import{Ai as Ot,Di as Vt,Gi as Rt,Ji as Nt,Qo as Ut,ci as Tt,fi as Ft,hi as It,ki as Pt,ni as Mt,qi as wt,ti as kt,wi as Bt,zi as Dt}from"./chunk-RQDYBYBM.js";import{I as Pe,T as Me,U as me,ba as Et}from"./chunk-FBI7JGZC.js";import{a as U}from"./chunk-ILYMG6ZI.js";import{U as Lt,f as bt,r as N,t as yt,x as At}from"./chunk-MXUIPT66.js";import{A as xt,E as St,H as vt,I as R,b as ut,c as gt,f as M,g as _t,l as V,m as Ct,q as ht,t as ft}from"./chunk-DX7LHTFF.js";import{$d as at,Aa as C,Ab as l,Ba as h,Bb as b,Cb as T,Ce as ct,Da as xe,Db as F,Dc as Le,E as Ge,Eb as ve,Fb as y,Gd as nt,Ge as st,Jd as ot,Ka as E,Kb as _,Kd as rt,Lb as p,Me as lt,N as pe,Na as Ke,Ob as ie,Og as mt,Pb as Je,Ua as a,Va as v,Vc as Ee,Wc as Te,X as ze,Xb as Y,Xc as P,Yb as g,Zb as I,_b as f,a as Xe,ad as et,ae as Qe,bd as O,be as Ie,cc as k,da as Ye,dc as B,ec as D,gb as te,gd as Fe,ib as x,ic as K,jc as ne,kc as be,la as fe,lc as ye,md as tt,oa as q,ob as s,pf as pt,qb as Se,rc as d,rg as dt,s as he,sc as m,t as Ze,ta as A,tc as J,td as it,vc as Ae,wc as de,yh as L,zb as c}from"./chunk-N6B2OJOY.js";import{a as qe,b as je}from"./chunk-GHL4OFBQ.js";var Oe=class{};var ei=(()=>{let r=class r{constructor(e){this.adapter=e}load(e,t,o){return this.adapter.load(e,t,o)}deleteEntry(e,t,o,u){return this.adapter.deleteEntry(e,t,o,u)}updateEntry(e,t,o,u){return this.adapter.updateEntry(e,t,o,u)}updateArticlesCount(e,t,o,u){return this.adapter.updateArticlesCount(e,t,o,u)}deleteArticlesWithZero(e,t,o){return this.adapter.deleteArticlesWithZero(e,t,o)}resetCountingList(e,t,o){return this.adapter.resetCountingList(e,t,o)}closeCountingList(e,t){return this.adapter.closeCountingList(e,t)}copyArticlesFromCostCenter(e,t,o){return this.adapter.copyArticlesFromCostCenter(e,t,o)}addArticles(e,t,o,u){return this.adapter.addArticles(e,t,o,u)}addCustomArticles(e,t,o,u){return this.adapter.addCustomArticles(e,t,o,u)}shareClosedCountingList(e,t,o){return this.adapter.shareClosedCountingList(e,t,o)}getCountingListExportUrl(e,t,o,u){return this.adapter.getCountingListExportUrl(e,t,o,u)}};r.\u0275fac=function(t){return new(t||r)(q(Oe))},r.\u0275prov=fe({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var ti=Ie(Ut,n=>n.inventoriesState.countingList),ii=Ie(ti,n=>({costCenterCode:n.costCenterCode,results:n.results,pagination:n.pagination,sortModel:n.sortModel,storagePlaces:n.storagePlaces,successCode:n.successCode,failedCode:n.failedCode,closedCountingList:n.closedCountingList,loading:n.loading,loaded:n.loaded,error:n.error})),ni=Ie(ti,n=>n.loading);var H=(()=>{let r=class r{constructor(e,t,o,u,S,ee){this.foerchStore=e,this.userIdService=t,this.connector=o,this.downloadService=u,this.occEndpointsService=S,this.http=ee}get(){return this.foerchStore.pipe(Qe(ii))}load(e,t){this.withUserId(o=>this.foerchStore.dispatch(new Tt({userId:o,costCenterCode:e,query:t})))}loadAndAppend(e,t){this.withUserId(o=>this.foerchStore.dispatch(new Ft({userId:o,costCenterCode:e,query:t})))}deleteEntry(e,t,o){this.withUserId(u=>this.foerchStore.dispatch(new It({userId:u,costCenterCode:e,entry:t,query:o})))}updateEntry(e,t,o,u){this.withUserId(S=>this.foerchStore.dispatch(new Pt({userId:S,costCenterCode:e,entry:t,query:o,forMobile:u})))}updateArticlesCount(e,t,o){this.withUserId(u=>this.foerchStore.dispatch(new Mt({userId:u,costCenterCode:e,countNumber:t,query:o})))}deleteArticlesWithZero(e,t){this.withUserId(o=>this.foerchStore.dispatch(new wt({userId:o,costCenterCode:e,query:t})))}resetCountingList(e,t){this.withUserId(o=>this.foerchStore.dispatch(new kt({userId:o,costCenterCode:e,query:t})))}closeCountingList(e){this.withUserId(t=>this.foerchStore.dispatch(new Bt({userId:t,costCenterCode:e})))}resetClosedCountingList(){this.foerchStore.dispatch(new Dt)}copyArticlesFromCostCenter(e,t){this.withUserId(o=>this.foerchStore.dispatch(new Ot({userId:o,costCenterCode:e,sourceCostCenterCode:t})))}addArticles(e,t,o){this.withUserId(u=>this.foerchStore.dispatch(new Vt({userId:u,costCenterCode:e,articles:t,storagePlace:o})))}addCustomArticles(e,t,o){this.withUserId(u=>this.foerchStore.dispatch(new Rt({userId:u,costCenterCode:e,customerArticles:t,storagePlace:o})))}shareClosedCountingList(e,t){this.withUserId(o=>this.foerchStore.dispatch(new Nt({userId:o,receivers:t,closedCountingListPk:e})))}exportCountingList(e,t,o="by_articlenumber:asc"){this.withUserId(u=>{let S=this.connector.getCountingListExportUrl(u,e,t,o);this.downloadService.downloadFromEndpoint(S,{loadingMessage:"",modalTitle:"countingList.quickActions.exportModal.title",modalMessage:"countingList.quickActions.exportModal.message",modalButton:"countingList.quickActions.exportModal.button"})})}getEntriesForBarcodeCatalog(e){return this.userIdService.getUserId().pipe(pe(1),Ye(t=>{let o=new tt({"Content-Type":"application/json"}),u=this.occEndpointsService.buildUrl(`users/${t}/inventory/costcenters/${e}/countinglist/barcode`);return this.http.get(u,{headers:o}).pipe(ze("entries"))}))}isLoading(){return this.foerchStore.pipe(Qe(ni))}withUserId(e){this.userIdService.getUserId().pipe(Ge(t=>t!==ct),pe(1)).subscribe(t=>e(t))}};r.\u0275fac=function(t){return new(t||r)(q(at),q(st),q(ei),q($t),q(pt),q(it))},r.\u0275prov=fe({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();function _i(n,r){if(n&1&&(c(0,"div",4)(1,"span"),g(2),d(3,"cxTranslate"),l()()),n&2){let i=p();a(2),I(m(3,1,i.hasNoRecipients?"countingList.shareClosedCountingListModal.missingRecipients":"countingList.shareClosedCountingListModal.containsInvalidEmailAddresses"))}}var oi=(()=>{let r=class r extends jt{constructor(e,t,o,u,S){super(e,t,o),this.foerchMembersService=e,this.baseSiteService=t,this.fb=o,this._countingListService=u,this._router=S}shareWithEmailAddresses(e){this._countingListService.shareClosedCountingList(this.countingListPk,e)}navigateToInventory(){this._countingListService.resetClosedCountingList(),this._router.navigate(["/","my-account","inventory"])}};r.\u0275fac=function(t){return new(t||r)(v(qt),v(Wt),v(xt),v(H),v(ot))},r.\u0275cmp=A({type:r,selectors:[["foerch-counting-list-share-modal"]],features:[te],decls:11,vars:20,consts:[[3,"cancelButtonText","confirmButtonText","isConfirmButtonDisabled","title"],[3,"formGroup"],["bindLabel","name","formControlName","recipients",3,"addTag","addTagText","items","multiple","placeholder"],["class","form-helptext form-helptext_danger",4,"ngIf"],[1,"form-helptext","form-helptext_danger"]],template:function(t,o){t&1&&(c(0,"foerch-modal-confirm",0)(1,"p"),g(2),d(3,"cxTranslate"),l(),c(4,"div")(5,"form",1),b(6,"ng-select",2),d(7,"cxTranslate"),d(8,"async"),d(9,"cxTranslate"),x(10,_i,4,3,"div",3),l()()()),t&2&&(s("cancelButtonText","countingList.shareClosedCountingListModal.cancelButton")("confirmButtonText","barcodeCatalogList.eanShareDialog.confirmButton")("isConfirmButtonDisabled",o.shareForm.invalid)("title","countingList.shareClosedCountingListModal.title"),a(2),f(" ",m(3,12,"countingList.shareClosedCountingListModal.description")," "),a(3),s("formGroup",o.shareForm),a(),s("addTag",!0)("addTagText",m(7,14,"countingList.shareClosedCountingListModal.addEmailAddress"))("items",m(8,16,o.members$))("multiple",!0)("placeholder",m(9,18,"countingList.shareClosedCountingListModal.memberListPlaceholder")),a(4),s("ngIf",o.shareForm.touched&&o.shareForm.invalid))},dependencies:[P,Ct,M,_t,ht,ft,R,ue,O,L],encapsulation:2,changeDetection:0});let n=r;return n})();var Z=(()=>{let r=class r{get stylingClass(){return`${this.sizingClass} ${this.extraClass}`}constructor(e){this.winRef=e,this.canAdd=!0,this.placeholder="",this.storagePlaces=[],this.extraClass="",this.sizingClass="",this.appendDropdownToBody=!1,this.storagePlaceChanged=new E}onChangeStoragePlace(e){this.storagePlaceChanged.emit(e)}addDropdownPanelClass(){this.appendDropdownToBody&&setTimeout(()=>{let e=this.winRef.document.querySelector(".ng-dropdown-panel");e&&e.classList&&e.classList.add(this.sizingClass)},0)}};r.\u0275fac=function(t){return new(t||r)(v(lt))},r.\u0275cmp=A({type:r,selectors:[["foerch-storage-place"]],inputs:{canAdd:"canAdd",placeholder:"placeholder",storagePlaces:"storagePlaces",selectedStoragePlace:"selectedStoragePlace",extraClass:"extraClass",sizingClass:"sizingClass",appendDropdownToBody:"appendDropdownToBody"},outputs:{storagePlaceChanged:"storagePlaceChanged"},decls:3,vars:14,consts:[[3,"ngModelChange","change","open","addTag","addTagText","appendTo","clearable","items","ngClass","notFoundText","placeholder","searchable","ngModel"]],template:function(t,o){t&1&&(c(0,"ng-select",0),d(1,"cxTranslate"),d(2,"cxTranslate"),D("ngModelChange",function(S){return B(o.selectedStoragePlace,S)||(o.selectedStoragePlace=S),S}),_("change",function(S){return o.onChangeStoragePlace(S)})("open",function(){return o.addDropdownPanelClass()}),l()),t&2&&(s("addTag",o.canAdd)("addTagText",m(1,10,"countingList.addStoragePlace"))("appendTo",o.appendDropdownToBody?"body":null)("clearable",o.selectedStoragePlace!=="")("items",o.storagePlaces)("ngClass",o.stylingClass)("notFoundText",m(2,12,"countingList.noStoragePlace"))("placeholder",o.placeholder)("searchable",!0),k("ngModel",o.selectedStoragePlace))},dependencies:[Ee,M,V,R,L],encapsulation:2,changeDetection:0});let n=r;return n})();function Ci(n,r){if(n&1&&(c(0,"div",15),b(1,"input",16),c(2,"label",17),g(3),l()()),n&2){let i=r.index,e=r.item,t=r.item$;a(),Je("id","item-",i,""),s("ngModel",t.selected),a(2),I(e.description)}}var ai=(()=>{let r=class r{constructor(e,t){this._modalService=e,this._customerArticleService=t,this.icons=U,this.selectedStoragePlace=null,this.selectedCustomerArticles=[],this.customerArticles$=this._customerArticleService.get().pipe(he(o=>o.filter(u=>u.inventory===!0)))}dismissModal(){this._modalService.dismissActiveModal(!1)}confirm(){let e={storagePlace:this.selectedStoragePlace,articles:this.selectedCustomerArticles};this._modalService.closeActiveModal(e)}onStoragePlaceChanged(e){this.selectedStoragePlace=e}};r.\u0275fac=function(t){return new(t||r)(v($),v(Jt))},r.\u0275cmp=A({type:r,selectors:[["foerch-counting-list-add-custom-articles-modal"]],decls:23,vars:23,consts:[[1,"modal-header"],[1,"modal-title"],["aria-label","Close","type","button",1,"close",3,"click"],["aria-hidden","true"],[3,"type"],[1,"modal-body"],[1,"row"],[1,"col-12","mb-2"],["bindLabel","description","bindValue","code",1,"ng-select-multiple_checkbox",3,"ngModelChange","clearable","closeOnSelect","items","multiple","placeholder","ngModel"],["ng-option-tmp",""],[1,"col-12"],[3,"storagePlaceChanged","canAdd","placeholder","storagePlaces"],[1,"modal-footer"],[1,"col"],["type","button",1,"btn","btn-primary",3,"click","disabled"],[1,"form-check","form-checkbox"],["type","checkbox","role","checkbox",1,"form-check-input",3,"id","ngModel"],[1,"form-check-label"]],template:function(t,o){t&1&&(c(0,"div",0)(1,"h3",1),g(2),d(3,"cxTranslate"),l(),c(4,"button",2),_("click",function(){return o.dismissModal()}),c(5,"span",3),b(6,"cx-icon",4),l()()(),c(7,"div",5)(8,"div",6)(9,"div",7)(10,"ng-select",8),d(11,"async"),d(12,"cxTranslate"),D("ngModelChange",function(S){return B(o.selectedCustomerArticles,S)||(o.selectedCustomerArticles=S),S}),x(13,Ci,4,4,"ng-template",9),l()(),c(14,"div",10)(15,"foerch-storage-place",11),d(16,"cxTranslate"),_("storagePlaceChanged",function(S){return o.onStoragePlaceChanged(S)}),l()()()(),c(17,"div",12)(18,"div",6)(19,"div",13)(20,"button",14),_("click",function(){return o.confirm()}),g(21),d(22,"cxTranslate"),l()()()()),t&2&&(a(2),f(" ",m(3,13,"countingList.addCustomArticlesModal.addCustomerArticles")," "),a(4),s("type",o.icons.CLOSE),a(4),s("clearable",!1)("closeOnSelect",!1)("items",m(11,15,o.customerArticles$))("multiple",!0)("placeholder",m(12,17,"countingList.addCustomArticlesModal.customArticles")),k("ngModel",o.selectedCustomerArticles),a(5),s("canAdd",!0)("placeholder",m(16,19,"countingList.addArticles.storagePlace"))("storagePlaces",o.storagePlaces),a(5),s("disabled",o.selectedCustomerArticles.length===0),a(),f(" ",m(22,21,"countingList.addCustomArticlesModal.addCustomerArticles")," "))},dependencies:[ut,M,V,N,R,St,Z,O,L],encapsulation:2,changeDetection:0});let n=r;return n})();var hi=(n,r)=>({result:n,isDropdownHidden:r});function fi(n,r){if(n&1){let i=y();c(0,"div",12),_("click",function(){let t=C(i).$implicit,o=p(3);return h(o.addToQuickInbox(t))}),b(1,"cx-media",13),c(2,"span",14),g(3),l(),b(4,"span",15),l()}if(n&2){let i=r.$implicit;a(),s("alt",i.summary)("container",i.images==null?null:i.images.PRIMARY),a(2),I(i.code),a(),s("innerHTML",i.nameHtml,Ke)}}function xi(n,r){if(n&1){let i=y();T(0),c(1,"div",9)(2,"div",10),_("mousedown",function(){C(i);let t=p(2);return h(t.disableClose())}),x(3,fi,5,4,"div",11),l()(),F()}if(n&2){let i=p().ngIf,e=p();a(),s("className",i.isDropdownHidden?"d-none":"cartQuickEntryDrop"),a(2),s("ngForOf",i.result.products)("ngForTrackBy",e.trackByProduct)}}function Si(n,r){if(n&1){let i=y();c(0,"div",2)(1,"div",5)(2,"textarea",6,0),d(4,"cxTranslate"),D("ngModelChange",function(t){C(i);let o=p();return B(o.quickEntry,t)||(o.quickEntry=t),h(t)}),_("blur",function(){C(i);let t=p();return h(t.closeDropDown())}),l(),c(5,"label",7),g(6),d(7,"cxTranslate"),l()(),x(8,xi,4,3,"ng-container",8),l()}if(n&2){let i=r.ngIf,e=p();a(2),s("placeholder",m(4,4,"cartHeader.addArticlePlaceHolder")),k("ngModel",e.quickEntry),a(4),f(" ",m(7,6,"cartHeader.addArticlePlaceHolder")," "),a(2),s("ngIf",(i.result.products==null?null:i.result.products.length)>0)}}var ci=(()=>{let r=class r extends Xt{constructor(){super(...arguments),this.addToCountingList=new E,this.selectedStoragePlace=null}onStoragePlaceChanged(e){this.selectedStoragePlace=e}emitQuickEntries(e){e.length&&(this.addToCountingList.emit({articles:e,storagePlace:this.selectedStoragePlace}),this.quickEntry="")}};r.\u0275fac=(()=>{let e;return function(o){return(e||(e=xe(r)))(o||r)}})(),r.\u0275cmp=A({type:r,selectors:[["foerch-counting-list-quick-add-entry"]],inputs:{storagePlaces:"storagePlaces"},outputs:{addToCountingList:"addToCountingList"},features:[te],decls:10,vars:17,consts:[["quickEntryCart",""],["class","form-group",4,"ngIf"],[1,"form-group"],[3,"storagePlaceChanged","canAdd","placeholder","storagePlaces"],["type","button",1,"btn","btn-primary","btn-block",3,"click","disabled"],[1,"form-floating"],["id","quickEntryCart","rows","1",1,"form-control",3,"ngModelChange","blur","placeholder","ngModel"],["for","quickEntryCart",1,"form-label"],[4,"ngIf"],[3,"className"],[1,"products",3,"mousedown"],["class","cartQuickEntryDropSuggest",3,"click",4,"ngFor","ngForOf","ngForTrackBy"],[1,"cartQuickEntryDropSuggest",3,"click"],["format","thumbnail",3,"alt","container"],[1,"code"],[1,"name",3,"innerHTML"]],template:function(t,o){t&1&&(x(0,Si,9,8,"div",1),d(1,"async"),d(2,"async"),c(3,"div",2)(4,"foerch-storage-place",3),d(5,"cxTranslate"),_("storagePlaceChanged",function(S){return o.onStoragePlaceChanged(S)}),l()(),c(6,"div",2)(7,"button",4),_("click",function(){return o.addToCartFromQuickAddIn()}),g(8),d(9,"cxTranslate"),l()()),t&2&&(s("ngIf",be(14,hi,m(1,6,o.results$),m(2,8,o.isDropdownHidden$))),a(4),s("canAdd",!0)("placeholder",m(5,10,"countingList.addArticles.storagePlace"))("storagePlaces",o.storagePlaces),a(3),s("disabled",o.getQuickEntries().length===0),a(),f(" ",m(9,12,"common.add")," "))},dependencies:[Te,P,gt,M,V,Lt,Z,O,L],encapsulation:2});let n=r;return n})();var bi=function(n,r,i,e){var t=arguments.length,o=t<3?r:e===null?e=Object.getOwnPropertyDescriptor(r,i):e,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,r,i,e);else for(var S=n.length-1;S>=0;S--)(u=n[S])&&(o=(t<3?u(o):t>3?u(r,i,o):u(r,i))||o);return t>3&&o&&Object.defineProperty(r,i,o),o},yi=function(n,r){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,r)};function Ai(n,r){n&1&&(c(0,"div",9),g(1),d(2,"cxTranslate"),l()),n&2&&(a(),f(" ",m(2,1,"countingList.addArticles.headline")," "))}function Li(n,r){if(n&1){let i=y();c(0,"button",10),_("click",function(){C(i);let t=p();return h(t.toggleExpansion())}),c(1,"div",11)(2,"div",12),g(3),d(4,"cxTranslate"),l(),c(5,"div",13),b(6,"cx-icon",14),l()()()}if(n&2){let i=p();a(3),f(" ",m(4,2,"countingList.addArticles.headline")," "),a(3),s("type",i.icons.ARROW_DOWN)}}var G,Re=(G=class{get isCollapsed(){return this.isMobile&&this._isCollapsed}constructor(r,i){this.activeCartService=r,this.modalService=i,this.icons=U,this.copyArticlesFromCostCenter=new E,this.quickAddArticlesAtStoragePlace=new E,this.addCustomerArticlesAtStoragePlace=new E,this.selectedStoragePlace=null,this.selectedCostCenter=null,this._isCollapsed=!0}ngOnInit(){this.costCenters$=this.activeCartService.getAllCostCentersAndOrderReasons().pipe(he(r=>r.filter(i=>i.code!==this.costCenterCode)))}ngOnDestroy(){}toggleExpansion(){this._isCollapsed=!this._isCollapsed}addCustomerArticles(){let r=this.modalService.open(ai);if(r){let i=r.componentInstance;i.storagePlaces=this.storagePlaces,r.result.then(e=>{e!==!1&&e.articles&&e.articles.length>0&&this.addCustomerArticlesAtStoragePlace.emit(e)}).catch(()=>{})}}onAddArticles(r){this.quickAddArticlesAtStoragePlace.emit(r)}onStoragePlaceChanged(r){this.selectedStoragePlace=r}onCopyArticlesFromCostCenter(){this.selectedCostCenter&&this.copyArticlesFromCostCenter.emit(this.selectedCostCenter.code)}},G.\u0275fac=function(i){return new(i||G)(v(Be),v($))},G.\u0275cmp=A({type:G,selectors:[["foerch-counting-list-expansion"]],inputs:{costCenterCode:"costCenterCode",isMobile:"isMobile",storagePlaces:"storagePlaces"},outputs:{copyArticlesFromCostCenter:"copyArticlesFromCostCenter",quickAddArticlesAtStoragePlace:"quickAddArticlesAtStoragePlace",addCustomerArticlesAtStoragePlace:"addCustomerArticlesAtStoragePlace"},decls:15,vars:21,consts:[[1,"cartBox","mx-n2","mx-md-0","mt-2","mt-md-0"],["class","cartBox-head",4,"ngIf"],["class","btn btn-block cartBox-headBtn",3,"click",4,"ngIf"],[1,"cartBox-body",3,"ngbCollapse"],["type","button",1,"btn","btn-link_secondary","py-0","mb-2",3,"click"],[3,"addToCountingList","storagePlaces"],[1,"form-group"],["bindLabel","name",3,"ngModelChange","clearable","items","placeholder","ngModel"],["type","button",1,"btn","btn-primary","btn-block",3,"click","disabled"],[1,"cartBox-head"],[1,"btn","btn-block","cartBox-headBtn",3,"click"],[1,"row"],[1,"col","text-start"],[1,"col-auto"],[3,"type"]],template:function(i,e){i&1&&(c(0,"div",0),x(1,Ai,3,3,"div",1)(2,Li,7,4,"button",2),c(3,"div",3)(4,"button",4),_("click",function(){return e.addCustomerArticles()}),g(5),d(6,"cxTranslate"),l(),c(7,"foerch-counting-list-quick-add-entry",5),_("addToCountingList",function(o){return e.onAddArticles(o)}),l(),c(8,"div",6)(9,"ng-select",7),d(10,"async"),d(11,"cxTranslate"),D("ngModelChange",function(o){return B(e.selectedCostCenter,o)||(e.selectedCostCenter=o),o}),l()(),c(12,"button",8),_("click",function(){return e.onCopyArticlesFromCostCenter()}),g(13),d(14,"cxTranslate"),l()()()),i&2&&(Se("open",!e.isCollapsed),a(),s("ngIf",!e.isMobile),a(),s("ngIf",e.isMobile),a(),s("ngbCollapse",e.isCollapsed),a(2),f(" ",m(6,13,"inventoryOverview.addCustomerArticles")," "),a(2),s("storagePlaces",e.storagePlaces),a(2),s("clearable",!1)("items",m(10,15,e.costCenters$))("placeholder",m(11,17,"countingList.addArticles.copyArticlesFrom")),k("ngModel",e.selectedCostCenter),a(3),s("disabled",!e.selectedCostCenter),a(),f(" ",m(14,19,"countingList.addArticles.copy")," "))},dependencies:[P,M,V,N,R,re,ci,O,L],encapsulation:2,changeDetection:0}),G);Re=bi([we(),yi("design:paramtypes",[Be,$])],Re);var Fi=["foerch-counting-list-item",""],Ii=(n,r,i)=>[n,r,"symbol","1.2",i];function Pi(n,r){if(n&1&&(T(0),g(1),F()),n&2){let i=p(2);a(),f(" ",i.foerchArticleCode," ")}}function Mi(n,r){if(n&1&&(T(0),g(1),F()),n&2){let i=p(2);a(),f(" ",i.item.customArticleCode," ")}}function wi(n,r){if(n&1&&(c(0,"div",8),g(1),l()),n&2){let i=p(2);a(),f(" ",i.item.customArticleCode," ")}}function ki(n,r){if(n&1){let i=y();c(0,"button",9),d(1,"cxTranslate"),_("click",function(){C(i);let t=p(2);return h(t.deleteEntry())}),b(2,"cx-icon",10),l()}if(n&2){let i=p(2);s("title",m(1,2,"countingList.table.icons.delete")),a(2),s("type",i.icons.DELETE)}}function Bi(n,r){if(n&1){let i=y();T(0),c(1,"td")(2,"div",1),x(3,Pi,2,1,"ng-container",0)(4,Mi,2,1,"ng-container",0),l(),x(5,wi,2,1,"div",2),c(6,"div",3),g(7),l()(),c(8,"td")(9,"foerch-storage-place",4),d(10,"cxTranslate"),_("storagePlaceChanged",function(t){C(i);let o=p();return h(o.onStoragePlaceChanged(t))}),l()(),c(11,"td")(12,"span",5),g(13),l()(),c(14,"td")(15,"span",5),g(16),d(17,"currency"),l()(),c(18,"td")(19,"foerch-input",6),_("valueChanged",function(t){C(i);let o=p();return h(o.onArticleActualCountChange(t))}),l()(),c(20,"td"),x(21,ki,3,4,"button",7),l(),F()}if(n&2){let i=p();a(3),s("ngIf",i.foerchArticleCode&&(i.articleNumberMode!==i.articleNumberModes.CUSTOMER||!i.item.customArticleCode)),a(),s("ngIf",i.articleNumberMode===i.articleNumberModes.CUSTOMER&&i.item.customArticleCode),a(),s("ngIf",i.articleNumberMode===i.articleNumberModes.BOTH&&i.item.customArticleCode),a(2),I(i.item.articleName),a(2),s("appendDropdownToBody",!0)("canAdd",!0)("extraClass",i.extraClass)("placeholder",m(10,18,"countingList.addArticles.storagePlace"))("selectedStoragePlace",i.item.storagePlace)("sizingClass","ng-select_sm")("storagePlaces",i.storagePlaces),a(4),I(i.item.articleTargetCount),a(3),I(Ae(17,20,ye(26,Ii,i.item.articleTargetAmount,i.currency,i.localeCode))),a(3),s("extraClass",i.inputClass)("inputId","actualCount_"+i.item.articleCode)("onlyDigits",!0)("value",i.item.articleActualCount),a(2),s("ngIf",i.item.articleTargetCount===0)}}var Di="is-valid",Oi="is-invalid",Ne=(()=>{let r=class r{get extraClass(){return this.updateSuccessful?Di:this.updateFailed||!this.isValid()?Oi:""}get foerchArticleCode(){return this.item?this.item.supplierAlternativeAID?this.item.supplierAlternativeAID:this.item.articleCode:""}get inputClass(){return`form-control-sm ${this.extraClass}`}constructor(e){this.cd=e,this.icons=U,this.updateSuccessful=!1,this.updateFailed=!1,this.articleNumberMode=me.FOERCH,this.itemUpdated=new E,this.itemDeleted=new E,this.articleNumberModes=me}deleteEntry(){this.itemDeleted.emit(this.item)}updateItem(){this.itemUpdated.emit(this.item)}onArticleActualCountChange(e){this.item=je(qe({},this.item),{articleActualCount:e}),this.cd.detectChanges(),this.isValid()&&this.updateItem()}onStoragePlaceChanged(e){e!==this.item.storagePlace&&(this.item=je(qe({},this.item),{storagePlace:e}),this.updateItem())}isValid(){let e=Number(this.item.articleActualCount);return Number.isNaN(e)?!1:this.item.articleActualCount>=0}};r.\u0275fac=function(t){return new(t||r)(v(Le))},r.\u0275cmp=A({type:r,selectors:[["","foerch-counting-list-item",""]],inputs:{item:"item",currency:"currency",localeCode:"localeCode",storagePlaces:"storagePlaces",updateSuccessful:"updateSuccessful",updateFailed:"updateFailed",articleNumberMode:"articleNumberMode"},outputs:{itemUpdated:"itemUpdated",itemDeleted:"itemDeleted"},attrs:Fi,decls:1,vars:1,consts:[[4,"ngIf"],[1,"countingList-code"],["class","countingList-customcode",4,"ngIf"],[1,"countingList-desc"],[3,"storagePlaceChanged","appendDropdownToBody","canAdd","extraClass","placeholder","selectedStoragePlace","sizingClass","storagePlaces"],[1,"text-small"],["type","number",3,"valueChanged","extraClass","inputId","onlyDigits","value"],["class","btn-icon","type","button",3,"title","click",4,"ngIf"],[1,"countingList-customcode"],["type","button",1,"btn-icon",3,"click","title"],[3,"type"]],template:function(t,o){t&1&&x(0,Bi,22,30,"ng-container",0),t&2&&s("ngIf",o.item)},dependencies:[P,N,ke,Z,Fe,L],encapsulation:2,changeDetection:0});let n=r;return n})();var Ri=n=>({active:n}),Ni=(n,r,i)=>[n,r,"symbol","1.2",i];function Ui(n,r){if(n&1&&(T(0),g(1),F()),n&2){let i=p(2);a(),f(" ",i.item.articleCode," ")}}function Wi(n,r){if(n&1&&(T(0),g(1),F()),n&2){let i=p(2);a(),I(i.item.customArticleCode)}}function qi(n,r){if(n&1&&(c(0,"div",16),g(1),l()),n&2){let i=p(2);a(),f(" ",i.item.customArticleCode," ")}}function ji(n,r){if(n&1){let i=y();c(0,"button",17),_("click",function(){C(i);let t=p(2);return h(t.deleteEntry())}),b(1,"cx-icon",8),l()}if(n&2){let i=p(2);a(),s("type",i.icons.DELETE)}}function Qi(n,r){if(n&1){let i=y();T(0),c(1,"div",1)(2,"div",2)(3,"div",3),x(4,Ui,2,1,"ng-container",0)(5,Wi,2,1,"ng-container",0),l(),x(6,qi,2,1,"div",4),c(7,"div",5),g(8),l()(),c(9,"div",6)(10,"button",7),_("click",function(){C(i);let t=p();return h(t.toggleExpansion())}),b(11,"cx-icon",8),l()()(),c(12,"div",9)(13,"div",1)(14,"div",10)(15,"small"),g(16),d(17,"cxTranslate"),l(),c(18,"div",3),g(19),l()(),c(20,"div",2)(21,"small"),g(22),d(23,"cxTranslate"),l(),c(24,"div",3),g(25),d(26,"currency"),l()(),c(27,"div",6),x(28,ji,2,1,"button",11),l()(),c(29,"div",12)(30,"div",10)(31,"foerch-input",13),d(32,"cxTranslate"),_("valueChanged",function(t){C(i);let o=p();return h(o.onArticleActualCountChange(t))}),l()(),c(33,"div",14)(34,"foerch-storage-place",15),d(35,"cxTranslate"),_("storagePlaceChanged",function(t){C(i);let o=p();return h(o.onStoragePlaceChanged(t))}),l()()()(),F()}if(n&2){let i=p();a(4),s("ngIf",i.articleNumberMode!==i.articleNumberModes.CUSTOMER||!i.item.customArticleCode),a(),s("ngIf",i.articleNumberMode===i.articleNumberModes.CUSTOMER&&i.item.customArticleCode),a(),s("ngIf",i.articleNumberMode===i.articleNumberModes.BOTH&&i.item.customArticleCode),a(2),f(" ",i.item.articleName," "),a(2),s("ngClass",ne(36,Ri,i.isExpanded)),a(),s("type",i.icons.ARROW_DOWN),a(),s("ngbCollapse",!i.isExpanded),a(4),f(" ",m(17,22,"countingList.mobile.targetCount")," "),a(3),I(i.item.articleTargetCount),a(3),f(" ",m(23,24,"countingList.table.targetValue")," "),a(3),f(" ",Ae(26,26,ye(38,Ni,i.item.articleTargetAmount,i.currency,i.localeCode))," "),a(3),s("ngIf",i.item.articleTargetCount===0),a(3),s("extraClass",i.extraClass)("inputId","actualCount_"+i.item.articleCode)("labelAndPlaceholder",m(32,32,"countingList.mobile.actualCount"))("onlyDigits",!0)("value",i.item.articleActualCount),a(3),s("canAdd",!0)("extraClass",i.extraClass)("placeholder",m(35,34,"countingList.addArticles.storagePlace"))("selectedStoragePlace",i.item.storagePlace)("storagePlaces",i.storagePlaces)}}var li=(()=>{let r=class r extends Ne{constructor(){super(...arguments),this.isExpanded=!1}toggleExpansion(){this.isExpanded=!this.isExpanded}};r.\u0275fac=(()=>{let e;return function(o){return(e||(e=xe(r)))(o||r)}})(),r.\u0275cmp=A({type:r,selectors:[["foerch-counting-list-item-mobile"]],features:[te],decls:1,vars:1,consts:[[4,"ngIf"],[1,"row"],[1,"col"],[1,"text-small"],["class","countingList-customcode",4,"ngIf"],[1,"countingList-desc"],[1,"col-auto"],[1,"btn-icon","cartEntry-action-arrow",3,"click","ngClass"],[3,"type"],[1,"mt-2",3,"ngbCollapse"],[1,"col-4","pe-0"],["class","btn-icon","type","button",3,"click",4,"ngIf"],[1,"row","mt-2"],["type","number",3,"valueChanged","extraClass","inputId","labelAndPlaceholder","onlyDigits","value"],[1,"col-8"],[3,"storagePlaceChanged","canAdd","extraClass","placeholder","selectedStoragePlace","storagePlaces"],[1,"countingList-customcode"],["type","button",1,"btn-icon",3,"click"]],template:function(t,o){t&1&&x(0,Qi,36,42,"ng-container",0),t&2&&s("ngIf",o.item)},dependencies:[Ee,P,N,re,ke,Z,Fe,L],encapsulation:2,changeDetection:0});let n=r;return n})();var Xi=function(n,r,i,e){var t=arguments.length,o=t<3?r:e===null?e=Object.getOwnPropertyDescriptor(r,i):e,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,r,i,e);else for(var S=n.length-1;S>=0;S--)(u=n[S])&&(o=(t<3?u(o):t>3?u(r,i,o):u(r,i))||o);return t>3&&o&&Object.defineProperty(r,i,o),o},Zi=function(n,r){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,r)},Gi=()=>({count:0}),zi=()=>({count:1});function Yi(n,r){n&1&&(c(0,"div",11),g(1),d(2,"cxTranslate"),l()),n&2&&(a(),f(" ",m(2,1,"countingList.quickActions.headline")," "))}function Ki(n,r){if(n&1){let i=y();c(0,"button",12),_("click",function(){C(i);let t=p();return h(t.toggleExpansion())}),c(1,"div",13)(2,"div",14),g(3),d(4,"cxTranslate"),l(),c(5,"div",15),b(6,"cx-icon",9),l()()()}if(n&2){let i=p();a(3),f(" ",m(4,2,"countingList.quickActions.headline")," "),a(3),s("type",i.icons.ARROW_DOWN)}}function Ji(n,r){if(n&1){let i=y();c(0,"button",16),_("click",function(){C(i);let t=p();return h(t.triggerExport(t.quickActionOption.GENERATE_BARCODE_CATALOG))}),c(1,"div",17),b(2,"cx-icon",9),l(),g(3),d(4,"cxTranslate"),l()}if(n&2){let i=p();a(2),s("type",i.icons.EXPORT),a(),f(" ",m(4,2,"countingList.quickActions.generateBarcodeCatalogFromCountingList")," ")}}var w=function(n){return n[n.SET_TO_ZERO=0]="SET_TO_ZERO",n[n.SET_TO_ONE=1]="SET_TO_ONE",n[n.DELETE_IF_ZERO=2]="DELETE_IF_ZERO",n[n.EXPORT_AS_PDF=3]="EXPORT_AS_PDF",n[n.EXPORT_WITHOUT_IMAGES=4]="EXPORT_WITHOUT_IMAGES",n[n.EXPORT_AS_XLS=5]="EXPORT_AS_XLS",n[n.GENERATE_BARCODE_CATALOG=6]="GENERATE_BARCODE_CATALOG",n}(w||{}),z,Ue=(z=class{get isCollapsed(){return this.isMobile&&this._isCollapsed}constructor(r,i,e){this._permissionsService=r,this._countingListService=i,this._barcodeCatalogItemService=e,this.icons=U,this.updateArticlesCount=new E,this.deleteArticlesWithZero=new E,this.exportAsPDF=new E,this.exportAsXLS=new E,this.exportWithoutImages=new E,this.quickActionOption=w,this.selectedOption=w.SET_TO_ZERO,this.pendingAction=null,this._isCollapsed=!0,this.showBarcodeCatalog$=this._permissionsService.getPermissionValueAsBoolean(Me.ACTIVATE_WEBSHOP_BARCODE_CATALOG)}ngOnDestroy(){}toggleExpansion(){this._isCollapsed=!this._isCollapsed}applyQuickAction(){switch(this.selectedOption){case w.SET_TO_ZERO:{this.updateArticlesCount.emit(0);break}case w.SET_TO_ONE:{this.updateArticlesCount.emit(1);break}case w.DELETE_IF_ZERO:{this.deleteArticlesWithZero.emit();break}default:break}}triggerExport(r){switch(r){case w.EXPORT_AS_PDF:{this.pendingAction=w.EXPORT_AS_PDF,this.exportAsPDF.emit();break}case w.EXPORT_WITHOUT_IMAGES:{this.pendingAction=w.EXPORT_WITHOUT_IMAGES,this.exportWithoutImages.emit();break}case w.EXPORT_AS_XLS:{this.pendingAction=w.EXPORT_AS_XLS,this.exportAsXLS.emit();break}case w.GENERATE_BARCODE_CATALOG:{this._countingListService.getEntriesForBarcodeCatalog(this.costCenter.code).pipe(pe(1)).subscribe(i=>{let e={name:this.catalogName,costCenters:[this.costCenter],entries:i};this._barcodeCatalogItemService.presetBarcodeCatalog(e)});break}default:break}}},z.\u0275fac=function(i){return new(i||z)(v(oe),v(H),v(De))},z.\u0275cmp=A({type:z,selectors:[["foerch-counting-list-quick-actions"]],inputs:{isMobile:"isMobile",costCenter:"costCenter",catalogName:"catalogName"},outputs:{updateArticlesCount:"updateArticlesCount",deleteArticlesWithZero:"deleteArticlesWithZero",exportAsPDF:"exportAsPDF",exportAsXLS:"exportAsXLS",exportWithoutImages:"exportWithoutImages"},decls:33,vars:45,consts:[[1,"cartBox","mx-n2","mx-md-0"],["class","cartBox-head",4,"ngIf"],["class","btn btn-block cartBox-headBtn",3,"click",4,"ngIf"],[1,"cartBox-body",3,"ngbCollapse"],[1,"form-group"],[3,"ngModelChange","clearable","placeholder","searchable","ngModel"],[3,"value"],["type","button",1,"btn","btn-primary","btn-block","mb-lg-3","mb-2",3,"click"],[1,"btn","btn-link","cartBox-link",3,"click"],[3,"type"],["class","btn btn-link cartBox-link d-flex",3,"click",4,"ngIf"],[1,"cartBox-head"],[1,"btn","btn-block","cartBox-headBtn",3,"click"],[1,"row"],[1,"col","text-start"],[1,"col-auto"],[1,"btn","btn-link","cartBox-link","d-flex",3,"click"],[1,"align-self-start"]],template:function(i,e){i&1&&(c(0,"div",0),x(1,Yi,3,3,"div",1)(2,Ki,7,4,"button",2),c(3,"div",3)(4,"div",4)(5,"ng-select",5),d(6,"cxTranslate"),D("ngModelChange",function(o){return B(e.selectedOption,o)||(e.selectedOption=o),o}),c(7,"ng-option",6),g(8),d(9,"cxTranslate"),l(),c(10,"ng-option",6),g(11),d(12,"cxTranslate"),l(),c(13,"ng-option",6),g(14),d(15,"cxTranslate"),l()()(),c(16,"button",7),_("click",function(){return e.applyQuickAction()}),g(17),d(18,"cxTranslate"),l(),c(19,"button",8),_("click",function(){return e.triggerExport(e.quickActionOption.EXPORT_AS_PDF)}),b(20,"cx-icon",9),g(21),d(22,"cxTranslate"),l(),c(23,"button",8),_("click",function(){return e.triggerExport(e.quickActionOption.EXPORT_WITHOUT_IMAGES)}),b(24,"cx-icon",9),g(25),d(26,"cxTranslate"),l(),c(27,"button",8),_("click",function(){return e.triggerExport(e.quickActionOption.EXPORT_AS_XLS)}),b(28,"cx-icon",9),g(29),d(30,"cxTranslate"),l(),x(31,Ji,5,4,"button",10),d(32,"async"),l()()),i&2&&(Se("open",!e.isCollapsed),a(),s("ngIf",!e.isMobile),a(),s("ngIf",e.isMobile),a(),s("ngbCollapse",e.isCollapsed),a(2),s("clearable",!1)("placeholder",m(6,23,"countingList.quickActions.chooseQuickAction"))("searchable",!1),k("ngModel",e.selectedOption),a(2),s("value",e.quickActionOption.SET_TO_ZERO),a(),I(J(9,25,"countingList.quickActions.setAllArticlesTo",K(43,Gi))),a(2),s("value",e.quickActionOption.SET_TO_ONE),a(),I(J(12,28,"countingList.quickActions.setAllArticlesTo",K(44,zi))),a(2),s("value",e.quickActionOption.DELETE_IF_ZERO),a(),I(m(15,31,"countingList.quickActions.deleteAllArticlesIfZero")),a(3),f(" ",m(18,33,"common.apply")," "),a(3),s("type",e.icons.PDF),a(),f(" ",m(22,35,"countingList.quickActions.exportCountingListAsPDF")," "),a(3),s("type",e.icons.PURCHASE_ORDER),a(),f(" ",m(26,37,"countingList.quickActions.exportCountingListWithoutImages")," "),a(3),s("type",e.icons.XLS),a(),f(" ",m(30,39,"countingList.quickActions.exportCountingListAsXLS")," "),a(2),s("ngIf",m(32,41,e.showBarcodeCatalog$)))},dependencies:[P,M,V,N,R,vt,re,O,L],encapsulation:2,changeDetection:0}),z);Ue=Xi([we(),Zi("design:paramtypes",[oe,H,De])],Ue);var tn=(n,r)=>({currencyCode:n,localeCode:r}),He=n=>({costCenterName:n}),nn=()=>({}),pi=()=>["/","my-account","inventory"];function on(n,r){if(n&1){let i=y();T(0),c(1,"button",14),b(2,"cx-icon",15),g(3),d(4,"cxTranslate"),l(),c(5,"h3"),g(6),d(7,"cxTranslate"),l(),c(8,"button",16),_("click",function(){C(i);let t=p(3);return h(t.resetCountingList())}),g(9),d(10,"cxTranslate"),l(),c(11,"button",17),_("click",function(){C(i);let t=p(3);return h(t.closeCountingList())}),g(12),d(13,"cxTranslate"),l(),F()}if(n&2){let i=p(3);a(),s("routerLink",K(15,pi)),a(),s("type",i.icons.ARROW_LEFT),a(),f(" ",m(4,6,"common.back")," "),a(3),f(" ",J(7,8,"countingList.countingListOfCostCenter",ne(16,He,i.costCenter.name))," "),a(3),f(" ",m(10,11,"common.reset")," "),a(3),f(" ",m(13,13,"countingList.finalizeInventoryReport")," ")}}function rn(n,r){n&1&&ve(0)}function an(n,r){if(n&1&&(c(0,"div",18),x(1,rn,1,0,"ng-container",19),l()),n&2){p(2);let i=Y(9);a(),s("ngTemplateOutlet",i)}}function cn(n,r){n&1&&ve(0)}function sn(n,r){n&1&&(c(0,"div")(1,"div",23),b(2,"cx-spinner",24),l()())}function ln(n,r){if(n&1){let i=y();c(0,"foerch-counting-list-item-mobile",28),_("itemDeleted",function(t){C(i);let o=p(5);return h(o.onDeleteEntry(t))})("itemUpdated",function(t){C(i);let o=p(5);return h(o.onUpdateEntry(t))}),l()}if(n&2){let i=r.$implicit,e=p(4).ngIf,t=p();s("articleNumberMode",t.articleNumberMode)("currency",e.currencyCode)("item",i)("localeCode",e.localeCode)("storagePlaces",t.storagePlaces)("updateFailed",i.pk===t.failedCode)("updateSuccessful",i.pk===t.successCode)}}function pn(n,r){if(n&1){let i=y();T(0),c(1,"div",25),x(2,ln,1,7,"foerch-counting-list-item-mobile",26),l(),c(3,"foerch-paging",27),_("viewChangePageEvent",function(t){C(i);let o=p(4);return h(o.onChangePageNumber(t))}),l(),F()}if(n&2){let i=p(4);a(2),s("ngForOf",i.entries)("ngForTrackBy",i.trackByItem),a(),s("buttonLabel","countingList.mobile.loadMore")("isMobile",!0)("pagination",i.pagination)}}function dn(n,r){if(n&1){let i=y();T(0),x(1,sn,3,0,"div",4),c(2,"div",20)(3,"div",21)(4,"ng-select",22),D("ngModelChange",function(t){C(i);let o=p(3);return B(o.selectedSortMobile,t)||(o.selectedSortMobile=t),h(t)}),_("change",function(t){C(i);let o=p(3);return h(o.onMobileChangeSortModel(t))}),l()()(),x(5,pn,4,5,"ng-container",5),F()}if(n&2){p(2);let i=Y(5),e=p();a(),s("ngIf",e.isLoading),a(3),s("clearable",!1)("items",e.mobileSortItems)("searchable",!1),k("ngModel",e.selectedSortMobile),a(),s("ngIf",e.entries.length>0)("ngIfElse",i)}}function mn(n,r){if(n&1){let i=y();T(0),x(1,on,14,18,"ng-container",5),c(2,"div",6)(3,"div",7)(4,"foerch-counting-list-quick-actions",8),d(5,"cxTranslate"),_("deleteArticlesWithZero",function(){C(i);let t=p(2);return h(t.onDeleteArticlesWithZero())})("exportAsPDF",function(){C(i);let t=p(2);return h(t.onExportAsPDF())})("exportAsXLS",function(){C(i);let t=p(2);return h(t.onExportAsXLS())})("exportWithoutImages",function(){C(i);let t=p(2);return h(t.onExportWithoutImages())})("updateArticlesCount",function(t){C(i);let o=p(2);return h(o.updateArticlesCountTo(t))}),l()(),c(6,"div",7)(7,"foerch-counting-list-expansion",9),_("addCustomerArticlesAtStoragePlace",function(t){C(i);let o=p(2);return h(o.onAddCustomerArticlesAtStoragePlace(t))})("copyArticlesFromCostCenter",function(t){C(i);let o=p(2);return h(o.onCopyArticlesFromCostCenter(t))})("quickAddArticlesAtStoragePlace",function(t){C(i);let o=p(2);return h(o.onQuickAddArticlesAtStoragePlace(t))}),l()()(),c(8,"div",10)(9,"div",11)(10,"foerch-search-input",12),_("searchString",function(t){C(i);let o=p(2);return h(o.onChangeSearchString(t))}),l()(),x(11,an,2,1,"div",13),l(),x(12,cn,1,0,"ng-container",4)(13,dn,6,7,"ng-container",5),F()}if(n&2){p();let i=Y(3),e=Y(7),t=p();a(),s("ngIf",t.isMobile)("ngIfElse",e),a(3),s("catalogName",J(5,14,"countingList.countingListOfCostCenter",ne(17,He,t.costCenter.name)))("costCenter",t.costCenter)("isMobile",t.isMobile),a(3),s("costCenterCode",t.costCenterCode)("isMobile",t.isMobile)("storagePlaces",t.storagePlaces),a(3),s("initialValue",t.query)("placeholder","countingList.searchForArticles"),a(),s("ngIf",!t.isMobile),a(),s("ngIf",K(19,nn)),a(),s("ngIf",t.isMobile)("ngIfElse",i)}}function un(n,r){n&1&&(c(0,"div")(1,"div",23),b(2,"cx-spinner",24),l()())}function gn(n,r){if(n&1){let i=y();c(0,"tr",40),_("itemDeleted",function(t){C(i);let o=p(4);return h(o.onDeleteEntry(t))})("itemUpdated",function(t){C(i);let o=p(4);return h(o.onUpdateEntry(t))}),l()}if(n&2){let i=r.$implicit,e=p(3).ngIf,t=p();s("articleNumberMode",t.articleNumberMode)("currency",e.currencyCode)("item",i)("localeCode",e.localeCode)("storagePlaces",t.storagePlaces)("updateFailed",i.pk===t.failedCode)("updateSuccessful",i.pk===t.successCode)}}function _n(n,r){n&1&&ve(0)}function Cn(n,r){if(n&1){let i=y();T(0),c(1,"div",29)(2,"foerch-table-reset",30),_("resetSorting",function(){C(i);let t=p(3);return h(t.onSortingReset())}),l(),c(3,"table",31)(4,"thead")(5,"tr")(6,"th")(7,"foerch-table-sort",32),d(8,"cxTranslate"),_("changeSorting",function(t){C(i);let o=p(3);return h(o.onChangeSortModel(t))}),l(),c(9,"foerch-table-sort",33),d(10,"cxTranslate"),_("changeSorting",function(t){C(i);let o=p(3);return h(o.onChangeSortModel(t))}),l()(),c(11,"th",34)(12,"foerch-table-sort",35),d(13,"cxTranslate"),_("changeSorting",function(t){C(i);let o=p(3);return h(o.onChangeSortModel(t))}),l()(),c(14,"th")(15,"foerch-table-sort",36),d(16,"cxTranslate"),_("changeSorting",function(t){C(i);let o=p(3);return h(o.onChangeSortModel(t))}),l()(),c(17,"th"),g(18),d(19,"cxTranslate"),l(),c(20,"th")(21,"foerch-table-sort",37),d(22,"cxTranslate"),_("changeSorting",function(t){C(i);let o=p(3);return h(o.onChangeSortModel(t))}),l()(),c(23,"th",38),g(24),d(25,"cxTranslate"),l()()(),c(26,"tbody"),x(27,gn,1,7,"tr",39),l()()(),c(28,"div",10)(29,"div",18),x(30,_n,1,0,"ng-container",19),l()(),F()}if(n&2){p(2);let i=Y(9),e=p();a(2),s("enabled",e.hasActiveSorting),a(5),ie("title",m(8,16,"countingList.table.articleNumber")),s("sortModel",e.sortModel),a(2),ie("title",m(10,18,"countingList.table.articleName")),s("sortModel",e.sortModel),a(3),ie("title",m(13,20,"countingList.table.storagePlace")),s("sortModel",e.sortModel),a(3),ie("title",m(16,22,"countingList.table.targetCount")),s("sortModel",e.sortModel),a(3),f(" ",m(19,24,"countingList.table.targetValue")," "),a(3),ie("title",m(22,26,"countingList.table.actualCount")),s("sortModel",e.sortModel),a(3),f(" ",m(25,28,"countingList.table.action")," "),a(3),s("ngForOf",e.entries)("ngForTrackBy",e.trackByItem),a(3),s("ngTemplateOutlet",i)}}function hn(n,r){if(n&1&&x(0,un,3,0,"div",4)(1,Cn,31,30,"ng-container",5),n&2){p();let i=Y(5),e=p();s("ngIf",e.isLoading),a(),s("ngIf",e.entries.length>0)("ngIfElse",i)}}function fn(n,r){if(n&1&&(c(0,"div",42)(1,"div",43),g(2),d(3,"cxTranslate"),l()()),n&2){let i=p(3);a(2),f(" ",m(3,1,i.query===""?"countingList.noEntries":"countingList.noMatch")," ")}}function xn(n,r){if(n&1&&x(0,fn,4,3,"div",41),n&2){let i=p(2);s("ngIf",!i.isLoading)}}function Sn(n,r){if(n&1){let i=y();c(0,"div",44)(1,"div",18)(2,"a",45),b(3,"cx-icon",15),g(4),d(5,"cxTranslate"),l(),c(6,"h3"),g(7),d(8,"cxTranslate"),l()(),c(9,"div",46)(10,"button",47),_("click",function(){C(i);let t=p(2);return h(t.resetCountingList())}),g(11),d(12,"cxTranslate"),l()(),c(13,"div",21)(14,"button",48),_("click",function(){C(i);let t=p(2);return h(t.closeCountingList())}),g(15),d(16,"cxTranslate"),l()()()}if(n&2){let i=p(2);a(2),s("routerLink",K(15,pi)),a(),s("type",i.icons.ARROW_LEFT),a(),f(" ",m(5,6,"common.back")," "),a(3),f(" ",J(8,8,"countingList.countingListOfCostCenter",ne(16,He,i.costCenter.name))," "),a(4),f(" ",m(12,11,"common.reset")," "),a(4),f(" ",m(16,13,"countingList.finalizeInventoryReport")," ")}}function vn(n,r){if(n&1){let i=y();c(0,"div",50)(1,"foerch-items-per-page",51),_("itemNumbersChangeEvent",function(t){C(i);let o=p(3);return h(o.onChangePageSize(t))}),l(),c(2,"foerch-paging",52),_("viewChangePageEvent",function(t){C(i);let o=p(3);return h(o.onChangePageNumber(t))}),l()()}if(n&2){let i=p(3);a(),s("countOptions",i.countOptions)("disabled",i.isLoading)("label","countingList.table.itemsPerPage")("pagination",i.pagination),a(),s("disabled",i.isLoading)("isMobile",!1)("label","countingList.pagination.label")("pagination",i.pagination)}}function bn(n,r){if(n&1&&x(0,vn,3,8,"div",49),n&2){let i=p(2);s("ngIf",i.entries.length>0)}}function yn(n,r){if(n&1&&(T(0),x(1,mn,14,20,"ng-container",4)(2,hn,2,3,"ng-template",null,0,de)(4,xn,1,1,"ng-template",null,1,de)(6,Sn,17,18,"ng-template",null,2,de)(8,bn,1,1,"ng-template",null,3,de),F()),n&2){let i=p();a(),s("ngIf",i.costCenter)}}var Lr=(()=>{let r=class r{get costCenterCode(){return this._activatedRoute.snapshot.paramMap.get("uid")}constructor(e,t,o,u,S,ee,se,le,_e,Ce){this._activatedRoute=e,this._breakpointService=t,this._costCenterService=o,this._countingListService=u,this._currencyService=S,this._currencyLocaleService=ee,this._modalService=se,this._permissionsService=le,this._translationService=_e,this._cd=Ce,this.icons=U,this.costCenter=null,this.isMobile=!0,this.entries=[],this.successCode=null,this.failedCode=null,this.query="",this.countOptions=[10,20,50,100],this.pageSize=this.countOptions[1],this.defaultSortModel={sortBy:"articlenumber",sortDirection:Et.ASC},this.sortModel=this.defaultSortModel,this.hasActiveSorting=!1,this.mobileSortItems=[],this.storagePlaces=[],this.currency$=this._currencyService.getActive(),this.locale$=this._currencyLocaleService.getActiveLocaleForCurrencyPipe(),this.closedCountingListPk=null,this.isLoading=!0,this.articleNumberMode=me.FOERCH,this._subs$=new Xe}ngOnInit(){this._costCenterService.load(this.costCenterCode),this._subs$.add(this._costCenterService.get().subscribe(e=>{this.costCenter=e,this._cd.detectChanges()})),this._subs$.add(this._permissionsService.getPermissionValue(Me.ACTIVATE_WEBSHOP_ARTICLE_NUMBER).subscribe(e=>{e&&(this.articleNumberMode=e,this._cd.detectChanges())})),this._subs$.add(this._countingListService.get().subscribe(e=>{e.costCenterCode!==null&&e.loaded?(this.entries=e.results,this.pagination=e.pagination,this.storagePlaces=e.storagePlaces,this.successCode=e.successCode,this.failedCode=e.failedCode,this.handleClosedCountingList(e.closedCountingList)):(this.entries=[],this.storagePlaces=[],this.successCode=null,this.failedCode=null,this.closedCountingListPk=null),this._cd.detectChanges()})),this._countingListService.load(this.costCenterCode,this.buildQueryStringForFirstPage()),this._subs$.add(this._countingListService.isLoading().subscribe(e=>{this.isLoading=e,this._cd.detectChanges()})),this._subs$.add(this._breakpointService.isEqual(bt.xs).subscribe(e=>this.isMobile=e)),this.prepareMobileSortItems()}ngOnDestroy(){this._subs$.unsubscribe()}trackByItem(e,t){return t.articleCode}resetCountingList(){let e=this._modalService.open(ue);if(e){let t=e.componentInstance;t.title="countingList.resetCountingListModal.title",t.description="countingList.resetCountingListModal.description",t.confirmButtonText="common.reset",e.result.then(o=>{o&&this._countingListService.resetCountingList(this.costCenterCode,this.buildQueryStringForFirstPage())}).catch(()=>{})}}closeCountingList(){let e=this._modalService.open(ue);if(e){let t=e.componentInstance;t.title="countingList.closeCountingListModal.title",t.description="countingList.closeCountingListModal.description",t.confirmButtonText="countingList.finalizeInventoryReport",e.result.then(o=>{o&&this._countingListService.closeCountingList(this.costCenterCode)}).catch(()=>{})}}onChangeSearchString(e){this.query=e,this._countingListService.load(this.costCenterCode,this.buildQueryStringForFirstPage())}updateArticlesCountTo(e){this._countingListService.updateArticlesCount(this.costCenterCode,e,this.buildQueryStringForFirstPage())}onDeleteArticlesWithZero(){this._countingListService.deleteArticlesWithZero(this.costCenterCode,this.buildQueryStringForFirstPage())}onExportAsPDF(){this._countingListService.exportCountingList(this.costCenterCode,Pe.AS_PDF,this.getSortBy())}onExportAsXLS(){this._countingListService.exportCountingList(this.costCenterCode,Pe.AS_XLS,this.getSortBy())}onExportWithoutImages(){this._countingListService.exportCountingList(this.costCenterCode,Pe.WITHOUT_IMAGES,this.getSortBy())}onQuickAddArticlesAtStoragePlace(e){let t=e.articles.map(o=>o.code);this._countingListService.addArticles(this.costCenterCode,t,e.storagePlace)}onAddCustomerArticlesAtStoragePlace(e){this._countingListService.addCustomArticles(this.costCenterCode,e.articles,e.storagePlace)}onCopyArticlesFromCostCenter(e){this._countingListService.copyArticlesFromCostCenter(this.costCenterCode,e)}onDeleteEntry(e){this._countingListService.deleteEntry(this.costCenterCode,e,this.isMobile?this.buildQueryStringForFirstPage():this.buildQueryString())}onUpdateEntry(e){this._countingListService.updateEntry(this.costCenterCode,e,this.buildQueryString(),this.isMobile)}onChangePageSize(e){this.pageSize=e;let t=this.buildQueryStringForFirstPage();this._countingListService.load(this.costCenterCode,t)}onChangePageNumber(e){let t=this.buildQueryString(e);this.isMobile?this._countingListService.loadAndAppend(this.costCenterCode,t):this._countingListService.load(this.costCenterCode,t)}onChangeSortModel(e,t=!0){t&&(this.hasActiveSorting=!0),this.sortModel=e,this._countingListService.load(this.costCenterCode,this.buildQueryStringForFirstPage())}onMobileChangeSortModel(e){let t=e.value.split("_");this.sortModel={sortBy:t[0],sortDirection:t[1]},this.onChangeSortModel(this.sortModel)}onSortingReset(){this.hasActiveSorting=!1,this.onChangeSortModel(this.defaultSortModel,!1)}prepareMobileSortItems(){this._subs$.add(Ze([this._translationService.translate("countingList.table.articleNumber"),this._translationService.translate("countingList.table.articleName"),this._translationService.translate("countingList.table.storagePlace"),this._translationService.translate("countingList.mobile.targetCount"),this._translationService.translate("countingList.mobile.actualCount"),this._translationService.translate("common.sorting"),this._translationService.translate("common.asc"),this._translationService.translate("common.desc"),this._translationService.translate("common.dateAsc"),this._translationService.translate("common.dateDesc")]).subscribe(([e,t,o,u,S,ee,se,le,_e,Ce])=>{this.mobileSortItems=[[e,"articlenumber",se,"ASC",le,"DESC"],[t,"name",se,"ASC",le,"DESC"],[o,"name",se,"ASC",le,"DESC"],[u,"targetcount",_e,"ASC",Ce,"DESC"],[S,"actualcount",_e,"ASC",Ce,"DESC"]].reduce((We,Q)=>(We.push({name:`${ee}: ${Q[0]} ${Q[2]}`,value:`${Q[1]}_${Q[3]}`}),We.push({name:`${ee}: ${Q[0]} ${Q[4]}`,value:`${Q[1]}_${Q[5]}`}),We),[]),this.selectedSortMobile=this.mobileSortItems[0].value}))}handleClosedCountingList(e){if(e&&e!==this.closedCountingListPk){this.closedCountingListPk=e;let t=this._modalService.open(oi);if(t){let o=t.componentInstance;o.countingListPk=this.closedCountingListPk,t.result.then(u=>{u&&o.share(),o.navigateToInventory()}).catch(()=>{})}}}buildQueryStringForFirstPage(){return this.buildQueryString(0)}buildQueryString(e=null){let t=[],o=this.query.trim();return o.length>0&&t.push(`query=${o}`),e!==null?t.push(`page=${e}`):this.pagination&&t.push(`page=${this.pagination.page}`),t.push(`pageSize=${this.pageSize}`),this.sortModel&&t.push(this.getSortBy()),t.length>0?`${t.join("&")}`:""}getSortBy(){return`sort=by_${this.sortModel.sortBy}:${this.sortModel.sortDirection.toLowerCase()}`}};r.\u0275fac=function(t){return new(t||r)(v(nt),v(At),v(Kt),v(H),v(dt),v(Yt),v($),v(oe),v(mt),v(Le))},r.\u0275cmp=A({type:r,selectors:[["foerch-counting-list"]],decls:3,vars:8,consts:[["desktopVersion",""],["noEntries",""],["desktopHeader",""],["desktopPagination",""],[4,"ngIf"],[4,"ngIf","ngIfElse"],[1,"row","mb-3"],[1,"col-md-6"],[3,"deleteArticlesWithZero","exportAsPDF","exportAsXLS","exportWithoutImages","updateArticlesCount","catalogName","costCenter","isMobile"],[3,"addCustomerArticlesAtStoragePlace","copyArticlesFromCostCenter","quickAddArticlesAtStoragePlace","costCenterCode","isMobile","storagePlaces"],[1,"row"],[1,"col","col-md-5"],[3,"searchString","initialValue","placeholder"],["class","col",4,"ngIf"],["type","button",1,"btn","btn-tertiary","btn-back",3,"routerLink"],[3,"type"],["type","button",1,"btn","btn-secondary","btn-block","mt-3","mw-sm-only-400","mb-2",3,"click"],["type","button",1,"btn","btn-primary","btn-block","mw-sm-only-400","mb-3",3,"click"],[1,"col"],[4,"ngTemplateOutlet"],[1,"row","mb-1"],[1,"col-auto"],["bindLabel","name","bindValue","value","labelForId","purchasedArticlesSortingDropDown",1,"ng-select_alt",3,"ngModelChange","change","clearable","items","searchable","ngModel"],[1,"spinnerOverlayWrapper"],[1,"spinner_overlay"],[1,"countingList-wrapper","mx-n2"],[3,"articleNumberMode","currency","item","localeCode","storagePlaces","updateFailed","updateSuccessful","itemDeleted","itemUpdated",4,"ngFor","ngForOf","ngForTrackBy"],[3,"viewChangePageEvent","buttonLabel","isMobile","pagination"],[3,"itemDeleted","itemUpdated","articleNumberMode","currency","item","localeCode","storagePlaces","updateFailed","updateSuccessful"],[1,"cartTable-wrapper"],[3,"resetSorting","enabled"],[1,"cartTable"],["sortBy","articlenumber",3,"changeSorting","title","sortModel"],["sortBy","name",3,"changeSorting","title","sortModel"],[1,"w-25"],["sortBy","storagepoint",3,"changeSorting","title","sortModel"],["sortBy","targetcount",3,"changeSorting","title","sortModel"],["sortBy","actualcount",3,"changeSorting","title","sortModel"],[1,"cartTable-iconsCol"],["foerch-counting-list-item","",3,"articleNumberMode","currency","item","localeCode","storagePlaces","updateFailed","updateSuccessful","itemDeleted","itemUpdated",4,"ngFor","ngForOf","ngForTrackBy"],["foerch-counting-list-item","",3,"itemDeleted","itemUpdated","articleNumberMode","currency","item","localeCode","storagePlaces","updateFailed","updateSuccessful"],["class","emptyState",4,"ngIf"],[1,"emptyState"],[1,"emptyState-text"],[1,"row","g-0","mb-3"],[1,"btn","btn-tertiary","btn-back",3,"routerLink"],[1,"col-auto","pe-2"],["type","button",1,"btn","btn-secondary","btn-block",3,"click"],["type","button",1,"btn","btn-primary","btn-block",3,"click"],["class","countingList-pagination",4,"ngIf"],[1,"countingList-pagination"],[3,"itemNumbersChangeEvent","countOptions","disabled","label","pagination"],[3,"viewChangePageEvent","disabled","isMobile","label","pagination"]],template:function(t,o){t&1&&(x(0,yn,10,1,"ng-container",4),d(1,"async"),d(2,"async")),t&2&&s("ngIf",be(5,tn,m(1,1,o.currency$),m(2,3,o.locale$)))},dependencies:[Te,P,et,rt,M,V,N,yt,R,Ht,Zt,zt,Gt,Qt,Re,Ne,li,Ue,O,L],encapsulation:2,changeDetection:0});let n=r;return n})();export{Oe as a,ei as b,Lr as c};