{% extends '@CpCreationVitiCore/admin/base.html.twig' %}

{% block content %}
    <div class="panel panel-default">
        <div class="panel-heading">
            {{ 'admin_client_import.base.details_title'|trans }}
            <div class="pull-right">
                <a href="{{ path('admin_imported_client') }}" class="btn btn-default btn-xs">
                    {{ 'admin_client_import.back_to_base'|trans }}
                </a>
            </div>
        </div>
        <div class="panel-body">
            <dl class="dl-horizontal">
                <dt>{{ 'admin_client_import.base.email'|trans }}</dt>
                <dd>{{ item.email }}</dd>

                <dt>{{ 'admin_client_import.base.group'|trans }}</dt>
                <dd>{{ item.group.name }}</dd>

                <dt>{{ 'admin_client_import.base.application_status'|trans }}</dt>
                <dd>
                    {% if item.shouldApplyOnRegistration %}
                        <span class="label label-success">{{ 'admin_client_import.base.applied'|trans }}</span>
                    {% else %}
                        <span class="label label-default">{{ 'admin_client_import.base.not_applied'|trans }}</span>
                    {% endif %}
                </dd>
            </dl>

            <div class="alert {{ item.shouldApplyOnRegistration ? 'alert-info' : 'alert-warning' }}">
                {{ (item.shouldApplyOnRegistration
                    ? 'admin_client_import.base.enabled_help'
                    : 'admin_client_import.base.disabled_help')|trans }}
            </div>

            <form method="post" action="{{ path('admin_imported_client_toggle_application', {id: item.id}) }}">
                <input type="hidden" name="_token" value="{{ csrf_token('toggle-imported-client-' ~ item.id) }}">
                <button type="submit" class="btn {{ item.shouldApplyOnRegistration ? 'btn-warning' : 'btn-success' }}">
                    {{ (item.shouldApplyOnRegistration
                        ? 'admin_client_import.base.disable_application'
                        : 'admin_client_import.base.enable_application')|trans }}
                </button>
            </form>
        </div>
    </div>
{% endblock %}
