mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-07 05:52:57 +00:00
@@ -14,7 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {Component, EventEmitter, Input, Output} from '@angular/core';
|
import {Component, EventEmitter, Input, Output} from '@angular/core';
|
||||||
import {DocumentAction, PAIADocument, PAIADocumentStatus} from '../../../types';
|
import {DocumentAction, PAIADocument, PAIADocumentStatus, PAIADocumentVisualStatus} from '../../../types';
|
||||||
import {LibraryAccountService} from '../../library-account.service';
|
import {LibraryAccountService} from '../../library-account.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -27,12 +27,15 @@ export class PAIAItemComponent {
|
|||||||
|
|
||||||
renewable: boolean;
|
renewable: boolean;
|
||||||
|
|
||||||
|
visualStatus?: PAIADocumentVisualStatus;
|
||||||
|
|
||||||
constructor(private readonly libraryAccountService: LibraryAccountService) {}
|
constructor(private readonly libraryAccountService: LibraryAccountService) {}
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
set item(value: PAIADocument) {
|
set item(value: PAIADocument) {
|
||||||
this._item = value;
|
this._item = value;
|
||||||
void this.setRenewable();
|
void this.setRenewable();
|
||||||
|
this.visualStatus = this.getVisualStatus(Number(this.item.status));
|
||||||
}
|
}
|
||||||
|
|
||||||
get item(): PAIADocument {
|
get item(): PAIADocument {
|
||||||
@@ -56,4 +59,18 @@ export class PAIAItemComponent {
|
|||||||
const isActive = await this.libraryAccountService.isActivePatron();
|
const isActive = await this.libraryAccountService.isActivePatron();
|
||||||
this.renewable = isActive && Number(this.item.status) === PAIADocumentStatus.Held;
|
this.renewable = isActive && Number(this.item.status) === PAIADocumentStatus.Held;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private getVisualStatus(status: PAIADocumentStatus): PAIADocumentVisualStatus | undefined {
|
||||||
|
switch (status) {
|
||||||
|
case PAIADocumentStatus.Ordered: {
|
||||||
|
return {color: 'warning', status: status, statusText: 'ordered'};
|
||||||
|
}
|
||||||
|
case PAIADocumentStatus.Provided: {
|
||||||
|
return {color: 'success', status: status, statusText: 'ready'};
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,10 +14,16 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<ion-item>
|
<ion-item>
|
||||||
<!-- TODO: text not selectable in Chrome, bugfix needed https://github.com/ionic-team/ionic-framework/issues/24956 -->
|
|
||||||
<ion-label class="ion-text-wrap">
|
<ion-label class="ion-text-wrap">
|
||||||
@if (item.about) {
|
@if (item.about) {
|
||||||
<h2 class="name">{{ item.about }}</h2>
|
<h2 class="name">
|
||||||
|
@if (visualStatus) {
|
||||||
|
<ion-badge [color]="visualStatus.color" slot="start">
|
||||||
|
{{ 'library.account.pages' + '.' + listName + '.' + visualStatus.statusText | translate }}
|
||||||
|
</ion-badge>
|
||||||
|
}
|
||||||
|
{{ item.about }}
|
||||||
|
</h2>
|
||||||
}
|
}
|
||||||
@for (property of propertiesToShow; track property) {
|
@for (property of propertiesToShow; track property) {
|
||||||
@if (item[property]) {
|
@if (item[property]) {
|
||||||
|
|||||||
@@ -12,3 +12,6 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with
|
* You should have received a copy of the GNU General Public License along with
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
ion-badge {
|
||||||
|
vertical-align: bottom;
|
||||||
|
}
|
||||||
|
|||||||
@@ -35,23 +35,13 @@
|
|||||||
@switch (activeSegment) {
|
@switch (activeSegment) {
|
||||||
@case ('orders') {
|
@case ('orders') {
|
||||||
@for (hold of paiaDocuments; track hold) {
|
@for (hold of paiaDocuments; track hold) {
|
||||||
@if (toNumber(hold.status) === paiaDocumentStatus.Provided) {
|
<stapps-paia-item
|
||||||
<stapps-paia-item
|
[item]="hold"
|
||||||
[item]="hold"
|
[propertiesToShow]="['label', 'storage']"
|
||||||
[propertiesToShow]="['label', 'storage']"
|
(documentAction)="onDocumentAction($event)"
|
||||||
(documentAction)="onDocumentAction($event)"
|
listName="holds"
|
||||||
listName="holds"
|
>
|
||||||
>
|
</stapps-paia-item>
|
||||||
</stapps-paia-item>
|
|
||||||
} @else {
|
|
||||||
<stapps-paia-item
|
|
||||||
[item]="hold"
|
|
||||||
[propertiesToShow]="['label']"
|
|
||||||
(documentAction)="onDocumentAction($event)"
|
|
||||||
listName="holds"
|
|
||||||
>
|
|
||||||
</stapps-paia-item>
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@case ('reservations') {
|
@case ('reservations') {
|
||||||
|
|||||||
@@ -88,3 +88,9 @@ export interface DocumentAction {
|
|||||||
action: 'cancel' | 'renew';
|
action: 'cancel' | 'renew';
|
||||||
doc: PAIADocument;
|
doc: PAIADocument;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface PAIADocumentVisualStatus {
|
||||||
|
color: 'warning' | 'success';
|
||||||
|
status: PAIADocumentStatus;
|
||||||
|
statusText: 'ordered' | 'ready';
|
||||||
|
}
|
||||||
|
|||||||
@@ -336,13 +336,15 @@
|
|||||||
"title": "Titel",
|
"title": "Titel",
|
||||||
"about": "Mehr Informationen",
|
"about": "Mehr Informationen",
|
||||||
"label": "Signatur",
|
"label": "Signatur",
|
||||||
"starttime": "Übermittelt am",
|
"starttime": "Vorgemerkt am",
|
||||||
"endtime": "Abzuholen bis",
|
"endtime": "Abzuholen bis",
|
||||||
"storage": "Abholtheke",
|
"storage": "Abholtheke",
|
||||||
"queue": "Position in der Warteschlange"
|
"queue": "Position in der Warteschlange"
|
||||||
},
|
},
|
||||||
"holds": "Bestellungen",
|
"holds": "Bestellungen",
|
||||||
"reservations": "Vormerkungen"
|
"reservations": "Vormerkungen",
|
||||||
|
"ordered": "Bestellt",
|
||||||
|
"ready": "Abholbereit"
|
||||||
},
|
},
|
||||||
"checked_out": {
|
"checked_out": {
|
||||||
"title": "Deine Ausleihen",
|
"title": "Deine Ausleihen",
|
||||||
|
|||||||
@@ -336,13 +336,15 @@
|
|||||||
"title": "Title",
|
"title": "Title",
|
||||||
"about": "More information",
|
"about": "More information",
|
||||||
"label": "Shelfmark",
|
"label": "Shelfmark",
|
||||||
"starttime": "Submitted at",
|
"starttime": "Reserved on",
|
||||||
"endtime": "Available for pickup until",
|
"endtime": "Available for pickup until",
|
||||||
"storage": "Pick-up counter",
|
"storage": "Pickup counter",
|
||||||
"queue": "Position in the queue"
|
"queue": "Position in the queue"
|
||||||
},
|
},
|
||||||
"holds": "orders",
|
"holds": "orders",
|
||||||
"reservations": "reservations"
|
"reservations": "reservations",
|
||||||
|
"ordered": "Ordered",
|
||||||
|
"ready": "Ready for pickup"
|
||||||
},
|
},
|
||||||
"checked_out": {
|
"checked_out": {
|
||||||
"title": "checked out items",
|
"title": "checked out items",
|
||||||
|
|||||||
Reference in New Issue
Block a user