import{a as I}from"./chunk-7JZWQJZL.js";import{b as x}from"./chunk-U3TY5HQZ.js";import{a as g}from"./chunk-6Y2DN35X.js";import{a as D}from"./chunk-AFI6Z2RM.js";import{a as h}from"./chunk-UQ247MIA.js";import{a as S}from"./chunk-XN5TZF6G.js";import{B as j}from"./chunk-7YTVARFL.js";import{f,t as v}from"./chunk-S332DHRQ.js";import{i as b}from"./chunk-JSG72ZNQ.js";import{g as m}from"./chunk-LINAD4CC.js";import{K as _,La as y}from"./chunk-QHAVDXDG.js";import{a as P}from"./chunk-KXX3UDJ3.js";import{f as u,j as A}from"./chunk-GQAU5ACB.js";import{la as l,pa as s}from"./chunk-ISMRT7VU.js";var $=(()=>{class c{constructor(e){this._http=e}offer(){return this._http.get("/api-reporting/live/offer")}accept(){return this._http.post("/api-reporting/live/offer/accept",{})}getIncreasePriceAdvice(e){return this._http.get(`/api-reporting/live/store/${e}/advice/price-potential`)}getAdviceExclusion(e,t){let o=new u;return o=o.append("code",t),this._http.get(`/api-reporting/live/store/${e}/advice-exclusion`,{params:o})}getStableDemandAdvices(e){let t=new u;return t=t.append("storeId",e.storeId),t=t.append("from",e.from),t=t.append("to",e.to),this._http.get("/api-reporting/advisor/advices/stable-demand",{params:t})}getUnstableDemandAdvices(e){let t=new u;return t=t.append("storeId",e.storeId),t=t.append("from",e.from),t=t.append("to",e.to),this._http.get("/api-reporting/advisor/advices/unstable-demand",{params:t})}createAdviceExclusion(e,t){return this._http.post(`/api-reporting/live/store/${e}/advice-exclusion`,t)}deleteAdviceExclusion(e,t){return this._http.delete(`/api-reporting/live/store/${e}/advice-exclusion`,{body:t})}getMetrics(e,t){return this._http.post(`/api-reporting/live/store/${e}/advice/price-potential/metrics`,t,{headers:P})}notSoldProducts(e){return this._http.get(`/api-reporting/live/store/${e}/advice/not-sold-products`)}runningOutProducts(e){return this._http.get(`/api-reporting/live/store/${e}/advice/running-out-products`)}addDiscounts(e){return this._http.get(`/api-reporting/live/store/${e}/advice/add-discounts`)}removeFromShelf(e){return this._http.get(`/api-reporting/live/store/${e}/advice/remove-from-shelf`)}static{this.\u0275fac=function(t){return new(t||c)(s(A))}}static{this.\u0275prov=l({token:c,factory:c.\u0275fac})}}return c})();function w(c,M){return+m(c)>+m(M)}var J=(()=>{class c{constructor(e,t,o,r){this._visionService=e,this._priceActsService=t,this._localizationService=o,this._priceService=r,this.translateBind=this._localizationService.getSync.bind(this._localizationService)}offer(){return this._visionService.offer()}accept(){return this._visionService.accept()}getIncreasePriceAdvice(e){return this._visionService.getIncreasePriceAdvice(e)}getAdviceExclusion(e,t){return this._visionService.getAdviceExclusion(e,t)}createAdviceExclusion(e,t){return this._visionService.createAdviceExclusion(e,t)}deleteAdviceExclusion(e,t){return this._visionService.deleteAdviceExclusion(e,t)}getMetrics(e,t){return this._visionService.getMetrics(e,t)}notSoldProducts(e){return this._visionService.notSoldProducts(e)}runningOutProducts(e){return this._visionService.runningOutProducts(e)}addDiscounts(e){return this._visionService.addDiscounts(e)}removeFromShelf(e){return this._visionService.removeFromShelf(e)}getStableDemandAdvices(e){return this._visionService.getStableDemandAdvices(e)}getUnstableDemandAdvices(e){return this._visionService.getUnstableDemandAdvices(e)}getPriceList(){let e={criteria:{filter:{sources:[S.PricePotentialAdvice]}},take:100,skip:0,orderBy:"date"};return this._priceActsService.getAll(e)}createAdjustmentPriceAct(e,t){let o=e.map(i=>({nomenclatureId:i.id,purchasePrice:i.purchasePrice,markup:this._priceActsService.calculatePercentageChange(i.recommendedPrice,i.purchasePrice),oldPrice:i.sellPrice,newPrice:i.recommendedPrice})),r={storeId:t,positions:o,comment:null,source:S.PricePotentialAdvice,priceId:this._priceService.defaultPriceId};return this._priceActsService.create(r)}mergePriceHistoryByDay(e){let t=[...e].sort((r,i)=>new Date(r.operationDate).getTime()-new Date(i.operationDate).getTime()),o=new Map;for(let r of t){let i=r.operationDate.slice(0,10),n=o.get(i);n?n.last=r:o.set(i,{first:r,last:r})}return Array.from(o.values()).map(({first:r,last:i})=>({operationDate:i.operationDate,oldPrice:r.oldPrice,newPrice:i.newPrice,source:i.source,adjustmentPriceActId:i.adjustmentPriceActId}))}build30dPeriodLabels(e,t=6){let o=[],r=f(new Date(e)),i=new Date;for(let n=0;n<t;n++){let a=D(h(r,29)),p=v(r,"dd.MM.yyyy"),d=v(a,"dd.MM.yyyy");if(o.push(`${p} - ${d}`),w(i,a))r=f(h(a,1));else break}return o}convertDateFormat(e){let[t,o]=e.split("-").map(d=>d.trim()),r="dd:MM:yyyy",i=this._localizationService.currentLocale===_.KK?I:x,n=g(t,r,new Date),a=g(o,r,new Date),p=d=>v(d,"dd LLL",{locale:i});return`${p(n)} - ${p(a)}`}static{this.\u0275fac=function(t){return new(t||c)(s($),s(j),s(y),s(b))}}static{this.\u0275prov=l({token:c,factory:c.\u0275fac})}}return c})();export{$ as a,J as b};
//# sourceMappingURL=chunk-EJ7IOLKL.js.map
