<?php
	header('Content-Type: text/html; charset=utf-8');
	error_reporting(0);
	$path="../../";
	include("../../map.php");
	include("../../scripts.php");
	include("../../secure.php");
	//findDirectoryPath("deppo")
$sayfa = $_GET['sayfa'];
	if($sayfa == "") {$sayfa = 0;}else{$sayfa = ($sayfa-1) * 10;} 
	$sql = mysqli_query($conn, "select * from ".$_SESSION["lang"]." where ne='paket' order by id desc limit $sayfa,10"); 
	$sql2 = mysqli_query($conn, "select count(*) FROM ".$_SESSION["lang"]." where ne='paket'");$rsay=mysqli_fetch_assoc($sql2);
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo $package?></title>
</head>
<body>
    <div class="qmodal">
        <div class="qmodal-content">
		<div class="alert alert-warning" id="result" style="display:none;"></div>
            <!-- Header with Action Buttons -->
            <div class="qmodal-header">
			<div class="header-title">
				<nav aria-label="breadcrumb">
					<ol class="breadcrumb">
						<li class="breadcrumb-item"><a href="?"><i class="fa fa-home"></i></a></li>
						<li class="breadcrumb-item active" aria-current="page"><?php echo $package?></li>
					</ol>
				</nav>
			</div>
                <button type="button" class="btn btn-warning" onclick="location.href='?ne=<?php echo $_GET['ne'];?>&islem=<?php echo $_GET['islem'];?>&durum=ypaket&s2=<?php echo $_GET["s2"];?>'" title="<?php echo $packages[0]; echo $sdil[201]; //Ekle?>"><i class="fa fa-plus" aria-hidden="true"></i></button>
            </div>
            <!-- Left Tab Menu -->
            <div class="v8-columns">
                <!-- Content Area -->
                <div class="" ts1="<?php echo dtarih($rs["ts1"],"gg ka yy time");?>" ts2="<?php echo dtarih($rs["ts2"],"gg ka yy time");?>" ts3="<?php echo dtarih($rs["ts3"],"gg ka yy time");?>">
<table class="table" style="min-width: 800px;">
							<thead>
								<tr>
									<th class="w6 mw10" style="text-align:center;">ID</span></th>
									<th class="mw10"><?php echo $packages[0]?></th>
									<th class="w10 mw15 tac">Max Kayıt</th>
									<th class="w10 mw15 tac">Max Resim</th>
									<th class="w10 mw15 tac">Fiyat</th>
									<th class="w10 mw15 tac">Otomatik Onay</th>
									<th class="w10 mw15 tac">Vitrin</th>
									<th class="w8 mw12"><?php echo $sdil[213]; //İşlemler?></th>
								</tr>
							</thead>
							<tbody>
								<?php while($rs=mysqli_fetch_assoc($sql)){ ?>
									<tr data-id="<?php echo $rs["id"];?>">
										<th style="text-align: center;"><a target="_blank" href="?ne=<?php echo $_GET["ne"];?>&islem=dpaket&id=<?php echo $rs["id"];?>"><?php echo i2a($rs["id"],7);?></a></th>
										<td style="cursor:pointer;" onclick="location.href='package.php?ne=<?php echo $_GET["ne"];?>&islem=dpaket&id=<?php echo $rs["id"];?>'">
											<span title="<?php echo $rs["t1"];?>" class="with-tip"><?php echo $rs["t1"];?> (<?php if($rs["s13"]==1){echo "A";}else{echo "P";}?>)</span>
										</td>
										<td class="tac"><?php if($rs["i2"]<>""){echo $rs["i1"];}else{echo "∞";}?></td>
										<td class="tac"><?php if($rs["i2"]<>""){echo $rs["i2"];}else{echo "∞";}?></td>
										<td class="tac"><?php echo $rs["pb1"];?></td>
										<td class="tac"><?php if($rs["i3"]==1){echo "<i class=\"fas fa-check-square\"></i>";}else{echo "<i class=\"fas fa-square\"></i>";}?></td>
										<td class="tac"><?php if($rs["i4"]==1){echo "<i class=\"fas fa-check-square\"></i>";}else{echo "<i class=\"fas fa-square\"></i>";}?></td>
										<td class="table-actions" style="text-align: center;">
											<div class="input-group-btn" id="btns<?php echo $rs["id"];?>">
												<button type="button" class="btn btn-info mr2" onclick="location.href='package.php?ne=<?php echo $_GET["ne"];?>&islem=dpaket&id=<?php echo $rs["id"];?>'" title="<?php echo $sdil[199]; //Düzenle?>"><i class="fa fa-pencil"></i></button>
												<button type="button" title="<?php echo $sdil[204]; //Kaldir?>" class="btn btn-danger" onclick="location.href='?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $rs["id"];?>&durum=spaket'"><i class="fa fa-times" aria-hidden="true"></i></button>
											</div>
										</td>
									</tr>
								<?php }?>
							</tbody>
						</table>
                 </div>
            </div>
</body>
<?php echo $footer?>
</html>
<?php
if($_GET["durum"] == "ypaket"){
	$rt1="".trim($sdil[200])." ".trim($packages[0])."";
	$sql = $conn->query("insert into ".$_SESSION["lang"]." (ne,t1,ts1,s12,s13) values ('paket', '".$rt1."', now(), '0', '1')");
	$sql=mysqli_query($conn, "select * from ".$_SESSION["lang"]." where ne='paket' order by id desc"); $rs=mysqli_fetch_assoc($sql);
	echo location("packages.php?ne=".$_GET["ne"]."&islem=dpaket&id=".$rs["id"]."&durum=ok",self,500,1);
}elseif($_GET["durum"] == "spaket"){
	$sqlr=mysqli_query($conn, "select * from ".$_SESSION["lang"]." where ne='paket' and id=".$_GET["id"].""); $rsr=mysqli_fetch_assoc($sqlr);
	$aql = mysqli_query($conn, "delete from ".$_SESSION["lang"]." where ne='paket' and id=".$_GET["id"]."");	
	echo location("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&durum=ok",self,500,1);
}
?>