Skip to content

MrmFinanceLgComponent

reference
2 min readUpdated

Kind: Class

Source: Frontend/src/app/components/dashboard/dashboard-libary/widgets/mrm-finance-lg/mrm-finance-lg.component.ts (line 72)

Part of: Frontend

MrmFinanceLgComponent is an Angular dashboard widget that loads and presents finance-related data for subscribed users. It manages lifecycle updates, calculates performance values, formats price and month display values, responds to resize events, and stores cached widget state.

Extends: BaseWidgetComponent

Methods

MethodSignatureReturns
checkFeatureSubscriptioncheckFeatureSubscription()boolean
ngOnInitngOnInit()void
ngOnChangesngOnChanges()void
getDashboardDatagetDashboardData()void
initalizingDatainitalizingData(value: BranchData[])void
calculatePerformancePercalculatePerformancePer(month: MonthData)number
translateMonthNametranslateMonthName(month: MonthData)string
getpriceFormattedgetpriceFormatted(x: undefined)string
onResizeonResize()void
setChachingsetChaching()void
getChachinggetChaching()void
onValueChangedonValueChanged(e: undefined)void
onChartInitonChartInit(e: any, index: number)void
switchChartTypeHandlerswitchChartTypeHandler()void
switchBasedOnTendencyHandlerswitchBasedOnTendencyHandler()void
mouseoverRowSpanmouseoverRowSpan(e: undefined, bIndex: number)void
mouseoutRowSpanmouseoutRowSpan(e: undefined, bIndex: number)void
comparingWithPrevMonthcomparingWithPrevMonth(month: MonthData, bIndex: number, monthIndex: number, propertyName: string)string
comparingBookingWithPrevSummcomparingBookingWithPrevSumm(month: TotalBookingMonths, index: number)string
comparingMonthsWithPrevSummcomparingMonthsWithPrevSumm(month: TotalBookingMonths, index: number, propertyName: string)string
setValuesetValue(value: number)void
setForecastValuesetForecastValue(value: number)void
setMarginAvaragesetMarginAvarage(value: number)void
isForecastisForecast(month: MonthData)boolean
isAchievedOrCurrentisAchievedOrCurrent(month: MonthData)boolean
getpriceForecastAmountgetpriceForecastAmount(month: MonthData)number
expectedCurrencyChangeexpectedCurrencyChange(e: undefined)void

Properties

PropertyType
_widgetWidget
_widgetTypestring
yearIdnumber
periodIdnumber
countOfEditablePrevMonthsnumber
withoutOptionBarboolean
bookingOrSalesnumber
withNominalboolean
selectedTeamnumber
forecastRuleIdnumber
allowedtoEditboolean
allowedtoEnableEdtingboolean
forecastRulesany[]
selectedYearnumber
numYearsDatasourceany[]
todayWidgetsEnumany
cachingWidgetDataCachingWidgetData
dataBranchData[]
originalDataBranchData[]
singleMonthsMonthData
branchCurrencyany
basedOnTendencyboolean
SeriseRangeany[]
echartsIntanceany
totalBookingMonthsTotalBookingMonths[]
tempTotalMonthTotalBookingMonths
pastDiffnumber
urrenFeaturenumber

Where it refuses work

  • MrmFinanceLgComponent stops the work with an early return when this.dashboardLibraryService.checkFeatureSubscription(this.widget.chartEnumId).
  • MrmFinanceLgComponent stops the work with an early return when month.MonthId == 12.
  • MrmFinanceLgComponent stops the work with an early return when month[propertyName] < this.data[bIndex].MrmLGs[monthIndex - 1][propertyName].
  • MrmFinanceLgComponent stops the work with an early return when month.TotalAmountMonth < this.totalBookingMonths[index - 1].TotalAmountMonth.
  • MrmFinanceLgComponent stops the work with an early return when month[propertyName] < this.totalBookingMonths[index - 1][propertyName].
  • MrmFinanceLgComponent stops the work with an early return when month.MonthId >= new Date().getMonth() + 1.

Diagram

mermaid
graph LR
  A[Angular lifecycle] --> B[MrmFinanceLgComponent]
  B --> C[checkFeatureSubscription]
  C --> D[getDashboardData]
  D --> E[initalizingData]
  E --> F[calculatePerformancePer]
  E --> G[translateMonthName]
  E --> H[getpriceFormatted]
  B --> I[onResize]
  B --> J[setChaching]

Usage

ts
import { Component, ViewChild, ViewContainerRef } from '@angular/core';
import { MrmFinanceLgComponent } from './mrm-finance-lg.component';

@Component({
  selector: 'app-dashboard-host',
  template: `<ng-container #widgetHost></ng-container>`,
})
export class DashboardHostComponent {
  @ViewChild('widgetHost', { read: ViewContainerRef })
  widgetHost!: ViewContainerRef;

  loadFinanceWidget(): void {
    const widgetRef = this.widgetHost.createComponent(MrmFinanceLgComponent);

    if (widgetRef.instance.checkFeatureSubscription()) {
      widgetRef.instance.getDashboardData();
    }
  }
}

AI Coding Instructions

  • Check checkFeatureSubscription() before requesting or displaying finance data.
  • Let Angular call ngOnInit() and ngOnChanges() through the component lifecycle; do not call lifecycle hooks directly from application code.
  • Keep data preparation in initalizingData() so calculated, translated, and formatted values stay consistent.
  • Use calculatePerformancePer(), translateMonthName(), and getpriceFormatted() for display values instead of duplicating formatting logic in templates.
  • Preserve the existing setChaching() method name when updating related callers, even though its spelling differs from “caching.”

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)

  • DashboardWidgetsModuleFrontend/src/app/components/dashboard/dashboard-widgets.module.ts:1

Was this page helpful?

Download as PDF