{% import 'Front/Default/macro.html.twig' as m %}
{% set isHome       = app.request.attributes.get('_route') == '_welcome' %}
{% if isHome %}
    {% set bodyClass = 'home' %}
{% endif %}
<!DOCTYPE html>
<html lang="{{ app.request.locale|replace({'_':'-'}) }}">
    <head>
        <meta charset="utf-8">
        <title>{{ metatitle is defined and metatitle ? metatitle ~ ' - CGénial' : 'Fondation CGénial' }}</title>

        <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />

        {# Meta content #}
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta content="{{ metadescription is defined and metadescription?metadescription:"La Fondation CGénial, reconnue d’utilité publique, a été créée en 2006 par plusieurs grandes entreprises afin de sensibiliser les jeunes aux sciences et aux métiers qui en relèvent." }}" name="description"/>
        
       


        {% block metaOpengraph %}{% endblock %}

        {# Favicons #}
        {# @see http://realfavicongenerator.net/ #}
        <link rel="shortcut icon" href="{{ asset('favicon.ico') }}?v=2017" />
        <link rel="apple-touch-icon" sizes="180x180" href="{{ asset('apple-touch-icon.png') }}?v=2017">
        <link rel="icon" type="image/png" href="{{ asset('favicon-32x32.png') }}?v=2017" sizes="32x32">
        <link rel="icon" type="image/png" href="{{ asset('favicon-16x16.png') }}?v=2017" sizes="16x16">
        <link rel="manifest" href="{{ asset('manifest.json') }}?v=2017">
        <link rel="mask-icon" href="{{ asset('safari-pinned-tab.svg') }}?v=2017" color="#5bbad5">
        <meta name="theme-color" content="#ffffff">

        {# CSS files #}
        <link media="all" href="{{ asset("front/styles/lib/jquery-ui/jquery-ui.min.css") }}" rel="stylesheet" />
        {# <link media="all" href="{{ asset('front/scripts/lib/bxslider/jquery.bxslider.css') }}" rel="stylesheet"/> #}
        <link media="all" href="{{ asset('front/styles/main.css'|asset_rev) }}" rel="stylesheet"/>
        {% block stylesheets %}{% endblock %}

        <script src="{{ asset("front/scripts/lib/jquery/jquery-3.3.1.min.js"|asset_rev) }}"></script>
        {% block init_javascripts_head %}{% endblock %}
       
        {#
            <script type="text/javascript" src="{{ asset("front/scripts/lib/tarteaucitron.js/tarteaucitron.js") }}"></script>
        #}

        <script type="text/javascript">
         {#
            tarteaucitron.init({
                "privacyUrl": "", /* Privacy policy url */
                "cdn" : "/front/front/scripts/lib/tarteaucitron.js/",
                "hashtag": "#tarteaucitron", /* Open the panel with this hashtag */
                "cookieName": "tarteaucitron", /* Cookie name */
        
                "orientation": "middle", /* Banner position (top - bottom) */
                "showAlertSmall": true, /* Show the small banner on bottom right */
                "cookieslist": true, /* Show the cookie list */

                "adblocker": false, /* Show a Warning if an adblocker is detected */
                "AcceptAllCta" : true, /* Show the accept all button when highPrivacy on */
                "highPrivacy": true, /* Disable auto consent */
                "handleBrowserDNTRequest": false, /* If Do Not Track == 1, disallow all */

                "removeCredit": false, /* Remove credit link */
                "moreInfoLink": true, /* Show more info link */
                "useExternalCss": false, /* If false, the tarteaucitron.css file will be loaded */

                //"cookieDomain": ".my-multisite-domaine.fr", /* Shared cookie for multisite */
                            
                "readmoreLink": "/cookiespolicy" /* Change the default readmore link */
            });
        #}
            <!-- Matomo -->
        
            var _paq = window._paq = window._paq || [];
            /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
            _paq.push(["setCookieDomain", "*.cgenial.org"]);
            _paq.push(['trackPageView']);
            _paq.push(['enableLinkTracking']);
            (function() {
                var u="https://cgenialconnect.matomo.cloud/";
                _paq.push(['setTrackerUrl', u+'matomo.php']);
                _paq.push(['setSiteId', '2']);
                var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
                g.async=true; g.src='//cdn.matomo.cloud/cgenialconnect.matomo.cloud/matomo.js'; s.parentNode.insertBefore(g,s);
            })();
            <!-- End Matomo Code -->
        </script>
    </head>
    <body{% if bodyClass is defined %} class="{{ bodyClass }}"{% endif %} {#data-gaid="{{ google_analytics_id }}"#}>
        {# include header #}
        {% include "Front/_part/header.html.twig" %}

        <div class="maincontent" role="main">
            <div class="before_body">
                {% block before_body %}{% endblock %}
            </div>

            <div class="body">
                <div class="container">
                    {% for msg in app.session.flashbag.get('info') %}
                        {% if loop.first %}
                            <div class="alert alert-info">
                        {% endif %}
        
                        <div class="notice">{{ msg|raw }}</div>
        
                        {% if loop.last %}
                            </div>
                        {% endif %}
                    {% endfor %}
        
                    {% for msg in app.session.flashbag.get('warning') %}
                        {% if loop.first %}
                            <div class="alert alert-warning">
                        {% endif %}
        
                        <div class="notice">{{ msg|raw }}</div>
        
                        {% if loop.last %}
                            </div>
                        {% endif %}
                    {% endfor %}
        
                    {% for msg in app.session.flashbag.get('error') %}
                        {% if loop.first %}
                            <div class="alert alert-danger">
                        {% endif %}
        
                        <div class="notice">{{ msg|raw }}</div>
        
                        {% if loop.last %}
                            </div>
                        {% endif %}
                    {% endfor %}
        
                    {% for msg in app.session.flashbag.get('success') %}
                        {% if loop.first %}
                            <div class="alert alert-success">
                        {% endif %}
        
                        <div class="notice">{{ msg|raw }}</div>
        
                        {% if loop.last %}
                            </div>
                        {% endif %}
                    {% endfor %}

                    {% block body %}{% endblock %}
                </div>
            </div>

            <div class="after_body">
                {% block after_body %}{% endblock %}
            </div>
        </div>

        {# include footer #}
        {% include "Front/_part/footer.html.twig" %}



        {# JavaScript files #}
        {% block init_javascripts %}{% endblock %}

        <script type="text/javascript" charset="utf-8">
            window.CaptchaCallback = function() {
                    $(".g-recaptcha").each(function(index, el) {
                        var attributes = {
                            'sitekey'  : '{{ google_recaptcha_public_key }}',
                            'size'     : 'invisible',
                            'callback' : $(el).data('callback')
                        };

                        /*window['widget' + index] = grecaptcha.render(el, attributes)

                        $(el).data('recaptcha-widget-id', 'widget' + index);*/
                        $(el).data('recaptcha-widget-id', grecaptcha.render(el, attributes));
                    });
                }

                /*
                window.registerCallback = function(){
                    $('#formRegister').data("recaptcha-verified", true).submit();
                };
                */

                window.contactCallback = function(){
                    $('#formContact').data("recaptcha-verified", true).submit();
                };

                window.newsletterCallback = function(){
                    $('#formNewsletter').data("recaptcha-verified", true).submit();
                };

                $('#formContact, #formNewsletter, #formRegisterXXXX').on("submit", function(e){
                    var $form = $(this);
                    if ($form.data("recaptcha-verified")) return;

                    e.preventDefault();
                    grecaptcha.execute($form.find(".g-recaptcha").data("recaptcha-widget-id"));
                });
            
            
        </script>

        <!-- Google Recaptcha API v2 -->
        <script src='https://www.google.com/recaptcha/api.js?onload=CaptchaCallback&render=explicit' async defer></script>

       

        <script src="{{ asset('front/scripts/main.js'|asset_rev) }}"></script>
        {% block javascripts %}{% endblock %}

        {% if app.user is not null and is_granted("IS_AUTHENTICATED_REMEMBERED") %}
            <a href="{{ path("template",{"id":81, 'title':'contact'}) }}" class="btn btn-sm btn-tangerine" style="border-radius: 0;position: fixed;bottom:0; z-index: 100; right: 165px; padding-bottom: 14px;">Besoin d'aide ?</a>
        {% endif %}

       
        {#
        <script type="text/javascript">
            tarteaucitron.user.gtagUa = '{{ google_analytics_id }}';
            tarteaucitron.user.gtagMore = function () { /* add here your optionnal gtag() */ };
            (tarteaucitron.job = tarteaucitron.job || []).push('gtag');
        </script>
        #}
    </body>
</html>
