Skip to content

WidgetBookingVsTargetVsForecastByMonthsComponent

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/widget-booking-vs-target-vs-forecast-by-months.component.ts (line 45)

Part of: Pams

WidgetBookingVsTargetVsForecastByMonthsComponent is an Angular dashboard widget component for presenting booking, target, and forecast information by month. It loads dashboard and team lookup data, prepares series ranges, calculates performance percentages, and translates month names for display.

Implements: OnInit, OnChanges

Methods

MethodSignatureReturns
ngOnInitngOnInit()void
ngDoCheckngDoCheck()void
ngOnChangesngOnChanges()void
ngOnDestroyngOnDestroy()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
subscriptionSubscription
ForecastedDeviationPercentagenumber
SeriseRangeany[]
initOptsany
seriesany[]
headerDataany
echartsIntanceany
optionsany
TargetBooking`string
AchievedBooking`string
teamsLookupany[]

Where it refuses work

  • 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.
  • WidgetBookingVsTargetVsForecastByMonthsComponent stops the work with an early return when month.MonthId < new Date().getMonth() + 1.

Diagram

mermaid
graph LR
    Lifecycle[Angular lifecycle hooks]
    Lifecycle --> Init[ngOnInit]
    Lifecycle --> Changes[ngOnChanges]
    Lifecycle --> Check[ngDoCheck]
    Lifecycle --> Destroy[ngOnDestroy]

    Init --> Load[getDashboardData]
    Changes --> Load
    Load --> Initialize[initalizingData]
    Initialize --> Teams[getTeamLookup]
    Initialize --> Series[setSeriseRange]
    Initialize --> Performance[calculatePerformancePer]
    Initialize --> Months[translateMonthName]

    Series --> Widget[Monthly booking vs target vs forecast view]
    Performance --> Widget
    Months --> Widget

Usage

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

function refreshMonthlyWidget(
  component: WidgetBookingVsTargetVsForecastByMonthsComponent
): void {
  component.getDashboardData();

  const seriesRanges: any[] = component.setSeriseRange();
  const performancePercentage: number = component.calculatePerformancePer();
  const monthLabel: string = component.translateMonthName();

  console.log({
    seriesRanges,
    performancePercentage,
    monthLabel,
  });
}

AI Coding Instructions

  • Let Angular call ngOnInit, ngOnChanges, ngDoCheck, and ngOnDestroy; keep lifecycle-specific setup and cleanup in those methods.
  • Keep dashboard retrieval in getDashboardData() and initialize derived widget state through initalizingData().
  • Preserve the existing setSeriseRange() method name when updating callers, even though its spelling differs from “series.”
  • Update team-dependent filtering through getTeamLookup() before building monthly display data.
  • Keep calculatePerformancePer() and translateMonthName() focused on presentation-ready values used by the widget.

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