{% extends 'base/base.html' %}
{% load static %}
{% block title %} SignUp {% endblock %}l
{% block css %}
    <link rel="stylesheet" href="{% static 'registration/css/bootstrapValidator.css' %}"/>
    <script type="text/javascript" src="{% static 'registration/js/bootstrapValidator.js' %}"></script>
    <script type="text/javascript" src="{% static 'registration/js/passwd.js' %}"></script>
{% endblock %}

{% block body %}
    {% include 'base/nav-bar.html' %}
    <div id="wrap">
        <div id="main">

                <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>

            <div class="container">
                <div class="row">
                    <div class="col-md-6 offset-md-3 card">
                        <div class="card-block">
                            <h1 class="card-title">Sign Up</h1>
                            <hr>
                            <form action="" method="post">
                                {% csrf_token %}
                                <div class="row">
                                    <div class="form-group col-md-6">
                                        <label for="first_name">FirstName</label>
                                        <input type="text" class="form-control" name="first_name" id="first_name"
                                               value="{{ form.first_name.value|default_if_none:"" }}"
                                               placeholder="First Name">
                                        <small class="form-text text-muted">
                                            First Name
                                        </small>
                                    </div>

                                    <div class="form-group col-md-6">
                                        <label for="last_name">LastName</label>
                                        <input type="text" class="form-control" name="last_name" id="last_name"
                                               value="{{ form.last_name.value|default_if_none:"" }}"
                                               placeholder="Last Name">
                                        <small class="form-text text-muted">
                                            Last Name
                                        </small>
                                    </div>


                                    <div class="form-group col-md-8">
                                        <label for="email">Email</label>
                                        <input type="email" class="form-control" name="email" id="email"
                                               value="{{ form.email.value|default_if_none:"" }}" placeholder="email">
                                        <small class="form-text text-muted">
                                            Enter your Email Id
                                        </small>
                                    </div>

                                    <div class="form-group col-md-4">
                                        <label for="year">Batch</label>
                                        <input type="number" class="form-control" name="year" id="year"
                                               value="{{ form.year.value|default_if_none:"" }}" placeholder="YYYY">
                                        <small class="form-text text-muted">
                                            Year of Admission
                                        </small>
                                    </div>

                                    <div class="form-group col-md-12">
                                        <label for="username">Username</label>
                                        <input type="text" class="form-control" name="username" id="username"
                                               value="{{ form.username.value|default_if_none:"" }}" placeholder="Username">
                                        <small class="form-text text-muted">
                                            Username, used to login
                                        </small>
                                    </div>

                                    <div class="form-group col-md-6">
                                        <label for="password1">Password</label>
                                        <input type="password" class="form-control" name="password1" id="password1"
                                               value="" placeholder="Password">
                                        <small class="form-text text-muted">
                                            Password
                                        </small>
                                    </div>

                                    <div class="form-group col-md-6">
                                        <label for="password2">Again</label>
                                        <input type="password" class="form-control" name="password2" id="password"
                                               value="{{ object.email }}" placeholder="Password again">
                                        <small class="form-text text-muted">
                                            Password, Once more
                                        </small>
                                    </div>
                                    <div class="form-group col-md-12">
                                        <a class="text-muted" href="{% url 'login' %}"><small>Already have an account?</small></a>
                                    </div>

                                    <div class="col-md-12">
                                        <button type="submit" class="btn btn-primary">Submit</button>
                                    </div>

                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>


    <style>
        .container {
            margin-top: 70px;
        }

        .notifications {
            position: fixed;
            top: 90px;
            right: 0;
            z-index: 1000;
            font-size: 0.7em;
            max-width: 90%;
        }

        body {
            background: rgb(242, 245, 244);
        }
    </style>
    {% include 'base/footer.html' %}


{% endblock %}

