<!--
~ 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 (isInCalendar | async) {
  <ion-chip outline="true" color="success" (click)="removeFromCalendar()">
    <ion-icon name="event_available" [fill]="true"></ion-icon>
    <ion-label>{{ 'chips.addEvent.addedToEvents' | translate }}</ion-label>
  </ion-chip>
} @else {
  <ion-chip outline="true" color="primary" (click)="addToCalendar()">
    <ion-icon name="calendar_today"></ion-icon>
    <ion-label>{{ 'chips.addEvent.addEvent' | translate }}</ion-label>
  </ion-chip>
}
<stapps-simple-card
  title="{{ 'duration' | propertyNameTranslate: item | titlecase }}"
  [content]="[item.duration | amDuration: 'minutes']"
></stapps-simple-card>
@if (item.dates.length > 1) {
  <stapps-simple-card
    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>
} @else {
  <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>
}
@if (item.performers) {
  <stapps-simple-card
    [title]="'performers' | propertyNameTranslate: item | titlecase"
    [content]="item.performers"
  ></stapps-simple-card>
}
@if (item.offers) {
  <stapps-offers-detail [offers]="item.offers"></stapps-offers-detail>
}
<ion-card>
  <ion-card-header> {{ 'event' | propertyNameTranslate: item | titlecase }} </ion-card-header>
  <ion-card-content>
    <stapps-data-list-item [item]="$any(item.event)"></stapps-data-list-item>
  </ion-card-content>
</ion-card>
@if (item.inPlace) {
  <ion-card>
    <ion-card-header> {{ 'inPlace' | propertyNameTranslate: item | titlecase }} </ion-card-header>
    <ion-card-content>
      <stapps-data-list-item [item]="$any(item.inPlace)"></stapps-data-list-item>
    </ion-card-content>
  </ion-card>
}
@if (item.inPlace && item.inPlace.geo) {
  <stapps-map-widget [place]="$any(item.inPlace)"></stapps-map-widget>
}
