<div class="inner-wrapper">
<?php $path="../../"; include("../../map.php"); include("../../scripts.php"); ?>
<table class="v3-table" style="font-size:14px;">
	<thead>
		<tr class="mdn <?php if($_SESSION["kim"]=="Admin" or ($_SESSION["kim"]=="yonetici" and $_SESSION["y15"]<>0)){echo "cols";}?>" data-ne="<?php echo $_GET["ne"]?>">
			<th class="w6 mw6" style="text-align:center;">ID
				<div class="order">
					<a href="?ne=<?php echo $_GET['ne'];?>&islem=<?php echo $_GET['islem'];?>&key=<?php echo $_GET["key"];?>&s4=<?php echo $_GET["s4"];?>&sayfa=<?php echo $_GET["sayfa"];?>&order=pb1+asc" class="fa fa-sort-asc"></a>
					<a href="?ne=<?php echo $_GET['ne'];?>&islem=<?php echo $_GET['islem'];?>&key=<?php echo $_GET["key"];?>&s4=<?php echo $_GET["s4"];?>&sayfa=<?php echo $_GET["sayfa"];?>&order=pb1+desc" class="fa fa-sort-desc"></a>
				</div>
			</th>
			<th class=""> <span class="column-sort"> <a href="#" title="Sort up" class="sort-up"></a> <a href="#" title="Sort down" class="sort-down"></a> </span> <?php echo translate("Sepet No")?> </th>
			<th class="w12 mw12 tar"> <?php echo translate("User")?> </th>
			<th class="w8 mw10 tar"><?php echo $sdil[144]; //Tutar?></th>
			<th class="w10 mw10 tac" scope="col"><?php echo $sdil[115]; //Tarih/Saat?></th>
			<th class="w8 mw8 tac"><?php echo $sdil[213]; //İşlemler?></th>
		</tr>
	</thead>
	<tbody>
		<?php
			$sqll = mysqli_query($conn, "select DISTINCT t4 from eticaret where ne='sepet' and t5='sepet' order by id desc"); while($lsepet=mysqli_fetch_assoc($sqll)){
			$sqlb = mysqli_query($conn, "select * from eticaret where ne='sepet' and t5='sepet' and t4='".$lsepet["t4"]."'"); $basket=mysqli_fetch_assoc($sqlb);
			$gtoplam=0;
			$sqlm = mysqli_query($conn, "select id,t1,t13,n17 from t5 where id=".$basket["s1"]." order by id desc"); $rsm=mysqli_fetch_assoc($sqlm); $jsci=json_decode($rsm["n17"],true);
			//-- Sipariş Hesapla -->
			$images = array();
			$sqlb = mysqli_query($conn, "select * from eticaret where ne='sepet' and t4='".$basket["t4"]."'"); while($sepet=mysqli_fetch_assoc($sqlb)){
				$images[] = medya($sepet["s3"],1,"kresim","t1",'',$weburl);
				include("../../../deppo/tools/script/order_calc.php");
			}
			//-- Sipariş Hesapla -->
			?>
			<tr id="tr_<?php echo $basket["id"]?>" data-id="<?php echo $basket["id"];?>" class="alert alert-warning">
				<td class="th table-check-cell cp v3-text-info"><?php echo i2a($basket["id"],7)?></td>
				<td class="mfrm" data-toggle="modal" data-target="#myModal" data-title="Sepet" data-url="../../modules/clients/client_basket.php?id=<?php echo $rsm["id"];?>" style="cursor:pointer;">
					<span class="fl" style="margin-top: 12px;"><?php echo $basket["t4"];?></span>
					<?php if($cols["c_eticaret_orderimages"]<>""){?>
						<?php $i=0;foreach($images as $image){$i++;?>
							<?php if($i<11){?>
							<img src="<?php echo $image;?>" style="height: 45px; width: 45px; border-radius: 50%; float: right; margin-left: -28px; border: 1px solid;">
							<?php }?>
						<?php }?>
						<?php if(count($images)>10){?>
						<i class="fas fa-plus" title="<?php echo count($images)?>" style="background: white;height: 45px; width: 45px; border-radius: 50%; float: right; border: 1px solid; font-size: 40px; padding: 3px; color: darkgreen;"></i>
						<?php }?>
					<?php }?>
				</td>
				<td class="tar cp">
				<?php if($rsm["t13"]<>""){echo "<i class=\"fas fa-medal\"></i>";}?> <?php if(mysqli_num_rows($sqlm)>0){echo $rsm["t1"];}else{echo $jso["Name"]." ".$jso["Surname"];}?><?php if(mysqli_num_rows($sqlb)>0 and $sepet["s19"]<>0){echo " >> ".$rsb["t1"];}?>
				<?php if($cols["c_eticaret_firm"]<>"" and $mobile==""){echo "<br><span style=\"font-size:11px;\">".kisalt($jsci["ifirma"],3)."</span>";}?>
				</td>
				<td class="tar">
					<div style=""><?php echo wprice($gtoplam)?> <i class="fa fa-<?php echo strtolower($basket["n2"]);?>"></i></div>
				</td>
				<td class="tac"><?php echo dtarih($basket["ts1"],"gg ka  time");?></td>
				<td class="tac">
					<a  class="btn btn-warning mfrm" data-toggle="modal" data-target="#myModal" data-title="Sepet" data-url="../../modules/clients/client_basket.php?id=<?php echo $rsm["id"];?>"><i class="fa fa-eye"></i></a>
					<a href="?t4=<?php echo $lsepet["t4"]?>" onclick="if(!confirm('<?php echo $rsm["t1"]?> sepeti boşaltılacak, eminmisiniz?')){ event.preventDefault() }" class="btn btn-warning"><i class="fa fa-trash"></i></a>
				</td>
			</tr>
			<?php $total=0; $stutar=""; $ototal=$ototal+$gtoplam; }?>
		</tbody>
	</table>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<?php 
if($_GET["t4"]<>""){
	$dbasket = mysqli_query($conn, "delete from eticaret where t4='".$_GET["t4"]."'");
	echo location("?",self,500,1);
}
?>