{% extends '@ajax-layout/layout.twig' %}

{% block body %}

	<div class="clearfix" id="popupFormatdoc">
		
		<div class="colonne2">
			<div id="treeview" class="treeview">
			</div>
		</div>
		<div id="zoneDonnee" class="colonne2 last">
		</div>
	
	</div>
	
	<script>
        $('#treeview').treeview({
            'data': {{ treeMaquette | json }},
            'showTags': false,
            'levels': 2,
            'enableLinks': false,
        });
        
	 	$("#treeview").on('click','.list-group-item', function () {
           	var id = $(this).data('id');
			
			activeLoader();
        	$.ajax({
    		  	dataType : 'html',
        		url: '{{ baseUrl() }}ProjetAchat/popupFormatDocument/ajaxFormatDocument/'+id,
        		type: "POST",
        		data: {'divCode': '{{ post.divCode }}', 'divLibelle': '{{ post.divLibelle }}'},
        		success: function(result){
        			$("#zoneDonnee").html(result);
        			desactiveLoader();
        		}
        	});
		});
        
	</script>
{% endblock %}