diff --git a/src/app/modules/library/account/account.page.html b/src/app/modules/library/account/account.page.html
index 1c3c7f30..2c5b61be 100644
--- a/src/app/modules/library/account/account.page.html
+++ b/src/app/modules/library/account/account.page.html
@@ -35,7 +35,7 @@
{{ 'library.account.pages.profile.title' | translate | titlecase }}
-
+
{{ 'library.account.pages.holds.title' | translate | titlecase }}
diff --git a/src/app/modules/library/account/checked-out/checked-out-page.component.ts b/src/app/modules/library/account/checked-out/checked-out-page.component.ts
index bcaa7526..7e660780 100644
--- a/src/app/modules/library/account/checked-out/checked-out-page.component.ts
+++ b/src/app/modules/library/account/checked-out/checked-out-page.component.ts
@@ -1,5 +1,5 @@
import {Component} from '@angular/core';
-import {DocumentAction, PAIADocument} from '../../types';
+import {DocumentAction, PAIADocument, PAIADocumentStatus} from '../../types';
import {LibraryAccountService} from '../library-account.service';
@Component({
@@ -27,8 +27,9 @@ export class CheckedOutPageComponent {
async fetchItems() {
try {
this.checkedOutItems = undefined;
- this.checkedOutItems =
- await this.libraryAccountService.getCheckedOutItems();
+ this.checkedOutItems = await this.libraryAccountService.getFilteredItems([
+ PAIADocumentStatus.Held,
+ ]);
} catch {
await this.libraryAccountService.handleError();
this.checkedOutItems = [];
diff --git a/src/app/modules/library/account/holds-and-reservations/holds-and-reservations-page.html b/src/app/modules/library/account/holds-and-reservations/holds-and-reservations-page.html
deleted file mode 100644
index 375d7d75..00000000
--- a/src/app/modules/library/account/holds-and-reservations/holds-and-reservations-page.html
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-
-
-
- {{
- 'library.account.pages.holds.title' | translate | titlecase
- }}
-
-
-
-
-
- {{
- 'library.account.pages.holds.holds' | translate
- }}
-
-
- {{
- 'library.account.pages.holds.reservations' | translate
- }}
-
-
- 0; else fallback">
-
-
-
-
-
-
-
- {{ 'search.nothing_found' | translate | titlecase }}
-
-
-
-
diff --git a/src/app/modules/library/account/holds-and-reservations/holds-and-reservations-page.component.ts b/src/app/modules/library/account/holds/holds-page.component.ts
similarity index 56%
rename from src/app/modules/library/account/holds-and-reservations/holds-and-reservations-page.component.ts
rename to src/app/modules/library/account/holds/holds-page.component.ts
index 9a4bdb85..f21058ae 100644
--- a/src/app/modules/library/account/holds-and-reservations/holds-and-reservations-page.component.ts
+++ b/src/app/modules/library/account/holds/holds-page.component.ts
@@ -2,34 +2,45 @@ import {Component} from '@angular/core';
import {DocumentAction, PAIADocument, PAIADocumentStatus} from '../../types';
import {LibraryAccountService} from '../library-account.service';
+type Segment = 'orders' | 'reservations';
+
@Component({
- selector: 'app-holds-and-reservations',
- templateUrl: './holds-and-reservations-page.html',
- styleUrls: ['./holds-and-reservations-page.scss'],
+ selector: 'stapps-holds',
+ templateUrl: './holds-page.html',
+ styleUrls: ['./holds-page.scss'],
})
-export class HoldsAndReservationsPageComponent {
+export class HoldsPageComponent {
paiaDocuments?: PAIADocument[];
paiaDocumentStatus = PAIADocumentStatus;
+ activeSegment: Segment = 'orders';
+
constructor(private readonly libraryAccountService: LibraryAccountService) {}
async ionViewWillEnter(): Promise {
- await this.fetchItems();
+ await this.fetchItems(this.activeSegment);
}
- async fetchItems(status: PAIADocumentStatus = PAIADocumentStatus.Ordered) {
+ async fetchItems(segment: Segment) {
+ this.activeSegment = segment;
this.paiaDocuments = undefined;
+ const itemsStatus =
+ segment === 'reservations'
+ ? [PAIADocumentStatus.Reserved]
+ : [PAIADocumentStatus.Ordered, PAIADocumentStatus.Provided];
try {
- this.paiaDocuments = await (Number(status) === PAIADocumentStatus.Ordered
- ? this.libraryAccountService.getHolds()
- : this.libraryAccountService.getReservations());
+ this.paiaDocuments = await this.libraryAccountService.getFilteredItems(
+ itemsStatus,
+ );
} catch {
await this.libraryAccountService.handleError();
this.paiaDocuments = [];
}
}
+ toNumber = Number;
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async segmentChanged(event: any) {
await this.fetchItems(event.detail.value);
@@ -40,6 +51,6 @@ export class HoldsAndReservationsPageComponent {
documentAction,
);
- if (answer) await this.fetchItems();
+ if (answer) await this.fetchItems(this.activeSegment);
}
}
diff --git a/src/app/modules/library/account/holds/holds-page.html b/src/app/modules/library/account/holds/holds-page.html
new file mode 100644
index 00000000..a1eff968
--- /dev/null
+++ b/src/app/modules/library/account/holds/holds-page.html
@@ -0,0 +1,81 @@
+
+
+
+
+
+ {{
+ 'library.account.pages.holds.title' | translate | titlecase
+ }}
+
+
+
+
+
+ {{
+ 'library.account.pages.holds.holds' | translate
+ }}
+
+
+ {{
+ 'library.account.pages.holds.reservations' | translate
+ }}
+
+
+ 0; else fallback">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ 'search.nothing_found' | translate | titlecase }}
+
+
+
+
diff --git a/src/app/modules/library/account/holds-and-reservations/holds-and-reservations-page.scss b/src/app/modules/library/account/holds/holds-page.scss
similarity index 100%
rename from src/app/modules/library/account/holds-and-reservations/holds-and-reservations-page.scss
rename to src/app/modules/library/account/holds/holds-page.scss
diff --git a/src/app/modules/library/account/library-account.service.ts b/src/app/modules/library/account/library-account.service.ts
index 16c96a04..516ba272 100644
--- a/src/app/modules/library/account/library-account.service.ts
+++ b/src/app/modules/library/account/library-account.service.ts
@@ -125,21 +125,11 @@ export class LibraryAccountService {
return input.split(':').pop();
}
- async getHolds() {
+ async getFilteredItems(documentStatus: PAIADocumentStatus[]) {
return (await this.getItems())?.doc.filter(document => {
- return [PAIADocumentStatus.Ordered].includes(Number(document.status));
- });
- }
-
- async getReservations() {
- return (await this.getItems())?.doc.filter(document => {
- return [PAIADocumentStatus.Reserved].includes(Number(document.status));
- });
- }
-
- async getCheckedOutItems() {
- return (await this.getItems())?.doc.filter(document => {
- return PAIADocumentStatus.Held === Number(document.status);
+ return documentStatus.includes(
+ Number(document.status) as PAIADocumentStatus,
+ );
});
}
diff --git a/src/app/modules/library/library.module.ts b/src/app/modules/library/library.module.ts
index ae5a5bbb..8cef1d92 100644
--- a/src/app/modules/library/library.module.ts
+++ b/src/app/modules/library/library.module.ts
@@ -22,7 +22,7 @@ import {TranslateModule} from '@ngx-translate/core';
import {LibraryAccountPageComponent} from './account/account.page';
import {ProfilePageComponent} from './account/profile/profile-page.component';
import {CheckedOutPageComponent} from './account/checked-out/checked-out-page.component';
-import {HoldsAndReservationsPageComponent} from './account/holds-and-reservations/holds-and-reservations-page.component';
+import {HoldsPageComponent} from './account/holds/holds-page.component';
import {FinesPageComponent} from './account/fines/fines-page.component';
import {PAIAItemComponent} from './account/elements/paia-item/paiaitem.component';
import {FirstLastNamePipe} from './account/first-last-name.pipe';
@@ -54,8 +54,8 @@ const routes: ProtectedRoutes | Routes = [
canActivate: [AuthGuardService],
},
{
- path: 'library-account/holds-and-reservations',
- component: HoldsAndReservationsPageComponent,
+ path: 'library-account/holds',
+ component: HoldsPageComponent,
data: {authProvider: 'paia'},
canActivate: [AuthGuardService],
},
@@ -83,7 +83,7 @@ const routes: ProtectedRoutes | Routes = [
LibraryAccountPageComponent,
ProfilePageComponent,
CheckedOutPageComponent,
- HoldsAndReservationsPageComponent,
+ HoldsPageComponent,
FinesPageComponent,
PAIAItemComponent,
FirstLastNamePipe,
diff --git a/src/app/modules/library/types.ts b/src/app/modules/library/types.ts
index 562fad3c..dcdf33a7 100644
--- a/src/app/modules/library/types.ts
+++ b/src/app/modules/library/types.ts
@@ -24,6 +24,12 @@ export interface PAIAPatron {
note?: string;
}
+/*
+ * Document representing a library item received from the HeBIS PAIA service
+ * TODO: would be good to standardize the items of HeBIS PAIA to match the official PAIA documentation
+ * e.g. status should be number (0-5), and queue, renewals, reminder should be numbers too
+ * https://gbv.github.io/paia/paia.html#documents
+ */
export interface PAIADocument {
status: string;
item?: string;
@@ -37,6 +43,7 @@ export interface PAIADocument {
duedate?: string;
cancancel?: boolean;
canrenew?: boolean;
+ storage?: string;
// with locations
condition?: unknown;
}
diff --git a/src/app/modules/profile/page/sections.ts b/src/app/modules/profile/page/sections.ts
index 5f4b4a07..5213248c 100644
--- a/src/app/modules/profile/page/sections.ts
+++ b/src/app/modules/profile/page/sections.ts
@@ -187,10 +187,10 @@ export const profilePageSections: SCSection[] = [
...SCSectionLinkConstantValues,
},
{
- name: 'Holdings & Reservations',
+ name: 'Orders & Reservations',
icon: SCIcon`collections_bookmark`,
needsAuth: true,
- link: ['/library-account/holds-and-reservations'],
+ link: ['/library-account/holds'],
translations: {
de: {
name: 'Bestellungen & Vormerkungen',
diff --git a/src/assets/i18n/de.json b/src/assets/i18n/de.json
index 2ed5b2b3..82955d53 100644
--- a/src/assets/i18n/de.json
+++ b/src/assets/i18n/de.json
@@ -273,7 +273,8 @@
"title": "Titel",
"about": "Mehr Informationen",
"label": "Signatur",
- "endtime": "Zum Abholen bis"
+ "endtime": "Abzuholen bis",
+ "storage": "Abholbereit"
},
"holds": "Bestellungen",
"reservations": "Vormerkungen"
diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json
index 0a241fda..5df64a73 100644
--- a/src/assets/i18n/en.json
+++ b/src/assets/i18n/en.json
@@ -268,14 +268,15 @@
}
},
"holds": {
- "title": "holds and reservations",
+ "title": "Orders and reservations",
"labels": {
"title": "Title",
"about": "More information",
- "label": "Label",
- "endtime": "Available for pickup until"
+ "label": "Shelfmark",
+ "endtime": "Available for pickup until",
+ "storage": "Available for pickup"
},
- "holds": "holds",
+ "holds": "orders",
"reservations": "reservations"
},
"checked_out": {