<?php

include('../config/connection.php');

session_start();

$db_name=$_SESSION['dir_name'];

$db_email=$_SESSION['dir_email'];

if (isset($db_name) || isset($db_email)){

?>

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>TECL Admin - <?php echo $db_name; ?></title>

<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.0/css/jquery.dataTables.min.css">

<script type="text/javascript" language="javascript" src="https://code.jquery.com/jquery-3.5.1.js"></script>

<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/1.11.0/js/jquery.dataTables.min.js"></script>

<script>

$(document).ready( function () {

$('#myTable').DataTable();

} );

</script>

<?php include_once 'layout/menu.php'; ?>

<div class="mai-logo" title="Welcome to TECL (Technical Educational Council for Life )">

<a href="#"><img src="../assets/img/logo.png" alt="#" style="max-height:100px;width:200px;"></a>

</div>

<!-- sidebar-wrapper  -->

<main class="page-content">

<div class="container" id="u1">

<div class="row">

<center><h5>TECL MEMBER</h5></center>

<table id="myTable" class="display" style='font-size:10pt;'>

<thead class="table-dark">

<tr>

<th>#</th>

<th>Name</th>

<th>Email</th>

<th>Mobile</th>

<th>Status</th>

<th>Edit</th>

<th>Delete</th>

</tr>

</thead>

<tbody>

<?php

$sql="select * from tecl_our_member";

$result=mysqli_query($con,$sql);

$count=mysqli_num_rows($result);

if($count>0){

$i=1;

#echo "Total Member : ".$count;

while($data=mysqli_fetch_assoc($result)){

?>

<tr>

<td style="color:#fff;background: #000;"><?php echo $i;?></td>

<td><?php echo $data['name']?></td>

<td><?php echo $data['email']?></td>

<td><?php echo $data['mobile']?></td>

<td><?php

if($data['status']){

echo "<span style='color:green;font-weight: 500'>Active</span>";

}else{ echo "<span style='color:red;font-weight: 500;'>Dactive</span>";} ?></td>

<td>

<a href="mem_edit.php?/=<?php echo $data['id'];?>" style="color:green;text-decoration:none"> <i class="fa fa-cog"></i></a>

</td>

<td>

<a href="vendor/mem_del.php?/=<?php echo $data['id'];?>" onclick="return confirm('DO you sure delete the data')" style="color:red;text-decoration:none"> <i class="fa fa-trash"></i></a>

</td>

</tr>

<?php

$i++;

}

?>

</tbody>

<?php

}else{

?>

<tr>

<td colspan="10"><?php echo "NO record Found;"?></td>

</tr>

<?php

}

?>

</table>

</div>

</div>

<?php include_once 'layout/footer.php'; ?>

</main>

<!-- page-content" -->

</div>

<script>

$(".sidebar-dropdown > a").click(function() {

$(".sidebar-submenu").slideUp(200);

if (

$(this)

.parent()

.hasClass("active")

) {

$(".sidebar-dropdown").removeClass("active");

$(this)

.parent()

.removeClass("active");

} else {

$(".sidebar-dropdown").removeClass("active");

$(this)

.next(".sidebar-submenu")

.slideDown(200);

$(this)

.parent()

.addClass("active");

}

});

$("#close-sidebar").click(function() {

$(".page-wrapper").removeClass("toggled");

});

$("#show-sidebar").click(function() {

$(".page-wrapper").addClass("toggled");

});

</script>

</body>

</html>

<?php

}else{

header("Location:../dir_login.php");

}

?>