<!doctype html>
<html lang="en"  class="w-[640px]">
   <head>
      <?php echo view('user/layout/head');?>
   </head>
   <style>
      @import url("https://fonts.googleapis.com/css?family=Quicksand:400,500,700&subset=latin-ext");
      .wrapper {
      width: 100%;
      height: auto;
      min-height: 600px;
      padding-top: 100px;
      padding-right:281px;
      padding-left:50px;
      }
      @media screen and (max-width: 800px) {
      .wrapper {
      padding-right:223px;
      }
      }
      @media screen and (max-width: 500px) {
      .wrapper {
      height: auto;
      min-height: 100vh;
      padding-top: 100px;
      padding-right:191px;
      padding-left:2px;
      }
      }
      @media screen and (max-width: 400px) {
      .wrapper {
      height: auto;
      min-height: 100vh;
      padding-top: 100px;
      padding-right:154px;
      padding-left:6px;
      }
      }
      .profile-card {
      width: 195%;
      min-height: 460px;
      margin: auto;
      box-shadow: 0px 8px 60px -10px rgba(13, 28, 39, 0.6);
      /* background: #16164b; */
      border-radius: 12px;
      max-width: 700px;
      position: relative;
      border:1px solid #010651;
      background: rgba(255,255,255,0.2);
      padding: 14px 9px;
      border-top-right-radius: 20px;
      border: 2px solid rgba(255,255,255,0.5);
      border-bottom-left-radius: 20px;
      margin-left: 31px;
      margin-bottom: 10px;
      }
      .profile-card.active .profile-card__cnt {
      filter: blur(6px);
      }
      .profile-card__img {
      width: 120px;
      height: 120px;
      margin-left: auto;
      margin-right: auto;
      transform: translateY(-50%);
      border-radius: 50%;
      overflow: hidden;
      position: relative;
      z-index: 4;
      box-shadow: 0px 5px 50px 0px #0568b5, 0px 0px 0px 7px #0568b5;
      }
      @media screen and (max-width: 576px) {
      .profile-card__img {
      width: 120px;
      height: 120px;
      }
      }
      .profile-card__img img {
      display: block;
      width: 100%;
      height: 100%;
      object-fit: cover;
      border-radius: 50%;
      background:#ad831f;
      }
      .profile-card__cnt {
      margin-top: -35px;
      text-align: center;
      padding: 0 20px;
      padding-bottom: 20px;
      transition: all 0.3s;
      }
      .profile-card__name {
      font-weight: 700;
      font-size: 24px;
      color: #ffad00;
      margin-bottom: 15px;
      }
      @media screen and (max-width: 576px) {
      .trade-sec-one {
      width: 100%;
      }
      }
      .trade-sec-one1
      {
      width:100%;
      }
      .test
      {
      overflow:hidden;
      overflow-x:scroll;
      scrollbar-width:thin;
      }
      .round
      {
      border-radius:20px;
      }
      .prof_image{
      width:55px;
      height:60px;
      border-radius:50px;
      position:relative;
      margin-right:10px;
      }
      .btn1
      {
      border-top-right-radius: 0px !important;
      border-bottom-right-radius: 0px !important;
      padding:6px 10px!important;
      }
      .btn2
      {
      padding:6px 12px!important;
      }
      .progress {
      height: 6px;
      width: 90%;
      background-color: lightgray;
      border-radius: 20px;
      margin:4px 25px;
      }
      .progress-done {
      height: 100%;
      width: 0;
      opacity: 0;
      background: #ffad00;
      color: #fff;
      border-radius: 20px;
      display: flex;
      justify-content: center;
      align-items: center;
      box-shadow: 0 3px 3px -5px #f2709c, 0 2px 5px #f2709c;
      transition: 1s ease;
      }
      .accordion-display-content
      {
      margin-left:0px !important;
      }
      .record-sub-heading
      {
      border-radius:5px !important;
      }
      .coin-wrap
      {
      height: 78vh !important;
      }
   </style>
   <body class="section-overflow">
      <!--banner start -->
      <section class="banner-bg overall-bg ">
         <div class="container">
            <?php echo view('user/layout/header');?>
         </div>
         <section class="dash-wrap coin-wrap">
            <div class="container">
            <div class="row">
               <div class="col-12">
                  <?php 
                     use App\Libraries\MyEncrypt;
                     use App\Helpers\site_helper;
                     use App\Helpers\form_helper;
                     $this->db = db_connect();
                     $this->session = session();
                     $this->common_model = model('CommonModel');
                     helper('form_helper');
                     
                     
                     $user=$this->session->get('uusersid');
                     
                     
                     $con = "uusersid = '".$user."'";
                     
                     $user_details = $this->common_model->GetRow('uusers',$con);
                     
                     $condition = array (
                        'uusersid' => $user,
                        'type' => 'activation',
                        'status' => '1',
                        );
                     
                     
                     
                     $result = $this->db->table('history')->where($condition)->get()->getRow();
                     //$result = 1;
                     
                     if($result)
                     {
                     
                     if($user_details->rankid != 0)
                     {
                        $cond = "id = '".$user_details->rankid."'";
                        $rank_details = $this->common_model->GetRow('rewardsettings',$cond);
                     
                     $rid = $user_details->rankid;
                        
                        $rank = $rank_details->rank_name;
                     
                     
                        $nextRecord = $this->db->table('rewardsettings')->where('id >',  $user_details->rankid)->orderBy('id', 'ASC')->limit(1)->get()->getRow();
                     
                        $rank_id = $nextRecord->id;
                        $name = 'Activate bot to the next rank '.$nextRecord->rank_name;
                        $image = $nextRecord->image;
                     
                     
                     }
                     else
                     {
                        $rank = '--';
                        $rid = '';
                        $cond = "id = 2";
                        $rank_details = $this->common_model->GetRow('rewardsettings',$cond);
                        $rank_id = $rank_details ->id;
                        $name = 'Activate bot to the rank '.$rank_details ->rank_name;
                        $image = 'r2.png';
                     }
                     
                     
                     $current = 'current';
                     }
                     else
                     {
                     $rank = '--';
                     $current = '';
                     $image = 'r2.png';
                     $rid= '';
                     $cond = "id = 2";
                     $rank_details = $this->common_model->GetRow('rewardsettings',$cond);
                     $rank_id = $rank_details->id;
                     $name = 'Activate bot to the rank '.$rank_details ->rank_name;
                     }
                     
                     
                     
                     
                     
                     
                     ?>
                  <div class="col-lg-10 offset-lg-1">
                     <?php 
                        $session = \Config\Services::session();
                        if($session->getFlashData('success_message')) 
                        {
                        ?>
                     <div class="success-msg input-msg">
                        <img src="<?php echo base_url();?>/assets/images/success.png">
                        <p class="text-white fw-medium ms-2 mb-0"><?php echo $session->getFlashData('success_message');?></p>
                     </div>
                     <?php 
                        } 
                        else if($session->getFlashData('error_message')) 
                        { 
                        ?>
                     <div class="error-msg input-msg">
                        <img src="<?php echo base_url();?>/assets/images/error.png">
                        <p class="text-white fw-medium ms-2 mb-0"><?php echo $session->getFlashData('error_message');?></p>
                     </div>
                     <?php 
                        } 
                        ?>
                     <div class="trade-sec-one trade-sec-one1 record-sub-heading">
                        <!-- <h2 style="color:#000"><strong>User</strong></h2> -->
                        <ul class=" list-unstyled mb-0 mt-4">
                           <li class=" main-profile d-flex align-items-center" style="justify-content:center !important;margin-bottom:10px">
                              <a href="javascript:void(0);" class="menu-list d-flex align-items-center text-decoration-none" >
                                 <div class="earning d-flex align-items-center text-white">
                                    <div class="earn-icon">
                                       <img src="<?php echo base_url();?>/assets/images/rank/<?php echo $image;?>" class="prof_image">
                                    </div>
                                    <div class="earn-content  ms-2">
                                       <h5 class="text-white mb-0"><?php echo $user_details->username;?></h5>
                                       <p class="text-primary d-flex align-items-center justify-content-around"> Rank name : <?php echo $rank;?>
                                       </p>
                                    </div>
                                 </div>
                              </a>
                           </li>
                        </ul>
                        <?php if($current != '')
                           { ?>
                        <div class="earn-content  ms-2">
                           <button class="btn btn1 btn-secondary" style="margin-top:-81px;float:right;">current</button>
                        </div>
                        <?php } ?>
                        <div class="trade-sec-content">
                           <h3 class="text-white text-center"> Next rank Requirements</h3>
                           <div class="row">
                              <div class="col-lg-12 menu-list d-flex align-items-center justify-content-between text-decoration-none" style="margin-bottom:10px !important">
                                 <div class="menu-content text-start">
                                    <i class="fa fa-sun text-primary ms-2"> </i><span class="ms-2 text-white">Activate Bot</span>
                                 </div>
                                 <div class="menu-list-arrow" >
                                    <a href="<?php echo base_url();?>/activate/rank/<?php echo $rank_id;?>"><button class="btn btn2 btn-primary" style="margin:8px;">Activate now</button></a>
                                 </div>
                              </div>
                              <div class="col-lg-12 menu-list d-flex align-items-center justify-content-between text-decoration-none">
                                 <div class="menu-content text-start">
                                    <span class="ms-5 text-white"><?php echo $user_details->username;?></span>
                                 </div>
                                 <div class="menu-list-arrow" >
                                    <span class="text-white" style="padding-right:20px"><?php echo $name;?></span>
                                 </div>
                              </div>
                              <?php 
                                 $progress_value = progress_bar($rank_id,$user);
                                 
                                 ?>
                              <div class="col-lg-12">
                                 <div class="progress">
                                    <div class="progress-done" data-done="<?php echo $progress_value;?>"></div>
                                 </div>
                              </div>
                              <div class="col-lg-12 menu-list d-flex align-items-center justify-content-between text-decoration-none">
                                 <div class="menu-content text-start">
                                    <span class="ms-5 text-white"><?php if($progress_value == 100){echo 'Completed';}else{ echo 'Progress';};?></span>
                                 </div>
                                 <div class="menu-list-arrow" >
                                    <span class="text-white" style="padding-right:20px"><?php echo round($progress_value);?>%</span>
                                 </div>
                              </div>
                           </div>
                        </div>
                     </div>
                  </div>
                  <div class="act_sec mt-5">
                     <div class="col-lg-8 offset-lg-2">
                        <div id="pills-tab" class="text-center">
                           <h3 class="text-white">
                           Upgrade to the next rank</h5>
                           <a href="<?php echo base_url();?>/activate/rank/<?php echo $rank_id;?>"><button class="btn btn-primary mt-3 ">Activate bot</button></a>
                        </div>
                     </div>
                  </div>
                  <div class="text-center text-white-50 mt-4">
                     <h5> Swipe to see the requirement of each tier. </h5>
                  </div>
                  <div class="test d-flex align-items-center justify-content-between ">
                     <div class="test1"></div>
                     <?php
                        foreach($rank_data as $row)
                        {
                        
                           if($row->id == $rid)
                           {
                              
                              $color = "#16164b";
                              $label = 'current';
                              $lclr = '#fff';
                           }
                           else
                           {
                            
                              $color = "";
                              $label = '--';
                              $lclr = '#fff';
                           }
                        ?>
                     <div class="wrapper "  >
                        <div class="profile-card accordion-display-content js-profile-card" style="background:<?php echo $color;?>">
                           <div class="profile-card__img">
                              <img src="<?php echo base_url();?>/assets/images/rank/<?php echo $row->image;?>" alt="profile card">
                           </div>
                           <div class="profile-card__cnt js-profile-cnt ">
                              <div class="profile-card__name" style="color:<?php echo $lclr;?>"><?php echo $row->rank_name;?></div>
                              <div class="row ">
                                 <div class="col-lg-10 offset-lg-1">
                                    <div class="trade-sec-one " >
                                       <div class="trade-sec-content">
                                          <h3 class="text-white">Requirements</h3>
                                          <div class="row record-sub-heading">
                                             <div class="col-lg-12 menu-list d-flex align-items-center justify-content-between text-decoration-none">
                                                <div class="menu-content text-start">
                                                   <i class="fa fa-network-wired text-primary ms-2"> </i><span class="ms-2 text-white">Direct Sponsor</span>
                                                </div>
                                                <div class="menu-list-arrow" >
                                                   <button class="btn btn2 btn-primary" style="margin:16px;"><?php echo $row->direct_spon_count;?></button>
                                                </div>
                                             </div>
                                             <div class="col-lg-12 menu-list d-flex align-items-center justify-content-between text-decoration-none">
                                                <div class="menu-content text-start">
                                                   <i class="fa fa-medal text-primary ms-2"> </i><span class="ms-2 text-white">Rank Requirement</span>
                                                </div>
                                                <div class="menu-list-arrow" >
                                                   <button class="btn btn2 btn-primary" style="margin:16px;"><?php echo $row->sponsor_elg_count;?></button>
                                                </div>
                                             </div>
                                             <div class="col-lg-12 menu-list d-flex align-items-center justify-content-between text-decoration-none">
                                                <div class="menu-content text-start">
                                                   <i class="fa fa-users text-primary ms-2"> </i><span class="ms-2 text-white">Group sales</span>
                                                </div>
                                                <div class="menu-list-arrow" >
                                                   <button class="btn btn2 btn-primary" style="margin:16px;"><?php echo $row->group_sales;?>&nbsp;USDT</button>
                                                </div>
                                             </div>
                                          </div>
                                       </div>
                                    </div>
                                 </div>
                              </div>
                              <div class="text-center text-white mt-3 col-lg-4 offset-lg-4">
                                 <button class="btn btn-primary round"><?php echo $label;?></button>
                              </div>
                           </div>
                        </div>
                     </div>
                     <?php } ?>
                  </div>
               </div>
            </div>
         </section>
         <!--footer start -->
         <?php echo view('user/layout/footer');?>
         <!--footer end -->
      </section>
      <?php echo view('user/layout/footer-script');?>
      <script>
         AOS.init({
         });
      </script>
      <script>

      const progress = document.querySelector('.progress-done');

      setTimeout(() => {
      progress.style.opacity = 1;
      progress.style.width = progress.getAttribute('data-done') + '%';
      }, 500)

</script>
   </body>
</html>
