From 6175a39031173e042288a6ca6729abb18bc566a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Marie=CC=81thoz?= Date: Mon, 9 Dec 2024 16:22:15 +0100 Subject: [PATCH] primeng: admin loans MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-by: Johnny MarieĢthoz Co-Authored-by: Bertrand Zuchuat --- projects/admin/src/app/app.module.ts | 2 - .../loans-brief-view.component.html | 103 ++++++++---------- .../loans-brief-view.component.scss | 29 ----- .../loans-brief-view.component.ts | 19 ++-- .../circulation-log-loan.component.html | 28 ++--- .../circulation-log-loan.component.scss | 39 ------- .../circulation-log-loan.component.ts | 3 +- ...irculation-log-notification.component.html | 33 +++--- ...irculation-log-notification.component.scss | 42 ------- .../circulation-log-notification.component.ts | 3 +- .../circulation-log.component.html | 63 +++++------ .../circulation-log.component.scss | 77 ------------- .../circulation-log.component.ts | 3 +- .../circulation-logs-dialog.component.ts | 70 ------------ .../circulation-logs.component.html | 31 +++--- .../circulation-logs.component.scss | 40 ------- .../circulation-logs.component.ts | 68 ++++++------ .../circulation-stats.component.html | 10 +- projects/admin/src/index.html | 4 +- .../component/open-close-button.component.ts | 8 +- 20 files changed, 188 insertions(+), 487 deletions(-) delete mode 100644 projects/admin/src/app/record/brief-view/loans-brief-view/loans-brief-view.component.scss delete mode 100644 projects/admin/src/app/record/circulation-logs/circulation-log/circulation-log-loan/circulation-log-loan.component.scss delete mode 100644 projects/admin/src/app/record/circulation-logs/circulation-log/circulation-log-notification/circulation-log-notification.component.scss delete mode 100644 projects/admin/src/app/record/circulation-logs/circulation-log/circulation-log.component.scss delete mode 100644 projects/admin/src/app/record/circulation-logs/circulation-logs-dialog.component.ts delete mode 100644 projects/admin/src/app/record/circulation-logs/circulation-logs.component.scss diff --git a/projects/admin/src/app/app.module.ts b/projects/admin/src/app/app.module.ts index ef77b3667..2e9b6c82f 100644 --- a/projects/admin/src/app/app.module.ts +++ b/projects/admin/src/app/app.module.ts @@ -81,7 +81,6 @@ import { VendorBriefViewComponent } from './record/brief-view/vendor-brief-view. import { CirculationLogLoanComponent } from './record/circulation-logs/circulation-log/circulation-log-loan/circulation-log-loan.component'; import { CirculationLogNotificationComponent } from './record/circulation-logs/circulation-log/circulation-log-notification/circulation-log-notification.component'; import { CirculationLogComponent } from './record/circulation-logs/circulation-log/circulation-log.component'; -import { CirculationLogsDialogComponent } from './record/circulation-logs/circulation-logs-dialog.component'; import { CirculationLogsComponent } from './record/circulation-logs/circulation-logs.component'; import { CirculationStatsComponent } from './record/circulation-logs/circulation-stats/circulation-stats.component'; import { DocumentEditorComponent } from './record/custom-editor/document-editor/document-editor.component'; @@ -278,7 +277,6 @@ export function appInitFactory(appInitializerService: AppInitializerService): () DialogImportComponent, NotificationTypePipe, CirculationLogsComponent, - CirculationLogsDialogComponent, CirculationLogComponent, ItemInCollectionPipe, CountryCodeTranslatePipe, diff --git a/projects/admin/src/app/record/brief-view/loans-brief-view/loans-brief-view.component.html b/projects/admin/src/app/record/brief-view/loans-brief-view/loans-brief-view.component.html index c1330f482..6eb648211 100644 --- a/projects/admin/src/app/record/brief-view/loans-brief-view/loans-brief-view.component.html +++ b/projects/admin/src/app/record/brief-view/loans-brief-view/loans-brief-view.component.html @@ -15,65 +15,58 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . --> -
+
-
-
-
{{ record.metadata.document.title | mainTitle }}
-
-
-
Item
-
- - ({{ record.metadata.item.barcode }}) -
-
Patron
-
- - {{ record.metadata.patron.formatted_name }} - -
-
Status
-
- {{ record.metadata.state | translate }} - @switch(record.metadata.state) { - - @case (loanState.ITEM_ON_LOAN) { - @if (record.metadata?.is_late) { - overdue - ({{ 'due date' | translate }} - - {{record.metadata.end_date | date: 'shortDate' }}) - } - } - - @case (loanState.ITEM_AT_DESK) { - ({{ 'request expire at' | translate }} - {{ record.metadata.request_expire_date | date: 'shortDate' }}) - } - } -
-
+
+
{{ record.metadata.document.title | mainTitle }}
+ +
+ + @if (canUseDebugMode) { + + + + }
- -
- - @if (canUseDebugMode) { - - } -
+ + @if (debugMode) { -
{{ record.metadata | json }}
+
{{ record.metadata | json }}
}
-
diff --git a/projects/admin/src/app/record/brief-view/loans-brief-view/loans-brief-view.component.scss b/projects/admin/src/app/record/brief-view/loans-brief-view/loans-brief-view.component.scss deleted file mode 100644 index 9a645a684..000000000 --- a/projects/admin/src/app/record/brief-view/loans-brief-view/loans-brief-view.component.scss +++ /dev/null @@ -1,29 +0,0 @@ -/* You can add global styles to this file, and also import other style files */ -/* - * RERO ILS UI - * Copyright (C) 2022 RERO - * Copyright (C) 2022 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/bootstrap'; - -dl dd { - margin-bottom: 0; -} -pre { - font-size: 60%; - background-color: $light; -} - diff --git a/projects/admin/src/app/record/brief-view/loans-brief-view/loans-brief-view.component.ts b/projects/admin/src/app/record/brief-view/loans-brief-view/loans-brief-view.component.ts index bc8f7a5c3..2ec00d831 100644 --- a/projects/admin/src/app/record/brief-view/loans-brief-view/loans-brief-view.component.ts +++ b/projects/admin/src/app/record/brief-view/loans-brief-view/loans-brief-view.component.ts @@ -22,16 +22,17 @@ import { DateTime } from 'luxon'; import { DialogService } from 'primeng/dynamicdialog'; import { LoanState } from '../../../classes/loans'; import { CirculationLogsComponent } from '../../circulation-logs/circulation-logs.component'; +import { TranslateService } from '@ngx-translate/core'; @Component({ selector: 'admin-loans-brief-view', - templateUrl: './loans-brief-view.component.html', - styleUrls: ['./loans-brief-view.component.scss'] + templateUrl: './loans-brief-view.component.html' }) export class LoansBriefViewComponent implements ResultItem, OnInit { private dialogService: DialogService = inject(DialogService); private permissionsService: PermissionsService = inject(PermissionsService); + private translateService: TranslateService = inject(TranslateService); // COMPONENT ATTRIBUTES ===================================================== /** Information to build the URL on the record detail view. */ @@ -44,7 +45,7 @@ export class LoansBriefViewComponent implements ResultItem, OnInit { /** debug mode toggle */ debugMode = false; /** class to use for the state bullet */ - stateClass: string = null; + tagSeverity: string = null; /** Reference on LoanState */ loanState = LoanState; /** is the current request is expired */ @@ -63,7 +64,7 @@ export class LoansBriefViewComponent implements ResultItem, OnInit { /** OnInit hook */ ngOnInit() { // State bullet color - this._getBadgeStyle(); + this.setTagSeverity(); // Is request is expired this.record.metadata.request_expire_date = "2024-10-28T08:58:59.979434+00:00"; if ('request_expire_date' in this.record.metadata) { @@ -76,6 +77,8 @@ export class LoansBriefViewComponent implements ResultItem, OnInit { /** Open transaction history logs dialog */ openTransactionHistoryDialog(loanPid: string): void { this.dialogService.open(CirculationLogsComponent, { + header: this.translateService.instant("Circulation history"), + width: '60vw', dismissableMask: true, data: { resourcePid: loanPid, @@ -87,19 +90,19 @@ export class LoansBriefViewComponent implements ResultItem, OnInit { // PRIVATE COMPONENT FUNCTIONS ============================================== /** Define the bullet color. */ - private _getBadgeStyle(): void { + private setTagSeverity(): void { switch (this.record.metadata.state) { case LoanState.CREATED: case LoanState.PENDING: case LoanState.ITEM_AT_DESK: - this.stateClass = 'badge-info'; + this.tagSeverity = 'info'; break; case LoanState.ITEM_ON_LOAN: - this.stateClass = 'badge-success'; + this.tagSeverity = 'success'; break; case LoanState.ITEM_IN_TRANSIT_FOR_PICKUP: case LoanState.ITEM_IN_TRANSIT_TO_HOUSE: - this.stateClass = 'badge-warning'; + this.tagSeverity = 'warning'; } } } diff --git a/projects/admin/src/app/record/circulation-logs/circulation-log/circulation-log-loan/circulation-log-loan.component.html b/projects/admin/src/app/record/circulation-logs/circulation-log/circulation-log-loan/circulation-log-loan.component.html index dbeaa2aa2..c1ddf883a 100644 --- a/projects/admin/src/app/record/circulation-logs/circulation-log/circulation-log-loan/circulation-log-loan.component.html +++ b/projects/admin/src/app/record/circulation-logs/circulation-log/circulation-log-loan/circulation-log-loan.component.html @@ -20,10 +20,11 @@ [isHighlight]="isHighlight" [separator]="separator" > - {{ record.metadata.loan.trigger | translate }} -
+ {{ record.metadata.loan.trigger | translate }} +
-
+
+   @if (record.metadata.loan.transaction_location) { @if (record.metadata.loan.transaction_location.pid | getRecord : 'locations' | async; as location) { {{ $any(location).metadata.library.pid | getRecord : 'libraries' : 'field' : 'name' | async }} @@ -33,7 +34,8 @@ }
-
+
+   @if (record.metadata.loan.patron.pid) { @if (record.metadata.loan.patron.pid | getRecord : 'patrons' | async; as patron) { @@ -45,10 +47,10 @@ }
-
+