<template>
  <div class="row justify-content-center">
    <div class="col-8">
      <div v-if="registration">
        <h2 class="jh-entity-heading" data-cy="registrationDetailsHeading">
          <span>Rejestracja na wydarzenie </span> {{ registration.event.name }}
        </h2>
        <dl class="row jh-entity-details">
          <dt>
            <span>Data</span>
          </dt>
          <dd>
            <span v-if="registration.dateTime">{{ formatDateLong(registration.dateTime) }}</span>
          </dd>
          <dt>
            <span>Aktywna</span>
          </dt>
          <dd>
            <span>{{ registration.active }}</span>
          </dd>
          <dt>
            <span>Imię i Nazwisko gracza</span>
          </dt>
          <dd>
            <span>{{ registration.playerName }}</span>
          </dd>
          <dt>
            <span>Komentarz</span>
          </dt>
          <dd>
            <span>{{ registration.comment }}</span>
          </dd>
          <dt>
            <span>Osoba rejestrująca/płacąca</span>
          </dt>
          <dd>
            {{
              registration.user ? registration.user.firstName + ' ' + registration.user.lastName + ' (' + registration.user.login + ')' : ''
            }}
          </dd>
          <dt>
            <span>Wydarzenie</span>
          </dt>
          <dd>
            <div v-if="registration.event">
              <router-link :to="{ name: 'EventView', params: { eventId: registration.event.id } }">{{
                registration.event.name
              }}</router-link>
            </div>
          </dd>
        </dl>
        <button type="submit" @click.prevent="previousState()" class="btn btn-info" data-cy="entityDetailsBackButton">
          <font-awesome-icon icon="arrow-left"></font-awesome-icon>&nbsp;<span>Back</span>
        </button>
        <router-link
          v-if="registration.id"
          :to="{ name: 'RegistrationEdit', params: { registrationId: registration.id } }"
          custom
          v-slot="{ navigate }"
        >
          <button @click="navigate" class="btn btn-primary">
            <font-awesome-icon icon="pencil-alt"></font-awesome-icon>&nbsp;<span>Edit</span>
          </button>
        </router-link>
      </div>
    </div>
  </div>
</template>

<script lang="ts" src="./registration-details.component.ts"></script>
