gdc_cmod/app/Views/result/result_show.php
2025-11-24 11:13:25 +07:00

114 lines
3.3 KiB
PHP

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Result <?=$accessnumber?></title>
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = {
theme: {
extend: {
fontFamily: {
sans: ['Inter', 'sans-serif'],
},
}
}
}
</script>
</head>
<?php
$userid = session('userid');
?>
<body class="bg-gray-50 flex items-start justify-center">
<div class="w-full max-w-4xl min-h-screen flex flex-col ">
<div class="flex-1 flex flex-col h-full bg-white rounded-2xl shadow-2xl space-y-6 p-3 m-2">
<header>
<p class="text-end">user : <?=$userid;?></p>
<p>Result lab# <?=$accessnumber;?><br />Status : <?=$status;?></p>
</header>
<div class='flex-1 flex flex-col relative shadow-inner bg-gray-100 border border-gray-300'>
<iframe
id="result-iframe"
title="PHP Embedded Content Demo"
class="flex-1"
src="http://glenlis/spooler_db/main_dev.php?acc=<?=$accessnumber;?>">
<p>Your browser does not support iframes. Please contact the technical support.</p>
</iframe>
<?php if($verif == 0) { ?>
<div class="absolute inset-0 flex items-center justify-center pointer-events-none z-20">
<span class="text-7xl font-black text-gray-600 opacity-20 transform rotate-[-30deg] select-none">
Unverified
</span>
</div>
<?php } ?>
</div>
<footer>
<?php if($verif == 0) { ?>
<p class='text-end'>
<button id='result-button'
class='bg-blue-500 text-white py-2 px-3 text-sm rounded-md
disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-gray-400 disabled:text-gray-200'
disabled onclick="validate()">Validate</button>
</p>
<?php } ?>
<p class="mt-2 text-gray-500 text-xs text-center">&copy; 2025 - 5panda</p>
</footer>
</div>
</div>
<script>
<?php if($verif == 0) { ?>
const iframe = document.getElementById('result-iframe');
const button = document.getElementById('result-button');
iframe.addEventListener('load', () => {
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
const scrollElement = iframeDoc.scrollingElement || iframeDoc.documentElement;
iframeDoc.addEventListener('scroll', () => {
const scrollTop = scrollElement.scrollTop;
const scrollHeight = scrollElement.scrollHeight;
const clientHeight = scrollElement.clientHeight;
// Check if scrolled to bottom
if (scrollTop + clientHeight >= scrollHeight - 2) {
button.disabled = false;
}
});
});
function validate() {
const ok = confirm('Are you sure?');
if (!ok) return;
const postData = {
accessnumber: '<?=$accessnumber;?>',
userid: '<?=$userid?>'
};
fetch('<?=base_url("result/validate");?>', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(postData)
})
.then(function (response) {
if (!response.ok) throw new Error('Failed to send data');
//return response.json();
})
.then(function (data) {
//location.reload();
})
.catch(function (error) {
alert('Error: ' + error.message);
});
}
<?php }?>
</script>
</body>
</html>