{% extends 'base.html.twig' %}
{% trans_default_domain 'fediplan' %}
{% block title %}{{ 'common.about_fediplan'|trans }}{% endblock %}

{% block content %}
    {% include 'nav.html.twig' %}
    <h1>{{ 'common.login'|trans}}</h1>

    {{ form_start(form) }}
    {{ form_row(form._token) }}

    {{ form_errors(form) }}
    {% if flow.getCurrentStepNumber() == 1 %}
        <div class="row">
            <div class=" col-md-4">
                <div class="form-group has-feedback">
                    {{ form_label(form.host) }}
                    <div class="input-group">
                        <div class="input-group-prepend">
                            <span class="input-group-text" id="basic-addon1"><i class="fa fa-globe"></i></span>
                        </div>
                        {{ form_widget(form.host, {'attr': {'class': 'form-control'}}) }}
                    </div>
                    {% if not form.host.vars.errors is empty %}
                        <span class="label label-danger">
						{% for errorItem in form.host.vars.errors %}
                            {{ errorItem.message }}
                        {% endfor %}
					</span>
                    {% endif %}
                </div>
            </div>
        </div>
    {% elseif flow.getCurrentStepNumber() == 2 %}
        <div class="row">
            <div class="col-md-6">
                <div class="alert alert-warning">
                    {{ 'messages.login_authorization'|trans }}
                </div>
                <a href="{{ urlToMastodon }}" target="_blank" class="btn btn-default">  {{ 'messages.authorization_get'|trans }}</a>
            </div>
        </div>
        <div class="row">
            <div class=" col-md-4">
                <div class="form-group has-feedback">
                    {{ form_label(form.code) }}
                    <div class="input-group">
                        <div class="input-group-prepend">
                            <span class="input-group-text" id="basic-addon1"><i class="fa fa-key"></i></span>
                        </div>
                        {{ form_widget(form.code, {'attr': {'class': 'form-control'}}) }}
                    </div>

                    {% if not form.code.vars.errors is empty %}
                        <span class="label label-danger">
						{% for errorItem in form.code.vars.errors %}
                            {{ errorItem.message }}
                        {% endfor %}
					</span>
                    {% endif %}
                </div>
            </div>
        </div>
        {{ form_widget(form.client_id, {'value' : client_id}) }}
        {{ form_widget(form.client_secret, {'value' : client_secret}) }}
    {% endif %}
    {{ form_widget(form) }}
    <div class="row">
        <div class="col-md-2">
            <input type="submit" class="btn btn-primary btn-block btn-flat"  value="{{ 'common.next'|trans }}"/>
        </div>
    </div>


    <blockquote class="blockquote text-center" style="margin-top: 50px;">
        <p class="mb-0">{{ 'page.index.about'|trans |raw}}</p>
        <p>{{ 'page.index.data'|trans |raw}}</p>
        <footer class="blockquote-footer">FediPlan 1.0.0</footer>
    </blockquote>

    {{ form_end(form) }}
{% endblock %}
