Skip to content

WidgetBookingVSTargetTodayComponent

reference
1 min readUpdated

Kind: Class

Source: Pams/Web/Pams.Web/Client/app/components/dashboard/dashboard-libary/widgets/widget-booking-vstarget-today/widget-booking-vstarget-today.component.ts (line 21)

Part of: Pams

WidgetBookingVSTargetTodayComponent renders the dashboard widget that compares today’s bookings with target values. It loads dashboard data, initializes chart state, handles planned-visit chart interactions, and releases resources when the component is destroyed.

Implements: OnInit

Methods

MethodSignatureReturns
getDashboardDatagetDashboardData()void
insializeWidgetinsializeWidget(value: any[])void
sortingByIndexsortingByIndex(index: number)void
ngOnInitngOnInit()void
onChartInitonChartInit(e: any)void
onPlannedVisitsChartClickonPlannedVisitsChartClick(e: undefined)void
ngOnDestroyngOnDestroy()void

Properties

PropertyType
_widgetWidget
todayWidgetsEnumany
subscriptionSubscription
sortingByEnumany
sortingDirectionEnumany
requestSortingDirectionnumber
sortingArraySortingArray[]
propertyNamestring
dataany[]
originalDataany[]
initOptsany
seriesany[]
headerDataany
echartsIntanceany
optionsany

Where it refuses work

  • WidgetBookingVSTargetTodayComponent stops the work with an early return when a[this.propertyName] < b[this.propertyName], in 2 places.
  • WidgetBookingVSTargetTodayComponent stops the work with an early return when a[this.propertyName] > b[this.propertyName], in 2 places.

Diagram

mermaid
graph LR
    Init[ngOnInit] --> Setup[insializeWidget]
    Setup --> Data[getDashboardData]
    Data --> Sort[sortingByIndex]
    Sort --> Chart[onChartInit]
    Chart --> Click[onPlannedVisitsChartClick]
    Destroy[ngOnDestroy] --> Cleanup[Release subscriptions and chart resources]

Usage

ts
import { Component, ViewChild } from '@angular/core';
import { WidgetBookingVSTargetTodayComponent } from './widget-booking-vstarget-today.component';

@Component({
  selector: 'app-dashboard-host',
  template: `
    <app-widget-booking-vstarget-today
      #bookingTargetWidget>
    </app-widget-booking-vstarget-today>

    <button type="button" (click)="refreshWidget()">
      Refresh
    </button>
  `
})
export class DashboardHostComponent {
  @ViewChild('bookingTargetWidget')
  bookingTargetWidget?: WidgetBookingVSTargetTodayComponent;

  refreshWidget(): void {
    this.bookingTargetWidget?.getDashboardData();
  }
}

AI Coding Instructions

  • Keep data loading inside getDashboardData() so widget refresh behavior remains in one place.
  • Preserve the initialization flow from ngOnInit() through insializeWidget() before creating or updating chart state.
  • Apply sortingByIndex() before binding data to the chart when chart ordering depends on source indexes.
  • Route planned-visit chart events through onPlannedVisitsChartClick() rather than adding click handling in parent dashboard components.
  • Clean up subscriptions, chart instances, and event handlers in ngOnDestroy().

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