<?php
	
	$message = "";
	$browser = $_SERVER['HTTP_USER_AGENT'];
	echo $browser;
	
	if(isset($_POST['valide']) && $_POST['valide'] == "ok")
	{ 
		header("Location: ok.php");
    }

	 if(isset($_POST['valide']) && $_POST['valide'] == "annule")
	 { 		
		header("Location: valide.php");
	 }	
	 
?>


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="https://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="https://code.jquery.com/jquery.js"></script>
<script src="https://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>

<title>Espace réservation</title>
</head>		

<link rel="stylesheet" href="menu_style.css" type="text/css">

<body>

<style>

.css_message {	width: 500px;
				border-style: solid;
				border-width: 1px;
				border-color: #1c75c8;
				padding: 3px; 
				background-color: #c5ddf6; 
			}

.ui-widget-overlay {
  background: #000;
}
</style>

<script type="text/javascript">

/***************************************************/
/*
$(document).ready(function()
{
		$('#bouton_submit').click(effacer); 
		$('#bouton_annuler').click(annuler); 
});
/***************************************************/

function effacer()
{
	alert("dfsdfgfgqsdf");
	$("#dialog-confirm").dialog({
					//autoOpen: false,  
					resizable: false,
					modal: true,
					title: "Erreur",
					height: 250,
					width: 400,
					buttons: {
							"OK": function ()
							{
								
								document.getElementById('valide').value="ok";
								form_supprimer.submit();
								$(this).dialog('close');
								
								//callback(true);
							},
							"Fermer": function ()
							{
								$(this).dialog('close');
							},
					}
			});
			
			
			$("#dialog-confirm").html('Voulez-vous effacer ce rendez-vous ?.');
			$("#dialog-confirm" ).dialog("open");
			return false;
}

/***************************************************/

function annuler()
{
	
	  window.history.back();
}

/***************************************************/


function fct_effacer()
{	
	verif = confirm("Voulez vous vraiment supprimer ce rendez-vous ?"); 	

 	if(verif == true) 
	{ 
		document.getElementById('valide').value="ok"; 	
	} 	

	if(verif == false) 
	{ 
		document.getElementById('valide').value="stop";
	}	
} 

function fct_annuler()
{	
		alert("coco");
		document.getElementById('valide').value="annule";
} 
</script>

<link rel="stylesheet" href="menu_style.css" type="text/css">

	<div id='cssmenu'>
	<ul>
		<li><a href='home.php'><span>Home</span></a></li>
		<li><a href='selection_planning_mois.php'><span>Planning</span></a></li>
		<li class='active'><a href='selection_gestion_mois.php'><span>Gestion</span></a></li>
		<li><a href='selection_statistique_mois.php'><span>Statistiques</span></a></li>
<?php
		if($_SESSION['nom'] == "admin")
		{ 	
			echo '<li><a href="deplacer_un_rendezvous_admin.php"><span>Déplacer</span></a></li>';
			echo '<li><a href="configuration.php"><span>Configuration</span></a></li>';
		}
		else
		{
			echo '<li><a href="deplacer_un_rendezvous_user.php"><span>Déplacer</span></a></li>';
		}
?>
		<li><a href='change_password.php'><span>Changer password</span></a></li>
		<li><a href='logout.php'><span>Déconnexion</span></a></li>
		<li><a href='#'><span><?php echo $_SESSION['nom'] .' ' .$_SESSION['prenom'] .' connecté' ?></span></a></li>
	</ul>
	</div>
	<br>
	<br>
	
	<!--<form action="" method="post" id="form_supprimer" name="form_supprimer"> -->
	<form action="#" name ="form_supprimer" method="post">
	<table align="left" cellspacing="1" cellpadding="5" border="0" bgcolor="#D5D5D5" width="400"> 
	<!--<table align="left"  border="0" bgcolor="#D5D5D5" width="400">-->	
	<tr bgcolor="#F1F3F5">
	<td><?php echo $client; ?> souhaite annuler un rendez-vous:</td>		
	</tr>
	</tr>	
	</td>
	</tr>

	<input type="hidden" name="valide" id="valide" value="">
	<input type="hidden" name="jour" id="jour" value="<?php echo $jour; ?>">	
	<input type="hidden" name="horaire" id="horaire" value="<?php echo $horaire; ?>">	
	<input type="hidden" name="client" id="client" value="<?php echo $client; ?>">		
	<input type="hidden" name="mois" id="mois" value="<?php echo $mois; ?>">	

	
	<tr bgcolor="#FFFFFF">	
	<td align="left" > 	
	<?php echo "Le blabla à val"; ?>
	</td>	
	</tr>

	<tr bgcolor="#FFFFFF">	
	</tr>	
	
	<tr bgcolor='#F1F3F5'>
	<td colspan='2' align='center'>	
<!--
	<input type="submit" value="Supprimer" class="button" id="bouton_submit" />
	<input type="submit" value="Annuler" 	class="button" id="bouton_annuler" />
-->	
	<input type='submit' name='effacer' value='Supprimer' onClick="fct_effacer()" /> 
	<input type='submit' name='Annuler' value='Annuler' onClick="fct_annuler()" />  	
	
	</td>	
	</tr>
	</td>
	</tr>
	</table>

	</div>
	</div>
	</form>
	
	<div id="dialog-confirm"></div>
	
<?php


				if( $message == "ok")
				{	
					echo '
							<div id="id_message" class="css_message">
							<p>
							<strong>Information</strong>: Modification du mot de passe effectuée avec succés.
							</p>
							<div>';
					$message = "none";
				}
?>	
	
	</body>
	</html>