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


include('header.php');
include("db_con.php");
$UniversityID = $_SESSION["UniversityID"];
$UserID = $_SESSION["UserID"];
$UserID = 1
 //$ClientID=$_GET['ClientID'];
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>View Equipment</title>
    

</head>
<body>
<table class="table table-hover">

<!-- <div class="alert alert-success my-0" role="alert">
<a href="main.php" class="alert-link text-decoration-none">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-left" viewBox="0 0 16 16">
  <path fill-rule="evenodd" d="M15 8a.5.5 0 0 0-.5-.5H2.707l3.147-3.146a.5.5 0 1 0-.708-.708l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.707 8.5H14.5A.5.5 0 0 0 15 8z"/>
</svg></a>&emsp;
            <a href="" class="alert-link text-decoration-none"> Image Upload Queue</a>
</div> -->
    
    <!-- <tr style="background-color:#d1e7dd; color:#000;">
    
    
        <th>Image Upload Queue</th>
       
        <th class="text-center"></th>
       
        
    </tr> -->

    <?php
    // $ClientID = $_GET["ClientID"];
    $Qry3="SELECT * FROM `equipment`"; 

    $Run3=mysqli_query($con,$Qry3);
    if(mysqli_num_rows($Run3)<1)
    {
        echo"<tr><td colspan='3'> No Record</td></tr>";
    }
    else
    {
      ?>
      <br>
      <div class="container">
      <div class="row row-cols-1 row-cols-md-4">
      <?php
        while($Data3=mysqli_fetch_assoc($Run3))
        {
            
            ?>


  

  <div class="col mb-4">
    <div class="card">
    <div class="card-header">
    Record ID: <?php echo $Data3["record_id"]; ?>
        
    </div>
      <img src="images\equipment\<?php echo $Data3['equipment_id'].'/'.$Data3['image']; ?>" onerror="if (this.src != 'images/default/equipment_image_not_found.jpg') this.src = 'images/default/equipment_image_not_found.jpg';" class="card-img-top" alt="...">
      <!-- <img class="card-img-top" src="https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl=http://localhost/Order/equipment_manager/admin_view_log.php?equipment_id=<?php echo $Data3["equipment_id"];?>&choe=UTF-8"> -->
      <div class="card-body">
        <h5 class="card-title">Title: <?php echo $Data3["title"]; ?></h5>

        <p class="card-text"><small class="text-muted">Location: <?php echo $Data3["location"]; ?><br>Type: <?php echo $Data3["equipment_type"]; ?><br>Notes: <?php echo $Data3["notes"]; ?><br>Service interval: <?php echo $Data3["service_interval"]; ?></small></p>
        <p class="card-text">Description: <?php echo $Data3["equipment_description"]; ?></p>
        
        <div class="text-right my-0" >
            <a align="right"class="btn btn-sm btn-warning text-right my-0 py-1"href="images\equipment\<?php echo $Data3['equipment_id'];?>\qr_code_<?php echo $Data3['equipment_id'];?>.jpg"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-qr-code" viewBox="0 0 16 16">
            <path d="M2 2h2v2H2V2Z"/>
            <path d="M6 0v6H0V0h6ZM5 1H1v4h4V1ZM4 12H2v2h2v-2Z"/>
            <path d="M6 10v6H0v-6h6Zm-5 1v4h4v-4H1Zm11-9h2v2h-2V2Z"/>
            <path d="M10 0v6h6V0h-6Zm5 1v4h-4V1h4ZM8 1V0h1v2H8v2H7V1h1Zm0 5V4h1v2H8ZM6 8V7h1V6h1v2h1V7h5v1h-4v1H7V8H6Zm0 0v1H2V8H1v1H0V7h3v1h3Zm10 1h-1V7h1v2Zm-1 0h-1v2h2v-1h-1V9Zm-4 0h2v1h-1v1h-1V9Zm2 3v-1h-1v1h-1v1H9v1h3v-2h1Zm0 0h3v1h-2v1h-1v-2Zm-4-1v1h1v-2H7v1h2Z"/>
            <path d="M7 12h1v3h4v1H7v-4Zm9 2v2h-3v-1h2v-1h1Z"/>
            </svg></a>
            <a align="right"class="btn btn-sm btn-primary text-right my-0 py-1"href="admin_view_log.php?equipment_id=<?php echo $Data3["equipment_id"]; ?>">Logs</a>

        </div>
        <!-- <p class="card-text"><small class="text-muted">Notes: <?php echo $Data3["notes"]; ?></small></p> -->
      </div>
      <!-- <div class="card-footer">

    </div> -->
    <?php
   
?>
    </div>
  </div>


            <!-- <tr>
                
                <td rowspan=""><a class="text-decoration-none text-dark" href="images\<?php echo $Data3['equipment_id'].'/'.$Data3['image']; ?>"><img width="200px" height="150px" src="images\<?php echo $Data3['equipment_id'].'/'.$Data3['image']; ?>" alt="NOT_FOUND" style="max-width:50px"></a></td>
                <td><?php echo "Title: ".$Data3["title"]."<br>Location: ".$Data3["location"]."<br>Equipment Type: ".$Data3["equipment_type"]."<br>Equipment Description: ".$Data3["equipment_description"]."<br>Notes: ".$Data3["notes"]."<br>Service Interval: ".$Data3["service_interval"]; ?></td>
              
               
              
               
                <td rowspan="" class="text-center align-middle"><a href="DeleteOrder.php?OrderNumber=<?php echo $Data3["OrderNumber"]?>&OrderID=<?php echo $Data3["OrderID"]?>&Image=<?php echo $Data3["Image"]?>" class="btn btn-danger"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash" viewBox="0 0 16 16">
  <path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6z"/>
  <path fill-rule="evenodd" d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1v1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4H4.118zM2.5 3V2h11v1h-11z"/>
</svg></a></td>    
            </tr>   -->
            
           
        <?php
        }
        ?>
        </div>
        </div>
        </table>
        <?php
    }
    ?>
</body>
</html>