Kind: Class
Source: Pams/Web/Pams.Web/Client/app/components/dashboard/dashboard-libary/widgets/mrm-finance-lg/mrm-finance-lg.component.ts (line 72)
Part of: Pams
MrmFinanceLgComponent is an Angular dashboard widget that retrieves and prepares finance data for display. It responds to component lifecycle and resize events, calculates performance values, translates month names, formats prices, and manages cached state.
Methods
| Method | Signature | Returns |
|---|---|---|
ngOnInit | ngOnInit() | void |
ngOnChanges | ngOnChanges() | void |
ngOnDestroy | ngOnDestroy() | void |
getDashboardData | getDashboardData() | void |
initalizingData | initalizingData(value: BranchData[]) | void |
calculatePerformancePer | calculatePerformancePer(month: MonthData) | number |
translateMonthName | translateMonthName(month: MonthData) | string |
getpriceFormatted | getpriceFormatted(x: undefined) | string |
onResize | onResize() | void |
setChaching | setChaching() | void |
getChaching | getChaching() | void |
onValueChanged | onValueChanged(e: undefined) | void |
onChartInit | onChartInit(e: any, index: number) | void |
switchChartTypeHandler | switchChartTypeHandler() | void |
switchBasedOnTendencyHandler | switchBasedOnTendencyHandler() | void |
mouseoverRowSpan | mouseoverRowSpan(e: undefined, bIndex: number) | void |
mouseoutRowSpan | mouseoutRowSpan(e: undefined, bIndex: number) | void |
comparingWithPrevMonth | comparingWithPrevMonth(month: MonthData, bIndex: number, monthIndex: number, propertyName: string) | string |
comparingBookingWithPrevSumm | comparingBookingWithPrevSumm(month: TotalBookingMonths, index: number) | string |
comparingMonthsWithPrevSumm | comparingMonthsWithPrevSumm(month: TotalBookingMonths, index: number, propertyName: string) | string |
setValue | setValue(value: number) | void |
setForecastValue | setForecastValue(value: number) | void |
setMarginAvarage | setMarginAvarage(value: number) | void |
isForecast | isForecast(month: MonthData) | boolean |
isAchievedOrCurrent | isAchievedOrCurrent(month: MonthData) | boolean |
getpriceForecastAmount | getpriceForecastAmount(month: MonthData) | number |
expectedCurrencyChange | expectedCurrencyChange(e: undefined) | void |
Properties
| Property | Type |
|---|---|
_widget | Widget |
_widgetType | string |
withoutOptionBar | boolean |
bookingOrSales | number |
withNominal | boolean |
selectedTeam | number |
forecastRuleId | number |
allowedtoEdit | boolean |
allowedtoEnableEdting | boolean |
forecastRules | any[] |
selectedYear | number |
numYearsDatasource | any[] |
todayWidgetsEnum | any |
cachingWidgetData | CachingWidgetData |
data | BranchData[] |
originalData | BranchData[] |
singleMonths | MonthData |
branchCurrency | any |
basedOnTendency | boolean |
subscription | Subscription |
SeriseRange | any[] |
echartsIntance | any |
totalBookingMonths | TotalBookingMonths[] |
tempTotalMonth | TotalBookingMonths |
Where it refuses work
MrmFinanceLgComponentstops the work with an early return whenmonth.MonthId == 12.MrmFinanceLgComponentstops the work with an early return whenmonth[propertyName] < this.data[bIndex].MrmLGs[monthIndex - 1][propertyName].MrmFinanceLgComponentstops the work with an early return whenmonth.TotalAmountMonth < this.totalBookingMonths[index - 1].TotalAmountMonth.MrmFinanceLgComponentstops the work with an early return whenmonth[propertyName] < this.totalBookingMonths[index - 1][propertyName].MrmFinanceLgComponentstops the work with an early return whenmonth.MonthId >= new Date().getMonth() + 1.MrmFinanceLgComponentstops the work with an early return whenmonth.MonthId <= new Date().getMonth() + 1.
Diagram
mermaidgraph LR Lifecycle[Angular lifecycle] --> Init[ngOnInit] Lifecycle --> Changes[ngOnChanges] Lifecycle --> Destroy[ngOnDestroy] Init --> Fetch[getDashboardData] Changes --> Fetch Fetch --> Initialize[initalizingData] Initialize --> Performance[calculatePerformancePer] Initialize --> Month[translateMonthName] Initialize --> Price[getpriceFormatted] Resize[onResize] --> Cache[setChaching] Destroy --> Cache
Usage
tsimport { ComponentFixture, TestBed } from '@angular/core/testing';
import { MrmFinanceLgComponent } from './mrm-finance-lg.component';
describe('MrmFinanceLgComponent', () => {
let fixture: ComponentFixture<MrmFinanceLgComponent>;
let component: MrmFinanceLgComponent;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [MrmFinanceLgComponent],
}).compileComponents();
fixture = TestBed.createComponent(MrmFinanceLgComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('loads and formats dashboard data', () => {
component.getDashboardData();
const performance = component.calculatePerformancePer();
const monthName = component.translateMonthName();
const formattedPrice = component.getpriceFormatted();
expect(performance).toBeDefined();
expect(monthName).toBeDefined();
expect(formattedPrice).toBeDefined();
});
});
AI Coding Instructions
- Keep data retrieval inside
getDashboardData()and prepare widget state throughinitalizingData(). - Recalculate display-dependent values after input changes and resize events when the rendered layout depends on them.
- Preserve the existing lifecycle cleanup in
ngOnDestroy()and keep cache handling insetChaching(). - Use
calculatePerformancePer(),translateMonthName(), andgetpriceFormatted()for display values instead of duplicating formatting logic in templates.
Used by
1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.
Imported by (1)
TranslateHandler—Pams/Web/Pams.Web/Client/app/app.module.ts:1
Was this page helpful?