Skip to content

MrmWarehouseSupplierComponent

reference
2 min readUpdated

Kind: Class

Source: Pams/Web/Pams.Web/Client/app/components/dashboard/dashboard-libary/widgets/mrm-warehouse-supplier/mrm-warehouse-supplier.component.ts (line 84)

Part of: Pams

MrmWarehouseSupplierComponent manages warehouse-supplier dashboard data within the dashboard widget library. It handles authorization checks, lifecycle updates, data initialization and persistence, monthly totals, month-name translation, and synchronized scrolling.

Methods

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

Diagram

mermaid
graph LR
    A[Angular lifecycle] --> B[GetAuthorizationAccess]
    A --> C[initalizingData]
    C --> D[getDashboardData]
    D --> E[calculateSumByMonth]
    E --> F[translateMonthName]
    F --> G[Dashboard widget view]
    G --> H[syncScroll]
    G --> I[saveDashboardData]
    A --> J[ngOnDestroy]

Usage

ts
import { Component, ViewChild } from '@angular/core';
import { MrmWarehouseSupplierComponent } from './mrm-warehouse-supplier.component';

@Component({
  selector: 'app-dashboard-page',
  template: `
    <app-mrm-warehouse-supplier></app-mrm-warehouse-supplier>

    <button type="button" (click)="refreshWidget()">
      Refresh
    </button>
  `
})
export class DashboardPageComponent {
  @ViewChild(MrmWarehouseSupplierComponent)
  warehouseSupplierWidget!: MrmWarehouseSupplierComponent;

  refreshWidget(): void {
    this.warehouseSupplierWidget.getDashboardData();
    this.warehouseSupplierWidget.calculateSumByMonth();
    this.warehouseSupplierWidget.syncScroll();
  }

  saveWidgetState(): void {
    this.warehouseSupplierWidget.saveDashboardData();
  }
}

AI Coding Instructions

  • Keep authorization checks in GetAuthorizationAccess() before loading or saving dashboard data.
  • Follow Angular lifecycle flow: initialize data in ngOnInit(), respond to updated bindings in ngOnChanges(), and release subscriptions or listeners in ngOnDestroy().
  • Preserve the existing initalizingData() method name when calling or modifying it, even though its spelling differs from initializingData.
  • Recalculate monthly totals with calculateSumByMonth() after dashboard data changes, then update month labels through translateMonthName().
  • Keep linked scroll containers synchronized through syncScroll() without creating recursive scroll event updates.

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