<!--
  ~ 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-card>
  <ion-card-header> {{ 'event' | propertyNameTranslate : item | titlecase }} </ion-card-header>
  <ion-card-content>
    <a [routerLink]="['/data-detail', item.event.uid]">{{ 'name' | thingTranslate : item.event }}</a>
  </ion-card-content>
</ion-card>
<ion-card *ngIf="item.inPlace">
  <ion-card-header> {{ 'inPlace' | propertyNameTranslate : item | titlecase }} </ion-card-header>
  <ion-card-content>
    <ion-icon name="pin_drop"> </ion-icon>
    <a [routerLink]="['/data-detail', item.inPlace.uid]">{{ 'name' | thingTranslate : item.inPlace }}</a>
    <stapps-address-detail
      *ngIf="item.inPlace.address"
      [address]="item.inPlace.address"
    ></stapps-address-detail>
  </ion-card-content>
</ion-card>
<stapps-simple-card
  title="{{ 'duration' | propertyNameTranslate : item | titlecase }}"
  [content]="[item.duration | amDuration : 'minutes']"
></stapps-simple-card>
<stapps-simple-card
  *ngIf="item.dates.length > 1; else single_event"
  title="{{ 'dates' | propertyNameTranslate : item | titlecase }}"
  content="{{ 'data.chips.add_events.popover.AT' | translate | titlecase }} {{
    item.dates[0] | amDateFormat : 'HH:mm ddd'
  }} {{ 'data.chips.add_events.popover.UNTIL' | translate }} {{
    item.dates[item.dates.length - 1] | amDateFormat : 'll'
  }}"
></stapps-simple-card>
<ng-template #single_event>
  <stapps-simple-card
    title="{{ 'dates' | propertyNameTranslate : item | titlecase }}"
    content="{{ 'data.chips.add_events.popover.AT' | translate | titlecase }} {{
      item.dates[item.dates.length - 1] | amDateFormat : 'll, HH:mm'
    }}"
  ></stapps-simple-card>
</ng-template>
<stapps-simple-card
  *ngIf="item.performers"
  [title]="'performers' | propertyNameTranslate : item.performers | titlecase"
  [content]="item.performers"
></stapps-simple-card>
<stapps-offers-detail *ngIf="item.offers" [offers]="item.offers"></stapps-offers-detail>
