<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <title>{{ installation.name }} - {% block title %}{{ 'Homepage'|trans }}{% endblock %}</title>
    {% block head_custom %}{% endblock %}
    <link rel="shortcut icon" href="{{ asset('build/images/favicon.ico') }}" type="image/x-icon">

    <script type="application/javascript">
        {# this is global data, in use for all js app #}
        window.addaddress = {{ add_address|json_encode|raw }};
    </script>

    {{ encore_entry_link_tags('mod_collection') }}
    {{ encore_entry_link_tags('mod_bootstrap') }}
    {{ encore_entry_link_tags('mod_forkawesome') }}
    {{ encore_entry_link_tags('mod_ckeditor5') }}
    {{ encore_entry_link_tags('chill') }}
    {{ encore_entry_link_tags('mod_blur') }}
    {{ encore_entry_link_tags('vue_onthefly') }}
    {{ encore_entry_link_tags('mod_address_details') }}
    {% block css %}<!-- nothing added to css -->{% endblock %}
</head>

<body>
    {% if chill_main_config.top_banner is defined and chill_main_config.top_banner.visible is true %}
        {{ include('@ChillMain/Layout/_top_banner.html.twig') }}
    {% endif %}

    {% if responsive_debug is defined and responsive_debug == 1 %}
        {{ include('@ChillMain/Layout/_debug.html.twig') }}
    {% endif %}

    {% if header_logo_only is defined and header_logo_only == 1 %}
        {{ include('@ChillMain/Layout/_header_logo_only.html.twig') }}
    {% else %}
        {{ include('@ChillMain/Layout/_header.html.twig') }}
    {% endif %}

    {% block top_banner %}{#
        To use if you want to add a banner below the header (ie the menu)
    #}{% endblock %}

    <div class="content" id="content">
        <div class="container-xxl">

        {% block sublayout_content %}
            <div class="row justify-content-center my-5">

                {# Flash messages ! #}
                {% if app.session.flashbag.keys()|length > 0 %}
                    <div class="row justify-content-center">
                        <div class="col-10 mb-5 flash_message">

                            {% for flashMessage in app.session.flashbag.get('success') %}
                                <div class="alert alert-success flash_message">
                                    <span>{{ flashMessage|trans }}</span>
                                </div>
                            {% endfor %}

                            {% for flashMessage in app.session.flashbag.get('error') %}
                                <div class="alert alert-danger flash_message">
                                    <span>{{ flashMessage|trans }}</span>
                                </div>
                            {% endfor %}

                            {% for flashMessage in app.session.flashbag.get('notice') %}
                                <div class="alert alert-warning flash_message">
                                    <span>{{ flashMessage|trans }}</span>
                                </div>
                            {% endfor %}

                        </div>
                    </div>
                {% endif %}

                {% block content %}
                    <div class="col-8 main_search">
                        {% if app.user.isAbsent %}
                            <div class="d-flex flex-row mb-5 alert alert-warning" role="alert">
                                <p class="m-2">{{'absence.You are marked as being absent'|trans }}</p>
                                <span class="ms-auto">
                                    <a class="btn btn-delete" title="Modifier" href="{{ path('chill_main_user_absence_unset') }}">{{ 'absence.Unset absence'|trans }}</a>
                                </span>
                            </div>
                        {% endif %}
                        <h2>{{ 'Search'|trans }}</h2>

                        <form action="{{ path('chill_main_search') }}" method="get">
                            <input class="form-control form-control-lg" name="q" type="search" placeholder="{{ 'Search persons, ...'|trans }}" />
                            <div class="text-center">
                                <button type="submit" class="btn btn-lg btn-warning mt-3">
                                    <i class="fa fa-fw fa-search"></i> {{ 'Search'|trans }}
                                </button>
                                <a class="btn btn-lg btn-misc mt-3" href="{{ path('chill_main_advanced_search_list') }}">
                                    <i class="fa fa-fw fa-search"></i> {{ 'Advanced search'|trans }}
                                </a>
                            </div>
                        </form>
                    </div>

                    {#  DISABLED {{  chill_widget('homepage', {} ) }} #}

                    {% include '@ChillMain/Homepage/index.html.twig' %}

                {% endblock %}

            </div>
        {% endblock %}

        </div>
    </div>

    {{ include('@ChillMain/Layout/_footer.html.twig') }}

    {{ encore_entry_script_tags('mod_collection') }}
    {{ encore_entry_script_tags('mod_bootstrap') }}
    {{ encore_entry_script_tags('mod_forkawesome') }}
    {{ encore_entry_script_tags('mod_ckeditor5') }}
    {{ encore_entry_script_tags('mod_blur') }}
    {{ encore_entry_script_tags('chill') }}
    {{ encore_entry_script_tags('vue_onthefly') }}
    {{ encore_entry_script_tags('mod_address_details') }}

    <script type="text/javascript">
        window.addEventListener('DOMContentLoaded', function(e) {
            chill.checkOtherValueOnChange();
            $('.select2').select2({
                allowClear: true,
                theme: "bootstrap"
            });
            chill.categoryLinkParentChildSelect();
        });
    </script>

    {% block js %}<!-- nothing added to js -->{% endblock %}
</body>
</html>
