{% extends '@CadolesCore/base.html.twig' %}

{% block pagewrapper %}
    <a class="btn btn-default" onClick="closeModal()">Fermer</a>

    <br><br>
    <table class="table table-striped table-bordered table-hover" id="dataTablesnotin" style="width:100%">
        <thead>
        <tr>
            <th>Action</th>
            <th>Email</th>
            <th>Statut</th>
        </tr>
        </thead>

        <tbody>
            {% for invitation in invitations %}
                <tr>
                    <td>
                    {% if invitation.relance %}
                        <a style='cursor:pointer' onClick='showMail("{{invitation.email}}")'><i class='fa fa-envelope fa-fw'></i></a>
                    {% endif %}
                    </td>
                    <td>{{invitation.email}}</td>
                    <td>{{invitation.statut}}</td>
                </tr>
            {% endfor %}
        </tbody>
    </table>

{% endblock %}

{% block localjavascript %}
    $(document).ready(function() {
    });

    function showMail(email) {
        window.parent.$("#mymodal").hide();

        $("#mymodal").find(".modal-title").html("INVITATION");
        var url="{{ path('cadoles_core_mail_invitationgroup',{id:id,email:'xxx'}) }}";
        url=url.replace('xxx',email);
        window.parent.$("#mymodal").find("#framemodal").attr("src",url);
        window.parent.$("#mymodal").modal().show();
    }  

    function closeModal() {
        url=window.parent.location;
        window.parent.location=url;
    }

{% endblock %}