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

{% block page %}
  {% if g.is_editor %}
    <div class="btn-toolbar" role="toolbar">
      <a class="btn btn-primary" href="{{ url_for('enemy_new') }}" role="button">
        <span class="fas fa-plus"></span> Enemy
      </a>
    </div>
  {% endif %}
{% if not model.enemies %}
    There are no enemies.
  {% else %}
      <table class="table table-hover table-striped table-bordered">
        <thead>
          <tr>
            <th scope="col" class="col-sm-auto text-center">ID</th>
            <th scope="col" class="col-sm-auto text-center">Name</th>
            <th scope="col" class="col-sm-auto text-center">Boss Enemy</th>

            {% if g.is_editor %}
              <th scope="col" class="col-sm-auto text-center">Editor</th>
            {% endif %}
          </tr>
        </thead>
        <tbody>
          {% for item in model.enemies %}
          <tr>
            <td class="col-sm-auto text-center">{{ item.id }}</td>
            <td class="col-sm-auto text-center">{{ item.name }}</td>
            <td class="col-sm-auto text-center">
              {% if item.boss %}
                <span class="fas fa-check"></span>
              {% endif %}
            </td>

            {% if g.is_editor %}
              <td class="col-sm-auto text-center">
                <a class="btn btn-default" href="{{ url_for('enemy_edit', enemy_id = item.id) }}">
                  <span class="fas fa-pencil-alt"></span>
                </a>
              </td>
            {% endif %}
          </tr>
        {% endfor %}
        </tbody>
      </table>

  {% endif %}
{% endblock %}