{% extends 'layout.twig' %}

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

	<div class="tab-content" id="tab-content">

        <h4>
            {% if idVersion %}
                {{ 'Affectation des types articles du catalogue' | trad }} : {{ infoCata.DESCRIPTION_CATA }} ({{ infoCata.ID_CATAL }})
            {% else %}
                {{ 'Affectation globale des types articles' | trad }}
            {% endif %}
        </h4>

        {{ arianeSub() }}

        <form method="post" name="form_affectation" id="form_affectation">	
        
			<table class="table">
				<thead class="thead-dark">
    				<tr>
						{% if idVersion == null %}
    						<th>{{ triTable('DESCRIPTION_CATA',  infoPagination.filter.tri_DESCRIPTION_CATA, 'Catalogue' | trad, 'listeFormat', path('Catalogue.AffectationTypeArticle.parArticle', {idVersion:idVersion}), 'form_affectation') }}</th>
						{% endif %}
						<th>{{ triTable('DESIGNCRT',  infoPagination.filter.tri_DESIGNCRT, 'désignation' | trad, 'listeFormat', path('Catalogue.AffectationTypeArticle.parArticle', {idVersion:idVersion}), 'form_affectation') }}</th>
						<th>{{ triTable('CODEARTI',  infoPagination.filter.tri_CODEARTI, 'Article' | trad, 'listeFormat', path('Catalogue.AffectationTypeArticle.parArticle', {idVersion:idVersion}), 'form_affectation') }}</th>
						<th>{{ triTable('RS_FOUR',  infoPagination.filter.tri_RS_FOUR, 'Fournisseur' | trad, 'listeFormat', path('Catalogue.AffectationTypeArticle.parArticle', {idVersion:idVersion}), 'form_affectation') }}</th>
						<th>{{ triTable('RS_FAB',  infoPagination.filter.tri_RS_FAB, 'Fabricant' | trad, 'listeFormat', path('Catalogue.AffectationTypeArticle.parArticle', {idVersion:idVersion}), 'form_affectation') }}</th>
						<th>{{ triTable('DESIGNAT',  infoPagination.filter.tri_DESIGNAT, 'Sous-famille' | trad, 'listeFormat', path('Catalogue.AffectationTypeArticle.parArticle', {idVersion:idVersion}), 'form_affectation') }}</th>
    					<th>{{ triTable('REFARTFOU',  infoPagination.filter.tri_REFARTFOU, 'Ref. Fou.' | trad,'listeFormat', path('Catalogue.AffectationTypeArticle.parArticle', {idVersion:idVersion}), 'form_affectation') }}</th>
						<th>{{ triTable('REFARTFAB',  infoPagination.filter.tri_REFARTFAB, 'Ref. fab.' | trad,'listeFormat', path('Catalogue.AffectationTypeArticle.parArticle', {idVersion:idVersion}), 'form_affectation') }}</th>
    				    <th>{{ 'Type article' | trad }}</th>
                    </tr>
    			</thead>
    			<tbody>
    				<tr>
						{% if idVersion == null %}
    						<th>{{ filterTable('DESCRIPTION_CATA', infoPagination.filter.filter_DESCRIPTION_CATA, '', 'listeFormat', path('Catalogue.AffectationTypeArticle.parArticle'), 'form_affectation') }}</th>
						{% endif %}
						<th>{{ filterTable('DESIGNCRT', infoPagination.filter.filter_DESIGNCRT, '', 'listeFormat', path('Catalogue.AffectationTypeArticle.parArticle', {idVersion:idVersion}), 'form_affectation') }}</th>
						<th>{{ filterTable('CODEARTI', infoPagination.filter.filter_CODEARTI, '', 'listeFormat', path('Catalogue.AffectationTypeArticle.parArticle', {idVersion:idVersion}), 'form_affectation') }}</th>

						<th>{{ zoomFilter('CODEFOUR'~spliter()~'RS_FOUR', infoPagination.filter['filter_CODEFOUR'~spliter()~'RS_FOUR'], '', 'form_affectation', path('Ajax.liste.fournisseur'), 'Fournisseur' | trad, '','','Fournisseur','','','Fourniss') }}</th>
						<th>{{ zoomFilter('FABRICANT'~spliter()~'RS_FAB', infoPagination.filter['filter_FABRICANT'~spliter()~'RS_FAB'], '', 'form_affectation', path('Ajax.liste.fabricant'), 'Fabricant' | trad, '','','Fabricant','','','Fabricant') }}</th>
						<th>{{ zoomFilter('DESIGNAT'~spliter()~'SOUSFAMI', infoPagination.filter['filter_DESIGNAT'~spliter()~'SOUSFAMI'], '', 'form_affectation', path('Ajax.liste.sousFamille'), 'Sous-famille' | trad, '','','Sous-famille','','','ssFamill') }}</th>
						<th>{{ filterTable('REFARTFOU', infoPagination.filter.filter_REFARTFOU, '', 'listeFormat', path('Catalogue.AffectationTypeArticle.parArticle', {idVersion:idVersion}), 'form_affectation') }}</th>
						<th>{{ filterTable('REFARTFAB', infoPagination.filter.filter_REFARTFAB, '', 'listeFormat', path('Catalogue.AffectationTypeArticle.parArticle', {idVersion:idVersion}), 'form_affectation') }}</th>
                        <th></th>
    				</tr>
    				{% for article in listes %}
						<tr onclick='changeCodeLibelle("{{ post.divCode }}","{{ article.ID | convert_encoding('UTF-8', 'ISO-8859-1')  }}", "{{ post.divLibelle }}", "{{ article.DESIGNCRT }}");desactivePopup ()'>
							{% if idVersion == null %}
								<td id ="{{article.ID}}">{{ article.DESCRIPTION_CATA }} {% if article.ID_CATAL%}({{ article.ID_CATAL  }}){% endif %}</td>
							{% endif %}
							<td>{{ article.DESIGNCRT }}</td>
							<td>{{ article.CODEARTI }}</td>
							<td>{{ article.RS_FOUR }} {% if article.CODEFOUR %}({{ article.CODEFOUR }}){% endif %}</td>
							<td>{{ article.RS_FAB }} {% if article.FABRICANT %}({{ article.FABRICANT }}){% endif %}</td>
							<td>{{ article.DESIGNAT}} ({{ article.SOUSFAMI}})</td>
							<td>{{ article.REFARTFOU }}</td>
							<td>{{ article.REFARTFAB }}</td>
                            <td>
                                <div class="row">
                                    {{ inputAdvance('ZOOM', {
                                        'name' : 'CARACTER'~article.IDLIGNE,
                                        'value' : article.CARACTER,
                                        'pahtZoom' : path('GlobalApplication.MultiSelect.afficher'),
                                        'paramZoom' : "{'titre' : '"~('type article' | trad |e('js')|raw)~"','value' : $('#input_CARACTER"~article.IDLIGNE~"').val(),'entity' : 'CarArt', 'CODFILTRE' : 'CAR_ART', 'separateur': ';' }",
                                        'titleZoom' : 'Liste des types d\'articles' | trad,
                                        'option' : 'desactiveSaisie',
                                        'inputAttr' : {
                                            'data-updatevalue' : 'on',
                                        },
                                    }) }}
                                </div>
                            </td>
						</tr>
    				{% endfor %}
    			</tbody>
			</table>

            {{ paginations(path('Catalogue.AffectationTypeArticle.parArticle', {idVersion:idVersion}),infoPagination.nombreDePage, infoPagination.page, infoPagination.post, 'modal-body') }}
        </form>

    </div>
</section>

{{ updateValue(path('Catalogue.ControleVersion.updateValue'),'', '') }}

{% endblock %}