From eb5b57b295aa95751e0b5efcd37b92fd91848170 Mon Sep 17 00:00:00 2001 From: Alicia Zangger Date: Fri, 8 Nov 2019 14:47:40 +0100 Subject: [PATCH] circ-pol: implement detail view MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Adds circulation policies detailed view. * Adds collapse list component to display application informations sorted by patron type. * Removes some useless imports. Co-Authored-by: Alicia Zangger Co-Authored-by: Johnny MariƩthoz --- projects/admin/src/app/app.module.ts | 19 +- .../circ-policies-brief-view.component.ts | 8 +- .../circ-policy-detail-view.component.html | 176 ++++++++++++++++++ .../circ-policy-detail-view.component.ts | 62 ++++++ .../collapse-list.component.html | 33 ++++ .../collapse-list/collapse-list.component.ts | 35 ++++ .../src/app/service/record-routing.service.ts | 4 +- .../admin/src/app/translate/i18n/en_US.json | 6 + 8 files changed, 335 insertions(+), 8 deletions(-) create mode 100644 projects/admin/src/app/record/detail-view/circ-policy-detail-view/circ-policy-detail-view.component.html create mode 100644 projects/admin/src/app/record/detail-view/circ-policy-detail-view/circ-policy-detail-view.component.ts create mode 100644 projects/admin/src/app/record/detail-view/circ-policy-detail-view/collapse-list/collapse-list.component.html create mode 100644 projects/admin/src/app/record/detail-view/circ-policy-detail-view/collapse-list/collapse-list.component.ts diff --git a/projects/admin/src/app/app.module.ts b/projects/admin/src/app/app.module.ts index 3ea4d1f02..da9d0c4c7 100644 --- a/projects/admin/src/app/app.module.ts +++ b/projects/admin/src/app/app.module.ts @@ -58,6 +58,8 @@ import { DocumentDetailViewComponent } from './record/detail-view/document-detai import { HoldingComponent } from './record/detail-view/document-detail-view/holding/holding.component'; import { HoldingItemComponent } from './record/detail-view/document-detail-view/holding-item/holding-item.component'; import { HoldingsComponent } from './record/detail-view/document-detail-view/holdings/holdings.component'; +import { CircPolicyDetailViewComponent } from './record/detail-view/circ-policy-detail-view/circ-policy-detail-view.component'; +import { CollapseListComponent } from './record/detail-view/circ-policy-detail-view/collapse-list/collapse-list.component'; @NgModule({ declarations: [ @@ -90,7 +92,16 @@ import { HoldingsComponent } from './record/detail-view/document-detail-view/hol DocumentDetailViewComponent, HoldingComponent, HoldingItemComponent, - HoldingsComponent + HoldingsComponent, + BioInformationsPipe, + BirthDatePipe, + MefTitlePipe, + LibraryComponent, + ExceptionDatesListComponent, + ExceptionDatesEditComponent, + CirculationPolicyComponent, + CircPolicyDetailViewComponent, + CollapseListComponent ], imports: [ Bootstrap4FrameworkModule, @@ -145,7 +156,11 @@ import { HoldingsComponent } from './record/detail-view/document-detail-view/hol SelectItemTypeTypeComponent, LibraryComponent, PersonDetailViewComponent, - DocumentDetailViewComponent + DocumentDetailViewComponent, + ExceptionDatesEditComponent, + CircPolicyDetailViewComponent, + CirculationPolicyComponent, + CollapseListComponent ], bootstrap: [AppComponent] }) diff --git a/projects/admin/src/app/record/brief-view/circ-policies-brief-view.component.ts b/projects/admin/src/app/record/brief-view/circ-policies-brief-view.component.ts index 3919e0eb7..09b828384 100644 --- a/projects/admin/src/app/record/brief-view/circ-policies-brief-view.component.ts +++ b/projects/admin/src/app/record/brief-view/circ-policies-brief-view.component.ts @@ -15,13 +15,14 @@ * along with this program. If not, see . */ -import { Component, Input } from '@angular/core'; +import { Component } from '@angular/core'; import { ResultItem } from '@rero/ng-core'; @Component({ selector: 'admin-circ-policies-brief-view', template: ` -
{{ record.metadata.name }}
+
{{ record.metadata.name }}
+
{{ record.metadata.description }} @@ -32,12 +33,9 @@ import { ResultItem } from '@rero/ng-core'; }) export class CircPoliciesBriefViewComponent implements ResultItem { - @Input() record: any; - @Input() type: string; - @Input() detailUrl: { link: string, external: boolean }; } diff --git a/projects/admin/src/app/record/detail-view/circ-policy-detail-view/circ-policy-detail-view.component.html b/projects/admin/src/app/record/detail-view/circ-policy-detail-view/circ-policy-detail-view.component.html new file mode 100644 index 000000000..1945a8938 --- /dev/null +++ b/projects/admin/src/app/record/detail-view/circ-policy-detail-view/circ-policy-detail-view.component.html @@ -0,0 +1,176 @@ + + + +

{{ data.name | translate }}

+
+ +
+ +
+
+ {{ 'Name' | translate }}: +
+
+ {{ data.name }} +
+
+ +
+
+ {{ 'Description' | translate }}: +
+
+ {{ data.description }} +
+
+ +
+
+ {{ 'Level' | translate }}: +
+
+ +
+ {{ 'Library' | translate }} +
+
+ +
+ {{ 'Organisation' | translate }} +
+
+
+
+ +
+

{{ 'Circulation settings' | translate }}

+ +
+
+ {{ 'Allow checkout' | translate }}: +
+
+
+
+ + + + + + +
+
+ +
+
+ {{ 'Allow requests' | translate }}: +
+
+
+ + + + + + +
+
+ +
+
+ {{ 'Is default' | translate }}: +
+
+
+ + + + + + +
+
+ +
+
+ {{ 'Checkout duration' | translate }}: +
+
+ {{ data.checkout_duration }} +
+
+ +
+
+ {{ 'Number of renewals' | translate }}: +
+
+ {{ data.number_renewals }} +
+
+ +
+
+ {{ 'Renewal duration' | translate }}: +
+
+ {{ data.renewal_duration }} +
+
+
+ +
+

{{ 'Notifications and fees' | translate}}

+ +
+
+ {{ 'Number of days after due date' | translate }}: +
+
+ {{ data.number_of_days_after_due_date }} +
+
+ +
+
+ {{ 'Number of days before due date' | translate }}: +
+
+ {{ data.number_of_days_before_due_date }} +
+
+ +
+
+ {{ 'Reminder fee amount' | translate }}: +
+
+ {{ data.reminder_fee_amount }} +
+
+
+ +
+

{{ 'Application' | translate }}

+
+ +
+
+
+
diff --git a/projects/admin/src/app/record/detail-view/circ-policy-detail-view/circ-policy-detail-view.component.ts b/projects/admin/src/app/record/detail-view/circ-policy-detail-view/circ-policy-detail-view.component.ts new file mode 100644 index 000000000..ea8495062 --- /dev/null +++ b/projects/admin/src/app/record/detail-view/circ-policy-detail-view/circ-policy-detail-view.component.ts @@ -0,0 +1,62 @@ +/* + * RERO ILS UI + * Copyright (C) 2019 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 + * 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, OnInit, OnDestroy } from '@angular/core'; +import { Observable } from 'rxjs'; + +@Component({ + selector: 'admin-circ-policy-detail-view', + templateUrl: './circ-policy-detail-view.component.html' +}) + +export class CircPolicyDetailViewComponent implements OnInit, OnDestroy { + + /** The observable resolving record data */ + record$: Observable; + + /** The resource type */ + type: string; + + /** The record */ + record: any; + + /** The settings to display */ + settings = new Map(); + + /** The observer to the record observable */ + private recordObs = null; + + /** On init hook */ + ngOnInit() { + this.recordObs = this.record$.subscribe(record => { + this.record = record; + if (record.metadata.settings) { + record.metadata.settings.forEach(setting => { + if (!this.settings.has(setting.patron_type.pid)) { + this.settings.set(setting.patron_type.pid, [setting.item_type.pid]); + } else { + this.settings.get(setting.patron_type.pid).push(setting.item_type.pid); + } + }); + } + }); + } + + + /** On destroy hook */ + ngOnDestroy() { this.recordObs.unsubscribe(); } +} diff --git a/projects/admin/src/app/record/detail-view/circ-policy-detail-view/collapse-list/collapse-list.component.html b/projects/admin/src/app/record/detail-view/circ-policy-detail-view/collapse-list/collapse-list.component.html new file mode 100644 index 000000000..b14ed4d62 --- /dev/null +++ b/projects/admin/src/app/record/detail-view/circ-policy-detail-view/collapse-list/collapse-list.component.html @@ -0,0 +1,33 @@ + + +
+ +
+
+
+
+ {{ item_type_pid | getRecord: 'item_types' : 'field' : 'name' | async }} +
+
+
+
diff --git a/projects/admin/src/app/record/detail-view/circ-policy-detail-view/collapse-list/collapse-list.component.ts b/projects/admin/src/app/record/detail-view/circ-policy-detail-view/collapse-list/collapse-list.component.ts new file mode 100644 index 000000000..ff4f70a52 --- /dev/null +++ b/projects/admin/src/app/record/detail-view/circ-policy-detail-view/collapse-list/collapse-list.component.ts @@ -0,0 +1,35 @@ +/* + * RERO ILS UI + * Copyright (C) 2019 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 + * 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, OnInit, Input } from '@angular/core'; + +@Component({ + selector: 'admin-collapse-list', + templateUrl: './collapse-list.component.html' +}) +export class CollapseListComponent { + + /** Patron type */ + @Input() patronType: string; + + /** Item types */ + @Input() itemTypes: string[]; + + /** Is collapsed */ + isCollapsed = true; + +} diff --git a/projects/admin/src/app/service/record-routing.service.ts b/projects/admin/src/app/service/record-routing.service.ts index 33c160022..dd666c10a 100644 --- a/projects/admin/src/app/service/record-routing.service.ts +++ b/projects/admin/src/app/service/record-routing.service.ts @@ -39,6 +39,7 @@ import { DocumentEditorComponent } from '../document-editor/document-editor.comp import { UserService } from './user.service'; import { LibraryDetailViewComponent } from '../record/detail-view/library-detail-view/library-detail-view.component'; import { RecordPermissionMessageService } from './record-permission-message.service'; +import { CircPolicyDetailViewComponent } from '../record/detail-view/circ-policy-detail-view/circ-policy-detail-view.component'; @Injectable({ providedIn: 'root' @@ -228,7 +229,8 @@ export class RecordRoutingService { { key: 'circ_policies', label: 'Circulation Policies', - component: CircPoliciesBriefViewComponent + component: CircPoliciesBriefViewComponent, + detailComponent: CircPolicyDetailViewComponent } ] } diff --git a/projects/admin/src/app/translate/i18n/en_US.json b/projects/admin/src/app/translate/i18n/en_US.json index 77b208886..d291d8984 100644 --- a/projects/admin/src/app/translate/i18n/en_US.json +++ b/projects/admin/src/app/translate/i18n/en_US.json @@ -6,6 +6,8 @@ "Additional Materials": "Additional Materials", "Address": "Address", "Address must be at least 4 characters long.": "Address must be at least 4 characters long.", + "Allow checkout": "Allow checkout", + "Allow requests": "Allow requests", "Application": "Application", "Applies to patron types": "Applies to patron types", "Apply": "Apply", @@ -75,6 +77,7 @@ "Integer only.": "Integer only.", "Interval is required.": "Interval is required.", "Interval must greater than 0.": "Interval must greater than 0.", + "Is default": "Is default", "Is part of": "Is part of", "Item": "Item", "Item infos": "Item infos", @@ -95,6 +98,8 @@ "No request corresponding to the given item has been found.": "No request corresponding to the given item has been found.", "Notes": "Notes", "Notifications and fees": "Notifications and fees", + "Number of days after due date": "Number of days after due date", + "Number of days before due date": "Number of days before due date", "Number of renewals": "Number of renewals", "OK": "OK", "Online Access": "Online Access", @@ -119,6 +124,7 @@ "Record Updated!": "Record Updated!", "Record created!": "Record created!", "Record deleted": "Record deleted", + "Reminder fee amount": "Reminder fee amount", "Renewal duration": "Renewal duration", "Renewal duration is required.": "Renewal duration is required.", "Repeat each": "Repeat each",