Skip to content

MrmBookingCityComponent

reference
2 min readUpdated

Kind: Class

Source: Pams/Web/Pams.Web/Client/app/components/dashboard/dashboard-libary/widgets/mrm-booking-city/mrm-booking-city.component.ts (line 118)

Part of: Pams

MrmBookingCityComponent is an Angular dashboard widget for loading, initializing, and saving booking-city dashboard data. It manages authorization checks, lifecycle updates, period-based totals by year and month, and month-name translation for display.

Methods

MethodSignatureReturns
GetAuthorizationAccessGetAuthorizationAccess(url: string)void
ngOnInitngOnInit()void
ngOnChangesngOnChanges()void
ngOnDestroyngOnDestroy()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
withoutOptionBarboolean
editModeboolean
bookingOrSalesnumber
withNominalboolean
selectedTeamnumber
forecastRuleIdnumber
dataBranchData[]
allowedtoEditboolean
allowedtoEnableEdtingboolean
widgetEditRequestany
widgetEditEndany
forecastRulesany[]
selectedYearnumber
numYearsDatasourceany[]
todayWidgetsEnumany
cachingWidgetDataCachingWidgetData
originalDataBranchData[]
selectedDataBranchData[]
singleMonthsMonthData
branchCurrencyany
basedOnTendencyboolean
subscriptionSubscription
SeriseRangeany[]
echartsIntanceany
totalBookingMonthsTotalBookingMonths[]
tempTotalMonthTotalBookingMonths
popupany
searchTextstring
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 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].
  • MrmBookingCityComponent stops the work with an early return when this.allowedtoEnableEdting.

Diagram

mermaid
graph LR
  A[Angular Lifecycle] --> B[ngOnInit]
  A --> C[ngOnChanges]
  A --> D[ngOnDestroy]

  B --> E[GetAuthorizationAccess]
  E --> F[getDashboardData]
  F --> G[initalizingData]

  C --> F
  G --> H[calculateSumByYear]
  G --> I[calculateSumByMonth]
  I --> J[translateMonthName]

  G --> K[saveDashboardData]

Usage

ts
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MrmBookingCityComponent } from './mrm-booking-city.component';

describe('MrmBookingCityComponent', () => {
  let fixture: ComponentFixture<MrmBookingCityComponent>;
  let component: MrmBookingCityComponent;

  beforeEach(async () => {
    await TestBed.configureTestingModule({
      declarations: [MrmBookingCityComponent],
    }).compileComponents();

    fixture = TestBed.createComponent(MrmBookingCityComponent);
    component = fixture.componentInstance;

    fixture.detectChanges();
  });

  it('loads dashboard data during initialization', () => {
    component.ngOnInit();

    component.getDashboardData();
    component.calculateSumByYear();
    component.calculateSumByMonth();
  });
});

AI Coding Instructions

  • Keep data loading inside the existing authorization and lifecycle flow; call GetAuthorizationAccess() before requesting dashboard data when access must be verified.
  • Treat ngOnChanges() as a refresh path when component inputs change, and avoid duplicating initialization logic outside initalizingData().
  • Keep yearly and monthly aggregation logic in calculateSumByYear() and calculateSumByMonth() so displayed totals remain derived from the same data source.
  • Use translateMonthName() for month labels instead of hardcoding display text, especially when adding localized dashboard output.
  • Release subscriptions, timers, or other managed resources in ngOnDestroy() when extending the component.

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)

  • TranslateHandlerPams/Web/Pams.Web/Client/app/app.module.ts:1
  • DashboardTabComponentPams/Web/Pams.Web/Client/app/components/dashboard/dashboard-libary/dashboard-tab/dashboard-tab.component.ts:1
  • ReportsTabComponentPams/Web/Pams.Web/Client/app/components/dashboard/reports-library/reports-tab/reports-tab.component.ts:1

Was this page helpful?

Download as PDF