
<?php
include('../includes/sidebar.php');
include('../includes/header.php');
?>
  <!-- [ Main Content ] start -->
  <div class="pc-container">
    <div class="pc-content">
      <!-- [ breadcrumb ] start -->
      <div class="page-header">
        <div class="page-block">
          <div class="page-header-title">
            <h5 class="mb-0 font-medium">Sample Page</h5>
          </div>
          <ul class="breadcrumb">
            <li class="breadcrumb-item"><a href="../dashboard/index.html">Home</a></li>
            <li class="breadcrumb-item"><a href="javascript: void(0)">Other</a></li>
            <li class="breadcrumb-item" aria-current="page">Sample Page</li>
          </ul>
        </div>
      </div>
      <!-- [ breadcrumb ] end -->


      <!-- [ Main Content ] start -->

      <div class="grid grid-cols-12 gap-x-6">
        <!-- [ sample-page ] start -->
        <div class="col-span-12">
          <div class="card">
          
            <div class="card-body">
              <div class="card table-bordered" >
              <div class="card-header"  style="display:flex;justify-content:space-between;">
                <div><h5>Recent Users</h5></div>
                <div>
                <!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal">
<i class="fa-solid fa-plus"></i>  Add
</button>

<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h1 class="modal-title fs-5" id="exampleModalLabel">Modal title</h1>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body">
       <form action="category_add.php" method="post" enctype="multipart/form-data">
        <div class="mb-3">
    <label class="form-label">Image</label>
    <input type="file" class="form-control" name="image">
  </div>
          <div class="mb-3">
    <label class="form-label">Name</label>
    <input type="text" class="form-control"  placeholder="Enter product name" name="name">
  </div>
      <div class="mb-3">
    <label class="form-label">status</label>
    <select name="status" class="form-control" >
      <option value="">--Select--</option>
  <option value="1">Active</option>
  <option value="0">Inactive</option>

</select>
  </div>
  <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
        <button type="submit" class="btn btn-primary">Submit</button>
      </div>
</form>
      </div>
      
    </div>
  </div>
</div>
              
              </div>
              </div>
              <div class="card-body">
                <div class="table-responsive">
                  <table class="table table-hover">
                   <thead>
                    <tr>
                      <th>Id</th>
                        <th>Image</th>
                      <th>Name</th>
                    
                      <th>status</th>
                      
                      <th>Action</th>
                    </tr>
                   
                   </thead>
                   <?php
                    include('../includes/connection.php');
                    $sql="select * from category_add";
                    $result=mysqli_query($con,$sql);
                    while($data=mysqli_fetch_assoc($result))
                    {
                   ?>
                 
                    <tr>
                      <td><?php echo $data['id'] ?></td>
                       <td> <img src="<?php echo $data['image'] ?>" alt="" style="height:100px;width:100px;"> </td>
                      <td><?php echo $data['name'] ?></td>
                       <?php
                   if($data['status']=='0')
                   {
                    echo"<td><button class='btn btn-danger'>Out of stock</button></td>";
                   }
                   else{
                     echo"<td><button class='btn btn-success'>Available</button></td>";
                   }
                   
                   ?>
                   

                     
                    
                      <td>
                      <a href='category_edit.php?<?php echo"id=$data[id]"?>' class="btn btn-success"><i class="fa-solid fa-pen-to-square"></i></a>
                        <a href='category_delete.php?<?php echo"id=$data[id]" ?>'class="btn btn-danger" ><i class="fa-solid fa-trash"></i></a>
                       
                      </td>
                    </tr>
                   
                   <?php
                    }
                   ?>
                  </table>
                </div>
              </div>
            </div>
         
            </div>
          </div>

        </div>
        <!-- [ sample-page ] end -->
      </div>
      <!-- [ Main Content ] end -->
    </div>
  </div>
  <!-- [ Main Content ] end -->
         
            
        
        <!-- [ Main Content ] end -->
     
     <?php

include('../includes/footer.php');
?>
     
   