<!--
~ 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/>.
-->
<ion-grid>
  @if (holding.storage && holding.storage.content) {
    <ion-row>
      <ion-col size="3">{{ 'hebisSearch.daia.location' | translate }}</ion-col>
      <ion-col size="9" [innerHTML]="holding.storage.content"></ion-col>
    </ion-row>
  }
  @if (holding.signature && !holding.online) {
    <ion-row>
      <ion-col size="3">{{ 'hebisSearch.daia.signature' | translate }}</ion-col>
      <ion-col size="9">{{ holding.signature }}</ion-col>
    </ion-row>
  }
  @if (holding.holdings) {
    <ion-row>
      <ion-col size="3">{{ 'hebisSearch.daia.holdings' | translate }}</ion-col>
      <ion-col size="9">{{ holding.holdings }}</ion-col>
    </ion-row>
  }
  @if (holding.about) {
    <ion-row>
      <ion-col size="3">{{ 'hebisSearch.daia.comment' | translate }}</ion-col>
      <ion-col size="9" [innerHTML]="holding.about"></ion-col>
    </ion-row>
  }
  @if (holding.available && holding.online && resourceLink) {
    <ion-row>
      <ion-col size="3">{{ 'Online' }}</ion-col>
      <ion-col size="9">
        <stapps-external-link
          [link]="resourceLink"
          [text]="'hebisSearch.daia.fulltext' | translate"
        ></stapps-external-link
      ></ion-col>
    </ion-row>
  }
  @if (holding.status) {
    <ion-row>
      <ion-col size="3">{{ 'hebisSearch.daia.status' | translate }}</ion-col>
      <ion-col size="9">
        @if (holding.status === 'available') {
          <ion-icon name="check_circle" color="success"></ion-icon>
        }
        @if (holding.status === 'library_only') {
          <ion-icon name="check_circle" color="warning"></ion-icon>
        }
        @if (['checked_out', 'not_yet_available', 'not_available'].indexOf(holding.status) > -1) {
          <ion-icon name="cancel" color="danger"> </ion-icon>
        }
        {{ 'hebisSearch.daia.status_states' + '.' + holding.status | translate }}
        @if (
          (holding.status === 'available' || holding.status === 'library_only') &&
          holding.available &&
          holding.available.href
        ) {
          <stapps-external-link [text]="'hebisSearch.daia.order' | translate" [link]="holding.available.href">
          </stapps-external-link>
        }
        @if (holding.status === 'checked_out' && holding.unavailable && holding.unavailable.href) {
          <stapps-external-link
            [text]="'hebisSearch.daia.reserve' | translate"
            [link]="holding.unavailable.href"
          >
          </stapps-external-link>
        }
      </ion-col>
    </ion-row>
  }
  @if (holding.dueDate) {
    <ion-row>
      <ion-col size="3">{{ 'hebisSearch.daia.dueDate' | translate }}</ion-col>
      <ion-col size="9">{{ holding.dueDate | amDateFormat: 'll' }}</ion-col>
    </ion-row>
  }
</ion-grid>
