Kind: Class
Source: Pams/Web/Pams.Web/Client/app/components/dashboard/dashboard-libary/widgets/mrm-cogs/mrm-cogs.component.ts (line 84)
Part of: Pams
MrmCogsComponent is an Angular dashboard widget for displaying and managing MRM cost-of-goods-sold data. It checks authorization access, loads and saves dashboard data, aggregates values by year or month, and translates month names for display.
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 |
calculateSumByYear | calculateSumByYear() | 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 |
switchWithTaxableHandler | switchWithTaxableHandler() | void |
switchChartTypeHandler | switchChartTypeHandler() | void |
switchBasedOnTendencyHandler | switchBasedOnTendencyHandler() | void |
comparingWithPrevMonth | comparingWithPrevMonth(month: BranchData, bIndex: number, monthIndex: 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 |
mouseoverRowSpan | mouseoverRowSpan(e: undefined, bIndex: number) | void |
mouseoutRowSpan | mouseoutRowSpan(e: undefined, bIndex: number) | void |
editSelectedMonthPrepare | editSelectedMonthPrepare(month: MonthData, supplierId: 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 |
withTaxable | boolean |
selectedTeam | number |
forecastRuleId | number |
data | BranchData[] |
allowedtoEdit | boolean |
allowedtoEnableEdting | boolean |
widgetEditRequest | any |
widgetEditEnd | any |
forecastRules | any[] |
selectedYear | number |
numYearsDatasource | any[] |
todayWidgetsEnum | any |
cachingWidgetData | CachingWidgetData |
originalData | BranchData[] |
selectedData | BranchData[] |
singleMonths | MonthData |
branchCurrency | any |
basedOnTendency | boolean |
subscription | Subscription |
SeriseRange | any[] |
echartsIntance | any |
totalBookingMonths | MonthsSum[] |
tempMonthSum | MonthsSum |
totalTargets | number |
yearBooking | number |
totalForecasts | number |
tempTotalTarget | TotalTargets |
allGroupsTotalSales | number |
totalPercentageOfAchievedSales | number |
totalCumulativeSales | number |
totalDirectSales | number |
totalTotalDirectSales | number |
totalDirectService | number |
totalDirectSalesWithScrap | number |
totalTotalDirectSalesWithScrap | number |
totalCommission | number |
_totalSalesAfterCommission | number |
popup | any |
searchText | string |
Where it refuses work
MrmCogsComponentstops the work with an early return whenmonth.MonthId == 12.MrmCogsComponentstops the work with an early return whenmonth[propertyName] < this.data[bIndex].MrmCogsGroups[monthIndex - 1][propertyName].MrmCogsComponentstops the work with an early return whenmonth[propertyName] < this.totalBookingMonths[index - 1][propertyName].MrmCogsComponentstops the work with an early return whenthis.allowedtoEnableEdting.MrmCogsComponentstops the work with an early return whenthis.allowedtoEdit.
Diagram
mermaidgraph LR A[Angular Lifecycle] --> B[GetAuthorizationAccess] A --> C[ngOnInit] A --> D[ngOnChanges] A --> E[ngOnDestroy] C --> F[getDashboardData] C --> G[initalizingData] D --> F F --> H[calculateSumByYear] F --> I[calculateSumByMonth] I --> J[translateMonthName] G --> K[saveDashboardData]
Usage
tsimport { Component, ViewChild } from '@angular/core';
import { MrmCogsComponent } from './mrm-cogs.component';
@Component({
selector: 'app-dashboard-host',
template: `
<app-mrm-cogs #mrmCogs></app-mrm-cogs>
<button type="button" (click)="refreshCogsData()">
Refresh COGS data
</button>
`
})
export class DashboardHostComponent {
@ViewChild('mrmCogs')
mrmCogsComponent?: MrmCogsComponent;
refreshCogsData(): void {
this.mrmCogsComponent?.getDashboardData();
}
saveCogsData(): void {
this.mrmCogsComponent?.saveDashboardData();
}
}
AI Coding Instructions
- Keep data loading inside
getDashboardData()and initialize widget state throughinitalizingData(). - Run authorization checks through
GetAuthorizationAccess()before exposing or updating dashboard data. - Preserve Angular lifecycle handling in
ngOnInit(),ngOnChanges(), andngOnDestroy()when adding subscriptions or input-driven refresh behavior. - Use
calculateSumByYear()andcalculateSumByMonth()for aggregation rather than duplicating calculation logic in templates or parent components. - Route month labels through
translateMonthName()so displayed month names remain consistent with the component’s translation behavior.
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?