<?php $sql=mysqli_query($conn, "select * from genel where ne='not' and t3='keep' order by id desc");?>
<?php if(mysqli_num_rows($sql)>0){?>
	<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
	<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js"></script>
	<link rel="stylesheet" type="text/css" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/base/jquery-ui.css"/>
	<link href="//fonts.googleapis.com/css?family=Patrick+Hand" rel="stylesheet">
	<script src="//rawgit.com/jackmoore/autosize/master/dist/autosize.min.js"></script>
	<div style="position: fixed; margin-left:50%; margin-rigth:50%; top: 100px; width: 60px; height: 60px; font-size: 150px; z-index: 9999999999999999999; display:none;" id="check" class="fa fa-check"></div>
	<div class="keeper" style="">
		<style>
			.k0{
				z-index:1; filter: drop-shadow(2px 4px 6px black); <?php if($mobile==""){?>position:absolute;<?php }?> border: 1px solid #ccc; margin: 5px !important; min-height:265px;
				<?php if($mobile==""){echo "width:250px; height:250px;"; }else{echo "width:95%;"; }
				echo "background:#ffff8d;";
				?>
				color: rgba(0,0,0,.87); display: inline-table; padding:10px; font-size:14px; font-family: 'Patrick Hand', cursive;
			}
			.k0:before{content: "#0"; position: absolute; bottom: 45px; right: 25px; font-size: 50px; opacity: 0.1;}
		</style>
		<div data-id="0" id="k0" class="hdiv k0 v3-col-md-2" style="display:none;">
			<i class="fa fa-trash" style="display:none; position: absolute; font-size: 14px; top: 5px; left: 5px;" onclick="toggle('#k0')"></i>
			<i class="fa fa-save"  style="display:none; position: absolute; font-size: 18px; top: 5px; right: 5px;" onclick="AjaxPResult('fonksiyon.php?ne=notlar&islem=keep&durum=add_keep','#f0','#f0');"></i>
			<form id="f0" method="post" style="margin-top:10px;height:90%;">
				<textarea class="form-control" name="n1" id="n1_0" placeholder="Yeni Not" style="height: inherit; border: none !important; overflow: auto; outline: none; -webkit-box-shadow: none !important; -moz-box-shadow: none; box-shadow: none !important;"></textarea>
				
				<div class="tools" id="m0" style="position:absolute; display:none; bottom:0px; width:70%;">
					<div id="mc0" style="position:absolute; z-index:1; width:100%; left: -3px; bottom: 10px; border-radius: 5px; padding-top: 2px; font-size: 12px;">
						<select name="s3" id="s3_0" style="float:left; width:36%; margin-right:5px; height:30px; padding:5px;">
							<option value="0" ><?php echo translate("Tekrar")?></option>
							<option value="1" ><?php echo $sdil[70]; //Aylık?></option>
							<option value="2" ><?php echo $sdil[71]; //Yıllık?></option>
						</select>
						<input type="date" value="" name="t4"  id="t4_0" style="float:left; width: 58%; margin-right:3px; padding:0px;">
					</div>								
				</div>
			</form>
			<script>
				<?php if($mobile==""){?>
					jQuery(".k0").mouseenter(function() {
						jQuery("#m0, .fa-trash, .fa-save").css("display", "block");
					}).mouseleave(function(){
						jQuery("#m0, .fa-trash, .fa-save").css("display", "none");
					});
				<?php }else{?>
					jQuery("#m0, .fa-trash, .fa-save").css("display", "block");
				<?php }?>
				jQuery('#f0').change(function(){
					AjaxPResult('fonksiyon.php?ne=notlar&islem=keep&durum=add_keep','#f0','#f0');
				});
			</script>
		</div>
		<?php
		$sql=mysqli_query($conn, "select * from genel where ne='not' and t3='keep' and (s7=1 or n1 like '%#destktop%') $levt order by id desc"); while($rs=mysqli_fetch_assoc($sql)){ $k++;
			$position=""; $properties="";
			$position = explode(',',$rs["n2"]);
			$properties = explode(',',$rs["n3"]);
			$sqlu=mysqli_query($conn, "select * from t5 where id=".$rs["s19"]." order by id desc"); $rsu=mysqli_fetch_assoc($sqlu);
			?>
			<style>
				.k<?php echo $rs["id"]?>{
					z-index:<?php if($rs["n5"]==""){echo $k;}else{echo $rs["n5"];}?>; filter: drop-shadow(2px 4px 6px black); <?php if($mobile==""){?>position:absolute;<?php }?> border: 1px solid #ccc; margin: 5px !important; min-height:265px;
					<?php
					if($mobile=="" and $properties[0]<>""){ echo "width:".($properties[0]+22)."px; height:".($properties[1]+22)."px;"; }elseif($mobile=="" and $properties[0]==""){ echo "width:250px; height:250px;"; }else{ echo "width:95%;"; }
					if($rs["n2"]<>"" and $mobile==""){ echo "top:".$position[0]."px; left:".$position[1]."px;"; }
					if($rs["n4"]==""){ echo "background:#ffff8d;"; }else{ echo "background:".$rs["n4"].";"; }
					?>
					color: rgba(0,0,0,.87); display: inline-table; padding:10px; font-size:14px; font-family: 'Patrick Hand', cursive;
				}
				.k<?php echo $rs["id"]?>:before{content: "#<?php echo $k?>"; position: absolute; bottom: 45px; right: 25px; font-size: 50px; opacity: 0.1;}
			</style>
			<div data-id="<?php echo $rs["id"]?>" keep-order="<?php echo $k?>" class="hdiv k<?php echo $rs["id"]?> v3-col-md-2">
				<i class="far fa-plus" style="display:none; position: absolute; font-size: 20px; top: 5px; left: 5px;" onclick="toggle('#k0')"></i>
				<div style="display:none;" id="text_<?php echo $rs["id"]?>"><?php echo $rs["n1"];?></div>
				<div id="r<?php echo $rs["id"]?>" style="display: block; position: absolute; right: 10px; top: 5px;"></div>
				<form id="k<?php echo $rs["id"]?>" method="post" style="margin-top:10px;height:90%;">
					<input type="hidden" name="position" id="pos_<?php echo $rs["id"]?>" value="<?php echo $rs["n2"]?>">
					<input type="hidden" name="properties" id="pro_<?php echo $rs["id"]?>" value="<?php echo $rs["n3"]?>">
					<input type="hidden" name="color"  id="clr_<?php echo $rs["id"]?>" value="<?php echo $rs["n4"]?>">
					<input type="hidden" name="zindex" id="z_<?php echo $rs["id"]?>" value="<?php echo $rs["n5"]?>">
					<textarea class="form-control" name="n1" id="n1_<?php echo $rs["id"]?>" placeholder="Not Alanı" style="height: inherit; border: none !important; overflow: auto; outline: none; -webkit-box-shadow: none !important; -moz-box-shadow: none; box-shadow: none !important;"><?php echo $rs["n1"];?></textarea>
					<?php $sqlc=mysqli_query($conn, "select id from t2 where ne='chat' and t2='keep' and s3=".$rs["id"]." order by id desc"); $rsc=mysqli_fetch_assoc($sqlc);?>
					<?php if(mysqli_num_rows($sqlc)>0){?><span style="position: absolute; bottom: 15px; right: 95px; font-size:10px" title="Chat"><i class="fa-regular fa-comments"></i></span><?php }?>
					<span style="position: absolute; bottom: 15px; right: 10px; font-size:10px" title="Düzenlenme Tarihi"><?php if(mysqli_num_rows($sqlu)>0){echo $rsu["t1"];}else{echo "Admin";}?> <?php echo dtarih($rs["ts2"],"gg ka yy time");?></span>
					<div style="clear:both; height:20px"></div>
					<div class="tools" id="m<?php echo $rs["id"]?>" style="display:none; position:absolute; bottom:10px; width:95%;">
						<a class="btn btn-xs mfrm" data-toggle="modal" data-target="#myModal" data-title="<?php echo $sdil[48]; //E-Ajanda?>" data-ref="?" data-width="60%" data-url="modules/events/note.php?ne=notlar&islem=keep&durum=noku&gun=<?php echo $cgun;?>&ay=<?php echo $bay;?>&yil=<?php echo $yil;?>&id=<?php echo $rs["id"];?>"><i class="fa fa-edit"></i></a>
						<a class="btn btn-xs btn-delete-div" data-href="modules/events/note.php?ne=notlar&islem=keep&id=<?php echo $rs["id"];?>&durum=snot"><i class="fa fa-trash"></i></a>
						<a class="btn btn-xs kmfrm" onclick="toggle('#mc<?php echo $rs["id"]?>');"><i class="fa fa-calendar"></i></a>
						<div id="mc<?php echo $rs["id"]?>" style="position:absolute; z-index:999; width:100%; left: -3px; bottom: 30px; display:none; border-radius: 5px; padding-top: 2px; font-size: 12px;">
							<select name="s3" id="s3_<?php echo $rs["id"]?>" style="float:left; width:36%; margin-right:5px; height:30px; padding:5px;">
								<option value="0" <?php if($rs["s3"]==0){?>selected<?php }?>><?php echo translate("Tekrar")?></option>
								<option value="1" <?php if($rs["s3"]==1){?>selected<?php }?>><?php echo $sdil[70]; //Aylık?></option>
								<option value="2" <?php if($rs["s3"]==2){?>selected<?php }?>><?php echo $sdil[71]; //Yıllık?></option>
							</select>
							<input type="date" value="<?php echo $rs["t4"];?>" name="t4"  id="t4_<?php echo $rs["id"]?>" style="float:left; width: 58%; margin-right:3px; padding:0px;">
						</div>
						
						<a class="btn btn-xs kmfrm" onclick="toggle('#cm<?php echo $rs["id"]?>');"><i class="fa fa-paint-brush"></i></a>
						<div id="cm<?php echo $rs["id"]?>" style="position:absolute; z-index:999; width:100%; left: -3px; bottom: 30px; display:none; border: 1px solid #ccc; background: #e6e6e6; border-radius: 5px; padding-top: 2px; padding-left: 2px;">
							<i data-id="#ffffff" class="fa fa-circle c<?php echo $rs["id"]?>" style="color:#fff; font-size:18px; margin-right:5px;"></i>
							<i data-id="#ffff8d" class="fa fa-circle c<?php echo $rs["id"]?>" style="color:#ffff8d; font-size:18px; margin-right:5px;"></i>
							<i data-id="#ffd180" class="fa fa-circle c<?php echo $rs["id"]?>" style="color:#ffd180; font-size:18px; margin-right:5px;"></i>
							<i data-id="#ccff90" class="fa fa-circle c<?php echo $rs["id"]?>" style="color:#ccff90; font-size:18px; margin-right:5px;"></i>
							<i data-id="#b388ff" class="fa fa-circle c<?php echo $rs["id"]?>" style="color:#b388ff; font-size:18px; margin-right:5px;"></i>
							<i data-id="#90f4ff" class="fa fa-circle c<?php echo $rs["id"]?>" style="color:#90f4ff; font-size:18px; margin-right:5px;"></i>
							<i data-id="#ff9090" class="fa fa-circle c<?php echo $rs["id"]?>" style="color:#ff9090; font-size:18px; margin-right:5px;"></i>
							<i data-id="#de8dbd" class="fa fa-circle c<?php echo $rs["id"]?>" style="color:#de8dbd; font-size:18px; margin-right:5px;"></i>
							<i data-id="#80ffcb" class="fa fa-circle c<?php echo $rs["id"]?>" style="color:#80ffcb; font-size:18px; margin-right:5px;"></i>
						</div>
					</div>
				</form>
			</div>
			<script>
				<?php if($mobile==""){?>
					jQuery(".k<?php echo $rs["id"]?>").mouseenter(function() {
						jQuery("#m<?php echo $rs["id"]?>, .fa-plus").css("display", "block");
					}).mouseleave(function(){
						jQuery("#m<?php echo $rs["id"]?>, .fa-plus").css("display", "none");
					});
				<?php }else{?>
					jQuery("#m<?php echo $rs["id"]?>, .fa-plus").css("display", "block");
				<?php }?>
				autosize(document.getElementById("n<?php echo $rs["id"]?>"));
				jQuery('.k<?php echo $rs["id"]?>') .draggable() .resizable();
				<?php if($mobile==""){?>
					jQuery('.k<?php echo $rs["id"]?>').mouseleave(function(){
						skeep(<?php echo $rs["id"]?>);
					});
				<?php }?>
				jQuery('#k<?php echo $rs["id"]?>').change(function(){
					var n1 = jQuery('#n1_<?php echo $rs["id"]?>').val();
					jQuery('#text_<?php echo $rs["id"]?>').html(n1);
					AjaxPResult('fonksiyon.php?durum=keep&id=<?php echo $rs["id"]?>','#k<?php echo $rs["id"]?>','#r<?php echo $rs["id"]?>','nopl','');
				});
				function skeep(id) {
					var keep = '.k'+id+'';
					var vpos = jQuery('#pos_'+id+'').val();
					var vpro	=	jQuery('#pro_'+id+'').val();
					var position = jQuery(keep).position();
					var pos = "" + position.top + "," + position.left + "";
					var pro = ''+jQuery(keep).width()+','+jQuery(keep).height()+'';
					
					jQuery('#pos_'+id+'').val(pos);
					jQuery('#pro_'+id+'').val(pro);
					if(vpos!=pos || vpro!=pro){
						setTimeout(function(){
							AjaxPResult('fonksiyon.php?durum=keep&id='+id+'','#k'+id+'','#r'+id+'','nopl','');
						}, 1000);
					}
				}
				jQuery('.c<?php echo $rs["id"]?>').click(function(){
					var color = jQuery(this).attr('data-id');
					jQuery("#clr_<?php echo $rs["id"]?>").val(color);
					jQuery('.k<?php echo $rs["id"]?>').css({ background: color});
					AjaxPResult('fonksiyon.php?durum=keep&id=<?php echo $rs["id"]?>','#k<?php echo $rs["id"]?>','#r<?php echo $rs["id"]?>','nopl','');
				});
			</script>
		<?php }?>
	</div>
	<?php }?>