PageSourceSearch

https://dolly.no/5195.2a0b493bb3bbade3.js

js dolly.no collected 2026-10-02 20:18:12 UTC 47,484 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkeSusoft=self.webpackChunkeSusoft||[]).push([[5195],{99203:(tt,L,i)=>{i.d(L,{w:()=>y});var y=function(x){return x[x.NUMBER=0]="NUMBER",x[x.TEXT=1]="TEXT",x}(y||{})},36652:(tt,L,i)=>{i.d(L,{_:()=>at});var y=i(12747),x=i(62288),G=i(99203);class D{static exportAsExcelFile(b,C,o="xlsx",u){const v=x.Wp.aoa_to_sheet(b);Object.keys(v).forEach(R=>{const I=D.getColumnIndexLetters(R),d=D.getColumnIndexNumber(I);-1===d||isNaN(d)||u[d]!==G.w.NUMBER||"number"!=typeof v[R].v?-1!==d&&!isNaN(d)&&(v[R].t="t",v[R].z="@"):(v[R].z="#,##0.00",v[R].t="n")}),(0,x._h)({Sheets:{data:v},SheetNames:["data"]},C+o,{ignoreEC:!0})}static getColumnIndexLetters(b){const C=b.match(/^[A-Z]+/);return C?C[0]:""}static getColumnIndexNumber(b){if(null==b||!b.length)return-1;let C=0;for(let o=0;o<b.length;o++)C+=o===b.length-1?D.getCharIndexValue(b.charAt(o)):26*(D.getCharIndexValue(b.charAt(o))+1);return C}static getCharIndexValue(b){return b.charCodeAt(0)-65}}var $=i(20246),P=i(61747),S=i(22913),B=i(54032),J=i(80419),Y=i(1400),T=i(17705),et=i(41780),z=i(46781);let at=(()=>{var U;class b{constructor(o,u){this.translateService=o,this.categoryService=u}static exportAsPdf(o,u,v,t){let R=new $.uE;const d=6*v.length+6;"landscape"===t?(R=new $.uE(t),(0,P.Ay)(R,{head:[u[0]],headStyles:{fillColor:this.grayColor},body:u.slice(1,u.length),margin:{horizontal:0,bottom:0,top:d},styles:{fontSize:6.5}})):(0,P.Ay)(R,{head:[u[0]],headStyles:{fillColor:this.grayColor},body:u.slice(1,u.length),margin:{top:d,horizontal:0,bottom:0}});for(let k=0;k<R.internal.pages.length;k++){R.setPage(k),R.setFontSize(12),R.setFont("courier","normal"),R.setTextColor(82,86,89);let j=5,V=7;v.forEach(X=>{R.text(X,j,V),V+=6})}R.save(o+".pdf")}static exportAsExcel(o,u,v){D.exportAsExcelFile(o,u+".","xlsx",v)}static exportAsCSV(o,u,v){D.exportAsExcelFile(o,u+".","csv",v)}export(o){let u=this.generateHeader(o.filters,o.fromDate,o.toDate,o.date);switch(o.extraHeaders&&(u=u.concat(o.extraHeaders)),o.exportFileFormat){case y.U.CSV:return u.length>0&&(o.dataList.unshift([]),o.dataList.unshift(u)),void b.exportAsCSV(o.dataList,o.fileName,o.excelExportColumnTypes);case y.U.EXCEL:return u.length>0&&(o.dataList.unshift([]),o.dataList.unshift(u)),void b.exportAsExcel(o.dataList,o.fileName,o.excelExportColumnTypes);case y.U.PDF:return void b.exportAsPdf(o.fileName,o.dataList,u,o.orientation)}}collectCategoryFilterNodeNames(o,u,v){o.forEach(t=>{var R,I;const d="-1"===t.id||null==v?void 0:v.find(j=>j.id===t.id),k="-1"===t.id?this.translateService.instant("filters.no_category"):null!==(R=null==d?void 0:d.name)&&void 0!==R?R:t.id;u.has(t.level)||u.set(t.level,[]),u.get(t.level).push(k),null!==(I=t.children)&&void 0!==I&&I.length&&this.collectCategoryFilterNodeNames(t.children,u,null==d?void 0:d.childrenViewList)})}generateHeader(o,u,v,t){var R,I;const d=[];if((null!=o&&o.vendorId||null!=o&&o.vendor)&&null!=o&&o.vendors){const F=o.vendorId||o.vendor;d.push(this.translateService.instant("filters.vendor")+": "+o.vendors.find(N=>N.id===F).name)}if(null!=o&&null!==(R=o.allShops)&&void 0!==R&&R.length){var k,j,V;let F=this.translateService.instant("filters.shops")+": ";if((null===(k=o.shops)||void 0===k?void 0:k.length)>=o.allShops.length||(null===(j=o.shopIds)||void 0===j?void 0:j.length)>=(null===(V=o.allShops)||void 0===V?void 0:V.length))F+=this.translateService.instant("admin.reports.all");else{const N=o.shops||o.shopIds;null==N||N.forEach(_=>{var A;F+=(null===(A=o.allShops.find(Z=>Z.shopNo===_))||void 0===A?void 0:A.displayName)+" "})}d.push(F)}var X,K;if(null!=o&&o.activeOnly&&d.push(this.translateService.instant("filters.active_only_checkbox_label")),null!=o&&o.showProductsWithNegativeStock&&d.push(this.translateService.instant("admin.reports.show_products_with_negative_stock")),null!=o&&o.showOnlyProductsOnStock&&d.push(this.translateService.instant("admin.reports.show_only_products_on_stock")),t&&d.push(this.translateService.instant("admin.reports.date_input_label")+": "+t),u&&d.push(this.translateService.instant("admin.reports.from_date_input_label")+": "+u),v&&d.push(this.translateService.instant("admin.reports.to_date_input_label")+": "+v),null!=o&&o.source&&d.push(this.translateService.instant("admin.reports.source.source")+": "+o.source),null!=o&&o.paymentType&&(d.push(this.translateService.instant("admin.reports.payment_type_label")+": "+this.translateService.instant(`payment_type.${o.paymentType.toLowerCase()}`)),(null==o?void 0:o.paymentType)==Y.d.CUSTOM&&null!=o&&o.customPaymentType)&&d.push(this.translateService.instant("admin.reports.custom_payment_type_label")+": "+(null==o||null===(X=o.customPaymentTypes)||void 0===X||null===(X=X.find(F=>F.id===o.customPaymentType))||void 0===X?void 0:X.name)),null!=o&&o.searchQuery&&d.push(this.translateService.instant("admin.reports.search_term")+": "+o.searchQuery),null!=o&&o.searchTerm&&d.push(this.translateService.instant("admin.reports.search_term")+": "+o.searchTerm),null!=o&&o.term&&d.push(this.translateService.instant("admin.reports.search_term")+": "+o.term),null!=o&&o.showNetPrice&&d.push(this.translateService.instant("admin.reports.show_net_price")+": "+this.translateService.instant("admin.reports.true")),null!=o&&o.showLastYearGrossSale&&d.push(this.translateService.instant("admin.reports.show_last_year_gross_
1sale")+": "+this.translateService.instant("admin.reports.true")),null!=o&&o.departmentId&&d.push(this.translateService.instant("filters.department")+": "+o.departmentId),null!=o&&o.posNo&&d.push(this.translateService.instant("filters.pos")+": "+o.posNo),null!=o&&o.productWebshopAvailability){let F=this.translateService.instant("filters.exported")+": ";o.productWebshopAvailability===S.PZ.all?F+=this.translateService.instant("filters.show_all"):o.productWebshopAvailability===S.PZ.exported?F+=this.translateService.instant("filters.exported_only"):o.productWebshopAvailability===S.PZ.notExported&&(F+=this.translateService.instant("filters.not_exported_only")),d.push(F)}if(null!=o&&o.differenceAccount&&d.push(this.translateService.instant("admin.reports.account_sales.difference_account")+": "+o.differenceAccount),null!=o&&o.generalLedgerAccount&&d.push(this.translateService.instant("admin.reports.account_sales.general_ledger_account")+": "+o.generalLedgerAccount),null!=o&&o.paymentsAccount&&d.push(this.translateService.instant("admin.reports.account_sales.payments_account")+": "+o.paymentsAccount),o){var H,O,M,Q;const F=null===(H=this.categoryService)||void 0===H?void 0:H.getCategoryIdsFromFilter(o),N=null===(O=this.categoryService)||void 0===O?void 0:O.getCategoryNamesFromCategoryIds(F,o.categories);for(let _=1;_<=N.length;_++)d.push(this.translateService.instant("admin.reports.category")+" "+_+": "+N[_-1]);if(null!==(M=o.categoryFilter)&&void 0!==M&&null!==(M=M.multipleCategories)&&void 0!==M&&M.length){const _=new Map;this.collectCategoryFilterNodeNames(o.categoryFilter.multipleCategories,_,o.categories),Array.from(_.keys()).sort((A,Z)=>A-Z).forEach(A=>{d.push(this.translateService.instant("admin.reports.category")+" "+A+": "+_.get(A).join(", "))})}null!==(Q=o.categoryFilter)&&void 0!==Q&&Q.level&&d.push(this.translateService.instant("admin.reports.category_level",{level:o.categoryFilter.level}))}if(null!=o&&o.showReturnsOnly&&d.push(this.translateService.instant("admin.reports.show_returns_only")),null!=o&&o.batch&&d.push(this.translateService.instant("admin.stock.batch")+": "+o.batch),null!=o&&o.userId&&null!=o&&null!==(I=o.allUsers)&&void 0!==I&&I.length&&d.push(this.translateService.instant("admin.stock.user")+": "+(null===(K=o.allUsers.find(F=>B.H.getUserId(F)===o.userId))||void 0===K?void 0:K.userName)),null!=o&&o.creditSales){let F="filters.show_all";o.creditSales===J._N.EXCLUDE?F="filters.exclude_credit_sales":o.creditSales===J._N.SHOW_ONLY&&(F="filters.show_only_credit_sales"),d.push(this.translateService.instant("filters.credit_sales")+": "+this.translateService.instant(F))}return d}}return(U=b).grayColor="#e3e2de",U.\u0275fac=function(o){return new(o||U)(T.KVO(et.c$),T.KVO(z.M,8))},U.\u0275prov=T.jDH({token:U,factory:U.\u0275fac}),b})()},63275:(tt,L,i)=>{i.r(L),i.d(L,{WastageReportsContainerModule:()=>Ce});var y=i(60177),x=i(41780),G=i(9183),D=i(85956),$=i(25596),P=i(99213),S=i(52168),B=i(84135),J=i(80419),Y=i(12747),T=i(26184),et=i(20568),z=i(84572),at=i(33425),U=i(270),b=i(44437),C=i(99203),o=i(67374),u=i.n(o),v=i(52698),t=i(17705),R=i(42353),I=i(70521),d=i(59459),k=i(1443),j=i(34006),V=i(18370),X=i(50297),H=i(21626);let O=(()=>{var e;class r extends V.Y{constructor(a,n){super(a),this.userStorage=a,this.httpClient=n}getWastageJournalReportList(a){return this.httpClient.post("reporting/wastage/journals/list",{shops:a.shops,fromDate:a.fromDate,toDate:a.toDate,categoryFilter:a.c
1ategoryFilter,searchTerm:a.searchTerm,page:a.page,pageSize:a.pageSize})}getWastageJournalReportCount(a){return this.httpClient.post("reporting/wastage/journals/count",{shops:a.shops,fromDate:a.fromDate,toDate:a.toDate,categoryFilter:a.categoryFilter,searchTerm:a.searchTerm})}getWastageJournalReportSum(a){return this.httpClient.post("reporting/wastage/journals/totals",{shops:a.shops,fromDate:a.fromDate,toDate:a.toDate,categoryFilter:a.categoryFilter,searchTerm:a.searchTerm})}}return(e=r).\u0275fac=function(a){return new(a||e)(t.KVO(X.q),t.KVO(H.Qq))},e.\u0275prov=t.jDH({token:e,factory:e.\u0275fac}),r})(),M=(()=>{var e;class r{constructor(a){this.networkRepository=a}execute(a){return this.networkRepository.getWastageJournalReportCount(a)}}return(e=r).\u0275fac=function(a){return new(a||e)(t.KVO(O))},e.\u0275prov=t.jDH({token:e,factory:e.\u0275fac}),r})();var Q=i(96354);let K=(()=>{var e;class r{constructor(a){this.networkRepository=a}execute(a,n){return this.networkRepository.getWastageJournalReportList(a).pipe((0,Q.T)(l=>(l.forEach(p=>{p.dateTime=u()(p.dateTime,T.lS).format(n),p.displayProductName="("+p.productId+") "+p.productName,p.displaySalespersonName="("+p.salesPersonId+") "+p.salesPersonName}),l)))}}return(e=r).\u0275fac=function(a){return new(a||e)(t.KVO(O))},e.\u0275prov=t.jDH({token:e,factory:e.\u0275fac}),r})(),F=(()=>{var e;class r{constructor(a){this.networkRepository=a}execute(a){return this.networkRepository.getWastageJournalReportSum(a)}}return(e=r).\u0275fac=function(a){return new(a||e)(t.KVO(O))},e.\u0275prov=t.jDH({token:e,factory:e.\u0275fac}),r})();var N=i(36652),_=i(9159),A=i(96695),Z=i(97928);function ut(e,r){if(1&e&&(t.j41(0,"div",9),t.nrm(1,"webshop-report-widget",10),t.k0s()),2&e){const s=r.$implicit;t.R7$(1),t.Y8G("widgetData",s.value)}}function mt(e,r){if(1&e&&(t.j41(0,"div",7),t.DNE(1,ut,2,1,"div",8),t.nI1(2,"keyvalue"),t.k0s()),2&e){const s=t.XpG(2);t.R7$(1),t.Y8G("ngForOf",t.i5U(2,1,s.cardsData,s.returnZero))}}function gt(e,r){1&e&&(t.j41(0,"th",27),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&e&&(t.R7$(1),t.SpI(" ",t.bMT(2,1,"admin.reports.id_table_header")," "))}function _t(e,r){if(1&e&&(t.j41(0,"td",28),t.qex(1),t.EFF(2),t.bVm(),t.k0s()),2&e){const s=r.$implicit;t.R7$(2),t.SpI(" ",s.id," ")}}function vt(e,r){1&e&&(t.j41(0,"th",27),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&e&&(t.R7$(1),t.SpI(" ",t.bMT(2,1,"admin.reports.date_time")," "))}function ft(e,r){if(1&e&&(t.j41(0,"td",28),t.qex(1),t.EFF(2),t.bVm(),t.k0s()),2&e){const s=r.$implicit;t.R7$(2),t.SpI(" ",s.dateTime," ")}}function Rt(e,r){1&e&&(t.j41(0,"th",27),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&e&&(t.R7$(1),t.SpI(" ",t.bMT(2,1,"admin.reports.salesperson")," "))}function St(e,r){if(1&e&&(t.j41(0,"td",28),t.EFF(1),t.k0s()),2&e){const s=r.$implicit;t.R7$(1),t.SpI(" ",s.displaySalespersonName," ")}}function Ct(e,r){1&e&&(t.j41(0,"th",27),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&e&&(t.R7$(1),t.SpI(" ",t.bMT(2,1,"admin.reports.product_name_table_header")," "))}function yt(e,r){if(1&e&&(t.j41(0,"td",28),t.EFF(1),t.k0s()),2&e){const s=r.$implicit;t.R7$(1),t.SpI(" ",s.displayProductName," ")}}function Dt(e,r){1&e&&(t.j41(0,"th",29),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&e&&(t.R7$(1),t.SpI(" ",t.bMT(2,1,"admin.reports.quantity_table_header")," "))}function Ft(e,r){if(1&e&&(t.j41(0,"td",30),t.EFF(1),t.k0s()),2&e){const s=r.$implicit,a=t.XpG(3);t.R7$(1),t.SpI(" ",(null==s.quantity?null:s.quantity.toLocaleString(a.numberFormat,a.decimalPlacesFormat))||""," ")}}function bt(e,r){1&e&&(t.j41(0,"th",29),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&e&&(t.R7$(1),t.SpI(" ",t.bMT(2,1,"admin.reports.cost_amount")," "))}function xt(e,r){if(1&e&&(t.j41(0,"td",30),t.EFF(1),t.k0s()),2&e){const s=r.$implicit,a=t.XpG(3);t.R7$(1),t.SpI(" ",(null==s.costAmount?null:s.costAmount.toLocaleString(a.numberFormat,a.decimalPlacesFormat))||""," ")}}function Tt(e,r){1&e&&(t.j41(0,"th",29),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&e&&(t.R7$(1),t.SpI(" ",t.bMT(2,1,"admin.reports.weighted_cost_amount_table_header")," "))}function Et(e,r){if(1&e&&(t.j41(0,"td",30),t.EFF(1),t.k0s()),2&e){const s=r.$implicit,a=t.XpG(3);t.R7$(1),t.SpI(" ",(null==s.weightedCost?null:s.weightedCost.toLocaleStr
1ing(a.numberFormat,a.decimalPlacesFormat))||""," ")}}function It(e,r){1&e&&(t.j41(0,"th",29),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&e&&(t.R7$(1),t.SpI(" ",t.bMT(2,1,"admin.reports.ws_price")," "))}function Nt(e,r){if(1&e&&(t.j41(0,"td",30),t.EFF(1),t.k0s()),2&e){const s=r.$implicit,a=t.XpG(3);t.R7$(1),t.SpI(" ",(null==s.amount?null:s.amount.toLocaleString(a.numberFormat,a.decimalPlacesFormat))||""," ")}}function wt(e,r){1&e&&t.nrm(0,"tr",31)}function Wt(e,r){if(1&e&&t.nrm(0,"tr",32),2&e){const s=r.$implicit;t.AVh("element-row",!s.isTotalRow)("fw-bold",s.isTotalRow)}}function Gt(e,r){if(1&e&&(t.j41(0,"div",11)(1,"table",12),t.qex(2,13),t.DNE(3,gt,3,3,"th",14),t.DNE(4,_t,3,1,"td",15),t.bVm(),t.qex(5,16),t.DNE(6,vt,3,3,"th",14),t.DNE(7,ft,3,1,"td",15),t.bVm(),t.qex(8,17),t.DNE(9,Rt,3,3,"th",14),t.DNE(10,St,2,1,"td",15),t.bVm(),t.qex(11,18),t.DNE(12,Ct,3,3,"th",14),t.DNE(13,yt,2,1,"td",15),t.bVm(),t.qex(14,19),t.DNE(15,Dt,3,3,"th",20),t.DNE(16,Ft,2,1,"td",21),t.bVm(),t.qex(17,22),t.DNE(18,bt,3,3,"th",20),t.DNE(19,xt,2,1,"td",21),t.bVm(),t.qex(20,23),t.DNE(21,Tt,3,3,"th",20),t.DNE(22,Et,2,1,"td",21),t.bVm(),t.qex(23,24),t.DNE(24,It,3,3,"th",20),t.DNE(25,Nt,2,1,"td",21),t.bVm(),t.DNE(26,wt,1,0,"tr",25),t.DNE(27,Wt,1,4,"tr",26),t.k0s()()),2&e){const s=t.XpG(2);t.R7$(1),t.Y8G("dataSource",s.data),t.R7$(25),t.Y8G("matHeaderRowDef",s.displayedColumns),t.R7$(1),t.Y8G("matRowDefColumns",s.displayedColumns)}}function kt(e,r){if(1&e){const s=t.RV6();t.qex(0),t.DNE(1,mt,3,4,"div",2),t.j41(2,"div",3)(3,"div",4),t.DNE(4,Gt,28,3,"div",5),t.j41(5,"div")(6,"mat-paginator",6),t.bIt("page",function(n){t.eBV(s);const l=t.XpG();return t.Njj(l.paginatorChange(n))}),t.k0s()()()(),t.bVm()}if(2&e){const s=t.XpG();t.R7$(1),t.Y8G("ngIf",s.cardsData),t.R7$(3),t.Y8G("ngIf",!s.isLoading),t.R7$(2),t.Y8G("length",s.movementsCount)("pageIndex",s.filters.page)("pageSizeOptions",s.pageSizeOptions)("pageSize",s.filters.pageSize)}}function $t(e,r){1&e&&(t.j41(0,"div",33),t.nrm(1,"mat-spinner",34),t.k0s())}let rt=(()=>{var e;class r extends B.${constructor(a,n,l,p,c,h,f,E,w,g,m,W,ye,De,Fe){super(a),this.cdk=a,this.router=n,this.shopInfoService=l,this.activatedRoute=p,this.snackbarService=c,this.deviceInfoService=h,this.adminPanelService=f,this.matDialog=E,this.getWastageJournalReportCountInteractor=w,this.getWastageJournalReportInteractor=g,this.getWastageJournalSumReportInteractor=m,this.translateService=W,this.exportService=ye,this.browserStorageService=De,this.shopService=Fe,this.decimalPlacesFormat=new at.PM,this.pageSizeOptions=[10,25,50,100,200],this.displayedColumns=["id","date","salesPerson","productName","quantity","cost","weightedCost","amount"],this.data=[],this.cardsData={},this.currency="NOK",this.isLoading=!0,this.adminPanelService.setCurrentRouteInfo("admin.reports.title","reports")}ngOnInit(){this.addSubscription(this.deviceInfoService.getIsHandset$().subscribe(a=>this.isHandset=a)),this.addSubscription((0,z.z)([this.activatedRoute.queryParamMap,this.shopInfoService.getGeneralInfo(),this.shopInfoService.getShopInfo()]).subscribe(([a,n,l])=>{this.currency=l.currency,this.numberFormat=n.numberFormat,this.filters.allShops=n.shops,this.dateFormat=n.dateFormat,this.timeFormat=n.timeFormat,this.browserStorageService.getReportFilters(v.l.WASTAGE_REPORT_FILTERS_STORAGE_KEY)||(this.filters.shops=[n.shops[0].shopNo]),a.get("fromDate")&&a.get("toDate")&&(this.dateRange={startDate:u()(a.get("fromDate"),T.xX),endDate:u()(a.get("toDate"),T.xX)});const c=a.get("page");this.filters.page=Number(c||0);const h=a.get("pageSize");this.filters.pageSize=Number(h||50),a.get("selectedShops")&&(this.filters.shops=a.get("selectedShops").split(","));for(let f=1;f<=5;f++){const E=a.get("cat"+f);E&&(this.filters.categoryFilter["cat"+f]=E)}this.filters.searchTerm=a.get("searchTerm"),this.loadWastageJournalReport(),this.markForCheck()},()=>{this.isLoading=!1,this.snackbarService.error("error_reloading_data"),this.markForCheck()}))}getDatesAsQueryParams(){return{from:this.dateRange.startDate.format(T.xX),to:this.dateRange.endDate.format(T.xX)}}paginatorChange(a){this.filters.page=a.pageSize!=this.filters.pageSize?0:a.pageIndex,this.filters.pageSize=a.pageSize,this.renavigate()}renavigate(){var a,n,l,p,c;const h=this.getDatesAsQueryParams();this.router.navigate([],{queryParams:{fromDate:h.from,toDate:h.to,selectedShops:this.filters.shops.toString(),page:this.filters.page,pageSize:this.filters.pageSize,cat1:null===(a=this.filters.categoryFilter)||void 0===a?void 0:a.cat1,cat2:null===(n=this.filters.categoryFilter)||void 0===n?void 0:n.cat2,cat3:null===(l=this.filters.categoryFilter)||void 0===l?void 0:l.cat3,cat4:null===(p=this.filters.categoryFilter)||void 0===p?void 0:p.cat4,cat5:null===(c=this.filters.categoryFilter)||void 0===c?void 0:c.cat5,searchTerm:this.filters.searchTerm},relativeTo:this.activatedRoute,replaceUrl:!0})}updateCardsData(){const a={currency:this.currency,numberFormat:this.numberFormat,textColor:"white",appearance:"fill"};this.cardsData={movementsCount:{numberFormat:this.numberFormat,textColor:"white",appearance:"fill",title:"admin.reports.movement_count",value:this.movementsCount||0,color:"var(--sage-green)"},costAmount:{...a,title:"admin.reports.cost_amount",value:this.totalReport.costAmount||0,color:"var(--powder-blue)"},weightedCost:{...a,title:"admin.reports.weighted_cost_amount_table_header",value:this.totalReport.weightedCost||0,color:"var(--warm-tan)"},amount:{...a,title:"admin.reports.ws_price",value:this.totalReport.amount||0,color:"var(--dusty-purple)"}},this.markForCheck()}
1loadWastageJournalReport(){this.isLoading=!0,this.markForCheck();const a=this.getDatesAsQueryParams();this.filters.fromDate=a.from,this.filters.toDate=a.to,this.addSubscription((0,b.y)([this.getWastageJournalSumReportInteractor.execute(this.filters),this.getWastageJournalReportInteractor.execute(this.filters,this.dateFormat+" "+this.timeFormat),this.getWastageJournalReportCountInteractor.execute(this.filters)]).subscribe(([n,l,p])=>{this.totalReport=n,this.movementsCount=p.count,this.data=l,this.updateCardsData(),this.isLoading=!1,this.markForCheck()},()=>this.errorOccurred()))}getCategoryDisplayName(a){var n;const l=null===(n=this.filters)||void 0===n||null===(n=n.categories)||void 0===n?void 0:n.find(p=>p.id===a);return(null==l?void 0:l.displayName)||a}onExportOptionSelected(a){this.snackbarService.info("admin.reports.stock_reports.export_may_take_some_time"),this.isLoading=!0,this.markForCheck(),this.addSubscription(this.getWastageJournalReportInteractor.execute({...this.filters,page:null,pageSize:null},this.dateFormat+" "+this.timeFormat).subscribe({next:n=>{const l=n,p=[],c=[],h=[];c.push(this.translateService.instant("admin.reports.id_table_header")),h.push(C.w.NUMBER),c.push(this.translateService.instant("admin.reports.date_time")),h.push(C.w.TEXT),c.push(this.translateService.instant("admin.reports.salesperson")),h.push(C.w.TEXT),c.push(this.translateService.instant("admin.reports.product_name_table_header")),h.push(C.w.TEXT),c.push(this.translateService.instant("admin.reports.quantity_table_header")),h.push(C.w.NUMBER),c.push(this.translateService.instant("admin.reports.cost_amount")),h.push(C.w.NUMBER),c.push(this.translateService.instant("admin.reports.weighted_cost_amount_table_header")),h.push(C.w.NUMBER),c.push(this.translateService.instant("admin.reports.ws_price")),h.push(C.w.NUMBER),p.push(c),null==l||l.forEach(m=>{const W=[];W.push(null==m?void 0:m.id),W.push(null==m?void 0:m.dateTime),W.push(null==m?void 0:m.displaySalespersonName),W.push(null==m?void 0:m.displayProductName),W.push(null==m?void 0:m.quantity),W.push(null==m?void 0:m.costAmount),W.push(null==m?void 0:m.weightedCost),W.push(null==m?void 0:m.amount),p.push(W)});const f=["","","",this.translateService.instant("admin.reports.total")];f.push(this.totalReport.quantity),f.push(this.totalReport.costAmount),f.push(this.totalReport.weightedCost),f.push(this.totalReport.amount),p.push(f);const E=this.dateRange.startDate.format(this.dateFormat),w=this.dateRange.endDate.format(this.dateFormat),g=this.translateService.instant("admin.reports.wastage_journal_report")+"-"+this.translateService.instant("admin.reports.from_date_input_label")+" "+E+" "+this.translateService.instant("admin.reports.to_date_input_label")+" "+w;this.exportService.export({exportFileFormat:a,dataList:p,fileName:g,filters:this.filters,fromDate:E,toDate:w,excelExportColumnTypes:h}),this.isLoading=!1,this.markForCheck()},error:n=>{console.log(n),this.snackbarService.success("admin.reports.stock_reports.export_failed"),this.isLoading=!1,this.markForCheck()}}))}errorOccurred(){this.isLoading=!1,this.markForCheck(),this.snackbarService.error("error_reloading_data")}}return(e=r).\u0275fac=function(a){return new(a||e)(t.rXU(t.gRc),t.rXU(S.Ix),t.rXU(R.W),t.rXU(S.nX),t.rXU(I.z),t.rXU(d.E),t.rXU(k.f),t.rXU(j.bZ),t.rXU(M),t.rXU(K),t.rXU(F),t.rXU(x.c$),t.rXU(N._),t.rXU(v.l),t.rXU(U.L))},e.\u0275cmp=t.VBU({type:e,selectors:[["webshop-journal-reports"]],inputs:{dateRange:"dateRange",filters:"filters"},features:[t.Vt3],decls:2,vars:2,consts:[[4,"ngIf"],["class","loading-overlay",4,"ngIf"],["class","row gap-3 m-auto mb-3 w-100",4,"ngIf"],[1,"d-flex","py-md-3","p-0","flex-column","mx-auto"],[1,"row","g-0","d-flex","flex-column","position-relative"],["class","handy-div-container col-12 d-flex mw-100","style","overflow-y: hidden !important;",4,"ngIf"],["showFirstLastButtons","",1,"text-center",3,"length","pageIndex","pageSizeOptions","pageSize","page"],[1,"row","gap-3","m-auto","mb-3","w-100"],["class","col-md p-0",4,"ngFor","ngForOf"],[1,"col-md","p-0"],[3,"widgetData"],[1,"handy-div-container","col-12","d-flex","mw-100",2,"overflow-y","hidden !important"],["mat-table","",2,"overflow-y","auto","flex-grow","1",3,"dataSource"],["matColumnDef","id"],["mat-header-cell","",4,"matHeaderCellDef"],["mat-cell","",4,"matCellDef"],["matColumnDef","date"],["matColumnDef","salesPerson"],["matColumnDef","productName"],["matColumnDef","quantity"],["class","text-end","mat-header-cell","",4,"matHeaderCellDef"],["mat-cell","","class","text-end",4,"matCellDef"],["matColumnDef","cost"],["matColumnDef","weightedCost"],["matColumnDef","amount"],["mat-header-row","",4,"matHeaderRowDef"],["mat-row","",3,"element-row","fw-bold",4,"matRowDef","matRowDefColumns"],["mat-header-cell",""],["mat-cell",""],["mat-header-cell","",1,"text-end"],["mat-cell","",1,"text-end"],["mat-header-row",""],["mat-row",""],[1,"loading-overlay"],["color","accent"]],template:function(a,n){1&a&&(t.DNE(0,kt,7,6,"ng-container",0),t.DNE(1,$t,2,0,"div",1)),2&a&&(t.Y8G("ngIf",!n.isLoading),t.R7$(1),t.Y8G("ngIf",n.isLoading))},dependencies:[y.Sq,y.bT,G.LG,_.Zl,_.tL,_.ji,_.cC,_.YV,_.iL,_.KS,_.$R,_.YZ,_.NB,A.iy,Z.Q,y.lG,x.D9]}),r})();var nt=i(17238);let it=(()=>{var e;class r extends V.Y{constructor(a,n){super(a),this.userStorage=a,this.httpClient=n}getWastageReports(a){return this.httpClient.post("reporting/wastage",{shops:a.shops,fromDate:a.fromDate,toDate:a.toDate,categoryFilter:a.c
1ategoryFilter,searchTerm:a.searchTerm})}}return(e=r).\u0275fac=function(a){return new(a||e)(t.KVO(X.q),t.KVO(H.Qq))},e.\u0275prov=t.jDH({token:e,factory:e.\u0275fac}),r})(),lt=(()=>{var e;class r{constructor(a){this.networkRepository=a}execute(a){return this.networkRepository.getWastageReports(a).pipe((0,Q.T)(n=>((n=n.filter(l=>{var p;return(null==l||null===(p=l.rows)||void 0===p?void 0:p.length)>0})).forEach(l=>{var p;l.rows=null===(p=l.rows)||void 0===p?void 0:p.map(c=>{const h=Math.abs(c.costAmount*c.quantity),f=Math.abs(c.weightedCost*c.quantity),E=Math.abs(c.amount*c.quantity);return{...c,costSum:h,weightedCostSum:f,salesSum:E}})}),n[0])))}}return(e=r).\u0275fac=function(a){return new(a||e)(t.KVO(it))},e.\u0275prov=t.jDH({token:e,factory:e.\u0275fac}),r})();function jt(e,r){if(1&e&&(t.j41(0,"div",8),t.nrm(1,"webshop-report-widget",9),t.k0s()),2&e){const s=r.$implicit;t.R7$(1),t.Y8G("widgetData",s.value)}}function Xt(e,r){if(1&e&&(t.j41(0,"div",6),t.DNE(1,jt,2,1,"div",7),t.nI1(2,"keyvalue"),t.k0s()),2&e){const s=t.XpG(2);t.R7$(1),t.Y8G("ngForOf",t.i5U(2,1,s.cardsData,s.returnZero))}}function At(e,r){1&e&&(t.j41(0,"th",28),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&e&&(t.R7$(1),t.SpI(" ",t.bMT(2,1,"admin.reports.category_name_table_header")," "))}function Lt(e,r){if(1&e&&(t.qex(0),t.j41(1,"span",30),t.EFF(2),t.k0s(),t.bVm()),2&e){const s=t.XpG().$implicit,a=t.XpG(3);t.R7$(2),t.SpI(" ",a.getCategoryDisplayName(s.categoryId1)," ")}}function Pt(e,r){if(1&e&&(t.j41(0,"td",29),t.DNE(1,Lt,3,1,"ng-container",0),t.k0s()),2&e){const s=r.$implicit;t.R7$(1),t.Y8G("ngIf",s.isCategory)}}function Ut(e,r){1&e&&(t.j41(0,"th",28),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&e&&(t.R7$(1),t.SpI(" ",t.bMT(2,1,"admin.reports.product_name_table_header")," "))}function Jt(e,r){if(1&e&&(t.j41(0,"td",29),t.EFF(1),t.k0s()),2&e){const s=r.$implicit;t.R7$(1),t.SpI(" ",s.productName," ")}}function Vt(e,r){1&e&&(t.j41(0,"th",31),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&e&&(t.R7$(1),t.SpI(" ",t.bMT(2,1,"admin.reports.quantity_table_header")," "))}function Mt(e,r){if(1&e&&(t.j41(0,"td",32),t.EFF(1),t.k0s()),2&e){const s=r.$implicit,a=t.XpG(3);t.R7$(1),t.SpI(" ",(null==s.quantity?null:s.quantity.toLocaleString(a.numberFormat,a.decimalPlacesFormat))||""," ")}}function Ot(e,r){1&e&&(t.j41(0,"th",31),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&e&&(t.R7$(1),t.SpI(" ",t.bMT(2,1,"admin.reports.cost_amount")," "))}function Bt(e,r){if(1&e&&(t.j41(0,"td",32),t.EFF(1),t.k0s()),2&e){const s=r.$implicit,a=t.XpG(3);t.R7$(1),t.SpI(" ",(null==s.costAmount?null:s.costAmount.toLocaleString(a.numberFormat,a.decimalPlacesFormat))||""," ")}}function Yt(e,r){1&e&&(t.j41(0,"th",31),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&e&&(t.R7$(1),t.SpI(" ",t.bMT(2,1,"admin.reports.weighted_cost_amount_table_header")," "))}function zt(e,r){if(1&e&&(t.j41(0,"td",32),t.EFF(1),t.k0s()),2&e){const s=r.$implicit,a=t.XpG(3);t.R7$(1),t.SpI(" ",(null==s.weightedCost?null:s.weightedCost.toLocaleString(a.numberFormat,a.decimalPlacesFormat))||""," ")}}function Ht(e,r){1&e&&(t.j41(0,"th",31),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&e&&(t.R7$(1),t.SpI(" ",t.bMT(2,1,"admin.reports.sales_price")," "))}function Qt(e,r){if(1&e&&(t.j41(0,"td",32),t.EFF(1),t.k0s()),2&e){const s=r.$implicit,a=t.XpG(3);t.R7$(1),t.SpI(" ",(null==s.amount?null:s.amount.toLocaleString(a.numberFormat,a.decimalPlacesFormat))||""," ")}}function Kt(e,r){1&e&&(t.j41(0,"th",31),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&e&&(t.R7$(1),t.SpI(" ",t.bMT(2,1,"admin.reports.cost_sum")," "))}function Zt(e,r){if(1&e&&(t.j41(0,"td",32),t.EFF(1),t.k0s()),2&e){const s=r.$implicit,a=t.XpG(3);t.R7$(1),t.SpI(" ",(null==s.costSum?null:s.costSum.toLocaleString(a.numberFormat,a.decimalPlacesFormat))||""," ")}}function qt(e,r){1&e&&(t.j41(0,"th",31),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&e&&(t.R7$(1),t.SpI(" ",t.bMT(2,1,"admin.reports.weighted_cost_sum")," "))}function te(e,r){if(1&e&&(t.j41(0,"td",32),t.EFF(1),t.k0s()),2&e){const s=r.$implicit,a=t.XpG(3);t.R7$(1),t.SpI(" ",(null==s.weightedCostSum?null:s.weightedCostSum.toLocaleString(a.numberFormat,a.decimalPlacesFormat))||""," ")}}function ee(e,r){1&e&&(t.j41(0,"th",31),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&e&&(t.R7$(1),t.SpI(" ",t.bMT(2,1,"admin.reports.sales_sum")," "))}function ae(e,r){if(1&e&&(t.j41(0,"td",32),t.EFF(1),t.k0s()),2&e){const s=r.$implicit,a=t.XpG(3);t.R7$(1),t.SpI(" ",(null==s.salesSum?null:s.salesSum.toLocaleStr
1ing(a.numberFormat,a.decimalPlacesFormat))||""," ")}}function oe(e,r){1&e&&t.nrm(0,"tr",33)}function se(e,r){if(1&e&&t.nrm(0,"tr",34),2&e){const s=r.$implicit;t.AVh("element-row",!s.isTotalRow)("fw-bold",s.isTotalRow)}}function re(e,r){if(1&e&&(t.j41(0,"div",10)(1,"table",11),t.qex(2,12),t.DNE(3,At,3,3,"th",13),t.DNE(4,Pt,2,1,"td",14),t.bVm(),t.qex(5,15),t.DNE(6,Ut,3,3,"th",13),t.DNE(7,Jt,2,1,"td",14),t.bVm(),t.qex(8,16),t.DNE(9,Vt,3,3,"th",17),t.DNE(10,Mt,2,1,"td",18),t.bVm(),t.qex(11,19),t.DNE(12,Ot,3,3,"th",17),t.DNE(13,Bt,2,1,"td",18),t.bVm(),t.qex(14,20),t.DNE(15,Yt,3,3,"th",17),t.DNE(16,zt,2,1,"td",18),t.bVm(),t.qex(17,21),t.DNE(18,Ht,3,3,"th",17),t.DNE(19,Qt,2,1,"td",18),t.bVm(),t.qex(20,22),t.DNE(21,Kt,3,3,"th",23),t.DNE(22,Zt,2,1,"td",18),t.bVm(),t.qex(23,24),t.DNE(24,qt,3,3,"th",23),t.DNE(25,te,2,1,"td",18),t.bVm(),t.qex(26,25),t.DNE(27,ee,3,3,"th",17),t.DNE(28,ae,2,1,"td",18),t.bVm(),t.DNE(29,oe,1,0,"tr",26),t.DNE(30,se,1,4,"tr",27),t.k0s()()),2&e){const s=t.XpG(2);t.R7$(1),t.Y8G("dataSource",s.groupedData),t.R7$(28),t.Y8G("matHeaderRowDef",s.displayedColumns),t.R7$(1),t.Y8G("matRowDefColumns",s.displayedColumns)}}function ne(e,r){if(1&e&&(t.qex(0),t.DNE(1,Xt,3,4,"div",2),t.j41(2,"div",3)(3,"div",4),t.DNE(4,re,31,3,"div",5),t.k0s()(),t.bVm()),2&e){const s=t.XpG();t.R7$(1),t.Y8G("ngIf",s.cardsData),t.R7$(3),t.Y8G("ngIf",!s.isLoading)}}function ie(e,r){1&e&&(t.j41(0,"div",35),t.nrm(1,"mat-spinner",36),t.k0s())}let ct=(()=>{var e;class r extends B.${constructor(a,n,l,p,c,h,f,E,w,g,m,W){super(a),this.cdk=a,this.router=n,this.shopInfoService=l,this.activatedRoute=p,this.snackbarService=c,this.deviceInfoService=h,this.adminPanelService=f,this.getWastageReportInteractor=E,this.translateService=w,this.exportService=g,this.browserStorageService=m,this.shopService=W,this.decimalPlacesFormat=new at.PM,this.displayedColumns=["categoryName","productName","quantity","cost","weightedCost","sales","costSum","weightedCostSum","salesSum"],this.groupedData=[],this.exportOptions=[Y.U.EXCEL],this.cardsData={},this.currency="NOK",this.isLoading=!0,this.adminPanelService.setCurrentRouteInfo("admin.reports.title","reports")}ngOnInit(){this.addSubscription(this.deviceInfoService.getIsHandset$().subscribe(a=>this.isHandset=a)),this.addSubscription((0,z.z)([this.activatedRoute.queryParamMap,this.shopInfoService.getGeneralInfo(),this.shopInfoService.getShopInfo()]).subscribe(([a,n,l])=>{this.currency=null==l?void 0:l.currency,this.numberFormat=n.numberFormat,this.filters.allShops=n.shops,this.dateFormat=n.dateFormat,this.browserStorageService.getReportFilters(v.l.WASTAGE_REPORT_FILTERS_STORAGE_KEY)||(this.filters.shops=[n.shops[0].shopNo]),a.get("fromDate")&&a.get("toDate")&&(this.dateRange={startDate:u()(a.get("fromDate"),T.xX),endDate:u()(a.get("toDate"),T.xX)}),a.get("selectedShops")&&(this.filters.shops=a.get("selectedShops").split(","));for(let c=1;c<=5;c++){const h=a.get("cat"+c);h&&(this.filters.categoryFilter["cat"+c]=h)}nt.$.isNotBlank(a.get("searchTerm"))&&(this.filters.searchTerm=a.get("searchTerm")),this.loadWastageReport(),this.markForCheck()},()=>{this.isLoading=!1,this.snackbarService.error("error_reloading_data"),this.markForCheck()}))}getDatesAsQueryParams(){return{from:this.dateRange.startDate.format(T.xX),to:this.dateRange.endDate.format(T.xX)}}loadWastageReport(){this.isLoading=!0,this.markForCheck();const a=this.getDatesAsQueryParams();this.filters.fromDate=a.from,this.filters.toDate=a.to,this.addSubscription(this.getWastageReportInteractor.execute(this.filters).subscribe(n=>{this.data=n,this.groupedData=this.groupDataByCategory(n),this.isLoading=!1,this.markForCheck()},()=>this.errorOccurred()))}getCategoryDisplayName(a){var n;const l=null===(n=this.filters)||void 0===n||null===(n=n.categories)||void 0===n?void 0:n.find(p=>p.id===a);return(null==l?void 0:l.displayName)||a}onExportOptionSelected(a){this.snackbarService.info("admin.reports.stock_reports.export_may_take_some_time"),this.isLoading=!0,this.markForCheck(),this.addSubscription(this.getWastageReportInteractor.execute(this.filters).subscribe({next:n=>{const l=this.groupDataByCategory(n),p=[],c=[],h=[];c.push(this.translateService.instant("admin.reports.category_name_table_header")),h.push(C.w.TEXT),c.push(this.translateService.instant("admin.reports.product_name_table_header")),h.push(C.w.TEXT),c.push(this.translateService.instant("admin.reports.quantity_table_header")),h.push(C.w.NUMBER),c.push(this.translateService.instant("admin.reports.cost_amount")),h.push(C.w.NUMBER),c.push(this.translateService.instant("admin.reports.weighted_cost_amount_table_header")),h.push(C.w.NUMBER),c.push(this.translateService.instant("admin.reports.sales")),h.push(C.w.NUMBER),c.push(this.translateService.instant("admin.reports.cost_sum")),h.push(C.w.NUMBER),c.push(this.translateService.instant("admin.reports.weighted_cost_sum")),h.push(C.w.NUMBER),c.push(this.translateService.instant("admin.reports.sales_sum")),h.push(C.w.NUMBER),p.push(c),null==l||l.forEach(g=>{const m=[];m.push(g.isCategory?this.getCategoryDisplayName(null==g?void 0:g.categoryId1):""),m.push(null==g?void 0:g.productName),m.push(null==g?void 0:g.quantity),m.push(null==g?void 0:g.costAmount),m.push(null==g?void 0:g.weightedCost),m.push(null==g?void 0:g.amount),m.push(null==g?void 0:g.costSum),m.push(null==g?void 0:g.weightedCostSum),m.push(null==g?void 0:g.salesSum),p.push(m)});const f=this.dateRange.startDate.format(this.dateFormat),E=this.dateRange.endDate.format(this.dateFormat),w=this.translateService.instant("admin.reports.wastage_report")+"-"+this.translateService.instant("admin.reports.from_date_input_label")+" "+f+" "+this.translateService.instant("admin.reports.to_date_input_label")+" "+E;this.exportService.export({exportFileFormat:a,dataList:p,fileName:w,filters:this.filters,fromDate:f,toDate:E,excelExportColumnTypes:h}),this.isLoading=!1,this.markForCheck()},error:n=>{console.log(n),this.snackbarService.success("admin.reports.stock_reports.export_failed"),this.isLoading=!1,this.markForCheck()}}))}errorOccurred(){this.isLoading=!1,this.markForCheck(),this.snackbarService.error("error_reloading_data")}groupDataByCategory(a){var n;if(!a||!a.rows)return[];const l=[],p=new Map;return this.totals={quantity:0,costAmount:0,weightedCost:0,amount:0,costSum:0,weightedCostSum:0,salesSum:0,isCategory:!1,isTotalRow:!0}
1,null==a||null===(n=a.rows)||void 0===n||n.forEach(c=>{var h;const f=c.categoryId1||"No Category";p.has(f)||p.set(f,[]),null===(h=p.get(f))||void 0===h||h.push(c),this.totals.quantity+=c.quantity||0,this.totals.costAmount+=c.costAmount||0,this.totals.weightedCost+=c.weightedCost||0,this.totals.amount+=c.amount||0,this.totals.costSum+=c.costSum||0,this.totals.weightedCostSum+=c.weightedCostSum||0,this.totals.salesSum+=c.salesSum||0}),p.forEach((c,h)=>{l.push({categoryId1:h,isCategory:!0}),c.forEach(f=>{l.push({...f,isCategory:!1})})}),l.push({...this.totals,productName:"Total"}),this.updateCardsData(),l}updateCardsData(){const a={currency:this.currency,numberFormat:this.numberFormat,textColor:"white",appearance:"fill"};this.cardsData={quantityTotal:{numberFormat:this.numberFormat,textColor:"white",appearance:"fill",title:"admin.reports.total_qty",value:this.totals.quantity||0,color:"var(--sage-green)"},costSum:{...a,title:"admin.reports.cost_sum",value:this.totals.costSum||0,color:"var(--powder-blue)"},weightedCostSum:{...a,title:"admin.reports.weighted_cost_sum",value:this.totals.weightedCostSum||0,color:"var(--warm-tan)"},salesSum:{...a,title:"admin.reports.sales_sum",value:this.totals.salesSum||0,color:"var(--dusty-purple)"}},this.markForCheck()}}return(e=r).\u0275fac=function(a){return new(a||e)(t.rXU(t.gRc),t.rXU(S.Ix),t.rXU(R.W),t.rXU(S.nX),t.rXU(I.z),t.rXU(d.E),t.rXU(k.f),t.rXU(lt),t.rXU(x.c$),t.rXU(N._),t.rXU(v.l),t.rXU(U.L))},e.\u0275cmp=t.VBU({type:e,selectors:[["webshop-wastage-reports"]],inputs:{dateRange:"dateRange",filters:"filters"},features:[t.Vt3],decls:2,vars:2,consts:[[4,"ngIf"],["class","loading-overlay",4,"ngIf"],["class","row gap-3 m-auto mb-3 w-100",4,"ngIf"],[1,"d-flex","py-md-3","p-0","flex-column","mx-auto"],[1,"row","g-0","d-flex","flex-column","position-relative"],["class","handy-div-container col-12 d-flex mw-100","style","overflow-y: hidden !important;",4,"ngIf"],[1,"row","gap-3","m-auto","mb-3","w-100"],["class","col-md p-0",4,"ngFor","ngForOf"],[1,"col-md","p-0"],[3,"widgetData"],[1,"handy-div-container","col-12","d-flex","mw-100",2,"overflow-y","hidden !important"],["mat-table","",2,"overflow-y","auto","flex-grow","1",3,"dataSource"],["matColumnDef","categoryName"],["mat-header-cell","",4,"matHeaderCellDef"],["mat-cell","",4,"matCellDef"],["matColumnDef","productName"],["matColumnDef","quantity"],["class","text-end","mat-header-cell","",4,"matHeaderCellDef"],["mat-cell","","class","text-end",4,"matCellDef"],["matColumnDef","cost"],["matColumnDef","weightedCost"],["matColumnDef","sales"],["matColumnDef","costSum"],["class"," text-end","mat-header-cell","",4,"matHeaderCellDef"],["matColumnDef","weightedCostSum"],["matColumnDef","salesSum"],["mat-header-row","",4,"matHeaderRowDef"],["mat-row","",3,"element-row","fw-bold",4,"matRowDef","matRowDefColumns"],["mat-header-cell",""],["mat-cell",""],[2,"font-weight","bold !important"],["mat-header-cell","",1,"text-end"],["mat-cell","",1,"text-end"],["mat-header-row",""],["mat-row",""],[1,"loading-overlay"],["color","accent"]],template:function(a,n){1&a&&(t.DNE(0,ne,5,2,"ng-container",0),t.DNE(1,ie,2,0,"div",1)),2&a&&(t.Y8G("ngIf",!n.isLoading),t.R7$(1),t.Y8G("ngIf",n.isLoading))},dependencies:[y.Sq,y.bT,G.LG,_.Zl,_.tL,_.ji,_.cC,_.YV,_.iL,_.KS,_.$R,_.YZ,_.NB,Z.Q,y.lG,x.D9]}),r})();var pt=i(97268),ot=i(46781),st=i(96850),le=i(58003);function ce(e,r){if(1&e){const s=t.RV6();t.j41(0,"webshop-reports-top-bar",11),t.bIt("dateChange",function(n){t.eBV(s);const l=t.XpG(2);return t.Njj(l.applyRange(n))})("filtersClick",function(){t.eBV(s);const n=t.XpG(2);return t.Njj(n.filtersClicked())})("searchQueryChange",function(n){t.eBV(s);const l=t.XpG(2);return t.Njj(l.searchQueryChanged(n))})("exportClick",function(n){t.eBV(s);const l=t.XpG(2);return t.Njj(l.onExportOptionSelected(n))}),t.k0s()}if(2&e){const s=t.XpG(2);t.Y8G("initialRange",s.dateRange)("hasSearch",!0)("searchTerm",s.filters.searchTerm)("showExportButton",!0)("exportOptions",s.exportOptions)("title","admin.reports.wastage_report")}}function pe(e,r){if(1&e&&(t.j41(0,"div",12)(1,"div",13),t.nrm(2,"webshop-wastage-reports",14),t.k0s()()),2&e){const s=t.XpG(2);t.R7$(2),t.Y8G("dateRange",s.dateRange)("filters",s.filters)}}function de(e,r){if(1&e&&(t.j41(0,"div",12)(1,"div",13),t.nrm(2,"webshop-journal-reports",14),t.k0s()()),2&e){const s=t.XpG(2);t.R7$(2),t.Y8G("dateRange",s.dateRange)("filters",s.filters)}}function he(e,r){if(1&e){const s=t.RV6();t.j41(0,"div",2),t.DNE(1,ce,1,6,"webshop-reports-top-bar",3),t.j41(2,"div",4)(3,"div",5)(4,"nav",6)(5,"a",7),t.bIt("click",function(){t.eBV(s);const n=t.XpG();return t.Njj(n.activeTabChange(n.WastageReportTab.WASTAGE))}),t.EFF(6),t.nI1(7,"translate"),t.k0s(),t.j41(8,"a",7),t.bIt("click",function(){t.eBV(s);const n=t.XpG();return t.Njj(n.activeTabChange(n.WastageReportTab.JOURNAL))}),t.EFF(9),t.nI1(10,"translate"),t.k0s()(),t.j41(11,"div",8,9),t.DNE(13,pe,3,2,"div",10),t.DNE(14,de,3,2,"div",10),t.k0s()()()()}if(2&e){const s=t.sdS(12),a=t.XpG();t.R7$(1),t.Y8G("ngIf",a.initiatedFilters),t.R7$(3),t.Y8G("tabPanel",s),t.R7$(1),t.AVh("active-tab",a.currentTab===a.WastageReportTab.WASTAGE),t.R7$(1),t.SpI(" ",t.bMT(7,10,"admin.reports.wastage_report")," "),t.R7$(2),t.AVh("active-tab",a.currentTab===a.WastageReportTab.JOURNAL),t.R7$(1),t.SpI(" ",t.bMT(10,12,"admin.reports.wastage_journal_report")," "),t.R7$(4),t.Y8G("ngIf",a.currentTab===a.WastageReportTab.WASTAGE),t.R7$(1),t.Y8G("ngIf",a.currentTab===a.WastageReportTab.JOURNAL)}}function ue(e,r){1&e&&(t.j41(0,"div",15),t.nrm(1,"mat-spinner",16),t.k0s())}var q=function(e){return e[e.WASTAGE=0]="WASTAGE",e[e.JOURNAL=1]="JOURNAL",e}(q||{});const me=[{path:"",component:(()=>{var e;class r extends B.${constructor(a,n,l,p,c,h,f,E){super(a),this.cdk=a,this.router=n,this.activatedRoute=l,this.snackbarService=p,this.matDialog=c,this.shopInfoService=h,this.browserStorageService=f,this.categoryService=E,this.currentTab=q.WASTAGE,this.isLoading=!1,this.initiatedFilters=!1,this.WastageReportTab=q,this.dateRange={startDate:u()().subtract(30,"day"),endDate:u()()},this.filters={searchTerm:"",categoryFilter:{}},this.exportOptions=[Y.U.EXCEL]}ngOnInit(){this.addSubscription((0,z.z)([this.shopInfoService.getGeneralInfo(),this.shopInfoService.getShopInfo(),this.categoryService.fetchCategories()]).subscribe(([a,n,l])=>{let p=this.browserStorageService.getReportFilters(v.l.WASTAGE_REPORT_FILTERS_STORAGE_KEY);p?(this.filters=p,this.dateRange={startDate:u()(this.filters.fromDate,T.xX),endDate:u()(this.filters.toDate,T.xX)}):(this.filters.shops=[a.shops[0].shopNo],this.filters.source=pt.kc.ANY,this.filters.pageSize=50,this.filters.page=0),this.filters.categories=l,this.filters.allShops=a.shops,this.initiateQueryParams()}))}initiateQueryParams(){this.addSubscription((0,z.z)([this.activatedRoute.queryParamMap,this.shopInfoService.getGeneralInfo(),this.shopInfoService.getShopInfo(),this.categoryService.fetchCategories()]).subscribe(([a,n,l,p])=>{let c=this.browserStorageService.getReportFilters(v.l.CATEGORY_REPORT_FILTERS_STORAGE_KEY);c?(this.filters=c,this.dateRange={startDate:u()(this.filters.fromDate,T.xX),endDate:u()(this.filters.toDate,T.xX)}):(this.filters.shops=[n.shops[0].shopNo],this.filters.source=pt.kc.ANY,this.filters.pageSize=50,this.filters.page=0),this.filters.categories=p,this.filters.allShops=n.shops,a.get("fromDate")&&a.get("toDate")&&(this.dateRange={startDate:u()(a.get("fromDate"),T.xX),endDate:u()(a.get("toDate"),T.xX)});const h=a.get("page");h&&(this.filters.page=Number(h));const f=a.get("pageSize");f&&(this.filters.pageSize=Number(f)),a.get("selectedShops")&&(this.filters.shops=a.get("selectedShops").split(","));for(let w=1;w<=5;w++){const g=a.get("cat"+w);g&&(this.filters.categoryFilter["cat"+w]=g)}nt.$.isNotBlank(a.get("searchTerm"))&&(this.filters.searchTerm=a.get("searchTerm"));const E=this.getDatesAsQueryParams();this.filters.fromDate=E.from,this.filters.toDate=E.to,this.browserStorageService.setReportFilters(v.l.WASTAGE_REPORT_FILTERS_STORAGE_KEY,this.filters),this.initiatedFilters=!0,this.markForCheck()}))}activeTabChange(a){this.currentTab=a,this.markForCheck()}getDatesAsQueryParams(){return{from:this.dateRange.startDate.format(T.xX),to:this.dateRange.endDate.format(T.xX)}}renavigate(){var a,n,l,p,c;const h=this.getDatesAsQueryParams();this.router.navigate([],{queryParams:{fromDate:h.from,toDate:h.to,selectedShops:this.filters.shops.toString(),page:this.filters.page,pageSize:this.filters.pageSize,cat1:null===(a=this.filters.categoryFilter)||void 0===a?void 0:a.cat1,cat2:null===(n=this.filters.categoryFilter)||void 0===n?void 0:n.cat2,cat3:null===(l=this.filters.categoryFilter)||void 0===l?void 0:l.cat3,cat4:null===(p=this.filters.categoryFilter)||void 0===p?void 0:p.cat4,cat5:null===(c=this.filters.categoryFilter)||void 0===c?void 0:c.cat5,searchTerm:this.filters.searchTerm},relativeTo:this.activatedRoute,replaceUrl:!0})}applyRange(a){this.dateRange=a,this.detectChanges(),this.renavigate()}filtersClicked(){const a=this.matDialog.open(et.R,{...this.filtersDefaultConfig});a.componentInstance.content=et.Z.BASIC_REPORTS_FILTER,a.componentInstance.initialData={...this.filters},a.componentInstance.shownFields=[J.Li.singleShopSelect,J.Li.category],a.afterClosed().subscribe(n=>{n&&(this.filters=n,this.renavigate())},()=>{this.isLoading=!1,this.snackbarService.error("error_reloading_data"),this.markForCheck()})}searchQueryChanged(a){this.filters.searchTerm=a,this.renavigate()}onExportOptionSelected(a){this.currentTab===q.WASTAGE&&this.wastageReportsComponent.onExportOptionSelected(a),this.currentTab===q.JOURNAL&&this.journalReportsComponent.onExportOptionSelected(a)}}return(e=r).\u0275fac=function(a){return new(a||e)(t.rXU(t.gRc),t.rXU(S.Ix),t.rXU(S.nX),t.rXU(I.z),t.rXU(j.bZ),t.rXU(R.W),t.rXU(v.l),t.rXU(ot.M))},e.\u0275cmp=t.VBU({type:e,selectors:[["webshop-wastage-reports-container"]],viewQuery:function(a,n){if(1&a&&(t.GBs(ct,5),t.GBs(rt,5)),2&a){let l;t.mGM(l=t.lsd())&&(n.wastageReportsComponent=l.first),t.mGM(l=t.lsd())&&(n.journalReportsComponent=l.first)}},features:[t.Vt3],decls:2,vars:2,consts:[["class","m-3",4,"ngIf"],["class","loading-overlay",4,"ngIf"],[1,"m-3"],[3,"initialRange","hasSearch","searchTerm","showExportButton","exportOptions","title","dateChange","filtersClick","searchQueryChange","exportClick",4,"ngIf"],[1,"d-flex","mb-3"],[1,"col-12"],["mat-tab-nav-bar","","color","accent",1,"mw-100","mb-2",2,"background","white","flex-grow","1",3,"tabPanel"],["mat-tab-link","",3,"click"],[1,"mw-100","w-100","mh-100"],["tabPanel",""],["class","mw-100 w-100 mh-100 h-100",4,"ngIf"],[3,"initialRange","hasSearch","searchTerm","showExportButton","exportOptions","title","dateChange","filtersClick","searchQueryChange","exportClick"],[1,"mw-100","w-100","mh-100","h-100"],[1,"h-100"],[1,"w-100","h-100",3,"dateRange","filters"],[1,"loading-overlay"],["color","accent"]],template:function(a,n){1&a&&(t.DNE(0,he,15,14,"div",0),t.DNE(1,ue,2,0,"div",1)),2&a&&(t.Y8G("ngIf",!n.isLoading),t.R7$(1),t.Y8G("ngIf",n.isLoading))},dependencies:[y.bT,G.LG,st.Bu,st.Ql,ct,rt,le.l,x.D9]}),r})()}];let ge=(()=>{var e;class r{}return(e=r).\u0275fac=function(a){return new(a||e)},e.\u0275mod=t.$C({type:e}),e.\u0275inj=t.G2t({imports:[S.iI.forChild(me),S.iI]}),r})();var _e=i(14823),dt=i(78287),ht=i(86087);let ve=(()=>{var e;class r{}return(e=r).\u0275fac=function(a){return new(a||e)},e.\u0275mod=t.$C({type:e}),e.\u0275inj=t.G2t({providers:[ot.M,N._,M,K,F,O],imports:[y.MD,G.D6,_.tP,A.Ou,_e.uc,j.hM,x.h,D.wG,$.Hu,P.m_,y.MD,S.iI,dt.d,ht.P]}),r})();var fe=i(37154),Re=i(80963);let Se=(()=>{var e;class r{}return(e=r).\u0275fac=function(a){return new(a||e)},e.\u0275mod=t.$C({type:e}),e.\u0275inj=t.G2t({providers:[ot.M,N._,lt,it],imports:[y.MD,G.D6,_.tP,x.h,D.wG,P.m_,y.MD,S.iI,dt.d,ht.P]}),r})(),Ce=(()=>{var e;class r{}return(e=r).\u0275fac=function(a){return new(a||e)},e.\u0275mod=t.$C({type:e}),e.\u0275inj=t.G2t({providers:[ot.M],imports:[y.MD,ge,G.D6,st.RI,x.h,D.wG,$.Hu,P.m_,y.MD,S.iI,Se,ve,fe.S,Re.M]}),r})()},10357:(tt,L,i)=>{i.d(L,{N:()=>G});var y=i(33425),x=i(17705);let G=(()=>{var D;class ${constructor(){this.decimalNumberFormat=new y.PM}
1transform(S,B="us-US",J){return null==S?void 0:S.toLocaleString(B,void 0===J?this.decimalNumberFormat:{minimumFractionDigits:J,maximumFractionDigits:J})}}return(D=$).\u0275fac=function(S){return new(S||D)},D.\u0275pipe=x.EJ8({name:"numFormat",type:D,pure:!0,standalone:!0}),$})()},60821:(tt,L,i)=>{i.d(L,{$:()=>G});var y=i(17705),x=i(345);let G=(()=>{var D;class ${constructor(S){this.sanitized=S}transform(S){return this.sanitized.bypassSecurityTrustHtml(S)}}return(D=$).\u0275fac=function(S){return new(S||D)(y.rXU(x.up,16))},D.\u0275pipe=y.EJ8({name:"safeHtml",type:D,pure:!0,standalone:!0}),$})()}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.