Skip to content

DashboardLibraryService

reference
2 min readUpdated

Kind: Class

Source: Pams/Web/Pams.Web/Client/app/services/dashboard/dashboard-library.service.ts (line 205)

Part of: Pams

DashboardLibraryService is a client-side service for retrieving dashboard widgets, roles, reports, and dashboard tab data. It also sends dashboard configuration changes, including active dashboard selection and separate branch view settings, between UI components and the backend.

Methods

MethodSignatureReturns
getWidgetDatagetWidgetData(widgetEnum: number, useNominal: boolean, useLocalVendor: boolean, yearId: number, yearEnum: number, useTendency: boolean, skip: number, take: number, teamId: number, widgetTargetId: number, forecastRuleId: number, OnlyActiveOffers: boolean, useForecast: boolean, getRateByVal: boolean)void
getRolesDashboardgetRolesDashboard()void
getRoleDashboardByIdgetRoleDashboardById(id: number)void
savelatestmodificationssavelatestmodifications(logHistory: DashboardLog)void
saveRoleDashboardsaveRoleDashboard(roleDashboard: RoleDashboard)void
saveDashboardTabssaveDashboardTabs(tabs: DashboardTabs[])void
getDashboardTabsgetDashboardTabs()void
changeActiveDashboardchangeActiveDashboard(roleId: number)void
toggoleSeparateBranchesViewstoggoleSeparateBranchesViews(separateBranchesViews: boolean)void
getRolesReportsgetRolesReports()void
getRoleReportsByIdgetRoleReportsById(id: number)void
getReportsTabsgetReportsTabs()void
saveRoleReportssaveRoleReports(roleDashboard: RoleDashboard)void
savelatestmodificationsForReportsavelatestmodificationsForReport(logHistory: DashboardLog)void
changeActiveReportchangeActiveReport(roleId: number)void
getBookingByProductTypegetBookingByProductType(useNominal: boolean)void
getBookingByTeamgetBookingByTeam(useNominal: boolean)void
getBookingBySuppliergetBookingBySupplier()void
getMRMBookingByNonSalesTeamgetMRMBookingByNonSalesTeam()void
saveMRMBookingByNonSalesTeamsaveMRMBookingByNonSalesTeam(monthData: any[])void
getMRMBacklogByProductTypegetMRMBacklogByProductType(vendorTypeId: number)void
getMRMForLGsgetMRMForLGs()void
getMRMWrehousegetMRMWrehouse()void
saveMRMWrehousesaveMRMWrehouse(monthData: any[])void
getMRMScrapStockgetMRMScrapStock()void
saveMRMScrapStocksaveMRMScrapStock(monthData: any[])void
getMRMTotalSalesgetMRMTotalSales(calculateBy: number)void
saveMRMTotalSalessaveMRMTotalSales(monthData: any[])void
getMRMCOGSgetMRMCOGS()void
saveMRMCOGSsaveMRMCOGS(monthData: any[])void
getMRMSGAndAgetMRMSGAndA()void
saveMRMSGAndAsaveMRMSGAndA(monthData: any[])void
getMRMDepreciationgetMRMDepreciation()void
saveMRMDepreciationsaveMRMDepreciation(monthData: any[])void
getMRMProfitAndLossgetMRMProfitAndLoss()void
saveMRMProfitAndLosssaveMRMProfitAndLoss(monthData: any[])void
getMRMCurrenciesRategetMRMCurrenciesRate()void
saveMRMCurrenciesRatesaveMRMCurrenciesRate(monthData: any[])void
getMRMPMBackloggetMRMPMBacklog()void
getMRMPMShipmentgetMRMPMShipment()void
getMRMCashPositiongetMRMCashPosition()void
saveMRMCashPositionsaveMRMCashPosition(monthData: any[])void
getMRMAccountReceivablegetMRMAccountReceivable()void
saveMRMAccountReceivablesaveMRMAccountReceivable(monthData: any[])void
getMRMAccountPayablegetMRMAccountPayable()void
saveMRMAccountPayablesaveMRMAccountPayable(monthData: any[])void
getMRMNetProfitgetMRMNetProfit()void
getMRMGrossMargingetMRMGrossMargin()void
getMRMCashFlowgetMRMCashFlow(CashFlowDisplay: number)void
saveMRMCashFlowsaveMRMCashFlow(monthData: any)void

Properties

PropertyType
yearDropdownany[]
yearSinceJanDropdownany[]
AccountTypesany[]
noResizeboolean
noMoveboolean
forecastRulesany[]
_separateBranchesViewsboolean
separateBranchesViewsany
allTodayWidgetsWidget[]
MRMReportTabsDashboardTabs[]
MRMWidgetsWidget[]

Where it refuses work

  • DashboardLibraryService stops the work with an early return when url && url != "".

Diagram

mermaid
graph LR
    Component[Dashboard UI Component] --> Service[DashboardLibraryService]

    Service --> Widgets[getWidgetData]
    Service --> Roles[getRolesDashboard]
    Service --> RoleById[getRoleDashboardById]
    Service --> Reports[getRolesReports]
    Service --> Tabs[getDashboardTabs]

    Service --> SaveChanges[savelatestmodifications]
    Service --> SaveRole[saveRoleDashboard]
    Service --> SaveTabs[saveDashboardTabs]
    Service --> ActiveDashboard[changeActiveDashboard]
    Service --> BranchViews[toggoleSeparateBranchesViews]

    Service --> Api[Backend API]

Usage

ts
import { Component, OnInit } from '@angular/core';
import { DashboardLibraryService } from 'app/services/dashboard/dashboard-library.service';

@Component({
  selector: 'app-dashboard-settings',
  template: `<!-- dashboard settings -->`
})
export class DashboardSettingsComponent implements OnInit {
  dashboardTabs: unknown;

  constructor(
    private readonly dashboardLibraryService: DashboardLibraryService
  ) {}

  ngOnInit(): void {
    this.dashboardLibraryService.getDashboardTabs().subscribe({
      next: (tabs) => {
        this.dashboardTabs = tabs;
      },
      error: (error) => {
        console.error('Unable to load dashboard tabs.', error);
      }
    });
  }

  loadWidgetData(): void {
    this.dashboardLibraryService.getWidgetData().subscribe();
  }
}

AI Coding Instructions

  • Keep dashboard API access inside DashboardLibraryService; components should call service methods rather than making direct HTTP requests.
  • Preserve the existing method name toggoleSeparateBranchesViews, including its spelling, when adding callers or references.
  • Handle observable subscriptions and errors in the consuming component, facade, or effect according to the existing application pattern.
  • Confirm request and response shapes against the backend contract before changing save methods such as saveRoleDashboard or saveDashboardTabs.
  • Refresh related dashboard state after calling methods that change the active dashboard, tabs, or branch view settings.

Used by

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

Imported by (112)

  • ReportsSettingsComponentPams/Web/Pams.Web/Client/app/components/configuration/reports-settings/reports-settings/reports-settings.component.ts:1
  • ReportsSettingsDetailsComponentPams/Web/Pams.Web/Client/app/components/configuration/reports-settings/reports-settings-details/reports-settings-details.component.ts:1
  • DashboardTabComponentPams/Web/Pams.Web/Client/app/components/dashboard/dashboard-libary/dashboard-tab/dashboard-tab.component.ts:1
  • BranchDataPams/Web/Pams.Web/Client/app/components/dashboard/dashboard-libary/widgets/mrm-account-payable/mrm-account-payable.component.ts:1
  • BranchDataPams/Web/Pams.Web/Client/app/components/dashboard/dashboard-libary/widgets/mrm-account-receivable/mrm-account-receivable.component.ts:1
  • BranchDataPams/Web/Pams.Web/Client/app/components/dashboard/dashboard-libary/widgets/mrm-backlog-product-types/mrm-backlog-product-types.component.ts:1
  • BranchDataPams/Web/Pams.Web/Client/app/components/dashboard/dashboard-libary/widgets/mrm-booking-city/mrm-booking-city.component.ts:1
  • BranchDataPams/Web/Pams.Web/Client/app/components/dashboard/dashboard-libary/widgets/mrm-booking-product-types/mrm-booking-product-types.component.ts:1

…and 104 more.

Was this page helpful?

Download as PDF