<?php session_start(); ?>
<?php if(isset($_SESSION['nama_peserta'])){ ?>
<?php
	include "koneksi.php";
	error_reporting(0);
?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>CRM DIGITAL TAPERA</title>	
	<link rel="stylesheet" href="https://cdn.datatables.net/1.10.2/css/jquery.dataTables.min.css">
	<script type="text/javascript" src="https://cdn.datatables.net/1.10.2/js/jquery.dataTables.min.js"></script>
	<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
	<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
	<link rel="stylesheet" href="https://cdn.datatables.net/1.10.2/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.2/js/jquery.dataTables.min.js"></script>

	<!-- Bootstrap -->
	<link href="css/bootstrap.min.css" rel="stylesheet">
	<link href='img/logo6.jpg' rel='shortcut icon'>
	<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
	<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
	<!--[if lt IE 9]>
		<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
		<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
	<![endif]-->
	

<script>
		function hanyaAngka(evt) {
		  var charCode = (evt.which) ? evt.which : event.keyCode
		   if (charCode > 31 && (charCode < 48 || charCode > 57))
 
		    return false;
		  return true;
		}
	</script>

<script type="text/javascript">
				function eraseText() {
				 document.getElementById("keperluan").value = "";
				 
				 document.getElementById("permintaan").value = "";
				 document.getElementById("permasalahan").value = "";
				 
				 document.getElementById("permintaan1").value = "";
				 document.getElementById("penyebab").value = "";
				}
	</script>

<style>
.navbar-default .navbar-nav>li>a {
    color:black;
    TEXT-DECORATION: none;
    WHITE-SPACE: nowrap;
    DISPLAY: block;
}


.h2{
	color:white;
}

.carousel-inner{
  margin-top:60px;
}
.carousel-inner .item {
    height:550px;
  }

.carousel-inner #slide1 {
  background: url('img/kontak.jpg') ;
  background-size: cover;
  background-position: top center;
  background-repeat: no-repeat;
}

.carousel-inner #slide2 {
  background: url('img/gedung.jpg') ;
  background-size: cover;
  background-position: top center;
  background-repeat: no-repeat;
}

.carousel-inner #slide3 {
  background: url('img/tangan.jpg') ;
  background-size: cover;
  background-position: top center;
  background-repeat: no-repeat;
}

.carousel-inner .carousel-caption h3 {
  color: #fff;
  margin: 0;
  align-items: center;
  font-size: 30px;
  font-weight: 700;
}

.carousel-inner .carousel-caption p {
  -webkit-animation-delay: 0.4s;
  animation-delay: 0.4s;
  color: #fff;
  margin-top: 10px;

}

.tentang {
  margin-top:60px;
  padding:20px;
  margin:40px;
 text-align:center;
}

.tentang p {
  max-width: 950px;
  text-align:center;
  margin-left:12%;
}


.bg-4 { 
    background-color: #2f2f2f;
    color: #fff;
}

footer{
    padding-top: 70px;
    padding-bottom: 70px;
  }

.container .row .thumbnail {
  padding-bottom: 70px;
}


@media screen and (max-width: 768px) {
  .jumbotron {
    padding-top:20px;
    padding-bottom:20px;
  }
}


	</style>
	<script>
		function hanyaAngka(evt) {
		  var charCode = (evt.which) ? evt.which : event.keyCode
		   if (charCode > 31 && (charCode < 48 || charCode > 57))
 
		    return false;
		  return true;
		}
	</script>
	
	<script type="text/javascript">
				function eraseText() {
				 document.getElementById("keperluan").value = "";
				 
				 document.getElementById("permintaan").value = "";
				 document.getElementById("permasalahan").value = "";
				 
				 document.getElementById("permintaan1").value = "";
				 document.getElementById("penyebab").value = "";
				}
	</script>
</head>
<body style="background:white;">
<nav class="navbar navbar-default navbar-fixed-top">
  <div class="container-fluid">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>                        
      </button>
	<img  src="img/logo5.png" width="215px">
    </div>
    <div class="collapse navbar-collapse" id="myNavbar">
      <ul class="nav navbar-nav">
		<li><a href="index.php">HOME <span class="sr-only">(current)</span></a></li>
    <li><a href="datapeserta.php">DATA PESERTA</a></li>
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">LAYANAN<span class="caret"></span></a>
          <ul class="dropdown-menu">
            <li class="active"><a href="layananpengaduan.php">LAYANAN PENGADUAN</a></li>
            <li><a href="layananchat.php">LAYANAN CHAT</a></li>
            <li><a href="layanancallcenter.php">CALL CENTER & EMAIL</a></li>
          </ul>
        </li>
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">CARA<span class="caret"></span></a>
          <ul class="dropdown-menu">
            <li><a href="carapengaduan.php">MENGGUNAKAN LAYANAN PENGADUAN</a></li>
            <li><a href="carachat.php">MENGGUNAKAN LAYANAN CHAT</a></li>
            <li><a href="caracsdanemail.php">MENGGUNAKAN CALL CENTER & EMAIL</a></li>
          </ul>
        </li>
				<li><a href="profile.php">PROFIL</a></li>

			</ul>
				
			  <ul class="nav navbar-nav navbar-right">
				<li class="dropdown">
				  <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><?php echo $_SESSION['nama_peserta']; ?> <span class="caret"></span></a>
				  <ul class="dropdown-menu" role="menu">
          <li><a href="#"><span class="glyphicon glyphicon-user" aria-hidden="true"></span> Akun Saya</a></li>
					<li class="divider"></li>
					<li><a href="logout.php"><span class="glyphicon glyphicon-log-out" aria-hidden="true"></span> Logout</a></li>
				  </ul>
				</li>
			  </ul>
			</div><!-- /.navbar-collapse -->
		  </div><!-- /.container-fluid -->
		</nav>
<br>
<br>
<br>
<br>



<div class="container">
	
<h1><a href="https://learncodeweb.com/php/php-crud-in-bootstrap-3-with-a-search-functionality/">Layanan Pengaduan Peserta</a></h1>
		<div class="panel panel-fkefkedjdegjrngkjlnbkjngerkjbfrkjbfdefault">
			
			</div>
		</div>
<!-- // print_r($results); -->

<div class="container">
    <div class="row header" style="text-align:center;color:green">
    </div>
    <table id="example" class="table table-striped table-bordered" style="width:100%">
        <thead>
					<tr class="bg-primary">
						<th>Nomor Peserta </th>
						<th>Nama peserta </th>
						<th>NIK </th>
						<th>Tanggal Lahir </th>
						<th>Jenis Kelamin </th>
						<th>Status Peserta </th>
						<th>Nomor Ponsel </th>
						<th>Email </th>
						<th class="text-center">Action</th>
					</tr>
				</thead>
			
                <tbody>
                  <?php

                  $query = "SELECT * FROM data_individu";

					
                  $sql = mysql_query($query);
                  while ($row = mysql_fetch_array($sql)) {
                  ?> 
                    <tr>
            			<td><?php echo $row['nomor_peserta'];?></td>
						<td><?php echo $row['nama_peserta'];?></td>
						<td><?php echo $row['nik'];?></td>
						<td><?php echo $row['tanggal_lahir'];?></td>
						<td><?php echo $row['jenis_kelamin'];?></td>
						<td><?php echo $row['status_peserta'];?></td>
						<td><?php echo $row['nomor_ponsel'];?></td>
						<td><?php echo $row['email'];?></td>
						<td align="center">
							<a href="edit1.php?nomor_peserta=<?php echo $row['nomor_peserta'];?>" class="text-primary"><i class="fa fa-fw fa-edit"></i> Detail</a> 
						</td>
					 </tr>
                  <?php
                  }
                  ?>
                </tbody>
              </table>
            </div>
          </div>
        </div>
      </div>
<br>
<br>

<?php


$nik = $_POST['nik'];
$nomor_peserta = $_POST['nomor_peserta'];
$email = $_POST['email'];
$nomor_ponsel = $_POST['nomor_ponsel'];
$pengaduan = $_POST['pengaduan'];
$jawaban_pengaduan = $_POST['jawaban_pengaduan'];
$status_pengaduan = $_POST['status_pengaduan'];
$submit = $_POST['submit'];

			
if(!empty($submit)){
$simpan = mysql_query("INSERT INTO pengaduan_peserta VALUES('$nik', '$nomor_peserta','$email', '$nomor_ponsel', '$pengaduan', '$jawaban_pengaduan', '$status_pengaduan', now())");
	 if($simpan==true) {
		echo "<script>alert('Berhasil!');</script>";
	}
	else {
		echo "<script>alert('Gagal!');</script>";
	}
	
	echo "<meta http-equiv='refresh' content='0;URL='>";
}
?>
<div class="container">

<form class="well form-horizontal" method="post">
<fieldset>

<!-- Form Name -->
<legend><center><h2><b>Form Pengaduan</b></h2></center></legend><br>

<!-- Text input-->

<div class="form-group">
<label class="col-md-4 control-label">NIK</label>  
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input  name="nik" placeholder="Masukkan NIK" class="form-control"  type="text">
</div>
</div>
</div>

<!-- Text input-->

<div class="form-group">
<label class="col-md-4 control-label" >Nomor Peserta</label> 
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input name="nomor_peserta" placeholder="Masukkan Nomor Peserta" class="form-control"  type="text">
</div>
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label">E-Mail</label>  
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
	<span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></span>
<input name="email" placeholder="Masukkan Email" class="form-control"  type="text">
</div>
</div>
</div>


<!-- Text input-->
   
<div class="form-group">
<label class="col-md-4 control-label">Nomor Ponsel</label>  
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
	<span class="input-group-addon"><i class="glyphicon glyphicon-earphone"></i></span>
<input name="nomor_ponsel" placeholder="(+62)" class="form-control" type="text">
</div>
</div>
</div>

<div class="form-group">
<label class="col-md-4 control-label">Pengaduan</label>  
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-pencil"></i></span>
<textarea id="pengaduan" name="pengaduan" placeholder="Masukkan Pengaduan Anda" style="height:200px; width:500px;"></textarea>
</div>
</div>
</div>

<div class="form-group">
<label class="col-md-4 control-label">Jawaban Pengaduan</label>  
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-pencil"></i></span>
<textarea id="jawaban_pengaduan" name="jawaban_pengaduan" placeholder="Jawaban Pengaduan" style="height:200px; width:500px;"></textarea>
</div>
</div>
</div>

<!-- Text input-->

<div class="form-group"> 
  <label class="col-md-4 control-label">Status Pengaduan</label>
    <div class="col-md-4 selectContainer">
    <div class="input-group">
        <span class="input-group-addon"><i class="glyphicon glyphicon-list"></i></span>
    <select name="status_pengaduan" class="form-control selectpicker">
      <option>Diterima/Selesai</option>
      <option>Menunggu Konfirmasi Lanjut</option>
    </select>
  </div>
</div>
</div>
<!-- Select Basic -->

<!-- Success message -->
<!-- Button -->
<div class="form-group" style="margin-left:40%; margin-top:5%;">
<button type="submit" name="submit" value="submit" id="submit" class="btn btn-primary" style="width:200px;"><i class="fa fa-fw fa-plus-circle"></i> SUBMIT</button>
</div>
</fieldset>
</form>
</div>
</div><!-- /.container -->
	
	  <footer class="sticky-footer">
        <div class="container">
          <div class="text-center">
            <small>@Copyright 2021. Hak Cipta dilindungi Undang-Undang</a></small>
          </div>
        </div>
      </footer>
      <!-- /.container-fluid-->
      <!-- /.content-wrapper-->


	<!-- jQuery (necessary for Bootstrap's JavaScript plugins -->
	<script>
        $(document).ready(function() {
$('#example').DataTable();
} );
    </script>
	
</body>
</html>
<?php 
}else{
header("location:login.php");
}
?>