{% extends "base.html" %}

{% block title %} | Notifications{% endblock %}

{% block main %}
        <div class="page-header">
            <div class="container">
                <h1>Your profile</h1>
            </div>
        </div>

        <div class="container">
            {% include 'snippets/messages.html' %}

            <div class="row">
                <div class="col-sm-4">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h6 class="item-info">User profile</h6>
                            <h3>{{ user.display_name }}</h3>
                        </div>
                        <div class="list-group">
                            <a href="{% url 'admin:userprofile' %}" class="list-group-item">Edit profile</a>
                            <a href="{% url 'admin:notifications' %}" class="list-group-item active">Notifications</a>
                        </div>
                    </div>
                </div>
                <div class="col-sm-8">
                    <h3 class="header">Notifications</h3>
                    <form method="POST" action="{% url 'admin:notifications' %}" novalidate>
                        {% csrf_token %}
                        {% if admins %}
                        <table class="table table-hover">
                            <thead>
                                <tr>
                                    <th>Project</th>
                                    <th>Project contact</th>
                                </tr>
                            </thead>
                            <tbody>
                            {% for project in admins %}
                            <tr>
                                <td>{{ project.project.name }}</td>
                                <td align="center"><input type="checkbox" name="{{project.project.id}}" {% if project.contact%}checked="checked"{% endif %}></td>
                            </tr>
                            {% endfor %}
                            </tbody>
                        </table>
                        <div class="form-group">
                            <button type="submit" class="btn btn-primary">Save</button>
                            <button type="reset" class="btn btn-link">Reset</button>
                        </div>
                        {% else %}
                        <div class="well empty-list">
                            <p class="lead">We couldn't find any projects that you're involved with.</p>
                            <p>You will therefore not receive any notifications.</p>
                        </div>
                        {% endif %}
                    </form>
                </div>
            </div>
        </div>
{% endblock %}

{% block libraries %}
            <script src="/static/js/admin.ui.forms.validate.js"></script>
{% endblock %}
