{% extends "base.html" %}
{% set active_page = "seasons" %}
{% block title %}{{ model.title }} {{ super() }}{% endblock %}

{% block page %}
  {% if g.is_editor %}
    <div class="btn-toolbar" role="toolbar">
      <a class="btn btn-primary" role="button"
         href="{{ url_for('episode_edit', season_id = model.season.id, episode_id = model.episode.id) }}">
        <span class="fas fa-pencil-alt"></span> Edit Episode
      </a>
      <a class="btn btn-primary" role="button"
         href="{{ url_for("event_new", ep_id = model.episode.id, s_id = model.season.id) }}" >
        <span class="fas fa-plus"></span> Event
      </a>
    </div>
  {% endif %}

  <div class="row">
    <div class="col-sm-6">

      <!--region Info Card-->

      <div class="card">
        <div class="card-header text-center">
          {{ model.episode.code }}: {{ model.episode.title }}
        </div>
        <div class="card-body">
          <div class="card-text">
              <ul class="list-group list-group-flush">
                <li class="list-group-item">
                  <span class="font-weight-bold">Date:</span>
                  {{ model.episode.date }}
                </li>
                <li class="list-group-item">
                  <span class="font-weight-bold">Start:</span>
                  {{ model.episode.start|format_time }}
                </li>
                <li class="list-group-item">
                  <span class="font-weight-bold">End:</span>
                  {{ model.episode.end|format_time }}
                </li>
                <li class="list-group-item">
                  <span class="font-weight-bold">Play Time:</span>
                  {{ model.episode.playtime }}
                </li>
                <li class="list-group-item">
                  <span class="font-weight-bold">Enemies Defeated:</span>
                  {{ model.events.victory_count }}
                </li>
                <li class="list-group-item">
                  <span class="font-weight-bold">Deaths:</span>
                  {{ model.events.defeat_count }}
                </li>
              </ul>
            </div>
        </div>
      </div>

      <!--endregion-->

      <hr>

      <!--region Player Card-->

      <div class="card">
        <div class="card-header text-center">
          Players in this episode
        </div>
        <div class="card-body">
          <table class="table table-striped table-bordered">
            <thead>
              <tr>
                <th scope="col" class="col-sm-auto text-center">Name</th>
              </tr>
            </thead>
            <tbody>
              {% for player in model.players %}
              <tr>
                  <td class="col-sm-auto text-center">{{ player.name }}</td>
              </tr>
            {% endfor %}
            </tbody>
          </table>
        </div>
      </div>

      <!--endregion-->

    </div>

    <div class="col-sm-6">
      <div class="card">
        <div class="card-header text-center">
          Event List
        </div>
        <div class="card-body">
        </div>
      </div>
    </div>
  </div>
{% endblock %}