<!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;
}

.other-title1
{color:black;
  font-size:13px;
}
</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('add_api'); ?></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 
          } 
          else if ($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 { }?>
      
           <a href="<?php echo base_url();?>apikeys"><input type="submit" value="<?php echo ucwords($this->lang->line('api_list'));?>" class="btn_chat" style="float:right;"></a>
           <?php 
           $id=$this->uri->segment(2);
           ?>
          <form class="steps-validation update-user" method="post" action="<?php echo base_url();?>editapi/<?php echo $id;?>">
          <div class="col-lg-12 mt-10">
              <label class="col-lg-12 other-title theme-color mt-15"><?php echo $this->lang->line('api_key'); ?>  </label>
                <div class="col-lg-12">
                  <input name="api_key" style="background:#ddd;" type="text" id="api_key" readonly value="<?php echo $api_det->api_key;?>"/>
                  <input type="button" id="mybut" name="mybut" value="Copy" class="btn_chat" style="background:red;" onclick="myFunction();">
                </div>
          </div>


          <div class="col-lg-12 mt-10">
              <label class="col-lg-12 other-title theme-color mt-15"><?php echo $this->lang->line('api_secret'); ?>  </label>
                <div class="col-lg-12">
                  <input name="api_secret" style="background:#ddd;" type="text" id="api_secret" readonly value="<?php echo $api_det->api_secret;?>"/>
                  <input type="button" id="mybut1" name="mybut1" value="Copy" class="btn_chat" style="background:red;" onclick="myFunction1();">
                </div>
           </div>


            <div class="col-lg-12 mt-10">
              <label class="col-lg-4 other-title theme-color mt-15"><?php echo $this->lang->line('lbl_status');?></label>
                <div class="col-lg-6">
                <select id="status" name="status">
                 <option value="1" <?php if($api_det->status=='1') echo "selected";?>>Active</option>
                 <option value="0" <?php if($api_det->status=='0') echo "selected";?>>InActive</option>
                 </select>
                </div>
           </div>

           <div class="col-lg-12 mt-10">
            <label class="col-lg-12 other-title theme-color mt-15"><?php echo $this->lang->line('api_permissions'); ?></label>
            <div class="col-lg-4">
            <label class="col-lg-12 other-title1 theme-color mt-15"><input type="checkbox" name="info" id="info" value="1" <?php if($api_det->info=='1') echo "checked";?>> <?php echo ucwords($this->lang->line('acc_bal'));?></label>
            </div>
            <div class="col-lg-4">
             <label class="col-lg-12 other-title1 theme-color mt-15"><input type="checkbox" name="open_order" id="open_order" value="1" <?php if($api_det->open_order=='1') echo "checked";?>> <?php echo ucwords($this->lang->line('open_ord'));?></label>
            </div>
            <div class="col-lg-4">
             <label class="col-lg-12 other-title1 theme-color mt-15"><input type="checkbox" name="cancel_order" id="cancel_ord" value="1" <?php if($api_det->cancel_order=='1') echo "checked";?>> <?php echo ucwords($this->lang->line('cancel_ord'));?></label>
            </div>
            </div>

            <div class="col-lg-12 mt-10">
            <div class="col-lg-4">
             <label class="col-lg-12 other-title1 theme-color mt-15"><input type="checkbox" name="buy_order" id="buy_order" value="1" <?php if($api_det->buy_order=='1') echo "checked";?>> <?php echo ucwords($this->lang->line('acc_buy'));?></label>
            </div>
            <div class="col-lg-4">
              <label class="col-lg-12 other-title1 theme-color mt-15"><input type="checkbox" name="sell_order" id="sell_order" value="1" <?php if($api_det->sell_order=='1') echo "checked";?>> <?php echo ucwords($this->lang->line('acc_sell'));?></label>
            </div>

             <div class="col-lg-4">
              <label class="col-lg-12 other-title1 theme-color mt-15"><input type="checkbox" name="info_trade" id="info_trade" value="1" <?php if($api_det->info_trade=='1') echo "checked";?>> <?php echo ucwords($this->lang->line('acc_tran'));?></label>
            </div>
           </div>


             <div class="col-lg-12 mt-10">
            <div class="col-lg-4">
             <label class="col-lg-12 other-title1 theme-color mt-15"><input type="checkbox" name="deposit" id="deposit" value="1" <?php if($api_det->deposit=='1') echo "checked";?>> <?php echo ucwords($this->lang->line('acc_dep'));?></label>
            </div>
            <div class="col-lg-4">
              <label class="col-lg-12 other-title1 theme-color mt-15"><input type="checkbox" name="withdraw" id="withdraw" value="1" <?php if($api_det->withdraw=='1') echo "checked";?>> <?php echo ucwords($this->lang->line('acc_with'));?></label>
            </div>

             <div class="col-lg-4">
              <label class="col-lg-12 other-title1 theme-color mt-15"><input type="checkbox" name="withdraw_req" id="withdraw_req" value="1" <?php if($api_det->with_req=='1') echo "checked";?>> <?php echo ucwords($this->lang->line('acc_withr'));?></label>
            </div>
           </div>
            <div class="clearfix" style="clear:both;"><br><br></div>
            <div class="cmmn col-lg-12"> 
              <div class="contact_page_btn text-center">
                  <button type="submit" class="yellow-btn" ><?php echo $this->lang->line('lbl_submit'); ?></button>
              </div>
            </div>
            </form>
        </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'); 
  }

}


function myFunction() {
  /* Get the text field */
  var copyText = document.getElementById("api_key");
  /* Select the text field */
  copyText.select();
  /* Copy the text inside the text field */
  document.execCommand("copy");
  document.getElementById('mybut').value='Copied';
  document.getElementById('mybut').style.background="green";
  document.getElementById('mybut1').style.background="red";
  document.getElementById('mybut1').value="Copy";
  /* Alert the copied text */
  //alert("Copied the text: " + copyText.value);
} 



function myFunction1() {
  /* Get the text field */
  var copyText = document.getElementById("api_secret");
 /* Select the text field */
  copyText.select();
  /* Copy the text inside the text field */
  document.execCommand("copy");
  document.getElementById('mybut1').value='Copied';
  document.getElementById('mybut1').style.background="green";
  document.getElementById('mybut').style.background="red";
  document.getElementById('mybut').value="Copy";

  /* Alert the copied text */
  //alert("Copied the text: " + copyText.value);
} 
  
   
</script>
<?php
$this->load->view('user/common_script');    
?>


</body>
</html>
