diff --git a/apps/frontend/src/app/modules/canteen/components/canteen/canteen.component.html b/apps/frontend/src/app/modules/canteen/components/canteen/canteen.component.html
index 1a8528ac2..1c9fbfcde 100644
--- a/apps/frontend/src/app/modules/canteen/components/canteen/canteen.component.html
+++ b/apps/frontend/src/app/modules/canteen/components/canteen/canteen.component.html
@@ -1,10 +1,10 @@
Menza étlap
-
-
- {{ weekdays[day] }}
-
- {{ meal.menu }}
-
-
+
+
+ {{ weekdays[day] }}
+
+ {{ meal.menu }}
+
+
diff --git a/apps/frontend/src/app/modules/canteen/components/canteen/canteen.component.ts b/apps/frontend/src/app/modules/canteen/components/canteen/canteen.component.ts
index a0579381e..f6ee88adb 100644
--- a/apps/frontend/src/app/modules/canteen/components/canteen/canteen.component.ts
+++ b/apps/frontend/src/app/modules/canteen/components/canteen/canteen.component.ts
@@ -1,9 +1,11 @@
import { ChangeDetectionStrategy, Component, OnDestroy, OnInit } from '@angular/core'
import { Observable } from 'rxjs'
+import { map } from 'rxjs/operators'
import { StructuredDataService } from '../../../../services/structured-data.service'
import { TitleService } from '../../../../services/title.service'
-import {CanteenDay} from "../../models/cateen";
-import {CanteenService} from "../../services/canteen.service";
+import { CanteenDay, Menu } from '../../models/cateen'
+import { CanteenService } from '../../services/canteen.service'
+import { getDay } from 'date-fns'
@Component({
selector: 'verseghy-canteen',
@@ -22,15 +24,32 @@ export class CanteenComponent implements OnInit, OnDestroy {
{ item: 'https://verseghy-gimnazium.net/canteen', position: 1, name: 'Menza' },
])
+ days: Observable<[Menu, Menu, Menu?] | null>[] = []
+
constructor(
private structuredDataService: StructuredDataService,
private titleService: TitleService,
- private canteenService: CanteenService,
+ private canteenService: CanteenService
) {}
ngOnInit() {
this.titleService.setTitle('Menza')
this.canteen = this.canteenService.getCanteen()
+
+ for (let week = 0; week < 2; week++) {
+ for (let day = 0; day < 5; day++) {
+ this.days[day + week * 5] = this.canteen.pipe(
+ map((weeks) => {
+ for (const weekDay of weeks[week]) {
+ if (getDay(weekDay.date) - 1 === day) {
+ return weekDay.menus
+ }
+ }
+ return null
+ })
+ )
+ }
+ }
}
ngOnDestroy() {