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

        use App\Libraries\MyEncrypt;
        use App\Helpers\site_helper;
        $this->db = db_connect();
        $session = session();
        $this->common_model = model('CommonModel');

       echo view('user/common_style1');
       echo view('user/common_header');
    ?> 
 

<link rel="stylesheet" href="<?php echo base_url('styles/css/table.css');?>">


    <style type="text/css">
.table-responsive {
    overflow-x: visible !important;
}
table tr th {
    background: #203c9d none repeat scroll 0 0;
    color: #fff;
    font-size: 13px;
    font-weight: 300;
    padding: 16px 20px;
    text-align: left;
    text-transform: capitalize;
    white-space: nowrap;
}
 @media only screen and (max-width:768px){
#DataTables_Table_0_wrapper{
  overflow: auto !important;
  overflow-y: hidden !important;
}
}
input[type="text"], input[type="email"], input[type="password"], input[type="search"] {
    background-color: #fff;
    border: 1px solid #e1e1e1;
    color: #000;
    font-size: 14px;
    height: 42px;
    margin: 5px 0;
    padding: 10px 7px 10px 10px;
    width: 100%;
}
    </style>


</head>
<body class="admin-inner">

<section class="white pt-10 pb-10">
<div class="container">
<div class="row  trading_pairbg bg-white inner-box mt-3 px-3 py-4">

<div class="col-lg-12">
<div class="right-block">
<div class="inner-title pb-3">
            <h6 class="color-2"><i class="fab fa-bitcoin"></i> MY Referrals</h6>
          </div>

                <div class="row">
                    <center>
                   <div class="col-lg-4">
                    <label class="sub_span">Here is Your Referral Link : </label>
                  </div>
                    <div class="col-lg-6 mt-2">
                            <span type="text" name="Address" id="link01" class=""> <?php echo $referral_url;?>
                           </span>
                    </span>
                   </div>
                   <br/>
                       <div class="col-lg-4">
                          <button class="btn btn-primary" onclick="javascript:copyToClipboard('#link01')">Copy Recommended URL</button>
                        </div>
                    </center> 
                    </div>


              <div style="clear:both;height:50px;"></div>
               <div align="center">
                      <p>Scan QR CODE</p>
                  <img src="https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=<?php echo $referral_url;?>">
               </div>
        <br/>
            <div class="row">
              <center>
              <div class="col-lg-4 mt-2">
              <p >Invitation Code : <span id="link02"><?php echo $invitation_code;?></span> &nbsp; &nbsp;<i onclick="javascript:copyToClipboard('#link02')" class="fa fa-copy"></i></p>

              </div>
             
              </center>
            </div>
               <div style="clear:both;height:50px;"></div>
              <div class="table-responsive  main-table mont">
         <div class="trading-table">
        <div class="table-responsive">
          <table class="table-striped">
                      <thead>
                        <tr>
                          <th>Referral</th>
                          <th>Name</th>
                          <th>Email</th>
                          <th>Joined</th>
                          <th>Status</th>
                          <th style="display: none;"></th>
                           <th style="display: none;"></th>
                        </tr>
                      </thead>
                      <tbody>
                      <?php
                        if($ref_name) {
                          foreach ($ref_name as $sponser) 
                          {
                            switch ($sponser->status) {
                              case '1':
                                $status = 'Active';
                                break;
                              case '2':
                                $status = 'Inactive';
                                break;
                              case '3':
                                $status = 'Deleted';
                                break;
                              default:
                                $status = 'New';
                                break;
                            }
                      ?>
                          <tr>
                            <td><?php echo ucfirst($sponser->username);?></td>
                            <td><?php echo ucfirst($sponser->fullname);?></td>
                            <td><?php echo $sponser->email;?></td>
                            <td><?php echo date('Y-m-d H:i:s', strtotime($sponser->createdate));?></td>
                            <td><?php echo $status;?></td>
                              <td style="display: none;"></td>
                              <td style="display: none;"></td>
                          </tr>
                      <?php }
                        } else { ?>
                          <tr>
                            <td colspan="5" style="text-align: center;"><?php echo 'No Records';?></td>
                          </tr>
                      <?php } ?>
                        
                      </tbody>
                    </table>
      </div> 
    </div>
    </div>
    </div>
    </div>
    </div>
    </div>
  </div>
</div>
</section>

<br>
<br>

<?php
 echo view('user/footer1');
  echo view('user/common_script');
?>
  </body>
</html>


<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo base_url('/styles/js/datatables.min.js');?>"></script>

<script type="text/javascript">

  
   function copyToClipboard(element) {
  var $temp = $("<input>");
  $("body").append($temp);
  $temp.val($(element).html()).select(); //Note the use of html() rather than text()
  document.execCommand("copy");
  $temp.remove();
}

  
    $(document).ready(function(){


      $('.main-table table').dataTable({
          "language": { search: "" },
          "Info": false
    });
    });

  
</script>

