<?php 
    require("header.php")
?>

    <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1></h1>
          </div>
          <div class="col-sm-6">
         
          </div>
        </div>
      </div><!-- /.container-fluid -->
    </section>

    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <div class="row">
          <div class="col-12">
            <!-- /.card -->

            <div class="card card-secondary">
              <div class="card-header">
                <h3 class="card-title"> Add Carrier</h3>
                <ol class="breadcrumb float-sm-right">
                  <li class="breadcrumb-item"><a href="#">Home</a></li>
                  <li class="breadcrumb-item ">Inventory</li>
                  <li class="breadcrumb-item active">Add Carrier</li>
                </ol>
              </div>
              <!-- /.card-header -->
              <div class="card-body">
              <form action="add_carrier_code.php" method="post">
                <div class="row">
                <br>
                      <?php if (isset($_GET['error'])) { ?>
                        <div class="alert alert-denger  col-12">
                                <p class="error"><?php echo $_GET['error']; ?></p>
                          </div>
                        
                      

                        <?php } ?>
                        <?php if (isset($_GET['success'])) { ?>
                          <div class="alert alert-success  col-12">
                              <p class="success"><?php echo $_GET['success']; ?></p>
                              </div>
                          
                      
                        <?php } ?>
                  <div class="col-sm-10">
                    
                            <div class="form-group">
                                <label for="exampleInputEmail1">Carrier name <span style="color:red; font-size:25px;">*<span></label>
                                <input type="text" name="carrier_name" class="form-control" id="exampleInputEmail1" placeholder="Enter Carrier Name" required>
                              
                            </div>
                      </div> 
                      <div class="col-sm-2"> 
                        
                        <button style="margin-top: 45px;width:95%; margin-left:5%" type="submit" name="add" class="btn btn-dark">Create</button>
                    
                    </div>
              
                </div> 

              </form>
           
                <table id="example1" class="table table-bordered table-striped">
                  <thead>
                  <tr>
                    <th>Sr.no</th>
                    <th>Date</th>
                    
                    <th>Carrier Name</th>
                   
                    <th>Status</th>
                 
                  </tr>
                  </thead>
                  <tbody>
                  <?php 
                    include('connection.php');
                    $i=0;
                
                    $sql="SELECT * FROM carrier ORDER BY date_time ";
                    $res=mysqli_query($conn,$sql);
                    while($row=mysqli_fetch_assoc($res))
                    {
                      $i++;
                   
                  ?>
                  
                  <tr>
                  <td><?php echo $i; ?></td>
                    <td><?php echo $row['date_time'];  ?></td>
                    
                    <td><?php echo $row['carrier_name'];  ?></td>
                    <td>
                    
                    <form method="POST" action="add_carrier_code.php">
                      
                        <input type="hidden" name="item_id" value="<?php echo $row['id']; ?>">
                        <?php if ($row['status'] == 1) { ?>
                            <input type="submit" name="block" value="Block" style="font-weight: 600;font-size: 12px;height: 30px;" class="btn btn-danger">
                        <?php } else { ?>
                            <input type="submit" name="activate" value="Activate" class="btn btn-success" style="font-weight: 600;font-size: 12px;height: 30px;">
                        <?php } ?>
                        <!-- <?php echo ($row['status'] == 1) ? "<div class='test rounded-circle'></div>" : "<div class='test2 rounded-circle'></div>"; ?> -->
                    </form>
                    
                </td>
                
                  </tr>
                  <?php 
                      }
                        ?>
                  </tbody>
              
                </table>
                 </div>
              </div>
              <!-- /.card-body -->
              
            </div>
            
            <!-- /.card -->
          </div>
          
          <!-- /.col -->
        </div>
        <!-- /.row -->
       
      <!-- /.container-fluid -->
    </section>
    <!-- /.content -->
  </div>
  <!-- for searching -->
<script>


</script>
 <!-- searching end -->

 <!-- pagination -->
 
<?php 
    require("footer.php")
?>