Skip to content

WidgetTopOffersByTeamsLastNyearsComponent

reference
2 min readUpdated

Kind: Class

Source: Frontend/src/app/components/dashboard/dashboard-libary/widgets/widget-top-offers-by-teams-last-nyears/widget-top-offers-by-teams-last-nyears.component.ts (line 21)

Part of: Frontend

WidgetTopOffersByTeamsLastNyearsComponent is an Angular dashboard widget that retrieves and displays top offers grouped by team across a recent-year range. It checks feature subscription access, manages chart initialization and updates, and handles chart interactions that open related planned-visit data.

Extends: BaseWidgetComponent

Implements: OnInit

Methods

MethodSignatureReturns
checkFeatureSubscriptioncheckFeatureSubscription()boolean
viewDataviewData()void
initializeChartinitializeChart(seriesData: undefined, headerData: undefined)void
getDashboardDatagetDashboardData()void
afterResponseafterResponse(Data: any[])void
ngOnChangesngOnChanges()void
ngOnInitngOnInit()void
setYearColorsetYearColor(year: number)string
onChartInitonChartInit(e: any)void
onPlannedVisitsChartClickonPlannedVisitsChartClick(e: undefined)void
setChachingsetChaching()void
getChachinggetChaching()void
onValueChangedonValueChanged(e: undefined)void
switchChartTypeHandlerswitchChartTypeHandler()void
switchChartRefernceCommissionHandlerswitchChartRefernceCommissionHandler()void
toggoleOnlyCurrentOfferstoggoleOnlyCurrentOffers()void
toggoleBudgetOfferstoggoleBudgetOffers()void
toggoleFirmOfferstoggoleFirmOffers()void
switchFirmOffersswitchFirmOffers()void
switchBudgetOffersswitchBudgetOffers()void
nextPagenextPage()void
prevPageprevPage()void

Properties

PropertyType
_widgetWidget
meAsVendorboolean
isRefernceCommissionboolean
withoutOptionBarboolean
onlyCurrentOffersboolean
numYearsnumber
_FirmOffersboolean
_BudgetOffersboolean
numYearsDatasourceany[]
todayWidgetsEnumany
branchNamestring
maxValueForYaxisnumber
initOptsany
seriesany[]
headerany[]
echartsIntanceany
cachingWidgetDataCachingWidgetData
originalDatasourceWidgetTopOffers[]
datasourceWidgetTopOffers[]
originalHeaderany[]
optionsany
skipnumber
currenFeaturenumber
seriesDataany
headerDataany[]
showDataOnChartboolean

Where it refuses work

  • WidgetTopOffersByTeamsLastNyearsComponent stops the work with an early return when this.dashboardLibraryService.checkFeatureSubscription(this.widget.chartEnumId).
  • WidgetTopOffersByTeamsLastNyearsComponent stops the work with an early return when this.showDataOnChart.

Diagram

mermaid
graph LR
  Lifecycle[Angular lifecycle] --> Init[ngOnInit]
  Lifecycle --> Changes[ngOnChanges]

  Init --> Subscription[checkFeatureSubscription]
  Subscription --> Data[getDashboardData]
  Changes --> Data

  Data --> Response[afterResponse]
  Response --> Chart[initializeChart]
  Chart --> ChartInit[onChartInit]
  Chart --> Color[setYearColor]

  ChartClick[Chart click] --> PlannedVisits[onPlannedVisitsChartClick]
  PlannedVisits --> ViewData[viewData]

Usage

ts
import { TestBed } from '@angular/core/testing';
import { WidgetTopOffersByTeamsLastNyearsComponent } from './widget-top-offers-by-teams-last-nyears.component';

// Configure the test module with the widget and its required dependencies first.
const fixture = TestBed.createComponent(
  WidgetTopOffersByTeamsLastNyearsComponent
);

fixture.detectChanges();

const widget = fixture.componentInstance;

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

AI Coding Instructions

  • Keep data loading behind checkFeatureSubscription() so unavailable features do not request dashboard data.
  • Let Angular invoke ngOnInit() and ngOnChanges() during normal rendering; call getDashboardData() directly only for explicit refresh flows.
  • Initialize or update chart state through afterResponse() and initializeChart() after dashboard data is available.
  • Keep chart event handling in onChartInit() and route planned-visit interactions through onPlannedVisitsChartClick().
  • Use setYearColor() when adding chart series so year-based color selection remains consistent.

Used by

2 references from 2 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

Imported by (2)

  • WidgetTopOffersByVariantsComponentFrontend/src/app/components/dashboard/dashboard-libary/widgets/widget-top-offers-by-variants/widget-top-offers-by-variants.component.ts:1
  • DashboardWidgetsModuleFrontend/src/app/components/dashboard/dashboard-widgets.module.ts:1

Was this page helpful?

Download as PDF