{% extends 'layout.twig' %}

{% block body %}

    <div class="contenu clearfix"  id="executeDivAction">
        <h1>{{ 'Gestion des projets' | trad }}</h1>
        
        <div>
            <ul class="nav nav-tabs" role="tablist" id="tablist">
            	<li id="onglet_TableauDeBord" onClick="redirectJSWithPost('{{ path('ProjetAchat.GestionProjetAchat.tableauBord') }}');"><a data-toggle="tab" aria-controls="divonglet_TableauDeBord" href="#Divonglet_TableauDeBord" class="ephemere">{{ 'Tableau de bord' | trad }}</a></li>
                <li id="onglet_DivModulable" class="active"><a data-toggle="tab" aria-controls="divModulable" href="#DivModulable" class="ephemere">{{ 'Exécuter action' | trad }}</a></li>
                <li id="onglet_DivModulable2" style="display:none"><a data-toggle="tab" aria-controls="divModulable2" href="#DivModulable2" class="ephemere"></a></li>
                <li id="onglet_DivModulable3" style="display:none"><a data-toggle="tab" aria-controls="divModulable3" href="#DivModulable3" class="ephemere"></a></li>
            </ul>
        </div>



		<div class="clearfix padding15">
            <div class="tab-content">
				<div id="DivModulable" class="tab-pane clearfix bg_form padding_form border_form active">
					{% include '@projetAchat/action/execute.twig' %}
				</div>
				
				<div id="DivModulable2" class="tab-pane fade clearfix bg_form padding_form border_form">
				</div>
	
				<div id="DivModulable3" class="tab-pane fade clearfix bg_form padding_form border_form">
				</div>
			</div>
	    </div>
	    
	    <script>  
    		function generateTab(path, titre, div, idDiv)
    		{
    			if(typeof idDiv == 'undefined')
    			{
    				idDiv = '';
    			}
    			
    			activeLoader();
            	$('#onglet_DivModulable'+idDiv).show();
            	$('#onglet_DivModulable'+idDiv).find('a').html(titre);
            	$('#onglet_DivModulable'+idDiv).find('a').trigger('click');
    
            	$.ajax({
        		  	dataType : 'html',
            		url: path,
            		type: "POST",
            		success: function(htmlData){
            			var result = $('<div />').append(htmlData).find('#'+div).html();
            			$('#DivModulable'+idDiv).html(result);
            			desactiveLoader();
            		},
        		});
    		}
    		
    		function triggerTab(tab)
    		{
    			$("a[aria-controls="+tab+"]").trigger('click');
    		}   
    		     
            $('#onglet_DivModulable').click(function(){
        		$('#onglet_DivModulable2').hide();
        		$('#DivModulable2').html('');
        		
        		$('#onglet_DivModulable3').hide();
        		$('#DivModulable3').html('');
            });
            
            $('#onglet_DivModulable2').click(function(){
        		$('#onglet_DivModulable3').hide();
        		$('#DivModulable3').html('');
            });
	    </script>
	
	</div>
	
{% endblock %}