{% extends '@ZikulaCoreInstaller/theme.html.twig' %}

{% block title 'Migrating Users...'|trans %}

{% block content %}
<div id="userMigration">
    <div>
        <h3>
            <span class="fas fa-cogs"></span>
            {% trans %}Migrate Users to ZAuth{% endtrans %}
            {{ pageSetVar('title', 'Migrate Users to ZAuth'|trans ) }}
        </h3>
        <div class="alert alert-info">
            {% trans %}This will migrate all VALID users from the old Users table to the new ZAuth table.{% endtrans %}
            {% trans %}This could potentially take a long time if there are many users that must be migrated. They will be migrated in batches of 25 to reduce the risk of timeouts.{% endtrans %}
            <em>{% trans %}Invalid users cannot be migrated unless their data is manually corrected. The errors are posted to the logfile.{% endtrans %}</em>
        </div>
        <div class="progress mb-3" id="progress-bar">
            <div class="progress-bar bg-success progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0">
                <span class="sr-only">{% trans %}Progress bar{% endtrans %}</span>
            </div>
        </div>
        <div class="alert alert-info">{% trans with {'%amount%': count} %}There are %amount% users to try to migrate.{% endtrans %}</div>
        <div class="text-center">
            <i id="spinner" class="fas fa-cog fa-2x fa-spin fa-fw d-none"></i> <button id="migrate" class="btn btn-lg btn-success">{% trans %}Begin migration{% endtrans %}</button>
        </div>
        <div id="pathHolder" data-migrate-route="{{ path('zauth_migration') }}" data-redirect-route="{{ path('upgrade', {stage: 'locale'}) }}"></div>
    </div>
</div>
{% endblock %}
