<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
	if ($_GET["ne"]=="haber"){ $nedir=$t22s[0]; $nedirs=$t22; $sislem="sayfa"; $q="h";}
	else if($_GET["ne"]=="sayfa"){ $nedir=$t21s[0];$nedirs=$t21; $sislem="sayfa"; $q="s";}
	else if($_GET["ne"]=="msayfa"){ $nedir=$n8s[0]; $nedirs=$n8; $sislem="sayfa"; $q="m";}
	else if($_GET["ne"]=="kayit"){ $nedir=$t24s[0]; $nedirs=$t24; $sislem="kayitlar"; $q="u";}
	else if($_GET["ne"]=="uye" and ($_GET["islem"]=="uyeler")){ $nedir=$t25s[0]; $nedirs=$t25; $sislem="uyeler";}
	else if($_GET["ne"]=="uye" and $_GET["islem"]=="relations"){ $nedir=ctranslate("İlişki"); $sislem="relations";}
	else if($_GET["ne"]=="form"){ $nedir=$form[0]; $nedirs=$form; $sislem="form";}
	else if($_GET["ne"]=="reklam"){ $nedir=$reklam[0]; $nedirs=$reklam; $sislem="reklam"; $q="r";}
	else if($_GET["ne"]=="service"){ $nedir=$t36s[0]; $nedirs=$t36; $sislem="service";}
	else if($_GET["ne"]=="gorev"){ $nedir=$tasks[0]; $nedirs=$tasks; $sislem="gorev";}
	else if($_GET["ne"]=="tgorev"){ $nedir=$tasks[0]; $nedirs=$tasks; $sislem="tgorev";}
	else if($_GET["ne"]=="eticaret"){ $nedir=""; $sislem="siparisler";}
	else if($_GET["islem"]=="sfatura"){ $nedir="".$sdil[148]." ".$sdil[24].""; $sislem="muhasebe";}
	else if($_GET["islem"]=="afatura"){ $nedir="".$sdil[149]." ".$sdil[24].""; $sislem="muhasebe";}
	else if($_GET["islem"]=="ifatura"){ $nedir="".$sdil[139]." ".$sdil[24].""; $sislem="muhasebe";}
	else{ $nedir=$_GET["ne"]; $nedirs=ihb($_GET["ne"]); $q=$_GET["ne"][0]; }
?>

<link href="//cdn.<?php echo $cdnurl?>/tools/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<link rel="stylesheet" href="//cdn.<?php echo $cdnurl?>/tools/css/bootstrap-multiselect.min.css"/>
<link href="//cdn.<?php echo $cdnurl?>/tools/css/css/bootstrap-colorpicker.min.css" rel="stylesheet" />
<link rel="stylesheet" href="<?php echo $path;?>assets/vendor/summernote/summernote-bs4.css">
<link rel="stylesheet" href="<?php echo $path;?>assets/search_ajax/chosen.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css">
<link rel="stylesheet" href="<?php echo $path;?>assets/css/v8-crm.css">
<link href="//cdn.<?php echo $cdnurl?>/tools/css/jquery.tagsinput.min.css" rel="stylesheet">
<link rel="stylesheet" href="<?php echo $path."css.php?dark=none";?>">
<link href="//cdn.<?php echo $cdnurl?>/tools/css/select2.min.css" rel="stylesheet" />
<link rel="stylesheet" href="//cdn.<?php echo $cdnurl?>/css/css.php">
<link rel="stylesheet" href="//cdn.<?php echo $cdnurl?>/tools/carousels/owl/css/owl.carousel.min.css">
<link rel="stylesheet" href="//cdn.<?php echo $cdnurl?>/tools/carousels/owl/css/owl.theme.default.min.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
<script src="//cdn.jsdelivr.net/npm/jquery@3.4.0/dist/jquery.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js"></script>
<?php if($mobile<>""){?>
	<script src="https://cdn.ckeditor.com/4.19.0/basic/ckeditor.js"></script>
<?php }else{?>
	<script src="https://cdn.ckeditor.com/4.19.0/full-all/ckeditor.js"></script>
<?php }?>
<script type="text/javascript" src="//cdn.<?php echo $cdnurl?>/js/inc_crm.js" lang="<?php echo trim($sdil[150]);?>" id="wjs" url="<?php echo $_SERVER['SERVER_NAME'];?>" pow="<?php echo $pow1?>" ver="<?php echo $pow2?>" city="<?php echo ilocation("city")?>" country="<?php echo ilocation("country")?>"></script>
<script src="<?php echo $path;?>jquery.php?<?php echo uri("get")?>&file=<?php echo basename($_SERVER['PHP_SELF']);?>&page=scripts"></script>
<style type="text/css">
<?php
	if($MSA<>1){ echo ".msa {display:none !important;}"; }
	if($MA<>1){ echo ".ma {display:none !important;}"; }
	if($SU<>1){ echo ".su {display:none !important;}"; }
	if($E==1){ echo ".e {display:none !important;}"; }
?>
	.clist {overflow:auto !important;}
	body { height:100vh; overflow:auto;}
	.custom-notice { position: fixed; top: 15px; right: 15px; z-index: 9999; padding: 15px 25px; border-radius: 8px; display: none; min-width: 300px; min-height: 90px; box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1); font-family: 'Arial', sans-serif; color: #fff; background-color: #333; transition: all 0.3s ease; }
	.custom-notice .notice { font-size: 14px;}
	.custom-notice i { font-size: 100px; position: absolute; right: -15px; top: -15px; opacity: 0.5; }
	.custom-notice.success { background-color: #28a745; border-left: 5px solid #218838; }
	.custom-notice.error { background-color: #dc3545; border-left: 5px solid #c82333; }
	.custom-notice.warning { background-color: #ffc107; border-left: 5px solid #e0a800; }
	.custom-notice.info { background-color: #17a2b8; border-left: 5px solid #138496; }
	.custom-notice strong { font-size: 20px; font-weight: 600; display:block;}
	.custom-notice.fadeIn { animation: fadeIn 0.3s ease-out;}
	.custom-notice.fadeOut { animation: fadeOut 0.5s ease-in;}
	@keyframes fadeIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
	@keyframes fadeOut { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-20px); } }
	/****************** Switches ********************/
	#reform input[type=checkbox] { display:none; }
	#reform input[type="checkbox"]:checked + label:before{ display:none; }
	.mini-switch + label{ width: 40px; height: 20px; background: url('//cdn.<?php echo $cdnurl?>/wpanel/wpanel.png') no-repeat 0 -24px; display:inline-block; padding: 0 0 0 0px; cursor:pointer; }
	.mini-switch:checked + label{ width: 40px; height: 20px; background: url('//cdn.<?php echo $cdnurl?>/wpanel/wpanel.png') no-repeat 0 0px; background-position:-1px -287px; display:inline-block; padding: 0 0 0 0px; cursor:pointer; }
	.sdn {display: none;}
	.form-control, .v3-form-control {box-shadow: none;}
	input.form-control, select.form-control {height:38px !important;}
	.chosen-choices {padding: 5px !important;}
	.chosen-container {width:100% !important;}
	select.form-control {height:34px !important;}
	::-webkit-scrollbar { width: 5px !important;}
	.chosen-rtl .chosen-drop {left: -9000px;}
	form {margin: 0px;}
	body {font-size:12px;}
	.panel-heading { border-bottom: 0px solid transparent; }
	.table-actions .btn, .input-group-btn .btn {width: 34px; height: 34px; }
	/****************** Tab Page ********************/
	.form label, .form .label { margin-bottom: 0px;}
	.auts {margin-top: -15px;}
	.auts label{font-size: 9px;}
	.mfrm{cursor:pointer}
    .checkbox-custom {width: 100%; display: flex; padding: 2px;}
	.v8-col200pxL-left { width: 239px; margin-left: -40px; float: left;}
	.v8-tabs-content, #tab-adty, #tab-dty0, #tab-adty1, #tab-adty2, #tab-adty3, #tab-adty4, #tab-adty5, #tab-adty6 {height:auto !important; min-height:500px;}
	.qmodal { display: flex; justify-content: center; align-items: center; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); z-index: 1000; }
	.qmodal-content { display: flex; flex-direction: column; background: #fff; width: 100%; height: 100%; border-radius: 0; overflow: auto; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); }
	.qmodal-header { position: sticky; top: 0; z-index: 1000; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); height: 45px; display: flex; left: unset; right: 0px; justify-content: flex-end; align-items: center; padding: 10px; background: #f5f5f5; border-bottom: 1px solid #ddd; }
	.qmodal-header button { background: #007bff; border: none; color: #fff; padding: 8px 12px; margin-left: 10px; border-radius: 4px; cursor: pointer; font-size: 14px; height:34px; }
	.qmodal-header button:hover {background: #0056b3;}
	.qmodal-header .header-title {position: absolute; left: 0px; margin-bottom: -25px;}
	.scat span {width: 17px; height: 16px; display: block; position: absolute; background: red; padding: 0px; top: 0px; right: 30px; border-radius: 50%; color: white; font-size:11px}
	@media (min-width:800px){ 
		#switchs { width: 200px; margin-left: 40px; }
	}
	@media (max-width:800px){ 
		.header-title {display:none;}
		.v8-col200pxL-left { width: 225px; margin-left: -40px; float: left;}
	}
	.dropdown-menu { left:auto; right: 0; }
	.dropdown-menu .dropdown-item { display: block; margin-bottom: 3px; text-align: left; }
	/* Bildirim Kutusu */
	.ui-pnotify { position: absolute; right: 0px; top: 45px; width: 300px; padding: 10px; border: 1px solid #ccc; border-radius: 5px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); font-family: Arial, sans-serif; background-color: #fff; transition: opacity 0.5s, transform 0.5s; }
	.ui-pnotify h4 { margin: 0; font-size: 16px; }
	.ui-pnotify .ui-pnotify-text { margin-top: 5px; font-size: 14px; }
	.ui-pnotify.notification-warning { border-color: #f39c12; background-color: #fdf7e6; }
	.ui-pnotify.notification-success { border-color: #2ecc71; background-color: #e9f7ef; }
	.ui-pnotify.notification-error { border-color: #e74c3c; background-color: #fbeae9; }
	.ui-pnotify-icon { float: left; margin-right: 10px; }
	.click-2-close { cursor: pointer; }
	.modal-backdrop {
		z-index: 999;
	}
	.form fieldset {position: relative;}
	.form fieldset p{font-size: 10px; position: absolute; text-align: right; width: 95%; bottom: 0px; right:15px; }
	.ifile { display: flex; align-items: center; gap: 10px; padding: 10px; border: 2px dashed #007bff; border-radius: 10px; text-align: center; cursor: pointer; width: 300px; justify-content: center; background-color: #f9f9f9; }
    .ifile:hover { background-color: #e0e0e0; }
    .ifile input { display: none !important; }
	.fieldset {position: relative;}
	/*.form fieldset p { bottom: -25px; }*/
	.input-group-addon i {width:20px; height:20px; display:block;}
	.colorpicker {width:150px !important;}
	<?php if($mobile==""){?>
	.modal-header {position: absolute; left: -50px; padding: 5px; border-radius: 15px 0px 0px 15px; width: 50px; filter: drop-shadow(-3px -2px 1px grey); height: 38px;}
	.modal {z-index: 999999; left: unset; width:75%;}
	.modal-dialog {width: 95%;}
	<?php }else{?>
	.modal-header { min-height:50px; padding: 10px 15px;}
	.modal {z-index: 999999; left: 0px; width:100%; padding-left:0px !important;}
	<?php }?>
	.left .fa-times {right:0px;position: absolute; top: 0px; opacity: 1; font-size: 30px;}
	.right .fa-times {left:0px;position: absolute; top: 0px; opacity: 1; font-size: 30px;}
	.left .v3-modal-header {display: block !important; opacity: 1;display:none; border: 1px solid #999999 !important;border-left: 0px !important;}
	.right .v3-modal-header {display: block !important; opacity: 1;display:none; border: 1px solid #999999 !important;border-right: 0px !important;}
	.left .v3-modal-content > .fa-times, .right .v3-modal-content > .fa-times {display:none;}
	.v3-modal-title {line-height: 27px;}
	.modal.right.fade.show, .modal.right.fade.in {right: -43px !important;}
	.toggle-btn { font-size: 24px; cursor: pointer; color: #333; margin-right: 10px; transition: transform 0.2s ease, color 0.2s ease; display: contents !important;}
	.toggle-btn:active { transform: scale(1.2); }
	.toggle-btn.xl { font-size: 36px; } /* 2 katı */
	.toggle-btn.xxl { font-size: 48px; } /* 4 katı */
	.fa-toggle-on { color: #28a745; }
	.fa-toggle-off { color: #dc3545; }
	inputs .v3-col-md-3 {height:95px;}
	#authority fieldset {height: 160px !important;}
	#authority fieldset p {display:block;}
	.breadcrumb .wide { min-width: 249px; }
	.breadcrumb .select2-container { width: 200px !important; position: absolute; margin-top: -8px;}
	.multiselect > .radio, .checkbox { padding-left: 0px; margin-top: 0px; }
	.multiselect-container label.checkbox > input[type="checkbox"] { margin-right: 3px; margin-top: 3px; }
	.multiselect-container.dropdown-menu { min-width: 150px;}
	.qmodal .dropdown-menu .dropdown-item { font-size: 13px; width: 100%; padding: 3px; }
	.multiselect-native-select .dropdown-menu { left: 0px; }
</style>
	<div class="message-box animated fadeIn" data-sound="alert" id="mb-remove-row">
		<div class="mb-container">
			<div class="mb-middle">
				<div class="mb-title" style="font-size: 28px;"><span class="fa fa-times"></span> <?php echo translate("Silmek İstediğinize")?> <strong><?php echo translate("Eminmisiniz")?></strong> ?</div>
				<div class="mb-content">
					<p class=""><?php echo translate("Eminseniz Lütfen Evet'e Basın")?>.</p>
				</div>
				<div class="mb-footer">
					<div class="pull-right">
						<button href="#" class="red btn btn-success btn-lg mb-control-yes"><?php echo translate("Evet")?></button>
						<button class="btn btn-default btn-lg mb-control-close"><?php echo translate("Hayır")?></button>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="message-box animated fadeIn" data-sound="alert" id="mb-undo-row">
		<div class="mb-container">
			<div class="mb-middle">
				<div class="mb-title" style="font-size: 28px;"><span class="fa fa-times"></span> <?php echo translate("İptal/İade İstediğinize")?> <strong><?php echo translate("Eminmisiniz")?></strong> ?</div>
				<div class="mb-content">
					<p class=""><?php echo translate("Eminseniz Lütfen Evet'e Basın")?>.</p>
				</div>
				<div class="mb-footer">
					<div class="pull-right">
						<button href="#" class="red btn btn-success btn-lg mb-control-yes"><?php echo translate("Evet")?></button>
						<button class="btn btn-default btn-lg mb-control-close"><?php echo translate("Hayır")?></button>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="message-box message-box-info animated fadeIn" data-sound="alert" id="mb-add-row">
		<div class="mb-container">
			<div class="mb-middle">
				<div class="mb-title" style="font-size: 28px;"><span class="fa fa-plus"></span> <?php echo translate("Kayıt eklemek istediğinize")?> <strong><?php echo translate("Eminmisiniz")?></strong> ?</div>
				<div class="mb-content">
					<p class=""><?php echo translate("Eminseniz Lütfen Evet'e Basın")?>.</p>
				</div>
				<div class="mb-footer">
					<div class="pull-right">
						<button href="#" class="red btn btn-success btn-lg mb-control-yes"><?php echo translate("Evet")?></button>
						<button class="btn btn-default btn-lg mb-control-close"><?php echo translate("Hayır")?></button>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div id="preload" style="display:none; width:100%; height:100%; padding:20% 45%; position:fixed; margin:0px; left:0px; top:0px; z-index:999999999999; background-image:url('<?php echo $weburl?>/deppo/tools/img/trns.png')"><img border="0" src="<?php echo $weburl?>/deppo/tools/img/loading.svg" style="max-height: 150px;"></div>
	<div id="saved" style="display:none; width:100%; height:100%; padding:20% 45%; position:fixed; margin:0px; left:0px; top:0px; z-index:999999999999;"><img border="0" src="<?php echo $weburl?>/deppo/tools/img/saved.gif" style="max-height: 150px;"></div>
<?php
	$mht = array("top: 10px","top: 45px","top: 80px","top: 115px","top: 150px","top: 185px");
	$mhc = array("info","warning","danger","success");
	for ($m = 0; $m <= 4; $m++) {
?>
		<div class="modal fade right" id="myModal<?php if($m>0){echo $m+1;}?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"  style="z-index:99999">
			<div class="modal-dialog modal-lg" style="max-width: unset !important;">
				<div class="modal-content" style="height:100vh">
					<div class="modal-header cmdl close cp bg-<?php if($mobile==""){echo $mhc[$m];}?>" data-dismiss="modal" data-url="about:blank" style="<?php if($mobile==""){echo $mht[$m];}?>">
						<?php if($mobile==""){?>
							<h4 class="v3-modal-title dn">Crm +Plus</h4>
							<a class="fa fa-times btn" style=""></a>
						<?php }else{?>
							<a class="fas fa-arrow-left" style="position: absolute; left: 15px; top: 18px; opacity: 1"></a>
							<h4 class="v3-modal-title dn" id="myModalLabel" style="float:right;">Crm +Plus</h4>
						<?php }?>
					</div>
					<div class="modal-body" style="padding: 5px;">
						<iframe src="" id="frm_modal<?php if($m>0){echo $m+1;}?>" name="modal<?php if($m>0){echo $m+1;}?>" frameborder="0" style="width:99%; height:<?php if($mobile==""){echo "99";}else{echo "94";}?>vh;" allowfullscreen></iframe>
					</div>
				</div>
			</div>
		</div>
<?php }?>
<script>
jQuery(document).on('show.bs.modal', '.modal', function() { const zIndex = 1040 + 10 * jQuery('.modal:visible').length; jQuery(this).css('z-index', zIndex); setTimeout(() => jQuery('.modal-backdrop').not('.modal-stack').css('z-index', zIndex - 1).addClass('modal-stack')); });

jQuery(document).on('click', '.btn-delete-modal', function(e) { e.preventDefault(); var t = jQuery(this), url = t.attr('data-url'), id = "<?php echo $_GET['id']; ?>", box = jQuery("#mb-remove-row"); box.addClass("open").find(".mb-control-yes").off("click").on("click", function() { box.removeClass("open"); $.get(url, function() { if(typeof parent.closeModal === 'function') parent.closeModal(id); }); }); box.find(".mb-control-close").on("click", function() { box.removeClass("open"); }); });
</script>
<?php
//<script src=\"".$weburl."/".$crmpath."/assets/js/theme.js\"></script>
$footer ="
	<script src=\"".$weburl."/".$crmpath."/assets/js/tabs.js\"></script>
	<script src=\"//cdn.".$cdnurl."/tools/ajax/1.11.2/jquery.min.js\"></script>
	<script src=\"//code.jquery.com/ui/1.13.2/jquery-ui.min.js\"></script>
	<script src=\"//cdn.".$cdnurl."/tools/js/jquery.tagsinput.min.js\"></script>
	<script src=\"//cdnjs.cloudflare.com/ajax/libs/summernote/0.8.20/summernote.min.js\"></script>
	<script src=\"//cdn.".$cdnurl."/tools/js/bootstrap.min.js\"></script>
	<script src=\"//cdn.".$cdnurl."/tools/js/jquery.maskedinput.min.js\"></script>
	<script src=\"//cdn.".$cdnurl."/tools/carousels/owl/js/owl.carousel.min.js\"></script>
	<script src=\"".$weburl."/".$crmpath."/assets/search_ajax/chosen.jquery.js\" type=\"text/javascript\"></script>
	<script src=\"//cdn.".$cdnurl."/tools/js/select2.min.js\"></script>
	<script src=\"//cdn.".$cdnurl."/tools/js/bootstrap-multiselect.min.js\"></script>
	<script src=\"//cdn.".$cdnurl."/tools/js/bootstrap-colorpicker.min.js\"></script>
	<script type=\"text/javascript\">
		jQuery(document).ready(function (){
			jQuery('[data-plugin-masked-input]').each(function () {
			  var mask = jQuery(this).data('input-mask');
			  jQuery(this).mask(mask);
			});
		  });
		function delay(callback, ms) {
		  var timer = 0;
		  return function() {
			var context = this, args = arguments;
			clearTimeout(timer);
			timer = setTimeout(function () {  callback.apply(context, args); }, ms || 0); };
		}
		jQuery(function() {
			jQuery('#input-tags').tagsInput();
			jQuery('#input-tags').tagsInput({ maxTags: 20 });
			jQuery('.addtag').click(function(e) {
				e.preventDefault();
				var i = jQuery(this).data('value');
				jQuery('#input-tags').addTag(i);
			});
		});
		var config = {
			'.chosen-select'           : {},
			'.chosen-select-deselect'  : {allow_single_deselect:true},
			'.chosen-select-no-single' : {disable_search_threshold:10},
			'.chosen-select-no-results': {no_results_text:'Kayıt Yok'},
			'.chosen-select-width'     : {width:'95%'}
		}
		for (var selector in config) {
			jQuery(selector).chosen(config[selector]);
		}
		const rteIds = ['rte', 'rte2', 'rte3', 'rte4', 'rte5'];
		rteIds.forEach(id => {
			if (document.getElementById(id) != undefined){
				CKEDITOR.replace(id);
			}
		});
		function notice(title, message, icon, type) {
			let notification = jQuery( '<div class=\"custom-notice alert alert-' + type + '\">' + '<i class=\"' + icon + '\"></i> <strong>' + title + '</strong> <div class=\"notice\">' + message + '</div></div>' );
			jQuery('body').append(notification);
			notification.fadeIn().delay(3000).fadeOut(500, function() {
				jQuery(this).remove();
			});
		}
		jQuery(document).on('keydown', function(e) {
			if (e.key === 'Enter') { // Enter tuşu kontrolü
				jQuery('.mb-control-yes').trigger('click'); // .mb-control-yes tıklama
			}
		});
		document.addEventListener(\"DOMContentLoaded\", function () {
			document.querySelectorAll('input[type=\"checkbox\"]:not(.notoggle)').forEach(checkbox => {
				if (window.getComputedStyle(checkbox).display === 'none') return;
				if (checkbox.closest('.multiselect-container')) return;
				let icon = document.createElement('i');
				icon.classList.add('fas', checkbox.checked ? 'fa-toggle-on' : 'fa-toggle-off', 'toggle-btn');
				// Checkbox'taki tüm class'ları ikona kopyala
				checkbox.classList.forEach(cls => {
					icon.classList.add(cls);
				});
				if (checkbox.getAttribute('style')) {
					icon.setAttribute('style', checkbox.getAttribute('style'));
				}
				icon.addEventListener('click', function () {
					checkbox.checked = !checkbox.checked;
					this.classList.toggle('fa-toggle-on', checkbox.checked);
					this.classList.toggle('fa-toggle-off', !checkbox.checked);
					this.style.transform = 'scale(1.4)';
					setTimeout(() => this.style.transform = 'scale(1)', 150);
				});
				checkbox.before(icon);
				checkbox.style.display = 'none';
			});
		});
        jQuery(document).ready(function () {
            jQuery('#tableFilter').on('keyup', function () {
                var value = jQuery(this).val().toLowerCase();
                jQuery('.filterable tbody tr').filter(function () {
                    var rowText = '';
                    jQuery(this).find('td').each(function () {
                        var cellText = jQuery(this).text().toLowerCase(); 
                        // Tüm form elemanlarını (input, select, textarea) kontrol et
                        var formElement = jQuery(this).find('input, select, textarea');
                        if (formElement.length) {
                            if (formElement.is('select')) {
                                cellText = formElement.find(':selected').text().toLowerCase();
                            } else {
                                cellText = formElement.val().toLowerCase();
                            }
                        }
                        rowText += cellText + '';
                    });
                    jQuery(this).toggle(rowText.indexOf(value) > -1);
                });
            });
        });
		document.querySelectorAll('.switch input[type=\"checkbox\"]').forEach(input => {
			input.addEventListener('change', (e) => {
				console.log(`Switch ${input.id} is now ${input.checked ? 'ON' : 'OFF'}`);
			});
		});
		jQuery(function() {
			jQuery(document).on('change', '.chosen-select.redirect', function() {
				var url = jQuery(this).val();
				if(url) window.location.href = url;
			});
		});
		var selectElement = jQuery('.ajax-select');
		selectElement.select2({
			placeholder: 'Listele',
			ajax: {
				url: '../public/data_json.php?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."', 
				dataType: 'json', 
				delay: 250,
				data: function (params) {
					return { q: params.term };
				},
				processResults: function (data) {
					return {
						results: $.map(data, function (item) {
							return {
								id: item.id,
								text: item.t1,
								link: item.link  // linki ekledik!
							}
						})
					};
				},
				cache: true
			},
			minimumInputLength: 2
		});
		if (selectElement.hasClass('link')) {
			selectElement.on('select2:select', function (e) {
				var data = e.params.data;
				if (data.link) {
					window.location.href = data.link;
				}
			});
		}
		jQuery(document).ready(function() {
			jQuery('[data-plugin-multiselect]').multiselect({ maxHeight: 200 });
			jQuery('.colorpicker-element').colorpicker().on('changeColor', function(e){ jQuery(this).find('input').val(e.color.toString('hex')); });
			jQuery('.icons').each(function(i){ jQuery('.icons').load('../../fonksiyon.php?islem=icons'); });
		});
		jQuery('.v8-side-tabs > li > a').click(function () {
			var tabId = jQuery(this).attr('href');
			jQuery('.v8-tabs-content').hide();
			jQuery(tabId).show();
		});
		function icons(e){
			show('icons');
			var ID = e.getAttribute('id');
			var val = jQuery('#'+ID+'').val();
			jQuery('.icons').load('../../fonksiyon.php?islem=icons&q='+val+'&ID='+ID+'');
			return false;
		}
		jQuery(function($){
			jQuery(document).on('keydown', function(e){
				var key = (e.key || '').toLowerCase();
				// Ctrl + S
				if(e.ctrlKey && key === 's'){
					e.preventDefault();
					AjaxKaydet('','');
					return;
				}

				// Enter
				if(e.keyCode === 13){ jQuery('.mb-control-yes').trigger('click');}
			});
		});

		(function() {
			const input = document.getElementById('n5');
			const datalist = document.getElementById('ln5');
			
			input.addEventListener('input', () => {
				const query = input.value.trim();
				if (query.length === 0) {
					datalist.innerHTML = '';
					return;
				}
				
				const url = '../public/datalist.php?ne=link&q=' + encodeURIComponent(query);
				
				fetch(url, {
					cache: 'no-cache' // Use single quotes for PHP compatibility
				})
				.then(response => {
					if (!response.ok) throw new Error('Network response was not ok');
					return response.text(); // expecting HTML string with <option> elements
				})
				.then(htmlOptions => {
					datalist.innerHTML = htmlOptions;
				})
				.catch(error => {
					console.error('Fetching suggestions failed:', error);
					datalist.innerHTML = '';
				});
			});
		})();
</script>
";

$footer .= '<script>jQuery(document).ready(function(){jQuery("#mselect").each(function(){if(!jQuery(this).data("multiselect")){jQuery(this).multiselect({maxHeight:200,buttonClass:"multiselect dropdown-toggle custom-select text-center"});}});jQuery(".multiselect.dropdown-toggle").on("click",function(e){e.preventDefault();jQuery(this).siblings(".multiselect-container").toggle();});});</script>';

if(($_GET["islem"]=="d".$_GET["ne"]."" || substr($_GET["islem"],1)=="fatura") && $_GET["durum"][0]<>"s"){
$footer .="
<script>
var unsaved = false;
jQuery(function () {
    jQuery('#asave').on('change', function() {
        unsaved = true;
    });
    jQuery('#savebtn').on('click', function() {
        unsaved = false;
    });
    window.addEventListener('beforeunload', function (e) {
        if (unsaved) {
            AjaxKaydet('','');
        }
    });
});
</script>
";
}
?>