<commit_before>{% extends "MgateSuiviBundle::layout.html.twig" %}

{% block title %}
    {{ 'suivi.etude_affichage'|trans({}, 'suivi') }} - {{ parent() }}
{% endblock %}

{% block content_bundle %}
    <div class="nav-tabs-custom">
        <ul class="nav nav-tabs">
            <li class="active"><a href="#tab1" data-toggle="tab">{{ 'suivi.recapitulatif'|trans({}, 'suivi') }}</a></li>
            <li><a href="#tab2" data-toggle="tab">{{ 'suivi.phases'|trans({}, 'suivi') }}</a></li>
            <li><a href="#tab3" data-toggle="tab">{{ 'suivi.redaction_generation'|trans({}, 'suivi') }}</a></li>
            {% if is_granted('ROLE_CA') %}
                <li><a href="#tab4" data-toggle="tab">{{ 'suivi.suivi'|trans({}, 'suivi') }}</a></li>
            {% endif %}
            <li><a href="#tab5" data-toggle="tab">{{ 'suivi.document'|trans({}, 'suivi') }}</a></li>
            <li><a href="#tab6" data-toggle="tab">{{ 'suivi.commentaries'|trans({}, 'suivi') }}</a></li>
        </ul>
        <div class="tab-content">
            <!-- ERRORS -->
            {% if etude.stateID | default(1) < 3 %}
                {% include "MgateSuiviBundle:Etude:Infos/error.html.twig" with  {'etude':  etude} %}
            {% endif %}
            <!--        -->
            <!-- RECAPITULATIF -->
            <div class="tab-pane active" id="tab1">
                {% include "MgateSuiviBundle:Etude:TabVoir/Recapitulatif.html.twig" with  {'etude':  etude} %}
            </div>
            <!-- PHASES -->
            <div class="tab-pane" id="tab2" style="min-height:200px;">
                {% include "MgateSuiviBundle:Etude:TabVoir/Phases.html.twig" with  {'etude':  etude} %}
            </div>
            <!-- SUIVI -->
            <div class="tab-pane" id="tab3">
                {% include "MgateSuiviBundle:Etude:TabVoir/Suivi.html.twig" with  {'etude':  etude} %}
            </div>
            <!-- SUIVI DOCUMENTS TYPES AUDIT -->
            {% if is_granted('ROLE_CA') %}
                <div class="tab-pane" id="tab4">
                    {% include "MgateSuiviBundle:Etude:TabVoir/Redaction.html.twig" with  {'etude':  etude} %}
                </div>
            {% endif %}
            <!-- SUIVI DOCUMENTS TYPES AUDIT -->
            <div class="tab-pane" id="tab5">
                {% include "MgateSuiviBundle:Etude:TabVoir/Documents.html.twig" with  {'etude':  etude} %}
            </div>

            <!-- Commentaires sur les études -->
            <div class="tab-pane" id="tab6">
                {% if etude.thread|default('0') %}
                    {% include 'FOSCommentBundle:Thread:async.html.twig' with {'id': etude.thread.id, 'view': 'flat'} %}
                {% endif %}
            </div>
        </div>
    </div>

{% endblock %}

{% block javascript_quick %}
    {{ parent() }}
    <script>
        //Egalisation de la hauteur des lignes des phases
        function equalHeight(group) {
            var tallest = 0;
            group.each(function () {
                thisHeight = $(this).height();
                if (thisHeight > tallest) {
                    tallest = thisHeight;
                }
            });
            group.css("height", tallest);
        }

        $(window).load(function () {
            var tab2 = $("#tab2");
            var methodo = $("#methodo");
            tab2.addClass("active");
            methodo.addClass("active");
            var nombreDeLigneParPhase = $(".egalize tr").length / $(".egalize").length;
            for (var i = 1; i <= nombreDeLigneParPhase; i++) {
                equalHeight($(".egalize tr:nth-child(" + i + ") th"));
            }
            methodo.removeClass("active");
            tab2.removeClass("active");
        });
    </script>
{% endblock %}

{% block javascript %}
    {{ parent() }}
    {{ form_javascript(formSuivi) }}
    <script src="{{ asset('js/highcharts.js') }}"></script>
    <script src="{{ asset('js/highcharts-fr.js') }}"></script>
    <script src="{{ asset('js/exporting.js') }}"></script>

    <script type="text/javascript">
        {{ chart(chart) }}
    </script>

    <script>
        function docStateChange() {
            $('.docTabRow').each(
                function (i, e) {
                    var ok = true;
                    $(e).children().children('input[type=checkbox]').each(
                        function (index, elem) {
                            ok = ok && elem.checked;
                        }
                    );
                    if (!ok)
                        $(e).children(':nth-child(2)').html('<span class="label label-important">Incomplet</span>');
                    else
                        $(e).children(':nth-child(2)').html('<span class="label label-success">Complet</span>');
                    ok = true;
                }
            );
        }
        $(document).ready(function () {
            docStateChange();
            //listen for the form beeing submitted
            $("#myForm :input").change(function () {
                $(".loading").show();
                var $form = $(this).closest("form");
                $.post($form.attr("action"), $form.serialize(),
                    function (data) {
                        $(".loading").hide();

                        if (data.responseCode != 200) {
                            bootbox.alert(data.msg);
                        }
                    });

                //we dont what the browser to submit the form
                return false;
            });


        });

    </script>
{% endblock %}
<commit_msg>Keep opened tab in url on etude page<commit_after>{% extends "MgateSuiviBundle::layout.html.twig" %}

{% block title %}
    {{ 'suivi.etude_affichage'|trans({}, 'suivi') }} - {{ parent() }}
{% endblock %}

{% block content_bundle %}
    <div class="nav-tabs-custom">
        <ul class="nav nav-tabs">
            <li class="active"><a href="#tab1" data-toggle="tab">{{ 'suivi.recapitulatif'|trans({}, 'suivi') }}</a></li>
            <li><a href="#tab2" data-toggle="tab">{{ 'suivi.phases'|trans({}, 'suivi') }}</a></li>
            <li><a href="#tab3" data-toggle="tab">{{ 'suivi.redaction_generation'|trans({}, 'suivi') }}</a></li>
            {% if is_granted('ROLE_CA') %}
                <li><a href="#tab4" data-toggle="tab">{{ 'suivi.suivi'|trans({}, 'suivi') }}</a></li>
            {% endif %}
            <li><a href="#tab5" data-toggle="tab">{{ 'suivi.document'|trans({}, 'suivi') }}</a></li>
            <li><a href="#tab6" data-toggle="tab">{{ 'suivi.commentaries'|trans({}, 'suivi') }}</a></li>
        </ul>
        <div class="tab-content">
            <!-- ERRORS -->
            {% if etude.stateID | default(1) < 3 %}
                {% include "MgateSuiviBundle:Etude:Infos/error.html.twig" with  {'etude':  etude} %}
            {% endif %}
            <!--        -->
            <!-- RECAPITULATIF -->
            <div class="tab-pane active" id="tab1">
                {% include "MgateSuiviBundle:Etude:TabVoir/Recapitulatif.html.twig" with  {'etude':  etude} %}
            </div>
            <!-- PHASES -->
            <div class="tab-pane" id="tab2" style="min-height:200px;">
                {% include "MgateSuiviBundle:Etude:TabVoir/Phases.html.twig" with  {'etude':  etude} %}
            </div>
            <!-- SUIVI -->
            <div class="tab-pane" id="tab3">
                {% include "MgateSuiviBundle:Etude:TabVoir/Suivi.html.twig" with  {'etude':  etude} %}
            </div>
            <!-- SUIVI DOCUMENTS TYPES AUDIT -->
            {% if is_granted('ROLE_CA') %}
                <div class="tab-pane" id="tab4">
                    {% include "MgateSuiviBundle:Etude:TabVoir/Redaction.html.twig" with  {'etude':  etude} %}
                </div>
            {% endif %}
            <!-- SUIVI DOCUMENTS TYPES AUDIT -->
            <div class="tab-pane" id="tab5">
                {% include "MgateSuiviBundle:Etude:TabVoir/Documents.html.twig" with  {'etude':  etude} %}
            </div>

            <!-- Commentaires sur les études -->
            <div class="tab-pane" id="tab6">
                {% if etude.thread|default('0') %}
                    {% include 'FOSCommentBundle:Thread:async.html.twig' with {'id': etude.thread.id, 'view': 'flat'} %}
                {% endif %}
            </div>
        </div>
    </div>

{% endblock %}

{% block javascript %}
    {{ parent() }}
    {{ form_javascript(formSuivi) }}
<script src="{{ asset('js/highcharts.js') }}"></script>
<script src="{{ asset('js/highcharts-fr.js') }}"></script>
<script src="{{ asset('js/exporting.js') }}"></script>

<script type="text/javascript">
    {{ chart(chart) }}
</script>

<script>
    // Display label according to checked checkbox (document validation tab)
    function docStateChange() {
        $('.docTabRow').each(
            function (i, e) {
                var ok = true;
                $(e).children().children('input[type=checkbox]').each(
                    function (index, elem) {
                        ok = ok && elem.checked;
                    }
                );
                if (!ok)
                    $(e).children(':nth-child(2)').html('<span class="label label-important">Incomplet</span>');
                else
                    $(e).children(':nth-child(2)').html('<span class="label label-success">Complet</span>');
                ok = true;
            }
        );
    }

    // etude progress change handler
    $(document).ready(function () {
        docStateChange();
        //listen for the form beeing submitted
        $("#myForm :input").change(function () {
            $(".loading").show();
            var $form = $(this).closest("form");
            $.post($form.attr("action"), $form.serialize(),
                function (data) {
                    $(".loading").hide();

                    if (data.responseCode !== 200) {
                        bootbox.alert(data.msg);
                    }
                });

            //we dont what the browser to submit the form
            return false;
        });
    });

    //Egalisation de la hauteur des lignes des phases
    function equalHeight(group) {
        var tallest = 0;
        group.each(function () {
            thisHeight = $(this).height();
            if (thisHeight > tallest) {
                tallest = thisHeight;
            }
        });
        group.css("height", tallest);
    }

    $(window).load(function () {
        var nombreDeLigneParPhase = $(".egalize tr").length / $(".egalize").length;
        for (var i = 1; i <= nombreDeLigneParPhase; i++) {
            equalHeight($(".egalize tr:nth-child(" + i + ") th"));
        }
    });

    // keep tab opened through refresh
    $(document).ready(function () {
        // show active tab on reload
        if (location.hash !== '') {
            var tabSelect = $('a[href="' + location.hash + '"]');
            var url = tabSelect.attr('data-url');
            var div = $(location.hash);
            if (div !== undefined) {
                div.load(url, function (result) {
                    return result
                });
            }
            tabSelect.tab('show');
        }

        // remember the hash in the URL without jumping
        $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
            var url = $(this).attr("data-url");
            var href = this.hash;

            if (history.pushState) {
                history.pushState(null, null, '#' + $(e.target).attr('href').substr(1));
            } else {
                location.hash = '#' + $(e.target).attr('href').substr(1);
            }
        });
    });
</script>

</script>
{% endblock %}

{'fraction_non_alphanumeric': 0.18748397024878174, 'fraction_numerical': 0.0047875523638539795, 'mean_word_length': 1.6689482089892766, 'pattern_counts': {'":': 0, '<': 138, '<?xml version=': 0, '>': 136, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '529210', 'n_tokens_mistral': 3675, 'n_tokens_neox': 3433, 'n_words': 646}