<?php
session_start();
error_reporting(0);
require 'cPanelScript/cPanelScript.php';

if (!isset($_SESSION['AdminID']) && !isset($_SESSION['Adminpage'])) {
?>
<!DOCTYPE html>
<html>
<head>
<title> Admin Login</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta http-equiv="content-language" content="en">
<meta name="theme-color" content="#426fb6" >
<meta name="msapplication-navbutton-color" content="#426fb6">
<meta name="apple-mobile-web-app-status-bar-style" content="#426fb6">
<meta name="keywords" content="">
<meta name="description" content="" >
<meta property="og:type" content="website">
<meta property="og:site_name" content="">
<meta property="og:title" content="SpringWellFinance">
<meta property="og:description" content="">
<meta property="og:site_name" content="">
<meta property="og:image" content="">
<meta name="msapplication-TileColor" content="#426fb6">
<meta name="msapplication-TileImage" content="https://d4u5qzkfpc9yt.cloudfront.net/favicons/mstile-144x144.7f7356b104f883d3d4fb2cf19d18d3f24c8cb71d.png">
<meta property="og:url" content="">
<link rel="stylesheet" type="text/css" href="/personal/personal/assets/css_animate/animate.min.css">
<link rel="stylesheet" type="text/css" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<link rel="icon" type="image/x-icon" href="/personal/personal/img/centuryBankLogo.png">
<link rel="stylesheet" type="text/css" href="/personal/personal/assets/stylesheet/layout.css">
<link rel="stylesheet" type="text/css" href="/personal/personal/assets/stylesheet/fonts.css">
<link rel="stylesheet" type="text/css" href="/personal/personal/assets/stylesheet/responsive.css">
<link rel="stylesheet" type="text/css" href="/personal/assets/stylesheet/fonts.css">
<!--========================== PRELOAD FONTS============================= -->
<link rel="preload" href="/personal/assets/fonts/hind-medium.otf" as="font">
<link rel="preload" href="/personal/assets/fonts/hind-light.otf" as="font">
<link rel="preload" href="/personal/assets/fonts/hind-bold.otf" as="font">
<link rel="preload" href="/personal/assets/fonts/hind-regular.otf" as="font">
<link rel="preload" href="/personal/assets/fonts/hind-semibold.otf" as="font">
<link rel=’stylesheet’ href=typicons.font-master/src/font/typicons.min.css’>
<!-- ====================== JS SCRIPTS =====================================-->
<script type="text/javascript" src="/personal/personal/assets/js/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="/personal/personal/assets/js/global.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script type="text/javascript" src="/personal/personal/assets/js/wow.min.js"></script>

</head>
<body>
<div id="body_container" class="cPanel">
<!-- ======================= LOGIN BODY ========================================-->
<div class="loginBody unselectable">
<div class="data"></div>
<h1>Admin Login</h1>
<form action="<?php $_SERVER['PHP_SELF'] ?>" method="POST">
<label for="email">
Email
<input type="email" name="Email" placeholder="Enter your fullname  *" autofocus id="adminID">
<div class="error errorEmail"></div>
</label>
<label for="password">
Password
<input type="password" name="password" placeholder="Enter your password *" id="adminPassword">
<div class="error errorPassword"></div>
</label>
<label for="Login">
<button type="button" id="AdminLogin">Login</button> 
</label>
</form>
</div>
</div>
</body>
</html>
<?php
}
else {?>
<!DOCTYPE html>
<html lang="en">

<head>
<!-- Required meta tags-->
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="au theme template">
<meta name="author" content="Hau Nguyen">
<meta name="keywords" content="au theme template">

<!-- Title Page-->
<title>Admin Dashboard</title>

<!-- Fontfaces CSS-->
<link href="css/font-face.css" rel="stylesheet" media="all">
<link href="vendor/font-awesome-4.7/css/font-awesome.min.css" rel="stylesheet" media="all">
<link href="vendor/font-awesome-5/css/fontawesome-all.min.css" rel="stylesheet" media="all">
<link href="vendor/mdi-font/css/material-design-iconic-font.min.css" rel="stylesheet" media="all">
<!-- Bootstrap CSS-->
<link href="vendor/bootstrap-4.1/bootstrap.min.css" rel="stylesheet" media="all">
<link rel="icon" type="image/x-icon" href="/personal/personal/img/centuryBankLogo.png">

<!-- Vendor CSS-->
<link href="vendor/animsition/animsition.min.css" rel="stylesheet" media="all">
<link href="vendor/bootstrap-progressbar/bootstrap-progressbar-3.3.4.min.css" rel="stylesheet" media="all">
<link href="vendor/wow/animate.css" rel="stylesheet" media="all">
<link href="vendor/css-hamburgers/hamburgers.min.css" rel="stylesheet" media="all">
<link href="vendor/slick/slick.css" rel="stylesheet" media="all">
<link href="vendor/select2/select2.min.css" rel="stylesheet" media="all">
<link href="vendor/perfect-scrollbar/perfect-scrollbar.css" rel="stylesheet" media="all">
<script type="text/javascript" src="/personal/assets/js/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="/personal/assets/js/global.js"></script>
<link rel="stylesheet" type="text/css" href="/personal/assets/stylesheet/layout.css">
<script type="text/javascript" src="/personal/personal/assets/js/global.js"></script>
<link rel="stylesheet" href="/personal/admin/css/sweetalert2.min.css">


<!-- Main CSS-->
<link href="css/theme.css" rel="stylesheet" media="all">

</head>

<body class="animsition">
<div class="page-wrapper">
<!-- HEADER MOBILE-->
<header class="header-mobile d-block d-lg-none">
<div class="header-mobile__bar">

<div class="container-fluid" >
<div class="header-mobile-inner">
<a class="logo" href="index.html">
<img src="/personal/assets/Img/century-bank-logo.svg" alt="" />
</a>
<button class="hamburger hamburger--slider" type="button">
<span class="hamburger-box">
<span class="hamburger-inner"></span>
</span>
</button>
</div>
</div>

</div>
<nav class="navbar-mobile">
<div class="container-fluid">
<ul class="navbar-mobile__list list-unstyled">
<li class="has-sub">
<a class="js-arrow" href="/personal/admin/" style="color: #555">
<i class="fas fa-tachometer-alt"></i>Dashboard</a>
</li>
<li class="has-sub">
<a class="js-arrow" href="#">
<i class="fas fa-user"></i>Access An Account</a>
<ul class="navbar-mobile-sub__list list-unstyled js-sub-list">
<li>
<a href="../login.php" target="_blank">Login</a>
</li>
</ul>
</li>
<li class="has-sub">
<a class="js-arrow" href="accounts.php">
<i class="fas fa-user"></i>Activate/Deactivate</a>
</li>
<li class="has-sub">
<a class="js-arrow" href="transactions.php">
<i class="fas fa-user"></i>Transactions</a>
</li>
<li class="has-sub">
<a class="js-arrow" href="../register.php">
<i class="fas fa-user"></i>Register Customer</a>
</li>

</ul>
</li>
</ul>
</div>
</nav>
</header>
<!-- END HEADER MOBILE-->

<!-- MENU SIDEBAR-->
<aside class="menu-sidebar d-none d-lg-block" style="background-color: white !important;">
<div class="logo">
<a href="#">ADMINISTRATOR PANEL
</a>
</div>
<div class="menu-sidebar__content js-scrollbar1">
<nav class="navbar-sidebar">
<ul class="list-unstyled navbar__list">
<li class="active has-sub">
<a class="js-arrow" href="/personal/admin/" style="color: #555;">
<i class="fas fa-tachometer-alt"></i>Dashboard</a>
</li>
<li class="has-sub">
<a class="js-arrow" href="#">
<i class="fas fa-user"></i>Access An Account</a>
<ul class="list-unstyled navbar__sub-list js-sub-list">
<li>
<a href="../login.php" target="_blank">Login</a>
</li>
</ul>
</li>
<li class="has-sub">
<a class="js-arrow" href="accounts.php">
<i class="fas fa-user"></i>Activate/Deactivate</a>
</li>
<li class="has-sub">
<a class="js-arrow" href="transactions.php">
<i class="fas fa-book"></i>Transactions</a>
</li>
<li class="has-sub">
<a class="js-arrow" href="../register.php">
<i class="fas fa-user"></i>Register a new customer</a>
</li>
<li class="has-sub">
<a class="js-arrow" href="cPanelScript/logout.php">
<i class="zmdi zmdi-power"></i>Sign Out</a>
</li>
</ul>
</nav>
</div>
</aside>
<!-- END MENU SIDEBAR-->

<!-- PAGE CONTAINER-->
<div class="page-container" style="background-color: white !important;">
<!-- HEADER DESKTOP-->
<header class="header-desktop" style="background-color: white !important;">
<div class="section__content section__content--p30">
<div class="container-fluid">
<div class="header-wrap">
<form class="form-header" action="" method="POST">
<input class="au-input au-input--xl" type="text" name="search" placeholder="Search for datas &amp; reports..." />
<button class="au-btn--submit" type="submit">
<i class="zmdi zmdi-search"></i>
</button>
</form>
<div class="header-button" style="position: relative;">
<div class="account-wrap">
<div class="account-item clearfix js-item-menu">
<div class="image">
<img src="AccImage/<?php echo $_SESSION['Acclmage']; ?>" alt=""/>
</div>
<div class="content">
<a class="js-acc-btn" href="#"><?php echo $_SESSION['username']; ?></a>
</div>
<div class="account-dropdown js-dropdown">
<div class="info clearfix">
<div class="image">
<a href="#">
<img src="AccImage/<?php echo $_SESSION['Acclmage']; ?>" alt="<?php echo $_SESSION['username']; ?>" />
</a>
</div>
<div class="content">
<h5 class="name">
<a href="#"><?php echo $_SESSION['username']; ?></a>
</h5>
<span class="email"><?php echo $_SESSION['AccBal']; ?></span>
</div>
</div>
<div class="account-dropdown__body">

<div class="account-dropdown__footer">
<a href="cPanelScript/logout.php">
<i class="zmdi zmdi-power"></i>Logout</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</header>
<!-- 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-lg-4" style="overflow: hidden;">

<button type="button" style="width: 100%; display: block; " data-toggle="modal" data-target="#CompTrans" class="ComTrans btn btn-success">Complete transaction</button><br>
</div>
<div id="deleteCustomerData"></div>
<div class="col-lg-12">
<h2 class="title-1 m-b-25">All Customers in SpringWellFinance(<?php echo $numAllUsers; ?>)</h2>
<div class="table-responsive table--no-card m-b-40">
<table class="table table-borderless table-striped table-earning">
<thead>
<tr>
<th>Account P.</th>
<th>Username</th>
<th>Password</th>
<th>Control</th>
<th>DEACTIVATE/ACIVATE</th>

</tr>
</thead>
<tbody>
<?php
if ($numAllUsers > 0) {

while ($fetchAllusers = mysqli_fetch_assoc($usersAll)) {
$ID = $fetchAllusers['ID'];
$Username = $fetchAllusers['Username'];
$Email = $fetchAllusers['Email'];
$AccountImage = $fetchAllusers['AccImage'];
$Fullname = $fetchAllusers['AccFullname'];
$Password = $fetchAllusers['Password'];
$AccType = $fetchAllusers['AccType'];
$AccBal = $fetchAllusers['AccBal'];
$LastLogin = $fetchAllusers['LastLogin'];
$Admin = $fetchAllusers['Admin'];
$Access = $fetchAllusers['active'];
?>                                      
<tr>

<td><img src="AccImage/<?php echo $AccountImage; ?>" alt="" style="width: 60px; height: 60px; border-radius: 50%;"></td>
<td><?php echo $Username; ?></td>
<td class="text-right"><?php echo $Password; ?></td>
<td><?php if($Admin == 1){?>
<button type="button" class="btn btn-primary">Admin</button>
<?php
}else {?>
<button type="button" class="btn btn-secondary">Customer</button> 
<?php
} 
?></td>


<td>
<div class="TransOnBody">
<label for="TransControler" class="TransOnCircle <?php if($Access == 1) { echo "on";} elseif($Access == 0){ echo "off";} ?>"></label>
</div>

<button type="button" class="btn btn-success openControlTransModal">Update</button>
<div class="controlFixed" style="display: none;">
<div class="givebillingCode" style="position: relative; z-index: 99999;">
<header><h2>Control Access</h2></header>
<div class="TransSucesss"></div>
<div class="fieldBox">

</div>
<div class="buttonsContainer">
    
<form action="activate.php" method="post">
<input type="hidden" name="userid" value="<?php echo $ID ?>">
<input type="hidden" name="email" value="<?php echo $Email ?>">

<button type="submit" name="deactivate" class="btn btn-primary">Deactivate</button> 
<button type="submit" name="activate" class="btn btn-primary">Activate</button> 

<button type="button" class="btn btn-danger CancelUpdateTranControl">Cancel</button>
</form>
  
  
</div>
</div> 
</div>  
</td>


</tr>     


<?php

}

}else {
echo "No Recent Transaction yet";
}
?>
</tbody>
</table>
</div>

</div>
</div>




<div class="row">
<div class="col-md-12">
<div class="copyright">
<p>Copyright © <?php echo date('Y'); ?> <a href="/personal/"> SpringWellFinance</a>.</p>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- END MAIN CONTENT-->
<!-- END PAGE CONTAINER-->
</div>

</div>

<div class="modal fade" id="CompTrans" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog" role="document">
      <div class="modal-content">
        <div class="modal-header">
          <h5 class="modal-title" id="exampleModalLabel">Complete a transaction</h5>
          <button type="button" class="close" data-dismiss="modal" aria-label="Close">
            <span aria-hidden="true">&times;</span>
          </button>
        </div>
        <div class="modal-body">
        <form  action="#" method="post" id="completeTrans">
            <div class="form-group">
                <label> Insert Activation Code </label>
                <input class="au-input au-input--full" type="text" name="ActCode" placeholder="Insert Activation Code " id="ActCode" required>
            </div>
      <div class="form-group">
          <label> Select Transaction </label>
          <select name="Currency" id="TransID" style="width: 100%; height: 45px;" required>
          <?php 
          while ($Transactions = mysqli_fetch_assoc($TransForAct)) {
              $ID = $Transactions['ID'];
              $requestID = $Transactions['ID'];
              $Customer = $Transactions['UserID'];
                          // get customer Data 
              $customerQuery = mysqli_query($connect, "SELECT * FROM customers WHERE ID = '$Customer'");
              $fetchCustomer = mysqli_fetch_assoc($customerQuery);
  
              $Fullname = $fetchCustomer['AccFullname'];
          ?>

          <option value="<?php echo $ID; ?>"><?php echo $requestID." - ".$Fullname; ?></option>
          <?php
          }
          ?>
          </select>
      </div>    
  </form>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
          <button type="submit" id="completeTrans" class="btn btn-primary">Complete</button>
        </div>
      </div>
    </div>
  </div>
  <div class="modal fade" id="backDate" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog" role="document">
      <div class="modal-content">
        <div class="modal-header">
          <h5 class="modal-title" id="exampleModalLabel">Change Date </h5>
          <button type="button" class="close" data-dismiss="modal" aria-label="Close">
            <span aria-hidden="true">&times;</span>
          </button>
        </div>
        <div class="modal-body">
        <form  action="#" method="post" id="backDate">
        <br>
        <div class="form-group">
            <label> Enter Time (No AM or PM)</label>
            <input class="au-input au-input--full" type="text" name="NewTime" placeholder="e.g 11:23" id="NewTime">
        </div>    
        <div class="form-group">
            <label> AM or PM ? </label>
            <select name="Account" id="Format" style="width: 100%; height: 45px;" required>
              <option value="AM">AM</option>
              <option value="PM">PM</option>
            </select>
        </div> 
        <div class="form-group">
            <label> Enter Date (Format YYYY-MM-DD)</label>
            <input class="au-input au-input--full" type="text" name="NewDate" placeholder="e.g 2020-04-31" id="NewDate">
        </div> 
      
  </form>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
          <button type="submit" id="backDateButton" class="btn btn-primary">Back Date </button>
        </div>
      </div>
    </div>
<!-- Jquery JS-->
<script src="/personal/admin/js/sweetalert2.all.min.js"></script>
<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>

<!-- Main JS-->
<script src="js/main.js"></script>

</body>

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



<?php
}

?>