<?php
$path="../../";
include("../../map.php");
$products = json_decode(GetArr("kayit"), true);
$users = json_decode(GetArr("uye","users"), true);
?>
<table class="v3-table" style="">
	<thead>
		<tr class="mdn">
			<th><?php echo ctranslate("Açıklama")?></th>
			<th class="w15 mw15"><?php echo ctranslate("Sorumlu")?></th>
			<th class="w15 mw15"><?php echo ctranslate($t25s[0]);?></th>
			<th class="w15 wm15"><?php echo ctranslate($t24s[0])?></th>
			<?php $i=0; $fci="i"; $sqli=mysqli_query($conn, "select * from genel where ne='inputs' $linputs and (t2='All' or t2='".$_SESSION["lang"]."') and (n3='uye' or n3='relations') and n4<>'switch' and n13='list' and s1=0 $luye order by s10,id asc"); while($rsi=mysqli_fetch_assoc($sqli)){$i++;?>
				<th class="w10 mw10"><?php echo ctranslate($rsi["n1"]);?></th>
			<?php }?>
			<th class="w10 mw10"><?php echo ctranslate("Tarih")?></th>
		</tr>
	</thead>
	<tbody>
		<?php
		$sql=mysqli_query($conn, "select * from t1 where ne='relations' ".$sorgu." order by id desc limit 0,10"); while($rs=mysqli_fetch_assoc($sql)){
			if(($_GET["ts1"]=="" and $_GET["ts2"]=="" and $rs["ts1"] >= date('Y-m-d', strtotime(date("Y-m-d"). ' -30 days'))) or ($_GET["ts1"]<>"" and $_GET["ts2"]<>"") and ($rs["ts1"]>=$_GET["ts1"] and $rs["ts1"]<=$_GET["ts2"])){
				$jsi = json_decode($rs["n17"], true);
				if ($authority==0){
					$yetki=0;
				}else{
					$yetki=1;
				}
				?>
				<tr data-id="<?php echo $rs["id"];?>">
					<td class="cp mfrm mtar" data-toggle="modal" data-target="#myModal" data-url="modules/clients/client_relation_detail.php?islem=relations&id=<?php echo $rs["id"]?>" data-width="50%" data-title="<?php echo $t25s[0];?> <?php echo ctranslate("İlişkileri")?>; <?php echo $rsc["t1"]?>"><?php echo $rs["t1"]?> <?php if($rs["t5"]<>""){?><i class="emojies far fa-<?php echo $rs["t5"];?> v3-text-warning fs19 mfs19 fr mfr"></i><?php }?></td>
					<td class="mdn">
						<select  class="small form-control" disabled>
							<option value="">...</option>
							<?php
							foreach($users as $key=>$value){
								$value["id"]==$rs["s19"] ? $selected="selected" : $selected="";
								echo "<option value=\"".$value["id"]."\" id=\"".$value["id"]."\" ".$selected.">".$value["item"]."</option>";
							}
							?>
						</select>
					</td>
					<td class="">
						<select class="small form-control" disabled>
							<option value="">...</option>
							<?php
							foreach($users as $key=>$value){
								$value["id"]==$rs["s1"] ? $selected="selected" : $selected="";
								echo "<option value=\"".$value["id"]."\" id=\"".$value["id"]."\" ".$selected.">".$value["item"]."</option>";
							}
							?>
						</select>
					</td>
					<td class="mdn">
						<select class="small form-control" disabled>
							<option value="">...</option>
							<?php
							foreach($products as $key=>$value){
								$value["id"]==$rs["s2"] ? $selected="selected" : $selected="";
								echo "<option value=\"".$value["id"]."\" id=\"".$value["id"]."\" ".$selected.">".$value["item"]."</option>";
							}
							?>
						</select>
					</td>
					<?php $i=0; $fci="i"; $sqli=mysqli_query($conn, "select * from genel where ne='inputs' $linputs and (t2='All' or t2='".$_SESSION["lang"]."') and (n3='uye' or n3='relations') and n4<>'switch' and n13='list' and s1=0 $luye order by s10,id asc"); while($rsi=mysqli_fetch_assoc($sqli)){$i++;?>
						<td class="mdn"><?php if($rsi["n4"]=="input"){echo $jsi[$fci.$i];}else{echo $jsi[$fci.$i][0];}?></td>
					<?php }?>
					<td class=""><div title="<?php echo dtarih($rs["ts1"],"gg ka yyyy");?>" class="v3-date"><span><?php echo dtarih($rs["ts1"],"gg");?></span><span><?php echo dtarih($rs["ts1"],"ka");?></span></div></td>
				</tr>
			<?php }}?>
		</tbody>					
	</table>