{% extends 'layout.twig' %}

{% block body %}

	<div class="contenu clearfix"  id="Consultation">
	
		{% include '@Consultation/SaisieReponses/block_entete.twig' %}
		
    	<div class="tab-content">
        	<div class="padding15">
        	
        		<div>
                	<table class="table table-hover">
                      	<thead class="thead-dark">
                            <tr>
                            	<th scope="col" width="50px">{{ 'Poste' | trad }}</th>
                                <th scope="col" width="100px">{{ 'Code article' | trad }}</th>
                                <th scope="col" width="">{{ 'Désignation' | trad }}</th>
                                <th scope="col" width="">{{ 'Désign. compl.' | trad }}</th>
                                <th scope="col" width="100px"class="align-right">{{'Quantité' | trad }}</th>
                                <th scope="col" width="100px">{{'Unité' | trad }}</th>
                                <th scope="col" width="100px" class="align-right">{{'Prix' | trad }}</th>
                                <th scope="col" width="0px"></th>
                            </tr>
                    	<tbody>
							{% set sous_total = 0 %}
							{% set subTotalGroup = 1 %}
							{% set subTotalList = '' %}
                    		{% for consultation in ligneConsultation %}
								{% if consultation.titre != '' %}
									<tr>
										<td colspan="8">
											<h4 style="margin-left:15px;">
												{{ consultation.titre }}
											</h4>
										</td>
									</tr>
								{% endif %}
								{% set sous_total = sous_total + (consultation.QTE * consultation.PU) %}
                    			<tr id="consult_{{ loop.index }}">
                    				<td>{{ consultation.NO_PO_AO }}</td>
                    				<td class="loupe">{{ consultation.CODE_ART }}</td>
                    				<td>{{ consultation.DES_ART }}</td>
                    				<td>{{ shortLibelle(consultation.DES_COMP, 30) }}</td>
                    				<td class="montant">{{ consultation.QTE}}</td>
                    				<td class="devise">{{ consultation.UNITE }} </td>
                    				<td class="montant">{{ consultation.PU |prixUnitaire }}</td>
                    				<td></td>
                    			</tr>
                    			<tr id="consult_{{ loop.index }}detail" class="detail_ligne hide_detail">
                    				<td colspan="8">
                    					<div id="articlePrincipal{{ consultation.NO_PO_AO }}">
                        					<div class="clearfix">
        										<div class="colonne2">
                                                	<div class="informations">
                                                        <p>
                                                        	<span class="champs_label">{{ 'Désignation fournisseur' | trad }}</span>
                                                            <span class="resultat">{{ consultation.DES_FOUR }}</span>
                                                        </p>
                                                        <p>
                                                        	<span class="champs_label">{{ 'Quantité de conditionnement' | trad }}</span>
                                                            <span class="resultat">{{ consultation.QTECOND }}</span>
                                                        </p>
                                                    </div>
        										</div>
        										<div class="colonne2 last">
                                                	<div class="informations">
                                                        <p>
                                                        	<span class="champs_label">{{ 'Référence fournisseur' | trad }}</span>
                                                            <span class="resultat">{{ consultation.REF_FOUR }}</span>
                                                        </p>
                                                        <p>
                                                        	<span class="champs_label">{{ 'Délai' | trad }}</span>
															{% if typeDel == 'D' %}
																<span class="resultat">{{ consultation.DELAI | dateTrad }}</span>
															{% elseif typeDel == 'J' %}
																<span class="resultat">{{ consultation.DELAIJ }} {{ 'J' | trad }}</span>
															{% elseif typeDel == 'T' %}
																<span class="resultat">{{ consultation.DELAIT }}</span>
															{% endif %}
                                                        </p>
                                                    </div>
        										</div>
                        					</div>
                    						<div class="clearfix">
                        						<div class="colonne2">
                                                	<div class="informations">
                                                        <p>
                                                        	<span class="champs_label">{{ 'Fabricant' | trad }}</span>
                                                            <span class="resultat">{{ convertLibelleGlobal('FABRICANT', '', consultation.COD_FAB, true) }}</span>
                                                        </p>
                                                        <p>
                                                        	<span class="champs_label">{{ 'Réf. fabricant' | trad }}</span>
                                                            <span class="resultat">{{ consultation.REF_FAB }}</span>
                                                        </p>
                                                    </div>
                    							</div>
                    							<div class="colonne2 last">
                                                	<div class="informations">
                                                        <p>
                                                        	<span class="champs_label">{{ 'Gamme' | trad }}</span>
                                                            <span class="resultat">{{ convertLibelleGlobal('GAMME', '', consultation.COD_GAM, true) }}</span>
                                                        </p>
                                                    </div>
                    							</div>
                    						</div>
                    						<div class="clearfix">
                    							<div class="colonne2">
                                                	<div class="informations">
                                                        <p>
                                                        	<span class="champs_label">{{ 'Pays d\'origine' | trad }}</span>
                                                            <span class="resultat">{{ listePays[consultation.PAY_ORI] }}</span>
                                                        </p>
                                                    </div>
                    							</div>
                    							<div class="colonne2 last">
                                                	<div class="informations">
                                                        <p>
                                                        	<span class="champs_label">{{ 'Pays de provenance' | trad }}</span>
                                                            <span class="resultat">{{ listePays[consultation.PAY_PROV] }}</span>
                                                        </p>
                                                    </div>
                    							</div>
                    						</div>
                    						<div class="clearfix">
                    							<div class="single row">
                                                	<div class="informations">
                                                        <p>
                                                        	<span class="champs_label">{{ 'Commentaire' | trad }}</span>
                                                            <span class="resultat">{{ consultation.COMFOURN }}</span>
                                                        </p>
                                                    </div>
                    							</div>
                    						</div>
                						</div>
                						
                						{% for variant in consultation.listeVariant %}
                							{% include '@Consultation/SaisieReponses/addVarianteNoEdit.twig' %}
                						{% endfor %}             				
                    				</td>
                    			</tr>
								{% set subTotalList = consultation.NO_PO_AO ~ '|' ~ subTotalList %}
								{% if consultation.sous_titre != '' %}
									<tr>
										<td colspan="8" style="text-align:right;">
											<h5>
												<span>{{ consultation.sous_titre }}</span> : <span id="subTotal{{ subTotalGroup }}" class="{{ subTotalList }}">{{ sous_total|tva }}</span>{{ ' ' ~ devise }}
											</h5>
										</td>
									</tr>
									{% set sous_total = 0 %}
									{% set subTotalGroup = subTotalGroup + 1 %}
									{% set subTotalList = '' %}
								{% endif %}
                    		{% endfor %}
            			</tbody>
        			</table>
    			</div>
        	</div>
    	</div>
	</div>
{% endblock %}