diff --git a/.eslintrc.json b/.eslintrc.json index 29db15082..6fbc9e423 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -8,13 +8,6 @@ "files": [ "*.ts" ], - "parserOptions": { - "project": [ - "tsconfig.json", - "e2e/tsconfig.json" - ], - "createDefaultProgram": true - }, "extends": [ "plugin:@angular-eslint/recommended", "plugin:@angular-eslint/template/process-inline-templates" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9fceb0aca..a740a4355 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,17 +9,17 @@ jobs: strategy: matrix: - node-version: [14.x, 16.x] + node-version: [18.x, 20.x] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - name: install package run: | - npm install -g @angular/cli@14 + npm install -g @angular/cli@17 npm ci - name: run tests run: | diff --git a/angular.json b/angular.json index 6d36290ac..a48e31676 100644 --- a/angular.json +++ b/angular.json @@ -157,7 +157,6 @@ "main": "projects/public-holdings-items/src/main.ts", "polyfills": "projects/public-holdings-items/src/polyfills.ts", "tsConfig": "projects/public-holdings-items/tsconfig.app.json", - "aot": true, "assets": [ { "glob": "**/*.json", @@ -171,6 +170,11 @@ } ], "styles": [ + "node_modules/primeng/resources/themes/lara-light-blue/theme.css", + "node_modules/primeng/resources/primeng.min.css", + "node_modules/primeicons/primeicons.css", + "node_modules/primeflex/primeflex.min.css", + "node_modules/ngx-spinner/animations/ball-zig-zag.css", "projects/public-search/src/app/scss/styles.scss", "projects/shared/src/scss/styles.scss" ], @@ -188,7 +192,6 @@ "outputHashing": "all", "sourceMap": false, "namedChunks": false, - "aot": true, "extractLicenses": true, "vendorChunk": false, "buildOptimizer": true, @@ -368,8 +371,8 @@ "builder": "@angular-eslint/builder:lint", "options": { "lintFilePatterns": [ - "projects/public-search/src/**/*.ts", - "projects/public-search/src/**/*.html" + "projects/public-search/**/*.ts", + "projects/public-search/**/*.html" ] } } @@ -391,7 +394,6 @@ "main": "projects/search-bar/src/main.ts", "polyfills": "projects/search-bar/src/polyfills.ts", "tsConfig": "projects/search-bar/tsconfig.app.json", - "aot": true, "assets": [ { "glob": "**/*.json", @@ -419,7 +421,6 @@ "outputHashing": "all", "sourceMap": false, "namedChunks": false, - "aot": true, "extractLicenses": true, "vendorChunk": false, "buildOptimizer": true, @@ -646,7 +647,6 @@ "main": "projects/public-user-profile-edit/src/main.ts", "polyfills": "projects/public-user-profile-edit/src/polyfills.ts", "tsConfig": "projects/public-user-profile-edit/tsconfig.app.json", - "aot": true, "assets": [ { "glob": "**/*.json", @@ -755,7 +755,6 @@ "main": "projects/public-user-password-change/src/main.ts", "polyfills": "projects/public-user-password-change/src/polyfills.ts", "tsConfig": "projects/public-user-password-change/tsconfig.app.json", - "aot": true, "assets": [ { "glob": "**/*.json", @@ -848,5 +847,10 @@ } } } + }, + "cli": { + "schematicCollections": [ + "@angular-eslint/schematics" + ] } } diff --git a/projects/admin/.eslintrc.json b/projects/admin/.eslintrc.json index f9a22fa0d..06595c7d7 100644 --- a/projects/admin/.eslintrc.json +++ b/projects/admin/.eslintrc.json @@ -8,12 +8,6 @@ "files": [ "*.ts" ], - "parserOptions": { - "project": [ - "projects/admin/tsconfig.eslint.json" - ], - "createDefaultProgram": false - }, "rules": { "@angular-eslint/directive-selector": [ "error", diff --git a/projects/admin/e2e/tsconfig.json b/projects/admin/e2e/tsconfig.json index 3d809e80f..9872ecac3 100644 --- a/projects/admin/e2e/tsconfig.json +++ b/projects/admin/e2e/tsconfig.json @@ -3,7 +3,7 @@ "compilerOptions": { "outDir": "../../../out-tsc/e2e", "module": "commonjs", - "target": "es2018", + "target": "es2022", "types": [ "jasmine", "jasminewd2", diff --git a/projects/admin/src/app/acquisition/components/account/account-brief-view/account-brief-view.component.html b/projects/admin/src/app/acquisition/components/account/account-brief-view/account-brief-view.component.html index 2a31b2f21..40a4a6050 100644 --- a/projects/admin/src/app/acquisition/components/account/account-brief-view/account-brief-view.component.html +++ b/projects/admin/src/app/acquisition/components/account/account-brief-view/account-brief-view.component.html @@ -1,6 +1,6 @@ -
- -
- {{ account.name }} -
-
- [{{ account.number }}] -
- -
- {{ account.allocated_amount | currency: organisation.default_currency }} -
- +@defer (when account && permissions) { + - - - - - +} @placeholder { - +} + +@for (childAccount of children; track childAccount) { + +} diff --git a/projects/admin/src/app/acquisition/components/account/account-brief-view/account-brief-view.component.ts b/projects/admin/src/app/acquisition/components/account/account-brief-view/account-brief-view.component.ts index 5fcd063be..1483f293f 100644 --- a/projects/admin/src/app/acquisition/components/account/account-brief-view/account-brief-view.component.ts +++ b/projects/admin/src/app/acquisition/components/account/account-brief-view/account-brief-view.component.ts @@ -1,6 +1,6 @@ /* * RERO ILS UI - * Copyright (C) 2021 RERO + * Copyright (C) 2021-2024 RERO * Copyright (C) 2021 UCLouvain * * This program is free software: you can redistribute it and/or modify @@ -50,7 +50,7 @@ export class AccountBriefViewComponent implements OnInit { // GETTER & SETTER ============================================================ /** Get the current budget pid for the organisation */ get organisation(): any { - return this._organisationService.organisation; + return this.organisationService.organisation; } /** Get the URL to access detail view for this account */ @@ -63,39 +63,39 @@ export class AccountBriefViewComponent implements OnInit { * @return the message to display into the tooltip box */ get deleteInfoMessage(): string { - return this._recordPermissionService.generateDeleteMessage(this.permissions.delete.reasons); + return this.recordPermissionService.generateDeleteMessage(this.permissions.delete.reasons); } // CONSTRUCTOR & HOOKS ======================================================== /** * Constructor - * @param _recordPermissionService - RecordPermissionService - * @param _organisationService - OrganisationService - * @param _accountApiService - AcqAccountApiService - * @param _toastrService - ToastrService - * @param _translateService - TranslateService - * @param _userService - UserService + * @param recordPermissionService - RecordPermissionService + * @param organisationService - OrganisationService + * @param accountApiService - AcqAccountApiService + * @param toastrService - ToastrService + * @param translateService - TranslateService + * @param userService - UserService */ constructor( - private _recordPermissionService: RecordPermissionService, - private _organisationService: OrganisationService, - private _accountApiService: AcqAccountApiService, - private _toastrService: ToastrService, - private _translateService: TranslateService, - private _userService: UserService + private recordPermissionService: RecordPermissionService, + private organisationService: OrganisationService, + private accountApiService: AcqAccountApiService, + private toastrService: ToastrService, + private translateService: TranslateService, + private userService: UserService ) { } /** OnInit hook */ ngOnInit(): void { if (this.account) { // load account permissions - this._recordPermissionService + this.recordPermissionService .getPermission('acq_accounts', this.account.pid) .subscribe((data: RecordPermissions) => this.permissions = data); // load children accounts if (this.loadChildren) { - const libraryPid = this._userService.user.currentLibrary; - this._accountApiService + const libraryPid = this.userService.user.currentLibrary; + this.accountApiService .getAccounts(libraryPid, this.account.pid) .subscribe(accounts => this.children = accounts); } @@ -105,10 +105,10 @@ export class AccountBriefViewComponent implements OnInit { // COMPONENT FUNCTIONS ======================================================== /** Delete the account */ delete() { - this._accountApiService + this.accountApiService .delete(this.account.pid) .subscribe(() => { - this._toastrService.success(this._translateService.instant('Account deleted')); + this.toastrService.success(this.translateService.instant('Account deleted')); this.deleteAccount.emit(this.account); }); } @@ -117,5 +117,4 @@ export class AccountBriefViewComponent implements OnInit { accountDeleted(account: IAcqAccount): void { this.children = this.children.filter(item => item.pid !== account.pid); } - } diff --git a/projects/admin/src/app/acquisition/components/account/account-detail-view/account-detail-view.component.html b/projects/admin/src/app/acquisition/components/account/account-detail-view/account-detail-view.component.html index 7980078e9..5245cadff 100644 --- a/projects/admin/src/app/acquisition/components/account/account-detail-view/account-detail-view.component.html +++ b/projects/admin/src/app/acquisition/components/account/account-detail-view/account-detail-view.component.html @@ -1,6 +1,6 @@ - +@if (organisation && esRecord$ | async; as account) { -
Fiscal year closed
+ @if (!account.is_active) { +
Fiscal year closed
+ }

{{ account.name }}

- +
Details
@@ -30,19 +32,19 @@
Details
{{ account.budget.pid | getRecord: 'budgets': 'field': 'name' | async }}
Library
{{ account.library.pid | getRecord: 'libraries': 'field': 'name' | async }}
- + @if (account.parent) {
Parent account
{{ account.parent.pid | getRecord: 'acq_accounts': 'field': 'name' | async }}
-
+ }
- +
Accounting informations
@@ -69,7 +71,7 @@
Accounting informations
- Children + Children {{ account.encumbrance_amount.children | negativeAmount | currency: organisation.default_currency }} @@ -83,7 +85,7 @@
Accounting informations
- Children + Children {{ account.expenditure_amount.children | negativeAmount | currency: organisation.default_currency }} @@ -115,4 +117,4 @@
Accounting informations
-
+} diff --git a/projects/admin/src/app/acquisition/components/account/account-detail-view/account-detail-view.component.ts b/projects/admin/src/app/acquisition/components/account/account-detail-view/account-detail-view.component.ts index 2cf3fd188..59dcd5f38 100644 --- a/projects/admin/src/app/acquisition/components/account/account-detail-view/account-detail-view.component.ts +++ b/projects/admin/src/app/acquisition/components/account/account-detail-view/account-detail-view.component.ts @@ -1,6 +1,6 @@ /* * RERO ILS UI - * Copyright (C) 2021 RERO + * Copyright (C) 2021-2024 RERO * Copyright (C) 2021 UCLouvain * * This program is free software: you can redistribute it and/or modify @@ -17,13 +17,11 @@ */ import { Component, OnInit } from '@angular/core'; -import { Record } from '@rero/ng-core'; import { DetailRecord } from '@rero/ng-core/lib/record/detail/view/detail-record'; import { Observable } from 'rxjs'; -import { map } from 'rxjs/operators'; +import { OrganisationService } from '../../../../service/organisation.service'; import { AcqAccountApiService } from '../../../api/acq-account-api.service'; import { IAcqAccount } from '../../../classes/account'; -import { OrganisationService } from '../../../../service/organisation.service'; @Component({ selector: 'admin-acquisition-account-detail-view', @@ -43,24 +41,24 @@ export class AccountDetailViewComponent implements OnInit, DetailRecord { // GETTER & SETTER ============================================================ /** Get the current budget pid for the organisation */ get organisation(): any { - return this._organisationService.organisation; + return this.organisationService.organisation; } // CONSTRUCTOR & HOOKS ======================================================== /** * Constructor - * @param _acqAccountApiService - AcqAccountApiService - * @param _organisationService - OrganisationService + * @param acqAccountApiService - AcqAccountApiService + * @param organisationService - OrganisationService */ constructor( - private _acqAccountApiService: AcqAccountApiService, - private _organisationService: OrganisationService + private acqAccountApiService: AcqAccountApiService, + private organisationService: OrganisationService ) { } /** OnInit hook */ ngOnInit(): void { this.record$.subscribe((data: any) => { - this.esRecord$ = this._acqAccountApiService.getAccount(data.metadata.pid); + this.esRecord$ = this.acqAccountApiService.getAccount(data.metadata.pid); }); } diff --git a/projects/admin/src/app/acquisition/components/account/account-list/account-list.component.html b/projects/admin/src/app/acquisition/components/account/account-list/account-list.component.html index 698393be9..7b79144a2 100644 --- a/projects/admin/src/app/acquisition/components/account/account-list/account-list.component.html +++ b/projects/admin/src/app/acquisition/components/account/account-list/account-list.component.html @@ -1,6 +1,6 @@ - +@if (organisation) {

Acquisition accounts

{{ 'Add' | translate }} @@ -36,8 +36,8 @@

Acquisition accounts

{{ 'Transfer funds' | translate }} … @@ -54,15 +54,17 @@

Acquisition accounts

Expenditure
Balance
-
- 0) { + @for (account of rootAccounts; track account) { + - -
- {{ 'No account available' | translate }} + > + } + } @else { + {{ 'No account available' | translate }} + } - +} + diff --git a/projects/admin/src/app/acquisition/components/account/account-list/account-list.component.ts b/projects/admin/src/app/acquisition/components/account/account-list/account-list.component.ts index 69827abc1..404f262ba 100644 --- a/projects/admin/src/app/acquisition/components/account/account-list/account-list.component.ts +++ b/projects/admin/src/app/acquisition/components/account/account-list/account-list.component.ts @@ -1,6 +1,6 @@ /* * RERO ILS UI - * Copyright (C) 2022 RERO + * Copyright (C) 2022-2024 RERO * Copyright (C) 2022 UCLouvain * * This program is free software: you can redistribute it and/or modify @@ -53,14 +53,14 @@ export class AccountListComponent implements OnInit { // GETTER & SETTER ============================================================ /** Get the current organisation */ get organisation(): any { - return this._organisationService.organisation; + return this.organisationService.organisation; } /** Get a message containing the reasons why record list cannot be exported */ get exportInfoMessage(): string { return (this.rootAccounts.length === 0) - ? this._translateService.instant('Result list is empty.') - : this._translateService.instant('Too many items. Should be less than {{max}}.', + ? this.translateService.instant('Result list is empty.') + : this.translateService.instant('Too many items. Should be less than {{max}}.', { max: RecordService.MAX_REST_RESULTS_SIZE } ); } @@ -68,24 +68,24 @@ export class AccountListComponent implements OnInit { // CONSTRUCTOR & HOOKS ======================================================== /** * Constructor - * @param _userService: UserService - * @param _acqAccountApiService: AcqAccountApiService - * @param _organisationService: OrganisationService - * @param _apiService: ApiService - * @param _translateService: TranslateService + * @param userService: UserService + * @param acqAccountApiService: AcqAccountApiService + * @param organisationService: OrganisationService + * @param apiService: ApiService + * @param translateService: TranslateService */ constructor( - private _userService: UserService, - private _acqAccountApiService: AcqAccountApiService, - private _organisationService: OrganisationService, - private _apiService: ApiService, - private _translateService: TranslateService, + private userService: UserService, + private acqAccountApiService: AcqAccountApiService, + private organisationService: OrganisationService, + private apiService: ApiService, + private translateService: TranslateService, ) { } /** OnInit hook */ ngOnInit(): void { - this._libraryPid = this._userService.user.currentLibrary; - this._acqAccountApiService.getAccounts(this._libraryPid, null).subscribe( + this._libraryPid = this.userService.user.currentLibrary; + this.acqAccountApiService.getAccounts(this._libraryPid, null).subscribe( accounts => { this.rootAccounts = accounts; this.exportOptions = this._exportFormats(); @@ -126,9 +126,7 @@ export class AccountListComponent implements OnInit { `library.pid:${this._libraryPid}` ]; const query = defaultQueryParams.join(' AND '); - const baseUrl = format.endpoint - ? format.endpoint - : this._apiService.getExportEndpointByType('acq_accounts'); + const baseUrl = format.endpoint || this.apiService.getExportEndpointByType('acq_accounts'); const params = new HttpParams() .set('q', query) .set('format', format.format); @@ -147,6 +145,6 @@ export class AccountListComponent implements OnInit { const totalResults = this.rootAccounts.length; return (format.hasOwnProperty('disableMaxRestResultsSize') && format.disableMaxRestResultsSize) ? totalResults > 0 - : 0 < totalResults && totalResults < RecordService.MAX_REST_RESULTS_SIZE; + : totalResults > 0 && totalResults < RecordService.MAX_REST_RESULTS_SIZE; } } diff --git a/projects/admin/src/app/acquisition/components/account/account-transfer/account-transfer.component.html b/projects/admin/src/app/acquisition/components/account/account-transfer/account-transfer.component.html index 419e05d0e..c85c79d6d 100644 --- a/projects/admin/src/app/acquisition/components/account/account-transfer/account-transfer.component.html +++ b/projects/admin/src/app/acquisition/components/account/account-transfer/account-transfer.component.html @@ -1,6 +1,6 @@ -
-

Fund transfer

-
- -
-
-
Source
-
-
Amount
-
Available
-
Target
-
-
- -