Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ill requests: improve pro patron view #1070

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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},
sort: 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, sort)
.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-4 d-flex">
<button type="button" class="btn-show-more"
[ngClass]="{'btn-expanded': !isCollapsed, 'btn-collapsed': isCollapsed}"
(click)="isCollapsed = !isCollapsed"
Expand All @@ -28,8 +28,12 @@
<div class="small">{{ record.metadata.document.authors }}</div>
</div>
</div>
<div class="col-2 text-right">
<div class="col-3">{{ 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>
</div>
<div class="col-1 text-right">
<a 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-4" translate>Document</div>
<div class="col-3" 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
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ <h6 class="card-header">
</dd>
<dt class="col-sm-5 col-md-3 col-lg-2 offset-1 label-title" translate>Request date</dt>
<dd class="col-sm-6 col-md-8 col-lg-9 mb-1">{{ record.created | dateTranslate : 'medium' }}</dd>
<dt class="col-sm-5 col-md-3 col-lg-2 offset-1 label-title" translate>Status</dt>
<dt class="col-sm-5 col-md-3 col-lg-2 offset-1 label-title" translate>Request status</dt>
<dd class="col-sm-6 col-md-8 col-lg-9 mb-1">
<span class="badge badge-{{ badgeColor(record.metadata.status) }} px-2 py-1" translate>
{{ record.metadata.status }}
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,
sort: 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, sort);
}
}