<!doctype html>
<html lang="en"  class="w-[640px]">
   <head>
      <?php echo view('user/layout/head');?>
   </head>
   <style>
      .help-block {
      color: #eb5055;
      margin: 0em 0em 0em !important;
      }
      #countdown{
      width: 337px;
      height: 120px;
      text-align: center;
      background: #222;
      background: linear-gradient(153deg, rgb(8, 73, 123) 0%, rgb(5, 104, 181) 48%) !important; 
      /* background-image:    -moz-linear-gradient(top, #222, #333, #333, #222);
      background-image:     -ms-linear-gradient(top, #222, #333, #333, #222);
      background-image:      -o-linear-gradient(top, #222, #333, #333, #222); */
      border: 1px solid #111;
      border-radius: 5px;
      box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.6);
      margin: auto;
      padding: 24px 0;
      position: relative;
      top: 0; bottom: 0; left: 0; right: 0;
      margin-top:10px;
      }
      #countdown:before{
      content:"";
      width: 8px;
      height: 65px;
      background: #444;
      background: linear-gradient(153deg, rgb(8, 73, 123) 0%, rgb(5, 104, 181) 48%) !important; ; 
      /* background-image:    -moz-linear-gradient(top, #555, #444, #444, #555);
      background-image:     -ms-linear-gradient(top, #555, #444, #444, #555);
      background-image:      -o-linear-gradient(top, #555, #444, #444, #555); */
      border: 1px solid #111;
      border-top-left-radius: 6px;
      border-bottom-left-radius: 6px;
      display: block;
      position: absolute;
      top: 48px; left: -10px;
      }
      #countdown:after{
      content:"";
      width: 8px;
      height: 65px;
      background: #444;
      background: linear-gradient(153deg, rgb(8, 73, 123) 0%, rgb(5, 104, 181) 48%) !important; ; 
      /* background-image:    -moz-linear-gradient(top, #555, #444, #444, #555);
      background-image:     -ms-linear-gradient(top, #555, #444, #444, #555);
      background-image:      -o-linear-gradient(top, #555, #444, #444, #555); */
      border: 1px solid #111;
      border-top-right-radius: 6px;
      border-bottom-right-radius: 6px;
      display: block;
      position: absolute;
      top: 48px; right: -10px;
      }
      /* #countdown #tiles{
      position: relative;
      z-index: 1;
      } */
      #countdown #tiles > span{
      width: 60px;
      max-width: 60px;
      font: bold 25px 'Droid Sans', Arial, sans-serif;
      text-align: center;
      color: #fff;
      background-color: #ddd;
      background: rgba(0,0,0,0.5); 
      /* background-image:    -moz-linear-gradient(top, #bbb, #eee);
      background-image:     -ms-linear-gradient(top, #bbb, #eee);
      background-image:      -o-linear-gradient(top, #bbb, #eee); */
      border-top: 1px solid #fff;
      border-radius: 3px;
      box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.7);
      margin: 0 7px;
      padding: 14px 0;
      display: inline-block;
      position: relative;
      }
      #countdown #tiles > span:before{
      content:"";
      width: 100%;
      height: 5px;
      background: #111;
      display: block;
      padding: 0 3px;
      position: absolute;
      top: 41%; left: -3px;
      z-index: -1;
      }
      #countdown #tiles > span:after{
      content:"";
      width: 100%;
      height: 1px;
      background: #eee;
      border-top: 1px solid #333;
      display: block;
      position: absolute;
      top: 48%; left: 0;
      }
      #countdown .labels{
      width: 100%;
      height: 20px;
      text-align: center;
      position: absolute;
      bottom: 8px;
      }
      #countdown .labels li{
      width: 70px;
      font: bold 15px 'Droid Sans', Arial, sans-serif;
      color: #000;
      text-shadow: 1px 1px 0px #000;
      text-align: center;
      text-transform: uppercase;
      display: inline-block;
      }
      .notify {
      position: fixed;
      top: 10px;
      left: 10px;
      -moz-box-sizing: border-box;
      box-sizing: border-box;
      width: 350px;
      font-size: 14px;
      text-align: center;
      }
      /* Positions
      ========================================================================== */
      .notify-top-right,
      .notify-bottom-right {
      left: auto;
      right: 10px;
      }
      .notify-top-center,
      .notify-bottom-center {
      left: 50%;
      margin-left: -175px;
      }
      .notify-bottom-left,
      .notify-bottom-right,
      .notify-bottom-center {
      top: auto;
      bottom: 10px;
      }
      .notify button {
      -webkit-appearance: none;
      padding: 0;
      cursor: pointer;
      background: 0 0;
      border: 0;
      display: none;
      }
      /* Responsiveness
      ========================================================================== */
      /* Phones portrait and smaller */
      @media (max-width: 479px) {
      /*
      * Fit in small screen
      */
      .notify {
      left: 10px;
      right: 10px;
      width: auto;
      margin: 0;
      }
      }
      /* Sub-object: `notify-message`
      ========================================================================== */
      .notify-message {
      position: relative;
      cursor: pointer;
      }
      .notify .alert-default {
      background: #fff;
      border: 1px solid #e5e5e5;
      }
      .pagination {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    }
    .pagination-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    margin: 0 5px;
    }
    .pagination-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    }
    #pageInfo {
    align-self: center;
    margin: 0 10px;
    }
   </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 team-wrap">
            <?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');
               
               
               $id = 'NyYmemh5aXA=';
                       
               $myencrypt = new MyEncrypt;
               $coinid = $myencrypt->decode($id);
               $user=$this->session->get('uusersid');
               $buy_bal=curbalance($this->session->get('uusersid'),$coinid);
               $bal=str_replace(",","", $buy_bal);
               
               $amt=$this->db->query("SELECT * FROM  adminsettings WHERE id=1 ")->getResult();
               $amnt=$amt[0];
               
               $condition = array (
               'uusersid' => $user,
               'type' => 'activation',
               'status' => '1',
               );
               $time = $this->db->table('history')->where($condition)->orderby('historyid','desc')->get()->getRow();
               
               if($time)
               {
                  $date = $time->expiry_date;
               }
               else
               {
                  $date = '';
               }
               
               // $condition = array (
               //    'uusersid' => $user,
               //    'type' => 'activation',
                
               //    );
               //    $result = $this->common_model->GetResults('history',$condition);

                  $result = $this->db->query("select * from `history` WHERE uusersid = '".$user."' AND type='activation' ORDER BY `historyid` DESC limit 10")->getResult();

                  $total_count = $this->db->query("select * from `history` WHERE uusersid = '".$user."' AND type='activation'  ORDER BY `historyid` DESC ")->getNumRows();
               
               
                  if($rank_id)
                  {
                      $activation = "Rank Activation";
                      $act_history = "Rank Activation History";
                  }
                  else
                  {
                     $activation = "Activation";
                     $act_history = "Activation History";
                  }
               
                 
               ?>
            <div class="container">
               <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><?php echo $activation;?></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><?php echo $act_history;?></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">
                        <?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 
                        } 
                        ?>
                        <?php
                           $this->db = db_connect();
                           $condition = array (
                                   'uusersid' => $user,
                                    'type' => 'activation'
                                 );
                           $get_status1 = $this->db->table('history')->where($condition)->orderby('historyid','desc')->get()->getResult();
                           
                           
                           if($get_status1)
                           { 
                              
                              $date2 = date('Y-m-d H:m:s');
                           
                           
                              foreach($get_status1 as $row)
                              {
                               
                                
                                 if(strtotime($date2) > strtotime($row->expiry_date))
                                 {
                                    $this->db->table('history')->where('uusersid',$user)->where('historyid',$row->historyid)->where('type','activation')->update(array('status' => '0'));
                                 }
                                 else
                                 {
                                     $this->db->table('history')->where('uusersid',$user)->where('historyid',$row->historyid)->where('type','activation')->update(array('status' => '1'));
                                 }
                           
                           
                           
                              }
                           }
                           
                           
                           
                           if($time)
                           {
                           $status=$time->status;
                           }
                           else
                           {
                             
                           $status='';
                           
                           }
                           
                           if($rank_id)
                           { 
                           
                              $con = "id = '".$rank_id."'";
                              
                              $rank_details = $this->common_model->GetRow('rewardsettings',$con);
                           
                              ?>

                        <div class="col-lg-10 offset-lg-1">
                           <form  class="steps-validation" method="post" id="bot_activate"  action="<?php echo base_url();?>/rank/activation"> 
                              <div class=" team-profit-content" >
                                 <div class="row">
                                    <div class="col-sm-12">
                                       <div class="title pt-2 text-center title-content">
                                          <h4 class="fw-bold text-primary  "> Active Rank Fee</h4>
                                       </div>
                                       <div class="col-lg-12 mt-5">
                                          <div class="form-block form-group mb-3">
                                             <div class="row text-white">
                                                <div class="col-lg-6 text-end" >
                                                   <h4>Rank name :</h4>
                                                </div>
                                                <div class="col-lg-5">
                                                   <strong><?php echo $rank_details->rank_name;?></strong> 
                                                </div>
                                             </div>
                                          </div>
                                       </div>
                                       <input type="hidden" name="rank_id" value="<?php echo $rank_id;?>">
                                       
                                       <div class="col-lg-12 mt-2">
                                          <div class="form-block  form-group mb-3 user-box">
                                             <div class="row text-white">
                                                <div class="col-lg-6 text-end">
                                                   <h4>Amount :</h4>
                                                </div>
                                                <div class="col-lg-5">
                                                   <strong><?php echo $rank_details->amount;?></strong> USDT
                                                </div>
                                             </div>
                                          </div>
                                       </div>
                                   
                                       <div class="check mb-5">
                                          <input class="form-check-input" type="checkbox" value="" id="check">
                                          <label class="form-check-label " for="check">
                                          <a href="<?php //echo base_url();?>/cms/terms" class="text-white"> Terms and conditions </a>
                                          </label>
                                          <p id="err" style="color:red"></p>
                                       </div>
                                       <div class="form-btn text-center col-lg-4 offset-lg-4"> 
                                       <button type="button" id="trans" class="btn btn-primary mb-5" >Confirm</button>
                                       </div>
                                    </div>
                                 </div>
                              </div>
                           </form>
                        </div>

 
                   
                        <?php   
                           } 
                           else
                           { 
                              
                              if($status != '1')
                              {
                                 if(!$time)
                                 {
                                    $date1 = date('Y-m-d H:m:s');
                                 if(strtotime($date1) > strtotime($date))
                                 { ?>
                        <div class="mb-5" style="color:red">
                           <h3 >Your Account is expired. Please activate your account by paying annual fee</h3>
                        </div>
                        <?php  
                           } 
                           }
                           ?>

                        <div class="col-lg-10 offset-lg-1">
                           <form  class="steps-validation" method="post" id="bot_activate"  action="<?php echo base_url();?>/user/activation">
                                 <div class=" team-profit-content" >
                                    <div class="row">
                                       <div class="col-sm-12">
                                          <div class="title pt-2 text-center title-content">
                                             <h4 class="fw-bold text-primary  ">Active annual fee</h4>
                                          </div>
                                          <div class="col-lg-12 mt-5">
                                             <div class="form-block form-group mb-3">
                                                <div class="row text-white">
                                                   <div class="col-lg-6 text-end" >
                                                      <h4>Total :</h4>
                                                   </div>
                                                   <div class="col-lg-5">
                                                      <strong><?php echo $amnt->activation_cost;?></strong> USDT
                                                   </div>
                                                </div>
                                             </div>
                                          </div>
                                          <?php 
                                             if($amnt->subs_type == 'yearly')
                                             {
                                             
                                                $words = 'Year';
                                             }
                                             else if($amnt->subs_type == 'monthly')
                                             {
                                             
                                                $words = 'Month';
                                             }
                                             else
                                             {
                                             $words = 'Onetime';
                                             }
                                             
                                             
                                             if($amnt->subs_type != 'onetime'){ ?>
                                          <div class="col-lg-12 mt-2">
                                             <div class="form-block  form-group mb-3 user-box">
                                                <div class="row text-white">
                                                   <div class="col-lg-6 text-end">
                                                      <h4>Duration :</h4>
                                                   </div>
                                                   <div class="col-lg-5">
                                                      <strong>1</strong> <?php echo $words;?>
                                                   </div>
                                                </div>
                                             </div>
                                          </div>
                                          <?php } ?>
                                          <div class="check mb-5">
                                             <input class="form-check-input" type="checkbox" value="" id="check">
                                             <label class="form-check-label " for="check">
                                             <a href="<?php echo base_url();?>/cms/terms" class="text-white"> Terms and conditions </a>
                                             </label>
                                             <p id="err" style="color:red"></p>
                                          </div>
                                          <div class="form-btn text-center col-lg-4 offset-lg-4"> 
                                          <button type="button" id="trans" name="trans" class="btn btn-primary mb-5" >Confirm</button>
                                          </div>
                                       </div>
                                    </div>
                                 </div>
                              </form>
                        </div>
                       
                        <?php 
                           } 
                           else  
                           { 
                           ?>
                        <div class="title mt-5 text-uppercase text-center text-primary ">
                           <h4>  Bot is Activated </h4>
                        </div>
                        <div id="countdown" class="mb-5">
                           <div id='tiles'></div>
                           <div class="labels">
                              <li>Days</li>
                              <li>Hours</li>
                              <li>Mins</li>
                              <li>Secs</li>
                           </div>
                        </div>
                        <div class="title mt-5 text-white text-center">
                           <h6>Trade Pilot Validity </h6>
                        </div>
                        <div class="row">
                           <div class="col-12">
                              <div class="quantify-header d-flex align-items-center text-white justify-content-between">
                                 <div class="trade-content ms-2">
                                    <h6 class="text-white fw-semibold aleo mb-0 align-items-center">Balance Account USDT
                                    </h6>
                                 </div>
                                 <div class="repeat-icon d-flex align-items-center">
                                    <h5 class="text-white me-2 fw-bold "><?php echo number_format($bal,2); ?> USDT
                                    </h5>
                                    <div id="ip-exist" style="display:none;color:#d84315;" class="error_msg"><?php echo "Insufficient Amount";?></div>
                                 </div>
                              </div>
                           </div>
                        </div>
                        <div class="col-lg-10 offset-lg-1">
                           <form  class="steps-validation" method="post" id="bot_activate"  action="<?php echo base_url();?>/user/activation">
                              <div class=" team-profit-content" >
                                 <div class="row">
                                    <div class="col-sm-12">
                                       <div class="title pt-2 text-center title-content">
                                          <h4 class="fw-bold text-primary  ">Activate Membership with Extend validity</h4>
                                       </div>
                                       <div class="col-lg-12 mt-5">
                                          <div class="form-block form-group mb-3">
                                             <div class="row text-white">
                                                <div class="col-lg-6 text-end" >
                                                   <h4>Total :</h4>
                                                </div>
                                                <div class="col-lg-5">
                                                   <strong><?php echo $amnt->activation_cost;?></strong> USDT
                                                </div>
                                             </div>
                                          </div>
                                       </div>
                                       <?php 
                                          if($amnt->subs_type == 'yearly')
                                          {
                                          
                                             $words = 'Year';
                                          }
                                          else if($amnt->subs_type == 'monthly')
                                          {
                                          
                                             $words = 'Month';
                                          }
                                          else
                                          {
                                            $words = 'Onetime';
                                          }
                                          
                                          
                                          if($amnt->subs_type != 'onetime'){ ?>
                                       <div class="col-lg-12 mt-2">
                                          <div class="form-block  form-group mb-3 user-box">
                                             <div class="row text-white">
                                                <div class="col-lg-6 text-end">
                                                   <h4>Duration :</h4>
                                                </div>
                                                <div class="col-lg-5">
                                                   <strong>1</strong> <?php echo $words;?>
                                                </div>
                                             </div>
                                          </div>
                                       </div>
                                       <?php } ?>
                                       <div class="check mb-5">
                                          <input class="form-check-input" type="checkbox" value="" id="check">
                                          <label class="form-check-label " for="check">
                                          <a href="<?php echo base_url();?>/cms/terms" class="text-white"> Terms and conditions </a>
                                          </label>
                                          <p id="err" style="color:red"></p>
                                       </div>
                                       <div class="form-btn text-center col-lg-4 offset-lg-4"> <button type="button" id="trans" name="trans" class="btn btn-primary mb-5">
                                         Confirm
                                          </button>
                                       </div>
                                    </div>
                                 </div>
                              </div>
                           </form>
                        </div>
                        <?php 
                           }
                           
                           } ?>
                     </div>
                     <div class="tab-pane fade " id="pills-dep2" role="tabpanel" aria-labelledby="pills-dep2-tab">

                     <div class="transaction mt-4">
                        <div class="container">
                           <div class="row">
                              <div class=" col-12">
                                 <div class="table-responsive trans asset-trans position-relative mb-5">
                                 <div class="head_trans py-3">
                                       <h4 class="fw-medium text-white aleo text-center mb-0"> <span id="total_count"> <?php echo $total_count;?> </span> Records </h4>
                                    </div>
                                    <table class="payment-info"  id="example1" style="width:100%">
                                   
                                       <tbody>
                                       <?php
                                       if($rank_id)
                                       {
                                          $condition = array (
                                             'uusersid' => $user,
                                             'type' => 'rank_activation',
                                           
                                             );

                                             $rank_result = $this->common_model->GetResults('history',$condition);

                                             if($rank_result)
                                             {
                                       
                                             foreach($rank_result as $rrow)
                                             { 
                                                
                                                $date3 = $rrow->expiry_date;
                                                
                                          
                                                switch ($rrow->status) {
                                                 case '1':
                                                   $status1 = 'Active';
                                                   $color = 'change-success';
                                                   break;
                                                 case '0':
                                                   $status1 = 'Expired';
                                                   $color = 'change-danger';
                                                   break;
                                                }
                                             
                                       
                                                ?>
                                          <tr>
                                             <td>
                                                <div class="asset-trans-content d-flex align-items-center justify-content-between">
                                                   <div class="asset-trans-left text-start">
                                                      <h6 class="aleo text-white mb-0"><?php echo $rrow->transactionid;?></h6>
                                                      <small class="text-primary fs-6 py-2 fw-bold lato"><?php echo $date3;?></small>
                                                      <h6 class="fw-medium fs-6 mb-0"><?php echo $status1;?></h6>
                                                   </div>
                                                   <div class="asset-trans-right text-end">
                                                      <small class="text-primary lato fw-bold "><?php echo $rrow->amount;?>&nbsp;USDT</small>
                                                      <h6 class="text-white fs-6 mt-4"><?php echo $status1;?></h6>
                                                   </div>
                                                </div>
                                             </td>
                                          </tr>
                                          <?php       }
                                       } }
                                       else
                                       { 
                                          if($result)
                                          {
                                       
                                             foreach($result as $result)
                                             {
                                          
                                          $date4 = date('d M Y H:m:s',strtotime($result->expiry_date));
                                          
                                          switch ($result->status) {
                                           case '1':
                                             $status1 = 'Active';
                                             $color = 'change-success';
                                             break;
                                           case '0':
                                             $status1 = 'Expired';
                                             $color = 'change-danger';
                                             break;
                                          }
                                          
                                          
                                          ?>

                                          <tr>
                                             <td>
                                                <div class="asset-trans-content d-flex align-items-center justify-content-between">
                                                   <div class="asset-trans-left text-start">
                                                      <h6 class="aleo text-white mb-0">Transaction Id : <?php echo $result->transactionid;?></h6>
                                                      <small class="text-primary fs-6 py-2 fw-bold lato"><?php echo $date4;?></small>
                                                      <h6 class="fw-medium fs-6 mb-0"><?php echo $status1;?></h6>
                                                   </div>
                                                   <div class="asset-trans-right text-end">
                                                      <small class="text-primary lato fw-bold "><?php echo $result->amount;?>&nbsp;USDT</small>
                                                     
                                                   </div>
                                                </div>
                                             </td>
                                          </tr>
                                          <?php } }
                                       else
                                       { ?>
                                    <tr>
                                       <td colspan="4" style="text-align: center;"><?php echo 'No Records';?></td>
                                    </tr>
                                    <?php }} ?>
                                       </tbody>
                                    </table>

                                   

                                 </div>
                              </div>
                           </div>
                        </div>
                     </div>

                     <div class="pagination">
                        <button id="prevPage" class="pagination-btn" onclick="changePage('prev')">« Previous</button>
                        <span id="pageInfo"></span>
                        <button id="nextPage" class="pagination-btn" onclick="changePage('next')">Next »</button>
                     </div>


                     </div>
                     <!---banner end---->
                  </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 src="<?php echo base_url()?>/styles/new_style/js/notify.js"></script>
      <script>
         let currentPage = 1;
         const itemsPerPage = 10; // Number of items per page
         let totalPages =1;
         


         document.addEventListener('DOMContentLoaded', function() {
            loadPage(currentPage);
         });

         function loadPage(page) {
            var uusersid = '<?php echo $this->session->get("uusersid"); ?>';
            $.ajax({
               method: 'POST',
               url: '<?php echo base_url("/activation_history"); ?>',
               data: {
                     uusersid: uusersid,
                     page: page,
                     itemsPerPage: itemsPerPage,
                    
               },
               success: function(response) {
                     var data = JSON.parse(response);
                     const tableBody = document.querySelector("#example1 tbody");
                     tableBody.innerHTML = '';

                     if (data.items.length === 0) {
                        tableBody.innerHTML = `
                           <tr>
                                 <td colspan="4" style="text-align: center; color: red;">No Records Found</td>
                           </tr>
                        `;
                     } else {
                        data.items.forEach(item => {
                           tableBody.innerHTML += `
                                 <tr>
                                    <td>
                                       <div class="asset-trans-content d-flex align-items-center justify-content-between">
                                             <div class="asset-trans-left text-start">
                                                <h6 class="aleo text-white mb-0">${item.trans_id}</h6>
                                                <small class="text-primary fs-6 py-2 fw-bold lato">${item.date}</small>
                                                <h6 class="fw-medium fs-6 mb-0">${item.status === '1' ? 'Active' : 'Expired'}</h6>
                                             </div>
                                             <div class="asset-trans-right text-end">
                                                <small class="text-primary lato fw-bold">${item.amount} USDT</small>
                                             </div>
                                       </div>
                                    </td>
                                 </tr>
                           `;
                        });
                     }

                     totalPages = data.totalPages;
                     document.getElementById('total_count').innerText = data.totalItems;
                     document.getElementById('prevPage').disabled = !data.hasPrev;
                     document.getElementById('nextPage').disabled = !data.hasNext;
                     document.getElementById('pageInfo').innerText = `Page ${page} of ${data.totalPages}`;
               }
            });
         }

         function changePage(direction) {
            if (direction === 'prev' && currentPage > 1) {
               currentPage--;
            } else if (direction === 'next' && currentPage < totalPages) {
               currentPage++;
            }
            loadPage(currentPage);
         }

      </script>
      <script>
         var timeString = "<?php echo $date;?>";
         var date5 = new Date(timeString);
         var target_date = date5.getTime();
         
         
         
         var days, hours, minutes, seconds; // variables for time units
         
         var countdown = document.getElementById("tiles"); // get tag element
         
         getCountdown();
         
         setInterval(function () { getCountdown(); }, 1000);
         
         function getCountdown(){
         
         // find the amount of "seconds" between now and target
         var current_date = new Date().getTime();
         var seconds_left = (target_date - current_date) / 1000;
         
         days = pad( parseInt(seconds_left / 86400) );
         seconds_left = seconds_left % 86400;
         
         hours = pad( parseInt(seconds_left / 3600) );
         seconds_left = seconds_left % 3600;
         
         minutes = pad( parseInt(seconds_left / 60) );
         seconds = pad( parseInt( seconds_left % 60 ) );
         
         // format countdown string + set tag value
         countdown.innerHTML = "<span>" + days + "</span><span>" + hours + "</span><span>" + minutes + "</span><span>" + seconds + "</span>"; 
         }
         
         function pad(n) {
         return (n < 10 ? '0' : '') + n;
         }
         
         
      </script>
      <script>
         $(document).ready(function(){
            $('#trans').on('click',function(){
         var balance = <?php echo str_replace(',', '', $buy_bal);?>;
         var activation = <?php echo $amnt->activation_cost;?>;
         // var balance = '1800';
         if(document.getElementById("check").checked==true)
         {
         $('#err').html("");
         
         if(balance < activation){
         
         $.notify(' <i class="fas fa-exclamation-triangle"></i>&nbsp;&nbsp; Please recharge your asset above. ', 'danger');
         
         }else{
         
         
         $('#bot_activate').submit();
         }
         }
         else
         {
         $('#err').html('Terms and condition is required');
         }
         });
         
         
         
         
         });
      </script>
   </body>
</html>
