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

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



}

$datas=$this->session->userdata('client');
$datas = str_replace(' ', '%20', $datas);
$datas=trim($datas);

?><!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">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
  <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;
}
@media (max-width: 768px) {
    /* CSS in here for mobile only */
    h3 {
        color:red;padding-left:7% !important;font-weight:bolder; text-align: center;
    }
}
@media (min-width: 769px) and (max-width: 1024px) {
    /* CSS in here for tablet only */
    h3 {
        font-size: 28px !important;
    }
}
</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="https://evoting.site/index.php/Login/Log_Out/ " style=" color:white;font-weight:bolder" class="btn btn-info">LOGOUT</a>
      </li>
    </ul>
  </nav>
  <nav class="main-sidebar sidebar-dark-primary elevation-4">
    <!-- 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>
   <!--    <li class="nav-item d-none d-sm-inline-block">
        <a  href="<?php  echo base_url()."assets/"; ?>index3.html" class="nav-link">Home</a>
      </li>
      <li class="nav-item d-none d-sm-inline-block">
        <a href="#" class="nav-link">Contact</a>
      </li> -->
    </ul>

    <!-- Right navbar links -->
    <!--<ul class="navbar-nav ml-auto">-->
      <!-- Messages Dropdown Menu -->
    <!--  <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" style="background: linear-gradient(to right, #3396FF 0%, #263F59 100%);">LOGOUT</a>-->
    <!--  </li>-->
    <!--</ul>-->
  </nav>
    </ul>
  </nav>
  <!-- /.navbar -->

  <!-- Main Sidebar Container -->
  <aside class="main-sidebar  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 has-treeview">
            <a href="<?php echo base_url();?>index.php/Login/show_data/ <?php echo $datas;?>" class="nav-link">
              <i class="nav-icon fas fa-tachometer-alt"></i>
              <p>
                PROFILE
                
              </p>
            </a>
          </li>
         
          <li class="nav-item">
            <a href="<?php echo base_url();?>index.php/Show_Voting_Data_Client/VotingTitlesDataClient/ <?php echo $datas;?>" class="nav-link">
              <i class="nav-icon far fa-image"></i>
              <p>
                Ballot
              </p>
            </a>
          </li>
      </nav>
      <!-- /.sidebar-menu -->
    </div>
    <!-- /.sidebar -->
  </aside>
  <div class="content-wrapper" >
    <section class="content-header" style="background: linear-gradient(to right, #3396FF 0%, #263F59 100%);">
      <div class="container-fluid">
        <div class="row"> 
          <?php
                if (isset($data)) 
                { 
            ?>
         <h3 style="color:white;padding-left:30%;font-weight:bolder; text-align: center;">WELCOME TO ONLINE VOTING FOR <span style="color:white"> <?php echo $data[0]->ballot_name ?> </span> <br><br></h3> 
         <?php
                }
            ?>       
        </div> 
        <form action=" " method="POST">
        <div class="row">
        
            <?php
                if (isset($data)) 
                    foreach($data as $row)
                {
            ?>
                <div class="col-md-4">
                    <div class="card card-widget widget-user">
                    <div class="widget-user-header" style="background: linear-gradient(to right, #ffcc00 0%, #ff0066 100%)">
                      <h4 class="widget-user-username" style="font-weight:900; color: #fff;"><?php echo $row->participant_name ?> </h4>
                    </div>

                    <div class="widget-user-image">
                    <img style="width: 100px; height: 100px;" class="img-circle elevation-2" src=" <?php echo $row->img_url; ?>" class="rounded"  alt="User Avatar">
                    </div>
                    <div class="card-footer">
                        <div class="row">
                        <div class="col-sm-12">
                              <center><p class="widget-user-username" style="font-weight:500; text-align: center; font-size: 15px;">Place: <?php echo $row->place ?> </p> <br><br>
                                <a href="<?php echo base_url();?>index.php/Update_Voting/vote_update/?participant_name=<?php echo $row->participant_name;?>&ballot_name=<?php echo $data[0]->ballot_name ?>&ip_address=<?php echo $_SERVER['REMOTE_ADDR']?>"  class="btn btn-primary btn-lg" style="color:white;" onclick="return confirm('Are you sure you want to vote <?php echo $row->participant_name;?> for <?php echo $data[0]->ballot_name ?>??')"> vote </a> 
                          <!--   <span class="description-text" style="background: linear-gradient(to right, #ffcc00 0%, #ff0066 100%);
                              padding: 9px;
                              color: #fff;"> <input type="radio" class="btn btn-warning" href="<?php echo base_url();?>index.php/Update_Voting/vote_update/?participant_name=<?php echo $row->participant_name;?>&ballot_name=<?php echo $data[0]->ballot_name ?>"  class="btn btn-sm" style="background: linear-gradient(to right, #ffcc00 0%, #ff0066 100%);color:#fff;"> Vote </span> --></center> 
                        </div>
                        </div>
                        
                     
                    </div>
                    </div>
                    <!-- /.widget-user -->
                  
                </div>
                  <!-- /.col -->
                        <?php
                      }
                    else
                    { 

                  ?>
                  <h1> No Candidates found </h1>
                  <?php
                    
                    } 

                  ?>
                </div>
                </form>
                <!--<center><span style="font-size: 20px; color: #fff;"><input type="checkbox" name="agree" id="agree"> Agree to vote for above</span>-->
            <br><br><br><br>
            <!--<span class="description-text" style="background: linear-gradient(to right, #ffcc00 0%, #ff0066 100%);-->
            <!--                  padding: 9px;-->
            <!--                  color: #fff;">-->
                 <!--<input type="radio" class="btn btn-warning" href="<?php //echo base_url();?>index.php/Update_Voting/vote_update/?participant_name=<?php //echo $row->participant_name;?>&ballot_name=<?php //echo $data[0]->ballot_name ?>"  class="btn btn-sm" style="background: linear-gradient(to right, #ffcc00 0%, #ff0066 100%);color:#fff;">-->
               
               	
            <!--<a href="<?php //echo base_url();?>index.php/Update_Voting/vote_update/?participant_name=<?php //echo $row->participant_name;?>&ballot_name=<?php //echo $data[0]->ballot_name ?>"  class="btn btn-primary btn-lg" style="color:white;"> vote </a>  </span>-->
               <!--<button onclick="myFunction()" class="btn btn-primary btn-lg" style="color:white;">Click me to Vote</button>-->
                </center>
              
                <h1 style="color:red"> <marquee behavior="scroll" direction="left"><?php echo "Your ip is being tracked:".$_SERVER['REMOTE_ADDR'] ;?></marquee> </h1>
                <!-- /.row -->
              </div>
            </div>
            <!-- /.widget-user -->
          </div>
          <!-- /.col -->
         
      </div>
      </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><a href=""></a>.</strong> 
  </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>
<!-- AdminLTE for sweetalert -->
  <!-- sweetalert2 -->
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<script>	
 function myFunction() {
     
            var link = document.querySelector("a"); 
            link.getAttribute("href"); 
            alert(link.getAttribute("href"));
     
        
        } 
         

</script>
</body>
</html>