<?php
	header('Content-Type: text/html; charset=utf-8');
	error_reporting(0);
	$path="../../";
	include("../../map.php");
	include("../../scripts.php");
	include("../../secure.php");
	//findDirectoryPath("deppo")
?>
<?php $sql=mysqli_query($conn, "select * from ".$_SESSION["lang"]." where ne='paket' and id=".$_GET["id"].""); $rs=mysqli_fetch_assoc($sql); $jsi = json_decode($rs["n17"],true);?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo $packages[0]?> <?php echo $sdil[119]; //İşlemleri?></title>
</head>
<body>
    <div class="qmodal">
        <div class="qmodal-content">
            <!-- 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"><a href="packages.php?ne=<?php echo $_GET['ne'];?>&islem=paket"><?php echo $packages[0]?></a></li>
                            <li class="breadcrumb-item active" aria-current="page"><?php echo $sdil[119]; //İşlemleri?></li>
                        </ol>
                    </nav>
                </div>
                <button type="button" class="btn btn-warning" onclick="AjaxKaydet('','');"><i class="fas fa-save"></i> Kaydet</button>
            </div>
			<form class="form" id="asave" name="rall" method="post" action="?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $_GET["id"];?>&durum=kaydet">
            <!-- Left Tab Menu -->
            <div class="v8-columns">
							<div class="v8-col200pxL-left">
								<ul class="v8-side-tabs v8-js-tabs v8-same-height">
									<li><a href="#tab-detay"><i class="fa fa-bookmark"></i><span> <?php echo $packages[0]?> <?php echo $sdil[207]; //Detay?></span></a></li>
									<li><a href="#tab-resim"><i class="fa fa-file-image-o" aria-hidden="true"></i><span> <?php echo $sdil[209]; //Resimler?></span></a></li>
								</ul>
								
								<fieldset class="grey-bg">
									<legend><i class="fa fa-power-off"></i> <?php echo $sdil[220]; //Açık/Kapalı?> <span style="font-size:8px; color:#ccc;">(s13)</span></legend>
									<select size="1" name="s13" class="form-control">
										<option value="0" <?php echo ($rs["s13"] == 0) ? 'selected' : ''; ?>>[0] <?php echo ctranslate("#Taslak"); ?></option>
										<option value="1" <?php echo ($rs["s13"] == 1) ? 'selected' : ''; ?>>[1] <?php echo ctranslate("#Yayında"); ?></option>
									</select>
								</fieldset>
								<fieldset class="grey-bg msa" style="">
									<legend>Silinmez <span style="font-size:8px; color:#ccc;">(s6)</span></legend>
									<select size="1" name="s6" class="form-control" style="position: absolute; right: 15px; top: 5px; width: 100px;">
                                        <option value="0" <?php echo ($rs["s6"] == 0) ? 'selected' : ''; ?>>...</option>
                                        <option value="1" <?php echo ($rs["s6"] == 1) ? 'selected' : ''; ?>>Silinmez</option>
                                    </select>
								</fieldset>
								<fieldset class="grey-bg">
									<legend><i class="fa fa-user-plus" aria-hidden="true"></i> <?php echo $sdil[80]; //Kullanıcı?> <span style="font-size:8px; color:#ccc;">(s19)</span></legend>
									<select size=1 name="ss19" class="form-control chosen-select">
										<option value="0">Admin</option>
										<?php $sql=mysqli_query($conn, "select * from t5 where s1=1"); while($rsm=mysqli_fetch_assoc($sql)){?>
											<option value="<?php echo $rsm["id"];?>" title="<?php echo $rsm["t1"];?>" alt="<?php echo $rsm["t1"];?>" style="color:#6699FF" <?php if ($rsm["id"]==$rs["s19"]) {?>Selected<?php }?>><?php echo $rsm["t1"];?></option>
										<?php }?>
									</select>
								</fieldset>
							</div>
							<div class="v8-col200pxL-right" 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");?>">
								<div id="tab-detay" class="v8-tabs-content" style="display: flow-root;">
									<fieldset class="grey-bg v3-col-md-<?php if(!empty($t46)){?>9<?php }else{?>12<?php }?>" style="">
										<?php $kt1="".trim($sdil[200])." ".trim($nedir)."";?>
										<legend> <?php echo $sdil[39]; //Başlık?> <span style="font-size:8px; color:#ccc;">(t1)</span></legend>
										<input type="text" name="t1" id="fcontrol" value="<?php echo $rs["t1"];?>" class="form-control" data-plugin-maxlength="" maxlength="70" onfocus="if(this.value == '<?php echo $kt1;?>') { this.value = ''} "  onblur="if(this.value == '') { this.value='<?php echo $kt1;?>'; }">
										<span id="control" style="position: absolute; margin-top: -38px; right: 2%;"></span>
									</fieldset>
									<?php if(!empty($t46)){?>
										<fieldset class="v3-col-md-3">
											<legend><?php echo $t46;?> <span style="font-size:8px; color:#ccc;">(t4)</span></legend>
											<input type="text" name="t4" value="<?php echo $rs["t4"];?>" placeholder="<?php echo $t46;?>">
										</fieldset>
									<?php }?>
									<fieldset class="grey-bg v3-col-md-3">
										<legend> <?php echo $sdil[85]; //Satış Fiyat?> <span style="font-size:8px; color:#ccc;">(pb2-pb1 t2)</span> </legend>
										<div class="v3-col-md-3 pd0">
											<input type="text" name="pb2"  value="<?php echo para($rs["pb2"]);?>" placeholder="<?php echo $module["currency"]; //Pb?>" title="Liste Satış Fiyat" class="form-control" style="text-decoration: line-through" onfocus="if(this.value == '0') { this.value = ''} "  onblur="if(this.value == '') { this.value='0'; }">
										</div>
										<div class="v3-col-md-3 pd0">
											<input type="text" name="pb1"  value="<?php echo para($rs["pb1"]);?>" placeholder="<?php echo $module["currency"]; //Pb?>" title="<?php echo $module["currency"]; //Pb?> Satış Fiyat" class="form-control" style="" onfocus="if(this.value == '0') { this.value = ''} "  onblur="if(this.value == '') { this.value='0'; }">
										</div>
										<div class="v3-col-md-3 pd0">
											<?php if($b4==1){?>
												<input type="text" name="pb3"  value="<?php echo para($rs["pb3"]);?>" placeholder="USD" title="USD Satış Fiyat" class="form-control" onfocus="if(this.value == '0') { this.value = ''} "  onblur="if(this.value == '') { this.value='0'; }">
												<input type="text" name="pb4"  value="<?php echo para($rs["pb3"]);?>" placeholder="EUR" title="EUR Satış Fiyat" class="form-control" onfocus="if(this.value == '0') { this.value = ''} "  onblur="if(this.value == '') { this.value='0'; }">
												<input type="text" name="pb5"  value="<?php echo para($rs["pb5"]);?>" placeholder="GBP" title="GBP Satış Fiyat" class="form-control" onfocus="if(this.value == '0') { this.value = ''} "  onblur="if(this.value == '') { this.value='0'; }">
											<?php }?>
										</div>
										<div class="v3-col-md-3 pd0">
											<select size=1 name="t2" class="form-control" style="<?php if($b4==1){?>display:none;<?php }?>">
												<option value="TRY" <?php if($rs["t2"]=="TL" or $rs["t2"]=="TRY") {?>Selected<?php }?>>TRY</option>
												<option value="EUR" <?php if($rs["t2"]=="EUR") {?>Selected<?php }?>>EUR</option>
												<option value="USD" <?php if($rs["t2"]=="USD") {?>Selected<?php }?>>USD</option>
												<option value="GBP" <?php if($rs["t2"]=="GBP") {?>Selected<?php }?>>GBP</option>
											</select>
										</div>
									</fieldset>
									<fieldset class="grey-bg v3-col-md-3" style="<?php if($m16<>1){?>display:none;<?php }?>">
										<legend> <?php echo $sdil[86]; //Kdv?> % <span style="font-size:8px; color:#ccc;">(s4)</span> </legend>
										<input type="text" name="ss4" class="form-control" value="<?php echo $rs["s4"];?>" style="" onkeypress="return SadeceRakam(event);" onblur="SadeceRakam(event,false)" maxlength="2" onfocus="if(this.value == '0') { this.value = ''} "  onblur="if(this.value == '') { this.value='0'; }">
									</fieldset>
									<?php if($m16==1 and ($f7==1 or $t28<>"")){?>
										<fieldset class="grey-bg v3-col-md-3">
											<legend>
												<?php if($f7==1){ echo $sdil[87]; echo " / ";} //Stok?> <?php echo $sdil[88]; //Birimi?> <span style="font-size:8px; color:#ccc;">(s5/t10)</span> </legend>
												<div class="v3-col-md-8">
													<input type="text" name="ss5" class="form-control" value="<?php echo $rs["s5"];?>" style="<?php if($f7<>1){echo "display:none;";}?>" onkeypress="return SadeceRakam(event);" onblur="SadeceRakam(event,false)" onfocus="if(this.value == '0') { this.value = ''} "  onblur="if(this.value == '') { this.value='0'; }">
												</div>
												<div class="v3-col-md-4">
													<select size=1 name="t10" class="form-control">
														<?php if(!empty($t28)){$sbirim = explode(',',$t28); foreach($sbirim as $sbrm) {$s++; if($s > 20) {$s = 1;}?>
														<option value="<?php echo $sbrm;?>" <?php if($rs["t10"]==$sbrm) {?>Selected<?php }?>><?php echo $sbrm;?></option>
													<?php }}?>
												</select>
											</div>
										</fieldset>
									<?php }?>
									<fieldset class="grey-bg v3-col-md-3">
										<legend>Süre (Gün)<span style="font-size:8px; color:#ccc;">(i5)</span></legend>
										<input type="number" class="form-control" name="i5" value="<?php echo $jsi["i5"];?>" style="" placeholder="30">
									</fieldset>
									<fieldset class="grey-bg v3-col-md-3">
										<legend>Max Kayıt<span style="font-size:8px; color:#ccc;">(i1)</span></legend>
										<input type="number" class="form-control" name="i1" value="<?php echo $jsi["i1"];?>" style="" placeholder="">
									</fieldset>
									<fieldset class="grey-bg v3-col-md-3">
										<legend>Max Resim<span style="font-size:8px; color:#ccc;">(i2)</span></legend>
										<input type="number" class="form-control" name="i2" value="<?php echo $jsi["i2"];?>" style="" placeholder="">
									</fieldset>
									
									<fieldset class="grey-bg v3-col-md-3">
										<legend>Otomatik Onay<span style="font-size:8px; color:#ccc;">(i3)</span></legend>
											<select size="1" name="i3" class="form-control">
												<option value="0" <?php echo ($jsi["i3"] == 0) ? 'selected' : ''; ?>>...</option>
												<option value="1" <?php echo ($jsi["i3"] == 1) ? 'selected' : ''; ?>>Aktif</option>
											</select>
									</fieldset>
									<fieldset class="grey-bg v3-col-md-3">
										<legend>Vitrin<span style="font-size:8px; color:#ccc;">(i4)</span></legend>
											<select size="1" name="i4" class="form-control">
												<option value="0" <?php echo ($jsi["i4"] == 0) ? 'selected' : ''; ?>>...</option>
												<option value="1" <?php echo ($jsi["i4"] == 1) ? 'selected' : ''; ?>>Aktif</option>
											</select>
									</fieldset>
								</div>
								<div id="tab-resim" class="v8-tabs-content" style="min-height:500px; position:relative;">
									<fieldset class="v3-row">
										<legend><?php echo $sdil[209]; //Resimler?></legend>
										<script type="text/JavaScript" language="JavaScript">
											jQuery(document).ready(function () {
												loadFunction('../ajax/ajax_medya.php','#mresim', 'resim');
											});
											document.write("<div id=\"mresim\"></div>");
										</script>
									</fieldset>
								</div>
							</div>
						</div>
                 </div>
            </div>
</form>
</body>
<script src="../../assets/js/tabs.js"></script>
<?php echo $footer?>
</html>
<?php
//-------------------------------------------------------------------------/İşlem Ekle/
if($_GET["durum"] == "kaydet"){
	$iarr = array();
	foreach ($_POST as $key => $value){
		if(substr($key,0,1)=="i"){
			$iarr = $iarr + array( $key => $value);
		}
	}
	$rjsi = json_encode($iarr, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
	if(!empty($_POST["ss1"])){$ss1=$_POST["ss1"];}else{$ss1="0";}
	if(!empty($_POST["ss4"])){$ss4=$_POST["ss4"];}else{$ss4="0";}
	if(!empty($_POST["ss5"])){$ss5=$_POST["ss5"];}else{$ss5="0";}
	if(!empty($_POST["ss13"])){$ss13=$_POST["ss13"];}else{$ss13="0";}
	if(!empty($_POST["pb1"])) {$kpb1=trim($_POST["pb1"]);} else{$kpb1="0";}
	if(!empty($_POST["pb2"])) {$kpb2=trim($_POST["pb2"]);} else{$kpb2="0";}
	$Sql = mysqli_query($conn, "update ".$_SESSION['lang']." set t1='".addslashes(stripslashes($_POST["t1"]))."', ts2=now() where id=".$_GET["id"]."");
	for ($l = 1; $l <= $lx; $l++) {
		$Sql = mysqli_query($conn, "update lang".$l." set t2='".$_POST["t2"]."', t4='".$_POST["t4"]."', t10='".$_POST["t10"]."', s4=".$ss4.", s5=".$ss5.", s13=".$ss13.", s19='".$_SESSION["user_id"]."', pb1='".sprice($kpb1)."', pb2='".sprice($kpb2)."', n17='".addslashes(stripslashes($rjsi))."', ts2=now() where id=".$_GET["id"]."");
	}
	echo location("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&id=".$_GET["id"]."&durum=ok",self,500,1);
}
?>