Skip to content

MrmBookingSupplierComponent

reference
2 min readUpdated

Kind: Class

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

Part of: Frontend

MrmBookingSupplierComponent is an Angular dashboard widget for displaying supplier booking data. It checks feature access, loads and initializes dashboard data, formats display values, and keeps scroll behavior aligned during resize and content updates.

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
syncScrollsyncScroll(e: undefined)void
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
selectTextselectText(e: undefined)void
sortingsorting(propertyName: string, propertyType: string, monthIndex: number)void

Properties

PropertyType
scrollOneElementRef
scrollTwoElementRef
scrollThreeElementRef
_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
searchTextstring
urrenFeaturenumber
sortingDirectionnumber

Where it refuses work

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

Diagram

mermaid
graph LR
  Dashboard[Dashboard] --> Component[MrmBookingSupplierComponent]

  Component --> Subscription[checkFeatureSubscription]
  Component --> Init[ngOnInit]
  Component --> Changes[ngOnChanges]
  Init --> Data[getDashboardData]
  Changes --> Data
  Data --> Initialize[initalizingData]

  Initialize --> Performance[calculatePerformancePer]
  Initialize --> Month[translateMonthName]
  Initialize --> Price[getpriceFormatted]

  Component --> Scroll[syncScroll]
  Component --> Resize[onResize]
  Resize --> Scroll

Usage

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

@Component({
  selector: 'app-dashboard-host',
  template: `
    <!-- Render the booking supplier widget in this dashboard view. -->
  `,
})
export class DashboardHostComponent implements AfterViewInit {
  @ViewChild(MrmBookingSupplierComponent)
  bookingSupplierWidget?: MrmBookingSupplierComponent;

  ngAfterViewInit(): void {
    const widget = this.bookingSupplierWidget;

    if (widget?.checkFeatureSubscription()) {
      widget.getDashboardData();
    }
  }
}

AI Coding Instructions

  • Let Angular call ngOnInit and ngOnChanges; keep data-loading and initialization logic aligned with these lifecycle hooks.
  • Check checkFeatureSubscription() before adding interactions that require the booking supplier feature.
  • Keep display calculations in calculatePerformancePer, translateMonthName, and getpriceFormatted rather than duplicating formatting logic in templates.
  • Call syncScroll() after changes that affect linked scroll containers, and keep resize handling in onResize().
  • Preserve the existing initalizingData() method name when calling or refactoring it.

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