diff --git a/apps/red-ui/src/app/modules/admin/screens/license/license-screen/license-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/license/license-screen/license-screen.component.ts index bea5b2140..7cb4a8184 100644 --- a/apps/red-ui/src/app/modules/admin/screens/license/license-screen/license-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/license/license-screen/license-screen.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component } from '@angular/core'; import { ConfigService } from '@services/config.service'; import { TranslateService } from '@ngx-translate/core'; import { @@ -20,7 +20,7 @@ import { User } from '@red/domain'; templateUrl: './license-screen.component.html', styleUrls: ['./license-screen.component.scss'], }) -export class LicenseScreenComponent implements OnInit { +export class LicenseScreenComponent { readonly roles = ROLES; readonly currentUser = getCurrentUser(); readonly currentYear = new Date().getFullYear(); @@ -48,10 +48,6 @@ export class LicenseScreenComponent implements OnInit { _loadingService.start(); } - async ngOnInit() { - await this.licenseService.loadLicenseData(); - } - getAnalysisPercentageOfLicense() { const totalLicensedNumberOfPages = this.licenseService.totalLicensedNumberOfPages; const numberOfAnalyzedPages = this.licenseService.currentInfo.numberOfAnalyzedPages; diff --git a/apps/red-ui/src/app/modules/admin/screens/license/license.module.ts b/apps/red-ui/src/app/modules/admin/screens/license/license.module.ts index a567edb1f..ad7375bca 100644 --- a/apps/red-ui/src/app/modules/admin/screens/license/license.module.ts +++ b/apps/red-ui/src/app/modules/admin/screens/license/license.module.ts @@ -1,4 +1,4 @@ -import { NgModule } from '@angular/core'; +import { inject, NgModule } from '@angular/core'; import { LicenseScreenComponent } from './license-screen/license-screen.component'; import { LicenseSelectComponent } from './license-select/license-select.component'; import { LicenseChartComponent } from './license-chart/license-chart.component'; @@ -10,11 +10,15 @@ import { NgxChartsModule } from '@swimlane/ngx-charts'; import { ComboChartComponent, ComboSeriesVerticalComponent, YAxisComponent } from './combo-chart'; import { FormsModule } from '@angular/forms'; import { CommonModule } from '@angular/common'; +import { LicenseService } from '@services/license.service'; const routes: Routes = [ { path: '', component: LicenseScreenComponent, + resolve: { + licenseData: () => inject(LicenseService).loadLicenseData(), + }, }, ]; diff --git a/apps/red-ui/src/app/modules/admin/screens/license/utils/functions.ts b/apps/red-ui/src/app/modules/admin/screens/license/utils/functions.ts index f2c71fe4d..2e5a7808f 100644 --- a/apps/red-ui/src/app/modules/admin/screens/license/utils/functions.ts +++ b/apps/red-ui/src/app/modules/admin/screens/license/utils/functions.ts @@ -2,7 +2,7 @@ import dayjs from 'dayjs'; import { IDateRange } from '@red/domain'; export function toDate(month: number, year: number) { - return dayjs(`01-${month}-${year}`, 'DD-M-YYYY').toDate(); + return dayjs(`${month}-01-${year}`, 'MM-DD-YYYY').toDate(); } export function isCurrentMonth(month: number, year: number) {