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
| Method | Signature | Returns |
|---|---|---|
checkFeatureSubscription | checkFeatureSubscription() | boolean |
ngOnInit | ngOnInit() | void |
ngOnChanges | ngOnChanges() | void |
getDashboardData | getDashboardData() | void |
initalizingData | initalizingData(value: BranchData[]) | void |
saveDashboardData | saveDashboardData() | void |
calculateSumByMonth | calculateSumByMonth(monthIndex: number) | void |
translateMonthName | translateMonthName(month: MonthData) | string |
getpriceFormatted | getpriceFormatted(x: undefined) | string |
onResize | onResize() | void |
setChaching | setChaching() | void |
getChaching | getChaching() | void |
switchChartTypeHandler | switchChartTypeHandler() | void |
switchBasedOnTendencyHandler | switchBasedOnTendencyHandler() | void |
comparingWithPrevMonth | comparingWithPrevMonth(month: MonthData, bIndex: number, index: number, propertyName: string) | string |
comparingBookingWithPrevSumm | comparingBookingWithPrevSumm(month: MonthsSum, index: number, propertyName: string) | string |
isCurrentMonth | isCurrentMonth(month: MonthData) | boolean |
getpriceForecastAmount | getpriceForecastAmount(month: MonthData) | number |
expectedCurrencyChange | expectedCurrencyChange(e: undefined) | void |
selectText | selectText(e: undefined) | void |
editSelectedMonthPrepare | editSelectedMonthPrepare(month: MonthData, supplierId: number) | void |
copyValueFromPrevMonth | copyValueFromPrevMonth(month: MonthData, monthIndex: number) | void |
sorting | sorting(propertyName: string, propertyType: string, monthIndex: number) | void |
openPopup | openPopup(n: string, t: string, i: string, btnTxt: string) | void |
savePopup | savePopup() | void |
ClosewithDonotSave | ClosewithDonotSave() | void |
OnOpenedPopup | OnOpenedPopup() | void |
closePopup | closePopup() | void |
Properties
| Property | Type |
|---|---|
sharedPopup | SharedPopupComponent |
_widget | Widget |
_widgetType | string |
yearId | number |
periodId | number |
countOfEditablePrevMonths | number |
withoutOptionBar | boolean |
editMode | boolean |
bookingOrSales | number |
withNominal | boolean |
selectedTeam | number |
forecastRuleId | number |
allowedtoEdit | boolean |
allowedtoEnableEdting | boolean |
widgetEditRequest | any |
widgetEditEnd | any |
forecastRules | any[] |
selectedYear | number |
numYearsDatasource | any[] |
todayWidgetsEnum | any |
cachingWidgetData | CachingWidgetData |
data | BranchData[] |
originalData | BranchData[] |
selectedData | BranchData[] |
branchCurrency | any |
basedOnTendency | boolean |
SeriseRange | any[] |
echartsIntance | any |
totalBookingMonths | MonthsSum[] |
tempMonthSum | MonthsSum |
totalTargets | number |
yearBooking | number |
totalForecasts | number |
tempTotalTarget | TotalTargets |
popup | any |
searchText | string |
isModeOfInsertFromPrevMonthActive | boolean |
pastDiff | number |
urrenFeature | number |
sortingDirection | number |
Where it refuses work
MrmWarehouseScrapComponentstops the work with an early return whena[propertyName] < b[propertyName], in 2 places.MrmWarehouseScrapComponentstops the work with an early return whena[propertyName] > b[propertyName], in 2 places.MrmWarehouseScrapComponentstops the work with an early return whenthis.dashboardLibraryService.checkFeatureSubscription(this.widget.chartEnumId).MrmWarehouseScrapComponentstops the work with an early return whenmonth.MonthId == 12.MrmWarehouseScrapComponentstops the work with an early return whenmonth[propertyName] < this.data[bIndex].MRMScrap[index - 1][propertyName].MrmWarehouseScrapComponentstops the work with an early return whenmonth[propertyName] < this.totalBookingMonths[index - 1][propertyName].
Diagram
mermaidgraph 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
tsimport { 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 throughinitalizingData(). - Check
checkFeatureSubscription()before requesting or rendering subscription-controlled scrap data. - Recalculate monthly values with
calculateSumByMonth()after dashboard data changes. - Use
translateMonthName()andgetpriceFormatted()for display formatting instead of duplicating formatting logic in templates. - Preserve lifecycle behavior in
ngOnInit(),ngOnChanges(), andonResize()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)
DashboardTabComponent—Frontend/src/app/components/dashboard/dashboard-libary/dashboard-tab/dashboard-tab.component.ts:1DashboardWidgetsModule—Frontend/src/app/components/dashboard/dashboard-widgets.module.ts:1ReportsTabComponent—Frontend/src/app/components/reports/reports-library/reports-tab/reports-tab.component.ts:1
Was this page helpful?