<!doctype html>
<html lang="en" translate="no" class="w-[640px] mx-auto md:w-full">
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>My team</title>
      <?php echo view('user/layout/head');?>
      <link href="https://cdn.datatables.net/2.0.8/css/dataTables.dataTables.css">
   </head>
   <style>
  .head {
    background: linear-gradient(180deg, rgba(179,137,34,1) 0%, rgba(140,98,10,1) 50%, rgba(179,137,34,1) 100%, rgba(14,72,62,1) 100%);
    color: #fff;
    border: 1px;
}

   </style>
   <body class="reg-overflow">
      <section class="dash-banner-bg banner-bg">
         <div class="container">
         <!---header start---->
         <?php echo view('user/layout/header');?>
         <!---header end---->
         <!---banner start---->
         <div class="row">
          <?php
              
              
              use App\Libraries\MyEncrypt;
              $this->db = db_connect();
              $this->session = session();
              $this->common_model = model('CommonModel');


              $id = 'NyYmemh5aXA=';
                        
              $myencrypt = new MyEncrypt;
              $coinid = $myencrypt->decode($id);
              $user=$this->session->get('uusersid');
             

              $con = "uusersid = '".$user."'";

              $user_details = $this->common_model->GetRow('uusers',$con);

         


             ?>
         <div class="col-lg-12">
            <div class="dash-wrap">
               <div class="title text-center py-1">
                  <h2 class="text-primary ">Quantitative Investment</h2>
               </div>
               <div class="team-tab">
                  <ul class="nav nav-pills d-flex justify-content-center ps-0" id="pills-tab" role="tablist">
                     <li class="nav-item" role="presentation">
                        <button class="nav-link active" id="pills-dep1-tab " data-bs-toggle="pill" data-bs-target="#pills-dep1"
                           type="button" role="tab" aria-controls="pills-dep1" aria-selected="true">
                           <div class="make-list">
                              <div class="process">
                                 <span>Summary</span>
                              </div>
                           </div>
                        </button>
                     </li>
                     <li class="nav-item" role="presentation">
                        <button class="nav-link" id="pills-dep2-tab " data-bs-toggle="pill" data-bs-target="#pills-dep2"
                           type="button" role="tab" aria-controls="pills-dep2" aria-selected="true">
                           <div class="make-list">
                              <div class="process">
                                 <span>Team</span>
                              </div>
                           </div>
                        </button>
                     </li>
                  </ul>
                  <div class="tab-content" id="pills-tabContent">
                     <div class="tab-pane fade show active" id="pills-dep1" role="tabpanel" aria-labelledby="pills-dep1-tab">
                        <div class="main-profile">
                           <div class="team-profile d-flex align-items-center my-3 justify-content-center">
                              <div class="profile-img mx-2">
                                 <iconify-icon icon="pajamas:profile"></iconify-icon>
                              </div>
                              <div class="profile-content">
                                 <h3 class=" text-white"><?php echo $user_details->username ;?></h3>
                                 <span class="text-white-50">Total Income <b class="text-white" id="balanceVal">0.000</b></span>
                              </div>
                           </div>
                        </div>
                        <div class="team-profit-content">
                           <div class="row">
                              <div class="col-lg-12">
                                 <h5 class="text-primary py-2 fs-4 text-center">Activate Profit</h5>
                              </div>
                              <div class="col-lg-5 offset-lg-1 col-sm-6">
                                 <div class="team-list">
                                    <p class="fw-light text-white-50 mb-0">Activate Profit Today</p>
                                    <h4 class="fw-bold text-white"><?php echo $today_profit;?></h4>
                                 </div>
                              </div>
                              <div class="col-lg-5  col-sm-6"  >
                                 <div class="team-list">
                                    <p class="fw-light text-white-50 mb-0">Activate Total profit</p>
                                    <h4 class="fw-bold text-white"><?php echo $total_profit;?></h4>
                                 </div>
                              </div>
                           </div>
                        </div>
                        <div class="team-profit-content">
                           <div class="row">
                              <div class="col-lg-12">
                                 <h5 class="text-primary py-2 fs-4 text-center">Direct Quantification</h5>
                              </div>
                              <div class="col-lg-5 offset-lg-1 col-sm-6">
                                 <div class="team-list">
                                    <p class="fw-light text-white-50 mb-0">Not Activated Yet</p>
                                    <h4 class="fw-bold text-white"><?php echo $inactive_direct;?></h4>
                                 </div>
                              </div>
                              <div class="col-lg-5 col-sm-6"  >
                                 <div class="team-list">
                                    <p class="fw-light text-white-50 mb-0">Activated</p>
                                    <h4 class="fw-bold text-white"><?php echo $active_direct;?></h4>
                                 </div>
                              </div>
                           </div>
                        </div>
                        <div class="team-profit-content">
                           <div class="row">
                              <div class="col-lg-12">
                                 <h5 class="text-primary py-2 fs-4 text-center">Team Quantification</h5>
                              </div>
                              <div class="col-lg-5 offset-lg-1 col-sm-6">
                                 <div class="team-list">
                                    <p class="fw-light text-white-50 mb-0">Not Activated Yet</p>
                                    <h4 class="fw-bold text-white"><?php echo $inactive_indirect;?></h4>
                                 </div>
                              </div>
                              <div class="col-lg-5 col-sm-6"  >
                                 <div class="team-list">
                                    <p class="fw-light text-white-50 mb-0">Activated</p>
                                    <h4 class="fw-bold text-white"><?php echo $active_indirect;?></h4>
                                 </div>
                              </div>
                           </div>
                        </div>
                     </div>
                     <div class="tab-pane fade " id="pills-dep2" role="tabpanel" aria-labelledby="pills-dep2-tab">
                        <div class="search-bar my-2">
                           <form class="form-inline my-2 my-lg-0">
                              <input class="form-control mr-sm-2" id="myInput" type="search" placeholder="Search username...." aria-label="Search">
                           </form>
                        </div>
                        <!-- <div class="faq_accordian mb-3">
                           <div class="accordion">
                              <div class="row">
                                 <div class="col-md-12">
                                    <div class="team-right accordion-toggle u">
                                       <div class="main-right-content">
                                          <h5 class="text-white mb-0 ">SupRev10 (you)</h5>
                                          <small class="text-white">revbot validity :-</small>
                                          <h6 class="text-white-50">Total Income 0.0000</h6>
                                       </div>
                                       <ul class="mb-0 asset-user-static list-unstyled">
                                          <li>
                                             <p class="text-white-50 mb-0">Total Profit:</p>
                                             <b class="text-white">0.0000</b>
                                          </li>
                                          <li>
                                             <p class="text-white-50 mb-0">Total Profit:</p>
                                             <b class="text-white">0.0000</b>
                                          </li>
                                          <li>
                                             <p class="text-white-50 mb-0">USDT balance :</p>
                                             <b class="text-white">200.0000</b>
                                          </li>
                                       </ul>
                                    </div>
                                    <div class="team-right accordion-content">
                                       <div class="display-content-one">
                                          <div class="main-right-content">
                                             <h5 class="text-white mb-0 ">SupRev001 </h5>
                                             <small class="text-white">revbot validity :- <span class="fw-bold">15-05-2024</span></small>
                                             <h6 class="text-white-50">Total Income 0.0000</h6>
                                          </div>
                                          <ul class="mb-0 asset-user-static list-unstyled">
                                             <li>
                                                <p class="text-white-50 mb-0">Total Profit:</p>
                                                <b class="text-white">0.0000</b>
                                             </li>
                                             <li>
                                                <p class="text-white-50 mb-0">Total Profit:</p>
                                                <b class="text-white">0.0000</b>
                                             </li>
                                             <li>
                                                <p class="text-white-50 mb-0">USDT balance :</p>
                                                <b class="text-white">200.0000</b>
                                             </li>
                                          </ul>
                                       </div>
                                       <div class="display-content-two">
                                          <div class="main-right-content">
                                             <h5 class="text-white mb-0 ">SupRev002 </h5>
                                             <small class="text-white">revbot validity :- </small>
                                             <h6 class="text-white-50">Total Income 0.0000</h6>
                                          </div>
                                          <ul class="mb-0 asset-user-static list-unstyled">
                                             <li>
                                                <p class="text-white-50 mb-0">Total Profit:</p>
                                                <b class="text-white">0.0000</b>
                                             </li>
                                             <li>
                                                <p class="text-white-50 mb-0">Total Profit:</p>
                                                <b class="text-white">0.0000</b>
                                             </li>
                                             <li>
                                                <p class="text-white-50 mb-0">USDT balance :</p>
                                                <b class="text-white">200.0000</b>
                                             </li>
                                          </ul>
                                       </div>
                                    </div>
                                 </div>
                              </div>
                           </div>
                        </div> -->
                        <div id="pills-tab" class="mt-5 ">
                        <table class="" id="example1" style="width:100%" >
                       
                          
                          <thead class="head">
                          <tr>
                          <th class="text-center">Username</th>
                          <th class="text-center">Invitation Code</th>
                          <th class="text-center">Income</th>
                      
                         
                        </tr>
                          </thead>
                          <tbody id="myTable" class="text-white">
                          <?php
                        if($direct_referrals) {
                          foreach ($direct_referrals as $key => $sponser) 
                          {
                            
                            $con = "uusersid = '".$sponser->uusersid."'";

                            $userid = $sponser->uusersid;

                            $udetails = $this->common_model->GetRow('uusers',$con);


                            if($udetails->username == '')
                            {
                              $name = "---";
                            }
                            else
                            {
                              $name = $udetails->username;
                            }

                       
                            switch ($sponser->activation_status) {
                              case '1':
                                $status = 'Active';
                                break;
                              case '0':
                                $status = 'Inactive';
                                break;
                            }
                            // $rank_name = $this->db->query('select * from rewardsettings where id = "'.$sponser->rank.'"')->getRow()->rank_name;
                      ?>
                          
                   
                          <tr>
                          <td class="text-center"><?php echo ucfirst($name);?></td>
                            <td class="text-center"><?php echo ucfirst($sponser->invitation_code);?></td>
                            <td class="text-center" id="balanceVal<?php echo $key;?>">0.00</td>
                          
                          </tr>

                         
                          <?php }
                        } else { ?>
                          <tr>
                            <td colspan="5" style="text-align: center;"><?php echo 'No Records';?></td>
                          </tr>
                      <?php } ?>
                        
                      

                          </tbody>
                        </table>
                      </div>
                     </div>
                     <!---banner end---->
                  </div>
               </div>
            </div>
            <?php echo view('user/layout/footer');?>
         </div>
      </section>
      <?php echo view('user/layout/footer-script');?>

     
    
      <!-- <script type="text/javascript" src="http://192.168.2.128/Jeyasri/projects/ARM008/source/styles/js/datatables.min.js"></script> -->


<script>

$(document).ready(function(){
  $("#myInput").on("keyup", function() {
    var value = $(this).val().toLowerCase();
    $("#myTable tr").filter(function() {
      $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
    });
  });


  $.ajax({
           type: 'post',
           url : '<?php echo base_url();?>/checkbalance/<?php echo $coinid?>',
           success : function(msg)
           {
         
             if(msg) {
               $('#balanceVal').html(msg);
         
            }
           }
         });

  <?php      
   foreach ($direct_referrals as $key=>$sponser) 
                          {
                            
                     

                            $userid = $sponser->uusersid;

                             ?>
         $.ajax({
           type: 'post',
           url : '<?php echo base_url();?>/checkuserbalance/<?php echo $coinid?>',
           data : {'id': <?php echo $userid;?>},
           success : function(msg)
           {
             alert(msg);
             if(msg) {
               $('#balanceVal'+'<?php echo $key;?>').html(msg);
         
            }
           }
         });

         <?php } ?>


});






</script>

   </body>
</html>