<?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>Add Notice for Both!!</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 Notice For Both</h3>
                <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="#">Home</a></li>
              <li class="breadcrumb-item">Notice Update</li>
              <li class="breadcrumb-item active">Add Notice</li>
            </ol>
              </div>
              <!-- /.card-header -->
              <div class="card-body">
       
            <form action="notice_for_all_code.php" method="post">
                <div class="row">
             
                  <div class="col-sm-10">
                    
                            <div class="form-group">
                                <label for="exampleInputEmail1">Notice<span style="color:red; font-size:25px;">*<span></label>
                                <textarea class="form-control" rows="1" name="notice" placeholder="Enter ..." required></textarea>
                              
                            </div>
                      </div> 
                      <div class="col-sm-2"> 
                        
                        <button  type="submit" style="margin-top: 45px;width:95%; margin-left:5%"  name="add" class="btn btn-dark">Create</button>
                    
                    </div>
                </div> 
                
              </form> 
          
           <br>
                <table id="example1" class="table table-bordered table-striped">
                  <thead>
                  <tr>
                    <th>Sr.no</th>
                    <th>Date</th>
                    
                    <th>Notice</th>
                   
                    <th>Status</th>
                 
                  </tr>
                  </thead>
                  <tbody>
                  <?php 
                    include('connection.php');
                    $i=0;
                   
                    $sql="SELECT * FROM notice 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['notice'];  ?></td>
                    <td>
                    
                    <form method="POST" action="notice_for_all_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" style="font-weight: 600;font-size: 12px;height: 30px;" class="btn btn-success">
                        <?php } ?>
                        <!-- <?php echo ($row['status'] == 1) ? "<div class='test rounded-circle'></div>" : "<div class='test2 rounded-circle'></div>"; ?> -->
                    </form>
                    
                </td>
                    <!-- <td><button type="submit" id="approve_button" class="btn btn-success">Active</button></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")
?>