<?php
include('../includes/session.php');
include('../includes/config.php');
include('../template/tngweb/header.php');


?>
<!--start page wrapper -->
<div class="page-wrapper">
    <div class="page-content">
        <div class="card radius-10">
            <div class="card-body">
                <div class="d-flex align-items-center">
                    <div>
                            <div class="mb-4">
        <a href="javascript:history.back()" class="back-btn">
            <i class="bi bi-arrow-left-circle"></i> Go Back
        </a>
    </div>
                        <h5 class="mb-0">All Users List</h5>
                    </div>
                   
                </div>
                <hr>
                <div class="table-responsive">
                    <table id="example2" class="table align-middle mb-0">
                        <thead class="table-light">
                            <tr>
                                <th class="text-center">SL.</th>
                                <th class="text-center">Username</th>
                                <th class="text-center">Name</th>
                                <th class="text-center">Email</th>
                                <th class="text-center">Type</th>
                                <th class="text-center">Balance</th>
                            </tr>
                        </thead>
                        <tbody>
                           
<?php
$res = mysqli_query($tng_conn,"SELECT * FROM users where parent='".$_SESSION['phone']."' ORDER BY id DESC");
if(mysqli_num_rows($res)>0){
    $x=0;
    while($data = mysqli_fetch_assoc($res)){
        if($data['type'] == 'admin'){
            continue;
        }
        $x ++;
        ?>
        <tr>
            <td class="text-center"><?= $x;?></td>
            <td class="text-center"><?= $data['phone'];?></td>
            <td class="text-center"><?= $data['name'];?></td>
            <td class="text-center"><?= $data['email'];?></td>
            <td class="text-center">
                  <div class="ms-2">
                        <h6 class="mb-1 font-14"><?php echo strtoupper($data['type']); ?></h6>
                    </div>
            </td>
        
            <td class="text-center"><?php 
            if($data['balance']!=NULL){

                echo strtoupper($data['balance']); 
            }else{
                echo "0.00";
            }
            ?></td>
            
        </tr>
        <?php
       
    }
}
?>
                          
                        </tbody>
                    </table>
                </div>
            </div>
        </div>

    </div>
</div>
<!--end page wrapper -->
<?php 
include('../template/tngweb/footer.php');
?>
<!-- Bootstrap JS -->
<script src="../template/tngweb/assets/js/bootstrap.bundle.min.js"></script>
<!--plugins-->
<script src="../template/tngweb/assets/js/jquery.min.js"></script>
<script src="../template/tngweb/assets/plugins/simplebar/js/simplebar.min.js"></script>
<script src="../template/tngweb/assets/plugins/metismenu/js/metisMenu.min.js"></script>
<script src="../template/tngweb/assets/plugins/perfect-scrollbar/js/perfect-scrollbar.js"></script>
<script src="../template/tngweb/assets/plugins/chartjs/chart.min.js"></script>
<script src="../template/tngweb/assets/plugins/vectormap/jquery-jvectormap-2.0.2.min.js"></script>
<script src="../template/tngweb/assets/plugins/vectormap/jquery-jvectormap-world-mill-en.js"></script>
<script src="../template/tngweb/assets/plugins/jquery.easy-pie-chart/jquery.easypiechart.min.js"></script>
<script src="../template/tngweb/assets/plugins/sparkline-charts/jquery.sparkline.min.js"></script>
<script src="../template/tngweb/assets/plugins/jquery-knob/excanvas.js"></script>
<script src="../template/tngweb/assets/plugins/jquery-knob/jquery.knob.js"></script>
<script>
$(function() {
    $(".knob").knob();
});
</script>
<script src="../template/tngweb/assets/js/index.js"></script>
<!--app JS-->
<script src="../template/tngweb/assets/js/app.js"></script>
<!-- datatable -->
<script src="../template/tngweb/assets/plugins/datatable/js/jquery.dataTables.min.js"></script>
	<script src="../template/tngweb/assets/plugins/datatable/js/dataTables.bootstrap5.min.js"></script>
<script>
		$(document).ready(function() {
			$('#example').DataTable();
            $('#aadh').inputmask();
		  } );
	</script>
	
	<script>
		$(document).ready(function() {
			var table = $('#example2').DataTable( {
				lengthChange: false,
				buttons: [ 'copy', 'excel', 'pdf', 'print']
			} );
		 
			table.buttons().container()
				.appendTo( '#example2_wrapper .col-md-6:eq(0)' );
		} );


	</script>
	
</body>



</html>