<!--
~ Copyright (C) 2022 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 (item.workLocations) {
  <ion-list>
    @for (contactPoint of contactPoints; track contactPoint; let i = $index) {
      <ion-card>
        <ion-card-header>
          @if (item.workLocations.length > 1) {
            {{ i + 1 }}.
          }
          {{ 'type' | thingTranslate: contactPoint | titlecase }}
        </ion-card-header>
        <ion-card-content>
          @if (contactPoint.telephone) {
            <p>
              {{ 'telephone' | propertyNameTranslate: 'contact point' | titlecase }}:
              <a [href]="'tel:' + contactPoint.telephone">{{ contactPoint.telephone }}</a>
            </p>
          }
          @if (contactPoint.email) {
            <p>
              {{ 'email' | propertyNameTranslate: 'contact point' | titlecase }}:
              <a [href]="'mailto:' + contactPoint.email">{{ contactPoint.email }}</a>
            </p>
          }
          @if (contactPoint.faxNumber) {
            <p>
              {{ 'faxNumber' | propertyNameTranslate: 'contact point' | titlecase }}:
              {{ contactPoint.faxNumber }}
            </p>
          }
          @if (contactPoint.officeHours) {
            <p>
              {{ 'officeHours' | propertyNameTranslate: 'contact point' | titlecase }}:
              {{ contactPoint.officeHours }}
            </p>
          }
          @if (contactPoint.url) {
            <p>
              {{ 'url' | propertyNameTranslate: 'contact point' | titlecase }}:
              <a [href]="contactPoint.url">{{ contactPoint.url }}</a>
            </p>
          }
          @if (isContactPoint(contactPoint) && contactPoint.areaServed) {
            <p>
              {{ 'areaServed' | propertyNameTranslate: contactPoint | titlecase }}:
              <a [routerLink]="['/data-detail', contactPoint.areaServed.uid]">{{
                contactPoint.areaServed.name
              }}</a>
            </p>
          }
        </ion-card-content>
      </ion-card>
    }
  </ion-list>
}
@if (item.jobTitles && item.jobTitles.length > 0) {
  <stapps-simple-card
    [title]="'jobTitles' | propertyNameTranslate: item | titlecase"
    [content]="item.jobTitles"
  ></stapps-simple-card>
}
