Skip to content

MrmBookingProductTypesComponent

reference
2 min readUpdated

Kind: Class

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

Part of: Pams

MrmBookingProductTypesComponent is an Angular dashboard widget that loads and presents booking product-type data. It manages initialization, data refreshes, resize handling, cached state, and display helpers for performance, month names, and formatted prices.

Methods

MethodSignatureReturns
ngOnInitngOnInit()void
ngOnChangesngOnChanges()void
ngOnDestroyngOnDestroy()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
withoutOptionBarboolean
bookingOrSalesnumber
withNominalboolean
selectedTeamnumber
forecastRuleIdnumber
allowedtoEditboolean
allowedtoEnableEdtingboolean
forecastRulesany[]
selectedYearnumber
numYearsDatasourceany[]
todayWidgetsEnumany
cachingWidgetDataCachingWidgetData
dataBranchData[]
originalDataBranchData[]
singleMonthsMonthData
branchCurrencyany
basedOnTendencyboolean
subscriptionSubscription
SeriseRangeany[]
echartsIntanceany
totalBookingMonthsTotalBookingMonths[]
tempTotalMonthTotalBookingMonths
totalTargetsnumber
yearBookingnumber
totalForecastsnumber
tempTotalTargetTotalTargets
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 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.
  • MrmBookingProductTypesComponent stops the work with an early return when month.TotalForecastMonth < this.totalBookingMonths[index - 1].TotalForecastMonth.

Diagram

mermaid
graph LR
  Dashboard[Dashboard container] --> Component[MrmBookingProductTypesComponent]

  Component --> Init[ngOnInit]
  Component --> Changes[ngOnChanges]
  Component --> Destroy[ngOnDestroy]

  Init --> Data[getDashboardData]
  Changes --> Data
  Data --> Initialize[initalizingData]
  Initialize --> Cache[setChaching]

  Component --> Performance[calculatePerformancePer]
  Component --> Month[translateMonthName]
  Component --> Price[getpriceFormatted]
  Component --> Resize[onResize]

Usage

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

@Component({
  selector: 'app-dashboard-page',
  template: `
    <!-- Render the widget according to its configured selector and inputs. -->
    <app-mrm-booking-product-types></app-mrm-booking-product-types>

    <button type="button" (click)="refreshProductTypes()">
      Refresh product types
    </button>
  `
})
export class DashboardPageComponent {
  @ViewChild(MrmBookingProductTypesComponent)
  productTypesWidget?: MrmBookingProductTypesComponent;

  refreshProductTypes(): void {
    this.productTypesWidget?.getDashboardData();
  }

  get performanceLabel(): string {
    return `${this.productTypesWidget?.calculatePerformancePer() ?? 0}%`;
  }
}

AI Coding Instructions

  • Keep data loading inside getDashboardData() and let Angular lifecycle hooks trigger refreshes when component state changes.
  • Preserve the existing initalizingData() method name when calling or modifying it, even though its spelling differs from initializing.
  • Release subscriptions, listeners, and resize-related resources from ngOnDestroy().
  • Keep calculatePerformancePer(), translateMonthName(), and getpriceFormatted() focused on display formatting rather than data retrieval.
  • Update cached values through setChaching() when changing the widget data flow.

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)

  • TranslateHandlerPams/Web/Pams.Web/Client/app/app.module.ts:1

Was this page helpful?

Download as PDF