{% extends "base.html" %}
{% load static %}
{% load tailwind_forms %}
{% load i18n %}

{% block title %}{% translate "Member settings" %} · {{ project.name }}  · {{ site_title }}{% endblock %}

{% block content %}


<div class="flex items-center justify-center">

    <div class="m-4 max-w-4xl flex-auto">
        <form action="." method="post">
        {% csrf_token %}

        {% if messages %}
        <ul>
            {% for message in messages %}
                {# if we introduce different levels we can use{% message.level == DEFAULT_MESSAGE_LEVELS.SUCCESS %} #}
                <li class="bg-cyan-50 dark:bg-cyan-900 border-2 border-cyan-800 dark:border-cyan-400 p-4 rounded-lg">{{ message }}</li>
            {% endfor %}
        </ul>
        {% endif %}

        <div>
            <h1 class="text-4xl my-4 font-bold">{% translate "Membership settings" %}</h1>
        </div>

        <div class="mt-4 mb-4">
            {% if this_is_you %}
                {% blocktranslate with project_name=project.name %}Your membership settings for project "{{ project_name }}".{% endblocktranslate %}
            {% else %}
                {% blocktranslate with project_name=project.name username=user.username %}Settings for project "{{ project_name }}" and user {{ username }}.{% endblocktranslate %}
            {% endif %}
        </div>

        {% tailwind_formfield form.role %}
        {% tailwind_formfield form.send_email_alerts %}

        <button class="font-bold text-slate-800 dark:text-slate-100 border-slate-500 dark:border-slate-400 pl-4 pr-4 pb-2 pt-2 border-2 bg-cyan-200 dark:bg-cyan-700 hover:bg-cyan-400 dark:hover:bg-cyan-600 active:ring rounded-md">{% translate "Save" %}</button>
        {% if this_is_you %}
            <a href="{% url "project_list" %}" class="text-cyan-500 dark:text-cyan-300 font-bold ml-2">{% translate "Cancel" %}</a> {# not quite perfect, because "you" can also click on yourself in the member list #}
        {% else %}
            <a href="{% url "project_members" project_pk=project.pk %}" class="text-cyan-500 dark:text-cyan-300 font-bold ml-2">{% translate "Cancel" %}</a>
        {% endif %}
        </form>

    </div>

</div>


{% endblock %}
