<!--
~ 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-header>
  <ion-toolbar color="primary" mode="ios">
    <ion-buttons slot="start">
      <ion-back-button></ion-back-button>
    </ion-buttons>
    <ion-title>{{ 'library.account.pages.profile.title' | translate | titlecase }}</ion-title>
  </ion-toolbar>
</ion-header>
<ion-content>
  @if (patron) {
    <ion-card>
      <ion-card-content>
        <ion-grid>
          <ion-row>
            <ion-col> {{ 'library.account.pages.profile.labels.id' | translate }}: </ion-col>
            <ion-col>
              {{ patron.id }}
            </ion-col>
          </ion-row>
          <ion-row>
            <ion-col> {{ 'library.account.pages.profile.labels.name' | translate }}: </ion-col>
            <ion-col> {{ patron.name_details?.title ?? '' }} {{ patron.name }} </ion-col>
          </ion-row>
          @if (patron.email) {
            <ion-row>
              <ion-col> {{ 'library.account.pages.profile.labels.email' | translate }}: </ion-col>
              <ion-col>
                {{ patron.email }}
              </ion-col>
            </ion-row>
          }
          @if (patron.address) {
            <ion-row>
              <ion-col> {{ 'library.account.pages.profile.labels.address' | translate }}: </ion-col>
              <ion-col>
                {{ patron.address }}
              </ion-col>
            </ion-row>
          }
          @if (patron.expires) {
            <ion-row>
              <ion-col> {{ 'library.account.pages.profile.labels.expires' | translate }}: </ion-col>
              <ion-col>
                @if (isUnlimitedExpiry(patron.expires)) {
                  {{ 'library.account.pages.profile.values.unlimited' | translate }}
                } @else {
                  {{ 'library.account.pages.profile.values.expires' | translate }}:&nbsp;{{
                    patron.expires | amDateFormat: 'll'
                  }}
                }
              </ion-col>
            </ion-row>
          }
        </ion-grid>
      </ion-card-content>
    </ion-card>
  } @else {
    <stapps-skeleton-simple-card [title]="false" [lines]="4"> </stapps-skeleton-simple-card>
  }
</ion-content>
