Skip to content

MrmBookingTeamsComponent

reference
2 min readUpdated

Kind: Class

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

Part of: Frontend

MrmBookingTeamsComponent is an Angular dashboard widget that loads and presents booking-team data. It checks feature subscription access, initializes widget state, calculates performance values, formats display data, and updates cached state when inputs or viewport conditions change.

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

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

Diagram

mermaid
graph LR
  Dashboard[Dashboard] --> Component[MrmBookingTeamsComponent]
  Component --> Subscription[checkFeatureSubscription]
  Component --> Lifecycle[ngOnInit / ngOnChanges]
  Lifecycle --> Data[getDashboardData]
  Data --> Initialize[initalizingData]
  Initialize --> Performance[calculatePerformancePer]
  Initialize --> Formatting[translateMonthName / getpriceFormatted]
  Component --> Resize[onResize]
  Component --> Cache[setChaching]

Usage

ts
import { Component, ViewChild } from '@angular/core';
import { MrmBookingTeamsComponent } from './mrm-booking-teams.component';

@Component({
  selector: 'app-dashboard-page',
  template: `
    <app-mrm-booking-teams #bookingTeams></app-mrm-booking-teams>
    <button type="button" (click)="refreshBookingTeams()">
      Refresh
    </button>
  `,
})
export class DashboardPageComponent {
  @ViewChild('bookingTeams')
  bookingTeams?: MrmBookingTeamsComponent;

  refreshBookingTeams(): void {
    if (this.bookingTeams?.checkFeatureSubscription()) {
      this.bookingTeams.getDashboardData();
    }
  }
}

AI Coding Instructions

  • Keep data loading behind checkFeatureSubscription() so unavailable features do not request dashboard data.
  • Preserve Angular lifecycle handling in ngOnInit() and ngOnChanges() when adding input-driven behavior.
  • Keep display calculations in calculatePerformancePer(), translateMonthName(), and getpriceFormatted() rather than duplicating formatting in templates.
  • Update cache-related behavior through setChaching() after changing data initialization or refresh flows.
  • Test resize-dependent changes through onResize() to avoid stale widget layout or display state.

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