Kind: Class
Source: Pams/Web/Pams.Web/Client/app/components/dashboard/dashboard-libary/widgets/mrm-warehouse-scrap/mrm-warehouse-scrap.component.ts (line 90)
Part of: Pams
MrmWarehouseScrapComponent is an Angular dashboard widget for loading, preparing, and displaying warehouse scrap data. It checks authorization, responds to lifecycle changes, calculates monthly totals, formats month and price values, and saves dashboard state.
Methods
| Method | Signature | Returns |
|---|---|---|
GetAuthorizationAccess | GetAuthorizationAccess(url: string) | void |
ngOnInit | ngOnInit() | void |
ngOnChanges | ngOnChanges() | void |
ngOnDestroy | ngOnDestroy() | 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 |
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 |
subscription | Subscription |
SeriseRange | any[] |
echartsIntance | any |
totalBookingMonths | MonthsSum[] |
tempMonthSum | MonthsSum |
totalTargets | number |
yearBooking | number |
totalForecasts | number |
tempTotalTarget | TotalTargets |
popup | any |
searchText | string |
isModeOfInsertFromPrevMonthActive | boolean |
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 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].MrmWarehouseScrapComponentstops the work with an early return whenthis.allowedtoEnableEdting.
Diagram
mermaidgraph LR Init[ngOnInit] --> Auth[GetAuthorizationAccess] Auth --> Load[getDashboardData] Load --> Initialize[initalizingData] Initialize --> Sum[calculateSumByMonth] Sum --> Month[translateMonthName] Sum --> Price[getpriceFormatted] Changes[ngOnChanges] --> Load Initialize --> Save[saveDashboardData] Destroy[ngOnDestroy] --> Cleanup[Release subscriptions or state]
Usage
tsimport { ComponentRef } from '@angular/core';
import { MrmWarehouseScrapComponent } from './mrm-warehouse-scrap.component';
function refreshWarehouseScrapWidget(
componentRef: ComponentRef<MrmWarehouseScrapComponent>
): void {
const widget = componentRef.instance;
// Angular runs ngOnInit during initial change detection.
componentRef.changeDetectorRef.detectChanges();
// Reload data after an external dashboard filter or refresh action.
widget.getDashboardData();
const monthLabel = widget.translateMonthName();
const formattedPrice = widget.getpriceFormatted();
console.log({ monthLabel, formattedPrice });
}
AI Coding Instructions
- Let Angular invoke
ngOnInit,ngOnChanges, andngOnDestroy; do not call lifecycle hooks from application code. - Call
GetAuthorizationAccess()before exposing or loading dashboard scrap data. - Keep data preparation in
initalizingData()and monthly aggregation incalculateSumByMonth()rather than duplicating calculations in templates. - Preserve the existing
initalizingDatamethod spelling when calling or modifying it. - Use
saveDashboardData()for dashboard-state persistence andgetDashboardData()when widget data must be refreshed.
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)
TranslateHandler—Pams/Web/Pams.Web/Client/app/app.module.ts:1DashboardTabComponent—Pams/Web/Pams.Web/Client/app/components/dashboard/dashboard-libary/dashboard-tab/dashboard-tab.component.ts:1ReportsTabComponent—Pams/Web/Pams.Web/Client/app/components/dashboard/reports-library/reports-tab/reports-tab.component.ts:1
Was this page helpful?