<!--
~ 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/>.
-->

@if (items | async; as items) {
  @if (items.length !== 0) {
    @for (item of items; track item) {
      <stapps-section @fade [item]="item" [title]="'name' | thingTranslate: item">
        <ion-button slot="button-end" fill="clear" color="medium" (click)="favoritesService.delete(item)">
          <ion-icon slot="icon-only" name="delete" [size]="24"></ion-icon>
        </ion-button>
        <stapps-opening-hours slot="subtitle" [openingHours]="$any(item).openingHours"></stapps-opening-hours>
        <stapps-mensa-section-content [item]="item"></stapps-mensa-section-content>
      </stapps-section>
    }
  } @else {
    <stapps-section [title]="'dashboard.canteens.title' | translate">
      <ion-item class="nothing-selected" lines="none">
        <ion-label class="ion-text-wrap">
          {{ 'dashboard.canteens.no_favorite_prefix' | translate }}
          <a [routerLink]="['/canteen']">{{ 'dashboard.canteens.no_favorite_link' | translate }}</a>
          {{ 'dashboard.canteens.no_favorite_suffix' | translate }}
        </ion-label>
      </ion-item>
    </stapps-section>
  }
}
