mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-22 09:32:41 +00:00
committed by
Rainer Killinger
parent
6b08af6a74
commit
42b860e417
@@ -147,6 +147,7 @@ export class AppComponent implements AfterContentInit {
|
|||||||
const toast = await this.toastController.create({
|
const toast = await this.toastController.create({
|
||||||
message: message,
|
message: message,
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
|
color: 'success',
|
||||||
});
|
});
|
||||||
await toast.present();
|
await toast.present();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ export class FeedbackPageComponent {
|
|||||||
'feedback.system_messages.success',
|
'feedback.system_messages.success',
|
||||||
),
|
),
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
|
color: 'success',
|
||||||
});
|
});
|
||||||
await toast.present();
|
await toast.present();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<stapps-paia-item
|
<stapps-paia-item
|
||||||
*ngFor="let checkedOutItem of checkedOutItems"
|
*ngFor="let checkedOutItem of checkedOutItems"
|
||||||
[item]="checkedOutItem"
|
[item]="checkedOutItem"
|
||||||
[propertiesToShow]="['endtime', 'label']"
|
[propertiesToShow]="['label', 'renewals', 'endtime']"
|
||||||
(documentAction)="onDocumentAction($event)"
|
(documentAction)="onDocumentAction($event)"
|
||||||
listName="checked_out"
|
listName="checked_out"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
<!-- {{ 'library.account.actions.cancel.header' | translate }}</ion-button-->
|
<!-- {{ 'library.account.actions.cancel.header' | translate }}</ion-button-->
|
||||||
<!-- >-->
|
<!-- >-->
|
||||||
<ion-button
|
<ion-button
|
||||||
*ngIf="item.canrenew"
|
[disabled]="!item.canrenew"
|
||||||
color="primary"
|
color="primary"
|
||||||
(click)="onClick('renew')"
|
(click)="onClick('renew')"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import {PAIATokenResponse} from '../../auth/paia/paia-token-response';
|
|||||||
import {AuthHelperService} from '../../auth/auth-helper.service';
|
import {AuthHelperService} from '../../auth/auth-helper.service';
|
||||||
import {ConfigProvider} from '../../config/config.provider';
|
import {ConfigProvider} from '../../config/config.provider';
|
||||||
import {TranslateService} from '@ngx-translate/core';
|
import {TranslateService} from '@ngx-translate/core';
|
||||||
import {AlertController} from '@ionic/angular';
|
import {AlertController, ToastController} from '@ionic/angular';
|
||||||
import {HebisSearchResponse} from '../../hebis/protocol/response';
|
import {HebisSearchResponse} from '../../hebis/protocol/response';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
@@ -57,6 +57,7 @@ export class LibraryAccountService {
|
|||||||
readonly configProvider: ConfigProvider,
|
readonly configProvider: ConfigProvider,
|
||||||
private readonly translateService: TranslateService,
|
private readonly translateService: TranslateService,
|
||||||
private readonly alertController: AlertController,
|
private readonly alertController: AlertController,
|
||||||
|
private readonly toastController: ToastController,
|
||||||
) {
|
) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||||
const config: SCFeatureConfigurationExtern = (
|
const config: SCFeatureConfigurationExtern = (
|
||||||
@@ -165,18 +166,28 @@ export class LibraryAccountService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cancelReservation(document: PAIADocument) {
|
async cancelReservation(document: PAIADocument) {
|
||||||
return this.performRequest<void>(
|
const result = await this.performRequest<void>(
|
||||||
`${this.baseUrl}/{patron}/cancel`,
|
`${this.baseUrl}/{patron}/cancel`,
|
||||||
'POST',
|
'POST',
|
||||||
{doc: [document]},
|
{doc: [document]},
|
||||||
);
|
);
|
||||||
|
if (result) {
|
||||||
|
void this.onSuccess('cancel');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renewLanding(document: PAIADocument) {
|
async renewLending(document: PAIADocument) {
|
||||||
return this.performRequest<void>(`${this.baseUrl}/{patron}/renew`, 'POST', {
|
const result = await this.performRequest<void>(
|
||||||
doc: [document],
|
`${this.baseUrl}/{patron}/renew`,
|
||||||
});
|
'POST',
|
||||||
|
{
|
||||||
|
doc: [document],
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (result) {
|
||||||
|
void this.onSuccess('renew');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async handleDocumentAction(documentAction: DocumentAction): Promise<boolean> {
|
async handleDocumentAction(documentAction: DocumentAction): Promise<boolean> {
|
||||||
@@ -187,7 +198,7 @@ export class LibraryAccountService {
|
|||||||
return this.cancelReservation(documentAction.doc);
|
return this.cancelReservation(documentAction.doc);
|
||||||
break;
|
break;
|
||||||
case 'renew':
|
case 'renew':
|
||||||
return this.renewLanding(documentAction.doc);
|
return this.renewLending(documentAction.doc);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const alert = await this.alertController.create({
|
const alert = await this.alertController.create({
|
||||||
@@ -234,4 +245,15 @@ export class LibraryAccountService {
|
|||||||
|
|
||||||
await alert.present();
|
await alert.present();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async onSuccess(action: DocumentAction['action']) {
|
||||||
|
const toast = await this.toastController.create({
|
||||||
|
message: this.translateService.instant(
|
||||||
|
`library.account.actions.${action}.success`,
|
||||||
|
),
|
||||||
|
duration: 2000,
|
||||||
|
color: 'success',
|
||||||
|
});
|
||||||
|
await toast.present();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,7 +284,8 @@
|
|||||||
"title": "Titel",
|
"title": "Titel",
|
||||||
"about": "Mehr Informationen",
|
"about": "Mehr Informationen",
|
||||||
"label": "Signatur",
|
"label": "Signatur",
|
||||||
"endtime": "Rückgabedatum"
|
"endtime": "Leihfristende",
|
||||||
|
"renewals": "Verlängerungen"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"fines": {
|
"fines": {
|
||||||
@@ -292,7 +293,7 @@
|
|||||||
"labels": {
|
"labels": {
|
||||||
"amount": "Betrag",
|
"amount": "Betrag",
|
||||||
"about": "Information",
|
"about": "Information",
|
||||||
"date": "Rückgabedatum",
|
"date": "Leihfristende",
|
||||||
"item": "Artikel",
|
"item": "Artikel",
|
||||||
"edition": "Ausgabe",
|
"edition": "Ausgabe",
|
||||||
"feetype": "Gebührenart",
|
"feetype": "Gebührenart",
|
||||||
@@ -304,13 +305,15 @@
|
|||||||
"actions": {
|
"actions": {
|
||||||
"cancel": {
|
"cancel": {
|
||||||
"header": "Vormerkung löschen",
|
"header": "Vormerkung löschen",
|
||||||
"text": "Bist Du dir sicher, die Vormerkung von \"{{value}}\" zu löschen?",
|
"text": "Soll die Vormerkung von \"{{value}}\" gelöscht werden?",
|
||||||
"unknown_book": "unbekanntem Titel"
|
"unknown_book": "unbekannter Titel",
|
||||||
|
"success": "Vormerkung erfolgreich gelöscht."
|
||||||
},
|
},
|
||||||
"renew": {
|
"renew": {
|
||||||
"header": "Ausleihfrist verlängern",
|
"header": "Ausleihfrist verlängern",
|
||||||
"text": "Bist Du dir sicher, die Ausleihfrist von \"{{value}}\" zu verlängern?",
|
"text": "Soll die Ausleihfrist von \"{{value}}\" verlängert werden?",
|
||||||
"unknown_book": "unbekanntem Titel"
|
"unknown_book": "unbekannter Titel",
|
||||||
|
"success": "Ausleihfrist erfolgreich verlängert."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,7 +284,8 @@
|
|||||||
"title": "Title",
|
"title": "Title",
|
||||||
"about": "More information",
|
"about": "More information",
|
||||||
"label": "Label",
|
"label": "Label",
|
||||||
"endtime": "Return date"
|
"endtime": "Due date",
|
||||||
|
"renewals": "Renewals"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"fines": {
|
"fines": {
|
||||||
@@ -292,7 +293,7 @@
|
|||||||
"labels": {
|
"labels": {
|
||||||
"amount": "Amount",
|
"amount": "Amount",
|
||||||
"about": "About",
|
"about": "About",
|
||||||
"date": "Return date",
|
"date": "Due date",
|
||||||
"item": "Item",
|
"item": "Item",
|
||||||
"edition": "Edition",
|
"edition": "Edition",
|
||||||
"feetype": "Fee type",
|
"feetype": "Fee type",
|
||||||
@@ -304,13 +305,15 @@
|
|||||||
"actions": {
|
"actions": {
|
||||||
"cancel": {
|
"cancel": {
|
||||||
"header": "Cancel reservation",
|
"header": "Cancel reservation",
|
||||||
"text": "Are you sure you want to extend the landing period of \"{{value}}\"?",
|
"text": "Are you sure you want to extend the lending period of \"{{value}}\"?",
|
||||||
"unknown_book": "unknown title"
|
"unknown_book": "unknown title",
|
||||||
|
"success": "Reservation cancelled successfully."
|
||||||
},
|
},
|
||||||
"renew": {
|
"renew": {
|
||||||
"header": "Extend landing period",
|
"header": "Extend lending period",
|
||||||
"text": "Are you sure you want to extend the landing period of \"{{value}}\"?",
|
"text": "Are you sure you want to extend the lending period of \"{{value}}\"?",
|
||||||
"unknown_book": "unknown title"
|
"unknown_book": "unknown title",
|
||||||
|
"success": "Lending period extended successfully."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user