<?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");
require_once "functions.php";
$vdidk=$_SESSION['usr'];
$stname=$_POST['stname'];
$aranaforas=$_POST['aranaforas'];
$mitroo= $_POST['mitroo'];
$sq=mysqli_query($con,"select tmima from allstudentinfo where mitroo='$mitroo'");
$rw=mysqli_fetch_array($sq);
$tmimaid=$rw['tmima'];
$flag=$_POST['flag'];
$etimo = $_POST['etimo'];
$kataggelon= $_POST['kathig'];
$datekata= $_POST['datekata'];
$perigrafi=$_POST['perigrafi'];
$sxolia=$_POST['sxolia'];
if ($flag==3) $perigrafi=$sxolia;
$arsimpx = $_POST['arsimpx'];
$metrox=$_POST['metrox'];
$datetimo = $_POST['datetimo'];
$etimo = $_POST['etimo'];
$eidostimo=$etimo;
$periodoi = $_POST['periodoi'];
$pini=$_POST['periodoi'];
//$katastasi = $_POST['katastasi'];

if ($etimo==0)
{

include "addkataggelia2.php";
	
?>
<h3>ΔΙΑΧΕΙΡΙΣΗ ΑΠΟΒΟΛΗΣ ΜΕ ΠΟΙΝΗ ΑΝΑΣΤΟΛΗΣ </h3>
<br><br><br> 
<h4>ΣΤΑΔΙΟ 1: ΔΗΜΙΟΥΡΓΙΑ ΕΠΙΣΤΟΛΗΣ</h4>
<button style="color:blue " onclick="window.open('epistoliana.php?timcode=<?php echo $aranaforas;?>','','toolbar=yes, scrollbars=yes, resizable=yes, width=900, height=900')">ΔΗΜΙΟΥΡΓΙΑ ΕΠΙΣΤΟΛΗΣ</button>
<h4>ΣΤΑΔΙΟ 2: ΑΠΟΣΤΟΛΗ SMS</h4>
<button style="color:blue " onclick="window.open('smspara.php?timcode=<?php echo $aranaforas;?>','','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 $mitroo;?>','','width=900,height=900')"><span>ΑΠΟΒΟΛΕΣ ΚΑΤΑ ΜΑΘΗΜΑ </span></a></li>  
<li class='has-sub'><a href='#' onClick="window.open('dispapousies.php?mit=<?php echo $mitroo;?>','','width=900,height=900')" /><span>ΚΑΤΑΣΤΑΣΗ ΑΠΟΥΣΙΩΝ </span></a></li>  
<li class='has-sub'><a href='#' onClick="window.open('dispdiag.php?mit=<?php echo $mitroo;?>','','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
include "addkataggelia2.php";
?>	
<h4>ΣΤΑΔΙΟ 1: ΕΠΙΛΟΓΗ ΗΜΕΡΟΜΗΝΙΩΝ ΓΙΑ ΤΗΝ ΑΠΟΒΟΛΗ</h4>
<?php

dispst($mitroo);
$mitr=$mitroo;
$sql = $dbcon->prepare("SELECT timocode FROM apobolientypo WHERE timocode = ? and who='Α'");
$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>