<?php
include("auth.php");
?>
<?php include("header.php");?>

            <!-- HEADER DESKTOP-->

            <!-- MAIN CONTENT-->
         


            

<div class="main-content">
                <div class="section__content section__content--p30">
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="overview-wrap">
                                    <h2 class="title-1">Dashboard</h2>
                                </div>
                            </div>
                        </div><br>


                        <table class="table-responsive" style ="background-color:white;">
                            <tr>
                            <th>First Name</th>
                            <th>Last Name</th>
                            <th>email</th>
                            <th>plan</th>
                            <th>password</th>
                            <th>investment</th>
                            <th>currentvaalue</th>
                            <th>growthpercentage</th>
                            <th>currentvaalue</th>
                            <th>Withdrawal</th>
                            
</tr>


<?php
include("dbcon.php");

if (isset($_GET['page_no']) && $_GET['page_no']!="") {
    $page_no = $_GET['page_no'];
    } else {
        $page_no = 1;
        }
	$total_records_per_page = 10;
		
$offset = ($page_no-1) * $total_records_per_page;
$previous_page = $page_no - 1;
$next_page = $page_no + 1;
$adjacents = "2";

$result_count = mysqli_query(
$db,
"SELECT COUNT(*) As total_records FROM members "
);
$total_records = mysqli_fetch_array($result_count);
$total_records = $total_records['total_records'];
$total_no_of_pages = ceil($total_records / $total_records_per_page);
$second_last = $total_no_of_pages - 1; // total pages minus 

$result = mysqli_query($db,"SELECT * FROM members ORDER BY id DESC LIMIT $offset, $total_records_per_page");
while($row = mysqli_fetch_array($result)){

 
    
?>		



<tr>
    <td><?php echo $row["firstname"];?></td>
    <td><?php echo $row["lastname"];?></td>
    <td><?php echo $row["email"];?></td>
    <td><?php echo $row["plan"];?></td>
    <th><?php echo $row["password"];?></th>
    <td><?php echo $row["plan"];?></td>
    <td><?php echo $row["investment"];?></td>
    <td><?php echo $row["currentvalue"];?></td>
    <td><?php echo $row["growthpercentage"];?></td>
    <td><?php echo $row["withdrawal"];?></td>
 

    <td>
    <?php echo '<a  class="edit" style ="color:red"; href="update-users.php?id='.$row['id'].'"><i class=
										   "fa fa-edit">  <br></i></a>';?>
										   
                                           <?php echo '<a  class="delete" href="delete-user.php?id='.$row['id'].'"><i class=
										   "fa fa-trash">  <br></i></a>';?>
</td>

</tr>


<?php
}
?>   

</table>
 
            <!-- END MAIN CONTENT-->
            <!-- END PAGE CONTAINER-->
        </div>
    </div>

 

 

    <!-- Jquery JS-->
    <script src="vendor/jquery-3.2.1.min.js"></script>
    <!-- Bootstrap JS-->
    <script src="vendor/bootstrap-4.1/popper.min.js"></script>
    <script src="vendor/bootstrap-4.1/bootstrap.min.js"></script>
    <!-- Vendor JS       -->
    <script src="vendor/slick/slick.min.js">
    </script>
    <script src="vendor/wow/wow.min.js"></script>
    <script src="vendor/animsition/animsition.min.js"></script>
    <script src="vendor/bootstrap-progressbar/bootstrap-progressbar.min.js">
    </script>
    <script src="vendor/counter-up/jquery.waypoints.min.js"></script>
    <script src="vendor/counter-up/jquery.counterup.min.js">
    </script>
    <script src="vendor/circle-progress/circle-progress.min.js"></script>
    <script src="vendor/perfect-scrollbar/perfect-scrollbar.js"></script>
    <script src="vendor/chartjs/Chart.bundle.min.js"></script>
    <script src="vendor/select2/select2.min.js">
    </script>

    <script src="//cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.min.js"></script>

    <!-- Main JS-->
    <script src="js/main.js"></script>
    <script src="../js/user.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@8"></script>
    
    <script type="text/javascript">
        new Morris.Line({
            // ID of the element in which to draw the chart.
            element: 'myfirstchart',
            // Chart data records -- each entry in this array corresponds to a point on
            // the chart.
            data: [
                
            ],
            // The name of the data record attribute that contains x-values.
            xkey: 'year',
            // A list of names of data record attributes that contain y-values.
            ykeys: ['value'],
            // Labels for the ykeys -- will be displayed when you hover over the
            // chart.
            labels: ['Value'],

            resize: true
        });

        convert();

        $("#withdrawButton").click(function(e){
            e.preventDefault()

            var loading_html = '<div style="height:150px;width:150px;margin: 0 auto;"><img style="width: 100%;" src="https://i.ya-webdesign.com/images/minimalist-transparent-loading-gif-6.gif" /></div>'

            swal.fire({
                title: "<h5></h5>", 
                html: loading_html,  
                showConfirmButton: false,
                showCancelButton: false,
                allowOutsideClick: false
            })

            setTimeout(()=>{
                swal.fire('Unable to complete request', 'Please upgrade your account', 'warning')
            }, 2000)
        })

    </script>

                        
                          
                        <?php include("footer.php");?>
                    </div>
                </div>
            </div>
            <!-- END MAIN CONTENT-->
            <!-- END PAGE CONTAINER-->
        </div>

    </div>

    <!-- Jquery JS-->
    

</body>

</html>
<!-- end document-->
