Skip to content

MrmBookingCityComponent

reference
2 min readUpdated

Kind: Class

Source: Frontend/src/app/components/dashboard/dashboard-libary/widgets/mrm-booking-city/mrm-booking-city.component.ts (line 118)

Part of: Frontend

MrmBookingCityComponent is an Angular dashboard widget for presenting booking data by city. It checks feature subscription access, loads and initializes dashboard state, calculates monthly and yearly totals, translates month labels, formats prices, and saves dashboard data. The component responds to Angular lifecycle events through ngOnInit and ngOnChanges.

Extends: BaseWidgetComponent

Methods

MethodSignatureReturns
checkFeatureSubscriptioncheckFeatureSubscription()boolean
ngOnInitngOnInit()void
ngOnChangesngOnChanges()void
getDashboardDatagetDashboardData()void
initalizingDatainitalizingData(value: BranchData[])void
saveDashboardDatasaveDashboardData()void
calculateSumByYearcalculateSumByYear()void
calculateSumByMonthcalculateSumByMonth(monthIndex: number)void
translateMonthNametranslateMonthName(month: MonthData)string
getpriceFormattedgetpriceFormatted(x: undefined)string
onResizeonResize()void
setChachingsetChaching()void
getChachinggetChaching()void
switchChartTypeHandlerswitchChartTypeHandler()void
switchBasedOnTendencyHandlerswitchBasedOnTendencyHandler()void
comparingWithPrevMonthcomparingWithPrevMonth(month: BranchData, bIndex: number, index: number, propertyName: string)string
comparingMonthsWithPrevSummcomparingMonthsWithPrevSumm(month: TotalBookingMonths, index: number, propertyName: string)string
isCurrentMonthisCurrentMonth(month: MonthData)boolean
getpriceForecastAmountgetpriceForecastAmount(month: MonthData)number
expectedCurrencyChangeexpectedCurrencyChange(e: undefined)void
selectTextselectText(e: undefined)void
mouseoverRowSpanmouseoverRowSpan(e: undefined, bIndex: number)void
mouseoutRowSpanmouseoutRowSpan(e: undefined, bIndex: number)void
syncScrollsyncScroll(e: undefined)void
editSelectedMonthPrepareeditSelectedMonthPrepare(month: MonthData, supplierId: number)void
sortingsorting(propertyName: string, propertyType: string, monthIndex: number)void
openPopupopenPopup(n: string, t: string, i: string, btnTxt: string)void
savePopupsavePopup()void
ClosewithDonotSaveClosewithDonotSave()void
OnOpenedPopupOnOpenedPopup()void
closePopupclosePopup()void

Properties

PropertyType
sharedPopupSharedPopupComponent
scrollOneElementRef
scrollTwoElementRef
scrollThreeElementRef
_widgetWidget
_widgetTypestring
yearIdnumber
periodIdnumber
countOfEditablePrevMonthsnumber
withoutOptionBarboolean
editModeboolean
bookingOrSalesnumber
withNominalboolean
selectedTeamnumber
forecastRuleIdnumber
dataBranchData[]
allowedtoEditboolean
allowedtoEnableEdtingboolean
widgetEditRequestany
widgetEditEndany
forecastRulesany[]
selectedYearnumber
numYearsDatasourceany[]
todayWidgetsEnumany
cachingWidgetDataCachingWidgetData
originalDataBranchData[]
selectedDataBranchData[]
singleMonthsMonthData
branchCurrencyany
basedOnTendencyboolean
SeriseRangeany[]
echartsIntanceany
totalBookingMonthsTotalBookingMonths[]
tempTotalMonthTotalBookingMonths
popupany
searchTextstring
urrenFeaturenumber
sortingDirectionnumber

Where it refuses work

  • MrmBookingCityComponent stops the work with an early return when a[propertyName] < b[propertyName], in 2 places.
  • MrmBookingCityComponent stops the work with an early return when a[propertyName] > b[propertyName], in 2 places.
  • MrmBookingCityComponent stops the work with an early return when this.dashboardLibraryService.checkFeatureSubscription(this.widget.chartEnumId).
  • MrmBookingCityComponent stops the work with an early return when month.MonthId == 12.
  • MrmBookingCityComponent stops the work with an early return when month[propertyName] < this.data[bIndex].MrmBooking[index - 1][propertyName].
  • MrmBookingCityComponent stops the work with an early return when month[propertyName] < this.totalBookingMonths[index - 1][propertyName].

Diagram

mermaid
graph LR
  A[ngOnInit / ngOnChanges] --> B[checkFeatureSubscription]
  B -->|Allowed| C[getDashboardData]
  C --> D[initalizingData]
  D --> E[calculateSumByYear]
  D --> F[calculateSumByMonth]
  F --> G[translateMonthName]
  E --> H[getpriceFormatted]
  F --> H
  D --> I[saveDashboardData]

Usage

ts
import { MrmBookingCityComponent } from './mrm-booking-city.component';

function refreshBookingCityWidget(
  widget: MrmBookingCityComponent,
): void {
  if (!widget.checkFeatureSubscription()) {
    return;
  }

  widget.getDashboardData();
  widget.calculateSumByYear();
  widget.calculateSumByMonth();

  const monthLabel = widget.translateMonthName();
  const formattedPrice = widget.getpriceFormatted();

  console.log({ monthLabel, formattedPrice });

  widget.saveDashboardData();
}

AI Coding Instructions

  • Let Angular invoke ngOnInit and ngOnChanges; keep lifecycle setup inside those hooks rather than calling them from application code.
  • Check checkFeatureSubscription() before loading or displaying subscription-gated booking data.
  • Keep data loading, initialization, calculation, formatting, and persistence in their existing method flow.
  • When changing monthly aggregation, update calculateSumByMonth() and translateMonthName() together so labels match calculated data.
  • Treat getpriceFormatted() as display formatting and keep numeric calculation logic in the sum methods.

Used by

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

Imported by (3)

  • DashboardTabComponentFrontend/src/app/components/dashboard/dashboard-libary/dashboard-tab/dashboard-tab.component.ts:1
  • DashboardWidgetsModuleFrontend/src/app/components/dashboard/dashboard-widgets.module.ts:1
  • ReportsTabComponentFrontend/src/app/components/reports/reports-library/reports-tab/reports-tab.component.ts:1

Was this page helpful?

Download as PDF