import{a as x}from"./chunk-ETP7UBOJ.js";import{b as j}from"./chunk-AWM4KYC6.js";import{a as P}from"./chunk-56M6FJ3C.js";import{a as b}from"./chunk-AFI6Z2RM.js";import{a as f}from"./chunk-UQ247MIA.js";import{a as S}from"./chunk-XN5TZF6G.js";import{A as $}from"./chunk-ADJRYQAP.js";import{f as g,t as m}from"./chunk-E65EA4Y7.js";import{e as I}from"./chunk-SMAIR2YP.js";import{g as h}from"./chunk-LINAD4CC.js";import{d as y,e as D}from"./chunk-BNNGG6ED.js";import{a as _}from"./chunk-7N232KV6.js";import{e as v,i as A}from"./chunk-NDLDFKR2.js";import{fa as u,ka as a}from"./chunk-PVUKHE45.js";var w=(()=>{let o=class o{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 c=new v;return c=c.append("code",t),this._http.get(`/api-reporting/live/store/${e}/advice-exclusion`,{params:c})}getStableDemandAdvices(e){let t=new v;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 v;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:_})}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`)}};o.\u0275fac=function(t){return new(t||o)(a(A))},o.\u0275prov=u({token:o,factory:o.\u0275fac});let n=o;return n})();function M(n,o){return+h(n)>+h(o)}var N=(()=>{let o=class o{constructor(e,t,c,r){this._visionService=e,this._priceActsService=t,this._localizationService=c,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 c=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:c,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()),c=new Map;for(let r of t){let i=r.operationDate.slice(0,10),s=c.get(i);s?s.last=r:c.set(i,{first:r,last:r})}return Array.from(c.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 c=[],r=g(new Date(e)),i=new Date;for(let s=0;s<t;s++){let d=b(f(r,29)),l=m(r,"dd.MM.yyyy"),p=m(d,"dd.MM.yyyy");if(c.push(`${l} - ${p}`),M(i,d))r=g(f(d,1));else break}return c}convertDateFormat(e){let[t,c]=e.split("-").map(p=>p.trim()),r="dd:MM:yyyy",i=this._localizationService.currentLocale===y.KK?x:j,s=P(t,r,new Date),d=P(c,r,new Date),l=p=>m(p,"dd LLL",{locale:i});return`${l(s)} - ${l(d)}`}};o.\u0275fac=function(t){return new(t||o)(a(w),a($),a(D),a(I))},o.\u0275prov=u({token:o,factory:o.\u0275fac});let n=o;return n})();export{w as a,N as b};
//# sourceMappingURL=chunk-U3AHFX5W.js.map
