<?php
$path="../../";
include("../../map.php");
include("../../secure.php");
include("../../scripts.php");
$sql=mysqli_query($conn, "select * from genel where ne='tanim' and id=".$_GET["id"].""); $rs=mysqli_fetch_assoc($sql);
?>
	<meta http-equiv="Content-Type" content="text/HTML; charset=utf-8" />
	<div class="panel panel-primary">
		<div class="panel-heading"><?php echo ihb($rs["n4"]);?></div>
		<div class="">
			<form action="?id=<?php echo $_GET["id"]?>&durum=duzenle" method="post" class="panel-body" style="padding: 5px 15px;">
				<div class="col-xs-3">
					<label>User Name</label>
					<input name="n1" type="text" placeholder="User Name" value="<?php echo v3d($rs["n1"]);?>" class="form-control">
				</div>
				<div class="col-xs-3">
					<label>Pass</label>
					<input name="n2" type="text" placeholder="Pass" value="<?php echo v3d($rs["n2"]);?>" class="form-control">
				</div>
				<div class="col-xs-3">
					<label>MerchantId/Api Key</label>
					<input name="n3" type="text" placeholder="MerchantId/Api Key" value="<?php echo $rs["n3"];?>" class="form-control">
				</div>
				<div class="col-xs-3">
					<label>Secret Key</label>
					<input name="n6" type="text" placeholder="Secret Key" value="<?php echo $rs["n6"];?>" class="form-control">
				</div>
				<?php if($rs["t2"]=="sp"){?>
				<div class="col-xs-3">
					<label>Kargo Süresi</label>
					<input name="t5" list="lt5" type="text" placeholder="Kargo Süresi" value="<?php echo $rs["t5"];?>" class="form-control"<?php if($rs["n4"]=="n11"){echo "required";}?>>
					<datalist id="lt5">
					<?php if($rs["n4"]=="ciceksepeti"){?>
							<option value="1">Çiçek_Servis</option>
							<option value="4">Hediye Kargo Aynı</option>
							<option value="5">Hediye Kargo 1-3</option>
							<option value="18">Hediye Kargo 1-2</option>
					<?php }?>
					</datalist>
				</div>
				<div class="col-xs-3">
					<label><?php if($rs["n4"]=="n11"){echo "Depo";}else{echo "Kargo Ücreti";}?></label>
					<input name="t6" list="lt6" type="text" placeholder="<?php if($rs["n4"]=="n11"){echo "Depo";}else{echo "Kargo Ücreti";}?>" value="<?php echo $rs["t6"];?>" class="form-control"<?php if($rs["n4"]=="n11"){echo "required";}?>>
					<datalist id="lt6">
					<?php if($rs["n4"]=="gittigidiyor"){?>
							<option value="S">Satıcı Öder(Ücretsiz Kargo)</option>
							<option value="B">Alıcı Öder(Ücretli Kargo)</option>
					<?php }?>
					</datalist>
				</div>
				<div class="col-xs-3">
					<label>Kargo Firması</label>
					<input name="t8" list="lt8" type="text" placeholder="Kargo ID" value="<?php echo $rs["t8"];?>" class="form-control" <?php if($rs["n4"]=="trendyol"){echo "required";}?>>
					<datalist id="lt8">
					<?php
					if($rs["n4"]=="trendyol"){
					$result = file_get_contents('https://api.trendyol.com/sapigw/shipment-providers');
					$arrays = json_decode($result, true);
					?>
						<?php foreach($arrays as $key=>$value){?>
							<option value="<?php echo $value["id"]?>"><?php echo $value["name"]?></option>
						<?php }?>
					<?php }elseif($rs["n4"]=="gittigidiyor"){?>
							<option value="aras">Aras</option>
							<option value="yurtici">Yurtiçi</option>
							<option value="mng">Mng</option>
							<option value="surat">Sürat</option>
					<?php }elseif($rs["n4"]=="ciceksepeti"){?>
							<option value="1">Servis Aracı İle Gönderim</option>
							<option value="2">Kargo İle Gönderim</option>
							<option value="3">Kargo+Servis Aracı</option>
					<?php }?>
					</datalist>
				</div>
				<div class="col-xs-3">
					<label>Yuvarlama</label>
					<select name="t7" class="form-control">
						<option <?php if($rs["t7"]==""){echo "selected";}?>>Yok</option>
						<option value="round" <?php if($rs["t7"]=="round"){echo "selected";}?>>En Yakına</option>
						<option value="ceil" <?php if($rs["t7"]=="ceil"){echo "selected";}?>>Yukarı</option>
						<option value="floor" <?php if($rs["t7"]=="floor"){echo "selected";}?>>Aşağı</option>
						<option value="intval" <?php if($rs["t7"]=="intval"){echo "selected";}?>>Küsüratsız</option>
					</select>
				</div>
				<?php }elseif($rs["t2"]=="xml"){?>
				<div class="col-xs-3">
					<label>Min Stok</label>
					<input name="t5" list="lt5" type="text" placeholder="Min Stok" value="<?php echo $rs["t5"];?>" class="form-control">
				</div>
				<div class="col-xs-3">
					<label>Kar Oranı</label>
					<input name="t6" list="lt6" type="text" placeholder="Kar Oranı" value="<?php echo $rs["t6"];?>" class="form-control">
				</div>
				<div class="col-xs-3">
					<label>...</label>
					<input name="t8" list="lt8" type="text" placeholder="" value="<?php echo $rs["t8"];?>" class="form-control">
				</div>
				<div class="col-xs-3">
					<label>Yuvarlama</label>
					<select name="t7" class="form-control">
						<option <?php if($rs["t7"]==""){echo "selected";}?>>Yok</option>
						<option value="round" <?php if($rs["t7"]=="round"){echo "selected";}?>>En Yakına</option>
						<option value="ceil" <?php if($rs["t7"]=="ceil"){echo "selected";}?>>Yukarı</option>
						<option value="floor" <?php if($rs["t7"]=="floor"){echo "selected";}?>>Aşağı</option>
						<option value="intval" <?php if($rs["t7"]=="intval"){echo "selected";}?>>Küsüratsız</option>
					</select>
				</div>
				<?php }elseif($rs["t2"]=="extre"){?>
				<div class="col-xs-3">
					<label>Banka</label>
					<input type="hidden" value="<?php echo $rs["s1"];?>" name="s1" id="s1">
					<input type="hidden" value="<?php echo $rs["t3"];?>" name="t3" id="t3">
					<input name="n4" id="n4" list="ln4" type="text" placeholder="Banka" value="<?php echo $rs["n4"];?>" class="form-control">
						<datalist id="ln4">
							<option selected value="0"><?php echo $sdil[221]; //Lütfen Seçiniz?></option>
							<option value="Garanti BBVA" data-id="16" data-cc="62" data-cl="69CD33">Garanti BBVA</option>
							<option value="Akbank" data-id="41" data-cc="46" data-cl="FEDC04">Akbank</option>
							<option value="Yapı Kredi" data-id="39" data-cc="67" data-cl="6C0071">Yapı Kredi</option>
							<option value="Tc.İş Bankası" data-id="28" data-cc="64" data-cl="E21066">Tc.İş Bankası</option>
							<option value="Vakıfbank" data-id="38" data-cc="15" data-cl="f7b413">Vakıfbank</option>
							<option value="Ziraat Bankası" data-id="40" data-cc="10" data-cl="e51519">Ziraat Bankası</option>
							<option value="Qnb Finansbank" data-id="14" data-cc="111" data-cl="0E4391">Qnb Finansbank</option>
							<option value="Deniz Bank" data-id="12" data-cc="134" data-cl="01326d">Deniz Bank</option>
							<option value="Tc.Halk Bankası" data-id="27" data-cc="12" data-cl="36defd">Tc.Halk Bankası</option>
							<option value="TEB" data-id="32" data-cc="32" data-cl="00a76d">TEB</option>
							<option value="Albarakatürk" data-id="3" data-cc="203" data-cl="ca132b">Albarakatürk</option>
							<option value="Anadolubank" data-id="5" data-cc="135" data-cl="000">Anadolubank</option>
							<option value="Asya Katılım Bankası" data-id="7" data-cc="208" data-cl="0c467e">Asya Katılım Bankası</option>
							<option value="Citibank" data-id="11" data-cc="92" data-cl="f80000">Citibank</option>
							<option value="Fortis Bank" data-id="15" data-cc="71" data-cl="f80000">Fortis Bank</option>
							<option value="HSBC Bank" data-id="18" data-cc="123" data-cl="d50011">HSBC Bank</option>
							<option value="ING Bank" data-id="19" data-cc="99" data-cl="f85612">ING Bank</option>
							<option value="Kuveyt Türk" data-id="20" data-cc="205" data-cl="036345">Kuveyt Türk</option>
							<option value="Şekerbank" data-id="26" data-cc="59" data-cl="01774f">Şekerbank</option>
							<option value="Türkiye Finans" data-id="37" data-cc="206" data-cl="00c0ae">Türkiye Finans</option>
							<option value="Diğer" data-id="0" data-cc="0" data-cl="ccc">Diğer</option>
						</datalist>
				</div>
				<script type="text/javascript">
					jQuery('#n4').on('change',function(){
						var val=jQuery('#n4').val();
						var id= jQuery('#ln4').find('option[value="'+val+'"]').data('id');
						var cl= jQuery('#ln4').find('option[value="'+val+'"]').data('cl');
						jQuery('#s1').val(id); jQuery("#t3").val(cl);
					}); 
				</script>
				<div class="col-xs-3">
					<label>Hesap No</label>
					<input name="t5" type="text" placeholder="Hesap No" value="<?php echo $rs["t5"];?>" class="form-control">
				</div>
				<div class="col-xs-3">
					<label>Şube Kodu</label>
					<input name="t8" type="text" placeholder="Şube Kodu" value="<?php echo $rs["t8"];?>" class="form-control">
				</div>
				<div class="col-xs-3">
					<label>Iban</label>
					<input name="t6" type="text" placeholder="Iban" value="<?php echo $rs["t6"];?>" class="form-control">
				</div>
				<div class="col-xs-3">
					<label>Döviz Cinsi</label>
					<input name="t7" list="lt7" type="text" placeholder="Döviz Cinsi" value="<?php echo $rs["t7"];?>" class="form-control">
					<datalist id="lt7">
						<option value="TRY">TRY</option>
						<option value="USD">USD</option>
						<option value="EUR">EUR</option>
					</datalist>
				</div>
				<?php }elseif($rs["t2"]=="efatura"){?>
				<div class="col-xs-3">
					<label>Firma Adı</label>
					<input name="t3" type="text" placeholder="" value="<?php echo $rs["t3"];?>" class="form-control">
				</div>
				<div class="col-xs-3">
					<label>Adres-1</label>
					<input name="t4" type="text" placeholder="" value="<?php echo $rs["t4"];?>" class="form-control">
				</div>
				<div class="col-xs-3">
					<label>Adres-2</label>
					<input name="t5" type="text" placeholder="" value="<?php echo $rs["t5"];?>" class="form-control">
				</div>
				<div class="col-xs-3">
					<label>Şehir</label>
					<input name="t6" type="text" placeholder="" value="<?php echo $rs["t6"];?>" class="form-control">
				</div>
				<div class="col-xs-3">
					<label>İlçe</label>
					<input name="t7" type="text" placeholder="" value="<?php echo $rs["t7"];?>" class="form-control">
				</div>
				<div class="col-xs-3">
					<label>Telefon</label>
					<input name="t8" type="text" placeholder="" value="<?php echo $rs["t8"];?>" class="form-control">
				</div>
				<div class="col-xs-3">
					<label>Sicil No</label>
					<input name="t9" type="text" placeholder="" value="<?php echo $rs["t9"];?>" class="form-control">
				</div>
				<div class="col-xs-3">
					<label>Mersis</label>
					<input name="t10" type="text" placeholder="" value="<?php echo $rs["t10"];?>" class="form-control">
				</div>
				<div class="col-xs-3">
					<label>Vergi Dairesi</label>
					<input name="t11" type="text" placeholder="" value="<?php echo $rs["t11"];?>" class="form-control">
				</div>
				<div class="col-xs-3">
					<label>Efatura Wsdl</label>
					<input name="n11" type="text" placeholder="" value="<?php echo $rs["n11"];?>" class="form-control">
				</div>
				<div class="col-xs-3">
					<label>Earsiv Wsdl</label>
					<input name="n12" type="text" placeholder="" value="<?php echo $rs["n12"];?>" class="form-control">
				</div>
				<div class="col-xs-12">
					<label>Not</label>
					<textarea name="n13" type="text" placeholder="" class="form-control"><?php echo $rs["n13"];?></textarea>
				</div>
				<?php }?>
				<div class="col-xs-12" style=" margin-top:15px; margin-bottom:15px;">
					<button class="btn btn-success" type="submit" style="float:right">Kaydet</button>
				</div>
				<div style="clear:both;padding: 5px; margin-top:15px; margin-bottom:0px;" class="alert alert-warning"><i class="fa fa-info-circle" aria-hidden="true"></i> ...</div>
			</form>
		</div>
	</div>
<script>
		if (document.getElementById("rte") != undefined) {
			CKEDITOR.replace('rte');
		};
	</script>
<?php
	if($_GET["durum"]=="duzenle"){
		//t2,ne,n1,n2,n3,n4,n5,n6,s10
		if($_POST["s1"]==""){$s1=0;}else{$s1=$_POST["s1"];}
		$Rs = mysqli_query($conn, "update genel set s1='".$s1."', t3='".$_POST["t3"]."', t4='".$_POST["t4"]."', t5='".$_POST["t5"]."', t6='".$_POST["t6"]."', t7='".$_POST["t7"]."', t8='".$_POST["t8"]."', t9='".$_POST["t9"]."', t10='".$_POST["t10"]."', t11='".$_POST["t11"]."', t12='".$_POST["t12"]."', t13='".$_POST["t13"]."', t14='".$_POST["t14"]."', t15='".$_POST["t15"]."', n1='".v3e($_POST["n1"])."', n2='".v3e($_POST["n2"])."', n3='".$_POST["n3"]."', n6='".$_POST["n6"]."', n11='".$_POST["n11"]."', n12='".$_POST["n12"]."', n13='".addslashes(stripslashes($_POST["n13"]))."' Where id=".$_GET["id"]."");
		echo location("?id=".$_GET["id"]."&durum=ok",self,500,1);
	}
?>