<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
 <?php
            $this->load->view('user/common_style');
 ?>
<link rel="stylesheet" href="<?php echo base_url();?>styles/fonts/Socialico/stylesheet.css">
<link rel="stylesheet" href="<?php echo base_url();?>styles/css/set1.css">
<link href="<?php echo base_url();?>/assets/boots/css/bootstrap-switch.css" rel="stylesheet" type="text/css">
<script src="<?php echo base_url();?>styles/js/modernizr.js"></script>
<style>
  .contact_one .contact_left_content form input[type="text"]{border:0px;}
  .prfledit label, .prfledit label {
  padding-top: 10px;
}
.profilesub ul li label{
  display: inline;
  /*color: #eb5055;*/
}
.help-block {
    color: #eb5055;
    margin: 0em 0em 0em !important;
}
p.frgtpwd {

text-transform: none;
  }

.control-error > p {
  color: rgb(255, 0, 0) !important;
}
</style>
        
</head>
<body>
    <?php
      $this->load->view('user/header');
      $this->load->view('user/login_header');
    ?>
    <?php 
      $us_data = userMinPass();
    ?> 
    <div class="col-lg-9 col-md-9 col-sm-12 col-xs-12">
      <div class="table-list clearfix">
              <h4 class="other-title theme-color"><?php echo $this->lang->line('api_list'); ?></h4>
                <?php if($this->session->flashdata('success_message')) {?>
                     <div class="row"><div class="col-lg-12 "><p class="frgtpwd frgtpwd1"><i class="fa fa-thumbs-up"></i><?php echo $this->session->flashdata('success_message');?></p></div></div>
                      <?php } elseif ($this->session->flashdata('error_message')) { ?>
                        <div class="row"><div class="col-lg-12">  <p class="frgtpwd frgtpwd1 frgtpwdred"><i class="fa fa-thumbs-down"></i><?php echo $this->session->flashdata('error_message');?></p></div></div>
                      <?php } else { }?>
      </div>


                  <a href="<?php echo base_url();?>apinew"><input type="submit" value="<?php echo $this->lang->line('new_api');?>" class="btn_chat" style="float:right;"></a>
                  <div class="table-responsive  main-table">
                    <table>
                      <thead>
                        <tr>
                          <th><?php echo $this->lang->line('lbl_date');?></th>
                          <th><?php echo $this->lang->line('api_key');?></th>
                          <th><?php echo $this->lang->line('lbl_status');?></th>
                          <th><?php echo $this->lang->line('lbl_action');?></th>
                        </tr>
                      </thead>
                      <tbody>
                      <?php 
                        $find_keys=$this->db->query("select * from api_det where userid='".$this->session->userdata('uusersid')."'")->result();
                        if($find_keys)
                        {
                          foreach($find_keys as $rows)
                          {
                              if($rows->status=='1')
                                $status="Active";
                              else
                                $status="In Active";

                              $myencrypt = new MyEncrypt;
                              $id = $myencrypt->encode($rows->id);
                            ?>
                              <tr>
                                <td><?php echo $rows->date;?></td>
                                <td><?php echo $rows->api_key;?></td>
                                <td><?php echo $status;?></td>
                                <td>
                                  <a href="<?php echo base_url()?>editapi/<?php echo $id;?>"><i class="fa fa-edit" title="Edit Permissions"></i></a>|
                                  <a href="<?php echo base_url()?>deleteapi/<?php echo $id;?>"><i class="fa fa-trash" title="Delete Key"></i></a>

                                </td>
                              </tr>

                            <?php

                          }

                        }

                      ?>
                      </tbody>
                      </table>
                </div>
            
            
      </div>
    </div>
       
   </div>
  </div>

  <?php
    $this->load->view('user/footer');
?>
</section>
<script src="<?php echo base_url();?>styles/js/jquery-1.12.2.min.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>assets/js/formValidation.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>assets/js/bootstrap.js"></script>
<script src="<?php echo base_url();?>/assets/boots/js/select_min.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>/assets/boots/css/select2.css">
<script>
      (function() {

         $('.change_trpwd').formValidation({
                    framework: 'bootstrap',
                    excluded: [':disabled'],
                    
                    fields: {
                        
                          currentpin: {
                            validators: {
                                notEmpty: {
                                    message: '<?php echo $this->lang->line("trans_empty_err");?>'
                                },
                                digits: {
                                    message: '<?php echo $this->lang->line("registration_trans_digit_err");?>'
                                },
                                remote: {
                                    url: function(validator, $field, value) {
                                        
                                        return '<?php echo base_url();?>user/profile/validtranspassword';
                                    },
                                    type: 'POST',
                                    delay: 1000,
                                    message: '<?php echo $this->lang->line("trans_pin_error"); ?>'
                                }

                            }
                        }
                       
                }
                })
               
        // trim polyfill : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim
        if (!String.prototype.trim) {
          (function() {
            // Make sure we trim BOM and NBSP
            var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
            String.prototype.trim = function() {
              return this.replace(rtrim, '');
            };
          })();
        }

        [].slice.call( document.querySelectorAll( 'input.input__field' ) ).forEach( function( inputEl ) {
          // in case the input is already filled..
          if( inputEl.value.trim() !== '' ) {
            classie.add( inputEl.parentNode, 'input--filled' );
          }

          // events:
          inputEl.addEventListener( 'focus', onInputFocus );
          inputEl.addEventListener( 'blur', onInputBlur );
        } );

        function onInputFocus( ev ) {
          classie.add( ev.target.parentNode, 'input--filled' );
        }

        function onInputBlur( ev ) {
          if( ev.target.value.trim() === '' ) {
            classie.remove( ev.target.parentNode, 'input--filled' );
          }
        }
      })();
    </script>
    </script>
<script src="<?php echo base_url();?>styles/js/main.js"></script>
<script src="<?php echo base_url();?>assets/boots/js/bootstrap-switch.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>assets/js/plugins/notifications/jgrowl.min.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>styles/js/owl.carousel.min.js"></script>
 <script src="<?php echo base_url();?>styles/js/classie.js"></script>
<script type="text/javascript">
$(document).ready(function($) {
$(".switch").bootstrapSwitch();
});

function enable(str)
{
  var cek= document.getElementById('switch1').checked;
  if(cek===true)
  {
      $("#enable_dat").css('display','block');
          $.ajax({
                    'method': 'POST',
                    'url': '<?php echo base_url();?>user/profile/create/',
                    dataType: 'json',
                    success:function(resp)
                    {
                       if(resp['exist']=='exist')
                       {

                       }
                       else
                       {
                        $('#enable_dat').html(resp['success']);
                       }
                        
                    }
                })


  }
  else
  {
   $("#enable_dat").css('display','none'); 
  }

}
  
   
</script>
<?php
$this->load->view('user/common_script');    
?>


</body>
</html>
