Skip to content

Commit

Permalink
entity: use entity instead of contribution
Browse files Browse the repository at this point in the history
* Adds a new contribution component.
* Removes Mef Person et Organisastion typeahead service.
* Adds Mef typeahead service.
* Adds contribution entity pipe.
* Removes contribution filter and format pipe.
* Renames contribution to entity.
* Uses authorized_access_point.

Co-Authored-by: Bertrand Zuchuat <[email protected]>
Co-Authored-by: Johnny Mariéthoz <[email protected]>
  • Loading branch information
2 people authored and zannkukai committed Apr 19, 2023
1 parent e4387ce commit 8d1f630
Show file tree
Hide file tree
Showing 51 changed files with 466 additions and 1,030 deletions.
42 changes: 18 additions & 24 deletions projects/admin/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* RERO ILS UI
* Copyright (C) 2019-2022 RERO
* Copyright (C) 2019-2022 UCLouvain
* Copyright (C) 2019-2023 RERO
* Copyright (C) 2019-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
Expand All @@ -17,7 +17,7 @@
*/

import { APP_BASE_HREF, PlatformLocation } from '@angular/common';
import { HttpClient, HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { HTTP_INTERCEPTORS, HttpClient, HttpClientModule } from '@angular/common/http';
import { APP_INITIALIZER, CUSTOM_ELEMENTS_SCHEMA, LOCALE_ID, NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
Expand All @@ -44,13 +44,10 @@ import {
SelectAccountEditorWidgetComponent
} from './acquisition/components/editor/widget/select-account-editor-widget/select-account-editor-widget.component';
import { ReceivedOrderPermissionValidator } from './acquisition/utils/permissions';
import { PaymentsDataComponent } from './record/search-view/patron-transaction-event-search-view/payments-data/payments-data.component';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { DocumentsTypeahead } from './classes/typeahead/documents-typeahead';
import { ItemsTypeahead } from './classes/typeahead/items-typeahead';
import { MefOrganisationTypeahead } from './classes/typeahead/mef-organisation-typeahead';
import { MefPersonTypeahead } from './classes/typeahead/mef-person-typeahead';
import { MefTypeahead } from './classes/typeahead/mef-typeahead';
import { PatronsTypeahead } from './classes/typeahead/patrons-typeahead';
import { TabOrderDirective } from './directives/tab-order.directive';
Expand All @@ -72,7 +69,7 @@ import { ItemInCollectionPipe } from './pipe/item-in-collection.pipe';
import { MainTitleRelationPipe } from './pipe/main-title-relation.pipe';
import { MarcPipe } from './pipe/marc.pipe';
import { NotesFormatPipe } from './pipe/notes-format.pipe';
import { SubjectProcessPipe } from './pipe/subject-process.pipe';
import { PatronNamePipe } from './pipe/patron-name.pipe';
import { CircPoliciesBriefViewComponent } from './record/brief-view/circ-policies-brief-view.component';
import { CollectionBriefViewComponent } from './record/brief-view/collection-brief-view.component';
import { DocumentsBriefViewComponent } from './record/brief-view/documents-brief-view/documents-brief-view.component';
Expand All @@ -82,10 +79,15 @@ import { ItemTypesBriefViewComponent } from './record/brief-view/item-types-brie
import { ItemsBriefViewComponent } from './record/brief-view/items-brief-view/items-brief-view.component';
import { LibrariesBriefViewComponent } from './record/brief-view/libraries-brief-view.component';
import { LoansBriefViewComponent } from './record/brief-view/loans-brief-view/loans-brief-view.component';
import { PatronTransactionEventDefaultComponent } from './record/brief-view/patron-transaction-events-brief-view/patron-transaction-event-default.component';
import { PatronTransactionEventOverdueComponent } from './record/brief-view/patron-transaction-events-brief-view/patron-transaction-event-overdue.component';
import { PatronTransactionEventsBriefViewComponent } from './record/brief-view/patron-transaction-events-brief-view/patron-transaction-events-brief-view.component';
import { PatronTypesBriefViewComponent } from './record/brief-view/patron-types-brief-view.component';
import { PatronsBriefViewComponent } from './record/brief-view/patrons-brief-view/patrons-brief-view.component';
import { TemplatesBriefViewComponent } from './record/brief-view/templates-brief-view.component';
import { VendorBriefViewComponent } from './record/brief-view/vendor-brief-view.component';
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';
Expand Down Expand Up @@ -150,18 +152,24 @@ import { LocalFieldComponent } from './record/detail-view/local-field/local-fiel
import { LocationDetailViewComponent } from './record/detail-view/location-detail-view/location-detail-view.component';
import { OrganisationDetailViewComponent } from './record/detail-view/organisation-detail-view/organisation-detail-view.component';
import { PatronDetailViewComponent } from './record/detail-view/patron-detail-view/patron-detail-view.component';
import { PatronPermissionComponent } from './record/detail-view/patron-detail-view/patron-permissions/patron-permission/patron-permission.component';
import { PatronPermissionsComponent } from './record/detail-view/patron-detail-view/patron-permissions/patron-permissions.component';
import { PatronTypesDetailViewComponent } from './record/detail-view/patron-types-detail-view/patron-types-detail-view.component';
import { PermissionDetailViewComponent } from './record/detail-view/permission-detail-view/permission-detail-view.component';
import { RecordMaskedComponent } from './record/detail-view/record-masked/record-masked.component';
import { TemplateDetailViewComponent } from './record/detail-view/template-detail-view/template-detail-view.component';
import { VendorDetailViewComponent } from './record/detail-view/vendor-detail-view/vendor-detail-view.component';
import { DocumentRecordSearchComponent } from './record/search-view/document-record-search/document-record-search.component';
import { IdentifiedbyValueComponent } from './record/editor/wrappers/identifiedby-value.component';
import { UserIdComponent } from './record/editor/wrappers/user-id/user-id.component';
import { CipoPatronTypeItemTypeComponent } from './record/formly/type/cipo-patron-type-item-type/cipo-patron-type-item-type.component';
import { ItemAvailabilityComponent } from './record/item-availability/item-availability.component';
import { OperationLogsDialogComponent } from './record/operation-logs/operation-logs-dialog/operation-logs-dialog.component';
import { OperationLogsComponent } from './record/operation-logs/operation-logs.component';
import { DocumentRecordSearchComponent } from './record/search-view/document-record-search/document-record-search.component';
import { PatronTransactionEventSearchViewComponent } from './record/search-view/patron-transaction-event-search-view/patron-transaction-event-search-view.component';
import { PaymentsDataComponent } from './record/search-view/patron-transaction-event-search-view/payments-data/payments-data.component';
import { PaymentDataPieComponent } from './record/search-view/patron-transaction-event-search-view/payments-data/pie/payment-data-pie.component';
import { PaymentsDataTableComponent } from './record/search-view/patron-transaction-event-search-view/payments-data/table/payments-data-table.component';
import { AppConfigService } from './service/app-config.service';
import { AppInitializerService } from './service/app-initializer.service';
import { OrganisationService } from './service/organisation.service';
Expand All @@ -170,17 +178,6 @@ import { UiRemoteTypeaheadService } from './service/ui-remote-typeahead.service'
import { CurrentLibraryPermissionValidator } from './utils/permissions';
import { CustomShortcutHelpComponent } from './widgets/custom-shortcut-help/custom-shortcut-help.component';
import { FrontpageComponent } from './widgets/frontpage/frontpage.component';
import { PatronTransactionEventsBriefViewComponent } from './record/brief-view/patron-transaction-events-brief-view/patron-transaction-events-brief-view.component';
import { PatronNamePipe } from './pipe/patron-name.pipe';
import { PatronTransactionEventOverdueComponent } from './record/brief-view/patron-transaction-events-brief-view/patron-transaction-event-overdue.component';
import { PatronTransactionEventDefaultComponent } from './record/brief-view/patron-transaction-events-brief-view/patron-transaction-event-default.component';
import { PatronTransactionEventSearchViewComponent } from './record/search-view/patron-transaction-event-search-view/patron-transaction-event-search-view.component';
import { PaymentsDataTableComponent } from './record/search-view/patron-transaction-event-search-view/payments-data/table/payments-data-table.component';
import { PaymentDataPieComponent } from './record/search-view/patron-transaction-event-search-view/payments-data/pie/payment-data-pie.component';
import { PatronPermissionsComponent } from './record/detail-view/patron-detail-view/patron-permissions/patron-permissions.component';
import { PatronPermissionComponent } from './record/detail-view/patron-detail-view/patron-permissions/patron-permission/patron-permission.component';
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';

/** Init application factory */
export function appInitFactory(appInitializerService: AppInitializerService): () => Promise<any> {
Expand Down Expand Up @@ -271,7 +268,6 @@ export function appInitFactory(appInitializerService: AppInitializerService): ()
RecordMaskedComponent,
IdentifiedbyValueComponent,
DialogImportComponent,
SubjectProcessPipe,
NotificationTypePipe,
CirculationLogsComponent,
CirculationLogsDialogComponent,
Expand Down Expand Up @@ -370,8 +366,7 @@ export function appInitFactory(appInitializerService: AppInitializerService): ()
// Use the "multi" parameter to allow the recovery of several services in the injector.
{ provide: typeaheadToken, useExisting: DocumentsTypeahead, multi: true },
{ provide: typeaheadToken, useExisting: ItemsTypeahead, multi: true },
{ provide: typeaheadToken, useExisting: MefOrganisationTypeahead, multi: true },
{ provide: typeaheadToken, useExisting: MefPersonTypeahead, multi: true },
{ provide: typeaheadToken, useExisting: MefTypeahead, multi: true },
{ provide: typeaheadToken, useExisting: PatronsTypeahead, multi: true },
{
provide: CoreConfigService,
Expand All @@ -388,8 +383,7 @@ export function appInitFactory(appInitializerService: AppInitializerService): ()
ItemsTypeahead,
PatronsTypeahead,
MainTitlePipe,
MefPersonTypeahead,
MefOrganisationTypeahead,
MefTypeahead,
TruncateTextPipe,
CurrentLibraryPermissionValidator,
ReceivedOrderPermissionValidator,
Expand Down
16 changes: 2 additions & 14 deletions projects/admin/src/app/circulation/item/item.component.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--
RERO ILS UI
Copyright (C) 2019 RERO
Copyright (C) 2019-2023 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
Expand Down Expand Up @@ -58,19 +58,7 @@
<a [routerLink]="['/records','documents','detail', item.document.pid]" *ngIf="item.document.title | mainTitle as title ">
{{ isCollapsed ? (title | truncateText: 12) : title }}
</a>
<ng-container *ngIf="document && document.contribution && document.contribution.length > 0">
<ul class="list-inline mb-0 small">
<li *ngFor="let contribution of document.contribution; let last = last; let i = index" class="list-inline-item">
<span *ngIf="!contribution.agent.pid" [innerHTML]="contribution | contributionFormat: true"></span>
<a
*ngIf="contribution.agent.pid"
[innerHTML]="contribution | contributionFormat: true"
[routerLink]="['/records', 'persons', 'detail', contribution.agent.pid]">
</a>
{{ last ? '' : '; ' }}
</li>
</ul>
</ng-container>
<shared-contribution [contributions]="document?.contribution"></shared-contribution>
</div>
<!-- CIRCULATION INFO -->
<div name="circ-info" class="col-2">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--
RERO ILS UI
Copyright (C) 2019 RERO
Copyright (C) 2019-2023 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
Expand Down Expand Up @@ -44,19 +44,7 @@
<a [routerLink]="['/records','documents','detail', document.pid]" *ngIf="document.title | mainTitle as title ">
{{ title }}
</a><br/>
<ng-container *ngIf="document.contribution && document.contribution.length > 0">
<ul class="list-inline mb-0 small" *ngIf="document && document.contribution">
<li *ngFor="let contribution of document.contribution; let last = last; let i = index" class="list-inline-item">
<span *ngIf="!contribution.agent.pid" [innerHTML]="contribution | contributionFormat: true"></span>
<a
*ngIf="contribution.agent.pid"
[innerHTML]="contribution | contributionFormat: true"
[routerLink]="['/records', 'persons', 'detail', contribution.agent.pid]">
</a>
{{ last ? '' : '; ' }}
</li>
</ul>
</ng-container>
<shared-contribution [contributions]="document?.contribution"></shared-contribution>
</div>
<div name="call-number" class="col-2">
<shared-inherited-call-number [item]="item"></shared-inherited-call-number>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,12 @@
</ng-template>
</div>
<div class="col-sm-4">
<ng-container *ngIf="document && document.metadata.contribution; else noContributionRecord">
<ul class="list-inline mb-0">
<li class="list-inline-item mr-1" *ngFor="let contribution of document.metadata.contribution.slice(0,3) | contributionFilter:language; let last = last; let i = index">
<ng-container *ngIf="contribution.pid && contribution.target !== undefined; else agentNoLink">
<a [routerLink]="['/', 'records', contribution.type | contributionType, 'detail', contribution.pid]">
{{ contribution.authorizedAccessPoint }}
</a>
</ng-container>
<ng-template #agentNoLink>
{{ contribution.authorizedAccessPoint }}
</ng-template>
{{ last ? '' : '; ' }}
{{ last && i === 2 ? '; …' : '' }}
</li>
</ul>
</ng-container>
<ng-template #noContributionRecord>
&nbsp;
</ng-template>
<shared-contribution
*ngIf="document?.metadata?.contribution && document.metadata.contribution.length > 0; else noContributionRecord"
[contributions]="document.metadata.contribution"
[limitRecord]="3"
></shared-contribution>
<ng-template #noContributionRecord>&nbsp;</ng-template>
</div>
<div class="col-sm-2">
{{ log.metadata.date | dateTranslate: 'short' }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* RERO ILS UI
* Copyright (C) 2021 RERO
* Copyright (C) 2021-2023 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
Expand All @@ -16,7 +16,6 @@
*/

import { Component, Input } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { ProvisionActivityType } from '@rero/shared';
import { OperationLogsApiService } from '@app/admin/api/operation-logs-api.service';

Expand All @@ -38,18 +37,11 @@ export class HistoryLogComponent {
/** Checkout record operation logs */
checkout: any = null;

/** Get current language */
get language(): string {
return this._translateService.currentLang;
}

/**
* Constructor
* @param _translateService - TranslateService
* @param _operationLogsApiService - OperationLogsApiService
*/
constructor(
private _translateService: TranslateService,
private _operationLogsApiService: OperationLogsApiService
) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,7 @@
<a [routerLink]="['/records', 'documents', 'detail', document.pid]" *ngIf="document.title | mainTitle as title">
{{ title }}
</a><br/>
<ng-container *ngIf="document.contribution && document.contribution.length > 0">
<ul class="list-inline mb-0 small">
<li *ngFor="let contribution of document.contribution; let last = last; let i = index" class="list-inline-item">
<span *ngIf="!contribution.agent.pid" [innerHTML]="contribution | contributionFormat: true"></span>
<a
*ngIf="contribution.agent.pid"
[innerHTML]="contribution | contributionFormat: true"
[routerLink]="['/records', 'persons', 'detail', contribution.agent.pid]">
</a>
{{ last ? '' : '; ' }}
</li>
</ul>
</ng-container>
<shared-contribution [contributions]="document?.contribution"></shared-contribution>
</div>
<div class="col-2">{{ loan.created | dateTranslate: 'short' }}</div>
<div class="col-2">-<!-- TODO :: display the computed expected_date --></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,7 @@
<a [routerLink]="['/records', 'documents', 'detail', document.pid]" *ngIf="document.title | mainTitle as title">
{{ title }}
</a><br/>
<ng-container *ngIf="document.contribution && document.contribution.length > 0">
<ul class="list-inline mb-0 small">
<li *ngFor="let contribution of document.contribution; let last = last; let i = index" class="list-inline-item">
<span *ngIf="!contribution.agent.pid" [innerHTML]="contribution | contributionFormat: true"></span>
<a
*ngIf="contribution.agent.pid"
[innerHTML]="contribution | contributionFormat: true"
[routerLink]="['/records', 'persons', 'detail', contribution.agent.pid]">
</a>
{{ last ? '' : '; ' }}
</li>
</ul>
</ng-container>
<shared-contribution [contributions]="document?.contribution"></shared-contribution>
</div>
<div class="col-3">
{{ loan.metadata.pickup_location_pid | getRecord: 'locations' : 'field' : 'pickup_name' | async }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* RERO ILS UI
* Copyright (C) 2020 RERO
* Copyright (C) 2020-2023 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
Expand Down Expand Up @@ -42,5 +42,5 @@ export interface ITypeahead {
* @returns - an observable of the list of suggestions.
*/
getSuggestions(options: any, query: string, numberOfSuggestions: number):
Observable<Array<SuggestionMetadata>>;
Observable<Array<SuggestionMetadata | string>>;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* RERO ILS UI
* Copyright (C) 2020 RERO
* Copyright (C) 2020 UCLouvain
* Copyright (C) 2020-2023 RERO
* Copyright (C) 2020-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
Expand Down Expand Up @@ -76,7 +76,7 @@ export class DocumentsTypeahead implements ITypeahead {
* @param numberOfSuggestions - the max number of suggestion to return
* @returns - an observable of the list of suggestions.
*/
getSuggestions(options: any, query: string, numberOfSuggestions: number): Observable<Array<SuggestionMetadata>> {
getSuggestions(options: any, query: string, numberOfSuggestions: number): Observable<Array<SuggestionMetadata | string>> {
if (!query) {
return of([]);
}
Expand Down Expand Up @@ -124,7 +124,7 @@ export class DocumentsTypeahead implements ITypeahead {

// Truncate text if the length of text great than maxLengthSuggestion
if (text.length > this.maxLengthSuggestion) {
text = text.substr(0, this.maxLengthSuggestion) + '…';
text = text.slice(0, this.maxLengthSuggestion) + '…';
}

// Process identifiedBy
Expand Down
Loading

0 comments on commit 8d1f630

Please sign in to comment.