
    <main>
        <section id="user-information">
            <div class="container">
                <div class="user__info-wrapper row">
			<?php include(__ROOT__."/public/panel/sidebar.php"); ?>
        <div class="form__wrapper">
                            <span><i class="ri-shopping-basket-line"></i> Siparişlerim (<?php
  $data_query = $db->prepare("SELECT * FROM siparis where user='".$puser["id"]."'");
    $data_query->execute(array("2"));
    $data_results = $data_query->fetch(PDO::FETCH_ASSOC);
    echo $data_query->rowCount();
?>)</span>
                            <div class="detail__content">
                                <div class="cart-details-main-block">
                                    <div class="cart-product cart-product-title d-flex flex-wrap d-none d-lg-flex align-items-center justify-content-between">
                                        <div class="product-id">
                                            <h3>#</h3>
                                        </div>
                                        <div class="product-name">
                                            <h3>Ürün</h3>
                                        </div>
                                        <div class="product-price">
                                            <h3 class="text-center">Fiyat </h3>
                                        </div>
                                        <div class="product-date">
                                            <h3 class="text-center">Tarih</h3>
                                        </div>
                                        <div class="product-url">
                                            <h3 class="text-center"></h3>
                                        </div>
                                    </div>
                                    <div class="product-cart-all-acrd-items">
									
									<?php 
											$query = $db->query("SELECT * FROM siparis where user='".$puser["id"]."' ORDER BY id DESC"); 
                while ($data = $query->fetch(PDO::FETCH_OBJ)) {
					$js=json_decode($data->urun,true);
					if($js[0]==Null){
						$urun=urun($data->urun);
						$urunad=$urun["ad"];
					}
					else{
						$urunad=array();
						foreach($js as $deg=>$val){
						$urun=urun($val["product"]);
						$urunad[]=$urun["ad"];
						}
						$urunad=implode(", ",$urunad);
					}
                   ?>
				   
				    <div class="cart-product cart-product-body d-flex flex-wrap cart-item  overflow-hidden position-relative">
                                            <div class="product-id item_ d-flex align-items-center">
                                                <div class="d-flex align-items-center">
                                                    <?=$data->id;?>
                                                </div>
                                            </div>
                                            <div class="product-name item_ d-flex align-items-center">
                                                <div class="d-flex align-items-center">
                                                    <a href="<?=$site;?>panel/order-detail?id=<?=$data->id;?>">
                                                     <?=$urunad;?>
                                                    </a>
                                                </div>
                                            </div>
                                            <div class="product-price item_ d-flex align-items-center justify-content-center">
                                                <h4 class="text-center"><?=$data->fiyat;?> TL</h4>
                                            </div>
                                            <div class="product-date item_ d-flex align-items-center justify-content-center">
                                                <h4 class="mb-0"><?=explode(" ",$data->tarih)[0];?></h4>
                                            </div>
                                            <div class="product-url item_ d-flex align-items-center justify-content-end">
                                                <div class="d-flex align-items-center justify-content-end w-100">
                                                    <a href="<?=$site;?>panel/order-detail?id=<?=$data->id;?>" class="cross-btn-positioning"><i class="ri-external-link-line"></i></a>
                                                </div>
                                            </div>
                                            <div class="hide-desktop w-100">
                                                <h5 class="detail-mobile" onclick="toggleClass()">Detaylar <i class="ri-arrow-down-s-line"></i></h5>
                                                <ul id="detail-content" class="mobil__zero">
                                                    <li>
                                                        <h4>Fiyat:</h4>
                                                        <span><?=$data->fiyat;?> TL</span>
                                                    </li>
                                                    <li>
                                                        <h4>ID:</h4>
                                                        <span><?=$data->id;?></span>
                                                    </li>
                                                    <li>
                                                        <h4>Tarih:</h4>
                                                        <span><?=explode(" ",$data->tarih)[0];?></span>
                                                    </li>
                                                    <li>
                                                        <h4>Ürün: <?=$urunad;?></h4>
                                                        <span>
                                                            İncele
                                                            <a href="<?=$site;?>panel/order-detail?id=<?=$data->id;?>" class="cross-btn-positioning"><i class="ri-external-link-line"></i></a>
                                                        </span>
                                                    </li>
                                                </ul>
                                            </div>
                                        </div>
				
				<?php } ?>
                                    
                                   </div>
                                </div>
                            </div>
                            <div class="table__content d-none">
                                <table class="table">
                                    <thead>
                                        <tr>
                                            <th scope="col">#</th>
                                            <th scope="col">Görsel</th>
                                            <th scope="col">Ürün</th>
                                            <th scope="col">Fiyat</th>
                                            <th scope="col">Tarih</th>
                                            <th scope="col"></th>
                                        </tr>
                                    </thead>
                                    <tbody><?php 
											$query = $db->query("SELECT * FROM siparis where user='".$puser["id"]."' ORDER BY id DESC"); 
                while ($data = $query->fetch(PDO::FETCH_OBJ)) {
					$js=json_decode($data->urun,true);
					if($js[0]==Null){
						$urun=urun($data->urun);
						$urunad=$urun["ad"];
					}
					else{
						$urunad=array();
						foreach($js as $val){
						$urun=urun($val);
						$urunad[]=$urun["ad"];
						}
						$urunad=implode(", ",$urunad);
					}
                   ?>
				   
                                        <tr>
                                            <th scope="row"><?=$data->id;?></th>
                                            <td><?=$urunad;?></td>
                                            <td><?=$data->fiyat;?> TL</td>
                                            <td><?=$data->tarih;?></td>
                                            <td>
                                                <a href="<?=$site;?>panel/myorder?id=<?=$data->id;?>">
                                                    <i class="ri-external-link-line"></i>
                                                </a>
                                            </td>
				</tr><?php } ?>
                                    
                                    </tbody>
                                </table>
                            </div>
                        </div>
                
                    </div>
                </div>
            </div>
        </section>
    </main>
