Skip to content

WidgetTopOffersByClientsLastNyearsComponent

reference
2 min readUpdated

Kind: Class

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

Part of: Frontend

WidgetTopOffersByClientsLastNyearsComponent is an Angular dashboard widget that displays top offers grouped by clients across a recent-year period. It checks feature subscription access, requests dashboard data, prepares chart state, and responds to chart initialization and planned-visit click events.

Extends: BaseWidgetComponent

Implements: OnInit

Methods

MethodSignatureReturns
viewDataviewData()void
checkFeatureSubscriptioncheckFeatureSubscription()boolean
getDashboardDatagetDashboardData()void
initializeChartinitializeChart(seriesData: undefined, headerData: undefined)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
toggoleOnlyCurrentOfferstoggoleOnlyCurrentOffers()void
switchChartRefernceCommissionHandlerswitchChartRefernceCommissionHandler()void
toggoleBudgetOfferstoggoleBudgetOffers()void
toggoleFirmOfferstoggoleFirmOffers()void
switchFirmOffersswitchFirmOffers()void
switchBudgetOffersswitchBudgetOffers()void
nextPagenextPage()void
prevPageprevPage()void

Properties

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

Where it refuses work

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

Diagram

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

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

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

  ChartInit --> YearColor[setYearColor]
  ChartInit --> Click[onPlannedVisitsChartClick]
  Click --> View[viewData]

Usage

ts
import { Component, ViewChild } from '@angular/core';
import { WidgetTopOffersByClientsLastNyearsComponent } from './widgets/widget-top-offers-by-clients-last-nyears/widget-top-offers-by-clients-last-nyears.component';

@Component({
  selector: 'app-dashboard-page',
  template: `
    <!-- Render the widget through its configured dashboard template. -->
    <button type="button" (click)="refreshTopOffers()">
      Refresh offers
    </button>
  `
})
export class DashboardPageComponent {
  @ViewChild(WidgetTopOffersByClientsLastNyearsComponent)
  topOffersWidget?: WidgetTopOffersByClientsLastNyearsComponent;

  refreshTopOffers(): void {
    if (!this.topOffersWidget?.checkFeatureSubscription()) {
      return;
    }

    this.topOffersWidget.getDashboardData();
  }
}

AI Coding Instructions

  • Keep checkFeatureSubscription() ahead of dashboard-data requests when adding refresh or reload paths.
  • Route successful data handling through afterResponse() so chart setup remains in the existing flow.
  • Reinitialize chart state through initializeChart() rather than creating chart state directly in lifecycle handlers.
  • Preserve the distinction between ngOnInit() for initial loading and ngOnChanges() for reacting to changed component inputs.
  • Handle onPlannedVisitsChartClick() through viewData() when extending chart click behavior.

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