Only show restaurants with menus for the given days

This commit is contained in:
zv0n 2022-10-29 14:51:10 +02:00
parent 75b960a0f1
commit f498ecbfe7
3 changed files with 16862 additions and 32 deletions

16887
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -3,4 +3,5 @@
<button type="button" class="btn btn-info" (click)="getAllDaysUpdate()" style="margin-right: 10px;">Show whole week</button> <button type="button" class="btn btn-info" (click)="getAllDaysUpdate()" style="margin-right: 10px;">Show whole week</button>
<button type="button" class="btn btn-info" (click)="getTodayOnlyUpdate()">Only show today</button> <button type="button" class="btn btn-info" (click)="getTodayOnlyUpdate()">Only show today</button>
</div> </div>
<app-restaurant *ngFor="let restaurant of restaurants; let i = index" [restaurant]="restaurant" [index]="i"></app-restaurant> <app-restaurant *ngFor="let restaurant of filterRestaurantsWithMeals(); let i = index" [restaurant]="restaurant" [index]="i"></app-restaurant>
<div *ngIf="filterRestaurantsWithMeals().length == 0">No daily menus today :(</div>

View File

@ -45,4 +45,8 @@ export class RestaurantsComponent implements OnInit {
}); });
} }
filterRestaurantsWithMeals(): Restaurant[] {
return this.restaurants.filter(r => r.daily.filter(d => d.meals.length != 0).length != 0)
}
} }