diff --git a/projects/admin/src/app/acquisition/acquisition-routing.module.ts b/projects/admin/src/app/acquisition/acquisition-routing.module.ts index 6fecdb0aa..6a9f32203 100644 --- a/projects/admin/src/app/acquisition/acquisition-routing.module.ts +++ b/projects/admin/src/app/acquisition/acquisition-routing.module.ts @@ -24,16 +24,33 @@ import { AccountListComponent } from './components/account/account-list/account- import { AccountTransferComponent } from './components/account/account-transfer/account-transfer.component'; import { OrderReceiptViewComponent } from './components/receipt/receipt-form/order-receipt-view.component'; import { CanOrderReceiptGuard } from './routes/guards/can-order-receipt.guard'; +import { AcquisitionMainComponent } from './components/acquisition-main/acquisition-main.component'; const routes: Routes = [ - { path: '', redirectTo: 'accounts', pathMatch: 'full' }, - { path: 'accounts/transfer', component: AccountTransferComponent, canActivate: [ PermissionGuard ], data: { permissions: [ PERMISSIONS.ACAC_TRANSFER ] } }, - { path: 'accounts', component: AccountListComponent, canActivate: [ PermissionGuard ], data: { permissions: [ PERMISSIONS.ACAC_ACCESS, PERMISSIONS.ACAC_SEARCH ], operator: PERMISSION_OPERATOR.AND } }, - { path: 'acq_orders/:pid/receive', component: OrderReceiptViewComponent, canActivate: [ CanOrderReceiptGuard ] } + { + path: '', + component: AcquisitionMainComponent, + children: [ + { path: '', redirectTo: 'accounts', pathMatch: 'full' }, + { + path: 'accounts/transfer', + component: AccountTransferComponent, + canActivate: [PermissionGuard], + data: { permissions: [PERMISSIONS.ACAC_TRANSFER] }, + }, + { + path: 'accounts', + component: AccountListComponent, + canActivate: [PermissionGuard], + data: { permissions: [PERMISSIONS.ACAC_ACCESS, PERMISSIONS.ACAC_SEARCH], operator: PERMISSION_OPERATOR.AND }, + }, + { path: 'acq_orders/:pid/receive', component: OrderReceiptViewComponent, canActivate: [CanOrderReceiptGuard] }, + ], + }, ]; @NgModule({ imports: [RouterModule.forChild(routes)], - exports: [RouterModule] + exports: [RouterModule], }) -export class AcquisitionRoutingModule { } +export class AcquisitionRoutingModule {} diff --git a/projects/admin/src/app/acquisition/acquisition.module.ts b/projects/admin/src/app/acquisition/acquisition.module.ts index 48c1ef238..c79955325 100644 --- a/projects/admin/src/app/acquisition/acquisition.module.ts +++ b/projects/admin/src/app/acquisition/acquisition.module.ts @@ -28,7 +28,6 @@ import { PreviewEmailModule } from '../shared/preview-email/preview-email.module import { AcquisitionRoutingModule } from './acquisition-routing.module'; import { AcqAccountApiService } from './api/acq-account-api.service'; import { AcqOrderApiService } from './api/acq-order-api.service'; -import { AccountBriefViewComponent } from './components/account/account-brief-view/account-brief-view.component'; import { AccountDetailViewComponent } from './components/account/account-detail-view/account-detail-view.component'; import { AccountListComponent } from './components/account/account-list/account-list.component'; import { AccountTransferComponent } from './components/account/account-transfer/account-transfer.component'; @@ -57,14 +56,13 @@ import { NoteBadgeColorPipe } from './pipes/note-badge-color.pipe'; import { PreviewContentPipe } from './pipes/preview-content.pipe'; import { ReceiptLineTotalAmountPipe } from './pipes/receipt-line-total-amount.pipe'; import { ReceptionDatesPipe } from './pipes/reception-dates.pipe'; -import { ChipsModule } from 'primeng/chips'; import { PrimengImportModule } from '../shared/primeng-import/primeng-import.module'; import { NotesComponent } from './components/notes/notes.component'; +import { AcquisitionMainComponent } from './components/acquisition-main/acquisition-main.component'; @NgModule({ declarations: [ AccountListComponent, - AccountBriefViewComponent, AccountTransferComponent, AccountDetailViewComponent, BudgetsBriefViewComponent, @@ -89,7 +87,8 @@ import { NotesComponent } from './components/notes/notes.component'; PreviewContentPipe, ReceiptLineTotalAmountPipe, OrderEmailFormComponent, - NotesComponent + NotesComponent, + AcquisitionMainComponent ], imports: [ CommonModule, diff --git a/projects/admin/src/app/acquisition/acquisition.scss b/projects/admin/src/app/acquisition/acquisition.scss deleted file mode 100644 index 256beaf66..000000000 --- a/projects/admin/src/app/acquisition/acquisition.scss +++ /dev/null @@ -1,138 +0,0 @@ -/* - * RERO ILS UI - * Copyright (C) 2021-2023 RERO - * Copyright (C) 2021-2023 UCLouvain - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, version 3 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -@import 'bootstrap/scss/functions'; -@import 'bootstrap/scss/variables'; -@import '../scss/variables'; -// @import "primeflex/primeflex"; -// @import "@rero/ng-core/assets/scss/ng-core"; - -.account { - - $DEPTH-PADDING: 50px; - $MAX-DEPTH: 10; - - // @extend .mb-1; - - - &:hover{ - background-color: #F8F8F8; - } - .account-name { - font-weight: bold; - } - .account-number { - text-transform: uppercase; - font-size: .9rem; - } - .amount { - text-align: right; - } - - @for $level from 1 to $MAX-DEPTH { - .depth-padding-#{$level} { - padding-left: calc(#{$DEPTH-PADDING} * #{$level}); - } - } -} - -// receipt =================================================================== -// Use these classes to manage receipt resources -// =========================================================================== -.receipt { - .account-number { - // @extend .text-sm; - color: $secondary; - font-weight: bold; - &:before { - content: '['; - } - &:after { - content: ']'; - } - } -} - -// REMOVE GUTTER ============================================================== -// Some DOM element has gutter to to bootstrap grid system. Using the -// following classes we can remove this gutters. -// ============================================================================ -$gutter: calc($grid-gutter-width / 2); -.no-gutter { - margin-right: -$gutter; - margin-left: -$gutter; -} - - -// BULLET NOTES =============================================================== -// Use this property to display a small bullet circle indicating that a -// resource has a related note. Each note type can define a color corresponding -// to default bootstrap color or any color defined into the `@each` css rule -// ============================================================================ -.bullet-notes { - margin-left: map-get($spacers, 2); - - .fa-bullet { - font-size: 0.75rem; - margin-left: map-get($spacers, 1); - - @each $name,$color in (primary,$primary),(success,$success),(danger,$danger),(warning,$warning),(info,$info), (dark,$dark) { - &.bullet-#{$name} { - color: $color; - } - } - } -} - -// PRIORITY TRIANGLE ========================================================== -// Use this property to display a colored triangle representing a -// priority level. The color is from green (priority=1) to red (priority=5) -// ============================================================================ -.priority { - background-repeat: no-repeat; - background-position: center center; - height: 16px; - width: 16px; - - &.priority-1 { - background-image: url(data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjIiIGJhc2VQcm9maWxlPSJ0aW55LXBzIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNCIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE0Ij4KCTx0aXRsZT5Ob3V2ZWF1IHByb2pldDwvdGl0bGU+Cgk8ZGVmcz4KCQk8aW1hZ2UgIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNCIgaWQ9ImltZzEiIGhyZWY9ImRhdGE6aW1hZ2UvcG5nO2Jhc2U2NCxpVkJPUncwS0dnb0FBQUFOU1VoRVVnQUFBQkFBQUFBT0NBTUFBQUFSOFd5NEFBQUFBWE5TUjBJQjJja3Nmd0FBQUlSUVRGUkZBQUFBbjlCUm04MU9tODFNb2M5Vm1jdExtczFMbTg1TW1zMUxtczFMbXMxTG04NU5tczVNbTg1TW04NU5tczFMbTgxTW04NU1tczVNbk01T21zMU1uTTFNbnRCU204NU1tc3hMbjgxUm04NU5tODFObmM1T21zMUxtczFNbmRCUG04NU1tODVObTg1TW1zMUxtczFNbk01Tm1zNU1tODVNbTg1TW04MU1tODVNbTgxTWIvSzVpd0FBQUN4MFVrNVRBQVBGd3dKcC8yUU84dThNbUpNby9DUEN2MHYvU1FYaDRBVjBjeEwwOUJHZ25DdisvU25JdytELy85bWszUUZiQUFBQWFrbEVRVlI0bkZYSVZ3S0NNQkJGMFVIeG9RaUVJa1dhaGE3NzN4OHdpUkR2ejh3N1JKeHhPSnFrZHdJc2ZaOHZnSDNWd01HU3UyOVByQ0Q4RFFKdzRXOUh3STBsbGp0Sm9jcnVERG0yaW5XWDFRNzFZNEVudEY1RTc0WS9JYUh0cU1kZkE0MThwNCtDN3d6dWF3WXZJSHIrSndBQUFBQkpSVTVFcmtKZ2dnPT0iLz4KCTwvZGVmcz4KCTxz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IgeT0iMCIgLz4KCTxwYXRoIGlkPSI1IiBmaWxsPSIjZmZmZmZmIiBhcmlhLWxhYmVsPSI1IiAgZD0iTTUuNTggOC44TDUuNTggNC42OEwxMC4zMyA0LjY4TDEwLjMzIDYuMDZMNy4xIDYuMDZMNy4xIDcuMlE3LjMyIDcuMTQgNy41NCA3LjExUTcuNzYgNy4wNyA4IDcuMDdROS4zNSA3LjA3IDEwLjExIDcuNzVRMTAuODYgOC40MSAxMC44NiA5LjYxUTEwLjg2IDEwLjggMTAuMDQgMTEuNDdROS4yMiAxMi4xNCA3Ljc2IDEyLjE0UTcuMTMgMTIuMTQgNi41MSAxMi4wMlE1Ljg5IDExLjkgNS4yOCAxMS42Nkw1LjI4IDEwLjE3UTUuODkgMTAuNTEgNi40MyAxMC42OVE2Ljk4IDEwLjg2IDcuNDYgMTAuODZROC4xNSAxMC44NiA4LjU1IDEwLjUyUTguOTUgMTAuMTggOC45NSA5LjYxUTguOTUgOS4wMyA4LjU1IDguN1E4LjE1IDguMzYgNy40NiA4LjM2UTcuMDUgOC4zNiA2LjU4IDguNDdRNi4xMSA4LjU4IDUuNTggOC44WiIgLz4KPC9zdmc+) - } -} - - -// ROLLOVER =================================================================== -// Use these classes to manage rollovered resources -// ============================================================================ -.rollovered { - & > *:not(.fiscal-year-closed) { - opacity: 0.5; - } -} - diff --git a/projects/admin/src/app/acquisition/api/acq-account-api.service.ts b/projects/admin/src/app/acquisition/api/acq-account-api.service.ts index fd9179f99..35ac24345 100644 --- a/projects/admin/src/app/acquisition/api/acq-account-api.service.ts +++ b/projects/admin/src/app/acquisition/api/acq-account-api.service.ts @@ -96,7 +96,7 @@ export class AcqAccountApiService { const query = defaultQueryParams.join(' AND '); options = { ...{sort: 'name'}, ...options }; // add some default params return this.recordService - .getRecords(this.resourceName, query, 1, RecordService.MAX_REST_RESULTS_SIZE, undefined, undefined, undefined, options.sort) + .getRecords(this.resourceName, query, 1, RecordService.MAX_REST_RESULTS_SIZE, undefined, undefined, {'Accept': 'application/rero+json'}, options.sort) .pipe( map((result: Record) => this.recordService.totalHits(result.hits.total) === 0 ? [] : result.hits.hits), map((hits: any[]) => hits.map(hit => ({...this.accountDefaultData, ...hit.metadata}) )) diff --git a/projects/admin/src/app/acquisition/classes/account.ts b/projects/admin/src/app/acquisition/classes/account.ts index 50b931b69..a54c57e18 100644 --- a/projects/admin/src/app/acquisition/classes/account.ts +++ b/projects/admin/src/app/acquisition/classes/account.ts @@ -49,4 +49,5 @@ export interface IAcqAccount extends IAcqBaseResource { distribution: number; budget: IObjectReference; parent: IObjectReference; + number_of_children?: number; } 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 deleted file mode 100644 index 3eb188706..000000000 --- a/projects/admin/src/app/acquisition/components/account/account-brief-view/account-brief-view.component.html +++ /dev/null @@ -1,97 +0,0 @@ - -@defer (when account && permissions) { -
- - - - -
- {{ account.allocated_amount | currency: organisation.default_currency }} -
- -
- {{ available_amount | currency: organisation.default_currency }} -
-
-
- {{ account.encumbrance_amount.self | currency: organisation.default_currency }} -
-
- {{ account.expenditure_amount.self | currency: organisation.default_currency}} -
-
- {{ account.remaining_balance.self | currency: organisation.default_currency }} -
- -
- @if (permissions.update.can) { - - } - @if (permissions.delete.can) { - - } @else { - - - - - } -
-
-} @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 deleted file mode 100644 index 178465629..000000000 --- a/projects/admin/src/app/acquisition/components/account/account-brief-view/account-brief-view.component.ts +++ /dev/null @@ -1,114 +0,0 @@ -/* - * RERO ILS UI - * Copyright (C) 2021-2024 RERO - * Copyright (C) 2021 UCLouvain - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, version 3 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -import { Component, EventEmitter, inject, Input, OnInit, Output } from '@angular/core'; -import { RecordPermissions } from '@app/admin/classes/permissions'; -import { OrganisationService } from '@app/admin/service/organisation.service'; -import { RecordPermissionService } from '@app/admin/service/record-permission.service'; -import { TranslateService } from '@ngx-translate/core'; -import { CONFIG } from '@rero/ng-core'; -import { UserService } from '@rero/shared'; -import { MessageService } from 'primeng/api'; -import { AcqAccountApiService } from '../../../api/acq-account-api.service'; -import { IAcqAccount } from '../../../classes/account'; - -@Component({ - selector: 'admin-account-brief-view', - templateUrl: './account-brief-view.component.html', - styleUrls: ['../../../acquisition.scss'] -}) -export class AccountBriefViewComponent implements OnInit { - - private recordPermissionService: RecordPermissionService = inject(RecordPermissionService); - private organisationService: OrganisationService = inject(OrganisationService); - private accountApiService: AcqAccountApiService = inject(AcqAccountApiService); - private translateService: TranslateService = inject(TranslateService); - private userService: UserService = inject(UserService); - private messageService = inject(MessageService); - - // COMPONENT ATTRIBUTES ======================================================== - /** the account to display */ - @Input() account: IAcqAccount = null; - /** does we need to load and display the children accounts */ - @Input() loadChildren = false; - /** event emit when the account is deleted */ - @Output() deleteAccount = new EventEmitter(); - - /** permission about the record */ - permissions: any; - /** children accounts */ - children: IAcqAccount[] = []; - - - // GETTER & SETTER ============================================================ - /** Get the current budget pid for the organisation */ - get organisation(): any { - return this.organisationService.organisation; - } - - /** Get the URL to access detail view for this account */ - get detailUrl(): string { - return `/records/acq_accounts/detail/${this.account.pid}`; - } - - /** - * Return a message containing the reasons why the item cannot be requested - * @return the message to display into the tooltip box - */ - get deleteInfoMessage(): string { - return this.recordPermissionService.generateDeleteMessage(this.permissions.delete.reasons); - } - - /** OnInit hook */ - ngOnInit(): void { - if (this.account) { - // load account permissions - 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 - .getAccounts(libraryPid, this.account.pid) - .subscribe(accounts => this.children = accounts); - } - } - } - - // COMPONENT FUNCTIONS ======================================================== - /** Delete the account */ - delete() { - this.accountApiService - .delete(this.account.pid) - .subscribe(() => { - this.messageService.add({ - severity: 'success', - summary: this.translateService.instant('Account'), - detail: this.translateService.instant('Account deleted'), - life: CONFIG.MESSAGE_LIFE - }); - this.deleteAccount.emit(this.account); - }); - } - - /** Operations to do when an account is deleted */ - 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 a104e2290..27f92db0c 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 @@ -17,98 +17,105 @@ --> @if (organisation && esRecord$ | async; as account) { - @if (!account.is_active) { -
Fiscal year closed
+ @if (account.is_active) { + } -

{{ account.name }}

+

{{ account.name }}

- -
-
Account number
-
{{ account.number }}
-
Budget
-
{{ account.budget.pid | getRecord: 'budgets': 'field': 'name' | async }}
-
Library
-
{{ account.library.pid | getRecord: 'libraries': 'field': 'name' | async }}
+
+ + - + - - + +
- - - + + - - + - - - + + - - - + + - - - + + - - - + + - - - + - - - + + - - - + +
Allocated amount +
Allocated amount {{ account.allocated_amount | currency: organisation.default_currency }}
Distribution + Distribution {{ account.distribution | negativeAmount | currency: organisation.default_currency }}
Current encumbranceSelf + Current encumbranceSelf {{ account.encumbrance_amount.self | negativeAmount | currency: organisation.default_currency }}
Children + Children {{ account.encumbrance_amount.children | negativeAmount | currency: organisation.default_currency }}
Current expenditureSelf + Current expenditureSelf {{ account.expenditure_amount.self | negativeAmount | currency: organisation.default_currency }}
Children + Children {{ account.expenditure_amount.children | negativeAmount | currency: organisation.default_currency }}
Balance + Balance {{ account.remaining_balance.self | currency: organisation.default_currency }}
Allowed encumbrance exceedance{{ account.encumbrance_exceedance.value }}% + Allowed encumbrance exceedance{{ account.encumbrance_exceedance.value }}% {{ account.encumbrance_exceedance.amount | currency: organisation.default_currency }}
Allowed expenditure exceedance{{ account.expenditure_exceedance.value }}% + Allowed expenditure exceedance{{ account.expenditure_exceedance.value }}% {{ account.expenditure_exceedance.amount | currency: organisation.default_currency }}
-
+ +
} diff --git a/projects/admin/src/app/acquisition/components/account/account-detail-view/account-detail-view.component.scss b/projects/admin/src/app/acquisition/components/account/account-detail-view/account-detail-view.component.scss index 21957f748..f29f058c5 100644 --- a/projects/admin/src/app/acquisition/components/account/account-detail-view/account-detail-view.component.scss +++ b/projects/admin/src/app/acquisition/components/account/account-detail-view/account-detail-view.component.scss @@ -16,53 +16,8 @@ * along with this program. If not, see . */ -@import 'bootstrap/scss/functions'; -@import 'bootstrap/scss/variables'; -@import '../../../../scss/variables'; - -.accounting-infos { - - .card-body { - padding: 0; - } - - .table { - margin-bottom: 0; - - th, td { - border-top: none; - } - tr *:first-child { - padding-left: map-get($spacers, 5); - } - tr *:last-child { - padding-right: map-get($spacers, 3); - } - tr:first-child * { - padding-top: map-get($spacers, 4); - } - tr:last-child * { - padding-bottom: map-get($spacers, 4); - } - - .percentage { - text-align: center !important; - } - - .amount { - font-family: Arial; - text-align: right; - border-left: $border-width solid $border-color; - flex: 0 0 15%; - max-width: 15%; - } - - .result { - border-top: $border-width solid $border-color; - border-bottom: $border-width solid $border-color; - background-color: $light; - } - +admin-acquisition-account-detail-view { +table td { + @extend .px-2, .py-1; } - } 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 39cc44c86..01b555a4e 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 @@ -25,8 +25,7 @@ import { IAcqAccount } from '../../../classes/account'; @Component({ selector: 'admin-acquisition-account-detail-view', - templateUrl: './account-detail-view.component.html', - styleUrls: ['./account-detail-view.component.scss'] + templateUrl: './account-detail-view.component.html' }) export class AccountDetailViewComponent implements OnInit, DetailRecord { 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 eceebe532..e7e650ce0 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 @@ -16,9 +16,9 @@ along with this program. If not, see . --> @if (organisation) { -
+

Acquisition accounts

-
+
Acquisition accounts
-
-
-
-
Amount
-
Available
-
Engagement
-
Expenditure
-
Balance
-
+
@if (rootAccounts.length > 0) { - @for (account of rootAccounts; track account) { - - } + + + + Name + Amount + Available + Engagement + Expenditure + Balance + + + + + + + + {{ rowData.name }} + + + {{ rowData.allocated_amount | currency: organisation.default_currency }} + + + + + {{ available_amount | currency: organisation.default_currency }} + + + + + {{ rowData.encumbrance_amount.self | currency: organisation.default_currency }} + + + {{ rowData.expenditure_amount.self | currency: organisation.default_currency}} + + + {{ rowData.remaining_balance.self | currency: organisation.default_currency }} + + +
+ + @if (rowData.permissions && rowData.permissions?.update && rowData?.permissions?.update?.can) { + + } + + + + + +
+ + +
+ +
+ } @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 a62d350f3..fb1b6821f 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 @@ -19,11 +19,15 @@ import { HttpParams } from '@angular/common/http'; import { Component, inject, OnInit } from '@angular/core'; import { AcqAccountApiService } from '@app/admin/acquisition/api/acq-account-api.service'; import { IAcqAccount } from '@app/admin/acquisition/classes/account'; +import { CONFIG } from '@rero/ng-core'; import { exportFormats } from '@app/admin/acquisition/routes/accounts-route'; import { OrganisationService } from '@app/admin/service/organisation.service'; +import { RecordPermissionService } from '@app/admin/service/record-permission.service'; import { TranslateService } from '@ngx-translate/core'; import { ApiService, RecordService } from '@rero/ng-core'; import { IPermissions, PERMISSIONS, UserService } from '@rero/shared'; +import { MessageService } from 'primeng/api'; +import { forkJoin, map, switchMap, tap } from 'rxjs'; @Component({ selector: 'admin-account-list', @@ -36,10 +40,12 @@ export class AccountListComponent implements OnInit { private organisationService: OrganisationService = inject(OrganisationService); private apiService: ApiService = inject(ApiService); private translateService: TranslateService = inject(TranslateService); + private recordPermissionService: RecordPermissionService = inject(RecordPermissionService); + private messageService: MessageService = inject(MessageService); // COMPONENT ATTRIBUTES ======================================================= /** Root account to display */ - rootAccounts: IAcqAccount[] = []; + rootAccounts: any[] = []; /** Export options configuration. */ exportOptions: { @@ -74,17 +80,90 @@ export class AccountListComponent implements OnInit { /** OnInit hook */ ngOnInit(): void { this._libraryPid = this.userService.user.currentLibrary; - this.acqAccountApiService.getAccounts(this._libraryPid, null).subscribe( - accounts => { - this.rootAccounts = accounts; + let localAccounts = []; + this.acqAccountApiService.getAccounts(this._libraryPid, null).pipe( + map(accounts => this.processAccount(accounts)), + tap(accounts => localAccounts = accounts), + switchMap(accounts => { + const obs = accounts.map(account => this.recordPermissionService + .getPermission('acq_accounts', account.data.pid)) + return forkJoin(obs); + }), + map((permissions: any) => { + permissions.forEach((permission, i) => { + localAccounts[i].data.permissions = permission; + }); + }) + ).subscribe( + () => { + this.rootAccounts = localAccounts; this.exportOptions = this._exportFormats(); }); } + processAccount(accounts) { + return accounts.map(account => { + return { + data: account, + label: account.name, + leaf: !(account?.number_of_children > 0) + }; + }); + } // COMPONENT FUNCTIONS ======================================================== /** Operations to do when an account is deleted */ - accountDeleted(account: IAcqAccount): void { - this.rootAccounts = this.rootAccounts.filter(item => item.pid !== account.pid); + accountDelete(node): void { + console.log(node); + this.acqAccountApiService + .delete(node.node.data.pid) + .pipe( + tap(() => { + if (node.parent) { + node.parent.children = node.parent.children.filter(account => account.data.pid !== node.node.data.pid); + node.parent.leaf = !(node.parent.children.length > 0); + } else { + this.rootAccounts = this.rootAccounts.filter(account => account.data.pid !== node.node.data.pid); + } + this.rootAccounts = [...this.rootAccounts]; + }) + ) + .subscribe(() => { + this.messageService.add({ + severity: 'success', + summary: this.translateService.instant('Account'), + detail: this.translateService.instant('Account deleted'), + life: CONFIG.MESSAGE_LIFE + }); + }); + } + + deleteInfoMessage(permissions): string { + return this.recordPermissionService.generateDeleteMessage(permissions.delete.reasons); + } + + onNodeExpand(event: any) { + if (!event.node.children) { + let localAccounts = []; + this.acqAccountApiService.getAccounts(this._libraryPid, event.node.data.pid).pipe( + map(accounts => this.processAccount(accounts)), + tap(accounts => localAccounts = accounts), + switchMap(accounts => { + const obs = accounts.map(account => this.recordPermissionService + .getPermission('acq_accounts', account.data.pid)) + return forkJoin(obs); + }), + map((permissions: any) => { + permissions.forEach((permission, i) => { + localAccounts[i].data.permissions = permission; + }); + }) + ).subscribe( + () => { + event.node.children = localAccounts; + this.rootAccounts = [...this.rootAccounts]; + } + ); + } } /** 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 a83e38b00..cc485de51 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 @@ -15,179 +15,139 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . --> + @if (accountsToDisplay && organisation) { -

Fund transfer

-
-
- @if (budgets.length > 1) { - - } -
-
Source
-
-
Amount
-
Available
-
Target
-
-
- @if (accountsToDisplay.length > 0) { - @for (account of accountsToDisplay; track account) { - + + + } diff --git a/projects/admin/src/app/acquisition/components/account/account-transfer/account-transfer.component.ts b/projects/admin/src/app/acquisition/components/account/account-transfer/account-transfer.component.ts index 50bc4c540..720b882ae 100644 --- a/projects/admin/src/app/acquisition/components/account/account-transfer/account-transfer.component.ts +++ b/projects/admin/src/app/acquisition/components/account/account-transfer/account-transfer.component.ts @@ -17,7 +17,7 @@ */ import { getCurrencySymbol } from '@angular/common'; -import { Component, inject, OnInit } from '@angular/core'; +import { Component, inject, OnDestroy, OnInit } from '@angular/core'; import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms'; import { Router } from '@angular/router'; import { OrganisationService } from '@app/admin/service/organisation.service'; @@ -28,14 +28,14 @@ import { MessageService } from 'primeng/api'; import { AcqAccountApiService } from '../../../api/acq-account-api.service'; import { IAcqAccount } from '../../../classes/account'; import { orderAccountsAsTree } from '../../../utils/account'; +import { DropdownChangeEvent } from 'primeng/dropdown'; +import { Subscription } from 'rxjs'; @Component({ selector: 'admin-account-transfer', - templateUrl: './account-transfer.component.html', - styleUrls: ['../../../acquisition.scss'] + templateUrl: './account-transfer.component.html' }) -export class AccountTransferComponent implements OnInit { - +export class AccountTransferComponent implements OnInit, OnDestroy { private acqAccountApiService: AcqAccountApiService = inject(AcqAccountApiService); private organisationService: OrganisationService = inject(OrganisationService); private formBuilder: UntypedFormBuilder = inject(UntypedFormBuilder); @@ -48,14 +48,16 @@ export class AccountTransferComponent implements OnInit { /** the accounts available for transfer */ accountsToDisplay: IAcqAccount[] = []; /** active budgets */ - budgets: string[] = []; + budgets: any[] = []; /** the transfer form group */ form: UntypedFormGroup; /** the accounts available for transfer */ private accountsTree: IAcqAccount[] = []; /** store the selected budgets */ - private selectedBudgetPid: string = undefined; + selectedBudget = undefined; + + private subscriptions = new Subscription(); // GETTER & SETTER ============================================================ /** Get the current organisation */ @@ -73,31 +75,30 @@ export class AccountTransferComponent implements OnInit { this.form = this.formBuilder.group({ source: [undefined, Validators.required], target: [undefined, Validators.required], - amount: [0, Validators.min(0.01)] + amount: [0, Validators.min(0.01)], }); } /** OnInit hook */ ngOnInit(): void { this._loadData(); - this.form.controls.source.valueChanges.subscribe((account: IAcqAccount) => { - const maxTransferAmount = account.remaining_balance.self; - this.form.controls.amount.setValidators([ - Validators.min(0.01), - Validators.max(maxTransferAmount) - ]); - }); + this.subscriptions.add( + this.form.controls.source.valueChanges.subscribe((account: IAcqAccount) => { + const maxTransferAmount = account.remaining_balance.self; + this.form.controls.amount.setValidators([Validators.min(0.01), Validators.max(maxTransferAmount)]); + }) + ); } - // PUBLIC FUNCTIONS ========================================================= - /** get the URL to access account detail view */ - getDetailUrl(account: IAcqAccount): string[] { - return ['/', 'records', 'acq_accounts', 'detail', account.pid]; + /** onDestroy hook */ + ngOnDestroy(): void { + this.subscriptions.unsubscribe(); } + // PUBLIC FUNCTIONS ========================================================= /** Handle event when a budget is selected */ - selectBudget(event: any): void { - this.selectedBudgetPid = event.target.value; + selectBudget(event: DropdownChangeEvent): void { + this.selectedBudget = event.value; this._filterAccountToDisplay(); } @@ -120,18 +121,19 @@ export class AccountTransferComponent implements OnInit { severity: 'success', summary: this.translateService.instant('Account'), detail: this.translateService.instant('Fund transfer successful!'), - life: CONFIG.MESSAGE_LIFE + life: CONFIG.MESSAGE_LIFE, }); this.router.navigate(['/', 'acquisition', 'accounts']); }, - error: (err) => this.messageService.add({ - severity: 'error', - summary: this.translateService.instant('Account'), - detail:this.translateService.instant(err.error.message), - sticky: true, - closable: true - }), - }); + error: (err) => + this.messageService.add({ + severity: 'error', + summary: this.translateService.instant('Account'), + detail: this.translateService.instant(err.error.message), + sticky: true, + closable: true, + }), + }); } /** @@ -142,9 +144,11 @@ export class AccountTransferComponent implements OnInit { if (this.form.get(fieldName) === undefined) { return true; } - return this.form.get(fieldName).invalid - && this.form.get(fieldName).errors - && (this.form.get(fieldName).dirty || this.form.get(fieldName).touched); + return ( + this.form.get(fieldName).invalid && + this.form.get(fieldName).errors && + (this.form.get(fieldName).dirty || this.form.get(fieldName).touched) + ); } // PRIVATE FUNCTIONS ======================================================== @@ -152,17 +156,23 @@ export class AccountTransferComponent implements OnInit { private _loadData(): void { const libraryPid = this.userService.user.currentLibrary; this.acqAccountApiService - .getAccounts(libraryPid, undefined, {sort: 'depth'}) + .getAccounts(libraryPid, undefined, { sort: 'depth' }) .subscribe((accounts: IAcqAccount[]) => { this.accountsTree = orderAccountsAsTree(accounts); - this.budgets = Array.from(new Set(this.accountsTree.map((account: IAcqAccount) => account.budget.pid))); - this.selectedBudgetPid = this.budgets.find(Boolean); // get the first element + this.budgets = Array.from(new Set(this.accountsTree.map((account: IAcqAccount) => account.budget.pid))).map( + (val) => { + return { code: val }; + } + ); + this.selectedBudget = this.budgets.find(Boolean); // get the first element this._filterAccountToDisplay(); }); } /** Allow to filter loaded accounts by the selected budget */ private _filterAccountToDisplay(): void { - this.accountsToDisplay = this.accountsTree.filter((acc: IAcqAccount) => acc.budget.pid === this.selectedBudgetPid); + this.accountsToDisplay = this.accountsTree.filter( + (acc: IAcqAccount) => acc.budget.pid === this.selectedBudget.code + ); } } diff --git a/projects/admin/src/app/acquisition/formly/type/select-account/select-account.component.scss b/projects/admin/src/app/acquisition/components/acquisition-main/acquisition-main.component.ts similarity index 51% rename from projects/admin/src/app/acquisition/formly/type/select-account/select-account.component.scss rename to projects/admin/src/app/acquisition/components/acquisition-main/acquisition-main.component.ts index e05fa96b2..628d607a9 100644 --- a/projects/admin/src/app/acquisition/formly/type/select-account/select-account.component.scss +++ b/projects/admin/src/app/acquisition/components/acquisition-main/acquisition-main.component.ts @@ -1,7 +1,6 @@ /* * RERO ILS UI - * Copyright (C) 2021 RERO - * Copyright (C) 2021 UCLouvain + * Copyright (C) 2022-2025 RERO * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -16,30 +15,26 @@ * along with this program. If not, see . */ -@import 'bootstrap/scss/functions'; -@import 'bootstrap/scss/variables'; +import { Component } from '@angular/core'; -.dropdown-toggle.btn { - border: $input-border-width solid $input-border-color; -} -.number { - font-size: $font-size-sm; - font-weight: bold; - color: $secondary; - text-align: right; - &:before { - content: '['; - } - &:after { - content: ']'; - } -} -.amount { - min-width: 10rem; - font-family: Arial; -} +@Component({ + selector: 'admin-acquisition-main', + template: ` + + + +
+
+ {{ message.summary }} +
+

+
+
+
+ + `, + styles: `` +}) +export class AcquisitionMainComponent { -.is_invalid { - border: $border-width solid $danger !important; - color: $danger; } diff --git a/projects/admin/src/app/acquisition/formly/type/select-account/select-account.component.ts b/projects/admin/src/app/acquisition/formly/type/select-account/select-account.component.ts index be5c20722..1b54561c3 100644 --- a/projects/admin/src/app/acquisition/formly/type/select-account/select-account.component.ts +++ b/projects/admin/src/app/acquisition/formly/type/select-account/select-account.component.ts @@ -22,8 +22,7 @@ import { ApiService } from '@rero/ng-core'; @Component({ selector: 'admin-select-account', - templateUrl: './select-account.component.html', - styleUrls: ['../../../acquisition.scss', './select-account.component.scss'] + templateUrl: './select-account.component.html' }) export class SelectAccountComponent extends FieldType implements OnInit { diff --git a/projects/admin/src/app/scss/styles.scss b/projects/admin/src/app/scss/styles.scss index 265c47084..fbabd8180 100644 --- a/projects/admin/src/app/scss/styles.scss +++ b/projects/admin/src/app/scss/styles.scss @@ -41,6 +41,7 @@ @import '../record/detail-view/entities-detail-view/remote/entities-remote-detail-view.component.scss'; @import '../record/detail-view/permission-detail-view/permission-detail-view.component.scss'; @import '../migration/conversion/record/detail-view/migration-data/migration-data.component.scss'; + @import '../acquisition/components/account/account-detail-view/account-detail-view.component.scss'; } @layer rero-ils-ui { @@ -51,6 +52,14 @@ max-width: 1440px; margin: auto; } + $DEPTH-PADDING: 10px; + $MAX-DEPTH: 10; + + @for $level from 1 to $MAX-DEPTH { + .depth-padding-#{$level} { + padding-left: calc(#{$DEPTH-PADDING} * #{$level}); + } + } } .p-accordion-header, .p-panel-header { diff --git a/projects/admin/src/app/shared/primeng-import/primeng-import.module.ts b/projects/admin/src/app/shared/primeng-import/primeng-import.module.ts index 4345fbf6f..fb7da4998 100644 --- a/projects/admin/src/app/shared/primeng-import/primeng-import.module.ts +++ b/projects/admin/src/app/shared/primeng-import/primeng-import.module.ts @@ -42,6 +42,8 @@ import { TableModule } from 'primeng/table'; import { FieldsetModule } from 'primeng/fieldset'; import { ChartModule } from 'primeng/chart'; import { AvatarModule } from 'primeng/avatar'; +import { TreeModule } from 'primeng/tree'; +import { TreeTableModule } from 'primeng/treetable'; @NgModule({ @@ -70,7 +72,9 @@ import { AvatarModule } from 'primeng/avatar'; CardModule, TableModule, FieldsetModule, - ChartModule + ChartModule, + TreeModule, + TreeTableModule ] }) export class PrimengImportModule { }