<div class="inner-wrapper">
	<!-- start: sidebar -->
	<aside id="sidebar-left" class="sidebar-left">
		
		<div class="sidebar-header">
			<div class="sidebar-title">
				Menu
			</div>
			<div class="sidebar-toggle hidden-xs" data-toggle-class="sidebar-left-collapsed" data-target="html" data-fire-event="sidebar-left-toggle">
				<i class="fa fa-bars" aria-label="Toggle sidebar"></i>
			</div>
		</div>
		
		<?php include('menu.php');?>
	</aside>
	<!-- end: sidebar -->
	<?php
	$sayfa = $_GET['sayfa'];
	if($_GET['sayfa'] == "") {$sayfa = 0; $ss = 1;}else{$sayfa = ($sayfa-1) * 20; $ss = $_GET['sayfa'];}
	if($_GET["s3"]<>""){$sorgu="and s3=".$_GET["s3"]."";}
	$sql = mysqli_query($conn, "select * from genel where ne='gorev' and s2=0 ".$sorgu." ".$luye." order by s1 asc,id desc limit $sayfa,20");
	$sqls = mysqli_query($conn, "select count(*) FROM genel where ne='gorev' and s2=0 ".$sorgu." ".$luye." order by s1 asc,id desc"); $rsay=mysqli_fetch_assoc($sqls);
	?>
	<section role="main" class="content-body">
		<header class="page-header">
			<h2><?php echo $task?></h2>
			<div class="right-wrapper text-right">
				<ol class="breadcrumbs">
					<li>
						<a href=".">
							<i class="fa fa-home"></i>
						</a>
					</li>
					<li><span>Crm +Plus</span></li>
					<li><span><?php echo $task?></span></li>
				</ol>
				
				<a class="sidebar-right-toggle" data-open="sidebar-right"><i class="fa fa-chevron-left"></i></a>
			</div>
		</header>
		<?php if($_GET["durum"]=="ok"){?>
			<div class="alert alert-success">
				<?php echo $sdil[212]; //Islem Basariyla Gerçeklestirilmistir !?>
			</div>
		<?php }?>
		
		<div class="row">
			<div class="col">
				<section class="card">
					<header class="card-header">
						<div class="card-actions" id="v-<?php echo $_GET['islem'];?>">
							<form method="post" action="?ne=<?php echo $_GET['ne'];?>&islem=<?php echo $_GET['islem'];?>&s3=<?php echo $_GET['s3'];?>&durum=goster" style="margin:0px; padding:0px; margin-right:20px;">
								<select name="sgun" class="small">
									<option value="">Seç</option>
									<?php for($g=1; $g<=32; $g++){?>
										<option value="<?php echo $g;?>" <?php if(date("d")==$g){?>Selected<?php }?>><?php echo $g;?></option>
									<?php }?>
								</select>
								<select name="say" class="small">
									<option value="">Seç</option>
									<?php for($a=1; $a<=12; $a++){?>
										<option value="<?php echo $a;?>" <?php if(date("m")==$a){?>Selected<?php }?>><?php echo $a;?></option>
									<?php }?>
								</select>
								<select name="syil" class="small">
									<option value="">Seç</option>
									<?php for ($y=date("Y"); $y <= date("Y")+30; $y++) {?>
										<option value="<?php echo $y;?>" <?php if(date("Y")==$y){?>Selected<?php }?>><?php echo $y;?></option>
									<?php }?>
								</select>
								<button type="submit" class="v3-btn v3-btn-xs">Filtrele</button>
							</form>
<!--
							<a href="#" class="card-action card-action-toggle" data-card-toggle=""></a>
							<a href="#" class="card-action card-action-dismiss" data-card-dismiss=""></a>
						-->
					</div>
					
					<h2 class="card-title"><?php echo $task?></h2>
				</header>
					<div class="pricing-table row no-gutters mt-3 mb-3">
						<?php
							while ($rs=mysqli_fetch_assoc($sql)){
							$jsi = json_decode($rs["n17"], true);
							if(($_SESSION["kim"]=="Admin") or ($_SESSION["kim"]=="yonetici" and $_SESSION["y13"]==3 and $_SESSION["user_id"]==$rs["s19"])){
								if ($rs["s6"]==1 or $authority==0){
									$yetki=0;
								}else{
									$yetki=1;
								}
							}else{
								$yetki=0;
							}
						$t10s = explode('-',$rs["t10"]);
						if(($_POST["syil"]=="" or $_POST["syil"]==$t10s[0]) and ($_POST["say"]=="" or $_POST["say"]==$t10s[1]) and ($_POST["sgun"]=="" or $_POST["sgun"]==$t10s[2])){
							?>
						<div class="col-lg-3 col-sm-6">
							<div class="plan <?php if($rs["t10"]<>"" and (dt($rs["t10"])==0)){?>most-popular<?php }?>">
								<?php if($rs["t10"]<>"" and dt($rs["t10"])==1){?><div class="plan-ribbon-wrapper"><div class="plan-ribbon">Yarın</div></div><?php }elseif($rs["t10"]<>"" and dt($rs["t10"])==0){?><div class="plan-ribbon-wrapper"><div class="plan-ribbon">Bugün</div></div><?php }?>
								<h3><?php echo $rs["t1"]?> <?php if($rs["t2"]<>""){ echo "[".$rs["t2"]."]";}?>  <?php if($rs["s3"]==1){?><i class="fa fa-check"></i><?php }?><span><?php echo dtarih($rs["t10"],"gg")?><br><?php echo dtarih($rs["t10"],"ka")?></span></h3>
										<a class="btn btn-primary" href="?ne=<?php echo $_GET["ne"]?>&islem=dgorev&id=<?php echo $rs["id"]?>"><i class="fa fa-eye"></i></a>
										<a class="btn btn-warning cw" href="?ne=<?php echo $_GET["ne"]?>&islem=dgorev&id=<?php echo $rs["id"]?>" title="<?php echo $sdil[199]; //Düzenle?>"><i class="fa fa-pencil"></i><span class="ddn"> <?php echo $sdil[199]; //Düzenle?></span></a>
										<?php if ($yetki==0){?>
											<a class="btn btn-danger btn-ban-row" title="<?php echo $sdil[216]; //Yetkili Değilsiniz ??>" data-href="#"><i class="fa fa-ban" aria-hidden="true"></i><span class="ddn"> <?php echo $sdil[216]; //Yetkili Değilsiniz ?></span></a>
										<?php }else{ ?>
											<a class="btn btn-danger btn-delete-row cw" title="<?php echo $sdil[204]; //Kaldir?>" data-href="?ne=<?php echo $_GET["ne"]?>&islem=<?php echo $_GET["islem"]?>&id=<?php echo $rs["id"]?>&durum=sgorev"><i class="fa fa-times" aria-hidden="true"></i><span class="ddn"> <?php echo $sdil[204]; //Kaldir?></span></a>
										<?php } ?>
											<a class="btn btn-info cw"><i class="fa fa-user cw" aria-hidden="true"></i> <?php if($rs["s19"]==0){ echo "Admin"; }else{ $sqlm=mysqli_query($conn, "select * from t5 where id=".$rs["s19"].""); $rsm=mysqli_fetch_assoc($sqlm); echo $rsm["t1"]; } ?></a>
								<ul style="max-height:200px; overflow:auto;">
									<li>
										<?php $t11Sx = explode(',',$rs["t11"]); $usql=mysqli_query($conn, "select * from t5"); while($rsm=mysqli_fetch_assoc($usql)){?>
											<?php foreach($t11Sx as $t11s){if($t11s==$rsm["id"]){echo $rsm["t1"];}}?>
										<?php }?>
									</li>
									<li><?php echo dtarih($rs["t10"],"gg.ua.yyyy")?> <?php echo $rs["t8"]?></li>
									<?php $i=0;$sqlix=mysqli_query($conn, "select * from genel where ne='inputs' and t2='".$_SESSION["lang"]."' and n3='".$_GET["ne"]."' and n4<>'switch' and (n2='0' or n2='".$rs["id"]."') and s1=0 order by s10 asc"); while($rsix=mysqli_fetch_assoc($sqlix)){$i++;?>
									<li><b><?php echo $rsix["n1"];?></b>; <?php echo $jsi["i".$i.""];?></li>
									<?php }?>
								</ul>
							</div>
						</div>
<?php }}?>
					</div>						
		</section>
	</div>
</div>
<!-- end: page -->
</section>
</div>
<aside id="sidebar-right" class="sidebar-right">
	<div class="nano">
		<div class="nano-content">
			<a href="#" class="mobile-close d-md-none">
				Collapse <i class="fa fa-chevron-right"></i>
			</a>
			<div class="sidebar-right-wrapper">
				...
			</div>
		</div>
	</div>
</aside>
</section>
<?php
if ($_GET["durum"]=="sgorev"){
	$dsql=mysqli_query($conn, "select * from genel where id='".$_GET["id"]."' order by id desc"); $drs=mysqli_fetch_assoc($dsql); $lt1=$drs["t1"];
	$sql = mysqli_query($conn, "delete from genel where id=".$_GET["id"]);
	$sql = mysqli_query($conn, "delete from t4 where s5=".$_GET["id"]);
	$sqln = mysqli_query($conn, "delete from genel where s2='".$_GET["id"]."'");
	echo location("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&durum=ok",self,500,1);
}elseif ($_GET["durum"]=="ygorev"){
	$st1="".trim($sdil[200])." ".trim($nedir)."";
	$sql = $conn->query("insert into genel(ne, t1, s1, s2, s3, s4, s5, s6, s19,ts1) values ('gorev', '".$st1."', '0', '0', '0', '0', '0', '0', '".$_SESSION["user_id"]."',now())");		
	$sql=mysqli_query($conn, "select * from genel where ne='".$_GET["ne"]."' order by id desc"); $rs=mysqli_fetch_assoc($sql);
	echo location("?ne=".$_GET["ne"]."&islem=dgorev&id=".$rs["id"]."&durum=ok",self,500,1);
}elseif ($_GET["durum"]=="arsiv"){
	$sql=mysqli_query($conn, "select * from genel where ne='".$_GET["ne"]."' and s3=1 order by id desc"); while($rs=mysqli_fetch_assoc($sql)){
		$Rs = mysqli_query($conn, "update genel set s2='1' where id=".$rs["id"]."");
	}
	echo location("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&durum=ok",self,500,1);
}
?>