{% extends '@ajax-layout/layout.twig' %}

{% block body %}
<div id="ajout-mot-cles">
    <div  class="clearfix"  id="genetableau">
    	<form method="post" name="formulaireListeMotClef" id="formulaireListeMotClef">
    	
    		<table class="table sans_actions table-hover" id="tableau">
            	<thead class="thead-dark">
                	<tr>
                        <th scope="col" width="12%" >{{ 'Libellé Mot Clés' | trad }}</th>
                    </tr>
                </thead>
                <tbody>
                	<tr>
                    	<td>{{ filterTable('popupMOTCLEF', infoPagination.filter.filter_popupMOTCLEF, '', 'genetableau', path('Fournisseur.motsClef.popupAjoutMotsClef', {'type' : type, 'div' : div }),'formulaireListeMotClef') }}</td>
                    	<input type="text"/ style="display: none !important;">
                    </tr>
                    {% for motsClefs in listeMotsClefs %}
                    <tr style="cursor:pointer;" onClick="ajouterEntity('{{ path('Fournisseur.motsClef.ajaxAjoutMotsClef', {'type' : type, 'div' : div }) }}', '{{ motsClefs.MOTCLEF |e('js')|raw }}', 'content_tableau');">
                        <td>{{ motsClefs.MOTCLEF }}</td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
            {{ paginations(path('Fournisseur.motsClef.popupAjoutMotsClef'),infoPagination.nombreDePage, infoPagination.page, infoPagination.post, 'ajout-mot-cles') }}
             <div class="button_right full validation_modal modal-footer">
                 <button type="button" class="button secondaire button_right" onClick='desactivePopup ();'>{{ 'Fermer' | trad }}</button>
    		</div>
		</form>
		</div>
</div>

{% if type %}
    <script>

        function ajouterEntity(path, entity, div)
        {
            $.ajax({
                dataType : 'html',
                url: path,
                data: {'entity' : entity},
                type: "POST",
                success: function(result){  
                    refrechDiv('{{ path('Fournisseur.motsClefInteraction.ajaxTableauMotclef', {'type':type}) }}', div);
                    desactivePopup();
                }
            });
        }

    </script>  
{% endif %}
{% endblock %}