<?php
    if(!isset($_SESSION['form_array'])){
        $_SESSION['form_array'] = []; 
    }
    if(isset($_REQUEST['form_id_num'])){
         if(!in_array($_REQUEST['form_id_num'], $_SESSION['form_array'])) {
         array_push($_SESSION['form_array'],$_REQUEST['form_id_num']);
    }else{
        $_REQUEST = [];
        $_POST = [];
    }
    }
$bankdata = new bank;
?>

<!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">
  <title>Admin Dashboard</title>
  <!-- plugins:css -->
  <link rel="stylesheet" href="/vendors/mdi/css/materialdesignicons.min.css">
  <link rel="stylesheet" href="/vendors/base/vendor.bundle.base.css">
  <!-- endinject -->
    <link rel="stylesheet" href="/vendors/datatables.net-bs4/dataTables.bootstrap4.css">
  <!-- inject:css -->
  <link rel="stylesheet" href="/css/adm_style.css">
  <!-- endinject -->
  <link rel="shortcut icon" href="/images/favicon.png" />
  <script src="/node_modules/sweetalert2/dist/sweetalert2.min.js"></script>
<link rel="stylesheet" href="/node_modules/sweetalert2/dist/sweetalert2.min.css">
<script>
window.addEventListener('DOMContentLoaded', function() {
// Get all the forms on the page
const forms = document.querySelectorAll('form');

// Function to generate a random number
function generateRandomNumber() {
  return Math.floor(Math.random() * 100000000); // Adjust the range as per your requirement
}
// console.log(generateRandomNumber);
// Loop through each form and add a hidden input field with a random number
forms.forEach(form => {
  const randomNumber = generateRandomNumber();
  // Create a hidden input element
  const input = document.createElement('input');
  input.type = 'hidden';
  input.name = 'form_id_num';
  input.value = randomNumber;
  // Append the hidden input to the form
  form.appendChild(input);
});
});

</script>
</head>
<body>
 ` <div class="container-scroller">
    <!-- partial:partials/_navbar.html -->
    <nav class="navbar col-lg-12 col-12 p-0 fixed-top d-flex flex-row">
            <div class="navbar-brand-wrapper d-flex justify-content-center">
        <div class="navbar-brand-inner-wrapper d-flex justify-content-between align-items-center w-100">  
          <a class="navbar-brand brand-logo" href="/dashboard"><img src="/images/logo.svg" alt="logo"/></a>
          <a class="navbar-brand brand-logo-mini" href="/dashboard"><img src="/images/logo.svg" alt="logo"/></a>
          <button class="navbar-toggler navbar-toggler align-self-center" type="button" data-toggle="minimize">
            <span class="mdi mdi-sort-variant"></span>
          </button>
        </div>  
      </div>
      <div class="navbar-menu-wrapper d-flex align-items-center justify-content-end">
        <ul class="navbar-nav mr-lg-4 w-100">
          <li class="nav-item nav-search d-none d-lg-block w-100">
            <div class="input-group">
              <div class="input-group-prepend">
                <span class="input-group-text" id="search">
                  <i class="mdi mdi-magnify"></i>
                </span>
              </div>
              <input type="text" class="form-control" placeholder="Search now" aria-label="search" aria-describedby="search">
            </div>
          </li>
        </ul>
        <ul class="navbar-nav navbar-nav-right">
          <li class="nav-item nav-profile dropdown">
            <a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown" id="profileDropdown">
              <img src="/images/user.svg" alt="profile"/>
              <span class="nav-profile-name">Admin User</span>
            </a>
            <div class="dropdown-menu dropdown-menu-right navbar-dropdown" aria-labelledby="profileDropdown">
              <a href="/admin/logout" class="dropdown-item">
                <i class="mdi mdi-logout text-primary"></i>
                Logout
              </a>
            </div>
          </li>
        </ul>
        <button class="navbar-toggler navbar-toggler-right d-lg-none align-self-center" type="button" data-toggle="offcanvas">
          <span class="mdi mdi-menu"></span>
        </button>
      </div>
    </nav>
    <!-- partial -->
    <div class="container-fluid page-body-wrapper">
      <!-- partial:partials/_sidebar.html -->
      <nav class="sidebar sidebar-offcanvas" id="sidebar">
        <ul class="nav">
          <li class="nav-item">
            <a class="nav-link" href="/admin">
              <i class="mdi mdi-home menu-icon"></i>
              <span class="menu-title">Dashboard</span>
            </a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="/admin/client_list">
              <i class="mdi mdi-bank menu-icon"></i>
              <span class="menu-title">Bank Accounts</span>
            </a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="/admin/register_list">
              <i class="mdi mdi-file-document-box-outline menu-icon"></i>
              <span class="menu-title">Registered Client</span>
            </a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="/admin/contact">
              <i class="mdi mdi-message menu-icon"></i>
              <span class="menu-title">Contact Message</span>
            </a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="/admin/logout">
              <i class="mdi mdi-home menu-icon"></i>
              <span class="menu-title">Log Out</span>
            </a>
          </li>
        </ul>
      </nav>
      <!-- partial -->
      <div class="main-panel">
      <?php 
      if(pages != null){
        define('cur_active',pages);
    }else{
        define('cur_active','dashboard');
    }
                        switch(cur_active) {
                            case 'dashboard':
                                include('dashboard.php');
                            break;
                            case 'newsletter':
                              include('newsletter.php');
                          break;
                            case 'client_data':
                                include('client_data.php');
                            break;
                            case 'client_list':
                                include('client_list.php');
                            break;
                            case 'contact':
                              include('contact.php');
                          break;
                            case 'register_list':
                                include('register_list.php');
                            break; 
                            case 'view_client':
                              include('view_client.php');
                          break;
                          case 'view_register':
                            include('view_register.php');
                        break;                            
                            default:
                            include('dashboard.php');
                        }
                ?>
        <!-- partial:partials/_footer.html -->
        <footer class="footer">
          <div class="d-sm-flex justify-content-center justify-content-sm-between">
            <span class="text-muted text-center text-sm-left d-block d-sm-inline-block">Copyright © 2020 <a> Bank</a> All rights reserved.</span>
          </div>
        </footer>
        <!-- partial -->
      </div>
      <!-- main-panel ends -->
    </div>
    <!-- page-body-wrapper ends -->
  </div>
  <!-- container-scroller -->

  <!-- plugins:js -->
  <script src="/vendors/base/vendor.bundle.base.js"></script>
    <script src="vendors/datatables.net/jquery.dataTables.js"></script>
  <script src="vendors/datatables.net-bs4/dataTables.bootstrap4.js"></script>
  <!-- endinject -->
  <!-- Plugin js for this page-->
  <script src="/vendors/chart.js/Chart.min.js"></script>
  <!-- End plugin js for this page-->
  <!-- inject:js -->
  <script src="/js/off-canvas.js"></script>
  <script src="/js/hoverable-collapse.js"></script>
  <script src="/js/template.js"></script>
  <!-- endinject -->
  <!-- Custom js for this page-->
  <script src="/js/dashboard.js"></script>
  <!-- End custom js for this page-->
</body>

</html>

