Kind: Class
Source: Frontend/src/app/components/dashboard/dashboard-libary/widgets/mrm-booking-product-types/mrm-booking-product-types.component.ts (line 45)
Part of: Frontend
MrmBookingProductTypesComponent is an Angular dashboard widget that loads and prepares booking product-type data for display. It responds to initialization, input changes, and resize events, calculates performance values, translates month labels, formats prices, and caches widget state. Subscription checks gate access to the widget data flow.
Extends: BaseWidgetComponent
Methods
| Method | Signature | Returns |
|---|---|---|
checkFeatureSubscription | checkFeatureSubscription() | boolean |
ngOnInit | ngOnInit() | void |
ngOnChanges | ngOnChanges() | void |
getDashboardData | getDashboardData() | void |
initalizingData | initalizingData(value: BranchData[]) | void |
calculatePerformancePer | calculatePerformancePer(month: MonthData) | number |
translateMonthName | translateMonthName(month: MonthData) | string |
getpriceFormatted | getpriceFormatted(x: undefined) | string |
onResize | onResize() | void |
setChaching | setChaching() | void |
getChaching | getChaching() | void |
onValueChanged | onValueChanged(e: undefined) | void |
onChartInit | onChartInit(e: any, index: number) | void |
switchChartTypeHandler | switchChartTypeHandler() | void |
switchBasedOnTendencyHandler | switchBasedOnTendencyHandler() | void |
comparingWithPrevMonth | comparingWithPrevMonth(month: MonthData, bIndex: number, index: number) | string |
comparingBookingWithPrevSumm | comparingBookingWithPrevSumm(month: TotalBookingMonths, index: number) | string |
comparingForecastWithPrevSumm | comparingForecastWithPrevSumm(month: TotalBookingMonths, index: number) | string |
setValue | setValue(value: number) | void |
setForecastValue | setForecastValue(value: number) | void |
setMarginAvarage | setMarginAvarage(value: number) | void |
isForecast | isForecast(month: MonthData) | boolean |
isAchievedOrCurrent | isAchievedOrCurrent(month: MonthData) | boolean |
getpriceForecastAmount | getpriceForecastAmount(month: MonthData) | number |
expectedCurrencyChange | expectedCurrencyChange(e: undefined) | void |
sorting | sorting(propertyName: string, propertyType: string, monthIndex: number) | void |
Properties
| Property | Type |
|---|---|
_widget | Widget |
_widgetType | string |
yearId | number |
periodId | number |
countOfEditablePrevMonths | number |
withoutOptionBar | boolean |
bookingOrSales | number |
withNominal | boolean |
selectedTeam | number |
forecastRuleId | number |
allowedtoEdit | boolean |
allowedtoEnableEdting | boolean |
forecastRules | any[] |
selectedYear | number |
numYearsDatasource | any[] |
todayWidgetsEnum | any |
cachingWidgetData | CachingWidgetData |
data | BranchData[] |
originalData | BranchData[] |
singleMonths | MonthData |
branchCurrency | any |
basedOnTendency | boolean |
SeriseRange | any[] |
echartsIntance | any |
totalBookingMonths | TotalBookingMonths[] |
tempTotalMonth | TotalBookingMonths |
totalTargets | number |
yearBooking | number |
totalForecasts | number |
tempTotalTarget | TotalTargets |
urrenFeature | number |
sortingDirection | number |
Where it refuses work
MrmBookingProductTypesComponentstops the work with an early return whena[propertyName] < b[propertyName], in 2 places.MrmBookingProductTypesComponentstops the work with an early return whena[propertyName] > b[propertyName], in 2 places.MrmBookingProductTypesComponentstops the work with an early return whenthis.dashboardLibraryService.checkFeatureSubscription(this.widget.chartEnumId).MrmBookingProductTypesComponentstops the work with an early return whenmonth.MonthId == 12.MrmBookingProductTypesComponentstops the work with an early return whenmonth.TotalValue < this.data[bIndex].MrmBooking[index - 1].TotalValue.MrmBookingProductTypesComponentstops the work with an early return whenmonth.TotalBookingMonth < this.totalBookingMonths[index - 1].TotalBookingMonth.
Diagram
mermaidgraph LR Lifecycle[Angular lifecycle] --> Init[ngOnInit] Lifecycle --> Changes[ngOnChanges] Init --> Subscription[checkFeatureSubscription] Changes --> Data[getDashboardData] Subscription --> Data Data --> Initialize[initalizingData] Initialize --> Performance[calculatePerformancePer] Initialize --> Month[translateMonthName] Initialize --> Price[getpriceFormatted] Initialize --> Cache[setChaching] Resize[onResize] --> Initialize
Usage
tsimport { AfterViewInit, Component, ViewChild } from '@angular/core';
import { MrmBookingProductTypesComponent } from './mrm-booking-product-types.component';
@Component({
selector: 'app-dashboard-host',
template: `
<!-- Render MrmBookingProductTypesComponent in this dashboard view -->
`,
})
export class DashboardHostComponent implements AfterViewInit {
@ViewChild(MrmBookingProductTypesComponent)
productTypesWidget!: MrmBookingProductTypesComponent;
ngAfterViewInit(): void {
if (this.productTypesWidget.checkFeatureSubscription()) {
this.productTypesWidget.getDashboardData();
}
}
onDashboardResize(): void {
this.productTypesWidget.onResize();
}
}
AI Coding Instructions
- Keep data loading inside
getDashboardData()and data preparation insideinitalizingData(). - Call
checkFeatureSubscription()before requesting or displaying subscription-gated dashboard data. - Recalculate display-dependent values through
onResize()rather than duplicating resize logic in parent components. - Keep month translation and price formatting in
translateMonthName()andgetpriceFormatted()so widget output stays consistent. - Preserve the existing
setChaching()method name when working with current callers.
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)
DashboardWidgetsModule—Frontend/src/app/components/dashboard/dashboard-widgets.module.ts:1
Was this page helpful?