{% extends "base-install.twig" %}
{% import "forms.twig" as forms %}

{% block jumboTron %}
    <div class="jumbotron">
        <div class="container">
            {% set themeName = theme.getThemeConfig("app_name") %}
            {% set header %}{% trans %}Welcome to the {{ themeName }} Installation{% endtrans %}{% endset %}
            <h1>{{ header }}</h1>
            <p>{% trans %}Thank you for choosing {{ themeName }}. This installation wizard will take you through
                setting up {{ themeName }} one step at a time. There are 6 steps in total, the first one is below.{% endtrans %}
            </p>
            <p><a class="btn btn-primary btn-lg" role="button" href="{{ theme.getThemeConfig("cms_install_url") }}" target="_blank">{% trans "Installation guide" %} &raquo;</a></p>
        </div>
    </div>
{% endblock %}

{% block stepContent %}
    <div class="row">
        <div class="col-md-12">
            {% set themeName = theme.getThemeConfig("app_name") %}
            <p>{% trans %}First we need to check if your server meets {{ themeName }}'s requirements.{% endtrans %}</p>
            <table id="sessions" class="table table-striped">
                <thead>
                <tr>
                    <th>{% trans "Item" %}</th>
                    <th>{% trans "Status" %}</th>
                    <th>{% trans "Advice" %}</th>
                </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>{{ "Settings File System Permissions"|trans }}</td>
                        <td>
                            {% if isSettingsPathWriteable %}
                                <span class="fa fa-check"></span>
                            {% else %}
                                <span class="fa fa-times"></span>
                            {% endif %}
                        </td>
                        <td>{{ "Write permissions are required for web/settings.php"|trans }}</td>
                    </tr>
                {% for check in config.checkEnvironment() %}
                    <tr>
                        <td>{{ check.item }}</td>
                        <td>
                            {% if check.status == 0 %}
                                <span class="fa fa-times"></span>
                            {% elseif check.status == 1 %}
                                <span class="fa fa-check"></span>
                            {% else %}
                                <span class="fa fa-exclamation"></span>
                            {% endif %}
                        </td>
                        <td>{{ check.advice }}</td>
                    </tr>
                {% endfor %}
                </tbody>
            </table>
            {% if config.environmentFault() %}
                <form action="{{ url_for("install", {step: 1}) }}" class="form-inline">
                    {% set title %}{% trans "Retest" %}{% endset %}
                    {{ forms.button(title, "submit") }}
                </form>
            {% elseif config.environmentWarning() %}
                <form action="{{ url_for("install", {step: 2}) }}" class="form-inline">
                    {% set title %}{% trans "Retest" %}{% endset %}
                    {% set link = url_for("install", {step: 1}) %}
                    {{ forms.button(title, "link", link) }}

                    {% set title %}{% trans "Next" %}{% endset %}
                    {{ forms.button(title, "submit", link) }}
                </form>
            {% else %}
                <form action="{{ url_for("install", {step: 2}) }}" class="form-inline">
                    {% set title %}{% trans "Next" %}{% endset %}
                    {{ forms.button(title, "submit") }}
                </form>
            {% endif %}
        </div>
    </div>
{% endblock %}