import{a as j}from"./chunk-RRSYYPWA.js";import{a as A}from"./chunk-WAMXHNDN.js";import{b as I}from"./chunk-HFDX2HBX.js";import{a as _}from"./chunk-AFI6Z2RM.js";import{a as v}from"./chunk-E3CNFAVP.js";import{a as P}from"./chunk-3E2O24RU.js";import{B as b}from"./chunk-JV3IW4ED.js";import{f as h,t as m}from"./chunk-W3BEWLBM.js";import{g as f}from"./chunk-LINAD4CC.js";import{c as D,d as x}from"./chunk-BOZT4LSN.js";import{a as S}from"./chunk-P5XIDEFS.js";import{e as g,i as y}from"./chunk-CO3WTSA4.js";import{ea as u,ja as a}from"./chunk-DYUFV4HF.js";var M=(()=>{let r=class r{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 g;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})}};r.\u0275fac=function(t){return new(t||r)(a(y))},r.\u0275prov=u({token:r,factory:r.\u0275fac});let n=r;return n})();function w(n,r){return+f(n)>+f(r)}var G=(()=>{let r=class r{constructor(e,t,o){this._pricePotentialServiceApi=e,this._priceActsService=t,this._localizationService=o,this.translateBind=this._localizationService.getSync.bind(this._localizationService)}offer(){return this._pricePotentialServiceApi.offer()}accept(){return this._pricePotentialServiceApi.accept()}getIncreasePriceAdvice(e){return this._pricePotentialServiceApi.getIncreasePriceAdvice(e)}getAdviceExclusion(e,t){return this._pricePotentialServiceApi.getAdviceExclusion(e,t)}createAdviceExclusion(e,t){return this._pricePotentialServiceApi.createAdviceExclusion(e,t)}deleteAdviceExclusion(e,t){return this._pricePotentialServiceApi.deleteAdviceExclusion(e,t)}getMetrics(e,t){return this._pricePotentialServiceApi.getMetrics(e,t)}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})),c={storeId:t,positions:o,comment:null,source:P.PricePotentialAdvice};return this._priceActsService.create(c)}mergePriceHistoryByDay(e){let t=[...e].sort((c,i)=>new Date(c.operationDate).getTime()-new Date(i.operationDate).getTime()),o=new Map;for(let c of t){let i=c.operationDate.slice(0,10),s=o.get(i);s?s.last=c:o.set(i,{first:c,last:c})}return Array.from(o.values()).map(({first:c,last:i})=>({operationDate:i.operationDate,oldPrice:c.oldPrice,newPrice:i.newPrice,source:i.source,adjustmentPriceActId:i.adjustmentPriceActId}))}build30dPeriodLabels(e,t=6){let o=[],c=h(new Date(e)),i=new Date;for(let s=0;s<t;s++){let p=_(v(c,29)),d=m(c,"dd.MM.yyyy"),l=m(p,"dd.MM.yyyy");if(o.push(`${d} - ${l}`),w(i,p))c=h(v(p,1));else break}return o}convertDateFormat(e){let[t,o]=e.split("-").map(l=>l.trim()),c="dd:MM:yyyy",i=this._localizationService.currentLocale===D.KK?j:I,s=A(t,c,new Date),p=A(o,c,new Date),d=l=>m(l,"dd LLL",{locale:i});return`${d(s)} - ${d(p)}`}};r.\u0275fac=function(t){return new(t||r)(a(M),a(b),a(x))},r.\u0275prov=u({token:r,factory:r.\u0275fac});let n=r;return n})();export{M as a,G as b};
//# sourceMappingURL=chunk-XHD6OSUN.js.map
