Skip to content

WidgetBookingVsTargetVsForecastByMonthsByVariantsComponent

reference
2 min readUpdated

Kind: Class

Source: Pams/Web/Pams.Web/Client/app/components/dashboard/dashboard-libary/widgets/widget-booking-vs-target-vs-forecast-by-months-by-variants/widget-booking-vs-target-vs-forecast-by-months-by-variants.component.ts (line 34)

Part of: Pams

WidgetBookingVsTargetVsForecastByMonthsByVariantsComponent manages a dashboard widget that compares booking values with target and forecast data across months and variants. It loads team lookup data, calculates performance percentages, formats month and price values, responds to resize events, and stores widget state through caching methods.

Implements: OnInit

Methods

MethodSignatureReturns
ngOnInitngOnInit()void
ngDoCheckngDoCheck()void
ngOnDestroyngOnDestroy()void
getTeamLookupgetTeamLookup()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
setValuesetValue(value: number)void

Properties

PropertyType
triangleNeedleDxCircularGaugeComponent
BoVsTaWidgetWidget
BoVsFoWidgetWidget
FoVsTaWidgetWidget
_widgetWidget
_widgetTypestring
forecastRuleIdnumber
forecastRulesany[]
bookingOrSalesnumber
numYearsDatasourceany[]
todayWidgetsEnumany
cachingWidgetDataCachingWidgetData
dataData
monthsMonthData[]
singleMonthsMonthData
branchCurrencyany
withNominalboolean
basedOnTendencyboolean
subscriptionSubscription
initOptsany
seriesany[]
headerDataany
echartsIntanceany
TargetBooking`string
AchievedBooking`string
teamsLookupany[]
selectedTeamnumber

Where it refuses work

  • WidgetBookingVsTargetVsForecastByMonthsByVariantsComponent stops the work with an early return when month.MonthId == 12.

Diagram

mermaid
graph LR
    Dashboard[Dashboard] --> Widget[WidgetBookingVsTargetVsForecastByMonthsByVariantsComponent]
    Widget --> Lifecycle[Angular lifecycle]
    Lifecycle --> Init[ngOnInit]
    Lifecycle --> Check[ngDoCheck]
    Lifecycle --> Destroy[ngOnDestroy]
    Widget --> TeamLookup[getTeamLookup]
    Widget --> Metrics[calculatePerformancePer]
    Widget --> Formatting[translateMonthName]
    Widget --> FormattingPrice[getpriceFormatted]
    Widget --> Resize[onResize]
    Widget --> Cache[setChaching]
    Cache --> Restore[getChaching]

Usage

ts
import { WidgetBookingVsTargetVsForecastByMonthsByVariantsComponent } from './widget-booking-vs-target-vs-forecast-by-months-by-variants.component';

function readWidgetValues(
  widget: WidgetBookingVsTargetVsForecastByMonthsByVariantsComponent,
) {
  widget.getTeamLookup();

  const performance = widget.calculatePerformancePer();
  const monthName = widget.translateMonthName();
  const formattedPrice = widget.getpriceFormatted();

  widget.setChaching();

  return {
    performance,
    monthName,
    formattedPrice,
  };
}

AI Coding Instructions

  • Let Angular invoke ngOnInit, ngDoCheck, and ngOnDestroy; keep initialization and cleanup logic within the matching lifecycle method.
  • Call getTeamLookup() before rendering data that depends on team selection or team-specific values.
  • Keep calculations in calculatePerformancePer() consistent with the booking, target, and forecast data supplied to the widget.
  • Use translateMonthName() and getpriceFormatted() for display values rather than duplicating formatting logic in the template.
  • Preserve the existing cache flow by pairing setChaching() with getChaching() when adding persisted widget 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)

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

Was this page helpful?

Download as PDF