import{a as I}from"./chunk-D2E2Q4FV.js";import{b as $}from"./chunk-AUIWZTMW.js";import{a as g}from"./chunk-JOIQPM2P.js";import{a as x}from"./chunk-AFI6Z2RM.js";import{a as f}from"./chunk-E3CNFAVP.js";import{a as P}from"./chunk-XN5TZF6G.js";import{A as b}from"./chunk-XOJFB2RU.js";import{f as h,t as v}from"./chunk-TL6VKVO7.js";import{e as j}from"./chunk-BTNSHOI7.js";import{g as m}from"./chunk-LINAD4CC.js";import{d as _,e as D}from"./chunk-L2U5MHO4.js";import{a as S}from"./chunk-PLVHWZTL.js";import{e as A,i as y}from"./chunk-YMOV4UGM.js";import{ga as l,la as a}from"./chunk-I3FGJX2C.js";var M=(()=>{let c=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 A;return o=o.append("code",t),this._http.get(`/api-reporting/live/store/${e}/advice-exclusion`,{params:o})}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:S})}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`)}};c.\u0275fac=function(t){return new(t||c)(a(y))},c.\u0275prov=l({token:c,factory:c.\u0275fac});let n=c;return n})();function w(n,c){return+m(n)>+m(c)}var N=(()=>{let c=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)}getPriceList(){let e={criteria:{filter:{sources:[P.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:P.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),s=o.get(i);s?s.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=h(new Date(e)),i=new Date;for(let s=0;s<t;s++){let p=x(f(r,29)),d=v(r,"dd.MM.yyyy"),u=v(p,"dd.MM.yyyy");if(o.push(`${d} - ${u}`),w(i,p))r=h(f(p,1));else break}return o}convertDateFormat(e){let[t,o]=e.split("-").map(u=>u.trim()),r="dd:MM:yyyy",i=this._localizationService.currentLocale===_.KK?I:$,s=g(t,r,new Date),p=g(o,r,new Date),d=u=>v(u,"dd LLL",{locale:i});return`${d(s)} - ${d(p)}`}};c.\u0275fac=function(t){return new(t||c)(a(M),a(b),a(D),a(j))},c.\u0275prov=l({token:c,factory:c.\u0275fac});let n=c;return n})();export{M as a,N as b};
//# sourceMappingURL=chunk-SYPCSFXZ.js.map
