<?php 
if($_GET["ne"]=="kayit" and $module["m5_kayit"]==""){
	$maddeli=explode('+', srep($m2));
}else if($_GET["ne"]=="uye" and $module["m5_uye"]==""){
	$maddeli=explode('+', srep($n17));
}else if($_GET["ne"]=="servis" and $module["m5_service"]==""){
	$maddeli=explode('+', srep($n13));
}else{
	$maddeli=explode('+', srep($module["m5_".$_GET["ne"].""]));
}
?>
<div class="v8-tabs-extra">
	<div id="tab-locales">
		<ul class="v8-mini-tabs v8-no-margin v8-js-tabs v8-same-height">
			<?php
			$x=0; foreach($maddeli as $gname) {$x++;
				$xgrup=explode(':', $gname); if($xgrup[1]<>""){ $gname=$xgrup[0];}else{ $gname="".translate("Grup")."-".$x."";}
				?>
				<li><a href="#tab-ext<?php echo $x?>"><?php echo $gname?> <span style="font-size:8px; color:#ccc;">(S2-<?php echo $x?>)</span></a></li>
			<?php }?>
		</ul>
		<?php for ($y = 1; $y <= count($maddeli); $y++) {
			if($y==1){
				$grup=explode(',', $maddeli[0]);
			}elseif($y==2){
				$grup=explode(',', $maddeli[1]);
			}elseif($y==3){
				$grup=explode(',', $maddeli[2]);
			}elseif($y==4){
				$grup=explode(',', $maddeli[3]);
			}elseif($y==5){
				$grup=explode(',', $maddeli[4]);
			}
			?>
			<div id="tab-ext<?php echo $y?>">
				<fieldset class="grey-bg row">
					<div class="alert alert-warning dn" id="err" style="display:none; width:100%"></div>
					<legend><?php echo $sdil[126]?></legend>
					<table class="table table-no-more table-bordered table-striped mb-0 sortable">
						<form method="post" id="fextra<?php echo $y;?>" class="nfx<?php echo $a?>" name="nfx<?php echo $a?>" autocomplete="off">
							<tr class="addtr" style="min-height: 30px;" data-id="" onclick="toggle('#bildirim0<?php echo $y?>');">
								<input type="hidden" name="sx2" value="<?php echo $y?>">
								<?php
								$a=0; foreach($grup as $imadde) {$a++;
									$xmadde=explode(':', $imadde); if($xmadde[1]<>""){ $imadde=$xmadde[1];}
									?>
									<td>
										<div style="position:absolute; margin-top: -5px; margin-left: -20px; display:none;" id="bildirim0">
											<input title="<?php echo $sdil[218]; //Vitrin?>" type="checkbox" name="xs7" style="height: 18px;width:18px; margin-top: 5px;" value="1" /><br><br>
											<input title="<?php echo $sdil[220]; //Açık/Kapalı?>" type="checkbox" name="xs13" style="height: 18px;width:18px; margin-top: 5px;" value="1" Checked />
										</div>
										<input type="text" name="nx<?php echo $a?>" list="lx<?php echo $a?>" id="nx<?php echo $a?>" style="" class="nx<?php echo $a?> form-control v3-input-sm" title="<?php echo $imadde;?>" placeholder="<?php echo $imadde;?>">
									</td>
								<?php }?>
								<td class="w7">
									<select name="tx2" id="tx2" class="form-control">
										<option value="All">[0] <?php echo $sdil[132] //Tüm?></option>
										<?php $i = 0;$diller = explode(',',$m1); foreach($diller as $dil) {$i++; if($i > 99) {$i = 1;}?>
										<option value="lang<?php echo $i?>" <?php if ($_SESSION["lang"]=="lang".$i.""){?>Selected<?php }?>>[<?php echo $i;?>] <?php echo $dil;?></option>
									<?php }?>
								</select>
							</td>
							<td class="w5">
								<input type="text" name="sx10" style="" class="form-control v3-input-sm" title="<?php echo $sdil[74]?>" placeholder="<?php echo $sdil[74]?>" value="0" onfocus="if(this.value == '0') { this.value = ''} "  onblur="if(this.value == '') { this.value='0'; }">
							</td>
							<td class="w8">aaa
								<div class="input-group-btn">
									<a tabindex="-1" onclick="Pcke('../public/extra_ajax.php?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $_GET["id"];?>&durum=extra','#fextra<?php echo $y;?>','#err','nfx<?php echo $a?>');" class="btn btn-warning mbtn" type="submit" <?php if ($e10==1 and $_SESSION["user"]<>V3d('TWFzdGVy')){?>disabled<?php }?>><i class="fa fa-plus "></i><span class="ddn"> <?php echo $sdil[201]; //ekle?></span></a>
									<a tabindex="-1" onclick="vtr('xn_<?php echo $y;?>');toggle('#vtr_1<?php echo $y;?>');toggle('#vtr_0<?php echo $y;?>')" class="btn btn-default mbtn" style="margin-left:1px !important" id="vtr_1<?php echo $y;?>"><i class="fa fa-angle-double-down"></i><span class="ddn"> <?php echo $sdil[207]; //Detay?></span></a>
									<a tabindex="-1" onclick="htr('xn_<?php echo $y;?>');toggle('#vtr_1<?php echo $y;?>');toggle('#vtr_0<?php echo $y;?>')" class="btn btn-default mbtn" style="display:none;margin-left:1px !important" id="vtr_0<?php echo $y;?>"><i class="fa fa-angle-double-up"></i><span class="ddn"> <?php echo $sdil[207]; //Detay?></span></a>
								</div>
							</td>
							<input type="submit" style="display:none;" />
						</tr>
						<tbody>
							<tr style="visibility: hidden;display: none;" id="xn_<?php echo $y;?>">
								<td colspan="10" style="padding:0px;">
									<div id="">
										<textarea class="form-control" style="height:60px;" name="nx12" placeholder="<?php echo $sdil[40]; //Kısa?> [n12]"></textarea>
										<textarea class="form-control" style="margin-top:10px; height:50px;" name="nx11" id="rtex0_<?php echo $y;?>"></textarea>
										<script>CKEDITOR.replace('rtex0_<?php echo $y;?>');</script>
										<div class="v3-col-md-12 v3-row mt20">
											<a class="v3-btn v3-btn-xs v3-btn-default sam" style="" href="?ne=ayarlar&islem=inputs&nedir=extra&kid=<?php echo $xn["id"]?>"><i class="fa fa-wrench" aria-hidden="true"></i></a>
											<?php $i=0;$sqli=mysqli_query($conn, "select * from genel where ne='inputs' and (t2='All' or t2='".$_SESSION["lang"]."') and n3='extra' and n4<>'switch' and s1=0 order by s10 asc"); while($rsi=mysqli_fetch_assoc($sqli)){$i++;?>
												<fieldset class="v3-col-md-3" style="">
													<legend><i class="<?php echo $rsi["n14"]?>"></i> <?php echo $rsi["n1"];?> <span style="font-size:8px; color:#ccc;"> (i<?php echo $i;?>)</span></legend>
													<?php if($rsi["n4"]=="input"){?>
														<input class="form-control <?php echo $rsi["n13"]?>" type="<?php echo $rsi["n5"]?>" name="xi<?php echo $i;?>" value="<?php echo $spjsi["xi".$i.""];?>" placeholder="<?php echo $rsi["n11"]?>" style="" <?php echo $rsi["n8"]?> <?php echo $rsi["n6"]?>>
													<?php }elseif($rsi["n4"]=="textarea"){?>
														<textarea class="form-control <?php echo $rsi["n13"]?>" name="xi<?php echo $i;?>" placeholder="<?php echo $rsi["n11"]?>" <?php echo $rsi["n8"]?> <?php echo $rsi["n6"]?>><?php echo $spjsi["xi".$i.""];?></textarea>
													<?php }elseif($rsi["n4"]=="select"){?>
														<select class="form-control <?php echo $rsi["n13"]?> chosen-select" name="xi<?php echo $i;?>[]" style="" <?php echo $rsi["n8"]?> <?php echo $rsi["n6"]?>>
															<option value=""><?php echo $sdil[221]; //Lütfen Seçiniz?></option>
															<?php $o=0;$sqlo=mysqli_query($conn, "select * from genel where ne='inputs' and s1=".$rsi["id"]." order by s10 asc"); while($rso=mysqli_fetch_assoc($sqlo)){$o++;?>
																<option value="<?php echo $rso["n2"]?>" <?php $q="";foreach($spjsi["i".$i.""] as $q){?><?php if($q==$rso["n2"] or $rso["n3"]==1){echo "selected";}}?>><?php echo $rso["n1"]?></option>
															<?php }?>
														</select>
													<?php }elseif($rsi["n4"]=="radio"){?>
														<?php $o=0;$sqlo=mysqli_query($conn, "select * from genel where ne='inputs' and t2='".$_SESSION["lang"]."' and s1=".$rsi["id"]." order by s10 asc"); while($rso=mysqli_fetch_assoc($sqlo)){$o++;?>
															<div style="float:left; margin-right: 5px;">
																<label style="float:left; margin-right:5px;"><?php echo $rso["n1"];?>
																<input type="radio" name="xi<?php echo $i;?>" value="<?php echo $rso["n2"];?>" <?php echo $rsi["n8"]?> <?php if($spjsi["xi".$i.""]==$rso["n2"] or $rso["n3"]==1){echo "checked";}?>></label>
															</div>
														<?php }?>
													<?php }elseif($rsi["n4"]=="checkbox"){?>
														<ul class="clist" style="z-index:99999;position:absolute; display:none;" id="cl<?php echo $rsi["id"];?>">
															<?php $o=0;$sqlo=mysqli_query($conn, "select * from genel where ne='inputs' and t2='".$_SESSION["lang"]."' and s1=".$rsi["id"]." order by s10 asc"); while($rso=mysqli_fetch_assoc($sqlo)){$o++;?>
																<li onclick="cbox('#cl<?php echo $rsi["id"];?>c<?php echo $o;?>')" style="cursor:pointer;"><input type="checkbox" onclick="cbox('#cl<?php echo $rsi["id"];?>c<?php echo $o;?>')" id="cl<?php echo $rsi["id"];?>c<?php echo $o;?>" name="xi<?php echo $i;?>[]" value="<?php echo $rso["n2"];?>" <?php echo $rsi["n8"]?> <?php foreach($spjsi["xi".$i.""] as $q){if($q==$rso["n2"] or $rso["n3"]==1){echo "checked"; $ql .="".$q.", ";}}?>> <?php echo $rso["n1"];?></li>
															<?php }?>
														</ul>
														<div style="cursor:pointer;" onclick="toggle('#cl<?php echo $rsi["id"];?>')"><?php if($ql<>""){echo substr($ql,0,-2);}else{echo $sdil[221];} //Lütfen Seçiniz?> <i class="fa fa-angle-down" style="float:right;"></i></div>
														<?php $ql="";$q="";}?>
														<p style="font-size:10px;"><?php echo $rsi["n9"];?></p>
													</fieldset>
												<?php }?>
											</div>
										</td>
									</tr>
								</form>
								<?php
								$kdt=0;$kht=0;
								$sql=mysqli_query($conn, "select * from t1 where t1='".$_GET['ne']."' and (t2='All' or t2='".$_SESSION['lang']."') and s1=".$_GET["id"]." and s2=".$y." order by s10,n1 asc"); while($nx=mysqli_fetch_assoc($sql)){
									$spjsi = json_decode($nx["n17"], true);
									?>
									<form action="../public/extra_ajax.php?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $_GET["id"];?>&extra_id=<?php echo $nx["id"];?>&durum=extra" method="post" autocomplete="off" id="xf<?php echo $nx["id"];?>" name="xf<?php echo $nx["id"];?>" class="xf<?php echo $b?>">
										<tr class="edittr" data-id="<?php echo $nx["id"];?>" style="min-height: 30px;" onclick="toggle('#bildirim<?php echo $nx["id"];?>')">
											<input type="hidden" name="sx2" value="<?php echo $nx["s2"];?>">
											<?php $b=0; foreach($grup as $imadde) {$b++;?>
												<td>
													<?php if($b==1){?>
														<div style="position:absolute; margin-top: -5px; margin-left: -20px; display:none;" id="bildirim<?php echo $nx["id"];?>">
															<input title="<?php echo $sdil[218]; //Vitrin?>" type="checkbox" name="sx7" style="height: 18px;width:18px; margin-top: 5px;" value="1" <?php if($nx["s7"]==1){?>Checked<?php }?> /><br>
															<input title="<?php echo $sdil[220]; //Açık/Kapalı?>" type="checkbox" name="sx13" style="height: 18px;width:18px; margin-top: 5px;" value="1" <?php if($nx["s7"]==1){?>Checked<?php }?> Checked />
														</div>
													<?php }?>
													<input type="text" name="nx<?php echo $b?>" list="lnx<?php echo $b?>" id="nx<?php echo $b?>-<?php echo $nx["id"];?>" style="" value="<?php echo $nx["n".$b.""];?>" class="ox<?php echo $b?> form-control v3-input-sm" title="<?php echo $imadde;?>" placeholder="<?php echo $imadde;?>">
												</td>
											<?php }?>
											<td class="w7">
												<select name="tx2" id="tx2" class="form-control">
													<option value="All" <?php if ($nx["t2"]=="" or $nx["t2"]=="All"){?>Selected<?php }?>>[0] <?php echo $sdil[132] //Tüm?></option>
													<?php $i = 0;$diller = explode(',',$m1); foreach($diller as $dil) {$i++; if($i > 99) {$i = 1;}?>
													<option value="lang<?php echo $i?>" <?php if ($nx["t2"]=="lang".$i."" or ($nx["t2"]=="" and $_SESSION["lang"]=="lang".$i."")){?>Selected<?php }?>>[<?php echo $i;?>] <?php echo $dil;?></option>
												<?php }?>
											</select>
										</td>
										<td class="w3">
											<input type="text" name="sx10" style="" class="form-control v3-input-sm" title="<?php echo $sdil[74]?>" value="<?php echo $nx["s10"]?>" placeholder="<?php echo $sdil[74]?>" onfocus="if(this.value == '0') { this.value = ''} "  onblur="if(this.value == '') { this.value='0'; }">
										</td>
										<td class="w8">
											<div class="input-group-btn">
												<a tabindex="-1" class="btn btn-warning mbtn" id="b<?php echo $nx["id"];?>" onclick="Ajaxs('<?php echo $nx["id"];?>','#err','Pcke');" <?php if ($e10==1 and $_SESSION["user"]<>V3d('TWFzdGVy')){?>disabled<?php }?>><i class="fa fa-refresh"></i><span class="ddn"> <?php echo $sdil[203]; //Güncelle?></span></button>
													<a style="margin-left: 1px" tabindex="-1" class="btn btn-danger btn-delete-row mbtn" data-href="../public/extra_ajax.php?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $_GET["id"];?>&durum=extra_s&extra_id=<?php echo $nx["id"];?>&sx2=<?php echo $nx["s2"];?>"><i class="fa fa-times "></i><span class="ddn"> <?php echo $sdil[204]; //Kaldır?></span></a>
													<a tabindex="-1" onclick="vtr('xn<?php echo $nx["id"];?>');toggle('#vtr_1<?php echo $nx["id"];?>');toggle('#vtr_0<?php echo $nx["id"];?>')" id="vtr_1<?php echo $nx["id"];?>" class="btn btn-default mbtn" style="margin-left:1px !important"><i class="fa fa-angle-double-down"></i><span class="ddn"> <?php echo $sdil[207]; //Detay?></span></a>
													<a tabindex="-1" onclick="htr('xn<?php echo $nx["id"];?>');toggle('#vtr_1<?php echo $nx["id"];?>');toggle('#vtr_0<?php echo $nx["id"];?>')" id="vtr_0<?php echo $nx["id"];?>" class="btn btn-default mbtn" style="display:none;margin-left:1px !important"><i class="fa fa-angle-double-up"></i><span class="ddn"> <?php echo $sdil[207]; //Detay?></span></a>
												</div>
											</td>
											<input type="submit" style="display:none;" />
										</tr>
										<tr style="visibility: hidden;display: none;" id="xn<?php echo $nx["id"];?>">
											<td colspan="10">
												<div>
													<textarea class="form-control" style="height:60px;" name="nx12" placeholder="<?php echo $sdil[40]; //Kısa?> [n12]"><?php echo $nx["n12"];?></textarea>
													<textarea class="form-control" style="margin-top:10px; height:50px;" name="nx11" id="rtex<?php echo $nx["id"];?>_<?php echo $y;?>"><?php echo $nx["n11"];?></textarea>
												</div>
												<script>CKEDITOR.replace('rtex<?php echo $nx["id"];?>_<?php echo $y;?>');</script>
												<div class="v3-col-md-12 v3-row mt20">
													<a class="v3-btn v3-btn-xs v3-btn-default sam" style="" href="?ne=ayarlar&islem=inputs&nedir=extra&kid=<?php echo $nx["id"]?>"><i class="fa fa-wrench" aria-hidden="true"></i></a>
													<?php $i=0;$sqli=mysqli_query($conn, "select * from genel where ne='inputs' and (t2='All' or t2='".$_SESSION["lang"]."') and n3='extra' and n4<>'switch' and s1=0 order by s10 asc"); while($rsi=mysqli_fetch_assoc($sqli)){$i++;?>
														<fieldset class="v3-col-md-3" style="">
															<legend><i class="<?php echo $rsi["n14"]?>"></i> <?php echo $rsi["n1"];?> <span style="font-size:8px; color:#ccc;"> (i<?php echo $i;?>)</span></legend>
															<?php if($rsi["n4"]=="input"){?>
																<input class="form-control <?php echo $rsi["n13"]?>" type="<?php echo $rsi["n5"]?>" name="xi<?php echo $i;?>" value="<?php echo $spjsi["xi".$i.""];?>" placeholder="<?php echo $rsi["n11"]?>" style="" <?php echo $rsi["n8"]?> <?php echo $rsi["n6"]?>>
															<?php }elseif($rsi["n4"]=="textarea"){?>
																<textarea class="form-control <?php echo $rsi["n13"]?>" name="xi<?php echo $i;?>" placeholder="<?php echo $rsi["n11"]?>" <?php echo $rsi["n8"]?> <?php echo $rsi["n6"]?>><?php echo $spjsi["xi".$i.""];?></textarea>
															<?php }elseif($rsi["n4"]=="select"){?>
																<select class="form-control <?php echo $rsi["n13"]?> chosen-select" name="xi<?php echo $i;?>[]" style="" <?php echo $rsi["n8"]?> <?php echo $rsi["n6"]?>>
																	<option value=""><?php echo $sdil[221]; //Lütfen Seçiniz?></option>
																	<?php $o=0;$sqlo=mysqli_query($conn, "select * from genel where ne='inputs' and s1=".$rsi["id"]." order by s10 asc"); while($rso=mysqli_fetch_assoc($sqlo)){$o++;?>
																		<option value="<?php echo $rso["n2"]?>" <?php $q="";foreach($spjsi["i".$i.""] as $q){?><?php if($q==$rso["n2"] or $rso["n3"]==1){echo "selected";}}?>><?php echo $rso["n1"]?></option>
																	<?php }?>
																</select>
															<?php }elseif($rsi["n4"]=="radio"){?>
																<?php $o=0;$sqlo=mysqli_query($conn, "select * from genel where ne='inputs' and t2='".$_SESSION["lang"]."' and s1=".$rsi["id"]." order by s10 asc"); while($rso=mysqli_fetch_assoc($sqlo)){$o++;?>
																	<div style="float:left; margin-right: 5px;">
																		<label style="float:left; margin-right:5px;"><?php echo $rso["n1"];?>
																		<input type="radio" name="xi<?php echo $i;?>" value="<?php echo $rso["n2"];?>" <?php echo $rsi["n8"]?> <?php if($spjsi["xi".$i.""]==$rso["n2"] or $rso["n3"]==1){echo "checked";}?>></label>
																	</div>
																<?php }?>
															<?php }elseif($rsi["n4"]=="checkbox"){?>
																<ul class="clist" style="z-index:99999;position:absolute; display:none;" id="cl<?php echo $rsi["id"];?>">
																	<?php $o=0;$sqlo=mysqli_query($conn, "select * from genel where ne='inputs' and t2='".$_SESSION["lang"]."' and s1=".$rsi["id"]." order by s10 asc"); while($rso=mysqli_fetch_assoc($sqlo)){$o++;?>
																		<li onclick="cbox('#cl<?php echo $rsi["id"];?>c<?php echo $o;?>')" style="cursor:pointer;"><input type="checkbox" onclick="cbox('#cl<?php echo $rsi["id"];?>c<?php echo $o;?>')" id="cl<?php echo $rsi["id"];?>c<?php echo $o;?>" name="xi<?php echo $i;?>[]" value="<?php echo $rso["n2"];?>" <?php echo $rsi["n8"]?> <?php foreach($spjsi["xi".$i.""] as $q){if($q==$rso["n2"] or $rso["n3"]==1){echo "checked"; $ql .="".$q.", ";}}?>> <?php echo $rso["n1"];?></li>
																	<?php }?>
																</ul>
																<div style="cursor:pointer;" onclick="toggle('#cl<?php echo $rsi["id"];?>')"><?php if($ql<>""){echo substr($ql,0,-2);}else{echo $sdil[221];} //Lütfen Seçiniz?> <i class="fa fa-angle-down" style="float:right;"></i></div>
																<?php $ql="";$q="";}?>
																<p style="font-size:10px;"><?php echo $rsi["n9"];?></p>
															</fieldset>
														<?php }?>
													</div>
												</td>
											</tr>
										</form>
										<?php
										if(is_numeric($nx["n2"]) and is_numeric($nx["n3"]) and is_numeric($nx["n4"]) and is_numeric($nx["n5"])){
											$kdt=$kdt+$nx["n5"];
											$kht=$kht+($nx["n2"]*$nx["n3"]);
										}
										?>
									<?php }?>
								</tbody>
							</table>
						</fieldset>
					</div>
				<?php }?>
			</div>
		</div>
		<script type="text/javascript">
			jQuery( document ).ready(function() {
				jQuery("tbody").sortable({
					delay: 150,
					stop: function() {
						var selectedData = new Array();
						jQuery('tr').each(function() {
							selectedData.push(jQuery(this).attr("data-id"));
						});
						updateOrder(selectedData);
					}
				});
				function updateOrder(data){
					jQuery.ajax({
						url:"../public/extra_ajax.php",
						type:'post',
						data:{position:data},
						success:function(){
							
						}
					})
				}
			});
		</script>