{% block body %}
	<div class="clearfix" id="document_projet">
		<div class="clearfix">
			{{ specifique('ProjetAchat', 'geditIcon') }}
			{% if ((typeObjet == 'D' and (droit.DOA_DOA_CM and model.PROPRIETAIRE == login) or droit.DOA_DOA_TT) or (typeObjet == 'M' and (droit.DOA_MOD_CM and model.PROPRIETAIRE == login) or droit.DOA_MOD_TT)) and droit.DOA_DOC_CM %}
        		<button class="white-tooltip principal" style="margin-top: 10px;float:right;"  onClick="generateTab('{{ path('GlobalApplication.CreationDocRattaches.ajoutDocAtt', {NO_DA: 'DOA', id: idForDoc, typeAccCadre:'noType'}) }}', '{{ 'Ajout d\'un document' | trad |e('js')|raw }}','div_doc_external');">{{ 'Ajouter' | trad }}</button>
    		{% endif %}
		</div>
    	
    	{% set Count = 0 %}
    	{% for key, document in listeDocument %}
    		{% if listeDocument[key-1].TYPE_PJ !=  document.TYPE_PJ  %}
    		{% set Count = Count+1 %}
    		<h4>{{ document.PJLIBELLE }}</h4>
        	<table class="table table-hover tableV2">
        		<thead class="thead-dark" style="display: none;">
        			<th scope="col" colspan="6"></th>
        		</thead>
        		<tbody>
    		{% endif %}
        		<tr id="document_{{ document.NO_ORDRE }}">
        			<td width="25%">
						{% if document.COMMENTAIRE %}
							<span class="white-tooltip" style="cursor:pointer;" onClick="ajaxPopup('{{ path('Ajax.outil.contentText') }}', '', '{{ document.COMMENTAIRE |e('js')|raw }}');">
								<b>{{ document.TITRE }}</b>
								<span class="infos_tooltip">
									{{ document.COMMENTAIRE }}         			
								</span>
							</span>
						{% else %}
							<b>{{ document.TITRE }}</b>
						{% endif %}
					</td>
        			<td width="10%">
            			<span class="white-tooltip">
                			<span class="infos_tooltip left">
                				{{ 'Date de validité' | trad }}
                            </span>
                            {{ document.DT_VALID | dateTrad }}
            			</span>
    			    </td>
        			<td width="20%">
            			<span class="white-tooltip">
                			<span class="infos_tooltip left">
                				{{ 'Auteur' | trad }}
                            </span>
                            {{ document.NOM }} ({{ document.AUTEUR }})
            			</span>
        			</td>
        			<td><a href="{{ path('GlobalApplication.AjaxDocRattaches.downloadFichier', {id: idForDoc, ordre: document.NO_ORDRE, NO_DA: 'DOA'}) }}">{{ document.NOM_ORI }}</a></td>
        			<td>{{ document.NOM_DATA }}</td>
        			<td width="10%">
        				{% if document.Delete and ((typeObjet == 'D' and (droit.DOA_DOA_CM and model.PROPRIETAIRE == login) or droit.DOA_DOA_TT) or (typeObjet == 'M' and (droit.DOA_MOD_CM and model.PROPRIETAIRE == login) or droit.DOA_MOD_TT)) and droit.DOA_DOC_CM %}
        				    {{ hover_action('document_'~document.NO_ORDRE, 'Supprimer_v2' , "popupConfirmation(\'"~path('Ajax.Erreur.popupConfirmationSuppresion')~"\', \'\', \'"~path('GlobalApplication.AjaxDocRattaches.supprimer', {id: idForDoc, NO_DA: 'DOA', NoOrdre: document.NO_ORDRE})~"\', \'"~('Etes-vous sûr de vouloir supprimer le document' | trad |e('js')|raw)~" "~(document.TITRE |e('js')|raw)~" ?\', \'redirect\')", 'float: right;margin-right:5px;') }}
        				{% endif %}
        			</td>
        		</tr>
    		{% if listeDocument[key+1].TYPE_PJ !=  document.TYPE_PJ  %}
        		</tbody>
        	</table>
        	{% endif %}
    	{% endfor %}
	</div>
{% endblock %}