{#
 # ---------------------------------------------------------------------
 #
 # GLPI - Gestionnaire Libre de Parc Informatique
 #
 # http://glpi-project.org
 #
 # @copyright 2015-2025 Teclib' and contributors.
 # @licence   https://www.gnu.org/licenses/gpl-3.0.html
 #
 # ---------------------------------------------------------------------
 #
 # LICENSE
 #
 # This file is part of GLPI.
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 #
 # ---------------------------------------------------------------------
 #}

{% if config_write_denied %}
    <h3>{{ __("Checking write access to configuration files") }}</h3>
    <div class="alert alert-danger" role="alert">
        <div class="d-flex">
            <div>
                <i class="ti ti-alert-circle me-2"></i>
            </div>
            <div>
                <h4 class="alert-title">{{ __('Write access denied for configuration files') }}</h4>
                <div class="text-secondary">
                    {{ __('A temporary write access to the following files is required: %s.')|format('`' ~ config_files_to_update|join('`, `') ~ '`') }}
                    <br />
                    {{ __('Write access to these files can be removed once the operation is finished.') }}
                </div>
            </div>
        </div>
    </div>
{% else %}
    <h3>{{ __("Checking of the compatibility of your environment with the execution of GLPI") }}</h3>
    {{ include('install/blocks/requirements_table.html.twig', {requirements: requirements}, with_context = false) }}
{% endif %}

{% set common_hiddens %}
   <input type="hidden" name="language" value="{{ session('glpilanguage') }}">
   <input type="hidden" name="update" value="{{ update }}">
   <input type="hidden" name="_glpi_csrf_token" value="{{ csrf_token() }}">
{% endset %}

{% set continue_form %}
   <form action="install.php" method="post" class="d-inline" data-submit-once>
      <button type="submit" name="submit" class="btn btn-primary">
         {{ __("Continue") }}
         <i class="ti ti-chevron-right ms-1"></i>
      </button>

      <input type="hidden" name="install" value="Etape_1">
      {{ common_hiddens }}
   </form>
{% endset %}

{% set retry_form %}
   <form action="install.php" method="post" class="d-inline" data-submit-once>
      <button type="submit" name="submit" class="btn btn-warning">
         {{ __("Try again") }}
         <i class="ti ti-reload ms-1"></i>
      </button>

      <input type="hidden" name="install" value="Etape_0">
      {{ common_hiddens }}
   </form>
{% endset %}

{% if config_write_denied or requirements.hasMissingMandatoryRequirements() %}
   <h3>{{ __('Do you want to continue?') }}</h3>
   <div class="text-center">
      {{ retry_form }}
   </div>
{% elseif requirements.hasMissingOptionalRequirements() %}
   <h3>{{ __('Do you want to continue?') }}</h3>
   <div class="text-center">
      {{ continue_form }}
      {{ retry_form }}
   </div>
{% else %}
   <div class="text-center">
      {{ continue_form }}
   </div>
{% endif %}
