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

{% block title %}Login | WebArchi{% endblock %}

{% block body %}

<div class="container mt-6 mb-6">
    <div class="has-text-centered">
        <img width="200px" src="{{ asset('img/ifc-web.png') }}" />
    </div>
    <h1 class="is-size-1 mt-6 mb-6 has-text-centered">IFC Web App</h1>
    <h2 class="is-size-3 mt-6 mb-6 has-text-centered">BHiLab CNR-ISPC</h2>

    <div class="card" style="max-width: 40vw; margin: 0 auto;">
        {% if error %}
            <div class="notification is-danger is-light" data-controller="notification"
                data-notification-target="notif">
                <button class="delete" data-action="click->notification#close"></button>
                Wrong user name and/or password. Please retry
            </div>
        {% endif %}
        <form class="card-content pl-5 pr-5 pt-6" action="{{ path('app_login') }}" id="login" method="post">
            <div class="field">
                <h2 class="label is-size-3 has-text-centered">Sign in</h2>
            </div>
            <div class="field">
                <label class="label">User name</label>
                <p class="control">
                    <input class="input" name="_username" required type="text" placeholder="User name">
                </p>
            </div>
            <div class="field mt-5" data-controller="show-password">
                <label class="label">Password</label>
                <p class="control has-icons-right">
                <input class="input" type="password" name="_password" required placeholder="Password" id="pass-field"
                    data-show-password-target="pass" />
                <span class="icon is-small is-right is-clickable" id="show-pw"
                    data-action="click->show-password#toggle">
                    <i class="fa fa-eye"></i>
                </span>
                </p>
            </div>
            <input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}">
            <div class="field mt-5" data-controller="loading">
                <p class="control" id="submit" data-loading-target="control">
                    <button class="button is-link is-fullwidth" type="submit" data-action="click->loading#setLoading">
                        Sign in
                    </button>
                </p>
            </div>
        </form>
    </div>
</div>
{% endblock %}
