feat: separate prettier from eslint

This commit is contained in:
Rainer Killinger
2023-01-11 13:25:18 +01:00
committed by Thea Schöbl
parent 939fb6ef0f
commit a88d000ccd
381 changed files with 17952 additions and 38411 deletions

View File

@@ -1,3 +1,18 @@
/*
* Copyright (C) 2023 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Component} from '@angular/core';
import {DocumentAction, PAIADocument, PAIADocumentStatus} from '../../types';
import {LibraryAccountService} from '../library-account.service';
@@ -17,9 +32,7 @@ export class CheckedOutPageComponent {
}
async onDocumentAction(documentAction: DocumentAction) {
const answer = await this.libraryAccountService.handleDocumentAction(
documentAction,
);
const answer = await this.libraryAccountService.handleDocumentAction(documentAction);
if (answer) await this.fetchItems();
}
@@ -27,9 +40,7 @@ export class CheckedOutPageComponent {
async fetchItems() {
try {
this.checkedOutItems = undefined;
this.checkedOutItems = await this.libraryAccountService.getFilteredItems([
PAIADocumentStatus.Held,
]);
this.checkedOutItems = await this.libraryAccountService.getFilteredItems([PAIADocumentStatus.Held]);
} catch {
await this.libraryAccountService.handleError();
this.checkedOutItems = [];

View File

@@ -1,11 +1,24 @@
<!--
~ Copyright (C) 2022 StApps
~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3.
~
~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details.
~
~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>.
-->
<ion-header>
<ion-toolbar color="primary" mode="ios">
<ion-buttons slot="start">
<ion-back-button></ion-back-button>
</ion-buttons>
<ion-title>{{
'library.account.pages.checked_out.title' | translate | titlecase
}}</ion-title>
<ion-title>{{ 'library.account.pages.checked_out.title' | translate | titlecase }}</ion-title>
</ion-toolbar>
</ion-header>
@@ -26,10 +39,7 @@
*ngIf="!checkedOutItems; else nothingFound"
></stapps-skeleton-list-item>
<ng-template #nothingFound>
<ion-label
*ngIf="checkedOutItems && checkedOutItems.length === 0"
class="centeredMessageContainer"
>
<ion-label *ngIf="checkedOutItems && checkedOutItems.length === 0" class="centeredMessageContainer">
{{ 'search.nothing_found' | translate | titlecase }}
</ion-label>
</ng-template>

View File

@@ -1,3 +1,18 @@
/*
* Copyright (C) 2023 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Component, Input} from '@angular/core';
import {PAIAFee} from '../../../types';
import {SCArticle, SCBook, SCPeriodical} from '@openstapps/core';
@@ -20,11 +35,9 @@ export class FeeItemComponent {
this.hasEdition = !fee.edition?.includes('null');
this._fee = fee;
if (this.hasEdition) {
this.libraryAccountService
.getDocumentFromHDS(fee.edition as string)
.then(book => {
this.book = book;
});
this.libraryAccountService.getDocumentFromHDS(fee.edition as string).then(book => {
this.book = book;
});
}
}

View File

@@ -1,3 +1,18 @@
<!--
~ Copyright (C) 2023 StApps
~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3.
~
~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details.
~
~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>.
-->
<ion-item>
<ion-label class="ion-text-wrap">
<ng-container *ngIf="hasEdition">
@@ -7,10 +22,7 @@
</h2>
<ng-template #loading
><h2>
<ion-skeleton-text
animated
style="width: 80%"
></ion-skeleton-text></h2
<ion-skeleton-text animated style="width: 80%"></ion-skeleton-text></h2
></ng-template>
</ng-container>
<ng-container *ngFor="let property of propertiesToShow">

View File

@@ -1,5 +1,5 @@
<!--
~ Copyright (C) 2022 StApps
~ Copyright (C) 2023 StApps
~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3.
@@ -19,18 +19,8 @@
><h2 *ngIf="item.about" class="name">{{ item.about }}</h2>
<ng-container *ngFor="let property of propertiesToShow">
<p *ngIf="item[property]">
{{
'library.account.pages' +
'.' +
listName +
'.' +
'labels' +
'.' +
property | translate
}}:
<ng-container
*ngIf="!['endtime', 'duedate'].includes(property); else date"
>
{{ 'library.account.pages' + '.' + listName + '.' + 'labels' + '.' + property | translate }}:
<ng-container *ngIf="!['endtime', 'duedate'].includes(property); else date">
{{ item[property] }}
</ng-container>
<ng-template #date>
@@ -47,11 +37,7 @@
<!-- >-->
<!-- {{ 'library.account.actions.cancel.header' | translate }}</ion-button-->
<!-- >-->
<ion-button
*ngIf="item.canrenew"
color="primary"
(click)="onClick('renew')"
>
<ion-button *ngIf="item.canrenew" color="primary" (click)="onClick('renew')">
{{ 'library.account.actions.renew.header' | translate }}</ion-button
>
</span>

View File

@@ -1,11 +1,24 @@
<!--
~ Copyright (C) 2022 StApps
~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3.
~
~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details.
~
~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>.
-->
<ion-header>
<ion-toolbar color="primary" mode="ios">
<ion-buttons slot="start">
<ion-back-button></ion-back-button>
</ion-buttons>
<ion-title>{{
'library.account.pages.fines.title' | translate | titlecase
}}</ion-title>
<ion-title>{{ 'library.account.pages.fines.title' | translate | titlecase }}</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
@@ -13,17 +26,12 @@
<stapps-fee-item *ngFor="let fine of fines" [fee]="fine"></stapps-fee-item>
</ion-list>
<ng-template #loading>
<stapps-skeleton-list-item
*ngFor="let _ of [].constructor(2)"
hideThumbnail="true"
>
<stapps-skeleton-list-item *ngFor="let _ of [].constructor(2)" hideThumbnail="true">
</stapps-skeleton-list-item>
</ng-template>
<ion-grid>
<ion-row *ngIf="amount; else amount_loading" class="ion-float-right">
<ion-col size="auto">
{{ 'library.account.pages.fines.labels.total_amount' | translate }}:
</ion-col>
<ion-col size="auto"> {{ 'library.account.pages.fines.labels.total_amount' | translate }}: </ion-col>
<ion-col size="auto">
{{ amount }}
</ion-col>

View File

@@ -1,3 +1,18 @@
/*
* Copyright (C) 2023 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Component} from '@angular/core';
import {DocumentAction, PAIADocument, PAIADocumentStatus} from '../../types';
import {LibraryAccountService} from '../library-account.service';
@@ -30,9 +45,7 @@ export class HoldsPageComponent {
? [PAIADocumentStatus.Reserved]
: [PAIADocumentStatus.Ordered, PAIADocumentStatus.Provided];
try {
this.paiaDocuments = await this.libraryAccountService.getFilteredItems(
itemsStatus,
);
this.paiaDocuments = await this.libraryAccountService.getFilteredItems(itemsStatus);
} catch {
await this.libraryAccountService.handleError();
this.paiaDocuments = [];
@@ -47,9 +60,7 @@ export class HoldsPageComponent {
}
async onDocumentAction(documentAction: DocumentAction) {
const answer = await this.libraryAccountService.handleDocumentAction(
documentAction,
);
const answer = await this.libraryAccountService.handleDocumentAction(documentAction);
if (answer) await this.fetchItems(this.activeSegment);
}

View File

@@ -1,29 +1,33 @@
<!--
~ Copyright (C) 2023 StApps
~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3.
~
~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details.
~
~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>.
-->
<ion-header>
<ion-toolbar color="primary" mode="ios">
<ion-buttons slot="start">
<ion-back-button></ion-back-button>
</ion-buttons>
<ion-title>{{
'library.account.pages.holds.title' | translate | titlecase
}}</ion-title>
<ion-title>{{ 'library.account.pages.holds.title' | translate | titlecase }}</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-segment
[(ngModel)]="activeSegment"
(ionChange)="segmentChanged($event)"
[value]="'orders'"
mode="md"
>
<ion-segment [(ngModel)]="activeSegment" (ionChange)="segmentChanged($event)" [value]="'orders'" mode="md">
<ion-segment-button [value]="'orders'">
<ion-label>{{
'library.account.pages.holds.holds' | translate
}}</ion-label>
<ion-label>{{ 'library.account.pages.holds.holds' | translate }}</ion-label>
</ion-segment-button>
<ion-segment-button [value]="'reservations'">
<ion-label>{{
'library.account.pages.holds.reservations' | translate
}}</ion-label>
<ion-label>{{ 'library.account.pages.holds.reservations' | translate }}</ion-label>
</ion-segment-button>
</ion-segment>
<ion-list *ngIf="paiaDocuments && paiaDocuments.length > 0; else fallback">
@@ -31,10 +35,7 @@
<ng-container *ngSwitchCase="'orders'">
<ng-container *ngFor="let hold of paiaDocuments">
<stapps-paia-item
*ngIf="
toNumber(hold.status) === paiaDocumentStatus.Provided;
else ordered
"
*ngIf="toNumber(hold.status) === paiaDocumentStatus.Provided; else ordered"
[item]="hold"
[propertiesToShow]="['label', 'storage']"
(documentAction)="onDocumentAction($event)"
@@ -70,10 +71,7 @@
*ngIf="!paiaDocuments; else nothingFound"
></stapps-skeleton-list-item>
<ng-template #nothingFound>
<ion-label
*ngIf="paiaDocuments && paiaDocuments.length === 0"
class="centeredMessageContainer"
>
<ion-label *ngIf="paiaDocuments && paiaDocuments.length === 0" class="centeredMessageContainer">
{{ 'search.nothing_found' | translate | titlecase }}
</ion-label>
</ng-template>

View File

@@ -1,16 +1,16 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
* Copyright (C) 2023 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Injectable} from '@angular/core';
@@ -20,14 +20,7 @@ import {
SCFeatureConfiguration,
SCFeatureConfigurationExtern,
} from '@openstapps/core';
import {
DocumentAction,
PAIADocument,
PAIADocumentStatus,
PAIAFees,
PAIAItems,
PAIAPatron,
} from '../types';
import {DocumentAction, PAIADocument, PAIADocumentStatus, PAIAFees, PAIAItems, PAIAPatron} from '../types';
import {HebisDataProvider} from '../../hebis/hebis-data.provider';
import {PAIATokenResponse} from '../../auth/paia/paia-token-response';
import {AuthHelperService} from '../../auth/auth-helper.service';
@@ -93,10 +86,7 @@ export class LibraryAccountService {
data?: JQuery.PlainObject,
): Promise<T | undefined> {
const token = await this.getValidToken();
const url = urlTemplate.replace(
'{patron}',
(token as PAIATokenResponse).patron,
);
const url = urlTemplate.replace('{patron}', (token as PAIATokenResponse).patron);
const settings: JQueryAjaxSettings = {
url: url,
dataType: 'json',
@@ -127,9 +117,7 @@ export class LibraryAccountService {
async getFilteredItems(documentStatus: PAIADocumentStatus[]) {
return (await this.getItems())?.doc.filter(document => {
return documentStatus.includes(
Number(document.status) as PAIADocumentStatus,
);
return documentStatus.includes(Number(document.status) as PAIADocumentStatus);
});
}
@@ -157,24 +145,18 @@ export class LibraryAccountService {
}
async cancelReservation(document: PAIADocument) {
const result = await this.performRequest<void>(
`${this.baseUrl}/{patron}/cancel`,
'POST',
{doc: [document]},
);
const result = await this.performRequest<void>(`${this.baseUrl}/{patron}/cancel`, 'POST', {
doc: [document],
});
if (result) {
void this.onSuccess('cancel');
}
}
async renewLending(document: PAIADocument) {
const result = await this.performRequest<void>(
`${this.baseUrl}/{patron}/renew`,
'POST',
{
doc: [document],
},
);
const result = await this.performRequest<void>(`${this.baseUrl}/{patron}/renew`, 'POST', {
doc: [document],
});
if (result) {
void this.onSuccess('renew');
}
@@ -208,19 +190,12 @@ export class LibraryAccountService {
text: this.translateService.instant('OK'),
},
],
header: this.translateService.instant(
`library.account.actions.${documentAction.action}.header`,
),
message: this.translateService.instant(
`library.account.actions.${documentAction.action}.text`,
{
value:
documentAction.doc.about ??
this.translateService.instant(
`library.account.actions.${documentAction.doc.about}.unknown_book`,
),
},
),
header: this.translateService.instant(`library.account.actions.${documentAction.action}.header`),
message: this.translateService.instant(`library.account.actions.${documentAction.action}.text`, {
value:
documentAction.doc.about ??
this.translateService.instant(`library.account.actions.${documentAction.doc.about}.unknown_book`),
}),
});
await alert.present();
});
@@ -238,9 +213,7 @@ export class LibraryAccountService {
async onSuccess(action: DocumentAction['action']) {
const toast = await this.toastController.create({
message: this.translateService.instant(
`library.account.actions.${action}.success`,
),
message: this.translateService.instant(`library.account.actions.${action}.success`),
duration: 2000,
color: 'success',
});

View File

@@ -1,3 +1,18 @@
/*
* Copyright (C) 2023 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Component} from '@angular/core';
import {LibraryAccountService} from '../library-account.service';
import {PAIAPatron} from '../../types';
@@ -10,14 +25,7 @@ import {PAIAPatron} from '../../types';
export class ProfilePageComponent {
patron?: PAIAPatron;
propertiesToShow: (keyof PAIAPatron)[] = [
'id',
'name',
'email',
'address',
'expires',
'note',
];
propertiesToShow: (keyof PAIAPatron)[] = ['id', 'name', 'email', 'address', 'expires', 'note'];
constructor(private readonly libraryAccountService: LibraryAccountService) {}

View File

@@ -1,11 +1,24 @@
<!--
~ Copyright (C) 2023 StApps
~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3.
~
~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details.
~
~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>.
-->
<ion-header>
<ion-toolbar color="primary" mode="ios">
<ion-buttons slot="start">
<ion-back-button></ion-back-button>
</ion-buttons>
<ion-title>{{
'library.account.pages.profile.title' | translate | titlecase
}}</ion-title>
<ion-title>{{ 'library.account.pages.profile.title' | translate | titlecase }}</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
@@ -14,28 +27,19 @@
<ion-grid>
<ng-container *ngFor="let property of propertiesToShow">
<ion-row *ngIf="patron[property]">
<ion-col>
{{
'library.account.pages.profile.labels' + '.' + property
| translate
}}:
</ion-col>
<ion-col> {{ 'library.account.pages.profile.labels' + '.' + property | translate }}: </ion-col>
<ion-col>
<ng-container *ngIf="!['expires'].includes(property); else date">
{{ patron[property] }}
</ng-container>
<ng-template #date>
<ng-container
*ngIf="patron[property] === '9999-12-31'; else exactDate"
>
{{
'library.account.pages.profile.values.unlimited' | translate
}}
<ng-container *ngIf="patron[property] === '9999-12-31'; else exactDate">
{{ 'library.account.pages.profile.values.unlimited' | translate }}
</ng-container>
<ng-template #exactDate>
{{
'library.account.pages.profile.values.expires' | translate
}}:&nbsp;{{ patron[property] | amDateFormat: 'll' }}
{{ 'library.account.pages.profile.values.expires' | translate }}:&nbsp;{{
patron[property] | amDateFormat: 'll'
}}
</ng-template>
</ng-template>
</ion-col>
@@ -45,7 +49,6 @@
</ion-card-content>
</ion-card>
<ng-template #loading>
<stapps-skeleton-simple-card [title]="false" [lines]="4">
</stapps-skeleton-simple-card>
<stapps-skeleton-simple-card [title]="false" [lines]="4"> </stapps-skeleton-simple-card>
</ng-template>
</ion-content>