{% extends "base.html" %}
{% load i18n comments thumbnail %}

{% block title %}{{ membership.first_name }} {{membership.last_name}}{% endblock %}

{% block teaser %}<h1>{% trans 'profile for' %} {{membership.username|title}}</h1>{% endblock %}

{% block navigation %}
<ul id="navigation">
    <li><a href="{% url 'player-ladder-score' membership.username %}">{% trans "Ladder Hanchans" %}</a></li>
    <li><a href="{% url 'player-kyu-score' membership.username %}">{% trans "Kyu Hanchans" %}</a></li>
    <li><a href="{% url 'player-dan-score' membership.username %}">{% trans "Dan Hanchans" %}</a></li>
    <li><a href="{% url 'player-invalid-score' membership.username %}">{% trans "Invalid Hanchans" %}</a></li>
    <li><a href="{% url 'maistar-player-games' membership.username %}">{% trans "Mai-Star Games" %}</a></li>
</ul>
{% endblock %}

{% block maincontent %}
{% if membership.avatar %}
    <img class="grid_3" src="{% thumbnail membership.avatar '220x220' crop='smart' %}" alt="{% trans 'Profile Image' %}"/>
{% else %}
    <div class="grid_3"> Noch kein Foto hoch geladen</div>
{% endif %}

<div class="grid_6">
    <ul>
        <li><strong>Name:</strong> {{membership.first_name}} {{membership.last_name}}</li>
        <li><strong>{% trans "Member Since" %}:</strong> {{membership.date_joined}}</li>
        <li><strong>{% trans "Last Login" %}:</strong> {{membership.last_login}}</li>
        {% if website %}
        <li><strong>Homepage:</strong> <a href="{{website}}">{{website}}</a></li>
        {% endif %}
    </ul>
    {% if kyu_dan_ranking %}
    <h3>Mahjong</h3>
    <ul>
        {% if kyu_dan_ranking.dan %}
        <li>
            <strong>{{kyu_dan_ranking.dan}}. Dan: </strong> {{ kyu_dan_ranking.dan_points }} {% trans 'Points' %}
            ({% trans 'Maximum' %}: {{ kyu_dan_ranking.max_dan_points }})
        </li>
        {% elif kyu_dan_ranking.kyu%}
        <li><strong>{{kyu_dan_ranking.kyu}}. Kyu: </strong> {{ kyu_dan_ranking.kyu_points }} {% trans 'Points' %}</li>
        {% endif %}
        <li><strong>{% trans 'Games Total' %}: </strong> {{ kyu_dan_ranking.hanchan_count }} Hanchans -
            {{kyu_dan_ranking.won_hanchans }} {% trans 'Won' %} / {{ kyu_dan_ranking.good_hanchans }} {% trans 'Good' %}
        </li>
        <li><strong>{% trans 'Current Season' %}: </strong> {{ ladder_ranking.hanchan_count }} Hanchans - {{ ladder_ranking.won_hanchans }} {% trans 'Won' %} / {{ ladder_ranking.good_hanchans }} {% trans 'Good' %}
        </li>
    </ul>
    {% endif %}
</div>

{% ifequal membership user %}
<div class="grid_3">
    <a href="{% url 'membership-edit' membership.username %}" class="button">
        <span class="fa fa-pencil"></span>
        {% trans "Edit Profile" %}
    </a>
    <a href="{% url 'password_change' %}" class="button">
        <span class="fa fa-key"></span>
        {% trans 'Change Password' %}
    </a>
    <a class="button" href="{% url 'social:begin' 'facebook' %}" rel="nofollow">
        <span class="fa fa-facebook"></span>
        {% blocktrans with 'Facebook' as name %}Associate with {{ name }}{% endblocktrans %}
    </a>
    <a class="button" href="{% url 'social:begin' 'twitter' %}" rel="nofollow">
        <span class="fa fa-twitter"></span>
        {% blocktrans with 'Twitter' as name %}Associate with {{ name }}{% endblocktrans %}
    </a>
    <a class="button" href="{% url 'social:begin' 'google-oauth2' %}" rel="nofollow">
        <span class="fa fa-google-plus"></span>
        {% blocktrans with 'Google' as name %}Associate with {{ name }}{% endblocktrans %}
    </a>

</div>
{% endifequal %}

{% block score_list %} {% endblock %}
{% endblock %}

{% block comments %}
{% if membership %}
    {% render_comment_list for membership %}
    {% render_comment_form for membership %}
{% endif %}
{% endblock %}

{% block buttonbar%}{%endblock%}
