Skip to content

Commit

Permalink
ill requests: improve pro patron view
Browse files Browse the repository at this point in the history
* Sorts ILL Requests by descending created-date in the ApiService.
* Displays the ILL 'request date' and 'pickup location' inline instead
of in the collapsible details.

Co-Authored-by: Pascal Repond <pascal.repond@rero.ch>
  • Loading branch information
PascalRepond committed Nov 8, 2023
1 parent de225cd commit 6761143
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 16 deletions.
8 changes: 6 additions & 2 deletions projects/admin/src/app/api/ill-request-api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,15 @@ export class IllRequestApiService extends BaseApi {
* @param filters - criteria to apply on the query to filter the result.
* @returns Array of ill request record
*/
getByPatronPid(patronPid: string, filters?: {[key: string]: string}): Observable<Record | Error> {
getByPatronPid(
patronPid: string,
filters?: {[key: string]: string},
order: string = '-created'
): Observable<Record | Error> {
const query = `patron.pid:${patronPid}`;
return this._recordService
.getRecords(this.RESOURCE_NAME, query , 1, RecordService.MAX_REST_RESULTS_SIZE,
undefined, filters, BaseApi.reroJsonheaders, 'created')
undefined, filters, BaseApi.reroJsonheaders, order)
.pipe(map((result: Record) => result.hits.hits));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
-->
<div class="row item">
<!-- MAIN ROW :: title, authors, status and action buttons ============== -->
<div class="col-10 d-flex">
<div class="col-5 d-flex">
<button type="button" class="btn-show-more"
[ngClass]="{'btn-expanded': !isCollapsed, 'btn-collapsed': isCollapsed}"
(click)="isCollapsed = !isCollapsed"
Expand All @@ -28,9 +28,13 @@
<div class="small">{{ record.metadata.document.authors }}</div>
</div>
</div>
<div class="col-2 text-right">
<div class="col-2">{{ record.metadata.pickup_location.name }}</div>
<div class="col-2">{{ record.created | dateTranslate:'medium'}}</div>
<div class="col-2">
<span class="mr-3 badge badge-{{ badgeColor(record.metadata.loan_status) }}" translate>{{ record.metadata.loan_status }}</span>
<a class="btn btn-sm btn-link btn-outline-primary"
</div>
<div class="col-1 text-right">
<div class="btn btn-sm btn-link btn-outline-primary"
title="{{ 'Details' | translate }}"
[routerLink]="['/', 'records', 'ill_requests', 'detail', record.metadata.pid]"
>
Expand Down Expand Up @@ -64,14 +68,6 @@
</ng-container>
</dd>
</ng-container>
<!-- PICKUP LOCATION -->
<dt class="offset-1 col-1 label-title" translate>Pickup location</dt>
<dd class="col-10 mb-0">{{ record.metadata.pickup_location.name }}</dd>
<!-- STATUS -->
<dt class="offset-1 col-1 label-title" translate>Status</dt>
<dd class="col-10 mb-0">
<span class="badge badge-{{badgeColor(record.metadata.status)}}" translate>{{ record.metadata.status }}</span>
</dd>
<!-- SCOPE -->
<dt class="offset-1 col-1 label-title" translate>Scope</dt>
<dd class="col-10 mb-0">
Expand All @@ -91,6 +87,11 @@
<span class="badge badge-light px-2 py-1 ml-2">{{ record.metadata.found_in.source }}</span>
</dd>
</ng-container>
<!-- STATUS -->
<dt class="offset-1 col-1 label-title" translate>Request status</dt>
<dd class="col-10 mb-0">
<span class="badge badge-{{badgeColor(record.metadata.status)}}" translate>{{ record.metadata.status }}</span>
</dd>
<!-- NOTES -->
<ng-container *ngIf="record.metadata.notes && record.metadata.notes.length > 0">
<dt class="offset-1 col-1 label-title" translate>Note</dt>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
<ng-container *ngIf="illRequests.length > 0; else noResult">
<!-- HEADER -->
<div class="row p-2 mb-1 bg-dark rounded text-light">
<div class="col-10" translate>Title</div>
<div class="col-5" translate>Document</div>
<div class="col-2" translate>Pickup location</div>
<div class="col-2" translate>Request date</div>
<div class="col-2" translate>Loan status</div>
<div class="col-1" translate>&nbsp;</div>
</div>
<admin-ill-request-item [record]="record" *ngFor="let record of illRequests"></admin-ill-request-item>
</ng-container>
Expand Down
5 changes: 3 additions & 2 deletions projects/public-search/src/app/api/ill-request-api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ export class IllRequestApiService extends BaseApi {
patronPid: string,
page: number,
itemsPerPage: number = 10,
headers = BaseApi.reroJsonheaders
headers = BaseApi.reroJsonheaders,
order: string = '-created'
): Observable<Record | Error> {
const query = `patron.pid:${patronPid} AND -status:denied AND -status:closed AND -loan_status:ITEM_RETURNED`;
return this._recordService.getRecords('ill_requests', query, page, itemsPerPage, undefined, undefined, headers);
return this._recordService.getRecords('ill_requests', query, page, itemsPerPage, undefined, undefined, headers, order);
}
}

0 comments on commit 6761143

Please sign in to comment.