Skip to content

MrmWarehouseSupplierComponent

reference
2 min readUpdated

Kind: Class

Source: Frontend/src/app/components/dashboard/dashboard-libary/widgets/mrm-warehouse-supplier/mrm-warehouse-supplier.component.ts (line 84)

Part of: Frontend

MrmWarehouseSupplierComponent is an Angular dashboard widget for warehouse supplier data. It checks feature subscription access, loads and saves dashboard data, prepares month-based totals, formats display values, and synchronizes scrolling.

Extends: BaseWidgetComponent

Methods

MethodSignatureReturns
checkFeatureSubscriptioncheckFeatureSubscription()boolean
ngOnInitngOnInit()void
ngOnChangesngOnChanges()void
getDashboardDatagetDashboardData()void
initalizingDatainitalizingData(value: BranchData[])void
saveDashboardDatasaveDashboardData()void
calculateSumByMonthcalculateSumByMonth(monthIndex: number)void
translateMonthNametranslateMonthName(month: MonthData)string
syncScrollsyncScroll(e: undefined)void
getpriceFormattedgetpriceFormatted(x: undefined)string
onResizeonResize()void
setChachingsetChaching()void
getChachinggetChaching()void
switchChartTypeHandlerswitchChartTypeHandler()void
switchBasedOnTendencyHandlerswitchBasedOnTendencyHandler()void
comparingWithPrevMonthcomparingWithPrevMonth(month: MonthData, bIndex: number, index: number)string
comparingBookingWithPrevSummcomparingBookingWithPrevSumm(month: MonthsSum, index: number, propertyName: string)string
isCurrentMonthisCurrentMonth(month: MonthData)boolean
getpriceForecastAmountgetpriceForecastAmount(month: MonthData)number
expectedCurrencyChangeexpectedCurrencyChange(e: undefined)void
selectTextselectText(e: undefined)void
editSelectedMonthPrepareeditSelectedMonthPrepare(month: MonthData, supplierId: number)void
copyValueFromPrevMonthcopyValueFromPrevMonth(month: MonthData, monthIndex: 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
allowedtoEditboolean
allowedtoEnableEdtingboolean
widgetEditRequestany
widgetEditEndany
forecastRulesany[]
selectedYearnumber
numYearsDatasourceany[]
todayWidgetsEnumany
cachingWidgetDataCachingWidgetData
dataBranchData[]
originalDataBranchData[]
selectedDataBranchData[]
singleMonthsMonthData
branchCurrencyany
basedOnTendencyboolean
SeriseRangeany[]
echartsIntanceany
totalBookingMonthsMonthsSum[]
tempMonthSumMonthsSum
totalTargetsnumber
yearBookingnumber
totalForecastsnumber
tempTotalTargetTotalTargets
popupany
searchTextstring
isModeOfInsertFromPrevMonthActiveboolean
pastDiffnumber
urrenFeaturenumber
sortingDirectionnumber

Where it refuses work

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

Diagram

mermaid
graph LR
  Lifecycle[Angular lifecycle] --> Component[MrmWarehouseSupplierComponent]
  Component --> Subscription[checkFeatureSubscription]
  Component --> Data[getDashboardData]
  Data --> Initialize[initalizingData]
  Initialize --> Totals[calculateSumByMonth]
  Component --> Save[saveDashboardData]
  Totals --> MonthLabel[translateMonthName]
  Totals --> PriceFormat[getpriceFormatted]
  Component --> Scroll[syncScroll]

Usage

ts
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MrmWarehouseSupplierComponent } from './mrm-warehouse-supplier.component';

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

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

    fixture = TestBed.createComponent(MrmWarehouseSupplierComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  it('loads dashboard data for subscribed users', () => {
    if (component.checkFeatureSubscription()) {
      component.getDashboardData();
      component.calculateSumByMonth();

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

      expect(monthName).toBeDefined();
      expect(formattedPrice).toBeDefined();
    }
  });
});

AI Coding Instructions

  • Keep subscription checks in place before requesting or displaying warehouse supplier dashboard data.
  • Follow Angular lifecycle flow: initialize data through ngOnInit and refresh derived state through ngOnChanges when inputs change.
  • Preserve the existing initalizingData method name when calling it, even though its spelling differs from initializing.
  • Recalculate month totals after changing source dashboard data so formatted month and price values stay current.
  • Keep syncScroll tied to the relevant scroll containers and avoid calling it before the widget view is available.

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