import{b as G,c as me,e as w}from"./chunk-RHDLOKV3.js";import{c as z}from"./chunk-7ZP6WCWL.js";import{a as se}from"./chunk-IH46RY6S.js";import{a as ae}from"./chunk-QYJGZ7EQ.js";import{b as B}from"./chunk-NFPGM4DL.js";import{v as o,w as A}from"./chunk-SDLOETO3.js";import{a as ce}from"./chunk-EKNPGUXW.js";import{a as L}from"./chunk-NCA55RNB.js";import{t as F}from"./chunk-TL6VKVO7.js";import{b as oe,e as D,f as re}from"./chunk-RCWJCOBH.js";import{Aa as ne,La as E,pa as P}from"./chunk-NKXT7PF4.js";import{a as I,b as $}from"./chunk-IGFM5CCE.js";import{s as te,u as ie,y as R}from"./chunk-YMOV4UGM.js";import{U as Z,Y as ee,k as X,ua as T}from"./chunk-TDUJNOEU.js";import{Db as y,Ec as C,Hb as N,Ib as S,Jc as U,Lc as V,Xc as Y,Yc as W,Zc as q,dc as s,ec as u,fc as l,fd as J,gc as h,gd as K,kd as b,lb as p,nc as k,tc as g,ua as x,va as M,vc as m,wb as r,zd as O}from"./chunk-I3FGJX2C.js";import{d as v,n as Q}from"./chunk-INB5GR2I.js";Q();Q();function le(n){return[{dataField:"date",caption:n("\u041F\u0430\u0440\u0442\u0438\u0438"),calculateCellValue:e=>`${n("\u041F\u0430\u0440\u0442\u0438\u044F \u043E\u0442")} ${F(new Date(e.date),"dd.MM.yyyy")}`},{dataField:"basisDocumentType",caption:n("\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435"),isCustom:!0},{dataField:"cost",caption:`${n("\u0417\u0430\u043A\u0443\u043F\u043E\u0447\u043D\u0430\u044F \u0446\u0435\u043D\u0430")}, \u20B8`,alignment:"right",numericPrecision:2,width:"14%"},{dataField:"initialQuantity",caption:n("\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:n("\u041E\u0441\u0442\u0430\u0442\u043E\u043A"),alignment:"right",width:"12%"}]}var ve=n=>({basisDocumentType:n});function ye(n,e){if(n&1&&(u(0,"div",4),h(1,"wk-badge",5),J(2,"translate"),l()),n&2){let t=m();p(),s("icon",t.iconRemain)("text",K(2,2,"\u041E\u0431\u0449\u0438\u0439 \u043E\u0441\u0442\u0430\u0442\u043E\u043A:")+t.commonRemain)}}function Se(n,e){if(n&1){let t=k();u(0,"wk-link",6),g("click",function(){let a=x(t).$implicit,c=m();return M(c.openDocumentDrawer(a.basisDocumentType,a.basisDocumentId))}),l()}if(n&2){let t=e.$implicit,i=m();s("text",i.getDocumentTypeNames(t.basisDocumentType))}}var d,j=(d=class extends z{constructor(e,t,i,a,c){super(a,c),this._productRemainsService=e,this._documentTypeService=t,this._localizationService=i,this.productId="",this.iconRemain=re.BoxMultiple,this.isAscending=!1,this.orderBy="date",this.columns=le(this._localizationService.getSync.bind(this._localizationService))}getLoadMethod(e){return this._productRemainsService.getProductRemainConsignments(this.productId,e)}getDocumentTypeNames(e){return A(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)}},d.\u0275fac=function(t){return new(t||d)(r(w),r(B),r(D),r(O),r(E))},d.\u0275cmp=y({type:d,selectors:[["tis-consignment"]],inputs:{productId:"productId",commonRemain:"commonRemain"},features:[N],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,i){if(t&1&&(h(0,"tis-table",3,0),S(2,ye,3,4,"ng-template",null,1,b)(4,Se,1,1,"ng-template",null,2,b)),t&2){let a=C(3),c=C(5);s("enableToolbar",!0)("data",i.dataSource)("columns",i.columns)("enablePagination",!0)("enableSpinner",!0)("pageNavigation",!0)("enableSearch",!1)("enableFilters",!1)("customToolbarTemplate",a)("customTemplates",W(10,ve,c))}},dependencies:[T,ne,L,R,P,oe],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}),d);j=v([I()],j);Q();function fe(n){return[{dataField:"date",caption:n("\u0414\u0430\u0442\u0430"),calculateCellValue:e=>F(new Date(e.changeDate),"dd.MM.yy HH:mm:ss")},{dataField:"basisDocumentType",caption:n("\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435"),isCustom:!0},{dataField:"previousQuantity",caption:n("\u0411\u044B\u043B\u043E"),alignment:"right",calculateCellValue:e=>e.previousQuantity},{dataField:"actualQuantity",caption:n("\u0421\u0442\u0430\u043B\u043E"),alignment:"right",isCustom:!0}]}var be=(n,e)=>({actualQuantity:n,basisDocumentType:e});function Te(n,e){if(n&1&&(u(0,"span",4),U(1),l(),U(2)),n&2){let t=e.$implicit,i=m();s("ngClass",t.actualQuantity-t.previousQuantity<0?"font-b1-error":"font-b1-success"),p(),V(" (",i.getDifferent(t),")\xA0 "),p(),V(" ",t.actualQuantity,`
`)}}function Re(n,e){if(n&1){let t=k();u(0,"wk-link",5),g("click",function(){let a=x(t).$implicit,c=m();return M(c.openDocumentDrawer(a.basisDocumentType,a.basisDocumentId))}),l()}if(n&2){let t=e.$implicit,i=m();s("text",i.getDocumentTypeNames(t.basisDocumentType))}}var f,H=(f=class extends z{constructor(e,t,i,a,c){super(a,c),this._productRemainsService=e,this._documentTypeService=t,this._localizationService=i,this.productId="",this.isAscending=!1,this.orderBy="date",this.columns=fe(this._localizationService.getSync.bind(this._localizationService))}getLoadMethod(e){return this._productRemainsService.getProductRemainHistory(this.productId,e)}getDifferent(e){let t=(e.actualQuantity-e.previousQuantity)*1e3,i=Math.round(+t)/1e3;return`${i>0?`+${i}`:i}`}getDocumentTypeNames(e){return A(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)}},f.\u0275fac=function(t){return new(t||f)(r(w),r(B),r(D),r(O),r(E))},f.\u0275cmp=y({type:f,selectors:[["tis-history"]],inputs:{productId:"productId"},features:[N],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,i){if(t&1&&(h(0,"tis-table",3,0),S(2,Te,3,3,"ng-template",null,1,b)(4,Re,1,1,"ng-template",null,2,b)),t&2){let a=C(3),c=C(5);s("enableToolbar",!0)("data",i.dataSource)("columns",i.columns)("enablePagination",!0)("enableSpinner",!0)("pageNavigation",!0)("enableSearch",!1)("enableFilters",!1)("customTemplates",q(9,be,a,c))}},dependencies:[T,Z,L,R,P],styles:[`.document-link[_ngcontent-%COMP%]{cursor:pointer}
/*# sourceMappingURL=history.component-H4KCYF3H.css.map */`],changeDetection:0}),f);H=v([I()],H);var Ie=()=>({text:!0,subtext:!0});function De(n,e){if(n&1&&h(0,"tis-consignment",4),n&2){let t=m();s("productId",t.productId)("commonRemain",(t.productRemainInfo==null?null:t.productRemainInfo.quantity)??0)}}function we(n,e){if(n&1&&h(0,"tis-history",5),n&2){let t=m();s("productId",t.productId)}}var _,_e=(_=class{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,i,a,c){this._productRemainsService=e,this._activatedRoute=t,this._router=i,this._location=a,this._localizationService=c,this.tabsConfig=me(this._localizationService.getSync.bind(this._localizationService)),this.selectedTab=G.Consignment,this.tabs=G,this.productId="",this.productRemainInfo=null}ngOnInit(){this._checkId()}changeActiveTab(e){this.selectedTab=e.id}toRemainsList(){this._location.back()}_checkId(){this._activatedRoute.queryParams.pipe($(this)).subscribe(e=>{if(!e.id){this.toRemainsList();return}this.productId=e.id,this._getProductRemainsById(this.productId)})}_getProductRemainsById(e){this._productRemainsService.getProductRemainById(e).pipe($(this)).subscribe({next:t=>this.productRemainInfo=t,error:()=>this.toRemainsList()})}},_.\u0275fac=function(t){return new(t||_)(r(w),r(te),r(ie),r(X),r(D))},_.\u0275cmp=y({type:_,selectors:[["tis-remains-details"]],decls:5,vars:7,consts:[[1,"header",3,"backButtonClicked","title","subtext","loadingConfig"],[3,"changed","tabsItems"],[3,"productId","commonRemain",4,"ngIf"],[3,"productId",4,"ngIf"],[3,"productId","commonRemain"],[3,"productId"]],template:function(t,i){t&1&&(u(0,"tis-subheader",0),g("backButtonClicked",function(){return i.toRemainsList()}),l(),u(1,"tis-main-layout")(2,"tis-tabs",1),g("changed",function(c){return i.changeActiveTab(c)}),l(),S(3,De,1,2,"tis-consignment",2)(4,we,1,1,"tis-history",3),l()),t&2&&(s("title",(i.productRemainInfo==null||i.productRemainInfo.nomenclature==null?null:i.productRemainInfo.nomenclature.name)??"")("subtext",i.warehouseName)("loadingConfig",Y(6,Ie)),p(2),s("tabsItems",i.tabsConfig),p(),s("ngIf",i.selectedTab===i.tabs.Consignment),p(),s("ngIf",i.selectedTab===i.tabs.History))},dependencies:[T,ee,se,ae,R,j,H,ce],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-s)}
/*# sourceMappingURL=remains-details.component-GJPRIIVO.css.map */`],changeDetection:0}),_);_e=v([I()],_e);export{_e as a};
//# sourceMappingURL=chunk-7PLOIV6Z.js.map
