{% block body %}

	<div id="refreshPJ">
		{% if withNavbar %}
			{% include "@Consultation/Consultation/_navbarConsultation.twig" %}
		{% endif %}
    	<div class="clearfix">
    		{% if canEdit and consultation.hasProjetLie %}
					<a class="download_blanc_v2 button_v2 white-tooltip" style="float: right;" id="btnAddCompany" href="{{ path('Consultation.ImportDocument.listeDocument', {'idAO':idAO}) }}">
						<span class="infos_tooltip left">
							{{ 'Importer un document depuis un projet' | trad }}
						</span>
					</a>
			{% endif %}
    	</div>

    	{% set Count = 0 %}
		<table class="table table-hover tableV2">
			<thead class="thead-dark">
				<th scope="col">{{"Titre" | trad}}</th>
				<th scope="col">{{"Fichier" | trad}}</th>
				<th scope="col">{{"Date de parution" | trad}}</th>
				<th scope="col">{{"Date de fin de validité" | trad}}</th>
				<th scope="col">{{"Auteur" | trad}}</th>
				<th scope="col">{{"Commentaire" | trad}}</th>
				<th scope="col">
				{% if canEdit %}
					<div style="display: flex; justify-content: end">
						<a class="ajouter_blanc_v2 white-tooltip" style="float: right;margin-left:5px!important;" id="btnAddCompany" href="{{ path('GlobalApplication.CreationDocRattaches.ajoutDocAtt', {id: idForDoc, NO_DA: 'AO_ENTET', typeAccCadre:'noType'}) }}">
							<span class="infos_tooltip left">
								{{ 'Ajouter un document' | trad }}
							</span>
						</a>
					</div>
				{% endif %}
				</th>
			</thead>
			<tbody>
    			{% for key, document in listeDocument %}
        		<tr id="document_{{ document.NO_ORDRE }}">
        			<td width="15%"><b>{{ document.TITRE }}</b></td>
        			<td><a href="{{ path('GlobalApplication.AjaxDocRattaches.downloadFichier', {id: idForDoc, ordre: document.NO_ORDRE, NO_DA: 'AO_ENTET'}) }}" target="_blank">{{ document.NOM_ORI }}</a></td>
        			<td>{{ document.DT_PARUT | dateTrad}}</td>
        			<td width="10%">{{ document.DT_VALID | dateTrad }}</td>
        			<td width="20%">{{ document.NOM }} ({{ document.AUTEUR }})</td>
					<td>{{ shortLibelle(document.COMMENTAIRE, 20, 'top-left') }}</td>				
        			<td width="10%">
        				{% if canEdit %}
    				        {{ hover_action('document_'~document.NO_ORDRE, 'modifier_v2' , "window.location.href ='"~path('GlobalApplication.ModifierDocRattaches.editDocAtt', {id: idForDoc, NO_DA: 'AO_ENTET', ordre :document.NO_ORDRE, typeAccCadre:'noType'})~"'", 'float: right;margin-right:5px;') }}
    				        {{ hover_action('document_'~document.NO_ORDRE, 'Supprimer_v2' , "popupConfirmation(\'"~path('Ajax.Erreur.popupConfirmationSuppresion')~"\', \'\', \'"~path('GlobalApplication.AjaxDocRattaches.supprimer', {id: idForDoc, NO_DA: 'AO_ENTET', NoOrdre: document.NO_ORDRE})~"\', \'"~('Etes-vous sûr de vouloir supprimer le document' | trad |e('js')|raw)~" "~(document.TITRE |e('js')|raw)~" ?\', \'refreshPJ\')", 'float: right;margin-right:5px;') }}
        				{% endif %}
        			</td>
        		</tr>
				{% else %}
					<tr><td colspan="7" style="text-align: center; color: DarkGray">{{"Aucun élément" | trad}}</td></tr>
    			{% endfor %}
        		</tbody>
        	</table>
	</div>

{% endblock %}