
{% block body %}

<td colspan="8" id="ligneAffichage{{ id }}">
<div>
	<table class="table">
		{% if not cmdHasTP %}
			<thead class="thead-dark">
				<tr>
					<th scope="col" width="10%">{{ 'N° Ligne' | trad }}</th>
					<th scope="col">
						<div class="ligne1">{{ 'Désignation ligne' | trad }}</div>
						<div class="ligne2">{{ 'Détail' | trad }}</div>
					</th>
					<th></th>
					<th scope="col" class="align-right" width="100px">{{ 'Quantité' | trad }}</th>
					<th scope="col" class="align-right" width="100px">{{ 'Prix Unitaire' | trad }}</th>
					<th scope="col" class="align-right" width="100px">{{ 'Montant HT' | trad }}</th>
					<th scope="col" class="align-right" width="100px">{{ 'Taux de TVA' | trad }}</th>
				</tr>
			</thead>
			<tbody>
		{% endif %}
        {% for ca in cas %}
			{% if cmdHasTP %}
			<thead class="thead-dark">
				<tr>
					<th scope="col" width="10%">{{ 'N° Ligne' | trad }}</th>
					<th scope="col">
						<div class="ligne1">{{ 'Désignation ligne' | trad }}</div>
						<div class="ligne2">{{ 'Détail' | trad }}</div>
					</th>
					<th></th>
					<th scope="col" class="align-right" width="100px">{{ 'Quantité' | trad }}</th>
					<th scope="col" class="align-right" width="100px">{{ 'Prix Unitaire' | trad }}</th>
					<th scope="col" class="align-right" width="100px">{{ 'Montant HT' | trad }}</th>
					<th scope="col" class="align-right" width="100px">{{ 'Taux de TVA' | trad }}</th>
				</tr>
			</thead>
			<tbody>
			{% endif %}
			<tr>
				<td>{{ ca.NO_PO }}</td>
				<td>
                	<div class="ligne1">
                    	 {{ ca.DES_SOMM | convert_encoding('UTF-8', 'ISO-8859-1') }}
                    </div>
                    <div class="ligne2 white-tooltip">
        				<span class="infos_tooltip top-left">
                            {{ ca.CONTMEMO | convert_encoding('UTF-8', 'ISO-8859-1') }}
                         </span>            
                        {{ ca.CONTMEMO | convert_encoding('UTF-8', 'ISO-8859-1') }}
                    </div>
                </td>
				<td></td>
				<td class="montant">{{ ca.QTE_COMM | prix ~ ' ' ~ ca.UNITE }}</td>
				<td class="montant">{{ ca.PU | prixUnitaire ~  devise}}</td>
				<td class="montant">{{ (ca.QTE_COMM * ca.PU) | prix ~ devise}}</td>
				<td class="align-right">{{ ca.TVA | tva}} %</td>
            </tr>
			{# 
			{% if ca.TP | length > 0 %}
			<tr>
				<td colspan="6">
					<table class="table">
						<tr>
							<th scope="col">
								{{'Libelle' | trad}}
							</th>
							<th scope="col">
								{{'Descriptif' | trad}}
							</th>		
							<th scope="col">
								{{'Montant de bse' | trad}}
							</th>	
							<th scope="col">
								{{'Pourcentage / Montant' | trad}}
							</th>
							<th scope="col">
								{{ 'Echéance' | trad }}
							</th>
						</tr>
					{% for tp in ca.TP %}
						<tr>
							<td>
								{{tp.LIBELLE}}
							</td>
							<td>
								{{tp.DESCRIPTIF}}
							</td>
							<td class="montant">
								{{tp.MNT_BASE ~ devise}}
							</td>
							<td class="montant">
								{{ (not tp.TP_EN_MNT | boolSql) ? (tp.POURC_TP ~ " %") : (tp.MNT_FIXE | prix ~ devise) }}
							</td>
							<td>
								{{ tp.DELAIFACT }}{{ tp.TYPEDELAIFACT }}
							</td>
						</tr>
					{% endfor %}
					</table>
				</td>
			</tr>
			{% endif %}
			#}
         {% endfor %}
        </tbody>
    </table>
	</div>
    {% if nombreEnregistrement > 1 and affichage == 'notAll' %}
    <div class="lignes_supplementaires" onclick="plusDeLignes('{{ path('Facture.ajax.detailChoixDesCommandes') }}','{{ id }}')">
    	<span class="voir_plus">{{ 'Tout afficher' | trad}} ({{ nombreEnregistrement~' '~('lignes' | trad) }})</span>
    </div>
    {% endif %}
	{% if allTP | length > 0 %}
		<div>
			<p><b>{{"Liste des termes de paiement" | trad ~ colon()}}</b></p>
			<table class="table">
				<thead class="thead-dark">
					<tr>
						<th scope="col" width="30%">{{ 'Libellé TP' | trad }}</th>
						<th scope="col">{{ 'Descriptif' | trad }}</th>
					</tr>
				</thead>
				<tbody>
					{% for tp in allTP %}
						<tr>
							<td>
								{{ tp.LIBELLE }}
							</td>
							<td>
								{{ shortLibelle(tp.DESCRIPTIF,taille: 150, ajaxPopup: false) }}
							</td>
						</tr>
					{% endfor %}
				</tbody>
			</table>
		</div>
	{% endif %}
</td>

<script>
function plusDeLignes(path, id)
{
	$.ajax({
	  	dataType : 'html',
  		url: path,
  		data: {'id' : id, 'affichage' : 'all'},
  		type: "POST",
  		success: function(htmlData){
  			/* 
  			$("#ligneAffichage").html(title); */
  			var result = $('<div />').append(htmlData).find('#ligneAffichage'+id).html();
            $('#ligneAffichage'+id).html(result);
  		}
  	});

}

ResizableColumns();
</script>
{% endblock %}
