{% extends 'layout.twig' %}

{% block body %}
<section class="contenu clearfix"  id="listeFormat">
	<h1>
		{{ 'Catalogues' | trad }}
	</h1>
		
    {{ ariane() }}

	<h3>
		{{ 'Article du catalogue' }} {{ infoCata.DESCRIPTION_CATA }} / {{ 'VERSION' | trad }} {{ versCata.VERSCATA }}
	</h3>

    {{ arianeSub() }}

    <h3 class="clearfix">
        {{ 'Article'  }} : {{ infoArticle.DESIGNCRT }}

        <button class="principal" style="margin-right:0px" onClick="ajaxPopupV2('{{ path('Catalogue.ControleVersion.validateCarac', {idLigne:idLigne,typeCar:typeCar}) }}', 'formCarac', '{{ 'Validation des caracteristiques' }}');">{{ libelleSave }}</button>
    </h3>

    <form id="formCarac" class="clearfix" style="margin-top:10px;">
        <table class="table table-hover" id="table_carac">
            <thead class="thead-dark">
                <tr>
                    <th scope="col" width='100px'>{{ 'Code' | trad }}</th>
                    <th scope="col">{{ 'Titre' | trad }}</th>
                    <th scope="col">{{ 'Description' | trad }}</th>
                    <th scope="col" width="150px">{{ 'Chargement ?' | trad }}</th>
                    <th scope="col" width="100px">
                        <a class="ajouter_blanc_v2  white-tooltip" onClick="addLigne('{{ path('Catalogue.ControleVersion.ajaxCarac') }}')" style="float: right;">
                            <span class="infos_tooltip left">
                                {{ 'Ajouter' |trad }}
                            </span>
                        </a>
                    </th>
                </tr>
            </thead>
            <tbody>
                {% for carac in listeCarac %}
                    {% include '@catalogue/Controle/caracteristique/_carac.twig' with {
                        rand : random(),
                    } %}
                {% endfor %}
            </tbody>
        </table>
    </form>
    
</section>
<script>
    function addLigne(path)
    {
        //
        $.ajax({
            url: path,
            type: 'POST',
            dataType : 'html',
            data: {},
            success: function(data){
                $('#table_carac > tbody').append(data);
            }
        });
    }
</script>
{% endblock %}