import{b as j,c as re,e as C}from"./chunk-54S7S4VK.js";import{b as P}from"./chunk-AJTKPNL2.js";import{a as oe}from"./chunk-F5MI6XGL.js";import{b as E}from"./chunk-24R2E2EJ.js";import{a as ne}from"./chunk-IXB4YWKF.js";import{w as o,x as O}from"./chunk-7YTVARFL.js";import{d as N}from"./chunk-7PKMSCVL.js";import{a as ie}from"./chunk-RVEFR64E.js";import{t as k}from"./chunk-S332DHRQ.js";import{I as ee,La as S,Ma as te}from"./chunk-QHAVDXDG.js";import{S as Z,ba as M,z as x}from"./chunk-27KSTDMK.js";import{s as K,u as X,y,z as B}from"./chunk-GQAU5ACB.js";import{Ae as q,Bb as r,Ea as Q,Ec as v,Ib as h,Jc as A,Lc as z,Mb as R,Nb as D,Sd as W,Xc as U,Yc as $,Zc as V,ac as F,af as J,cc as L,fd as G,gd as Y,hc as s,ic as d,jc as p,kc as f,kd as g,qa as H,rc as I,sb as u,tc as _,vc as l,ya as b,yd as w,za as T}from"./chunk-ISMRT7VU.js";function ae(i){return[{dataField:"date",caption:i("\u041F\u0430\u0440\u0442\u0438\u0438"),calculateCellValue:a=>`${i("\u041F\u0430\u0440\u0442\u0438\u044F \u043E\u0442")} ${k(new Date(a.date),"dd.MM.yyyy")}`},{dataField:"basisDocumentType",caption:i("\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435"),isCustom:!0},{dataField:"cost",caption:`${i("\u0417\u0430\u043A\u0443\u043F\u043E\u0447\u043D\u0430\u044F \u0446\u0435\u043D\u0430")}, \u20B8`,alignment:"right",numericPrecision:2,width:"14%"},{dataField:"initialQuantity",caption:i("\u041F\u0435\u0440\u0432\u043E\u043D\u0430\u0447\u0430\u043B\u044C\u043D\u043E\u0435 \u043A\u043E\u043B-\u0432\u043E"),alignment:"right",width:"18%"},{dataField:"currentQuantity",caption:i("\u041E\u0441\u0442\u0430\u0442\u043E\u043A"),alignment:"right",width:"12%"}]}var _e=i=>({basisDocumentType:i});function he(i,a){if(i&1&&(d(0,"div",4),f(1,"wk-badge",5),G(2,"translate"),p()),i&2){let e=l();u(),s("icon",e.iconRemain)("text",Y(2,2,"\u041E\u0431\u0449\u0438\u0439 \u043E\u0441\u0442\u0430\u0442\u043E\u043A:")+e.commonRemain)}}function ve(i,a){if(i&1){let e=I();d(0,"wk-link",6),_("click",function(){let n=b(e).$implicit,c=l();return T(c.openDocumentDrawer(n.basisDocumentType,n.basisDocumentId))}),p()}if(i&2){let e=a.$implicit,t=l();s("text",t.getDocumentTypeNames(e.basisDocumentType))}}var le=(()=>{class i extends P{constructor(e,t,n,c,m){super(c,m),this._productRemainsService=e,this._documentTypeService=t,this._localizationService=n,this.productId="",this.iconRemain=te.BoxMultiple,this.isAscending=!1,this.orderBy="date",this.columns=ae(this._localizationService.getSync.bind(this._localizationService))}getLoadMethod(e){return this._productRemainsService.getProductRemainConsignments(this.productId,e)}getDocumentTypeNames(e){return O(this._localizationService.getSync.bind(this._localizationService))[e]}openDocumentDrawer(e,t){e===o.Sell&&this._documentTypeService.viewSellDocument(t),e===o.Acceptance&&this._documentTypeService.viewAcceptance(t),e===o.Movement&&this._documentTypeService.viewMovement(t),e===o.Posting&&this._documentTypeService.viewPosting(t),e===o.WriteOff&&this._documentTypeService.viewWriteOff(t),e===o.Revision&&this._documentTypeService.viewRevision(t),e===o.ReturnSell&&this._documentTypeService.viewReturnDocument(t),e===o.ReturnSupplier&&this._documentTypeService.viewReturnSupplier(t),e===o.ProductionAct&&this._documentTypeService.viewProductionAct(t)}static{this.\u0275fac=function(t){return new(t||i)(r(C),r(E),r(S),r(w),r(M))}}static{this.\u0275cmp=h({type:i,selectors:[["tis-consignment"]],inputs:{productId:"productId",commonRemain:"commonRemain"},features:[R],decls:6,vars:12,consts:[["table",""],["toolbarTmpl",""],["basisDocumentTypeTmpl",""],[3,"enableToolbar","data","columns","enablePagination","enableSpinner","pageNavigation","enableSearch","enableFilters","customToolbarTemplate","customTemplates"],[1,"remain"],["size","large","stylingMode","outlined",3,"icon","text"],[1,"document-link",3,"click","text"]],template:function(t,n){if(t&1&&(f(0,"tis-table",3,0),D(2,he,3,4,"ng-template",null,1,g)(4,ve,1,1,"ng-template",null,2,g)),t&2){let c=v(3),m=v(5);s("enableToolbar",!0)("data",n.dataSource)("columns",n.columns)("enablePagination",!0)("enableSpinner",!0)("pageNavigation",!0)("enableSearch",!1)("enableFilters",!1)("customToolbarTemplate",c)("customTemplates",$(10,_e,m))}},dependencies:[Z,N,y,x,ee],styles:[`.remain[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;justify-content:flex-end}.document-link[_ngcontent-%COMP%]{cursor:pointer}
/*# sourceMappingURL=consignment.component-NPJ4SMR4.css.map */`],changeDetection:0})}}return i})();function pe(i){return[{dataField:"date",caption:i("\u0414\u0430\u0442\u0430"),calculateCellValue:a=>k(new Date(a.changeDate),"dd.MM.yy HH:mm:ss")},{dataField:"basisDocumentType",caption:i("\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435"),isCustom:!0},{dataField:"previousQuantity",caption:i("\u0411\u044B\u043B\u043E"),alignment:"right",calculateCellValue:a=>a.previousQuantity},{dataField:"actualQuantity",caption:i("\u0421\u0442\u0430\u043B\u043E"),alignment:"right",isCustom:!0}]}var ye=(i,a)=>({actualQuantity:i,basisDocumentType:a});function Se(i,a){if(i&1&&(d(0,"span",4),A(1),p(),A(2)),i&2){let e=a.$implicit,t=l();s("ngClass",e.actualQuantity-e.previousQuantity<0?"font-b1-error":"font-b1-success"),u(),z(" (",t.getDifferent(e),")\xA0 "),u(),z(" ",e.actualQuantity,`
`)}}function Ce(i,a){if(i&1){let e=I();d(0,"wk-link",5),_("click",function(){let n=b(e).$implicit,c=l();return T(c.openDocumentDrawer(n.basisDocumentType,n.basisDocumentId))}),p()}if(i&2){let e=a.$implicit,t=l();s("text",t.getDocumentTypeNames(e.basisDocumentType))}}var ue=(()=>{class i extends P{constructor(e,t,n,c,m){super(c,m),this._productRemainsService=e,this._documentTypeService=t,this._localizationService=n,this.productId="",this.isAscending=!1,this.orderBy="date",this.columns=pe(this._localizationService.getSync.bind(this._localizationService))}getLoadMethod(e){return this._productRemainsService.getProductRemainHistory(this.productId,e)}getDifferent(e){let t=(e.actualQuantity-e.previousQuantity)*1e3,n=Math.round(+t)/1e3;return`${n>0?`+${n}`:n}`}getDocumentTypeNames(e){return O(this._localizationService.getSync.bind(this._localizationService))[e]}openDocumentDrawer(e,t){e===o.Sell&&this._documentTypeService.viewSellDocument(t),e===o.Acceptance&&this._documentTypeService.viewAcceptance(t),e===o.Movement&&this._documentTypeService.viewMovement(t),e===o.Posting&&this._documentTypeService.viewPosting(t),e===o.WriteOff&&this._documentTypeService.viewWriteOff(t),e===o.Revision&&this._documentTypeService.viewRevision(t),e===o.ReturnSell&&this._documentTypeService.viewReturnDocument(t),e===o.ReturnSupplier&&this._documentTypeService.viewReturnSupplier(t),e===o.ProductionAct&&this._documentTypeService.viewProductionAct(t),e===o.Order&&this._documentTypeService.viewOrderDocument(t),e===o.ReturnOrder&&this._documentTypeService.viewReturnOrderDocument(t)}static{this.\u0275fac=function(t){return new(t||i)(r(C),r(E),r(S),r(w),r(M))}}static{this.\u0275cmp=h({type:i,selectors:[["tis-history"]],inputs:{productId:"productId"},features:[R],decls:6,vars:12,consts:[["table",""],["actualQuantityTmpl",""],["basisDocumentTypeTmpl",""],[3,"enableToolbar","data","columns","enablePagination","enableSpinner","pageNavigation","enableSearch","enableFilters","customTemplates"],[3,"ngClass"],[1,"document-link",3,"click","text"]],template:function(t,n){if(t&1&&(f(0,"tis-table",3,0),D(2,Se,3,3,"ng-template",null,1,g)(4,Ce,1,1,"ng-template",null,2,g)),t&2){let c=v(3),m=v(5);s("enableToolbar",!0)("data",n.dataSource)("columns",n.columns)("enablePagination",!0)("enableSpinner",!0)("pageNavigation",!0)("enableSearch",!1)("enableFilters",!1)("customTemplates",V(9,ye,c,m))}},dependencies:[J,q,N,y,x],styles:[`.document-link[_ngcontent-%COMP%]{cursor:pointer}
/*# sourceMappingURL=history.component-H4KCYF3H.css.map */`],changeDetection:0})}}return i})();var be=()=>({text:!0,subtext:!0});function Te(i,a){if(i&1&&f(0,"tis-consignment",2),i&2){let e=l();s("productId",e.productId)("commonRemain",(e.productRemainInfo==null?null:e.productRemainInfo.quantity)??0)}}function Re(i,a){if(i&1&&f(0,"tis-history",3),i&2){let e=l();s("productId",e.productId)}}var ot=(()=>{class i{get warehouseName(){return this.productRemainInfo?.warehouse.name?`${this._localizationService.getSync("\u0412\u044B\u0431\u0440\u0430\u043D\u043D\u044B\u0439 \u0441\u043A\u043B\u0430\u0434")}: ${this.productRemainInfo?.warehouse.name}`:""}constructor(e,t,n,c,m){this._productRemainsService=e,this._activatedRoute=t,this._router=n,this._location=c,this._localizationService=m,this.destroyRef=H(Q),this.tabsConfig=re(this._localizationService.getSync.bind(this._localizationService)),this.selectedTab=j.Consignment,this.tabs=j,this.productId="",this.productRemainInfo=null}ngOnInit(){this._checkId()}changeActiveTab(e){this.selectedTab=e.id}toRemainsList(){this._location.back()}_checkId(){this._activatedRoute.queryParams.pipe(B(this.destroyRef)).subscribe(e=>{if(!e.id){this.toRemainsList();return}this.productId=e.id,this._getProductRemainsById(this.productId)})}_getProductRemainsById(e){this._productRemainsService.getProductRemainById(e).pipe(B(this.destroyRef)).subscribe({next:t=>this.productRemainInfo=t,error:()=>this.toRemainsList()})}static{this.\u0275fac=function(t){return new(t||i)(r(C),r(K),r(X),r(W),r(S))}}static{this.\u0275cmp=h({type:i,selectors:[["tis-remains-details"]],decls:5,vars:7,consts:[[1,"header",3,"backButtonClicked","title","subtext","loadingConfig"],[3,"changed","tabsItems"],[3,"productId","commonRemain"],[3,"productId"]],template:function(t,n){t&1&&(d(0,"tis-subheader",0),_("backButtonClicked",function(){return n.toRemainsList()}),p(),d(1,"tis-main-layout")(2,"tis-tabs",1),_("changed",function(m){return n.changeActiveTab(m)}),p(),F(3,Te,1,2,"tis-consignment",2),F(4,Re,1,1,"tis-history",3),p()),t&2&&(s("title",(n.productRemainInfo==null||n.productRemainInfo.nomenclature==null?null:n.productRemainInfo.nomenclature.name)??"")("subtext",n.warehouseName)("loadingConfig",U(6,be)),u(2),s("tabsItems",n.tabsConfig),u(),L(n.selectedTab===n.tabs.Consignment?3:-1),u(),L(n.selectedTab===n.tabs.History?4:-1))},dependencies:[oe,ie,y,le,ue,ne],styles:[`[_nghost-%COMP%]{display:flex;flex-direction:column;min-height:100%}.header[_ngcontent-%COMP%]{top:0;position:sticky;z-index:10}.barcode-cell[_ngcontent-%COMP%]{display:flex;gap:var(--space-horizontal-8)}
/*# sourceMappingURL=remains-details.component-BL74YUH7.css.map */`],changeDetection:0})}}return i})();export{ot as a};
//# sourceMappingURL=chunk-EJIGSKD6.js.map
