{% block body %}
	<div class="clearfix">
		{% if additionalLines|length > 0 %}
			<table class="table table-hover">
				<thead class="thead-dark">
					<tr>
						<th scope="col" width="20%">{{ 'N° de poste' | trad }}</th>
						<th scope="col" width="20%">{{ 'Code article' | trad }}</th>
						<th scope="col" width="40%">{{ 'Désignation article' | trad }}</th>
						<th scope="col" width="20%">{{ 'Unité' | trad }}</th>
					</tr>
				</thead>
				<tbody>
					{% for line in additionalLines %}
						<tr id="line{{ line.no_ligne_cde }}">
							<td>{{ line.no_ligne_cde }}</td>
							<td class="loupe">{{ line.code_art }}</td>
							<td>{{ shortLibelle(line.design_sommaire, 45) }}</td>
							<td>{{ line.unite_label ~ ' (' ~ line.unite ~ ')' }}</td>
						</tr>
						<tr id="line{{ line.no_ligne_cde }}detail" class="detail_ligne {{ (loop.index != 1 ? 'hide_detail' : '') }}">
							<td colspan="4">
								<div class="informations">
									{{ generateCC({
                                        'init' 		: initCC, 
                                        'typeDoc' 	: 'BRT',
                                        'idDoc' 	: 0, 
                                        'idLigne' 	: line.no_ligne_cde, 
                                        'idPanier' 	: idUserBasket,
                                    }) }}
								</div>
							</td>
						</tr>
					{% endfor %}
				</tbody>
			</table>
		{% else %}
			<h4>
				{{ noCcInfo }}
			</h4>
		{% endif %}
	</div>
    <script>
        function updateValueCC(field, line, id, bool, error) {

			activeLoader();
            if (error == true) {
				desactiveLoader();
				return '';
            }

            if (bool) {
                var value = $('#input_'+field).is(':checked');
            } else {
                var value = $('#input_'+field).val();
            }
            
            $.ajax({
                dataType : 'json',
                url: '{{ path('Reception.CreationBR.ajaxUpdateCC') }}',
                data: {field: field, line: line, id: id, value: value},
                type: "POST",
                success: function(result){
					desactiveLoader();
                },
                error: function(result){
					desactiveLoader();
                }
            });
        }
    </script>

{% endblock %}
