{% extends "blog/base.html" %}
{% load render_table from django_tables2 %}

<!-- This template creates the profile page for one speaker. -->

{% block content %}
<div class="container">
    <div class="row">
        <div class="col s12 m4 l4">
            <div class="card">
                <div class="card-content">
                    <span class="card-title center-align">
                        {% if current_speaker.title %}
                        {{current_speaker.title}}
                        {% endif %}
                        {% if current_speaker.nobility %}
                        {{current_speaker.nobility}}
                        {% endif %}
                        {{current_speaker.first_name}}
                        {% if current_speaker.name_prefix %}
                        {{current_speaker.name_prefix}}
                        {% endif %}
                        {{current_speaker.last_name}}</span>
                    <p class="center-align"><i class="large material-icons blue-grey-text darken-4">account_circle</i></p>
                    <span class="card-title">Biographie</span>
                    <ul>
                        <li><i class="material-icons blue-grey-text darken-4" style="margin-right: 10px;">cake</i> Geburtstag: {{current_speaker.birthday}}</li>
                        <br />
                        {% if current_speaker.day_of_death %}
                        <li><b style="font-size: 2em;" class="blue-grey-text darken-4">†</b><span style="position: relative; right: -20px;"> Todesjahr:
                                {{ current_speaker.day_of_death}}</span></li>
                        <br />
                        {% endif %}
                        <li><i class="material-icons blue-grey-text darken-4" style="margin-right: 10px;">home</i> Geburtsort: {{current_speaker.birthplace}}</li>
                        <br />
                        <li><i class="material-icons blue-grey-text darken-4" style="margin-right: 10px;">work</i> Beruf: {{current_speaker.occupation}}</li>
                        <br />
                        <li><i class="material-icons blue-grey-text darken-4" style="margin-right: 10px;">fingerprint</i> Bundestags ID: {{current_speaker.id}}</li>
                        <br />
                        <li><i class="material-icons blue-grey-text darken-4" style="margin-right: 10px;">people</i> Partei: {{current_speaker.party}}<a class="tooltipped" data-position="bottom" data-tooltip="Aktuelle eingetragene Partei, bei der die Person Mitglied ist oder war. "><i
                                    class="material-icons blue-grey-text darken-4">info_outline</i></a></li>
                        <br />
                        <li><i class="material-icons blue-grey-text darken-4" style="margin-right: 10px;">filter_9_plus</i> Reden/Redebeiträge insgesamt: {{speech_count}}</li>
                    </ul>
                </div>
            </div>
            <ul class="collapsible expandable hoverable">
                {% if current_speaker.short_vita %}
                <li>
                    <div class="collapsible-header">Kurzbiographie</div>
                    <div class="collapsible-body white"><span>{{current_speaker.short_vita}}</span></div>
                </li>
                {% endif %}
                {% for period in sorted_l_info %}
                <li>
                    <div class="collapsible-header">
                        <i class="material-icons blue-grey-text darken-4" style="margin-right: 10px;">library_books</i> Wahlperiode {{period.legislative_period}}
                    </div>
                    <div class="collapsible-body white">
                        <ul>
                            <span class="card-title">Mitglied des Bundestags</span>
                            <li>Mitglied von {{period.legislative_period_start_date|date:"d.m.Y"}} bis
                                {% if period.legislative_period_end_date is None %}
                                heute
                                {% else %}
                                {{period.legislative_period_end_date|date:"d.m.Y"}}
                                {% endif %}
                            </li>
                            <br />
                            <li>Mandatsart: {{period.mandate_type}}
                            <li>
                                <br />
                                <span class="card-title">Institutions und Fraktionszugehörigkeit</span>
                                {% for institution in sorted_i_info %}
                                {% if institution.current_period == period.legislative_period %}
                            <li><b>{{institution.institution}}</b>
                            <li>
                                <br />
                                {% if institution.institution_start_date is not None %}
                            <li>Von {{institution.institution_start_date|date:"d.m.Y"}} bis
                                {% if institution.institution_end_date is None %}
                                heute
                                {% else %}
                                {{institution.institution_end_date|date:"d.m.Y"}}
                                {% endif %}
                            <li>
                                <br />
                                {% endif %}
                                {% endif %}
                                {% endfor %}
                        </ul>
                    </div>
                </li>
                {% endfor %}
            </ul>
        </div>
        <div class="col s12 m8">
            <div class="card">
                <div class="card-content">
                    <span class="card-title">Reden</span>
                    <div class="card-content">
                    <p>Alle Reden, die von {% if current_speaker.title %}
                    {{current_speaker.title}}
                    {% endif %}
                    {% if current_speaker.nobility %}
                    {{current_speaker.nobility}}
                    {% endif %}
                    {{current_speaker.first_name}}
                    {% if current_speaker.name_prefix %}
                    {{current_speaker.name_prefix}}
                    {% endif %}
                    {{current_speaker.last_name}} als MdB gehalten wurden.
                    <div style="overflow-x:auto;">
                        {% render_table speech_table %}
                    </div>
                </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock content %}
