<template>
  <div class="row justify-content-center">
    <div class="col-8">
      <div v-if="registration">
        <h2 class="jh-entity-heading" data-cy="registrationDetailsHeading"><span>Registration</span> {{ registration.id }}</h2>
        <dl class="row jh-entity-details">
          <dt>
            <span>Date Time</span>
          </dt>
          <dd>
            <span v-if="registration.dateTime">{{ formatDateLong(registration.dateTime) }}</span>
          </dd>
          <dt>
            <span>Active</span>
          </dt>
          <dd>
            <span>{{ registration.active }}</span>
          </dd>
          <dt>
            <span>Player Name</span>
          </dt>
          <dd>
            <span>{{ registration.playerName }}</span>
          </dd>
          <dt>
            <span>Comment</span>
          </dt>
          <dd>
            <span>{{ registration.comment }}</span>
          </dd>
          <dt>
            <span>User</span>
          </dt>
          <dd>
            {{ registration.user ? registration.user.login : '' }}
          </dd>
          <dt>
            <span>Event</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>
