{% extends "base.html" %}
{% block head_title %}{{ location.name }}{% endblock %}
{% block breadcrumbs %}
    <ol class="breadcrumb">
        <li><a href="{% url "campaign_index" %}">Campaigns</a></li>
        <li><a href="{% url "campaign_view" location.campaign.pk %}">{{ location.campaign.name }}</a></li>
        <li><a href="{% url "location_index" location.campaign.pk %}">Locations</a></li>
        <li>{{ location.name }}</li>
    </ol>
{% endblock %}
{% block content %}
{#    TODO Location View Template#}
    <h1>{{ location.name }}</h1>
    <div class="row">
        <div class="col-sm-2">Parent Location</div>
        <div class="col-sm-10"><a href="{% url 'location_view' location.campaign_id location.parent_location_id  %}">{{ location.parent_location}}</a></div>
        <div class="col-sm-2">Description</div>
        <div class="col-sm-10">{{ location.description }}</div>
    </div>
    <h2>Inner Locations</h2>

    <table class="table table-strpied">
    <thead><tr><th>#</th><th>Name</th></tr></thead>
    <tbody>
    {% for sublocation in location.location_set.all %}
        <tr>
        <td>{{ forloop.counter }}</td>
        <td><a href="{% url "location_view" location.campaign.pk sublocation.pk %}">{{ sublocation.name }}</a></td>
        </tr>
    {% endfor %}
    </tbody>
    </table>

    <h2>Related Characters</h2>
    <table class="table table-strpied">
    <thead><tr><th>#</th><th>Name</th><th>Description</th></tr></thead>
    <tbody>
    {% for character_rel in location.characterlocationrelationship_set.all %}
        <tr>
        <td>{{ forloop.counter }}</td>
            <td><a href="{% url "character_view" location.campaign.pk character_rel.character.pk %}">{{ character_rel.character.name }}</a></td>
            <td>{{ character_rel.description }}</td>
        </tr>
    {% endfor %}
    </tbody>
    </table>
{% endblock %}