<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Add IP</title>
    <link rel="stylesheet" href="<?php echo base_url()?>assest/css/retailer.css">
    <script src="https://kit.fontawesome.com/99ae471b6d.js" crossorigin="anonymous"></script>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
    <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js" integrity="sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF" crossorigin="anonymous"></script>
    <!-- jquer cdn -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
    <!-- =================== Datatable cdn start =================================== -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.2.0/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdn.datatables.net/1.12.1/css/dataTables.bootstrap5.min.css">
    <script src="https://code.jquery.com/jquery-3.5.1.js"></script>
    <script src="https://cdn.datatables.net/1.12.1/js/jquery.dataTables.min.js"></script>
    <script src="https://cdn.datatables.net/1.12.1/js/dataTables.bootstrap5.min.js"></script>

<body>



<div class="container-fluid py-2 ">
    
    
     <div class="col-md-11 bg-white p-3 ms-3" id="search-id">
         <h3 class="py-2 text-center">Add IP for Admin Login Link </h3>
        <div class="row gap-2">
        <div class="col-md-8">
            <!--<h5>Added Lists</h5>-->
            <table class="table border mt-2 bg-light" >
                <thead>
                    <th>Sr.No</th>
                    <th>Date</th>
                    <th>Name</th>
                    <th>IP Address</th>
                    <th>Status</th>
                    <th>Action</th>
                </thead>
                <?php
                     $sql = "SELECT * FROM allowed_ip Where status ='0'  order by id desc ";		
                $rs = $this->Login_model->Execute($sql, array())->result();
                    ?>
                <tbody>
                     <?php $i=1;foreach($rs as $r){
                            ?>
                    <tr>
                      <td><?=$i;?></td>
        <td><?=date("d-m-Y h:i:s a", strtotime(trim($r->created_at)));?></td>
        <td><?=$r->name;?></td>
        <td><?=$r->ip_adr;?></td>
        <td><?php
        
        if($r->status=='0'){
            $class= 'bg-success text-white rounded-pill px-1';
            $cnt = 'Active';

        }else{
            $class= 'bg-danger text-white rounded-pill px-1';
            $cnt = 'Block';
        }
        
     
        
        
        
        ?>
    <span class="<?=$class;?>"><?=$cnt;?></span>
        
        
        </td>
        <td>
              <a class="btn bg-info btn-sm text-white py-1" role="button"  href="<?php echo base_url()?>index.php/Ip_Allwed/ip_status/<?php echo $r->id . '/' . $r->status ;?>">Remove </a></td>
                        
                    </tr>
                    <?php $i++ ; } ?>
                    
                </tbody>
                
                
                
                
            </table>
        </div>
        <div class="col-md-3  border py-4 bg-light">
            <h4 class="text-center py-2 fw-bode">Add IP Address</h4>
            <form action="<?=base_url()?>index.php/Ip_Allwed/add_IP" method="POST">
                   <div class="col-md-8 mx-auto">
            <label class="form-label ">Enter User Name</label>
            <input type="text" class="form-control form-control-sm" name="name" placeholder="Enter User Name" required >
            </div>
                <div class="col-md-8 mx-auto mt-2">
            <label class="form-label ">Enter IP Address</label>
            <input type="text" class="form-control form-control-sm" name="ip_ad" placeholder="Enter IP Address" required >
            </div>
         <div class="text-center py-2"><button type="submit" class="btn btn-sm btn-primary">Submit</button></div>   
         </form>
        </div>
        
        </div>
        
        

</div>
    
    
    
    
    
    
    
    
    
</div>




<script>
       $('documemt').ready(function(){
           
           
           
           
           
           $('#example').DataTable();
       })
    
    
    
</script>



</body>
</html>