{% extends "layouts/base-fullscreen.html" %}

{% block title %} Register {% endblock %} 

<!-- Specific Page CSS goes HERE  -->
{% block stylesheets %}{% endblock stylesheets %}

{% block content %}

    <div class="content">
        <div class="container">
            <div class="row pt-5">
                <div class="col-md-6 mt-5 offset-md-3 pt-5 mt-5">
                    <div class="card">
                        <div class="card-header text-center py-4">
                            <h4 class="title">
                                Sign UP
                            </h4>

                            <h6 class="card-category">
                                {% if msg %}
                                    <span class="text-danger">{{ msg | safe }}</span>
                                {% else %}
                                    <span>
                                        Add your credentials
                                    </span>
                                {% endif %}  
                            </h6>     

                        </div>

                        {% if success %}

                            <div class="card-footer text-center">
                                <a href="{{ url_for('authentication_blueprint.login') }}" 
                                   class="btn btn-fill btn-primary">Login</a>
                            </div>

                        {% else %}

                            <form role="form" method="post" action="">
            
                                {{ form.hidden_tag() }} 

                                <div class="card-body px-5 py-3">

                                    <div class="row">
                                        <div class="col-md-12 px-md-1">
                                            <div class="form-group">
                                                <label>Username</label>
                                                {{ form.username(class="form-control") }}
                                            </div>
                                        </div>

                                        <div class="col-md-12 px-md-1">
                                            <div class="form-group">
                                                <label>Email</label>
                                                {{ form.email(class="form-control", type="email") }}
                                            </div>
                                        </div>

                                        <div class="col-md-12 px-md-1">
                                            <div class="form-group">
                                                <label>Password</label>
                                                {{ form.password(class="form-control", type="password") }}
                                            </div>
                                        </div>
                                    </div>

                                    
                                </div>
                                <div class="card-footer text-center">
                                    <button type="submit" name="register" class="btn btn-fill btn-primary">Register</button>

                                    <br /><br />
                                    
                                    <p>
                                        Have an account? <a href="{{ url_for('authentication_blueprint.login') }}" class="text-primary">Login</a>
                                    </p> 
                                </div>
                            
                            </form>

                        {% endif %} 

                    </div>
                </div>

            </div>
        </div>

    </div>

{% endblock content %}

<!-- Specific Page JS goes HERE  -->
{% block javascripts %}{% endblock javascripts %}
