<?php require_once('head.php'); ?>

  <body>
  <!-- container section start -->
  <section id="container" class="">
      
	<?php require_once('header.php'); ?>	

	<?php require_once('sidebar.php'); ?>
      
      <!--main content start-->
      <section id="main-content">
          <section class="wrapper">

			  <div class="row">
                  <div class="col-lg-12">
                      <!--breadcrumbs start -->
                      <ul class="breadcrumb">
                          <li><a href="dashboard.php"><i class="icon_house_alt"></i> Accounts</a></li>
                          <li class="active"> New Applications</li>
						  <li class="pull-right"> <i class="icon_calendar"></i>
							 <?php echo date('l jS F Y'); ?></li>
                      </ul>
                      <!--breadcrumbs end -->
                  </div>
              </div>		  
			  
			  <!-- knob charts -->
            <div class="row">
                  <div class="col-lg-12">                      
                      <aside class="profile-nav alt">
                          <section class="panel">
                            <div class="">
                              <div class="user-heading alt bg-layer profile-widget-info">                                
                                  <a href="#">
                                      <img alt="Administrator" src="../users/user.png">
                                  </a>
                                  <h1><?php echo WEB_NAME ?></h1>
                                  <h4>Welcome, Administrator</h4>
                                  </div>
                              </div>

                              <div class="weather-category profile-widget-data">
                                      <ul>
                                          <li class="active">
                                              <h5>Last login on:</h5>
											  <?php if ($row['last_ts'] == "0000-00-00 00:00:00") { echo ""; }else{ echo date('l jS F Y', strtotime($row['last_ts']));} ?>
                                          </li>
                                          <li>
                                              <h5>Last login From:</h5>
                                              <a href="http://api.hostip.info/get_html.php?ip=<?php echo $row['last_ip']; ?>" target="_blank">
											  <img src="http://api.hostip.info/flag.php?ip=<?php echo $row['last_ip']; ?>" alt="Country" width="39" height="24">
											  </a>
                                          </li>
                                          <li>
                                              <h5>Last login IP:</h5>
                                              <?php echo $row['last_ip']; ?>
                                          </li>
                                      </ul>
                                  </div>

                          </section>
                      </aside>                                            
                  </div>
                </div>
			  
			  <!-- Recent Transactions Starts -->
			  <div class="row">
                  <div class="col-lg-12">
                      <section class="panel">
                          <header class="panel-heading">
                              Newly Submitted Applications
                          </header>
						  
						  <div class="panel-body">
						  
						  <p>Find below newly submitted applications click on the activate button to activate them</p>
						  
                          <section class="panel">
                          <header class="panel-heading">
                              Newly Submitted Applications
                          </header>
                          <table class="table table-striped border-top" id="sample_1">
  <thead>
    <tr>     
      <th>Date</th>
		<th>Full Name</th>
		<th>Email</th>
		<th>View</th>
		<th>Activate</th>
		<th>Delete</th>
    </tr>
  </thead>
  <tbody>
	<?php
		dbconnect();
		$sql = "SELECT * FROM `".USERS_TABLE_NAME."` WHERE user_status='0' ORDER BY user_id DESC";
		$stmt = $pdo->query($sql);
		while($row = $stmt->fetch(PDO::FETCH_ASSOC)){ 
	?>  
    <tr class="odd gradeX">
        <td><?php echo date('jS F Y', strtotime($row['user_registered'])); ?></td>
		<td><?php echo $row['first_name']; ?> <?php echo $row['last_name']; ?></td>
		<td><?php echo $row['user_email']; ?></td>
		<td><a href="view.php?user=<?php echo $row['user_id']; ?>" class="btn btn-warning btn-rad">View</a></td>
		<td><a href="activate.php?user=<?php echo $row['user_id']; ?>" class="btn btn-success btn-rad">Activate</a></td>
		<td><a href="delete.php?user=<?php echo $row['user_id']; ?>&id=<?php echo $row['user_email']; ?>" onClick="javascript:return confirm('Are you sure you want to delete this Application?');" class="btn btn-danger btn-rad">Delete</a></td>
    </tr>
    <?php } ?>
  </tbody>
</table>
                      </section>

						</div>
                      </section>
                  </div>
              </div>
			  <!-- Recent Transactions end -->

              

          </section>
      </section>
      <!--main content end-->
  </section>
  <!-- container section start -->

    <!-- javascripts -->
    <script src="../js/jquery.js"></script>
    <script src="../js/bootstrap.min.js"></script>
    <!-- nice scroll -->
    <script src="../js/jquery.scrollTo.min.js"></script>
    <script src="../js/jquery.nicescroll.js" type="text/javascript"></script>
    <!-- data tables js -->
    <script type="text/javascript" src="../assets/data-tables/jquery.dataTables.js"></script>
    <script type="text/javascript" src="../assets/data-tables/DT_bootstrap.js"></script>
    <!-- dynamic table cuatom script for this page only-->
    <script src="../js/dynamic-table.js"></script>
    <!--custome script for all page-->
    <script src="../js/scripts.js"></script>

  </body>
</html>