<?php
include "scrinit.php";
include "logo.php";
?>
<!DOCTYPE html>
<html lang=''>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8" />
<link rel='stylesheet' type='text/css' href='multimcss.css' />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script src="script.js"></script> 
<script type="text/javascript">
function confirmDelete(delcode) { 
//display confirmation window which returns true or false 
if(!window.confirm("Να προχωρήσει η ακύρωση της διεκπεραίωσης της καταγγελίας?")) return false; 
  
//user clicked 'OK' 
window.location.href="akirosikat.php?id=" + delcode; 
}  
$(function() {
 $("#arsimperiforas").bind("changepara", function() {
     $.ajax({
         url: "changepara.php",
         data: "arsimperiforas="+$("#arsimperiforas").val(),
         success: function(html) {
             $("#eidostimo").html(html);
         }
     });
 }); 
});
function popupCenter(pageURL, title, w, h) {
    var left = (screen.width / 2)  - (w / 2);
    var top  = (screen.height / 2) - (h / 2);
    var targetWin = window.open(pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=1000, top='+top+', left='+left);
}
</script>
<style type="text/css">
table.myTable { border-collapse:collapse; }
table.myTable td, table.myTable th { border:1px solid black;padding:2px;font-size:9pt; }
<p style="font-size:09px;"></p>
</style>
</head>
<body>
<?php
require("dbconnect.php");
$stname=$_POST['stname'];
$aranaforas=$_POST['aranaforas'];
$_SESSION['aranaforas']=$aranaforas;
$vdidk=$_SESSION['usr'];
$mitr= $_POST['mitroo'];
$flag=$_POST['flag'];
$etimo = $_POST['etimo'];
if ($etimo==0)
{
$eidostimo=0;
include "addkataggelia2.php";
$_SESSION['eidostimo']=$eidostimo;	
?>
<h3>ΔΙΑΧΕΙΡΙΣΗ ΑΠΟΒΟΛΗΣ ΜΕ ΠΟΙΝΗ ΑΝΑΣΤΟΛΗΣ </h3>
<br><br><br> 
<h4>ΣΤΑΔΙΟ 1: ΔΗΜΙΟΥΡΓΙΑ ΕΠΙΣΤΟΛΗΣ</h4>
<button style="color:blue " onclick="window.open('epistoliana.php','','toolbar=yes, scrollbars=yes, resizable=yes, width=900, height=900')">ΔΗΜΙΟΥΡΓΙΑ ΕΠΙΣΤΟΛΗΣ</button>
<h4>ΣΤΑΔΙΟ 2: ΑΠΟΣΤΟΛΗ SMS</h4>
<button style="color:blue " onclick="window.open('smspara.php','','toolbar=yes, scrollbars=yes, resizable=yes, width=700, height=500')">ΑΠΟΣΤΟΛΗ SMS</button>
<br><br><br>
<h4>ΣΤΑΔΙΟ 3: ΟΛΟΚΛΗΡΩΣΗ ΔΙΕΚΠΕΡΑΙΩΣΗΣ ΚΑΤΑΓΓΕΛΙΑΣ</h4>
<?php
$sql1=mysqli_query($con,"SELECT oktel,oksms,okletter FROM kataggelia WHERE aranaforas='$aranaforas'");
$row = mysqli_fetch_array($sql1);

$x=0;$x1=0;$x2=0;
if ($row['okletter'] == '0000-00-00') {$dateep=date('Y-m-d');} else {$dateep=$row['okletter'];$x=1; } 
if ($row['oksms'] == '0000-00-00') {$datesms=date('Y-m-d');} else {$datesms=$row['oksms'];$x1=1; } 
if ($row['oktel'] == '0000-00-00') {$datetel=date('Y-m-d');} else {$datetel=$row['oktel'];$x2=1; } 
?>
<form action="addkata1.php" method="post">
<?php
echo "<table class='myTable' >
<tr style='border:1px solid black;font-size:9px'  >
<tr>
<th>ΕΠΙΣΤΟΛΗ</th>
<th>ΤΗΛΕΦΩΝΟ</th>
<th>ΜΗΝΥΜΑ/SMS</th>
</tr>";	

echo "<tr>";
?>
<td> <input type='checkbox' name='epistoli' <?php if ($x == 1) echo 'checked'; ?> /> </td>
<td> <input type='checkbox' name='tel' <?php if ($x2 == 1) echo 'checked'; ?> /> </td>
<td> <input type='checkbox' name='sms' <?php if ($x1 == 1) echo 'checked'; ?> /> </td>
</tr>

<tr>
<td> <input type='date' name='dateep' value=<?php echo $dateep;?> /> </td>
<td> <input type='date' name='datetel' value=<?php echo $datetel;?> /> </td>
<td> <input type='date' name='datesms' value=<?php echo $datesms;?> /> </td>
</tr> 

<input type="text" name="aranaforas" hidden value=<?php echo $aranaforas;?> > 
<br ></table><br ><br > 
<b>Η ΚΑΤΑΓΓΕΛΙΑ ΟΛΟΚΛΗΡΩΘΗΚΕ:</b> <input type="checkbox" name="olo" checked > 

<input type="submit" name="submit" value="Καταχώρηση" >
</form>

<br><br><br>
<a  href="pitharxika.php" style="color:blue" > <button style="color:blue"> Επιστροφή στις Καταγγελίες </button></a> 
&nbsp&nbsp&nbsp&nbsp<a  href=<?php echo $menu;?> style="color:blue "  ><button>Επιστροφή στο Μενού</button></a>
<?php
}
else
{
?>
<div id='cssmenu'>
<ul >
<li class='has-sub'><a href='kataggelia.php'><span>ΕΠΙΣΤΡΟΦΗ</span></a></li>
<li class='has-sub'><a href='#'><span>|</span></a></li> 
<li class='has-sub'><a href='#' onClick="window.open('dispapoboles.php?mit=<?php echo $mitr;?>','','width=900,height=900')"><span>ΑΠΟΒΟΛΕΣ ΚΑΤΑ ΜΑΘΗΜΑ </span></a></li>  
<li class='has-sub'><a href='#' onClick="window.open('dispapousies.php?mit=<?php echo $mitr;?>','','width=900,height=900')" /><span>ΚΑΤΑΣΤΑΣΗ ΑΠΟΥΣΙΩΝ </span></a></li>  
<li class='has-sub'><a href='#' onClick="window.open('dispdiag.php?mit=<?php echo $mitr;?>','','width=900,height=900')" /><span>ΚΑΤΑΣΤΑΣΗ ΔΙΑΓΩΝΙΣΜΑΤΩΝ </span></a></li>  
<li class='has-sub'><a href='#' onclick="confirmDelete('<?php echo $aranaforas; ?>');"><span>ΑΚΥΡΩΣΗ ΠΟΙΝΗΣ</span></a></li>
<li class='has-sub'><a href='#'><span>|</span></a></li>      
<li class='has-sub'><a href='#'><span><?php echo "Date: ".date('d-m-Y');?> </span></a></li> 
</div>
<?php
$eidostimo=0;
include "addkataggelia2.php";
$_SESSION['eidostimo']=$eidostimo;
?>	
<h4>ΣΤΑΔΙΟ 1: ΥΠΟΒΟΛΗ ΔΕΛΤΙΟΥ ΑΠΟΒΟΛΗΣ ΓΙΑ ΜΑΘΗΤΗ/ΤΡΙΑ</h4>
<?php
echo "<table class='myTable' >
<tr style='border:1px solid black' bgcolor=#81DAF5 >
<th>ΜΑΘΗΤΗΣ/ΜΑΘΗΤΡΙΑ</th>
<th>ΤΜΗΜΑ</th>
<th>ΥΠΕΥΘΥΝΟΣ ΚΑΘ.</th>
<th>ΠΑΤΕΡΑΣ</th>
<th>ΜΗΤΕΡΑ</th>
</tr>";
$sql = mysqli_query($con,"SELECT * FROM allstudentinfo WHERE mitroo='$mitr'  " );
$row = mysqli_fetch_array($sql);
$stname=$row['eponimo']." ".$row['onoma'];
$tmimaid=$row['tmima'];
$telmit=$row['kmiteras'];
$mit=$row['mitera'];
$telpat=$row['kpatera'];
$pat=$row['pateras'];
echo "<tr>";
echo "<td>".$stname." (".$mitr.") ". "</td>";
echo "<td>".$tmimaid. "</td>";
$sql = mysqli_query($con,"SELECT v.voi_id,t.Name,v.yt FROM voithos as v,teachers as t 
        WHERE v.Class_id='$tmimaid' AND v.voi_id=t.PMP  " );
 $row = mysqli_fetch_array($sql);
 $vdname=$row['Name'];
 $yt=$row['yt'];
 $sql = mysqli_query($con,"SELECT Name FROM teachers WHERE PMP='$yt' " );
 $row = mysqli_fetch_array($sql);
 $ytname=$row['Name'];
 echo "<td>".$ytname. "</td>";
 echo "<td>".$mit." (".$telmit.") "."</td>";
 echo "<td>".$pat." (".$telpat.") "."</td>";
 echo "</tr>";
 echo "</table>";

$sql = $dbcon->prepare("SELECT timocode FROM apobolientypo WHERE timocode = ? ");
$sql->execute([$aranaforas]);
$row=$sql->fetch(PDO::FETCH_ASSOC);
$count=$sql->rowCount();
if ($count <> 0)
{
	echo '<p style="color: red; font-size: 14pt">
      Η ΚΑΤΑΓΓΕΛΙΑ ΈΧΕΙ ΔΙΕΚΠΕΡΑΙΩΘΕΙ - ΠΡΕΠΕΙ ΝΑ ΑΚΥΡΩΣΕΤΕ ΤΗΝ ΔΙΕΚΠΕΡΑΙΩΣΗ
      </p>';
}
else
{
include "diagomathiti.php";

?><h3>Να επιλέξετε τις ημέρες που θα παραμείνει στο σπίτι ο/η μαθητής/τρια</h3> <?php
include "mathitisp2d.php";
}
}
?>	

</body>
</html>