import{a as h}from"./chunk-D5GR2SME.js";import{a as l}from"./chunk-AYYBQTWJ.js";import{a as n}from"./chunk-JAY45DEO.js";import{a as u,b as m}from"./chunk-EK6YV2TW.js";import{I as c,ea as d,ja as a,q as o}from"./chunk-DYUFV4HF.js";import{d as p,n as v}from"./chunk-INB5GR2I.js";v();var i,A=(i=class{constructor(t,e){this._productionActServiceApi=t,this._remainsService=e}create(t){let e=this._migrateFormToRequestModel(t);return this._productionActServiceApi.create(e).pipe(c(1))}edit(t,e){let r=this._migrateFormToRequestModel(e);return this._productionActServiceApi.edit(t,{date:r.date,copies:r.copies,comment:r.comment}).pipe(c(1))}getById(t){return this._productionActServiceApi.getById(t).pipe(o(e=>(e.date=new Date(e.date),e)))}getAll(t){return this._productionActServiceApi.getAll(t).pipe(c(1))}calculateTotalCost(t,e){let r={warehouseId:e,positions:t};return this._remainsService.getCalculatedProductsCost(r).pipe(m(this),o(s=>s.positions.reduce((S,g)=>S+=g.totalCost,0)))}getProductRemains(t,e){let r={criteria:{search:null,filter:{nomenclatureIds:e,viewWithZeroQuantity:!0}},skip:0,take:e.length,orderBy:"id",isAscending:!1};return this._remainsService.getProductRemains(t,r).pipe(o(s=>s.data))}_migrateFormToRequestModel(t){return{prescriptId:t.prescriptId,date:t.date?n(t.date):n(new Date),copies:t.copies,resultsWarehouseId:t.resultsWarehouseId,componentsWarehouseId:t.componentsWarehouseId,comment:t.comment}}},i.\u0275fac=function(e){return new(e||i)(a(h),a(l))},i.\u0275prov=d({token:i,factory:i.\u0275fac}),i);A=p([u()],A);export{A as a};
//# sourceMappingURL=chunk-2AG7KOCY.js.map
