<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="card-body">
					<table class="table table-no-more table-bordered table-striped mb-0">
						<thead>
							<tr>
								<th class="w4" style="text-align:center;">ID
									<div class="order">
										<a href="?ne=<?php echo $_GET['ne'];?>&islem=<?php echo $_GET['islem'];?>&key=<?php echo $_GET["key"];?>&s9=<?php echo $_GET["s9"];?>&sayfa=<?php echo $_GET["sayfa"];?>&durum=order&order=ID+asc" class="fa fa-sort-asc"></a>
										<a href="?ne=<?php echo $_GET['ne'];?>&islem=<?php echo $_GET['islem'];?>&key=<?php echo $_GET["key"];?>&s9=<?php echo $_GET["s9"];?>&sayfa=<?php echo $_GET["sayfa"];?>&durum=order&order=ID+desc" class="fa fa-sort-desc"></a>
									</div>
								</th>
								<th><?php echo $task?>
								<div class="order">
									<a href="?ne=<?php echo $_GET['ne'];?>&islem=<?php echo $_GET['islem'];?>&key=<?php echo $_GET["key"];?>&s9=<?php echo $_GET["s9"];?>&sayfa=<?php echo $_GET["sayfa"];?>&durum=order&order=t1+asc" class="fa fa-sort-asc"></a>
									<a href="?ne=<?php echo $_GET['ne'];?>&islem=<?php echo $_GET['islem'];?>&key=<?php echo $_GET["key"];?>&s9=<?php echo $_GET["s9"];?>&sayfa=<?php echo $_GET["sayfa"];?>&durum=order&order=t1+desc" class="fa fa-sort-desc"></a>
								</div>
							</th>
							<th class="w10"><?php echo $sdil[80]; //Kullanıcı?></th>
							<th class="w20"><?php echo $t25?></th>
							<th class="w15"><?php echo $tasks[0]?> <?php echo $sdil["115"]; //Tarih?>
							<div class="order">
								<a href="?ne=<?php echo $_GET['ne'];?>&islem=<?php echo $_GET['islem'];?>&key=<?php echo $_GET["key"];?>&s9=<?php echo $_GET["s9"];?>&sayfa=<?php echo $_GET["sayfa"];?>&durum=order&order=t10+asc" class="fa fa-sort-asc"></a>
								<a href="?ne=<?php echo $_GET['ne'];?>&islem=<?php echo $_GET['islem'];?>&key=<?php echo $_GET["key"];?>&s9=<?php echo $_GET["s9"];?>&sayfa=<?php echo $_GET["sayfa"];?>&durum=order&order=t10+desc" class="fa fa-sort-desc"></a>
							</div>
						</th>
						<th class="w8"><?php echo $sdil["213"]; //İşlemler?></th>
					</tr>
				</thead>
				<tbody>
					<?php
							while ($rs=mysqli_fetch_assoc($sql)){
							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])){
							?>
							<tr class="<?php if($rs["t10"]<>"" and dt($rs["t10"])>5){?>alert alert-success<?php }elseif($rs["t10"]<>"" and dt($rs["t10"])<6 and dt($rs["t10"])>3){?>alert alert-warning<?php }elseif($rs["t10"]<>"" and dt($rs["t10"])<2){?>alert alert-danger<?php }?>">
								<td style="cursor:pointer;" onclick="location.href='?ne=<?php echo $_GET["ne"]?>&islem=dgorev&id=<?php echo $rs["id"]?>'" class="th table-check-cell"><?php echo i2a($rs["id"],7);?></td>
								<td>
									<?php echo $rs["t1"]?> <?php if($rs["t2"]<>""){ echo "[".$rs["t2"]."]";}?>  <?php if($rs["s3"]==1){?><i class="fa fa-check"></i><?php }?>
								</td>
								<td>
									<?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"];
									}
									?>
								</td>
								<td style="cursor:pointer; color:red;" class="with-tip">
									<?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 }?>
								</td>
								<td><?php echo dtarih($rs["t10"],"gg.ua.yyyy")?> <?php echo $rs["t8"]?></td>
								<td class="table-actions">
									<div class="input-group-btn">
										<a style="margin-right:5px;" 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 style="" 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 style="" 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 } ?>
									</div>
								</td>
							</tr>
						<?php }}?>
					</tbody>
				</table>
			</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);
}
?>