forked from rero/rero-ils-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adds a new tab to display pending ILL requests. * Fixes the problem on separator parameter in JournalVolume pipe. * Fixes the typing of the journal parameter to the JournalVolume pipe. * Closes rero/rero-ils#2165. Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
1 parent
8e136bb
commit ec8e249
Showing
16 changed files
with
452 additions
and
36 deletions.
There are no files selected for viewing
125 changes: 125 additions & 0 deletions
125
projects/admin/src/app/api/ill-request-api.service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
/* | ||
* RERO ILS UI | ||
* Copyright (C) 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 | ||
* 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/>. | ||
*/ | ||
import { TestBed } from '@angular/core/testing'; | ||
|
||
import { HttpClientTestingModule } from '@angular/common/http/testing'; | ||
import { TranslateModule } from '@ngx-translate/core'; | ||
import { RecordModule, RecordService } from '@rero/ng-core'; | ||
import { of } from 'rxjs'; | ||
import { IllRequestApiService } from './ill-request-api.service'; | ||
|
||
describe('IllRequestApiService', () => { | ||
let service: IllRequestApiService; | ||
|
||
const response = { | ||
"aggregations": { | ||
}, | ||
"hits": { | ||
"hits": [ | ||
{ | ||
"created": "2023-04-25T06:40:01.498787+00:00", | ||
"id": "1", | ||
"links": { | ||
"self": "https://localhost:5000/api/ill_requests/1" | ||
}, | ||
"metadata": { | ||
"$schema": "https://bib.rero.ch/schemas/ill_requests/ill_request-v0.0.1.json", | ||
"copy": false, | ||
"document": { | ||
"authors": "Aly Badr, Cairo University", | ||
"identifier": "9780123456789", | ||
"publisher": "Cairo University Press", | ||
"source": { | ||
"journal_title": "Mon titre de revue", | ||
"number": "1", | ||
"volume": "12" | ||
}, | ||
"title": "Histoire d'Égypte", | ||
"year": "1920" | ||
}, | ||
"found_in": { | ||
"source": "BGE", | ||
"url": "http://data.rero.ch/01-R007878671/html?view=GE_V1" | ||
}, | ||
"library": { | ||
"pid": "1" | ||
}, | ||
"notes": [ | ||
{ | ||
"content": "Une note prof", | ||
"type": "staff_note" | ||
}, | ||
{ | ||
"content": "Une note publique", | ||
"type": "public_note" | ||
} | ||
], | ||
"organisation": { | ||
"pid": "1" | ||
}, | ||
"patron": { | ||
"name": "Premand, Alain", | ||
"pid": "9", | ||
"type": "ptrn" | ||
}, | ||
"pickup_location": { | ||
"name": "ILL AOSTE CANT1: Espaces publics", | ||
"pid": "1", | ||
"type": "loc" | ||
}, | ||
"pid": "1", | ||
"status": "pending" | ||
}, | ||
"updated": "2023-04-27T06:25:11.821222+00:00" | ||
} | ||
], | ||
"total": { | ||
"relation": "eq", | ||
"value": 1 | ||
} | ||
}, | ||
"links": {} | ||
}; | ||
|
||
const recordServiceSpy = jasmine.createSpyObj('RecordService', ['getRecords', 'totalHits']); | ||
recordServiceSpy.getRecords.and.returnValue(of(response)); | ||
recordServiceSpy.totalHits.and.returnValue(1); | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [ | ||
HttpClientTestingModule, | ||
RecordModule, | ||
TranslateModule.forRoot() | ||
], | ||
providers: [ | ||
{ provide: RecordService, useValue: recordServiceSpy }, | ||
] | ||
}); | ||
service = TestBed.inject(IllRequestApiService); | ||
}); | ||
|
||
it('should be created', () => { | ||
expect(service).toBeTruthy(); | ||
}); | ||
|
||
it('should turn the records around', () => { | ||
service.getByPatronPid('9').subscribe((result: any) => { | ||
expect(result).toEqual(response.hits.hits); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* RERO ILS UI | ||
* Copyright (C) 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 | ||
* 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/>. | ||
*/ | ||
import { Injectable } from '@angular/core'; | ||
import { Record, RecordService } from '@rero/ng-core'; | ||
import { Observable } from 'rxjs'; | ||
import { map } from 'rxjs/operators'; | ||
import { ILLRequestStatus } from '../classes/ill-request'; | ||
import { BaseApi } from '@rero/shared'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class IllRequestApiService extends BaseApi { | ||
|
||
/** Resource name */ | ||
readonly RESOURCE_NAME = 'ill_requests'; | ||
|
||
/** | ||
* Constructor | ||
* @param _recordService - RecordService | ||
*/ | ||
constructor(private _recordService: RecordService) { | ||
super(); | ||
} | ||
|
||
getByPatronPid(patronPid: string): Observable<Record | Error> { | ||
const query = `patron.pid:${patronPid} AND status:${ILLRequestStatus.PENDING}`; | ||
return this._recordService | ||
.getRecords( | ||
this.RESOURCE_NAME, query , 1, RecordService.MAX_REST_RESULTS_SIZE, | ||
undefined, undefined, BaseApi.reroJsonheaders, 'created' | ||
).pipe(map((result: Record) => result.hits.hits)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* RERO ILS UI | ||
* Copyright (C) 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 | ||
* 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/>. | ||
*/ | ||
|
||
@import 'bootstrap/scss/functions'; | ||
@import 'bootstrap/scss/variables'; | ||
|
||
.btn-hover { | ||
color: $black; | ||
background-color: $warning; | ||
// could be better to use ``@extend .btn:hover`` but it doesn't work for hover property | ||
} | ||
|
||
.item { | ||
margin-bottom: 0.25rem !important; | ||
padding: 0.25rem !important; | ||
border: $border-width solid $border-color; | ||
border-radius: $border-radius; | ||
position: relative; | ||
|
||
&:hover{ | ||
background-color: $light; | ||
} | ||
|
||
div.actions { | ||
position: absolute; | ||
top: 0.25rem; | ||
right: 15px; | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
...n/src/app/circulation/patron/ill-request/ill-request-item/ill-request-item.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<!-- | ||
RERO ILS UI | ||
Copyright (C) 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 | ||
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/>. | ||
--> | ||
<div class="row item"> | ||
<div class="col-sm-6" translate> | ||
<button type="button" class="btn-show-more" | ||
[ngClass]="{'btn-expanded': !isCollapsed, 'btn-collapsed': isCollapsed}" | ||
(click)="isCollapsed = !isCollapsed" | ||
[attr.aria-expanded]="!isCollapsed" aria-controls="collapse"> | ||
</button> | ||
{{ record.metadata.document.title }} | ||
</div> | ||
<div class="col-sm-5" translate>{{ record.metadata.document.authors }}</div> | ||
<div class="col-sm-1 text-right" translate> | ||
<a | ||
class="btn btn-sm btn-link btn-outline-primary" | ||
[routerLink]="['/', 'records', 'ill_requests', 'detail', record.metadata.pid]" | ||
> | ||
<i class="fa fa-eye" aria-hidden="true"></i> | ||
</a> | ||
</div> | ||
<div name="collapsed-details" class="col-12 mt-2" *ngIf="!isCollapsed"> | ||
<dl class="row"> | ||
<!-- PUBLISHER --> | ||
<ng-container *ngIf="record.metadata.document.publisher"> | ||
<dt class="offset-1 col-sm-3 col-md-2 col-lg-1 label-title" translate>Publisher</dt> | ||
<dd class="col-sm-8 col-md-9 col-lg-10 mb-0">{{ record.metadata.document.publisher }}</dd> | ||
</ng-container> | ||
|
||
<!-- YEAR --> | ||
<ng-container *ngIf="record.metadata.document.year"> | ||
<dt class="offset-1 col-sm-3 col-md-2 col-lg-1 label-title" translate>Year</dt> | ||
<dd class="col-sm-8 col-md-9 col-lg-10 mb-0">{{ record.metadata.document.year }}</dd> | ||
</ng-container> | ||
|
||
<!-- IDENTIFIER --> | ||
<ng-container *ngIf="record.metadata.document.identifier"> | ||
<dt class="offset-1 col-sm-3 col-md-2 col-lg-1 label-title" translate>Identifier</dt> | ||
<dd class="col-sm-8 col-md-9 col-lg-10 mb-0">{{ record.metadata.document.identifier }}</dd> | ||
</ng-container> | ||
|
||
<!-- SOURCE --> | ||
<ng-container *ngIf="record.metadata.document.source"> | ||
<dt class="offset-1 col-sm-3 col-md-2 col-lg-1 label-title" translate>Source</dt> | ||
<dd class="col-sm-8 col-md-9 col-lg-10 mb-0"> | ||
<ng-container *ngIf="record.metadata.document.source.volume || record.metadata.document.source.number"> | ||
{{ record.metadata.document.source | journalVolume }} | ||
</ng-container> | ||
</dd> | ||
</ng-container> | ||
|
||
<!-- PICKUP LOCATION --> | ||
<dt class="offset-1 col-sm-3 col-md-2 col-lg-1 label-title" translate>Pickup location</dt> | ||
<dd class="col-sm-8 col-md-9 col-lg-10 mb-0">{{ record.metadata.pickup_location.name }}</dd> | ||
|
||
<!-- SCOPE --> | ||
<dt class="offset-1 col-sm-3 col-md-2 col-lg-1 label-title" translate>Scope</dt> | ||
<dd class="col-sm-8 col-md-9 col-lg-10 mb-0"> | ||
<ng-container *ngIf="record.metadata.copy; else scopeLoan">{{ 'Copy' | translate }}</ng-container> | ||
<ng-template #scopeLoan>{{ 'Loan' | translate }}</ng-template> | ||
</dd> | ||
|
||
<!-- PAGES --> | ||
<ng-container *ngIf="record.metadata.copy && record.metadata.pages"> | ||
<dt class="offset-1 col-sm-3 col-md-2 col-lg-1 label-title" translate>Pages</dt> | ||
<dd class="col-sm-8 col-md-9 col-lg-10 mb-0">{{ record.metadata.pages }}</dd> | ||
</ng-container> | ||
|
||
<!-- FOUND IN --> | ||
<ng-container *ngIf="record.metadata.found_in"> | ||
<dt class="offset-1 col-sm-3 col-md-2 col-lg-1 label-title" translate>Found in</dt> | ||
<dd class="col-sm-8 col-md-9 col-lg-10 mb-0"> | ||
<a href="{{ record.metadata.found_in.url }}">{{ record.metadata.found_in.url }}</a> | ||
<span class="badge badge-light px-2 py-1 ml-2">{{ record.metadata.found_in.source }}</span> | ||
</dd> | ||
</ng-container> | ||
|
||
<!-- NOTES --> | ||
<ng-container *ngIf="record.metadata.notes && record.metadata.notes.length > 0"> | ||
<dt class="offset-1 col-sm-3 col-md-2 col-lg-1 label-title" translate>Note</dt> | ||
<dd class="col-sm-8 col-md-9 col-lg-10 mb-0"> | ||
<blockquote> | ||
<ul class="list-unstyled"> | ||
<li *ngFor="let note of record.metadata.notes" | ||
[innerHTML]="note.content | nl2br"> | ||
</li> | ||
</ul> | ||
</blockquote> | ||
</dd> | ||
</ng-container> | ||
</dl> | ||
</div> | ||
</div> |
Oops, something went wrong.