Spaces:
Running

testmaster-pro / take-test.html
Maqsadov's picture
ro'yxatdan otishni telegram malumotlari orqali yani bot orqali qilib ber.Keyin titul qosh test yaratish bo'limiga
d410619 verified
Raw History Blame Contribute Delete
6.6 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test Tekshirish - TestMaster Pro</title>
<link rel="stylesheet" href="style.css">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/feather-icons"></script>
</head>
<body class="bg-gray-50 min-h-screen">
<header-component></header-component>
<main class="container mx-auto px-4 py-8">
<div class="max-w-2xl mx-auto">
<div class="bg-white rounded-xl shadow-lg p-6 mb-8">
<h1 class="text-3xl font-bold text-gray-800 mb-2">Test Tekshirish</h1>
<p class="text-gray-600">Test kodini kiriting va javoblaringizni yozing</p>
</div>
<div id="auth-required-message" class="bg-yellow-50 border border-yellow-200 rounded-lg p-6 mb-8 hidden">
<div class="flex">
<div class="flex-shrink-0">
<i data-feather="alert-triangle" class="text-yellow-500 w-5 h-5"></i>
</div>
<div class="ml-3">
<h3 class="text-sm font-medium text-yellow-800">Avtorizatsiya talab qilinadi</h3>
<div class="mt-2 text-sm text-yellow-700">
<p>Test ishlash uchun tizimga kirishingiz kerak.</p>
</div>
<div class="mt-4">
<button id="login-to-take-btn" class="btn btn-primary">
Kirish
</button>
</div>
</div>
</div>
</div>
<div id="code-input-section" class="bg-white rounded-xl shadow-lg p-6 mb-8 hidden">
<h2 class="text-xl font-semibold text-gray-800 mb-4">Test Kodi</h2>
<div class="flex flex-col sm:flex-row gap-4">
<input
type="text"
id="test-code-input"
placeholder="2 xonali test kodini kiriting"
class="flex-1 border border-gray-300 rounded-lg px-4 py-3 focus:outline-none focus:ring-2 focus:ring-blue-500"
maxlength="2"
>
<button id="load-test-btn" class="bg-blue-600 hover:bg-blue-700 text-white font-medium py-3 px-6 rounded-lg transition-colors">
Testni Yuklash
</button>
</div>
</div>
<div id="test-section" class="bg-white rounded-xl shadow-lg p-6 hidden">
<h2 class="text-xl font-semibold text-gray-800 mb-6">Test Savollari</h2>
<div id="questions-container">
<!-- Questions will be loaded here dynamically -->
</div>
<div class="mt-8 pt-6 border-t border-gray-200">
<button id="submit-answers-btn" class="w-full bg-green-600 hover:bg-green-700 text-white font-medium py-3 px-6 rounded-lg transition-colors">
Javoblarni Yuborish
</button>
</div>
</div>
<div id="result-section" class="bg-white rounded-xl shadow-lg p-6 hidden">
<div class="text-center">
<div class="w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-4">
<i data-feather="check" class="text-green-600"></i>
</div>
<h2 class="text-2xl font-semibold text-gray-800 mb-2">Natijalar</h2>
<p class="text-gray-600 mb-6">Sizning test natijangiz quyidagicha:</p>
<div class="bg-blue-50 rounded-lg p-6 mb-6">
<div class="text-5xl font-bold text-blue-600 mb-2" id="score-display">0</div>
<div class="text-gray-700">to'g'ri javob</div>
</div>
<div class="mb-6">
<h3 class="font-medium text-gray-700 mb-3">Batafsil natijalar:</h3>
<div id="detailed-results" class="text-left bg-gray-50 rounded-lg p-4">
<!-- Detailed results will be shown here -->
</div>
</div>
<button id="back-to-home-btn" class="bg-blue-600 hover:bg-blue-700 text-white font-medium py-3 px-6 rounded-lg transition-colors">
Bosh Sahifaga Qaytish
</button>
</div>
</div>
</div>
</main>
<footer-component></footer-component>
<auth-modal></auth-modal>
<script src="components/header.js"></script>
<script src="components/footer.js"></script>
<script src="components/auth-modal.js"></script>
<script src="script.js"></script>
<script>
feather.replace();
// Check if user is logged in
const user = JSON.parse(localStorage.getItem('telegramUser'));
const authMessage = document.getElementById('auth-required-message');
const codeInputSection = document.getElementById('code-input-section');
const loginBtn = document.getElementById('login-to-take-btn');
if (!user) {
authMessage.classList.remove('hidden');
codeInputSection.classList.add('hidden');
loginBtn.addEventListener('click', () => {
document.querySelector('auth-modal').openModal();
});
} else {
authMessage.classList.add('hidden');
codeInputSection.classList.remove('hidden');
// Initialize the test taking functionality
initializeTestTaking();
}
// Listen for auth state changes
window.addEventListener('authStateChange', () => {
const newUser = JSON.parse(localStorage.getItem('telegramUser'));
if (newUser) {
authMessage.classList.add('hidden');
codeInputSection.classList.remove('hidden');
// Initialize the test taking functionality
initializeTestTaking();
} else {
authMessage.classList.remove('hidden');
codeInputSection.classList.add('hidden');
}
});
</script>
</body>
</html>