<?php
error_reporting(0);
session_start();
// include("login_check_admin.php");


include('header.php');
include("db_con.php");
$equipment_id = $_GET["equipment_id"];

?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>View Log</title>
    

</head>
<body>
    <div class="table-responsive">
<table class="table table-hover text-center">
    <thead>
        
        <th>Type</th>
        <th>Date</th>
        <th>Description</th>
        <th>Notes</th>
        <th>Next_Service</th>
        <th>completed_By</th>
        <th>Message</th>
        
    </thead>


    <?php
    
    $Qry3="SELECT * FROM `log`  WHERE equipment_id = '$equipment_id'";


    $Run3=mysqli_query($con,$Qry3);
    if(mysqli_num_rows($Run3)<1)
    {
        echo"<tr class='alert alert-danger text-center'><td colspan='3'>No Logs found</td></tr>";
    }
    else
    {
     
        while($Data3=mysqli_fetch_assoc($Run3))
        {
            $date=date_create($Data3["date"]);
            $date = date_format($date,"d/m/yy");
            
            $next_service=date_create($Data3["$next_service"]);
            $next_service = date_format($next_service,"d/m/yy");
            
           
            
            //echo $date."=".$next_service;
            ?>

                
  

  

             <tr>
                
                <td><?php echo $Data3['type']; ?></td>
                <td><?php echo $date; ?></td>
                <td><?php echo $Data3['description']; ?></td>
                <td><?php echo $Data3['notes']; ?></td>
                <td><?php echo $next_service; ?></td>
                <td><?php echo $Data3['completed_by']; ?></td>
                <td><?php echo $Data3['message']; ?></td>
              
              
               
              
               
                </tr>   
           
        <?php
        }
        ?>
        
        </table>
        </div>
        <?php
    }
    ?>
</body>
</html>