<?php 
ob_start();
session_start();
require_once('baglan.php');
require_once('fonk.php');
$dosya_yolu="//".$_SERVER["HTTP_HOST"].dirname($_SERVER['PHP_SELF']); 
?>
<!DOCTYPE html>
<html lang="tr" xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="robots" content="index,follow" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <!-- Page Needs -->
    <title>Rezervasyon Bilgileri</title>
    <link rel="stylesheet" href="<?php echo $dosya_yolu;?>/../<?php echo TEMA;?>/assets/css/main.css" />
    <link rel="stylesheet" href="<?php echo $dosya_yolu;?>/../<?php echo TEMA;?>/assets/css/alt.css" />
</head>

<body onload="window.print();">
<?php
if(isset($_SESSION['mailbilgi']['aracid']))
{
	$Sorgu = $db->prepare("SELECT * FROM araclar WHERE id = ? AND durum = ? AND dil = ?");
	$Sorgu->execute(array($_SESSION['mailbilgi']['aracid'],"1",$_SESSION['k_dil']));
	if($Sorgu->rowCount())
	{
		$Sonuc = $Sorgu->fetch(PDO::FETCH_ASSOC);
		$kategoriler =$db->query("SELECT * FROM kategori WHERE durum = '1' AND id='{$Sonuc['kategori']}' AND dil = '{$_SESSION['k_dil']}'")->fetch(PDO::FETCH_ASSOC);
		$alissube 	= $db->query("SELECT * FROM lokasyon WHERE adi = '{$_SESSION['alis']}' AND dil = '{$_SESSION['k_dil']}'")->fetch(PDO::FETCH_ASSOC);
	}
	else
	{
		header("Location:../../404.html");
	}
	$extraUcret = 0;
	if (isset($_SESSION['arac_'.$_SESSION['mailbilgi']['aracid']])) {
		foreach ($_SESSION['arac_'.$_SESSION['mailbilgi']['aracid']] as $k => $v) {
			$seciliextra = $db->query("SELECT * FROM ekstra WHERE id = '{$k}'")->fetch(PDO::FETCH_ASSOC);
			$extraUcret += $seciliextra['fiyat']*(int)$v;
		}
	}
}
else
{
	header("Location:index.html");
}	
?>
<center>
<img src="../<?php echo TEMA;?>/uploads/logo/<?php echo LOGO;?>">
</center>
<section class="site-content">
    <div class="page-content" style="padding: 0 0;">
        <div class="container">
            <div class="row">
                <div class="col-md-12">
                    <div class="success-box">
                        <div class="row">
                            <div class="col-md-8 col-md-offset-2">
                                <div class="success-head"><i class="ic ic-process-success"></i>
                                    <h1>TEŞEKKÜRLER !</h1>
                                    <p>Rezervasyon işleminizi başarılı bir şekilde gerçekleştirdiniz. <br> Detaylar önceki adıma belirttiğiniz e-posta adresinize mail yoluyla gönderildi.</p>
                                </div>
                            </div>
                            <div class="col-md-10 col-md-offset-1">
                                <div class="success-body">
                                    <div class="booking-box">
                                        <div class="row">
                                            <div class="col-md-12">
                                                <div class="car-detail">
                                                    <div class="row">
                                                        <div class="col-md-5 col-sm-5 col-xs-5">
                                                            <div class="image-box"><img src="<?php echo $dosya_yolu;?>/../<?php echo TEMA;?>/uploads/araclar/<?php echo $Sonuc['resim']; ?>"></div>
                                                        </div>
                                                        <div class="col-md-7 col-sm-7 col-xs-7">
                                                            <div class="car-info">
                                                                <div class="car-name"><?php echo $Sonuc['adi'];?></div>
                                                                <div class="car-class"><?php echo $kategoriler['adi'];?> </div>
                                                            </div>
                                                            <div class="car-option-list">
                                                                <ul>
																	<li><i class="fa fa-battery-three-quarters"></i><span><?php if($Sonuc['yakit'] == 1){echo "Dizel";}?><?php if($Sonuc['yakit'] == 2){echo "Benzin";}?><?php if($Sonuc['yakit'] == 3){echo "Lpg";}?></span></li>
																	<li><i class="fa fa-tachometer"></i><span><?php if($Sonuc['vites'] == 1){echo "Manuel";}?><?php if($Sonuc['vites'] == 2){echo "Otomatik";}?><?php if($Sonuc['vites'] == 3){echo "Triptonik";}?></span></li>
																	<li><i class="fa fa-recycle"></i><span><?php if($Sonuc['klima'] == 1){echo "Dijital";}?><?php if($Sonuc['klima'] == 2){echo "Analog";}?><?php if($Sonuc['klima'] == 3){echo "Yok";}?></span></li>
																	<li><i class="fa fa-suitcase"></i><span><?php echo $Sonuc['bagaj']; ?> lt</span></li>
																</ul>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>

                                            </div>
                                        </div>
                                        <hr>
                                        <div class="row">
                                            <div class="col-md-4 col-sm-4 col-xs-4">
                                                <div class="info-box">
                                                    <div class="label-text">Alış Bilgileri</div>
                                                    <div class="label-value"><?php echo $_SESSION['mailbilgi']['alis'];?><br> <?php echo $_SESSION['mailbilgi']['alistarih'];?></div>
                                                </div>
                                            </div>
                                            <div class="col-md-4 col-sm-4 col-xs-4">
                                                <div class="info-box border-l">
                                                    <div class="label-text">Teslim Bilgileri</div>
                                                    <div class="label-value"><?php echo $_SESSION['mailbilgi']['donus'];?><br><?php echo $_SESSION['mailbilgi']['donustarih'];?></div>
                                                </div>
                                            </div>
                                            <div class="col-md-4 col-sm-4 col-xs-4">
                                                <div class="info-box border-l">
                                                    <div class="label-text">Ücret</div>
                                                    <div class="label-price-value"><?php echo para_birim();?> <?php echo $_SESSION['mailbilgi']['fiyat']+$extraUcret;?></div><br />
                                                    <strong>(KDV Dahil)</strong>
                                                </div>
                                            </div>
                                        </div>
										<?php 
										if (isset($_SESSION['arac_'.$_SESSION['mailbilgi']['aracid']])) {?>
                                        <hr>
                                        <div class="row">
                                            <div class="col-md-12">
                                                <div class="info-box">
                                                    <div class="label-text">EK SEÇENEKLER</div>
                                                    <div class="label-extra-option">
                                                        <ul>
                                                        	<?php foreach ($_SESSION['arac_'.$_SESSION['mailbilgi']['aracid']] as $k => $v) {
																	$seciliextra = $db->query("SELECT * FROM ekstra WHERE id = '{$k}'")->fetch(PDO::FETCH_ASSOC);
																	if($v == 0) continue;
																	?>
                                                            		<li><i class="fa fa-check-circle"></i> <?=$v;?> x <?=$seciliextra['adi'];?></li>
																	<?php
																}?>															
                                                        </ul>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
										<?php } ?>
										<?php if($alissube['adres']){?>
                                        <hr>
                                        <div class="row">
                                            <div class="col-md-12">
                                                <div class="info-box">
                                                    <div class="label-text"><?=@$dil['sube_bilgileri'];?></div>
                                                    <div class="label-branch-list">
                                                        <ul>
                                                            <li><i class="ic ic-map-pin"></i><span><?php echo $alissube['adres'];?></span></li>
                                                            <li><i class="ic ic-phone-number"></i><span><?php echo $alissube['telefon'];?></span></li>
                                                        </ul>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
										<?php }?>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
</body>
</html>