<?php $total=0;?>
<div class="usesection">
  <div class="container">
    <div class="row justify-content-center">
      <div class="col-6 col-sm-2 col-md-2 text-center">
        <div class="user-home-menu-sub active">
          <a href="<?php echo base_url()?>user_profile" class="">
            <img src="<?php echo base_url()?>assets/img/user.png" class="w-100">
            <h4>MY PROFILE</h4>
          </a>
        </div>
      </div>
      <div class="col-6 col-sm-2 col-md-2 text-center">
        <div class="user-home-menu-sub ">
          <a href="<?php echo base_url()?>service" class="">
            <img src="<?php echo base_url()?>assets/img/email.png" class="w-100">
            <h4>SERVICES</h4>
          </a>
        </div>
      </div>
      <div class="col-6 col-sm-2 col-md-2 text-center">
        <div class="user-home-menu-sub">
          <a href="<?php echo base_url()?>support" class="">
            <img src="<?php echo base_url()?>assets/img/support.png" class="w-100">
            <h4>SUPPORT</h4>
          </a>
        </div>
      </div>
      <div class="col-6 col-sm-2 col-md-2 text-center">
        <div class="user-home-menu-sub">
          <a href="<?php echo base_url()?>orders" class="">
            <img src="<?php echo base_url()?>assets/img/billing.png" class="w-100">
            <h4>ORDERS</h4>
          </a>
        </div>
      </div>
      <div class="col-6 col-sm-2 col-md-2 text-center">
        <div class="user-home-menu-sub">
          <a href="<?php echo base_url()?>billing" class="">
            <img src="<?php echo base_url()?>assets/img/billing.png" class="w-100">
            <h4>BILLING HISTORY</h4>
          </a>
        </div>
      </div>
    </div>
    <div class="row ">
      <section class="py-5 ">
        <div class="row">
          <div class="col">
            <?php if(!empty($productDetail))
              {  
                $grandTotal=0;   
                $i=1;  
                $total=0;?>
                <table class="table">
                  <thead class="thead-light">
                    <th scope="col">Sl.No.</th>
                    <th scope="col">Plan Name</th>
                
                    <th>Expiry Date</th>
                    
                    <th scope="col">Price</th>
                    <th scope="col">Users</th>
                    <th scope="col">Duration</th>
                    <th scope="col">Subtotal</th>
                
                    <th scope="col">Action</th>
                
                  </thead>
                  <tbody>
                    <?php
                          
                    foreach ($productDetail as $row) 
                    { ?>
                      <tr>
                        <td><?php echo $i?></td>
                        <td><?php echo $row['plan_name'];?></td>
                  
                  
                        <td><?php 
                          if($row['duration']=="1")
                          {
                            $date=date("Y-m-d");
                            $exDate = date("Y-m-d", strtotime(date("Y-m-d", strtotime($date)) . " + 30 days"));
                            echo $new=date("d-m-Y",strtotime($exDate));
                          } 
                          if($row['duration']=="3")
                          {
                            $date=date("Y-m-d");
                            $exDate = date("Y-m-d", strtotime(date("Y-m-d", strtotime($date)) . " + 90 days"));
                            echo $new=date("d-m-Y",strtotime($exDate));
                          }
                          if($row['duration']=="6")
                          {
                            $date=date("Y-m-d");
                            $exDate = date("Y-m-d", strtotime(date("Y-m-d", strtotime($date)) . " + 180 days"));
                            echo $new=date("d-m-Y",strtotime($exDate));
                          }
                          if($row['duration']=="12")
                          {
                            $date=date("Y-m-d");
                            $exDate = date("Y-m-d", strtotime(date("Y-m-d", strtotime($date)) . " + 365 days"));
                            echo $new=date("d-m-Y",strtotime($exDate));
                          }
                          if($row['duration']=="24")
                          {
                            $date=date("Y-m-d");
                            $exDate = date("Y-m-d", strtotime(date("Y-m-d", strtotime($date)) . " + 730 days"));
                            echo $new=date("d-m-Y",strtotime($exDate));
                          }
                          if($row['duration']=="36")
                          {
                            $date=date("Y-m-d");
                            $exDate = date("Y-m-d", strtotime(date("Y-m-d", strtotime($date)) . " + 1095 days"));
                            echo $new=date("d-m-Y",strtotime($exDate));
                          }
                        ?></td>
                        
                        <td><?php echo $row['price'];?></td>
                   
                        <td>
                      <form method="post" action="<?php echo base_url()?>updatevalue">
                      <?php if($row['service_id']=='2')
                          {
                           
                              ?>
                               <input type="number" value="<?php echo $row['users'];?>"  name="user" min="1" max="100" required/>
                            
                            
                            <?php
                          } ?>
                        <select name="dtn">
                          <?php $opt=$row['duration'];
                          
                          if($opt=='12')
                          {?>
                          
                          <option value="12" <?php if($opt == '12') echo 'selected' ?>>12 Month</option>
                          <option value="24"<?php if($opt == '24') echo 'selected' ?>>24 Month</option>
                          <option value="36" <?php if($opt == '36') echo 'selected' ?>>36 Month</option>
          <?php } else
          {
            ?>
            <option value="1" <?php if($opt == '1') echo 'selected' ?>>1 Month</option>
                          <option value="3" <?php if($opt == '3') echo 'selected' ?>>3 Month</option>
                          <option value="6" <?php if($opt == '6') echo 'selected' ?>>6 Month</option>
                          <option value="12" <?php if($opt == '12') echo 'selected' ?>>12 Month</option>
                          <option value="24"<?php if($opt == '24') echo 'selected' ?>>24 Month</option>
                          <option value="36" <?php if($opt == '36') echo 'selected' ?>>36 Month</option>
                          <?php
          }?>
                        </select>
                        <input type="hidden" name="plnid" value="<?php echo $row['product_id']?>"/>
                       
                        <input type="submit" name="submit" value="Update"/>
                      </form>
                    </td>
                    <td>
                      <?php 
                      $sub= $row['duration']*$row['price']*$row['users'];
                    echo $sub  ?></td>
                    <td> <a href="<?php echo base_url()?>deleteItem/<?php echo $row['cart_id'];?>">Delete</a></td>
                  </tr>
                 
                  <?php 
                  $total=$total+$sub;
                  $i++;
                }
              }
            
              else{
              ?>
              
              Your Cart is Empty
              <?php
              
              }
              ?>
              
         
           
            </tbody>
          </table>
         
          <table>
            <tr>
              <td><?php if(isset($taxRate['0'])){
                foreach($taxRate as $tax){
                 $grandTotal=$total+($total*$tax->rate/100) ;
                }
                ?>
                <tr>
            
          <td>Total </td><td>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td><?php echo round($grandTotal,2)?></td></tr>
            <?php  } ?></td>
            </tr>
              
          </table>
          
        </div>
       
      </div>
    </section>
   
  </div>
  <div class="col">
            <a href="<?php echo base_url()?>service" class="btn btn-primary">Continue shopping</a>
          <form method="post" action="confirmOrder">
           <input type="hidden" value="<?php echo $this->session->userdata('email')?>" name="email"/>
            <input type="hidden" value="<?php echo $grandTotal;?>" name="total"/>
          <input type="submit" name="Order" value="Confirm Order" class="btn btn-primary"/>
          </form>
              
           
          </div>
</div>

</div>


<div class="footer">
      <footer>
        <div class="container">
          <div class="row">
            <div class="col-sm-6 col-md-3 col-lg-3">
              <h4>DOMAINS</h4>
              <ul>
                <li>Register Domain Name</li>
                <li>View Domain Pricing</li>
                <li>Bulk Domain Register</li>
                <li>Bulk Domain Transfer</li>
                <li>Whois Lookup</li>
                <li>Name Suggestion Tool</li>
                <li>Free with Every Domain</li>
                <li>View Promos</li>
              </ul>
            </div>
            <div class="col-sm-6 col-md-3 col-lg-3">
              <h4>HOSTING & PRODUCTS</h4>
              <ul>
                <li>Linux Hosting</li>
                <li>Windows Hosting</li>
                <li>Wordpress Hosting</li>
                <li>Linux Reseller Hosting</li>
                <li>Windows Reseller Hosting</li>
                <li>Dedicated Servers</li>
                <li>Managed Servers</li>
                <li>Cloud Hosting</li>
              </ul>
            </div>
            <div class="col-sm-6 col-md-3 col-lg-3">
              <h4>INFRASTRUCTURE</h4>
              <ul>
                <li>Datacenter Details</li>
                <li>Hosting Security</li>
                <li>24 x 7 Servers Monitoring</li>
                <li>Backup and Recovery</li>
              </ul>
            </div>
            <div class="col-sm-6 col-md-3 col-lg-3 m-auto">
              <ul class="list-inline">
                <li class="list-inline-item"><a href="https://www.facebook.com/asianet.hosting"><h3><i class="fab fa-facebook-square"></i></h3></a></li>
                <li class="list-inline-item"><h3><i class="fab fa-youtube"></i></h3></li>
                <li class="list-inline-item"><h3><i class="fab fa-twitter-square"></i></h3></li>
              </ul>
            </div>
          </div>
        </div>
      </footer>
    </div>
    <script src="https://cdn.jsdelivr.net/particles.js/2.0.0/particles.min.js"></script>
    <!-- <script src="https://threejs.org/examples/js/libs/stats.min.js"></script> -->
    <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="<?php echo base_url()?>assets/js/jquery-3.3.1.slim.min.js"></script>
    <script src="<?php echo base_url()?>assetsjs/popper.min.js"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="<?php echo base_url()?>assets/js/wow.js"></script>
    <script>
    new WOW().init();
    </script>
    <script>
    let navWrapper = document.querySelector('.nav-wrapper'),
    navToogler =  document.querySelector('.nav-toogler')
    navToogler.addEventListener('click', function (event) {
    navWrapper.classList.toggle('active')
    })
    </script>
    <script type="text/javascript">
    particlesJS("particles-js", {"particles":{"number":{"value":80,"density":{"enable":true,"value_area":800}},"color":{"value":"#000000"},"shape":{"type":"circle","stroke":{"width":0,"color":"#000000"},"polygon":{"nb_sides":5},"image":{"src":"img/github.svg",}},"opacity":{"value":0.5,"random":false,"anim":{"enable":false,"speed":1,"opacity_min":0.1,"sync":false}},"size":{"value":3,"random":true,"anim":{"enable":false,"speed":40,"size_min":0.1,"sync":false}},"line_linked":{"enable":true,"distance":150,"color":"#000000","opacity":0.4,"width":1},"move":{"enable":true,"speed":6,"direction":"none","random":false,"straight":false,"out_mode":"out","bounce":false,"attract":{"enable":false,"rotateX":600,"rotateY":1200}}},"interactivity":{"detect_on":"canvas","events":{"onhover":{"enable":true,"mode":"repulse"},"onclick":{"enable":true,"mode":"push"},"resize":true},"modes":{"grab":{"distance":400,"line_linked":{"opacity":1}},"bubble":{"distance":400,"size":40,"duration":2,"opacity":8,"speed":3},"repulse":{"distance":200,"duration":0.4},"push":{"particles_nb":4},"remove":{"particles_nb":2}}},"retina_detect":true});var count_particles, stats, update; stats = new Stats; stats.setMode(0); stats.domElement.style.position = 'absolute'; stats.domElement.style.left = '0px'; stats.domElement.style.top = '0px'; document.body.appendChild(stats.domElement); count_particles = document.querySelector('.js-count-particles'); update = function() { stats.begin(); stats.end(); if (window.pJSDom[0].pJS.particles && window.pJSDom[0].pJS.particles.array) { count_particles.innerText = window.pJSDom[0].pJS.particles.array.length; } requestAnimationFrame(update); }; requestAnimationFrame(update);;
    </script>
  </body>
</html>