<center><h1>Commande chez Ronny McKebab!</h1></center>
<?php
// si on démarre la commande
if(get("startCommande"))
{
?>
<form action="index.php" method="get">
	<input type="hidden" name="commande" value="on">
	<?php
	createInputText("nomClient","Nom du client");
	?><br>
	<input type="submit" class="btn-info btn-lg btn btn-block" value="Poursuivre" name="poursuivre">
</form>
<br>
<?php
	// affichage du bouton retour accueil
	setBouton("12","success","fa-home","Retour accueil","index.php");
}
// si on modifie la commande
if(get("commande"))
{
	if(get("poursuivre"))			$client1 = new Commande(6,5.5,get("nomClient"));
	else $client1 = unserialize($_SESSION["client1"]); 
	if (get("addAmericain")) 		$client1->addKebab("Americain",1);
	if (get("removeAmericain")) 	$client1->removeKebab("Americain",1);
	if (get("addBuffalo")) 			$client1->addKebab("Buffalo",1);
	if (get("removeBuffalo")) 		$client1->removeKebab("Buffalo",1);
	if (!get("commande"))			unset($_SESSION["client1"]);
	else 							$_SESSION["client1"]=serialize($client1);
?>
<div class="row">
	<?php
	if ($client1->getNb("Americain") >0)
	{
		setBouton("6","success","fa-plus","Ajouter Américain","index.php?commande=on&addAmericain=on");
		setBouton("6","danger","fa-minus","Enlever Américain","index.php?commande=on&removeAmericain=on");
	}
	else
		setBouton("12","success","fa-plus","Ajouter Américain","index.php?commande=on&addAmericain=on");
	?>
</div><br>
<div class="row">
	<?php
	if ($client1->getNb("Buffalo") >0)
	{
		setBouton("6","success","fa-plus","Ajouter Buffalo","index.php?commande=on&addBuffalo=on");
		setBouton("6","danger","fa-minus","Enlever Buffalo","index.php?commande=on&removeBuffalo=on");
	}
	else
		setBouton("12","success","fa-plus","Ajouter Buffalo","index.php?commande=on&addBuffalo=on");

	?>
</div><br>
<div class="row">
	<?php
	setBouton("12","default","fa-eye","Afficher commande","index.php?commande=on&afficherCommande=on");
	?>
</div><br>
<div class="row">
	<?php
	setBouton("12","warning","fa-times","Annuler commande","index.php");
	?>
</div><br>
<br>
<?php
	
}
// si on veut afficher la commande
if (get("afficherCommande"))
{
	$client1 = unserialize($_SESSION["client1"]);		
	$client1->afficherCommande();
	echo '<div class="row">';
	// ajout du bouton pour valider la commande --> il passe le paramère valideCommande
	setBouton("12","info","fa-check","Finaliser Commande","index.php?valideCommande=on");
	echo '</div><br>';
	$_SESSION["client1"]=serialize($client1);
}
?>
