<?php
			session_start();
			include("corps_html.php");
			include('database.php');
			include('config.php');
			DB_connexion(); 
	
?>	
<link rel="stylesheet" type="text/css" href="style.css">
<link href="http://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" rel="stylesheet">
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>

<script>

function active_champ_projet()
{
			
			document.getElementById("champ_projet").style.visibility='visible';

			nom_famille = document.getElementById('famille').value;
			var dataString = 'nom_famille='+ nom_famille;
			
			$.ajax
			({
				type: "POST",
				url: "ajax_liste_projet.php",
				data: dataString,
				cache: false,
				success: function(html)
				{
					//alert(html);
					document.getElementById('champ_projet').innerHTML = html;
				}
			});
			
			

			
}

function active_champ_bloc()
{
			document.getElementById("champ_bloc").style.visibility='visible';

			button = "<input class='btn btn-primary' type='submit' value='Selectionner' name='selection' onclick='selection_bloc()' />";
			
			nom_projet = document.getElementById('projet').value;
			var dataString = 'nom_projet='+ nom_projet;
			
			$.ajax
			({
				type: "POST",
				url: "ajax_liste_bloc.php",
				data: dataString,
				cache: false,
				success: function(html)
				{
					document.getElementById('champ_bloc').innerHTML = html + button;
				}
			});

}

function selection_bloc()
{
			
			var bloc = document.getElementById('bloc').value;
			var projet = document.getElementById('projet').value;
			window.location.replace("edition_bloc.php?bloc=" + bloc + "&projet=" + projet);
}
</script>

<body>

	<div class="layout">

<?php
	include("header.php");
?>	
		
<!-- Main -->
		<div class="main">
			<div class="container">
				<div class="row">
				
				<div class="col-md-12">
						<!-- Content -->
						<div class="content">
							<div class="page-header">
								<!--<h3>Interface du gestionnaire de projets</h3> -->
								<h2><i class="icon-bullhorn"></i> <span>Liste des blocs</span></h2>
							</div>
								
							<!-- Single Page -->
							<div class="page">
								
							<div class="examples">
							
							<!------>
							
							<div id='champ_famille' > 
							<p>				
							<div class="center">
			
							<label>Famille de produit: </label>
							<select name='famille' id='famille' onchange='active_champ_projet()'>
							<option value="vide">- - - Choisissez - - -</option>
<?php
							for($i=0; $i < count($tab_famille_projet) ; $i++) 
							{
								echo '<option value="'.$tab_famille_projet[$i].'">'.$tab_famille_projet[$i].'</option>'; 
							}
?>
							</select>
							</div>		
							</p>		
							</div>
							
							
							<div id='champ_projet' style="visibility: hidden;"  >  <!-- style='display:inline' -->
							<div class="center">					
							</br>
							</div>					
							</div> 

							</br>
														
							<div id='champ_bloc' style="visibility: hidden;"  >  <!-- style='display:inline' -->
<!--
							<div class="center">					
							</br>
							</div>  -->					
							</div> 
						
							<!------->
							
							</div>	
								
							<div class="clear"></div>

							<div class="clear"></div>
							</div>
							<!-- End Single Page -->
						</div>
						<!-- End Content -->
				</div>
					
				</div>
			</div>
		</div>
<!-- End Main -->
		
<?php
	include("footer.php");
?>		

	</div>

</body>
</html>
