Skip to content

WidgetBookingVsTargetVsForecastByMonthsComponent

reference
2 min readUpdated

Kind: Class

Source: Frontend/src/app/components/dashboard/dashboard-libary/widgets/widget-booking-vs-target-vs-forecast-by-months/widget-booking-vs-target-vs-forecast-by-months.component.ts (line 43)

Part of: Frontend

WidgetBookingVsTargetVsForecastByMonthsComponent manages dashboard data for a month-based comparison of bookings, targets, and forecasts. It checks feature subscription access, loads dashboard and team lookup data, prepares chart series ranges, calculates performance percentages, and translates month names for display.

Extends: BaseWidgetComponent

Implements: OnInit, OnChanges

Methods

MethodSignatureReturns
checkFeatureSubscriptioncheckFeatureSubscription()boolean
ngOnInitngOnInit()void
ngDoCheckngDoCheck()void
ngOnChangesngOnChanges()void
getDashboardDatagetDashboardData()void
initalizingDatainitalizingData(value: BranchData[])void
getTeamLookupgetTeamLookup()void
setSeriseRangesetSeriseRange()any[]
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
setForecastValuesetForecastValue(value: number)void
setMarginAvaragesetMarginAvarage(value: number)void
setMarginAvarageColorsetMarginAvarageColor(value: number)void
isForecastisForecast(month: MonthData)boolean
isAchievedOrCurrentisAchievedOrCurrent(month: MonthData)boolean
getpriceForecastAmountgetpriceForecastAmount(month: MonthData)number
expectedCurrencyChangeexpectedCurrencyChange(e: undefined)void

Properties

PropertyType
triangleNeedleDxCircularGaugeComponent
originalWidgetWidget
_widgetWidget
_widgetTypestring
withoutOptionBarboolean
bookingOrSalesnumber
withNominalboolean
selectedTeamnumber
forecastRuleIdnumber
forecastRulesany[]
selectedYearnumber
numYearsDatasourceany[]
todayWidgetsEnumany
cachingWidgetDataCachingWidgetData
dataBranchData[]
originalDataBranchData[]
singleMonthsMonthData
singleBranchBranchData
branchCurrencyany
basedOnTendencyboolean
ForecastedDeviationPercentagenumber
SeriseRangeany[]
initOptsany
seriesany[]
headerDataany
echartsIntanceany
optionsany
TargetBooking`string
AchievedBooking`string
teamsLookupany[]
currenFeaturenumber

Where it refuses work

  • WidgetBookingVsTargetVsForecastByMonthsComponent stops the work with an early return when this.dashboardLibraryService.checkFeatureSubscription(this.widget.chartEnumId).
  • WidgetBookingVsTargetVsForecastByMonthsComponent stops the work with an early return when a < b.
  • WidgetBookingVsTargetVsForecastByMonthsComponent stops the work with an early return when a > b.
  • WidgetBookingVsTargetVsForecastByMonthsComponent stops the work with an early return when month.MonthId == 12.
  • WidgetBookingVsTargetVsForecastByMonthsComponent stops the work with an early return when month.MonthId >= new Date().getMonth() + 1.
  • WidgetBookingVsTargetVsForecastByMonthsComponent stops the work with an early return when month.MonthId <= new Date().getMonth() + 1.

Diagram

mermaid
graph LR
  A[Angular lifecycle hooks] --> B[checkFeatureSubscription]
  A --> C[getDashboardData]
  C --> D[initalizingData]
  D --> E[getTeamLookup]
  D --> F[setSeriseRange]
  F --> G[Booking vs Target vs Forecast chart]
  D --> H[calculatePerformancePer]
  D --> I[translateMonthName]

Usage

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

function refreshWidgetData(
  widget: WidgetBookingVsTargetVsForecastByMonthsComponent
): void {
  if (!widget.checkFeatureSubscription()) {
    return;
  }

  widget.ngOnInit();
  widget.getDashboardData();

  const series = widget.setSeriseRange();
  const performance = widget.calculatePerformancePer();
  const monthLabel = widget.translateMonthName();

  console.log({ series, performance, monthLabel });
}

AI Coding Instructions

  • Keep subscription checks in place before requesting or presenting dashboard data.
  • Preserve the Angular lifecycle flow through ngOnInit, ngOnChanges, and ngDoCheck when changing refresh behavior.
  • Keep initalizingData and setSeriseRange aligned with the data shape returned by getDashboardData.
  • Update getTeamLookup when adding team-based filters or lookup dependencies.
  • Preserve the existing method spelling initalizingData and setSeriseRange unless all call sites are updated.

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