	<?php
	if (session::instance()->get('nom_utilisateur')!=='')
	{ 
     $nbArticles=session::instance()->get('panier'.'id');
	   $nbArticles=count($nbArticles);	
	?>	
	<div class="row-fluid sortable">
		<div class="box span12">
			<div class="box-header well" data-original-title>
					
					</div>
					<div class="box-content">
						<table class="table table-striped table-bordered bootstrap-datatable datatable">
						  <thead>
							  <tr>
								  <th>ID</th>
								  <th>Libelle</th>
								  <th>Quantite</th>
								  <th>Prix</th>
								  <th>Actions</th>
							  </tr>
						  </thead>   
						  <tbody>
						 
						  <?php   
						 
						  for ($i=0 ;$i < $nbArticles ; $i++) { 
						     $id=session::instance()->get('panier'.'id');
			  $data=session::instance()->get('panier'.'libelleProduit');
			  
		  $data1=session::instance()->get('panier'.'qteProduit');
		 
         $data2=session::instance()->get('panier'.'prixProduit');
						  ?>
						  
							<tr>
								<td><?php echo $id[$i];?></td>
								<td class="center"><?php echo $data[$i];?></td>
								<td class="center"><?php echo  '<input type="text" size="4" name="'.$id[$i].'" id="'.$id[$i].'" value="'.htmlspecialchars($data1[$i]).'"/>'; ?> <button onclick="ClicBoutonPanier('<?php echo $id[$i];?>');" class="oBtn oBtnPrimary">Valider</button> </td>
								<td class="center"><?php echo $data2[$i];?></td>
						
			
								<td class="center">
									<a class="oBtn oBtnSecondary" <?php echo 'onclick="supprimerArticle('.$id[$i].')"';?> >
										<i class="icon-trash icon-white"></i> 
										Supprimer
									</a>
								</td>
							</tr>
								<?php } ?>
							<h2> Mon panier <?php   echo " Total : ".number_format(session::instance()->get('total'), 2, ',', ' ').''; }?></h2>			
						  </tbody>
					  </table> 
                    	<?php if ($nbArticles > 0)
	{  ?>
     <button onclick="Commander();" class="oBtn oBtnPrimary">commander</button></td>
<?php } 
?>	  	  
					</div>
				</div><!--/span-->
				</div>
	


<script type="text/javascript"> 
   function ClicBoutonPanier(sender){
          if (confirm('Vous etes sure de vouloir modifier la quantite actuelle?')){ 
        var quantite=document.getElementsByName(sender)[0].value;
		var id=document.getElementsByName(sender)[0].id;
       
		document.location.href="<?php echo URL::base(); ?>page/modifierarticle/" +id+"/"+quantite ;
		}
   } 
     function supprimerArticle(sender){
          if (confirm('Vous etes sure de vouloir supprimer l\'article selectionné ?')){ 
       
       		document.location.href="<?php echo URL::base(); ?>page/supprimerarticle/" +sender ;
		}
   } 
 
    function Commander(){
         
      if (confirm('Vous etes sure de vouloir valider la commande ?')){ 
	   var id_client="<?php echo session::instance()->get('id_client') ; ?>";
		var total="<?php echo session::instance()->get('total') ; ?>";
       
		document.location.href="<?php echo URL::base();?>contact" ;
		}
   } 
</script>

	<script src="<?php echo URL::base(); ?>media/admin/js/jquery-1.7.2.min.js"></script>
	<!-- jQuery UI -->
	<script src="<?php echo URL::base(); ?>media/admin/js/jquery-ui-1.8.21.custom.min.js"></script>
	<!-- transition / effect library -->
	<script src="<?php echo URL::base(); ?>media/admin/js/bootstrap-transition.js"></script>
	<!-- alert enhancer library -->
	<script src="<?php echo URL::base(); ?>media/admin/js/bootstrap-alert.js"></script>
	<!-- modal / dialog library -->
	<script src="<?php echo URL::base(); ?>media/admin/js/bootstrap-modal.js"></script>
	<!-- custom dropdown library -->
	<script src="<?php echo URL::base(); ?>media/admin/js/bootstrap-dropdown.js"></script>
	<!-- scrolspy library -->
	<script src="<?php echo URL::base(); ?>media/admin/js/bootstrap-scrollspy.js"></script>
	<!-- library for creating tabs -->
	<script src="<?php echo URL::base(); ?>media/admin/js/bootstrap-tab.js"></script>
	<!-- library for advanced tooltip -->
	<script src="<?php echo URL::base(); ?>media/admin/js/bootstrap-tooltip.js"></script>
	<!-- popover effect library -->
	<script src="<?php echo URL::base(); ?>media/admin/js/bootstrap-popover.js"></script>
	<!-- button enhancer library -->
	<script src="<?php echo URL::base(); ?>media/admin/js/bootstrap-button.js"></script>
	<!-- accordion library (optional, not used in demo) -->
	<script src="<?php echo URL::base(); ?>media/admin/js/bootstrap-collapse.js"></script>
	<!-- carousel slideshow library (optional, not used in demo) -->
	<script src="<?php echo URL::base(); ?>media/admin/js/bootstrap-carousel.js"></script>
	<!-- autocomplete library -->
	<script src="<?php echo URL::base(); ?>media/admin/js/bootstrap-typeahead.js"></script>
	<!-- tour library -->
	<script src="<?php echo URL::base(); ?>media/admin/js/bootstrap-tour.js"></script>
	<!-- library for cookie management -->
	<script src="<?php echo URL::base(); ?>media/admin/js/jquery.cookie.js"></script>
	<!-- calander plugin -->
	<script src='<?php echo URL::base(); ?>media/admin/js/fullcalendar.min.js'></script>
	<!-- data table plugin -->
	<script src='<?php echo URL::base(); ?>media/admin/js/jquery.dataTables.min.js'></script>

	<!-- chart libraries start -->
	<script src="<?php echo URL::base(); ?>media/admin/js/excanvas.js"></script>
	<script src="<?php echo URL::base(); ?>media/admin/js/jquery.flot.min.js"></script>
	<script src="<?php echo URL::base(); ?>media/admin/js/jquery.flot.pie.min.js"></script>
	<script src="<?php echo URL::base(); ?>media/admin/js/jquery.flot.stack.js"></script>
	<script src="<?php echo URL::base(); ?>media/admin/js/jquery.flot.resize.min.js"></script>
	<!-- chart libraries end -->

	<!-- select or dropdown enhancer -->
	<script src="<?php echo URL::base(); ?>media/admin/js/jquery.chosen.min.js"></script>
	<!-- checkbox, radio, and file input styler -->
	<script src="<?php echo URL::base(); ?>media/admin/js/jquery.uniform.min.js"></script>
	<!-- plugin for gallery image view -->
	<script src="<?php echo URL::base(); ?>media/admin/js/jquery.colorbox.min.js"></script>
	<!-- rich text editor library -->
	<script src="<?php echo URL::base(); ?>media/admin/js/jquery.cleditor.min.js"></script>
	<!-- notification plugin -->
	<script src="<?php echo URL::base(); ?>media/admin/js/jquery.noty.js"></script>
	<!-- file manager library -->
	<script src="<?php echo URL::base(); ?>media/admin/js/jquery.elfinder.min.js"></script>
	<!-- star rating plugin -->
	<script src="<?php echo URL::base(); ?>media/admin/js/jquery.raty.min.js"></script>
	<!-- for iOS style toggle switch -->
	<script src="<?php echo URL::base(); ?>media/admin/js/jquery.iphone.toggle.js"></script>
	<!-- autogrowing textarea plugin -->
	<script src="<?php echo URL::base(); ?>media/admin/js/jquery.autogrow-textarea.js"></script>
	<!-- multiple file upload plugin -->
	<script src="<?php echo URL::base(); ?>media/admin/js/jquery.uploadify-3.1.min.js"></script>
	<!-- history.js for cross-browser state change on ajax -->
	<script src="<?php echo URL::base(); ?>media/admin/js/jquery.history.js"></script>
	<!-- application script for Charisma demo -->
	<script src="<?php echo URL::base(); ?>media/admin/js/charisma.js"></script>