Skip to content

MrmBookingProductTypesComponent

reference
2 min readUpdated

Kind: Class

Source: Frontend/src/app/components/dashboard/dashboard-libary/widgets/mrm-booking-product-types/mrm-booking-product-types.component.ts (line 45)

Part of: Frontend

MrmBookingProductTypesComponent is an Angular dashboard widget that loads and prepares booking product-type data for display. It responds to initialization, input changes, and resize events, calculates performance values, translates month labels, formats prices, and caches widget state. Subscription checks gate access to the widget data flow.

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
comparingWithPrevMonthcomparingWithPrevMonth(month: MonthData, bIndex: number, index: number)string
comparingBookingWithPrevSummcomparingBookingWithPrevSumm(month: TotalBookingMonths, index: number)string
comparingForecastWithPrevSummcomparingForecastWithPrevSumm(month: TotalBookingMonths, index: number)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
sortingsorting(propertyName: string, propertyType: string, monthIndex: number)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
totalTargetsnumber
yearBookingnumber
totalForecastsnumber
tempTotalTargetTotalTargets
urrenFeaturenumber
sortingDirectionnumber

Where it refuses work

  • MrmBookingProductTypesComponent stops the work with an early return when a[propertyName] < b[propertyName], in 2 places.
  • MrmBookingProductTypesComponent stops the work with an early return when a[propertyName] > b[propertyName], in 2 places.
  • MrmBookingProductTypesComponent stops the work with an early return when this.dashboardLibraryService.checkFeatureSubscription(this.widget.chartEnumId).
  • MrmBookingProductTypesComponent stops the work with an early return when month.MonthId == 12.
  • MrmBookingProductTypesComponent stops the work with an early return when month.TotalValue < this.data[bIndex].MrmBooking[index - 1].TotalValue.
  • MrmBookingProductTypesComponent stops the work with an early return when month.TotalBookingMonth < this.totalBookingMonths[index - 1].TotalBookingMonth.

Diagram

mermaid
graph LR
  Lifecycle[Angular lifecycle] --> Init[ngOnInit]
  Lifecycle --> Changes[ngOnChanges]
  Init --> Subscription[checkFeatureSubscription]
  Changes --> Data[getDashboardData]
  Subscription --> Data
  Data --> Initialize[initalizingData]
  Initialize --> Performance[calculatePerformancePer]
  Initialize --> Month[translateMonthName]
  Initialize --> Price[getpriceFormatted]
  Initialize --> Cache[setChaching]
  Resize[onResize] --> Initialize

Usage

ts
import { AfterViewInit, Component, ViewChild } from '@angular/core';
import { MrmBookingProductTypesComponent } from './mrm-booking-product-types.component';

@Component({
  selector: 'app-dashboard-host',
  template: `
    <!-- Render MrmBookingProductTypesComponent in this dashboard view -->
  `,
})
export class DashboardHostComponent implements AfterViewInit {
  @ViewChild(MrmBookingProductTypesComponent)
  productTypesWidget!: MrmBookingProductTypesComponent;

  ngAfterViewInit(): void {
    if (this.productTypesWidget.checkFeatureSubscription()) {
      this.productTypesWidget.getDashboardData();
    }
  }

  onDashboardResize(): void {
    this.productTypesWidget.onResize();
  }
}

AI Coding Instructions

  • Keep data loading inside getDashboardData() and data preparation inside initalizingData().
  • Call checkFeatureSubscription() before requesting or displaying subscription-gated dashboard data.
  • Recalculate display-dependent values through onResize() rather than duplicating resize logic in parent components.
  • Keep month translation and price formatting in translateMonthName() and getpriceFormatted() so widget output stays consistent.
  • Preserve the existing setChaching() method name when working with current callers.

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