<?php
defined('BASEPATH') OR exit('No direct script access allowed');

if(!($this->session->userdata('super_admin'))){
 
  redirect ('/Login');

}

?>

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>ACCE ONLINE VOTING</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <!-- Font Awesome -->
  <link rel="stylesheet"  href="<?php  echo base_url()."assets/"; ?>plugins/fontawesome-free/css/all.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
  <!-- Theme style -->
  <link rel="stylesheet"  href="<?php  echo base_url()."assets/"; ?>dist/css/adminlte.min.css">
  <!-- Google Font: Source Sans Pro -->
  <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">

  <style>
table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
  border: 1px solid #ddd;
}

th, td {
  text-align: left;
  padding: 16px;
}

tr:nth-child(even) {
  background-color: lightblue;
}
</style>
</head>
<body class="hold-transition sidebar-mini">
<div class="wrapper">
  <!-- Navbar -->
  <nav class="main-header navbar navbar-expand navbar-white navbar-light">
    <!-- Left navbar links -->
    <ul class="navbar-nav">
      <li class="nav-item">
        <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
      </li>
     
    </ul>

    <!--<form class="form-inline ml-3">-->
    <!--  <div class="input-group input-group-sm">-->
    <!--    <input class="form-control form-control-navbar" type="search" placeholder="Search" aria-label="Search">-->
    <!--    <div class="input-group-append">-->
    <!--      <button class="btn btn-navbar" type="submit">-->
    <!--        <i class="fas fa-search"></i>-->
    <!--      </button>-->
    <!--    </div>-->
    <!--  </div>-->
    <!--</form>-->

    <!-- Right navbar links -->
    <ul class="navbar-nav ml-auto">
    <li class="nav-item dropdown">
        <a href="<?php echo base_url()."index.php/Login/Log_Out/";?> " style=" color:white;font-weight:bolder" class="btn btn-info">LOGOUT</a>
      </li>
    </ul>
  </nav>
  <!-- /.navbar -->

  <!-- Main Sidebar Container -->
  <aside class="main-sidebar sidebar-dark-primary elevation-4">
    <!-- Brand Logo -->

    <!-- Sidebar -->
    <div class="sidebar">
      <!-- Sidebar user (optional) -->
      <div class="user-panel mt-3 pb-3 mb-3 d-flex">
        <div class="image">
          <img src="<?php  echo base_url()."assets/"; ?>dist/img/user2-160x160.jpg" class="img-circle elevation-2" alt="User Image">
        </div>
        <div class="info">
          <a href="#" class="d-block"></a>
        </div>
      </div>

      <!-- Sidebar Menu -->
      <nav class="mt-2">
        <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
          <!-- Add icons to the links using the .nav-icon class
               with font-awesome or any other icon font library -->
          <li class="nav-item">
            <a href="<?php  echo base_url()."index.php/Dashboard_Controller/Count_Func"; ?>"  class="nav-link">
            <i class="nav-icon fas fa-tachometer-alt"></i>
                  <p>DASHBOARD</p>
                </a>
            </li>  

          <li class="nav-item">
          <a href="<?php  echo base_url()."index.php/Login/userList"; ?>"  class="nav-link">
            <i class="nav-icon fas fa-tachometer-alt"></i>
                  <p>USER-LIST</p>
                </a>
            </li>   

          <li class="nav-item has-treeview">
            <a href="#" class="nav-link">
            <i class="nav-icon fas fa-tachometer-alt"></i>
              <p>
                MASTER
                <i class="right fas fa-angle-left"></i>
              </p>
            </a>
            <ul class="nav nav-treeview">
            <li class="nav-item">
              <a href="<?php  echo base_url()."index.php/Add_Client_Contoller/Add_Client_View" ;?>"  class="nav-link">
                  <i class="far fa-circle nav-icon"></i>
                  <p>ADD USER</p>
                </a>
            </li>

            <li class="nav-item">
              <a href="<?php  echo base_url()."index.php/Import_CSV/" ;?>"  class="nav-link">
                  <i class="far fa-circle nav-icon"></i>
                  <p>ADD USER-LIST</p>
                </a>
            </li>

            <li class="nav-item">
            <a href="<?php  echo base_url()."index.php/Add_Zone_Controller/Add_Zone_View/"; ?>"  class="nav-link">
                  <i class="far fa-circle nav-icon"></i>
                  <p>ADD ZONE</p>
                </a>
            </li>

            <li class="nav-item">
            <a href="<?php  echo base_url()."index.php/Add_Ballot_Controller/Add_Ballot_View/"; ?>"  class="nav-link">
                  <i class="far fa-circle nav-icon"></i>
                  <p>ADD BALLOT</p>
                </a>
            </li>

            <li class="nav-item">
            <a href="<?php  echo base_url()."index.php/Add_Participant_Controller/AddCandidates/"; ?>"  class="nav-link">
                  <i class="far fa-circle nav-icon"></i>
                  <p>ADD PARTICIPANT</p>
                </a>
            </li>

            <li class="nav-item">
            <a href="<?php  echo base_url()."index.php/Add_SMTP_Controller/Add_Smtp_View/"; ?>"  class="nav-link">
                  <i class="far fa-circle nav-icon"></i>
                  <p>ADD SMTP</p>
                </a>
            </li>

            </ul>
          </li>
         
          <li class="nav-item has-treeview">
          <a href="<?php  echo base_url()."index.php/Ballot_Controller_Admin/Show_Ballots/"; ?>"  class="nav-link">
            <i class="nav-icon fas fa-tachometer-alt"></i>
              <p>
              BALLOT
                <i class="right fas fa-angle-left"></i>
              </p>
            </a>
            <ul class="nav nav-treeview">
            <li class="nav-item">
            <a href="<?php  echo base_url()."index.php/Ballot_Controller_Admin/Show_Ballots/"; ?>"  class="nav-link">
                  <i class="far fa-circle nav-icon"></i>
                  <p>VIEW BALLOT</p>
                </a>
            </li>

            <li class="nav-item">
              <a href="<?php  echo base_url()."index.php/Voted_List_Controller/vote_list/"; ?>"  class="nav-link">
                  <i class="far fa-circle nav-icon"></i>
                  <p>VIEW &nbsp; VOTED LIST</p>
                </a>
            </li>
            </ul>
          </li>

          <li class="nav-item">
          <a href="<?php  echo base_url()."index.php/Report_Controller/"; ?>"  class="nav-link">
            <i class="nav-icon fas fa-tachometer-alt"></i>
                  <p>REPORT</p>
                </a>
            </li>

        </ul>
      </nav>
      <!-- /.sidebar-menu -->
    </div>
    <!-- /.sidebar -->
  </aside>
  
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
             <div class="row">
          <div class="col-sm-6">
            <!--<h1>Profile</h1>-->
            <?php if(isset($_SESSION['ballot_added'])){?>
                   <br><div class="alert alert-info"> <?php echo $_SESSION['ballot_added']; ?></div>
              <?php } ?> 
          </div>
          <!--<div class="col-sm-6">-->
          <!--  <ol class="breadcrumb float-sm-right">-->
          <!--    <li class="breadcrumb-item"><a href="#">Home</a></li>-->
          <!--    <li class="breadcrumb-item active">User Profile</li>-->
          <!--  </ol>-->
          <!--</div>-->
           <div class="col-sm-6">
      <button class="btn btn-primary dropdown-toggle form-group" type="button" data-toggle="dropdown" >Sort Ballot
      <span class="caret"></span></button>
      <ul class="dropdown-menu">
          <?php
           if (isset($bdata))
              foreach($bdata as $row)
                  {
                    
          ?>
          
          <li><a class="form-group" href="<?php  echo base_url()."index.php/Sort_Table/sort_values/"; ?> <?php echo $row->ballot_name ?>" > <option value=<?php echo $row->ballot_name ?> > <?php echo $row->ballot_name ?></option></a>
        </li>
            
        <?php
                } 
                 
          ?> 
            <a href="<?php  echo base_url()."index.php/Voted_List_Controller/vote_list/"; ?>" >All </a>  
          
          </ul>
    </div>
        </div>
       </div>  
      </div><!-- /.container-fluid -->
    </section>
      
      
  
    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <div class="row">
          <div class="col-12">
            <div class="card">
              <div class="card-header">
                <!--<h3 class="card-title">DataTable</h3>-->
              
              </div>
              <!-- /.card-header -->
              <div class="card-body">
                <table  id="myTable" class="table table-bordered table-hover">
                  <thead>
                  <tr>
                    <th>BALLOT</th>
                    <th>ID</th>
                    <th>NAME</th>
                    <th>VOTED TIME</th>
                    <th>VOTED</th>
                   
                  </tr>
                  </thead>
                  <tbody>
                  <?php
                  if (isset($data))
                    foreach($data as $row)
                      {
						  
                        ?>
                         <tr>
                         <td><?php echo $row->ballot_name ?> </td>
                         <td><?php echo $row->client_id ?> </td>
                          <td><?php echo isset($row->uname) ? $row->uname: $row->name ?> </td>
                         <td><?php echo $row->vote_date_time ?> </td>
                         <td><?php
                         if( $row->vote)
                            echo "VOTED";
                         else
                            echo "NOT VOTED";  ?> </td>
                         
                         </tr>
                     <?php
                      }
                    ?>

                  </tbody>
                  <tfoot>
                  <tr>
                     <th>BALLOT</th>
                    <th>ID</th>
                    <th>NAME</th>
                    <th>VOTED TIME</th>
                    <th>VOTED</th>
                  </tr>
                  </tfoot>
                </table>
              </div>
              <!-- /.card-body -->
            </div>
           
          </div>
          <!-- /.col -->
        </div>
        <!-- /.row -->
      </div>
      <!-- /.container-fluid -->
    </section>
    <!-- /.content -->
  </div>


  <!-- /.content-wrapper -->
  <footer class="main-footer">
    <div class="float-right d-none d-sm-block">
      <b>Version</b> 3.0.5
    </div>
    <strong>Copyright &copy; 2014-2019 <a href="http://adminlte.io">BEDRE WEB SOLUTIONS</a>.</strong> All rights
    reserved.
  </footer>

  <!-- Control Sidebar -->
  <aside class="control-sidebar control-sidebar-dark">
    <!-- Control sidebar content goes here -->
  </aside>
  <!-- /.control-sidebar -->
</div>
<!-- ./wrapper -->

<!-- jQuery -->
<script src="<?php  echo base_url()."assets/"; ?>plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="<?php  echo base_url()."assets/"; ?>plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE App -->
<script src="<?php  echo base_url()."assets/"; ?>dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="<?php  echo base_url()."assets/"; ?>dist/js/demo.js"></script>

<script>
function myFunction() {
  var input, filter, table, tr, td, i, txtValue;
  input = document.getElementById("myInput");
  filter = input.value.toUpperCase();
  table = document.getElementById("myTable");
  tr = table.getElementsByTagName("tr");
  for (i = 0; i < tr.length; i++) {
    td = tr[i].getElementsByTagName("td")[0];
    if (td) {
      txtValue = td.textContent || td.innerText;
      if (txtValue.toUpperCase().indexOf(filter) > -1) {
        tr[i].style.display = "";
      } else {
        tr[i].style.display = "none";
      }
    }       
  }
}
</script>

<!-- AdminLTE for datatables -->

<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script src="https://cdn.datatables.net/1.10.23/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.6.5/js/dataTables.buttons.min.js"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/buttons/1.6.5/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.6.5/js/buttons.print.min.js"></script>
<link href="https://cdn.datatables.net/1.10.23/css/jquery.dataTables.min.css" rel="stylesheet">

<script>
$(document).ready(function() {
    $('#myTable').DataTable( {
        dom: 'Bfrtip',
        buttons: [
            'csv', 'excel', 'pdf'
        ]
    } );
} );
</script>
</body>
</html>
