# MrmBacklogProductTypesComponent

**Kind:** Class

**Source:** `Frontend/src/app/components/dashboard/dashboard-libary/widgets/mrm-backlog-product-types/mrm-backlog-product-types.component.ts` (line 45)

**Part of:** [Frontend](subsystem-frontend-src-app)

`MrmBacklogProductTypesComponent` is an Angular dashboard widget for displaying backlog product-type data. It checks feature access, loads and initializes dashboard data, calculates display values, and responds to lifecycle and resize events within the dashboard widget library.

**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` |
| `switchVendorTypeIdHandler` | `switchVendorTypeIdHandler(vendorTypeId: number)` | `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` |

## Properties

| Property | Type |
|---|---|
| `_widget` | `Widget` |
| `_widgetType` | `string` |
| `yearId` | `number` |
| `periodId` | `number` |
| `countOfEditablePrevMonths` | `number` |
| `withoutOptionBar` | `boolean` |
| `withNominal` | `boolean` |
| `allowedtoEdit` | `boolean` |
| `allowedtoEnableEdting` | `boolean` |
| `selectedYear` | `number` |
| `vendorTypeEnum` | `any` |
| `vendorTypeId` | `any` |
| `cachingWidgetData` | `CachingWidgetData` |
| `data` | `BranchData[]` |
| `originalData` | `BranchData[]` |
| `singleMonths` | `MonthData` |
| `branchName` | `string` |
| `branchCurrency` | `any` |
| `SeriseRange` | `any[]` |
| `echartsIntance` | `any` |
| `totalBookingMonths` | `TotalBookingMonths[]` |
| `tempTotalMonth` | `TotalBookingMonths` |
| `totalTargets` | `number` |
| `yearBooking` | `number` |
| `totalForecasts` | `number` |
| `tempTotalTarget` | `TotalTargets` |
| `urrenFeature` | `number` |

## Where it refuses work

- `MrmBacklogProductTypesComponent` stops the work with an early return when `this.dashboardLibraryService.checkFeatureSubscription(this.widget.chartEnumId)`.
- `MrmBacklogProductTypesComponent` stops the work with an early return when `month.MonthId == 12`.
- `MrmBacklogProductTypesComponent` stops the work with an early return when `month.TotalValue < this.data[bIndex].MrmBooking[index - 1].TotalValue`.
- `MrmBacklogProductTypesComponent` stops the work with an early return when `month.TotalBookingMonth < this.totalBookingMonths[index - 1].TotalBookingMonth`.
- `MrmBacklogProductTypesComponent` stops the work with an early return when `month.TotalForecastMonth < this.totalBookingMonths[index - 1].TotalForecastMonth`.
- `MrmBacklogProductTypesComponent` stops the work with an early return when `month.MonthId >= new Date().getMonth() + 1`.

## Diagram

```mermaid
graph LR
    A[Angular Lifecycle] --> B[MrmBacklogProductTypesComponent]
    B --> C[checkFeatureSubscription]
    B --> D[ngOnInit]
    B --> E[ngOnChanges]
    D --> F[getDashboardData]
    E --> F
    F --> G[initalizingData]
    G --> H[calculatePerformancePer]
    G --> I[translateMonthName]
    G --> J[getpriceFormatted]
    B --> K[onResize]
    K --> L[setChaching]
```

## Usage

```ts
import { MrmBacklogProductTypesComponent } from './mrm-backlog-product-types.component';

function refreshBacklogProductTypes(
  component: MrmBacklogProductTypesComponent,
): void {
  if (!component.checkFeatureSubscription()) {
    return;
  }

  component.getDashboardData();

  const performancePercentage = component.calculatePerformancePer();
  const monthName = component.translateMonthName();
  const formattedPrice = component.getpriceFormatted();

  console.log({
    performancePercentage,
    monthName,
    formattedPrice,
  });
}
```

## AI Coding Instructions

- Call `checkFeatureSubscription()` before requesting or displaying feature-specific dashboard data.
- Keep data loading in `getDashboardData()` and data preparation in `initalizingData()` rather than duplicating initialization logic.
- Preserve the existing method name `initalizingData()` when modifying call sites, including its current spelling.
- Recalculate display-derived values through `calculatePerformancePer()`, `translateMonthName()`, and `getpriceFormatted()` instead of formatting the same values in templates.
- Route resize-related updates through `onResize()` and keep caching behavior within `setChaching()`.

## 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
