  
    <script src="<?= $homeurl ?>/assets/plugins/jquery/jquery-3.5.1.min.js"></script>
    <script src="<?= $homeurl ?>/assets/plugins/bootstrap/js/popper.min.js"></script>
    <script src="<?= $homeurl ?>/assets/plugins/bootstrap/js/bootstrap.min.js"></script>
    <script src="<?= $homeurl ?>/assets/plugins/perfectscroll/perfect-scrollbar.min.js"></script>
    <script src="<?= $homeurl ?>/assets/plugins/pace/pace.min.js"></script>
    <script src="<?= $homeurl ?>/assets/plugins/highlight/highlight.pack.js"></script>
	<script src="<?= $homeurl ?>/assets/plugins/datatables/datatables.js"></script>
    <script src="<?= $homeurl ?>/assets/js/main.min.js"></script>
    <script src="<?= $homeurl ?>/assets/js/custom.js"></script>
	<script src="<?= $homeurl ?>/assets/js/pages/datatables.js"></script>
	<script src='<?= $homeurl ?>/plugins/izitoast/js/iziToast.min.js'></script>
	<script src="<?= $homeurl ?>/assets/js/sweetalert2.min.js"></script>
	 <script src='<?= $homeurl ?>/plugins/select2/select2.min.js'></script>
	  <script src='<?= $homeurl ?>/plugins/datetimepicker/build/jquery.datetimepicker.full.min.js'></script>
	  
	  
	 <script>
			$('.select2').select2();
			$('#datatable1').DataTable({
				pageLength: 10
			});
			function kelapKelip() {
			$('.sandik').fadeOut(); 
			$('.sandik').fadeIn(); 
			}
			setInterval(kelapKelip, 500); 
			$('#example1').DataTable({
				pageLength: 10
					});
		</script>
		<script>
		$('.loader').fadeOut('fast');
		$(function() {
			$('#textarea').wysihtml5()
		});
		var autoRefresh = setInterval(
			function() {
				$('#waktu').load('status.php?pg=waktu');
				$('#log-list').load('status.php?pg=log');
				$('#loglist').load('status.php?pg=logguru');
				$('#pengumuman').load('status.php?pg=pengumuman');
				$('#pesantekirim').load('gateway/pesanterkirim.php');
				
				$('#server').load('server/statusserver.php');
				
			}, 1000
		);

		

		$('.datepicker').datetimepicker({
			timepicker: false,
			format: 'Y-m-d'
		});
		$('.tgl').datetimepicker();
		$('.timer').datetimepicker({
			datepicker: false,
			format: 'H:i'
		});
		

		function printkartu(idkelas, judul) {
			$('#loadframe').attr('src', 'sandik_ujian/print_kartu.php?id_kelas=' + idkelas);
		}
       
	   function printnopes(idkelas, judul) {
			$('#loadframe').attr('src', 'sandik_ujian/print_nopes.php?id_kelas=' + idkelas);
		}
		function iCheckform() {
			$('input[type=checkbox].flat-check, input[type=radio].flat-check').iCheck({
				checkboxClass: 'icheckbox_square-green',
				radioClass: 'iradio_square-green',
				increaseArea: '20%' // optional
			});
		}

		$(document).ready(function() {
			$("#btnserver").click(function() {

				swal({
					title: 'Ganti Status Server ',
					text: 'Apakah kamu yakin akan mengganti status server ini ??',
					type: 'warning',
					showCancelButton: true,
					confirmButtonColor: '#3085d6',
					cancelButtonColor: '#d33',
					confirmButtonText: 'Ya, Ganti'
				}).then((result) => {
					if (result.value) {
						$.ajax({
							url: 'gantiserver.php',
							type: "POST",
							success: function(respon) {
								location.reload();
							}
						})
					}
				});
				return false;
			})
			
			$('#soalpg').keyup(function() {
				$('#tampilpg').val(this.value);
			});
			$('#soalesai').keyup(function() {
				$('#tampilesai').val(this.value);
			});

			$('#ceksemua').change(function() {
				$(this).parents('#tablereset:eq(0)').
				find(':checkbox').attr('checked', this.checked);
			});

			$('.idkel').change(function() {
				var thisval = $(this).val();
				var txt_id = $(this).attr('id').replace('me', 'txt');
				var idm = $('#' + txt_id).val();
				var idu = $('#iduj').val();
				console.log(thisval + idm);
				$('.linknilai').attr('href', '?pg=nilai&ac=lihat&idu=' + idu + '&idm=' + idm + '&idk=' + thisval);
			});
			$('.alert-dismissible').fadeTo(2000, 500).slideUp(500, function() {
				$('.alert-dismissible').alert('close');
			});
			

			$('input:checkbox[name=masuksemua]').click(function() {
				if ($(this).is(':checked'))
					$('input:radio.absensi').attr('checked', 'checked');
				else
					$('input:radio.absensi').removeAttr('checked');
			});
			iCheckform()


		});
	</script>
	<script>
		function kirim_form() {
			var homeurl;
			homeurl = '<?= $homeurl ?>';
			var jawab = $('#headerkartu').val();
			$.ajax({
				type: 'POST',
				url: 'sandik_ujian/simpanheader.php',
				data: 'jawab=' + jawab,
				success: function(response) {
					location.reload();
				}
			});
		}
	</script>


	<script>
		//Hapus data jawaban
		$(function() {
			$("#btnhapusjawaban").click(function() {
				swal({
					title: 'Hapus Jawaban',
					text: 'Pastikan tidak ada yang sedang ujian yak ??',
					type: 'warning',
					showCancelButton: true,
					confirmButtonColor: '#3085d6',
					cancelButtonColor: '#d33',
					confirmButtonText: 'Ya, Hapus!'
				}).then((result) => {
					if (result.value) {
						$.ajax({
							url: 'hapusjawaban.php',
							type: "POST",
							beforeSend: function() {
								$('.loader').css('display', 'block');
							},
							success: function(respon) {
								iziToast.success({
									title: 'Mantap!',
									message: respon,
									position: 'topRight'
								});
								setTimeout(function() {
									window.location.reload();
								}, 2000);
							}
						})
					}
				});
				return false;
			})
		});
		$(function() {
			$("#buatberita").click(function() {
				swal({
					title: 'Generate Berita Acara',
					text: 'Pastikan pembuatan jadwal sudah fix ??',
					type: 'warning',
					showCancelButton: true,
					confirmButtonColor: '#3085d6',
					cancelButtonColor: '#d33',
					confirmButtonText: 'Ya, Buat!'
				}).then((result) => {
					if (result.value) {
						$.ajax({
							url: 'buatberita.php',
							type: "POST",
							beforeSend: function() {
								$('.loader').css('display', 'block');
							},
							success: function(respon) {
								$('.loader').css('display', 'none');
								location.reload();
							}
						})
					}
				});
				return false;
			})
		});

		$(document).ready(function() {
			var messages = $('#pesan').notify({
				type: 'messages',
				removeIcon: '<i class="icon icon-remove"></i>'
			});
			$('#formreset').submit(function(e) {
				e.preventDefault();
				$.ajax({
					type: 'POST',
					url: $(this).attr('action'),
					data: $(this).serialize(),
					success: function(data) {
						if (data == "ok") {
							messages.show("Reset Login Peserta Berhasil", {
								type: 'success',
								title: 'Berhasil',
								icon: '<i class="icon icon-check-sign"></i>'
							});
						}
						if (data == "pilihdulu") {
							swal({
								position: 'top-end',
								type: 'success',
								title: 'Data Berhasil disimpan',
								showConfirmButton: true
							});
						}
					}
				});
				return false;
			});

		});
	</script>

