Skip to content

MrmWarehouseScrapComponent

reference
2 min readUpdated

Kind: Class

Source: Frontend/src/app/components/dashboard/dashboard-libary/widgets/mrm-warehouse-scrap/mrm-warehouse-scrap.component.ts (line 90)

Part of: Frontend

MrmWarehouseScrapComponent is an Angular dashboard widget that displays warehouse scrap data. It loads and initializes dashboard state, checks feature subscription access, calculates monthly totals, formats prices and month labels, and saves dashboard configuration changes.

Extends: BaseWidgetComponent

Methods

MethodSignatureReturns
checkFeatureSubscriptioncheckFeatureSubscription()boolean
ngOnInitngOnInit()void
ngOnChangesngOnChanges()void
getDashboardDatagetDashboardData()void
initalizingDatainitalizingData(value: BranchData[])void
saveDashboardDatasaveDashboardData()void
calculateSumByMonthcalculateSumByMonth(monthIndex: number)void
translateMonthNametranslateMonthName(month: MonthData)string
getpriceFormattedgetpriceFormatted(x: undefined)string
onResizeonResize()void
setChachingsetChaching()void
getChachinggetChaching()void
switchChartTypeHandlerswitchChartTypeHandler()void
switchBasedOnTendencyHandlerswitchBasedOnTendencyHandler()void
comparingWithPrevMonthcomparingWithPrevMonth(month: MonthData, bIndex: number, index: number, propertyName: string)string
comparingBookingWithPrevSummcomparingBookingWithPrevSumm(month: MonthsSum, index: number, propertyName: string)string
isCurrentMonthisCurrentMonth(month: MonthData)boolean
getpriceForecastAmountgetpriceForecastAmount(month: MonthData)number
expectedCurrencyChangeexpectedCurrencyChange(e: undefined)void
selectTextselectText(e: undefined)void
editSelectedMonthPrepareeditSelectedMonthPrepare(month: MonthData, supplierId: number)void
copyValueFromPrevMonthcopyValueFromPrevMonth(month: MonthData, monthIndex: number)void
sortingsorting(propertyName: string, propertyType: string, monthIndex: number)void
openPopupopenPopup(n: string, t: string, i: string, btnTxt: string)void
savePopupsavePopup()void
ClosewithDonotSaveClosewithDonotSave()void
OnOpenedPopupOnOpenedPopup()void
closePopupclosePopup()void

Properties

PropertyType
sharedPopupSharedPopupComponent
_widgetWidget
_widgetTypestring
yearIdnumber
periodIdnumber
countOfEditablePrevMonthsnumber
withoutOptionBarboolean
editModeboolean
bookingOrSalesnumber
withNominalboolean
selectedTeamnumber
forecastRuleIdnumber
allowedtoEditboolean
allowedtoEnableEdtingboolean
widgetEditRequestany
widgetEditEndany
forecastRulesany[]
selectedYearnumber
numYearsDatasourceany[]
todayWidgetsEnumany
cachingWidgetDataCachingWidgetData
dataBranchData[]
originalDataBranchData[]
selectedDataBranchData[]
branchCurrencyany
basedOnTendencyboolean
SeriseRangeany[]
echartsIntanceany
totalBookingMonthsMonthsSum[]
tempMonthSumMonthsSum
totalTargetsnumber
yearBookingnumber
totalForecastsnumber
tempTotalTargetTotalTargets
popupany
searchTextstring
isModeOfInsertFromPrevMonthActiveboolean
pastDiffnumber
urrenFeaturenumber
sortingDirectionnumber

Where it refuses work

  • MrmWarehouseScrapComponent stops the work with an early return when a[propertyName] < b[propertyName], in 2 places.
  • MrmWarehouseScrapComponent stops the work with an early return when a[propertyName] > b[propertyName], in 2 places.
  • MrmWarehouseScrapComponent stops the work with an early return when this.dashboardLibraryService.checkFeatureSubscription(this.widget.chartEnumId).
  • MrmWarehouseScrapComponent stops the work with an early return when month.MonthId == 12.
  • MrmWarehouseScrapComponent stops the work with an early return when month[propertyName] < this.data[bIndex].MRMScrap[index - 1][propertyName].
  • MrmWarehouseScrapComponent stops the work with an early return when month[propertyName] < this.totalBookingMonths[index - 1][propertyName].

Diagram

mermaid
graph LR
  A[Angular lifecycle] --> B[ngOnInit]
  A --> C[ngOnChanges]
  B --> D[checkFeatureSubscription]
  D --> E[getDashboardData]
  E --> F[initalizingData]
  F --> G[calculateSumByMonth]
  G --> H[translateMonthName]
  G --> I[getpriceFormatted]
  C --> J[saveDashboardData]
  K[Window resize] --> L[onResize]

Usage

ts
import { Component, ViewChild, AfterViewInit } from '@angular/core';
import { MrmWarehouseScrapComponent } from './mrm-warehouse-scrap.component';

@Component({
  selector: 'app-dashboard-page',
  template: `
    <app-mrm-warehouse-scrap
      #warehouseScrapWidget>
    </app-mrm-warehouse-scrap>
  `
})
export class DashboardPageComponent implements AfterViewInit {
  @ViewChild('warehouseScrapWidget')
  warehouseScrapWidget!: MrmWarehouseScrapComponent;

  ngAfterViewInit(): void {
    if (this.warehouseScrapWidget.checkFeatureSubscription()) {
      this.warehouseScrapWidget.getDashboardData();
    }
  }
}

AI Coding Instructions

  • Keep data loading inside getDashboardData() and initialize derived widget state through initalizingData().
  • Check checkFeatureSubscription() before requesting or rendering subscription-controlled scrap data.
  • Recalculate monthly values with calculateSumByMonth() after dashboard data changes.
  • Use translateMonthName() and getpriceFormatted() for display formatting instead of duplicating formatting logic in templates.
  • Preserve lifecycle behavior in ngOnInit(), ngOnChanges(), and onResize() when changing widget inputs or layout handling.

Used by

3 references from 3 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

Imported by (3)

  • DashboardTabComponentFrontend/src/app/components/dashboard/dashboard-libary/dashboard-tab/dashboard-tab.component.ts:1
  • DashboardWidgetsModuleFrontend/src/app/components/dashboard/dashboard-widgets.module.ts:1
  • ReportsTabComponentFrontend/src/app/components/reports/reports-library/reports-tab/reports-tab.component.ts:1

Was this page helpful?

Download as PDF