<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<link href='fullcalendar.min.css' rel='stylesheet' />
<link href='fullcalendar.print.min.css' rel='stylesheet' media='print' />
<script src='lib/moment.min.js'></script>
<script src='lib/jquery.min.js'></script>
<script src='fullcalendar.js'></script>
<script src='locale/fr.js'></script>
    
   <link rel="stylesheet" href="css/bootstrap.min.css" >
     <link rel="stylesheet" href="css/font-awesome.min.css" >
<script src="lib/popper.min.js"></script>
<script src="lib/bootstrap.min.js" ></script>
    
    <style>
.fc-day { background-color:rgba(207,202,202,1.00)}   
.fc-sun { background-color:firebrick}       
.fc-sat { background-color:firebrick; }
.fc-mon { background-color:rgba(207,202,202,1.00)}   
.fc-thu { background-color:rgba(207,202,202,1.00)}   
.fc-fri { background-color:rgba(207,202,202,1.00)}   
.fc-wed { background-color:rgba(207,202,202,1.00)}   
.fc-tue { background-color:rgba(207,202,202,1.00)}   
 

.fc-toolbar { text-transform: capitalize; }

.fc-bg { /* the generic .fc-bg already does position */
z-index: 1;
background: #0931C7;
opacity: .8;
}
body {
     background-image: url('decembre.jpg');
    background-repeat: no-repeat;
    background-size: cover;
    border: none;
}
body .popover {
  max-width: 830px;
}
   

    </style>
         
 <?php
     
             // on se connecte à notre base pour planning

$servername = "localhost:8889";
$username = "root";
$password = "root";
$dbname = "calendrier";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 
								
$sql = "SELECT * FROM planning order by Debut ASC  ";
 //print "<br>".$sql;	
	 
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    
    $idxarray=0;
    // output data of each row
   // print "resultats";
    
    print "events: [";
    while($row = $result->fetch_assoc()) {
	    
$id=$row["idx"];
$titre=$row["Titre"];
$start=$row["Debut"];
$enddate=$row["Fin"];
$weekend=$row["WeekEnd"];
$lien=$row["Lien"];
$Description=$row["Description"];;
$backgroundColor=$row["CouleurFonds"];
$IDD=$row["IdxDevis"];;
$IDC=$row["IdxClient"];
          
        print $id;
             
             // on se connecte à notre base pour devis

$servername = "localhost:8889";
$username = "root";
$password = "root";
$dbname = "devis";

// Create connection
$connT = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($connT->connect_error) {
    die("Connection failed: " . $connT->connect_error);
} 
	
				//	 $sql = "SELECT * FROM tete";
$sql = "SELECT * FROM tete WHERE idx=".$IDD." ";
print $sql;
	
$resultd = $connT->query($sql);

if ($resultd->num_rows > 0) {
    // output data of each row
    while($row = $resultd->fetch_assoc()) {
		
$NUM=$row["num"];
$titre=$row["num"];
$IDX=$row["idx"];
$DATE=$row["date"];
$OBJETT=$row["objet"];
$IDXCLI=$row["idxcli"];
$MEMO=$row["memo"];
$ETATC=$row["etat"];		
$NumeroIdxClient=$row["idxcli"];;
$CHANTIER=$row["chantier"];
$TVA=$row["tva"];
$BANQUE=$row["banque"];
$REMARQUE=$row["remarque"];
$TYPECOM=$row["type"];
$datecommande=$row["commande"];
    } 
    
	
	} else {
    echo "0 results";
}
        
  $connT->close(); 
        

        print "
    {
      id:".$id.",
      title: '".$datecommande."',
      start: '".$start."',
      end : '".$enddate."',
      Weekend : ".$weekend.",
      lien : ".$lien.",
      description: '".$Description."',
      backgroundColor: '".$backgroundColor."'
    },";
        
        	}
       	}
   $conn->close();  
    

   
        ?>
     
    
    

<style>

  body {
    margin: 40px 10px;
    padding: 0;
    font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
    font-size: 14px;
  }

  #calendar {
    max-width: 900px;
    margin: 0 auto;
  }

</style>
</head>
    
<body>

<div id='calendar'></div>

   
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
  Launch demo modal
</button>

<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered " role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body" id="modal-body">
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary" id="sauve">Save changes</button>
      </div>
    </div>
  </div>
</div>
    
</body>
</html>
