
    <main>
        <section id="user-information">
            <div class="container">
                <div class="user__info-wrapper row">
			<?php include(__ROOT__."/public/panel/sidebar.php"); ?>
			
<?php $data = siparis(get("id")); if (!siparis(get("id"))) {header("location: ".$site."panel");die();}
if($data["user"]!=$_SESSION["user"]){
	header("location: ".$site."panel");die();
}
	$js=json_decode($data["urun"],true);
	$s=0;
					if($js[0]==Null){
						$urun=urun($data["urun"]);
						$urunad=$urun["ad"];
						$s++;
					}
					else{
						$urunad=array();
	$adx=array();
						foreach($js as $deg=>$val){
						$urun=urun($val["product"]);
							$say=0;
	$inputops=array();
	while(isset($val["opsiyon"][$say])){
		$opt=$val["opsiyon"][$say];
		$opt=opsiyon($opt);
		if($opt["ad"]!=Null){
			$adx[]=$opt["ad"].": ".$opt["secenek"];
		}
		$say++;
	}	
	
						$urunad[]=$urun["ad"];
	
						$s++;
						}
					$opsiyonlar=implode(", ",$adx);
						$urunad=implode(", ",$urunad);
					}
 ?>
                        <div class="form__wrapper invoice">
                            <span><i class="ri-shopping-basket-line"></i> Sipariş Detay</span>
                            <div class="order-detail form__content row">
                                <div class="form-group col-md-6">
                                    <label for="">Ürün Ad</label>
                                    <input type="text" name="" readonly id="" class="form-control" value="<?=$urunad;?>">
                                </div>
								
                                <div class="form-group col-md-6">
                                    <label for="">Ürün Adeti</label>
                                    <input type="text" name="" readonly id="" class="form-control" value="<?=$s;?>">
                                </div>
                                <div class="form-group col-md-6">
                                    <label for="">Sipariş No</label>
                                    <input type="text" name="" readonly id="" class="form-control" value="<?=get("id");?>">
                                </div>
                                <div class="form-group col-md-6">
                                    <label for="">Tarih</label>
                                    <input type="text" name="" readonly id="" class="form-control" value="<?=$data["tarih"];?>">
                                </div>
                                <div class="form-group col-md-6">
                                    <label for="">Fiyat</label>
                                    <input type="text" name="" readonly id="" class="form-control" value="<?=$data["fiyat"];?> TL">
                                </div>
                                <div class="form-group col-md-6">
                                    <label for="">Ödeme Türü</label>
                                    <input type="text" name="" readonly id="" class="form-control" value="<?=$data["odeme_yontem"];?>">
                                </div>
                                <div class="form-group col-md-6">
                                    <label for="">Sipariş Notu</label>
                                    <input type="text" name="" readonly id="" class="form-control" value="<?=$data["note"];?>">
                                </div>
                                <div class="form-group col-md-6">
                                    <label for="">Ek Opsiyon</label>
                                    <input type="text" name="" readonly id="" class="form-control" value="<?=$opsiyonlar;?>">
                                </div>
                                <div class="form-group col-md-12">
                                    <label for="">Sipariş Durumu</label>
                                    <input type="text" name="" readonly id="" class="form-control <?php if($data["durum"]==0){
										echo 'bekleniyor';
									} elseif($data["durum"]==2){
										echo 'tamamlandi';
									}  elseif($data["durum"]==3){
										echo 'iptal';
									} elseif($data["durum"]==5){
										echo 'onaybek';
									}   elseif($data["durum"]==10){
										echo 'odemebek';
									}  ?>" value="<?php if($data["durum"]==0){
										echo 'Bekleniyor';
									} elseif($data["durum"]==2){
										echo 'Tamamlandı';
									}  elseif($data["durum"]==3){
										echo 'İptal';
									} elseif($data["durum"]==5){
										echo 'Onay Bekliyor';
									}   elseif($data["durum"]==10){
										echo 'Ödeme Bekleniyor';
									}  ?>">
                                </div>
                                <div class="form-group col-md-12 adress">
                                    <label for="">Ürün İçeriği</label>
                                    <textarea name="" id="" readonly><?php
									if($data["durum"]==2){
				  $js=json_decode($data["urun"],true);
				  $stoka=json_decode($data["stok"],true);
					if($js[0]==Null){
						$urun=urun($data->urun);
						$urunad=$urun["ad"];
						echo $data["stok"];
					}
					else{
						
						foreach($js as $deg=>$val){
						$urun=urun($val["product"]);
						echo $urun["ad"]." - ".$stoka[$deg]."
";
						}
					}
									}
									else{
										echo 'Henüz teslim edilmedi.';
									}
									?></textarea>
                                </div>
                            </div>
                        </div>
                        <div class="form__wrapper">
                            <span><i class="ri-file-list-2-line"></i> Fatura Bilgileri</span>
							<?php 
							if($puser["ad"]==Null || $puser["soyad"]==Null || $puser["telefon"]==Null || $puser["ulke"]==Null || $puser["sehir"]==Null || $puser["ilce"]==Null || $puser["adres"]==Null) { ?>
 <div class="alert alert-info">Lütfen profilinizden eksik bilgileri doldurunuz.</div>
<?php }
?>
                            <div class="order-detail form__content row">
                                <div class="form-group col-md-6">
                                    <label for="">İsim Soyisim</label>
                                    <input type="text" name="" readonly id="" class="form-control" value="<?=$data["ad"];?>">
                                </div>
                                <div class="form-group col-md-6">
                                    <label for="">Telefon</label>
                                    <input type="text" name="" readonly id="" class="form-control" value="<?=$data["telefon"];?>">
                                </div>
                                <div class="form-group col-md-12">
                                    <label for="">Mail</label>
                                    <input type="text" name="" readonly id="" class="form-control" value="<?=$data["mail"];?>">
                                </div>
								
                                    <div class="form-group col-md-12">
                                        <label for="">Ülke</label>
                                        <input type="text" name="ulke" readonly id="ulke" class="form-control" value="<?=$puser["ulke"];?>">
                                    </div>
                                    <div class="form-group col-md-6">
                                        <label for="">Şehir</label>
                                        <input type="text" name="sehir" readonly id="sehir" class="form-control" value="<?=$puser["sehir"];?>">
                                    </div>
                                    <div class="form-group col-md-6">
                                        <label for="">İlçe</label>
                                        <input type="text" name="ilce" readonly id="ilce" class="form-control" value="<?=$puser["ilce"];?>">
                                    </div>
                                    <div class="form-group col-md-12 adress">
                                        <label for="">Adres</label>
                                        <textarea name="adres" id="adres" readonly><?=$puser["adres"];?></textarea>
                                    </div>
                            </div>
                        </div>
						</div>
                </div>
            </div>
        </section>
    </main>
