<table class="table table-hover" id="triggers">
    <thead class="thead-dark">
        <th scope="col">{{ 'Déclencheur' | trad }}</th>
        <th scope="col" width="15%">{{ 'Opérateur' | trad }}</th>
        <th scope="col">{{ 'Valeur' | trad }}</th>
        <th scope="col" width="50px">
            <a class="ajouter_blanc_v2  white-tooltip" style="float: right;" 
                onclick="addTrigger('{{ path('Delegation.PermanentDelegation.ajaxAddTrigger') }}');">
                <span class="infos_tooltip left">
                    {{ 'Ajouter un déclencheur' | trad }}
                </span>
            </a>
        </th>
    </thead>
    <tbody>
        <tr style="display:none;"></tr>
        {% if declencheurs %}
            {% for declencheur in declencheurs %}
                {% include '@Delegation/PermanentDelegation/_declencheur_ligne.twig'
                    with {
                        zoomInfo: declencheur.zoomInfo, 
                    }
                %}
            {% endfor %}
        {% else %}
            {% for declencheur in [0] %}
                {% include '@Delegation/PermanentDelegation/_declencheur_ligne.twig' %}
            {% endfor %}
        {% endif %}
    </tbody>
    <script>
        function addTrigger(path)
        {
            activeLoader();
            var lastId = $('.id_trigger').last().val();

            $.ajax({
                dataType : 'html',
                url: path,
                data: {'lastId' : lastId, 'societe' : $('#input_CODE_STE').val()},
                type: "POST",
                success: function(result){
                    $('#triggers tr:last').after(result);
                    desactiveLoader();
                }
            });
        }
    </script>
</table>
