<h2>Mes démarches</h2>
{% if json == False %}
<div class="intro">
    <p class="no_registration">
        {{ pp_no_registration_msg }}
    </p>
</div>
{% endif %}
{% if not aes_children.data %}
<div class="intro">
    <p>
        Vous n'avez pas encore d'enfant enregistré dans notre base de données.
    </p>
</div>
{% endif %}
<div class="wcs-forms-of-caterogy-imio links-list">
    <ul id="pp_forms">
    {% for form in aes_forms.data %}
        {% if form.slug == 'aes-mon-inscription-dans-le-portail-parent' %}
            <li class="active" id="registration_form">
                <a href='{{ form.url }}'>{{ form.title }}</a>
            </li>
        {% endif %}
        {% if json == False %}
            {% if form.slug != 'aes-mon-inscription-dans-le-portail-parent' %}
                <!-- <a style="pointer-events: none" ... but disable js events-->
                <li class="inactive" style="cursor:not-allowed;">
                    <a msg="Veuillez vous enregistrer d'abord." href='#'>
                        {{ form.title }}
                    </a>
                </li>
            {% endif %}
        {% else %}
            {% if form.slug != 'aes-mon-inscription-dans-le-portail-parent' %}
                {% if not aes_children.data and form.slug != 'aes-enregistrer-un-nouvel-enfant' %}
                <li class="inactive" style="cursor:not-allowed;">
                    <a msg="Veuillez enregistrer un enfant d'abord." href='#'>
                        {{ form.title }}
                    </a>
                </li>
                {% else %}
                <li class="active">
                    <a href='{{ form.url }}'>
                        {{ form.title }}
                    </a>
                </li>
                {% endif %}
            {% endif %}
        {% endif %}
    {% endfor %}
    </ul>
</div>
<script>
    $(function(){
        $("#registration_form").prependTo("#pp_forms");
        function out(){
            $(this).text($(this).attr("old_text"));
        }
        function over(){
            var $msg = $(this).attr("msg");
            $(this).attr("old_text", $(this).text());
            $(this).text($msg);
        }
        $("li.inactive a").hover(over, out);
    });
</script>
