diff --git a/projects/admin/src/app/acquisition/acquisition.module.ts b/projects/admin/src/app/acquisition/acquisition.module.ts index dfe994b47..caa9a22d3 100644 --- a/projects/admin/src/app/acquisition/acquisition.module.ts +++ b/projects/admin/src/app/acquisition/acquisition.module.ts @@ -1,7 +1,7 @@ /* * RERO ILS UI - * Copyright (C) 2021 RERO - * Copyright (C) 2021 UCLouvain + * 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 @@ -46,6 +46,7 @@ import { OrderReceiptViewComponent } from './components/receipt/receipt-form/ord import { OrderSummaryComponent } from './components/order/order-summary/order-summary.component'; import { ReceiptListComponent } from './components/receipt/receipt-list/receipt-list.component'; import { registerFormlyExtension } from './formly/extension'; +import { FieldDocumentBriefViewTypeComponent } from './formly/type/field-document-brief-view.type'; import { FieldRefTypeComponent } from './formly/type/field-ref.type'; import { RepeatTypeComponent } from './formly/type/repeat-section.type'; import { SelectAccountComponent } from './formly/type/select-account/select-account.component'; @@ -62,6 +63,7 @@ import { PermissionsService, SharedModule } from '@rero/shared'; import { OrderEmailFormComponent } from './components/order/order-email-form/order-email-form.component'; import { PreviewEmailModule } from '../shared/preview-email/preview-email.module'; + @NgModule({ declarations: [ AccountListComponent, @@ -70,6 +72,7 @@ import { PreviewEmailModule } from '../shared/preview-email/preview-email.module AccountDetailViewComponent, BudgetsBriefViewComponent, BudgetDetailViewComponent, + FieldDocumentBriefViewTypeComponent, FieldRefTypeComponent, InputNoLabelWrapperComponent, NegativeAmountPipe, @@ -104,6 +107,7 @@ import { PreviewEmailModule } from '../shared/preview-email/preview-email.module types: [ { name: 'repeat', component: RepeatTypeComponent }, { name: 'field-ref', component: FieldRefTypeComponent }, + { name: 'field-document-brief-view', component: FieldDocumentBriefViewTypeComponent }, { name: 'select-account', component: SelectAccountComponent } ], wrappers: [ diff --git a/projects/admin/src/app/acquisition/acquisition.scss b/projects/admin/src/app/acquisition/acquisition.scss index 201d3923a..92b0b5ebf 100644 --- a/projects/admin/src/app/acquisition/acquisition.scss +++ b/projects/admin/src/app/acquisition/acquisition.scss @@ -1,7 +1,7 @@ /* * RERO ILS UI - * Copyright (C) 2021 RERO - * Copyright (C) 2021 UCLouvain + * 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 @@ -48,6 +48,25 @@ } } +// receipt =================================================================== +// Use these classes to manage receipt resources +// =========================================================================== +.receipt { + .account-number { + font-size: $small-font-size; + 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. diff --git a/projects/admin/src/app/acquisition/components/order/order-detail-view/order-line/order-line.component.html b/projects/admin/src/app/acquisition/components/order/order-detail-view/order-line/order-line.component.html index 9bfda939f..698aa2a1c 100644 --- a/projects/admin/src/app/acquisition/components/order/order-detail-view/order-line/order-line.component.html +++ b/projects/admin/src/app/acquisition/components/order/order-detail-view/order-line/order-line.component.html @@ -1,7 +1,7 @@ +

{{ receipt.reference }}

@@ -32,14 +33,16 @@

{{ receipt.reference }}

{{ line.quantity }} - - {{ line.document.title_text }} - +
+ + + + + + +
{{ line.receipt_date | dateTranslate: 'shortDate' }}
-
{{ note.type | translate }} @@ -83,7 +86,7 @@

{{ receipt.reference }}

-
diff --git a/projects/admin/src/app/acquisition/components/receipt/receipt-detail-view/receipt-detail-view.component.scss b/projects/admin/src/app/acquisition/components/receipt/receipt-detail-view/receipt-detail-view.component.scss index 08b8ca44f..aee9c6c65 100644 --- a/projects/admin/src/app/acquisition/components/receipt/receipt-detail-view/receipt-detail-view.component.scss +++ b/projects/admin/src/app/acquisition/components/receipt/receipt-detail-view/receipt-detail-view.component.scss @@ -1,7 +1,7 @@ /* * RERO ILS UI - * Copyright (C) 2021 RERO - * Copyright (C) 2021 UCLouvain + * 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 @@ -73,17 +73,6 @@ $line-shift: map-get($spacers, 5); .left-offset { margin-left: $line-shift; } - .metadata { - font-weight: bold; - color: $secondary; - font-size: $small-font-size; - &::before { - content:'['; - } - &::after { - content: ']'; - } - } .note-content { border-left: 2px solid $border-color; margin-top: map-get($spacers, 1);; diff --git a/projects/admin/src/app/acquisition/components/receipt/receipt-detail-view/receipt-detail-view.component.ts b/projects/admin/src/app/acquisition/components/receipt/receipt-detail-view/receipt-detail-view.component.ts index babc00faf..e45cb7fc4 100644 --- a/projects/admin/src/app/acquisition/components/receipt/receipt-detail-view/receipt-detail-view.component.ts +++ b/projects/admin/src/app/acquisition/components/receipt/receipt-detail-view/receipt-detail-view.component.ts @@ -28,7 +28,7 @@ import { IAcqReceipt, IAcqReceiptLine } from '../../../classes/receipt'; @Component({ selector: 'admin-receipt-detail-view', templateUrl: './receipt-detail-view.component.html', - styleUrls: ['./receipt-detail-view.component.scss'] + styleUrls: ['../../../acquisition.scss', './receipt-detail-view.component.scss'] }) export class ReceiptDetailViewComponent implements OnInit, OnDestroy, DetailRecord { diff --git a/projects/admin/src/app/acquisition/components/receipt/receipt-form/order-receipt-form.ts b/projects/admin/src/app/acquisition/components/receipt/receipt-form/order-receipt-form.ts index a255eba42..63a89a3e5 100644 --- a/projects/admin/src/app/acquisition/components/receipt/receipt-form/order-receipt-form.ts +++ b/projects/admin/src/app/acquisition/components/receipt/receipt-form/order-receipt-form.ts @@ -232,19 +232,12 @@ export class OrderReceiptForm { }, { key: 'document', - type: 'field-ref', + type: 'field-document-brief-view', className: 'col-5', wrappers: ['input-no-label'], templateOptions: { headerClassName: 'col-5 font-weight-bold mb-2', label: 'Document', - resource: 'documents', - recourceKey: 'document', - resourceField: 'title.0._text', - resourceSelect: { - field: 'type', - value: 'bf:Title' - } } }, { diff --git a/projects/admin/src/app/acquisition/components/receipt/receipt-summary/receipt-summary.component.html b/projects/admin/src/app/acquisition/components/receipt/receipt-summary/receipt-summary.component.html index 8d62b9d2d..ce94258f7 100644 --- a/projects/admin/src/app/acquisition/components/receipt/receipt-summary/receipt-summary.component.html +++ b/projects/admin/src/app/acquisition/components/receipt/receipt-summary/receipt-summary.component.html @@ -56,11 +56,16 @@ -
+
{{ line.quantity }}x - - {{ line.document.title | truncateText }} - +
+ + + + + + +
diff --git a/projects/admin/src/app/acquisition/formly/type/field-document-brief-view.type.ts b/projects/admin/src/app/acquisition/formly/type/field-document-brief-view.type.ts new file mode 100644 index 000000000..aec2624ff --- /dev/null +++ b/projects/admin/src/app/acquisition/formly/type/field-document-brief-view.type.ts @@ -0,0 +1,49 @@ +/* + * RERO ILS UI + * Copyright (C) 2023 RERO + * Copyright (C) 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 { Component, OnInit } from '@angular/core'; +import { FieldType } from '@ngx-formly/core'; +import { RecordService } from '@rero/ng-core'; + +@Component({ + selector: 'admin-formly-field-type', + template: ` + + + + ` +}) +export class FieldDocumentBriefViewTypeComponent extends FieldType implements OnInit { + + /** record */ + record: any; + + /** + * Constructor + * @param _recordService - RecordService + */ + constructor(private _recordService: RecordService) { + super(); + } + + /** OnInit hook */ + ngOnInit(): void { + this._recordService.getRecord('documents', this.model['document']) + .subscribe((data: any) => this.record = data.metadata); + } +} diff --git a/projects/shared/src/lib/component/documents/document-brief-view/document-brief-view.component.html b/projects/shared/src/lib/component/documents/document-brief-view/document-brief-view.component.html new file mode 100644 index 000000000..e80678ee2 --- /dev/null +++ b/projects/shared/src/lib/component/documents/document-brief-view/document-brief-view.component.html @@ -0,0 +1,53 @@ + + + + {{ title }} + + + +
+ +
+
+ + +
+ {{ provisionActivityPublications | join }} +
+
+ + + +
+ ISBN: {{ identifiedBy | truncateText: 3 }} +
+
+ + +
+ ISSN: {{ identifiedBy | truncateText: 3 }} +
+
+ + diff --git a/projects/shared/src/lib/component/documents/document-brief-view/document-brief-view.component.scss b/projects/shared/src/lib/component/documents/document-brief-view/document-brief-view.component.scss new file mode 100644 index 000000000..faf027633 --- /dev/null +++ b/projects/shared/src/lib/component/documents/document-brief-view/document-brief-view.component.scss @@ -0,0 +1,33 @@ +/* + * RERO ILS UI + * Copyright (C) 2023 RERO + * Copyright (C) 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'; + +.small-content{ + font-size: small; + color: $secondary; + font-weight: bold; +} + +.truncate { + width: 250px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} diff --git a/projects/shared/src/lib/component/documents/document-brief-view/document-brief-view.component.spec.ts b/projects/shared/src/lib/component/documents/document-brief-view/document-brief-view.component.spec.ts new file mode 100644 index 000000000..1d131c879 --- /dev/null +++ b/projects/shared/src/lib/component/documents/document-brief-view/document-brief-view.component.spec.ts @@ -0,0 +1,41 @@ +/* + * RERO ILS UI + * Copyright (C) 2023 RERO + * Copyright (C) 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 { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { DocumentBriefViewComponent } from './document-brief-view.component'; + +describe('DocumentBriefViewComponent', () => { + let component: DocumentBriefViewComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ DocumentBriefViewComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(DocumentBriefViewComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/projects/shared/src/lib/component/documents/document-brief-view/document-brief-view.component.ts b/projects/shared/src/lib/component/documents/document-brief-view/document-brief-view.component.ts new file mode 100644 index 000000000..b08943747 --- /dev/null +++ b/projects/shared/src/lib/component/documents/document-brief-view/document-brief-view.component.ts @@ -0,0 +1,65 @@ +/* + * RERO ILS UI + * Copyright (C) 2023 RERO + * Copyright (C) 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 { Component, Input, OnInit } from '@angular/core'; + +@Component({ + selector: 'shared-document-brief-view', + templateUrl: './document-brief-view.component.html', + styleUrls: ['./document-brief-view.component.scss'] +}) +export class DocumentBriefViewComponent implements OnInit { + + /** Record */ + @Input() set record(record) { + this._record = record; + this.processProvisionActivityPublications(); + } + + /** Provision activities */ + provisionActivityPublications: any[] = []; + + /** Record */ + private _record: any; + + /** Get current record */ + get record(): any { + return this._record; + } + + /** + * Constructor + * @param _translateService - TranslateService + */ + constructor() { } + + ngOnInit(): void { } + + /** process provision activity publications */ + private processProvisionActivityPublications() { + const { provisionActivity } = this.record; + if (undefined === provisionActivity) { + return; + } + provisionActivity.map((provision: any) => { + if (provision.type === 'bf:Publication' && '_text' in provision) { + provision._text.map((text: any) => this.provisionActivityPublications.push(text.value)); + } + }); + } +} diff --git a/projects/shared/src/lib/pipe/identifiedby-label.pipe.spec.ts b/projects/shared/src/lib/pipe/identifiedby-label.pipe.spec.ts new file mode 100644 index 000000000..7625b6fb5 --- /dev/null +++ b/projects/shared/src/lib/pipe/identifiedby-label.pipe.spec.ts @@ -0,0 +1,26 @@ +/* + * RERO ILS UI + * Copyright (C) 2023 RERO + * Copyright (C) 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 { IdentifiedbyLabelPipe } from './identifier-label.pipe'; + +describe('IdentifierLabelPipe', () => { + it('create an instance', () => { + const pipe = new IdentifiedbyLabelPipe(); + expect(pipe).toBeTruthy(); + }); +}); diff --git a/projects/shared/src/lib/pipe/identifiedby-label.pipe.ts b/projects/shared/src/lib/pipe/identifiedby-label.pipe.ts new file mode 100644 index 000000000..104c23253 --- /dev/null +++ b/projects/shared/src/lib/pipe/identifiedby-label.pipe.ts @@ -0,0 +1,34 @@ +/* + * RERO ILS UI + * Copyright (C) 2023 RERO + * Copyright (C) 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 { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'identifiedByLabel' +}) +export class IdentifiedByLabelPipe implements PipeTransform { + + transform(identifiedBy: any[], types: string[]): string | null { + const identifiers: Array = types ? identifiedBy + .filter(identifier => types.includes(identifier.type)) : identifiedBy; + return identifiers.map(data => + data.value + ).join(', '); + } + +} diff --git a/projects/shared/src/lib/shared.module.ts b/projects/shared/src/lib/shared.module.ts index 71bf56ae6..5315e3593 100644 --- a/projects/shared/src/lib/shared.module.ts +++ b/projects/shared/src/lib/shared.module.ts @@ -52,6 +52,8 @@ import { PartOfComponent } from './view/brief/part-of/part-of.component'; import { InheritedCallNumberComponent } from './view/inherited-call-number/inherited-call-number.component'; import { ThumbnailComponent } from './view/thumbnail/thumbnail.component'; import { AvailabilityComponent } from './view/availability/availability.component'; +import { DocumentBriefViewComponent } from './component/documents/document-brief-view/document-brief-view.component'; +import { IdentifiedByLabelPipe } from './pipe/identifiedby-label.pipe'; @NgModule({ declarations: [ @@ -85,6 +87,8 @@ import { AvailabilityComponent } from './view/availability/availability.componen ContributionComponent, NoContentDirective, AvailabilityComponent, + DocumentBriefViewComponent, + IdentifiedByLabelPipe ], exports: [ CommonModule, @@ -114,6 +118,7 @@ import { AvailabilityComponent } from './view/availability/availability.componen ContributionComponent, NoContentDirective, AvailabilityComponent, + DocumentBriefViewComponent, ], imports: [ CommonModule, diff --git a/projects/shared/src/public-api.ts b/projects/shared/src/public-api.ts index 372015be7..1368114b6 100644 --- a/projects/shared/src/public-api.ts +++ b/projects/shared/src/public-api.ts @@ -29,6 +29,7 @@ export * from './lib/class/user'; export * from './lib/component/action-button/action-button.component'; export * from './lib/component/core/brief-view/brief-view.component'; +export * from './lib/component/documents/document-brief-view/document-brief-view.component'; export * from './lib/component/entities/entity-brief-view/entity-brief-view.component'; export * from './lib/view/contribution/contribution.component'; @@ -47,6 +48,7 @@ export * from './lib/pipe/entity-label.pipe'; export * from './lib/pipe/extract-source-field.pipe'; export * from './lib/pipe/get-translated-label.pipe'; export * from './lib/pipe/id-attribute.pipe'; +export * from './lib/pipe/identifiedby-label.pipe'; export * from './lib/pipe/is-array.pipe'; export * from './lib/pipe/item-holdings-call-number.pipe'; export * from './lib/pipe/join.pipe';