{% extends "base.html" %}
{% load i18n %}
{% get_current_language as LANGUAGE %}
{% block content %}
{% if messages %}
    <div>
        {% for message in messages %}
        <p class="{{ message.tags }}"><b>{{ message }}</b></p>
        {% endfor %}
    </div>
{% endif %}
<div class="ser user_L">
    <div class="user__pic"
        style="background:url(//upics.yandex.net/{{ user.uid }}/normal/) 50%; background-size:cover;"></div>
    <div class="user__name">
        {% if user.display_name %}
        <span>{{ user.display_name }}</span>
        {% else %}
        <span>{{ user.login }}</span>
        {% endif %}
        <em>{{ user.login }}</em>
    </div>
</div>
{% if user.has_contacts or user.has_social_links %}
<div class="contacts">
    <div class="title">
        <h4>{% trans "profile.contacts" %}</h4>
    </div>
    {% if user.address %}
    <p>{{ user.address }}</p>
    {% endif %}
    {% if user.company_name %}
    {# Translators: Company #}
    <p>{% trans "profile.company" %}: <span>{{ user.company_name }}</span></p>
    {% endif %}
    {% if user.contact_email %}
    <p>{% trans "profile.email" %}: <a href="mailto:{{ user.contact_email }}" class="link">{{ user.contact_email }}</a></p>
    {% endif %}
    {% if user.personal_website %}
    <p>{% trans "profile.website" %}: <a href="{{ user.personal_website }}" target="_blank" class="link">{{ user.personal_website }}</a></p>
    {% endif %}
    {% if user.has_social_links %}
        {% if user.fb_link %}
        <a href="https://facebook.com/{{ user.fb_link }}" target="_blank" class="link link_social"><i class="i24 i24_fb"></i> {{ user.fb_link }}</a>
        {% endif %}
        {% if user.twitter_link %}
        <a href="https://twitter.com/{{ user.twitter_link }}" target="_blank" class="link link_social"><i class="i24 i24_twi"></i> {{ user.twitter_link }}</a>
        {% endif %}
    {% endif %}
    {% if user.hacker_one_link %}
    <a href="https://hackerone.com/{{ user.hacker_one_link }}" target="_blank" class="link link_social"><i class="i24_hacker_one"></i> {{ user.hacker_one_link }}</a>
    {% endif %}
    {% if user.bug_crowd_link %}
    <a href="https://bugcrowd.com/{{ user.bug_crowd_link }}" target="_blank" class="link link_social"><i class="i24_bug_crowd"></i> {{ user.bug_crowd_link }}</a>
    {% endif %}
</div>
{% endif %}
{% if user.badges.exists %}
<div class="rewards">
    <div class="title">
        {# Translators: Rewards #}
        <h4>{% trans "profile.rewards" %}:</h4>
    </div>
    {% for count, badge, is_inactive in awards %}
    <div class="badge badge_positioned">
        {% if count > 1 %}
        <div class="award__counter{%if is_inactive %} award_inactive{% endif %}">{{ count }}</div>
        {% endif %}
        {% if badge.image_url %}
        <i style="background:url({{ badge.image_url }}); background-size: 100px 100px; width: 100px; height: 100px; border-radius:51px; display: inline-block;{% if is_inactive %} opacity: .4;{% endif %}"></i>
        {% else %}
        <i class="award award_empty{% if is_inactive %} award_inactive{% endif %}"></i>
        {% endif %}
        {% if LANGUAGE == 'en' %}
            <p>{{ badge.name_en }}</p>
        {% else %}
            <p>{{ badge.name }}</p>
        {% endif %}
    </div>
    {% endfor %}
</div>
{% endif %}
{% endblock %}
