Skip to content

Commit

Permalink
document: display title in brief and detail views
Browse files Browse the repository at this point in the history
* Adds variant titles and responsibility in detail view.
* Updates titles in all concerned views.
* Fixes circulation issue.

Co-Authored-by: Alicia Zangger <alicia.zangger@rero.ch>
Co-Authored-by: Gianni Pante <gianni.pante@rero.ch>
  • Loading branch information
2 people authored and jma committed Apr 8, 2020
1 parent d603a5e commit 4e4eb21
Show file tree
Hide file tree
Showing 41 changed files with 482 additions and 171 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { map } from 'rxjs/operators';
import { User } from '../../class/user';
import { PatronService } from '../../service/patron.service';
import { UserService } from '../../service/user.service';
import { ItemAction, ItemStatus, LoanState } from '../items';
import { ItemAction, ItemStatus } from '../items';
import { ItemsService } from '../items.service';

@Component({
Expand Down Expand Up @@ -86,6 +86,7 @@ export class CheckinComponent implements OnInit {
if (!searchText) {
return null;
}
this.searchText = searchText;
this.getPatronOrItem(this.searchText);
}

Expand Down
4 changes: 3 additions & 1 deletion projects/admin/src/app/circulation/item/item.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
</div>
<!-- TITLE -->
<div class="col-lg-4"><a
[routerLink]="['/records','documents','detail', item.document.pid]">{{ item.document.title | truncateText: 12 }}</a>
[routerLink]="['/records','documents','detail', item.document.pid]"
*ngIf="getMainTitle(item.document.title) != null">
{{ getMainTitle(item.document.title) | truncateText: 12 }}</a>
</div>
<!-- CIRCULATION INFO -->
<div class="col-lg-3">
Expand Down
12 changes: 11 additions & 1 deletion projects/admin/src/app/circulation/item/item.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { RecordService } from '@rero/ng-core';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { MainTitleService } from '../../service/main-title.service';
import { OrganisationService } from '../../service/organisation.service';
import { Item, ItemAction, Loan, LoanState } from '../items';
import { PatronTransactionService } from '../patron-transaction.service';
Expand Down Expand Up @@ -65,7 +66,8 @@ export class ItemComponent implements OnInit {
constructor(
private recordService: RecordService,
private organisationService: OrganisationService,
private patronTransactionService: PatronTransactionService
private patronTransactionService: PatronTransactionService,
private _mainTitleService: MainTitleService
) { }

/**
Expand Down Expand Up @@ -122,4 +124,12 @@ export class ItemComponent implements OnInit {
get organisation() {
return this.organisationService.organisation;
}

/**
* Get main title (correspondig to 'bf_Title' type, present only once in metadata)
* @param titleMetadata: title metadata
*/
getMainTitle(titleMetadata: any): string {
return this._mainTitleService.getMainTitle(titleMetadata);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
*/

import { Component, OnInit } from '@angular/core';
import { ItemsService } from '../items.service';
import { TranslateService } from '@ngx-translate/core';
import { ToastrService } from 'ngx-toastr';
import { UserService } from '../../service/user.service';
import { TranslateService } from '@ngx-translate/core';
import { ItemsService } from '../items.service';


@Component({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import { ToastrService } from 'ngx-toastr';
import { forkJoin } from 'rxjs';
import { User } from '../../../class/user';
import { PatronService } from '../../../service/patron.service';
import { UserService } from '../../../service/user.service';
import { Item, ItemAction, ItemStatus } from '../../items';
import { ItemsService } from '../../items.service';
import { UserService } from '../../../service/user.service';

@Component({
selector: 'admin-loan',
Expand Down Expand Up @@ -92,6 +92,7 @@ export class LoanComponent implements OnInit {
if (!searchText) {
return null;
}
this.searchText = searchText;
this.getItem(this.searchText);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import { ActivatedRoute, Router } from '@angular/router';
import { Component, OnDestroy, OnInit } from '@angular/core';
import { PatronService } from '../../../service/patron.service';
import { PatronTransactionService } from '../../patron-transaction.service';
import { ActivatedRoute, Router } from '@angular/router';
import { Observable, Subscription } from 'rxjs';
import { OrganisationService } from '../../../service/organisation.service';
import { User } from '../../../class/user';
import { OrganisationService } from '../../../service/organisation.service';
import { PatronService } from '../../../service/patron.service';
import { PatronTransactionService } from '../../patron-transaction.service';

@Component({
selector: 'admin-main',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { BsModalService, BsModalRef } from 'ngx-bootstrap';
import { getCurrencySymbol } from '@angular/common';
import { Component, OnInit } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { FormlyFieldConfig } from '@ngx-formly/core';
import { TranslateService } from '@ngx-translate/core';
import { BsModalRef, BsModalService } from 'ngx-bootstrap';
import { OrganisationService } from '../../../../service/organisation.service';
import { PatronTransaction } from '../../../patron-transaction';
import { PatronTransactionService } from '../../../patron-transaction.service';
import { TranslateService } from '@ngx-translate/core';
import { getCurrencySymbol } from '@angular/common';


@Component({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, Input } from '@angular/core';
import { PatronTransactionEvent, PatronTransactionEventType } from '../../../patron-transaction';
import { OrganisationService } from '../../../../service/organisation.service';
import { PatronTransactionEvent, PatronTransactionEventType } from '../../../patron-transaction';

@Component({
selector: 'admin-patron-transaction-event',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ <h6 translate>Details</h6>
<div class="row" *ngIf="transaction.document.pid | getRecord:'documents' | async as document">
<div class="col-sm-2 label-title text-right" translate>Document</div>
<div class="col-sm-10">
<a [routerLink]="['/records','documents','detail', transaction.document.pid]">
{{ document.metadata.title | truncateText: 15 }}
<a [routerLink]="['/records','documents','detail', transaction.document.pid]"
*ngIf="getMainTitle(document.metadata.title) != null">
{{ getMainTitle(document.metadata.title) | truncateText: 15 }}
</a>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { BsModalService } from 'ngx-bootstrap';
import { Component, Input, OnInit } from '@angular/core';
import { RecordService } from '@rero/ng-core';
import { BsModalService } from 'ngx-bootstrap';
import { MainTitleService } from 'projects/admin/src/app/service/main-title.service';
import { map, mergeMap } from 'rxjs/operators';
import { OrganisationService } from '../../../../service/organisation.service';
import { Item } from '../../../items';
import { PatronTransaction, PatronTransactionEventType, PatronTransactionStatus } from '../../../patron-transaction';
import {
PatronTransactionEventFormComponent
} from '../patron-transaction-event-form/patron-transaction-event-form.component';
import { PatronTransactionService } from '../../../patron-transaction.service';
import { OrganisationService } from '../../../../service/organisation.service';
import { RecordService } from '@rero/ng-core';
import { map, mergeMap } from 'rxjs/operators';
import { PatronTransactionEventFormComponent } from '../patron-transaction-event-form/patron-transaction-event-form.component';


@Component({
Expand All @@ -32,8 +31,9 @@ export class PatronTransactionComponent implements OnInit {
private _recordService: RecordService,
private _organisationService: OrganisationService,
private _patronTransactionService: PatronTransactionService,
private _modalService: BsModalService
) { }
private _modalService: BsModalService,
private _mainTitleService: MainTitleService
) {}

ngOnInit() {
this._loadLinkedItem();
Expand Down Expand Up @@ -110,4 +110,12 @@ export class PatronTransactionComponent implements OnInit {
};
this._modalService.show(PatronTransactionEventFormComponent, {initialState});
}

/**
* Get main title (correspondig to 'bf_Title' type, present only once in metadata)
* @param titleMetadata: title metadata
*/
getMainTitle(titleMetadata: any): string {
return this._mainTitleService.getMainTitle(titleMetadata);
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { BsModalService } from 'ngx-bootstrap';
import { Component, OnDestroy, OnInit } from '@angular/core';
import { BsModalService } from 'ngx-bootstrap';
import { Subscription } from 'rxjs';
import { User } from '../../../class/user';
import { OrganisationService } from '../../../service/organisation.service';
import { PatronService } from '../../../service/patron.service';
import { PatronTransaction, PatronTransactionStatus } from '../../patron-transaction';
import { PatronTransactionEventFormComponent } from './patron-transaction-event-form/patron-transaction-event-form.component';
import { PatronTransactionService } from '../../patron-transaction.service';
import { Subscription } from 'rxjs';
import { User } from '../../../class/user';
import { PatronTransactionEventFormComponent } from './patron-transaction-event-form/patron-transaction-event-form.component';

@Component({
selector: 'admin-patron-transactions',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
<!--
RERO ILS UI
Copyright (C) 2020 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 <http://www.gnu.org/licenses/>.
Copyright (C) 2020 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 <http://www.gnu.org/licenses/>.
-->
<ng-container *ngIf="item && loan; else loading">
<!-- BARCODE -->
<div class="col-sm-2">
<a [routerLink]="['/records', 'items', 'detail', item.pid]">{{ item.barcode }}</a>
</div>
<!-- TITLE -->
<div class="col-sm-5"><a [routerLink]="['/records', 'documents', 'detail', item.document.pid]">{{ item.document.title }}</a>
<div class="col-sm-5"><a [routerLink]="['/records', 'documents', 'detail', item.document.pid]"
*ngIf="getMainTitle(item.document.title) != null">
{{ getMainTitle(item.document.title) }}</a>
</div>
<!-- PICKUP LOCATION -->
<div class="col-sm-3">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Component, OnInit, Input } from '@angular/core';
import { Component, Input, OnInit } from '@angular/core';
import { RecordService } from '@rero/ng-core';
import { PatronService } from 'projects/admin/src/app/service/patron.service';
import { MainTitleService } from '../../../../service/main-title.service';
import { PatronService } from '../../../../service/patron.service';

@Component({
selector: 'admin-pickup-item',
Expand All @@ -41,7 +42,8 @@ export class PickupItemComponent implements OnInit {
*/
constructor(
private _recordService: RecordService,
private _patronService: PatronService
private _patronService: PatronService,
private _mainTitleService: MainTitleService
) { }

/**
Expand All @@ -57,4 +59,12 @@ export class PickupItemComponent implements OnInit {
});
}
}

/**
* Get main title (correspondig to 'bf_Title' type, present only once in metadata)
* @param titleMetadata: title metadata
*/
getMainTitle(titleMetadata: any): string {
return this._mainTitleService.getMainTitle(titleMetadata);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
<a [routerLink]="['/records', 'items', 'detail', item.pid]">{{ item.barcode }}</a>
</div>
<!-- TITLE -->
<div class="col-sm-5"><a [routerLink]="['/records', 'documents', 'detail', item.document.pid]">{{ item.document.title }}</a>
<div class="col-sm-5"><a [routerLink]="['/records', 'documents', 'detail', item.document.pid]"
*ngIf="getMainTitle(item.document.title) != null">
{{ getMainTitle(item.document.title) }}</a>
</div>
<!-- EXPECTED AVAILABILITY -->
<div class="col-sm-3">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Component, OnInit, Input } from '@angular/core';
import { Component, Input, OnInit } from '@angular/core';
import { RecordService } from '@rero/ng-core';
import { PatronService } from 'projects/admin/src/app/service/patron.service';
import { MainTitleService } from '../../../../service/main-title.service';
import { PatronService } from '../../../../service/patron.service';

@Component({
selector: 'admin-requested-item',
Expand All @@ -41,7 +42,8 @@ export class RequestedItemComponent implements OnInit {
*/
constructor(
private _recordService: RecordService,
private _patronService: PatronService
private _patronService: PatronService,
private _mainTitleService: MainTitleService
) { }

/**
Expand All @@ -57,4 +59,12 @@ export class RequestedItemComponent implements OnInit {
});
}
}

/**
* Get main title (correspondig to 'bf_Title' type, present only once in metadata)
* @param titleMetadata: title metadata
*/
getMainTitle(titleMetadata: any): string {
return this._mainTitleService.getMainTitle(titleMetadata);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
<tbody *ngIf="items && items.length">
<tr [ngClass]="{'table-success': item.loan.state !== 'PENDING'}"
*ngFor="let item of items">
<td><span *ngIf="item.document.title">{{ item.document.title }}</span></td>
<td><span *ngIf="getMainTitle(item.document.title) != null">
{{ getMainTitle(item.document.title) }}</span></td>
<td class="text-right">
{{ item.barcode }}
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

import { Component, Input } from '@angular/core';
import { MainTitleService } from '../../service/main-title.service';

@Component({
selector: 'admin-circulation-requested-items-list',
Expand All @@ -25,4 +26,14 @@ export class RequestedItemsListComponent {

@Input() items: any[];

constructor(private _mainTitleService: MainTitleService) {}

/**
* Get main title (correspondig to 'bf_Title' type, present only once in metadata)
* @param titleMetadata: title metadata
*/
getMainTitle(titleMetadata: any): string {
return this._mainTitleService.getMainTitle(titleMetadata);
}

}
Loading

0 comments on commit 4e4eb21

Please sign in to comment.