{% extends 'base/base.html' %}

{% block title %} New responsibility {% endblock %}

{% block body %}
    {% include 'base/nav-bar.html' %}
    <div id="wrap">
        <div id="main">
            <!-- content goes here -->
            <div class="container">
                <div class="row">
                    <div class="col-md-8 offset-md-2 card">
                        <div class="card-block">
                            <h1 class="card-title">Responsibility</h1>
                            <hr>
                            <form action="" method="post">
                                {% csrf_token %}
                                <div class="form-group">
                                    <label for="name">Title</label>
                                    <input type="text" class="form-control" name="name" id="name"
                                           value="{{ object.name }}" placeholder="Title">
                                    <small id="emailHelp" class="form-text text-muted">
                                        Title of the responsibility
                                    </small>
                                </div>

                                <div class="form-group">
                                    <label for="description">Description</label>
                                    <textarea id="description" name="description" class="form-control"
                                              placeholder="Description" rows="5">{{ object.description }}</textarea>
                                </div>
                                <button type="submit" class="btn btn-primary">Submit</button>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    {% include 'base/footer.html' %}

    <div class="notifications">
    {% if form.errors %}
        {% for field in form %}
            {% for error in field.errors %}
                <div class="alert alert-danger alert-dismissable">
                    <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
                    {{ field.label }}: {{ error|escape }}
                </div>
            {% endfor %}
        {% endfor %}
        {% for error in form.non_field_errors %}
            <div class="alert alert-danger alert-dismissable">
                <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
                {{ error|escape }}
            </div>
        {% endfor %}
    {% endif %}
    </div>

    <style>
        .container {
            margin-top: 70px;
        }
        .notifications {
            position: fixed;
            top: 90px;
            right: 0;
            z-index: 1000;
            font-size: 0.7em;
            max-width: 90%;
        }
    </style>
{% endblock %}
