Upgrading to Angular 20:

Replaced checked in package-lock.json by regenerated one.
Ran ng update @angular/core@20 @angular/cli@20
Ran npm install @angular-builders/jest@^20.0.0 @fortawesome/angular-fontawesome@^3.0.0 @swimlane/ngx-graph@^11
Ran npm install ngx-mat-select-search@^8.0.2.
Ran ng update @angular/material@20.
Updated all eslint and typescript to the latest versions.
Removed @angular-devkit/schematics.
Updated fontawesome.
Updated rxjs and tslib.
Moved required node version from 16 to 20.
Updated jest-preset-angular.
Set preserveWhitespaces to false.
Corrected two type declarations in two typescript files to make ng serve run without errors.
Removed unused angular-devkit/schematics from view-user.component.ts .
Updated list of supported browsers.
Upgraded prettier.
Ran prettier . --write the first time.
Ran prettier . --write the second time.
Ran ng generate @angular/core:inject with defaults, excepted a handful of files.
Fixed remaining eslint problems.
Added dist directory to ignores in eslint.config.js.
Let prettier fix formatting, almost everything is just line breaks.
Made htmlhint ignore @if and @for Angular constructs.
Updated node version in Github workflow to 22.12.0 (build.yml).
Updated .env.ts.
Updated Angular datetime format strings from YYYY-MM-DD to yyyy-MM-dd.
Merged changes from dev into angular20 branch.
This commit is contained in:
Felix van Hove
2025-12-08 11:01:01 +01:00
parent f1b4ec2cf2
commit 7fd1486c08
1516 changed files with 39367 additions and 36037 deletions
@@ -1,5 +1,5 @@
/** Angular Imports */
import { Injectable } from '@angular/core';
import { Injectable, inject } from '@angular/core';
import { ActivatedRouteSnapshot } from '@angular/router';
/** rxjs Imports */
@@ -13,10 +13,7 @@ import { OrganizationService } from '../../organization.service';
*/
@Injectable()
export class EditOfficeResolver {
/**
* @param {OrganizationService} organizationService Organization service.
*/
constructor(private organizationService: OrganizationService) {}
private organizationService = inject(OrganizationService);
/**
* Returns the office and template data.
@@ -1,5 +1,5 @@
/** Angular Imports */
import { Injectable } from '@angular/core';
import { Injectable, inject } from '@angular/core';
import { ActivatedRouteSnapshot } from '@angular/router';
import { SystemService } from 'app/system/system.service';
@@ -11,10 +11,7 @@ import { Observable } from 'rxjs';
*/
@Injectable()
export class OfficeDatatableResolver {
/**
* @param {SystemService} systemService Products service.
*/
constructor(private systemService: SystemService) {}
private systemService = inject(SystemService);
/**
* Returns the Office's Datatable data.
@@ -1,5 +1,5 @@
/** Angular Imports */
import { Injectable } from '@angular/core';
import { Injectable, inject } from '@angular/core';
import { ActivatedRouteSnapshot } from '@angular/router';
import { SystemService } from 'app/system/system.service';
@@ -11,10 +11,7 @@ import { Observable } from 'rxjs';
*/
@Injectable()
export class OfficeDatatablesResolver {
/**
* @param {SystemService} systemService Products service.
*/
constructor(private systemService: SystemService) {}
private systemService = inject(SystemService);
/**
* Returns the loan product data.
@@ -1,5 +1,5 @@
/** Angular Imports */
import { Injectable } from '@angular/core';
import { Injectable, inject } from '@angular/core';
import { ActivatedRouteSnapshot } from '@angular/router';
/** rxjs Imports */
@@ -13,10 +13,7 @@ import { OrganizationService } from '../../organization.service';
*/
@Injectable()
export class OfficeResolver {
/**
* @param {OrganizationService} organizationService Organization service.
*/
constructor(private organizationService: OrganizationService) {}
private organizationService = inject(OrganizationService);
/**
* Returns the office data.
@@ -1,5 +1,5 @@
/** Angular Imports */
import { Injectable } from '@angular/core';
import { Injectable, inject } from '@angular/core';
/** rxjs Imports */
import { Observable } from 'rxjs';
@@ -12,10 +12,7 @@ import { OrganizationService } from '../../organization.service';
*/
@Injectable()
export class OfficesResolver {
/**
* @param {OrganizationService} organizationService Organization service.
*/
constructor(private organizationService: OrganizationService) {}
private organizationService = inject(OrganizationService);
/**
* Returns the offices data.
@@ -6,23 +6,29 @@
<mat-form-field>
<mat-label>{{ 'labels.inputs.Office' | translate }}</mat-label>
<input required matInput formControlName="name" />
<mat-error *ngIf="officeForm.controls.name.hasError('required')">
{{ 'labels.inputs.Office' | translate }} {{ 'labels.commons.is' | translate }}
<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
@if (officeForm.controls.name.hasError('required')) {
<mat-error>
{{ 'labels.inputs.Office' | translate }} {{ 'labels.commons.is' | translate }}
<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
}
</mat-form-field>
<mat-form-field>
<mat-label>{{ 'labels.inputs.Parent Office' | translate }}</mat-label>
<mat-select required formControlName="parentId">
<mat-option *ngFor="let office of officeData" [value]="office.id">
{{ office.name }}
</mat-option>
@for (office of officeData; track office) {
<mat-option [value]="office.id">
{{ office.name }}
</mat-option>
}
</mat-select>
<mat-error *ngIf="officeForm.controls.parentId.hasError('required')">
{{ 'labels.inputs.Parent Office' | translate }} {{ 'labels.commons.is' | translate }}
<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
@if (officeForm.controls.parentId.hasError('required')) {
<mat-error>
{{ 'labels.inputs.Parent Office' | translate }} {{ 'labels.commons.is' | translate }}
<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
}
</mat-form-field>
<mat-form-field (click)="openedOnDatePicker.open()">
@@ -37,10 +43,12 @@
/>
<mat-datepicker-toggle matSuffix [for]="openedOnDatePicker"></mat-datepicker-toggle>
<mat-datepicker #openedOnDatePicker></mat-datepicker>
<mat-error *ngIf="officeForm.controls.openingDate.hasError('required')">
{{ 'labels.inputs.Opening Date' | translate }} {{ 'labels.commons.is' | translate }}
<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
@if (officeForm.controls.openingDate.hasError('required')) {
<mat-error>
{{ 'labels.inputs.Opening Date' | translate }} {{ 'labels.commons.is' | translate }}
<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
}
</mat-form-field>
<mat-form-field>
@@ -1,5 +1,5 @@
/** Angular Imports */
import { Component, OnInit, TemplateRef, ElementRef, ViewChild, AfterViewInit } from '@angular/core';
import { Component, OnInit, TemplateRef, ElementRef, ViewChild, AfterViewInit, inject } from '@angular/core';
import { UntypedFormGroup, UntypedFormBuilder, Validators, ReactiveFormsModule } from '@angular/forms';
import { Router, ActivatedRoute, RouterLink } from '@angular/router';
@@ -27,6 +27,16 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
]
})
export class CreateOfficeComponent implements OnInit, AfterViewInit {
private formBuilder = inject(UntypedFormBuilder);
private organizationService = inject(OrganizationService);
private settingsService = inject(SettingsService);
private router = inject(Router);
private route = inject(ActivatedRoute);
private dateUtils = inject(Dates);
private popoverService = inject(PopoverService);
private configurationWizardService = inject(ConfigurationWizardService);
dialog = inject(MatDialog);
/** Office form. */
officeForm: UntypedFormGroup;
/** Office Data */
@@ -53,17 +63,7 @@ export class CreateOfficeComponent implements OnInit, AfterViewInit {
* @param {ConfigurationWizardService} configurationWizardService ConfigurationWizard Service.
* @param {PopoverService} popoverService PopoverService.
*/
constructor(
private formBuilder: UntypedFormBuilder,
private organizationService: OrganizationService,
private settingsService: SettingsService,
private router: Router,
private route: ActivatedRoute,
private dateUtils: Dates,
private popoverService: PopoverService,
private configurationWizardService: ConfigurationWizardService,
public dialog: MatDialog
) {
constructor() {
this.route.data.subscribe((data: { offices: any }) => {
this.officeData = data.offices;
});
@@ -6,24 +6,32 @@
<mat-form-field>
<mat-label>{{ 'labels.inputs.Office' | translate }}</mat-label>
<input matInput required formControlName="name" />
<mat-error *ngIf="officeForm.controls.name.hasError('required')">
{{ 'labels.inputs.Office' | translate }} {{ 'labels.commons.is' | translate }}
<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
@if (officeForm.controls.name.hasError('required')) {
<mat-error>
{{ 'labels.inputs.Office' | translate }} {{ 'labels.commons.is' | translate }}
<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
}
</mat-form-field>
<mat-form-field *ngIf="officeForm.contains('parentId')">
<mat-label>{{ 'labels.inputs.Parent Office' | translate }}</mat-label>
<mat-select required formControlName="parentId">
<mat-option *ngFor="let office of officeData.allowedParents" [value]="office.id">
{{ office.name }}
</mat-option>
</mat-select>
<mat-error *ngIf="officeForm.controls.parentId.hasError('required')">
{{ 'labels.inputs.Parent Office' | translate }} {{ 'labels.commons.is' | translate }}
<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
</mat-form-field>
@if (officeForm.contains('parentId')) {
<mat-form-field>
<mat-label>{{ 'labels.inputs.Parent Office' | translate }}</mat-label>
<mat-select required formControlName="parentId">
@for (office of officeData.allowedParents; track office) {
<mat-option [value]="office.id">
{{ office.name }}
</mat-option>
}
</mat-select>
@if (officeForm.controls.parentId.hasError('required')) {
<mat-error>
{{ 'labels.inputs.Parent Office' | translate }} {{ 'labels.commons.is' | translate }}
<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
}
</mat-form-field>
}
<mat-form-field (click)="openingDatePicker.open()">
<mat-label>{{ 'labels.inputs.Opened On' | translate }}</mat-label>
@@ -37,10 +45,12 @@
/>
<mat-datepicker-toggle matSuffix [for]="openingDatePicker"></mat-datepicker-toggle>
<mat-datepicker #openingDatePicker></mat-datepicker>
<mat-error *ngIf="officeForm.controls.openingDate.hasError('required')">
{{ 'labels.inputs.Opening Date' | translate }} {{ 'labels.commons.is' | translate }}
<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
@if (officeForm.controls.openingDate.hasError('required')) {
<mat-error>
{{ 'labels.inputs.Opening Date' | translate }} {{ 'labels.commons.is' | translate }}
<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
}
</mat-form-field>
<mat-form-field>
@@ -1,5 +1,5 @@
/** Angular Imports */
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, inject } from '@angular/core';
import { UntypedFormGroup, UntypedFormBuilder, Validators, ReactiveFormsModule } from '@angular/forms';
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
import { Dates } from 'app/core/utils/dates';
@@ -21,6 +21,13 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
]
})
export class EditOfficeComponent implements OnInit {
private organizationService = inject(OrganizationService);
private settingsService = inject(SettingsService);
private formBuilder = inject(UntypedFormBuilder);
private route = inject(ActivatedRoute);
private router = inject(Router);
private dateUtils = inject(Dates);
/** Selected Data. */
officeData: any;
/** Office form. */
@@ -40,14 +47,7 @@ export class EditOfficeComponent implements OnInit {
* @param {MatDialog} dialog Dialog reference.
* @param {Dates} dateUtils Date Utils
*/
constructor(
private organizationService: OrganizationService,
private settingsService: SettingsService,
private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates
) {
constructor() {
this.route.data.subscribe((data: { officeTemplate: any }) => {
this.officeData = data.officeTemplate;
});
@@ -117,55 +117,59 @@
</mat-card>
</div>
<div class="flex-48" *ngIf="office">
<mat-card>
<mat-card-content>
<div class="layout-row">
<mat-card-title>
{{ office.name }}
</mat-card-title>
<div class="flex align-end">
<button mat-icon-button (click)="closeOffice()">
<fa-icon icon="times"></fa-icon>
</button>
</div>
</div>
<mat-tab-group>
<mat-tab label="General">
<div class="layout-row-wrap">
<div class="flex-50 mat-body-strong" *ngIf="office.parentId">
{{ 'Parent Office' | translate }}
</div>
<div class="flex-50" *ngIf="office.parentId">
{{ office.parentName }}
</div>
<div class="flex-50 mat-body-strong">
{{ ' Opened On' | translate }}
</div>
<div class="flex-50">
{{ office.openingDate | date }}
</div>
<div class="flex-50 mat-body-strong" *ngIf="office.externalId">
{{ 'External Id' | translate }}
</div>
<div class="flex-50" *ngIf="office.externalId">
<mifosx-external-identifier externalId="{{ office.externalId }}"></mifosx-external-identifier>
</div>
@if (office) {
<div class="flex-48">
<mat-card>
<mat-card-content>
<div class="layout-row">
<mat-card-title>
{{ office.name }}
</mat-card-title>
<div class="flex align-end">
<button mat-icon-button (click)="closeOffice()">
<fa-icon icon="times"></fa-icon>
</button>
</div>
</mat-tab>
<mat-tab *ngFor="let dataTable of dataTablesData" label="{{ dataTable.registeredTableName }}"></mat-tab>
</mat-tab-group>
</mat-card-content>
</mat-card>
</div>
</div>
<mat-tab-group>
<mat-tab label="General">
<div class="layout-row-wrap">
@if (office.parentId) {
<div class="flex-50 mat-body-strong">
{{ 'Parent Office' | translate }}
</div>
}
@if (office.parentId) {
<div class="flex-50">
{{ office.parentName }}
</div>
}
<div class="flex-50 mat-body-strong">
{{ ' Opened On' | translate }}
</div>
<div class="flex-50">
{{ office.openingDate | date }}
</div>
@if (office.externalId) {
<div class="flex-50 mat-body-strong">
{{ 'External Id' | translate }}
</div>
}
@if (office.externalId) {
<div class="flex-50">
<mifosx-external-identifier externalId="{{ office.externalId }}"></mifosx-external-identifier>
</div>
}
</div>
</mat-tab>
@for (dataTable of dataTablesData; track dataTable) {
<mat-tab label="{{ dataTable.registeredTableName }}"></mat-tab>
}
</mat-tab-group>
</mat-card-content>
</mat-card>
</div>
}
</div>
</div>
@@ -1,5 +1,5 @@
/** Angular Imports */
import { Component, OnInit, TemplateRef, ElementRef, ViewChild, AfterViewInit } from '@angular/core';
import { Component, OnInit, TemplateRef, ElementRef, ViewChild, AfterViewInit, inject } from '@angular/core';
import { MatPaginator } from '@angular/material/paginator';
import { MatSort, MatSortHeader } from '@angular/material/sort';
import {
@@ -41,7 +41,7 @@ import { MatButtonToggleGroup, MatButtonToggle } from '@angular/material/button-
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
import { MatButton, MatIconButton } from '@angular/material/button';
import { MatCard, MatCardContent, MatCardTitle } from '@angular/material/card';
import { NgIf, NgFor, DatePipe } from '@angular/common';
import { DatePipe } from '@angular/common';
import { MatTabGroup, MatTab } from '@angular/material/tabs';
import { ExternalIdentifierComponent } from '../../shared/external-identifier/external-identifier.component';
import { DateFormatPipe } from '../../pipes/date-format.pipe';
@@ -88,6 +88,13 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
]
})
export class OfficesComponent implements OnInit, AfterViewInit {
private route = inject(ActivatedRoute);
private router = inject(Router);
private officeTreeService = inject(OfficeTreeService);
private treeControlService = inject(TreeControlService);
private configurationWizardService = inject(ConfigurationWizardService);
private popoverService = inject(PopoverService);
/** Button toggle group form control for type of view. (list/tree) */
viewGroup = new UntypedFormControl('listView');
@@ -135,14 +142,9 @@ export class OfficesComponent implements OnInit, AfterViewInit {
* @param {ConfigurationWizardService} configurationWizardService ConfigurationWizard Service.
* @param {PopoverService} popoverService PopoverService.
*/
constructor(
private route: ActivatedRoute,
private router: Router,
private officeTreeService: OfficeTreeService,
private treeControlService: TreeControlService,
private configurationWizardService: ConfigurationWizardService,
private popoverService: PopoverService
) {
constructor() {
const officeTreeService = this.officeTreeService;
this.route.data.subscribe((data: { offices: any; officeDataTables: any }) => {
this.officesData = data.offices;
officeTreeService.initialize(this.officesData);
@@ -1,5 +1,5 @@
/** Angular Imports */
import { Component } from '@angular/core';
import { Component, inject } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { EntityDatatableTabComponent } from '../../../../shared/tabs/entity-datatable-tab/entity-datatable-tab.component';
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
@@ -17,6 +17,8 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
]
})
export class DatatableTabsComponent {
private route = inject(ActivatedRoute);
entityId: string;
/** Office Datatable */
entityDatatable: any;
@@ -27,7 +29,7 @@ export class DatatableTabsComponent {
* Fetches data table data from `resolve`
* @param {ActivatedRoute} route Activated Route.
*/
constructor(private route: ActivatedRoute) {
constructor() {
this.entityId = this.route.parent.parent.snapshot.paramMap.get('officeId');
this.route.data.subscribe((data: { officeDatatable: any }) => {
@@ -19,12 +19,16 @@
<hr class="section-divider" />
<div class="flex-45 mat-body-strong left">{{ 'labels.inputs.External Id' | translate }}</div>
<div class="flex-50 right" *ngIf="officeData.externalId">
<mifosx-external-identifier externalId="{{ officeData.externalId }}"></mifosx-external-identifier>
</div>
<div class="flex-50 right" *ngIf="!officeData.externalId">
{{ 'labels.inputs.Unassigned' | translate }}
</div>
@if (officeData.externalId) {
<div class="flex-50 right">
<mifosx-external-identifier externalId="{{ officeData.externalId }}"></mifosx-external-identifier>
</div>
}
@if (!officeData.externalId) {
<div class="flex-50 right">
{{ 'labels.inputs.Unassigned' | translate }}
</div>
}
</div>
<div class="bottom-button-container small-buttons">
@@ -1,5 +1,5 @@
/** Angular Imports */
import { Component } from '@angular/core';
import { Component, inject } from '@angular/core';
import { ActivatedRoute, RouterLink } from '@angular/router';
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
import { ExternalIdentifierComponent } from '../../../../shared/external-identifier/external-identifier.component';
@@ -21,6 +21,8 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
]
})
export class GeneralTabComponent {
private route = inject(ActivatedRoute);
/** Office data */
officeData: any;
@@ -28,7 +30,7 @@ export class GeneralTabComponent {
* Fetches office data from `resolve`
* @param {ActivatedRoute} route Activated Route
*/
constructor(private route: ActivatedRoute) {
constructor() {
this.route.data.subscribe((data: { office: any }) => {
this.officeData = data.office;
});
@@ -12,19 +12,21 @@
>
{{ 'labels.inputs.General' | translate }}
</a>
<span *ngFor="let officeDatatable of officeDatatables">
<a
mat-tab-link
*mifosxHasPermission="'READ_' + officeDatatable.registeredTableName"
[routerLink]="['./datatables', officeDatatable.registeredTableName]"
routerLinkActive
#datatable="routerLinkActive"
[active]="datatable.isActive"
class="compact-tab"
>
{{ officeDatatable.registeredTableName }}
</a>
</span>
@for (officeDatatable of officeDatatables; track officeDatatable) {
<span>
<a
mat-tab-link
*mifosxHasPermission="'READ_' + officeDatatable.registeredTableName"
[routerLink]="['./datatables', officeDatatable.registeredTableName]"
routerLinkActive
#datatable="routerLinkActive"
[active]="datatable.isActive"
class="compact-tab"
>
{{ officeDatatable.registeredTableName }}
</a>
</span>
}
</nav>
<mat-tab-nav-panel #tabPanel class="tab-panel">
@@ -1,5 +1,5 @@
/** Angular Imports */
import { Component } from '@angular/core';
import { Component, inject } from '@angular/core';
import { ActivatedRoute, RouterLinkActive, RouterLink, RouterOutlet } from '@angular/router';
import { MatTabNav, MatTabLink, MatTabNavPanel } from '@angular/material/tabs';
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
@@ -21,6 +21,8 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
]
})
export class ViewOfficeComponent {
private route = inject(ActivatedRoute);
/** Office datatables data */
officeDatatables: any;
@@ -28,7 +30,7 @@ export class ViewOfficeComponent {
* Fetches office datatables from `resolve`
* @param {ActivatedRoute} route Activated Route
*/
constructor(private route: ActivatedRoute) {
constructor() {
this.route.data.subscribe((data: { officeDatatables: any }) => {
this.officeDatatables = data.officeDatatables;
});