mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-03-17 04:02:30 +00:00
feat: seperate dishes by menu sections
This commit is contained in:
97
package-lock.json
generated
97
package-lock.json
generated
@@ -3868,18 +3868,18 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@openstapps/api": {
|
"@openstapps/api": {
|
||||||
"version": "0.44.0",
|
"version": "0.45.0",
|
||||||
"resolved": "https://registry.npmjs.org/@openstapps/api/-/api-0.44.0.tgz",
|
"resolved": "https://registry.npmjs.org/@openstapps/api/-/api-0.45.0.tgz",
|
||||||
"integrity": "sha512-ZVSt5JiN2ESgTxrNR0IRPbeMtmXATdytAeXMbtDFeKgwFb9uJAt6jZIto9sHQHZg2kJG6Ka9ycFaMstflZjLOg==",
|
"integrity": "sha512-lF1TIxbtqQlRYCvSyS3EDjQiwVK7BmZ3/HQ01MhlUR1ucfvMTk1GyIPx5E8HmrKSi3Pv8shurCObSwStQJjK+Q==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@krlwlfrt/async-pool": "0.7.0",
|
"@krlwlfrt/async-pool": "0.7.0",
|
||||||
"@openstapps/core": "0.71.0",
|
"@openstapps/core": "0.72.0",
|
||||||
"@openstapps/core-tools": "0.32.0",
|
"@openstapps/core-tools": "0.32.0",
|
||||||
"@openstapps/logger": "1.0.1",
|
"@openstapps/logger": "1.1.1",
|
||||||
"@types/cli-progress": "3.11.0",
|
"@types/cli-progress": "3.11.0",
|
||||||
"@types/express": "4.17.14",
|
"@types/express": "4.17.14",
|
||||||
"@types/morgan": "1.9.3",
|
"@types/morgan": "1.9.3",
|
||||||
"@types/node": "14.18.32",
|
"@types/node": "14.18.34",
|
||||||
"@types/traverse": "0.6.32",
|
"@types/traverse": "0.6.32",
|
||||||
"@types/uuid": "8.3.4",
|
"@types/uuid": "8.3.4",
|
||||||
"@types/wait-on": "5.3.1",
|
"@types/wait-on": "5.3.1",
|
||||||
@@ -3897,35 +3897,10 @@
|
|||||||
"wait-on": "6.0.1"
|
"wait-on": "6.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@openstapps/core": {
|
|
||||||
"version": "0.71.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@openstapps/core/-/core-0.71.0.tgz",
|
|
||||||
"integrity": "sha512-5RpbidtKknzx8/zmHUfppNHH1UuJSevO4Sr444HmW9voULSnlaghzIGyjUuuAjCm/LCG30WVhKTe3/nWZAnCbg==",
|
|
||||||
"requires": {
|
|
||||||
"@openstapps/core-tools": "0.32.0",
|
|
||||||
"@types/geojson": "1.0.6",
|
|
||||||
"@types/json-patch": "0.0.30",
|
|
||||||
"@types/json-schema": "7.0.11",
|
|
||||||
"@types/node": "14.18.24",
|
|
||||||
"fast-deep-equal": "3.1.3",
|
|
||||||
"http-status-codes": "2.2.0",
|
|
||||||
"json-patch": "0.7.0",
|
|
||||||
"json-schema": "0.4.0",
|
|
||||||
"rfdc": "1.3.0",
|
|
||||||
"ts-optchain": "0.1.8"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@types/node": {
|
|
||||||
"version": "14.18.24",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.24.tgz",
|
|
||||||
"integrity": "sha512-aJdn8XErcSrfr7k8ZDDfU6/2OgjZcB2Fu9d+ESK8D7Oa5mtsv8Fa8GpcwTA0v60kuZBaalKPzuzun4Ov1YWO/w=="
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "14.18.32",
|
"version": "14.18.34",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.32.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.34.tgz",
|
||||||
"integrity": "sha512-Y6S38pFr04yb13qqHf8uk1nHE3lXgQ30WZbv1mLliV9pt0NjvqdWttLcrOYLnXbOafknVYRHZGoMSpR9UwfYow=="
|
"integrity": "sha512-hcU9AIQVHmPnmjRK+XUUYlILlr9pQrsqSrwov/JK1pnf3GTQowVBhx54FbvM0AU/VXGH4i3+vgXS5EguR7fysA=="
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -3967,9 +3942,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@openstapps/core": {
|
"@openstapps/core": {
|
||||||
"version": "0.71.1",
|
"version": "0.72.0",
|
||||||
"resolved": "https://registry.npmjs.org/@openstapps/core/-/core-0.71.1.tgz",
|
"resolved": "https://registry.npmjs.org/@openstapps/core/-/core-0.72.0.tgz",
|
||||||
"integrity": "sha512-cch/bGqIcCQz6B/TYQ1+8Wa1gKUFGP4k1Er9o+n/i9tMIlILM6IwQu5hiJ1ro8q6scn+0AwxdLQxlBQymCcBiQ==",
|
"integrity": "sha512-bT22CWKf0Do32FwJLf+rWxbQTHTiPbJEzm3dd3Sk5utGgNTAeFequaNea2csvCOA1dRaVrRVQ7Ed9prVdep9ow==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@openstapps/core-tools": "0.32.0",
|
"@openstapps/core-tools": "0.32.0",
|
||||||
"@types/geojson": "1.0.6",
|
"@types/geojson": "1.0.6",
|
||||||
@@ -4111,9 +4086,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@openstapps/logger": {
|
"@openstapps/logger": {
|
||||||
"version": "1.0.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/@openstapps/logger/-/logger-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/@openstapps/logger/-/logger-1.1.1.tgz",
|
||||||
"integrity": "sha512-ekiqaj07NG2JKUdJBSoLTYJTz1sEtzJsGoz0F19s0h2A9fxP2duWD7bIcqfOcxj5Wggxr88zX/AK8cZG4Gda4g==",
|
"integrity": "sha512-hPLqV0nKXgbwRxbRCAzSvQzlHfWfpDGxbo/nJLY94zbVwzpHCW3favh+MFmEV536ZvprIOLkE8DfzBUC0a83ww==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/node": "14.18.32",
|
"@types/node": "14.18.32",
|
||||||
"@types/nodemailer": "6.4.6",
|
"@types/nodemailer": "6.4.6",
|
||||||
@@ -4300,14 +4275,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@types/cacheable-request": {
|
"@types/cacheable-request": {
|
||||||
"version": "6.0.2",
|
"version": "6.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.3.tgz",
|
||||||
"integrity": "sha512-B3xVo+dlKM6nnKTcmm5ZtY/OL8bOAOd2Olee9M1zft65ox50OzjEHW91sDiU9j6cvW8Ejg1/Qkf4xd2kugApUA==",
|
"integrity": "sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/http-cache-semantics": "*",
|
"@types/http-cache-semantics": "*",
|
||||||
"@types/keyv": "*",
|
"@types/keyv": "^3.1.4",
|
||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
"@types/responselike": "*"
|
"@types/responselike": "^1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@types/cli-progress": {
|
"@types/cli-progress": {
|
||||||
@@ -4493,11 +4468,11 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/keyv": {
|
"@types/keyv": {
|
||||||
"version": "4.2.0",
|
"version": "3.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-4.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz",
|
||||||
"integrity": "sha512-xoBtGl5R9jeKUhc8ZqeYaRDx04qqJ10yhhXYGmJ4Jr8qKpvMsDQQrNUvF/wUJ4klOtmJeJM+p2Xo3zp9uaC3tw==",
|
"integrity": "sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"keyv": "*"
|
"@types/node": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@types/leaflet": {
|
"@types/leaflet": {
|
||||||
@@ -11007,9 +10982,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"joi": {
|
"joi": {
|
||||||
"version": "17.6.4",
|
"version": "17.7.0",
|
||||||
"resolved": "https://registry.npmjs.org/joi/-/joi-17.6.4.tgz",
|
"resolved": "https://registry.npmjs.org/joi/-/joi-17.7.0.tgz",
|
||||||
"integrity": "sha512-tPzkTJHZQjSFCc842QpdVpOZ9LI2txApboNUbW70qgnRB14Lzl+oWQOPdF2N4yqyiY14wBGe8lc7f/2hZxbGmw==",
|
"integrity": "sha512-1/ugc8djfn93rTE3WRKdCzGGt/EtiYKxITMO4Wiv6q5JL1gl9ePt4kBsl1S499nbosspfctIQTpYIhSmHA3WAg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@hapi/hoek": "^9.0.0",
|
"@hapi/hoek": "^9.0.0",
|
||||||
"@hapi/topo": "^5.0.0",
|
"@hapi/topo": "^5.0.0",
|
||||||
@@ -11457,9 +11432,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"keyv": {
|
"keyv": {
|
||||||
"version": "4.5.0",
|
"version": "4.5.2",
|
||||||
"resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.2.tgz",
|
||||||
"integrity": "sha512-2YvuMsA+jnFGtBareKqgANOEKe1mk3HKiXu2fRmAfyxG0MJAywNhi5ttWA3PMjl4NmpyjZNbFifR2vNjW1znfA==",
|
"integrity": "sha512-5MHbFaKn8cNSmVW7BYnijeAVlE4cYA/SVkifVgrh7yotnfhKmjuXpDKjrABLnT0SfHWV21P8ow07OGfRrNDg8g==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"json-buffer": "3.0.1"
|
"json-buffer": "3.0.1"
|
||||||
}
|
}
|
||||||
@@ -11988,9 +11963,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"loupe": {
|
"loupe": {
|
||||||
"version": "2.3.4",
|
"version": "2.3.6",
|
||||||
"resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz",
|
||||||
"integrity": "sha512-OvKfgCC2Ndby6aSTREl5aCCPTNIzlDfQZvZxNUrBrihDhL3xcrYegTblhmEiCrg2kKQz4XsFIaemE5BF4ybSaQ==",
|
"integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"get-func-name": "^2.0.0"
|
"get-func-name": "^2.0.0"
|
||||||
}
|
}
|
||||||
@@ -17507,9 +17482,9 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"rxjs": {
|
"rxjs": {
|
||||||
"version": "7.5.7",
|
"version": "7.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.7.tgz",
|
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.6.0.tgz",
|
||||||
"integrity": "sha512-z9MzKh/UcOqB3i20H6rtrlaE/CgjLOvheWK/9ILrbhROGTweAi1BaFsTT9FbwZi5Trr1qNRs+MXkhmR06awzQA==",
|
"integrity": "sha512-DDa7d8TFNUalGC9VqXvQ1euWNN7sc63TrUCuM9J998+ViviahMIjKSOU7rfcgFOF+FCD71BhDRv4hrFz+ImDLQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"tslib": "^2.1.0"
|
"tslib": "^2.1.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,9 +84,9 @@
|
|||||||
"@ionic/storage-angular": "3.0.6",
|
"@ionic/storage-angular": "3.0.6",
|
||||||
"@ngx-translate/core": "14.0.0",
|
"@ngx-translate/core": "14.0.0",
|
||||||
"@ngx-translate/http-loader": "7.0.0",
|
"@ngx-translate/http-loader": "7.0.0",
|
||||||
"@openstapps/api": "0.44.0",
|
"@openstapps/api": "0.45.0",
|
||||||
"@openstapps/configuration": "0.33.0",
|
"@openstapps/configuration": "0.33.0",
|
||||||
"@openstapps/core": "0.71.1",
|
"@openstapps/core": "0.72.0",
|
||||||
"@transistorsoft/capacitor-background-fetch": "1.0.0",
|
"@transistorsoft/capacitor-background-fetch": "1.0.0",
|
||||||
"capacitor-secure-storage-plugin": "0.8.0",
|
"capacitor-secure-storage-plugin": "0.8.0",
|
||||||
"cordova-plugin-calendar": "5.1.6",
|
"cordova-plugin-calendar": "5.1.6",
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import {Router} from '@angular/router';
|
|||||||
import {Subscription} from 'rxjs';
|
import {Subscription} from 'rxjs';
|
||||||
import {IonRouterOutlet} from '@ionic/angular';
|
import {IonRouterOutlet} from '@ionic/angular';
|
||||||
import {DataRoutingService} from '../../../../data-routing.service';
|
import {DataRoutingService} from '../../../../data-routing.service';
|
||||||
|
import {groupBy} from 'src/app/_helpers/collections/group-by';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO
|
* TODO
|
||||||
@@ -36,8 +37,9 @@ export class PlaceMensaDetailComponent implements AfterViewInit, OnDestroy {
|
|||||||
/**
|
/**
|
||||||
* Map of dishes for each day
|
* Map of dishes for each day
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line unicorn/no-null
|
dishes: Promise<Record<SCISO8601Date, Record<string, SCDish[]>>> | null =
|
||||||
dishes: Promise<Record<SCISO8601Date, SCDish[]>> | null = null;
|
// eslint-disable-next-line unicorn/no-null
|
||||||
|
null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* number of days to display mensa menus for
|
* number of days to display mensa menus for
|
||||||
@@ -79,15 +81,6 @@ export class PlaceMensaDetailComponent implements AfterViewInit, OnDestroy {
|
|||||||
* TODO
|
* TODO
|
||||||
*/
|
*/
|
||||||
ngAfterViewInit() {
|
ngAfterViewInit() {
|
||||||
this.dishes = this.mensaService.getAllDishes(this.item, this.displayRange);
|
|
||||||
this.dishes.then(result => {
|
|
||||||
for (const [key, value] of Object.entries(result)) {
|
|
||||||
if (value.length === 0) {
|
|
||||||
delete result[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.selectedDay = Object.keys(result)[0];
|
|
||||||
});
|
|
||||||
if (!this.openAsModal) {
|
if (!this.openAsModal) {
|
||||||
this.subscriptions.push(
|
this.subscriptions.push(
|
||||||
this.dataRoutingService.itemSelectListener().subscribe(item => {
|
this.dataRoutingService.itemSelectListener().subscribe(item => {
|
||||||
@@ -95,6 +88,36 @@ export class PlaceMensaDetailComponent implements AfterViewInit, OnDestroy {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const dishesByDay = this.mensaService.getAllDishes(
|
||||||
|
this.item,
|
||||||
|
this.displayRange,
|
||||||
|
);
|
||||||
|
|
||||||
|
dishesByDay.then(result => {
|
||||||
|
for (const [key, value] of Object.entries(result)) {
|
||||||
|
if (value.length === 0) {
|
||||||
|
delete result[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.selectedDay = Object.keys(result)[0];
|
||||||
|
});
|
||||||
|
|
||||||
|
this.dishes = new Promise(async (resolve, reject) => {
|
||||||
|
try {
|
||||||
|
const dishesBySections: Record<string, Record<string, SCDish[]>> = {};
|
||||||
|
for (const [key, value] of Object.entries(await dishesByDay)) {
|
||||||
|
dishesBySections[key] = groupBy(
|
||||||
|
value,
|
||||||
|
x => x.menuSection?.name ?? '',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
resolve(dishesBySections);
|
||||||
|
} catch {
|
||||||
|
// eslint-disable-next-line unicorn/no-null
|
||||||
|
reject(null);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -16,14 +16,32 @@
|
|||||||
</ion-segment>
|
</ion-segment>
|
||||||
<ng-container [ngSwitch]="selectedDay">
|
<ng-container [ngSwitch]="selectedDay">
|
||||||
<ng-container *ngFor="let date of dishes | keyvalue">
|
<ng-container *ngFor="let date of dishes | keyvalue">
|
||||||
<ion-list *ngSwitchCase="date.key">
|
<ng-container *ngIf="(date.value | json) !== '{}'; else empty">
|
||||||
<ng-container *ngFor="let dish of date.value; index as i">
|
<ion-list *ngSwitchCase="date.key">
|
||||||
<stapps-data-list-item
|
<ng-container *ngFor="let section of date.value | keyvalue">
|
||||||
[item]="dish"
|
<ion-list-header
|
||||||
[hideThumbnail]="true"
|
*ngIf="section.value[0].menuSection"
|
||||||
></stapps-data-list-item>
|
lines="inset"
|
||||||
</ng-container>
|
>
|
||||||
</ion-list>
|
<ion-label class="title">
|
||||||
|
{{
|
||||||
|
'data.types.dish.detail.' +
|
||||||
|
section.value[0].menuSection.name
|
||||||
|
| translate
|
||||||
|
| titlecase
|
||||||
|
}}
|
||||||
|
{{ section.value[0].menuSection.servingHours }}
|
||||||
|
</ion-label>
|
||||||
|
</ion-list-header>
|
||||||
|
<ng-container *ngFor="let dish of section.value; index as j">
|
||||||
|
<stapps-data-list-item
|
||||||
|
[item]="dish"
|
||||||
|
[hideThumbnail]="true"
|
||||||
|
></stapps-data-list-item>
|
||||||
|
</ng-container>
|
||||||
|
</ng-container>
|
||||||
|
</ion-list>
|
||||||
|
</ng-container>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|||||||
@@ -17,3 +17,9 @@ ion-segment {
|
|||||||
flex: 1 0 100px;
|
flex: 1 0 100px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ion-list-header {
|
||||||
|
ion-label {
|
||||||
|
color: var(--ion-color-medium-shade);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -150,6 +150,9 @@
|
|||||||
"CHARACTERISTICS": "Zutaten",
|
"CHARACTERISTICS": "Zutaten",
|
||||||
"EMPTY_DISHES": "Keine Angebote verfügbar",
|
"EMPTY_DISHES": "Keine Angebote verfügbar",
|
||||||
"detail": {
|
"detail": {
|
||||||
|
"breakfast": "Frühstück",
|
||||||
|
"dinner": "Abendessen",
|
||||||
|
"lunch": "Mittagessen",
|
||||||
"AVG_NUTRITION_INFO": "Durchschnittliche Nährwertangaben",
|
"AVG_NUTRITION_INFO": "Durchschnittliche Nährwertangaben",
|
||||||
"CALORIES": "Brennwert",
|
"CALORIES": "Brennwert",
|
||||||
"FAT_TOTAL": "Fett",
|
"FAT_TOTAL": "Fett",
|
||||||
|
|||||||
@@ -150,6 +150,9 @@
|
|||||||
"CHARACTERISTICS": "Ingredients",
|
"CHARACTERISTICS": "Ingredients",
|
||||||
"EMPTY_DISHES": "No Offers Available",
|
"EMPTY_DISHES": "No Offers Available",
|
||||||
"detail": {
|
"detail": {
|
||||||
|
"breakfast": "Breakfast",
|
||||||
|
"dinner": "Dinner",
|
||||||
|
"lunch": "Lunch",
|
||||||
"AVG_NUTRITION_INFO": "Average Nutrition Facts",
|
"AVG_NUTRITION_INFO": "Average Nutrition Facts",
|
||||||
"CALORIES": "Calories",
|
"CALORIES": "Calories",
|
||||||
"FAT_TOTAL": "Fat",
|
"FAT_TOTAL": "Fat",
|
||||||
|
|||||||
Reference in New Issue
Block a user