
<script type="text/javascript">

 
// TABOVI //
function promjeniFormu(evt, formName) {
    var i, tabcontent, tablinks;
    tabcontent = document.getElementsByClassName("tabcontent");
    for (i = 0; i < tabcontent.length; i++) {
        tabcontent[i].style.display = "none";
    }
    tablinks = document.getElementsByClassName("tablinks");
    for (i = 0; i < tablinks.length; i++) {
        tablinks[i].className = tablinks[i].className.replace(" active", "");
    }
    document.getElementById(formName).style.display = "block";
    evt.currentTarget.className += " active";
}

</script>


<?php 
include 'header2.php';	



date_default_timezone_set('Europe/Zurich');
$current_time = time();




// echo getTimeStamp('17/02/2024, 10:00').'<br>';
// echo getTimeStamp('09/03/2024, 09:30').'<br>';
// echo getTimeStamp('14/02/2024, 07:50').'<br>';
// echo getTimeStamp('16/02/2024, 09:10').'<br>';
// echo getTimeStamp('24/02/2024, 07:43').'<br>';
// echo getTimeStamp('29/02/2024, 11:30').'<br>';
// echo getTimeStamp('12/02/2024, 08:40').'<br>';
// echo getTimeStamp('11/02/2024, 15:40').'<br>';
// echo getTimeStamp('07/02/2024, 09:50').'<br>';
// echo getTimeStamp('06/02/2024, 12:05').'<br>';
// echo getTimeStamp('13/02/2024, 09:00').'<br>';
// echo getTimeStamp('04/02/2024, 19:00').'<br>';
// echo getTimeStamp('04/02/2024, 13:40').'<br>';
// echo getTimeStamp('17/02/2024, 17:14').'<br>';
// echo getTimeStamp('03/02/2024, 21:00').'<br>';
// echo getTimeStamp('03/02/2024, 21:00').'<br>';
// echo getTimeStamp('02/02/2024, 19:40').'<br>';
// echo getTimeStamp('04/02/2024, 21:40').'<br>';
// echo getTimeStamp('29/02/2024, 21:50').'<br>';
// echo getTimeStamp('29/02/2024, 21:20').'<br>';
// echo getTimeStamp('21/02/2024, 21:30').'<br>';
// echo getTimeStamp('29/02/2024, 20:15').'<br>';
// echo getTimeStamp('08/02/2024, 16:40').'<br>';
// echo getTimeStamp('03/02/2024, 09:00').'<br>';
// echo getTimeStamp('17/02/2024, 07:50').'<br>';




//echo getTimeStamp('14/02/2024, 07:50');



$jezik = 'de-CH';
include 'language.php'; 
	
	$sql = "SELECT * FROM korisnici where mejl = 0 ORDER BY id DESC";
	$result = $conn->query($sql);
	
	$sqlPotvrdjeni = "SELECT * FROM korisnici where mejl = 1 and vrijemepolazaktime >= $current_time ORDER BY id DESC";
	$resultPotvrdjeni = $conn->query($sqlPotvrdjeni);
	
	$sqlOdbijeni = "SELECT * FROM korisnici where mejl = 2 ORDER BY id DESC";
	$resultOdbijeni = $conn->query($sqlOdbijeni);

	$sqlCompleted = "SELECT * FROM korisnici where mejl = 1 and vrijemepolazaktime < $current_time ORDER BY vrijemepolazaktime DESC";
   $resultCompleted = $conn->query($sqlCompleted);
	
	?>
	
	<div class="tabovi">
		<div class="tablinks active" onClick="promjeniFormu(event, 'nepotvrdjene')">Uncorfimed</div>
		<div class="tablinks" onClick="promjeniFormu(event, 'potvrdjene')">Confirmed</div>
		<div class="tablinks" onClick="promjeniFormu(event, 'completed')">Completed</div>
		<div class="tablinks" onClick="promjeniFormu(event, 'odbijene')">Cancelled</div>
	</div>
	 
	<?php echo '
	<div id="nepotvrdjene" class="tabcontent" style="display:block; ">
';
	if ($result->num_rows > 0) {
    	// output data of each row
    	while($row = $result->fetch_assoc()) {
		 
		$pocetak = $row["pocetak"];
		$kraj = $row["kraj"];
		$trajanje = $row["trajanje"];
		$klasa = $row["klasa"];
		$placanje = $row["placanje"];
		$povratak = $row["povratak"];
		$sati = $row["sati"];

		
		include 'obrada_podataka.php';
 

        echo '
<div class="span100" style=" margin-bottom:20px;">
   <div class="span100 first-row">
      <div class="span20 prikaz_lijevo"><a href="info.php?id='.$row["id"].'">#'.$row["id"].'</a></div>
      <div class="span40 prikaz_lijevo">'.date("d-m-Y H:i", $row["datum"]).'h</div>
      <div class="span40 prikaz_desno">CHF '.$row["cijena"].'<br /><span style="font-size:9px;">('.$placanje_display.')</span></div>
   </div>
   <div class="span100 second-row">'.$row["pocetak"].'</div>
   <div class="span100 third-row"  style="'.($row["kraj"] == '' ? "display:none;" : "").'">'.$row["kraj"].'</div>

   <div class="span100 four-row">
    <div class="span50 prikaz_lijevo">'.$row["vrijemepolazak"].'</div>
      <div class="span50 prikaz_desno back_povratak"  style="'.($povratak != 'roundtrip' ? "display:none;" : "").'">'.$row["vrijemepovratak"].' </div>
       
   </div>
   <div class="span100 five-row">
      <div class="span50 prikaz_lijevo">'.$povratak_display.'</div>
      <div class="span50 prikaz_desno"  style="'.($row["distanca"] == 0 ? "display:none;" :" ").'">'.$row["distanca"].'km ('.$trajanje_display.')</div>
   </div>
   <div class="span100 six-row" >
      <div class="span50 prikaz_lijevo six-row-left">
         <div class="review-subtitle">'.$row["ime"].' '.$row["prezime"].'</div>
         <div>'.$row["email"].'</div>
         <div>'.$row["telefon"].'</div>
         <div style="margin-top:7px;  display: '.($row["let"] == '' ? 'none' : '').';">FlightNo: '.$row["let"].'</div>
       
      </div>
      <div class="span50 prikaz_desno">
		<div class="review-subtitle">'.$klasa_display.'</div>
		<div class="span100">
			<div class="span50 prikaz_lijevo review-box-putnici">
				<div >'.$row["putnici"].'</div>
				<div>Passengers</div>
			</div>
			<div class="span50 prikaz_desno review-box-putnici">
				<div class="">'.$row["prtljag"].'</div>
				<div>Gepäck</div>
			</div>
		</div>
		<div class="review-subtitle">Childseat</div>
		<div class="span100 review-childseat"> 
			<div class="">'.($row["childseat"] == "" ? 'Nein' :  $row["childseat"]) .'</div>
		</div>	
	  </div>
   </div>
   <div class="span100 seven-row">
      <div class="span50 prikaz_lijevo">
         <form method="post" action="cancel_mail.php">
            <input type="text" name="posaljimejl"  value="2" style="display:none" />
            <input type="text" name="id"  value="'.$row["id"].'" style="display:none" />
            <input type="text" name="jezik"  value="'.$row["jezik"].'" style="display:none" />	
            <input type="text" name="ime"  value="'.$row["ime"].'" style="display:none" />
            <input type="text" name="prezime"  value="'.$row["prezime"].'" style="display:none" />
            <input type="text" name="email"  value="'.$row["email"].'" style="display:none" />
            <input type="text" name="vrijemepolazak"  value="'.$row["vrijemepolazak"].'" style="display:none" />
            <input type="text" name="telefon"  value="'.$row["telefon"].'" style="display:none" />
            <input id="send1_'.$row["id"].'" type="submit" name="submit" class="dugme" value="Cancel" />';
         echo '
         </form>
      </div>
      <div class="span50 prikaz_desno">
         <form method="post" action="send_mail.php">
            <input type="text" name="posaljimejl"  value="1" style="display:none" />
            <input type="text" name="id"  value="'.$row["id"].'" style="display:none" />
            <input type="text" name="jezik"  value="'.$row["jezik"].'" style="display:none" />
            <input type="text" name="cijena"  value="'.$row["cijena"].'" style="display:none" />
            <input type="text" name="pocetak"  value="'.$row["pocetak"].'" style="display:none" />
            <input type="text" name="vrijemepolazak"  value="'.$row["vrijemepolazak"].'" style="display:none" />
            <input type="text" name="kraj"  value="'.$row["kraj"].'" style="display:none" />
            <input type="text" name="povratak"  value="'.$row["povratak"].'" style="display:none" />
            <input type="text" name="vrijemepovratak"  value="'.$row["vrijemepovratak"].'" style="display:none" />
            <input type="text" name="distanca"  value="'.$row["distanca"].'" style="display:none" />
            <input type="text" name="trajanje"  value="'.$row["trajanje"].'" style="display:none" />
            <input type="text" name="klasa"  value="'.$row["klasa"].'" style="display:none" />
            <input type="text" name="putnici"  value="'.$row["putnici"].'" style="display:none" />
            <input type="text" name="prtljag"  value="'.$row["prtljag"].'" style="display:none" />
            <input type="text" name="childseat"  value="'.$row["childseat"].'" style="display:none" />
            <input type="text" name="sati"  value="'.$row["sati"].'" style="display:none" />
            <input type="text" name="ime"  value="'.$row["ime"].'" style="display:none" />
            <input type="text" name="prezime"  value="'.$row["prezime"].'" style="display:none" />
            <input type="text" name="firma"  value="'.$row["firma"].'" style="display:none" />
            <input type="text" name="email"  value="'.$row["email"].'" style="display:none" />
            <input type="text" name="telefon"  value="'.$row["telefon"].'" style="display:none" />
             
            <input type="text" name="buking"  value="'.$row["buking"].'" style="display:none" />
            <input type="text" name="let"  value="'.$row["let"].'" style="display:none" />
            <input type="text" name="letboard"  value="'.$row["letboard"].'" style="display:none" />
           
            <input type="text" name="placanje"  value="'.$row["placanje"].'" style="display:none" />
            <input type="text" name="platio"  value="'.$row["platio"].'" style="display:none" />
            <input type="text" name="mejl"  value="'.$row["mejl"].'" style="display:none" />
            <input type="text" name="pdf"  value="'.$row["pdf"].'" style="display:none" />
            <input  id="send_'.$row["id"].'" type="submit" name="submit" class="dugme" value="Confirm" />';
            echo '
         </form>
      </div>
   </div>
</div>';
    	}
	} else {
    echo 'Keine unbestätigten Fahrten! ';
	}
	echo '</div>';
	
	
	echo '
	<div id="potvrdjene" class="tabcontent">';
	if ($resultPotvrdjeni -> num_rows > 0) {
    	// output data of each row
    	while($rowPotvrdjeni = $resultPotvrdjeni -> fetch_assoc()) {
		 
		$pocetak = $rowPotvrdjeni["pocetak"];
		$kraj = $rowPotvrdjeni["kraj"];
		$trajanje = $rowPotvrdjeni["trajanje"];
		$klasa = $rowPotvrdjeni["klasa"];
		$placanje = $rowPotvrdjeni["placanje"];
		$povratak = $rowPotvrdjeni["povratak"];
		$sati = $rowPotvrdjeni["sati"];
 		
 		
		include 'obrada_podataka.php';

        echo '
        <div class="span100" style=" margin-bottom:20px;">
			<div class="span100 first-row"><div class="span20 prikaz_lijevo"><a href="info.php?id='.$rowPotvrdjeni["id"].'">#'.$rowPotvrdjeni["id"].'</a></div><div class="span40 prikaz_lijevo">'.date("d-m-Y H:i", $rowPotvrdjeni["datum"]).'h</div><div class="span40 prikaz_desno">CHF '.$rowPotvrdjeni["cijena"].'<br /><span style="font-size:9px;">('.$placanje_display.')</span></div>
			</div>
			<div class="span100 second-row">'.$rowPotvrdjeni["pocetak"].'</div>
			<div class="span100 third-row"  style="'.($rowPotvrdjeni["kraj"] == '' ? "display:none;" : "").'">'.$rowPotvrdjeni["kraj"].'</div>
		
			<div class="span100 four-row">
				<div class="span50 prikaz_lijevo">'.$rowPotvrdjeni["vrijemepolazak"].'</div>
				<div class="span50 prikaz_desno back_povratak"  style="'.($povratak != 'roundtrip' ? "display:none;" : "").'">'.$rowPotvrdjeni["vrijemepovratak"].'</div>
				 
			</div>
		
 
			<div class="span100 five-row">
				<div class="span50 prikaz_lijevo">'.$povratak_display.'</div>
				<div class="span50 prikaz_desno"  style="'.($rowPotvrdjeni["distanca"] == 0 ? "display:none;" :" ").'">'.$rowPotvrdjeni["distanca"].'km ('.$trajanje_display.')</div>
			</div>
		 
			<div class="span100 six-row "  style="margin-bottom:10px;">
				<div class="span50 prikaz_lijevo six-row-left">
					<div class="review-subtitle">'.$rowPotvrdjeni["ime"].' '.$rowPotvrdjeni["prezime"].'</div>
					<div>'.$rowPotvrdjeni["email"].'</div>
					<div>'.$rowPotvrdjeni["telefon"].'</div>
					<div style="margin-top:7px;  display: '.($rowPotvrdjeni["let"] == '' ? 'none' : '').';">FlightNo: '.$rowPotvrdjeni["let"].'</div>
				 
				</div>
				<div class="span50 prikaz_desno">
					<div class="review-subtitle">'.$klasa_display.'</div>
					<div class="span100">
						<div class="span50 prikaz_lijevo review-box-putnici">
							<div class="">'.$rowPotvrdjeni["putnici"].'</div>
							<div>Passengers</div>
						</div>
						<div class="span50 prikaz_desno review-box-putnici">
							<div class="">'.$rowPotvrdjeni["prtljag"].'</div>
							<div>Gepäck</div>
						</div>
					</div>
					<div class="review-subtitle">Childseat</div>
					<div class="span100 review-childseat">
						
						<div class="">'.($rowPotvrdjeni["childseat"] == "" ? 'Nein' :  $rowPotvrdjeni["childseat"]) .'</div>
						
					</div>	
				</div>	
				 
			</div>
		</div>';
    	}
	}else{
		echo 'Keine bestätigten Fahrten! ';
	}
	echo '
	</div> ';



	echo '
	<div id="completed" class="tabcontent">';
	if ($resultCompleted -> num_rows > 0) {
    	// output data of each row
    	while($rowCompleted = $resultCompleted -> fetch_assoc()) {
		 
		$pocetak = $rowCompleted["pocetak"];
		$kraj = $rowCompleted["kraj"];
		$trajanje = $rowCompleted["trajanje"];
		$klasa = $rowCompleted["klasa"];
		$placanje = $rowCompleted["placanje"];
		$povratak = $rowCompleted["povratak"];
		$sati = $rowCompleted["sati"];
 		
 		
		include 'obrada_podataka.php';

        echo '
        <div class="span100" style=" margin-bottom:20px;">
			<div class="span100 first-row"><div class="span20 prikaz_lijevo"><a href="info.php?id='.$rowCompleted["id"].'">#'.$rowCompleted["id"].'</a></div><div class="span40 prikaz_lijevo">'.date("d-m-Y H:i", $rowCompleted["datum"]).'h</div><div class="span40 prikaz_desno">CHF '.$rowCompleted["cijena"].'<br /><span style="font-size:9px;">('.$placanje_display.')</span></div>
			</div>
			<div class="span100 second-row">'.$rowCompleted["pocetak"].'</div>
			<div class="span100 third-row"  style="'.($rowCompleted["kraj"] == '' ? "display:none;" : "").'">'.$rowCompleted["kraj"].'</div>
		
			<div class="span100 four-row">
				<div class="span50 prikaz_lijevo">'.$rowCompleted["vrijemepolazak"].'</div>
				<div class="span50 prikaz_desno back_povratak"  style="'.($povratak != 'roundtrip' ? "display:none;" : "").'">'.$rowCompleted["vrijemepovratak"].'</div>
			 
			</div>
		
 
			<div class="span100 five-row">
				<div class="span50 prikaz_lijevo">'.$povratak_display.'</div>
				<div class="span50 prikaz_desno"  style="'.($rowCompleted["distanca"] == 0 ? "display:none;" :" ").'">'.$rowCompleted["distanca"].'km ('.$trajanje_display.')</div>
			</div>
		 
			<div class="span100 six-row "  style="margin-bottom:10px;">
				<div class="span50 prikaz_lijevo six-row-left">
					<div class="review-subtitle">'.$rowCompleted["ime"].' '.$rowCompleted["prezime"].'</div>
					<div>'.$rowCompleted["email"].'</div>
					<div>'.$rowCompleted["telefon"].'</div>
					<div style="margin-top:7px;  display: '.($rowCompleted["let"] == '' ? 'none' : '').';">FlightNo: '.$rowCompleted["let"].'</div>
				 
				</div>
				<div class="span50 prikaz_desno">
					<div class="review-subtitle">'.$klasa_display.'</div>
					<div class="span100">
						<div class="span50 prikaz_lijevo review-box-putnici">
							<div class="">'.$rowCompleted["putnici"].'</div>
							<div>Passengers</div>
						</div>
						<div class="span50 prikaz_desno review-box-putnici">
							<div class="">'.$rowCompleted["prtljag"].'</div>
							<div>Gepäck</div>
						</div>
					</div>
					<div class="review-subtitle">Childseat</div>
					<div class="span100 review-childseat">
						
						<div class="">'.($rowCompleted["childseat"] == "" ? 'Nein' :  $rowCompleted["childseat"]) .'</div>
						
					</div>	
				</div>	
				 
			</div>
		</div>';
    	}
	}else{
		echo 'Keine bestätigten Fahrten! ';
	}
	echo '
	</div> ';



	 
	
	
	echo '<div id="odbijene" class="tabcontent">';
		if ($resultOdbijeni -> num_rows > 0) {
    	// output data of each row
    	while($rowOdbijeni = $resultOdbijeni -> fetch_assoc()) {
			 
			$pocetak = $rowOdbijeni["pocetak"];
			$kraj = $rowOdbijeni["kraj"];
			$trajanje = $rowOdbijeni["trajanje"];
			$klasa = $rowOdbijeni["klasa"];
			$placanje = $rowOdbijeni["placanje"];
			$povratak = $rowOdbijeni["povratak"];
			$sati = $rowOdbijeni["sati"];
			 
 				
			include 'obrada_podataka.php';

        echo '
	<div class="span100" style="margin-bottom:20px;">
		<div class="span100 first-row">
			<div class="span20 prikaz_lijevo"><a href="info.php?id='.$rowOdbijeni["id"].'">#'.$rowOdbijeni["id"].'</a></div>
			<div class="span40 prikaz_lijevo">'.date("d-m-Y H:i", $rowOdbijeni["datum"]).'h</div>
			<div class="span40 prikaz_desno">CHF '.$rowOdbijeni["cijena"].'<br /><span style="font-size:9px;">('.$placanje_display.')</span></div>
		</div>
		<div class="span100 second-row">'.$rowOdbijeni["pocetak"].'</div>
		<div class="span100 third-row"  style="'.($rowOdbijeni["kraj"] == '' ? "display:none;" : "").'">'.$rowOdbijeni["kraj"].'</div>
		
		<div class="span100 four-row">
			<div class="span50 prikaz_lijevo">'.$rowOdbijeni["vrijemepolazak"].'</div>
			<div class="span50 prikaz_desno back_povratak"  style="'.($povratak != 'roundtrip' ? "display:none;" : "").'">'.$rowOdbijeni["vrijemepovratak"].'</div>
			 
		</div>
		
 
		<div class="span100 five-row">
			<div class="span50 prikaz_lijevo">'.$povratak_display.'</div>
			<div class="span50 prikaz_desno"  style="'.($rowOdbijeni["distanca"] == 0 ? "display:none;" :" ").'">'.$rowOdbijeni["distanca"].'km ('.$trajanje_display.')</div>
		</div>
		 
		<div class="span100 six-row" style="margin-bottom:10px;">
			<div class="span50 prikaz_lijevo six-row-left">
				<div class="review-subtitle">'.$rowOdbijeni["ime"].' '.$rowOdbijeni["prezime"].'</div>
				<div>'.$rowOdbijeni["email"].'</div>
				<div>'.$rowOdbijeni["telefon"].'</div>
				<div style="margin-top:7px; display: '.($rowOdbijeni["let"] == '' ? 'none' : '').';">FlightNo: '.$rowOdbijeni["let"].'</div>
				 
			</div>

			<div class="span50 prikaz_desno">
				<div class="review-subtitle">'.$klasa_display.'</div>
				<div class="span100">
					<div class="span50 prikaz_lijevo review-box-putnici">
						<div class="">'.$rowOdbijeni["putnici"].'</div>
						<div>Passengers</div>
					</div>
					<div class="span50 prikaz_desno review-box-putnici">
						<div class="">'.$rowOdbijeni["prtljag"].'</div>
						<div>Gepäck</div>
					</div>
				</div>
				<div class="review-subtitle">Childseat</div>
				<div class="span100 review-childseat">
					
				 
					<div class="">'.($rowOdbijeni["childseat"] == "" ? 'Nein' :  $rowOdbijeni["childseat"]) .'</div>
					
				</div>	
			</div>	
	  
		</div>
	</div>';
    	}
	}else{
		echo 'Keine abgesagten Fahrten! ';
	}
	echo '
	</div>';
	
	
	$conn->close();
	
?>	


<?php
 include 'footer.php';

?>