1010 lines
39 KiB
PHP
1010 lines
39 KiB
PHP
<?php
|
|
|
|
namespace App\Views;
|
|
|
|
class StudentPortal
|
|
{
|
|
public static function render(): string
|
|
{
|
|
return <<<'HTML'
|
|
<!DOCTYPE html>
|
|
<html lang="ar" dir="rtl">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>بوابة الطالب — منصة صَقِل التعليمية</title>
|
|
<!-- Google Fonts: Cairo -->
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800;900&display=swap" rel="stylesheet">
|
|
|
|
<!-- Pure Self-Contained Luxury CSS (Zero External CDN Dependency) -->
|
|
<style>
|
|
:root {
|
|
--bg-dark: #0B132B;
|
|
--bg-card: #16203D;
|
|
--bg-card-hover: #1E2C52;
|
|
--bg-input: #090E20;
|
|
--border: #2A3B66;
|
|
--border-focus: #00F5D4;
|
|
--text-primary: #FFFFFF;
|
|
--text-secondary: #CBD5E1;
|
|
--text-muted: #8E9FB8;
|
|
--accent-cyan: #00F5D4;
|
|
--accent-cyan-dark: #00BAA1;
|
|
--accent-gold: #FFD166;
|
|
--accent-red: #EF4444;
|
|
--accent-green: #10B981;
|
|
}
|
|
|
|
* {
|
|
box-sizing: border-box;
|
|
margin: 0;
|
|
padding: 0;
|
|
font-family: 'Cairo', system-ui, -apple-system, sans-serif;
|
|
}
|
|
|
|
body {
|
|
background-color: var(--bg-dark);
|
|
color: var(--text-primary);
|
|
min-height: 100vh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: space-between;
|
|
background-image:
|
|
radial-gradient(circle at 15% 15%, rgba(0, 245, 212, 0.06) 0%, transparent 40%),
|
|
radial-gradient(circle at 85% 85%, rgba(255, 209, 102, 0.04) 0%, transparent 40%),
|
|
linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
|
|
linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
|
|
background-size: 100% 100%, 100% 100%, 32px 32px, 32px 32px;
|
|
}
|
|
|
|
.container {
|
|
max-width: 1140px;
|
|
margin: 0 auto;
|
|
padding: 0 20px;
|
|
width: 100%;
|
|
}
|
|
|
|
/* Header */
|
|
header {
|
|
border-bottom: 1px solid var(--border);
|
|
background-color: rgba(11, 19, 43, 0.95);
|
|
backdrop-filter: blur(12px);
|
|
position: sticky;
|
|
top: 0;
|
|
z-index: 50;
|
|
}
|
|
|
|
.header-content {
|
|
height: 68px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.logo-area {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 12px;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.logo-badge {
|
|
width: 42px;
|
|
height: 42px;
|
|
border-radius: 12px;
|
|
background: linear-gradient(135deg, var(--accent-cyan), var(--accent-cyan-dark));
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
color: #0B132B;
|
|
font-size: 20px;
|
|
font-weight: 900;
|
|
box-shadow: 0 0 20px rgba(0, 245, 212, 0.35);
|
|
}
|
|
|
|
.brand-title {
|
|
font-size: 20px;
|
|
font-weight: 900;
|
|
color: #FFFFFF;
|
|
letter-spacing: 0.5px;
|
|
}
|
|
|
|
.portal-pill {
|
|
font-size: 11px;
|
|
font-weight: 700;
|
|
padding: 2px 10px;
|
|
border-radius: 999px;
|
|
background: rgba(0, 245, 212, 0.12);
|
|
color: var(--accent-cyan);
|
|
border: 1px solid rgba(0, 245, 212, 0.35);
|
|
margin-right: 8px;
|
|
}
|
|
|
|
.nav-link {
|
|
font-size: 13px;
|
|
color: var(--text-secondary);
|
|
text-decoration: none;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 6px;
|
|
transition: 0.2s;
|
|
}
|
|
|
|
.nav-link:hover {
|
|
color: var(--accent-gold);
|
|
}
|
|
|
|
.nav-link-highlight {
|
|
color: var(--accent-gold);
|
|
font-weight: 800;
|
|
text-decoration: underline;
|
|
}
|
|
|
|
/* Main Content */
|
|
main {
|
|
flex: 1;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 40px 0;
|
|
}
|
|
|
|
/* Auth Card */
|
|
.auth-card-wrapper {
|
|
width: 100%;
|
|
max-width: 460px;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.auth-header {
|
|
text-align: center;
|
|
margin-bottom: 24px;
|
|
}
|
|
|
|
.icon-box {
|
|
width: 64px;
|
|
height: 64px;
|
|
border-radius: 18px;
|
|
background: var(--bg-card);
|
|
border: 1px solid rgba(0, 245, 212, 0.4);
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
color: var(--accent-cyan);
|
|
margin-bottom: 16px;
|
|
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
|
|
}
|
|
|
|
.auth-title {
|
|
font-size: 24px;
|
|
font-weight: 900;
|
|
color: #FFFFFF;
|
|
margin-bottom: 6px;
|
|
}
|
|
|
|
.auth-subtitle {
|
|
font-size: 13px;
|
|
color: var(--text-muted);
|
|
line-height: 1.6;
|
|
}
|
|
|
|
.auth-box {
|
|
background: var(--bg-card);
|
|
border: 1px solid var(--border);
|
|
border-radius: 20px;
|
|
padding: 32px;
|
|
box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
|
|
position: relative;
|
|
}
|
|
|
|
/* Forms & Inputs */
|
|
.form-group {
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.form-label {
|
|
display: block;
|
|
font-size: 12px;
|
|
font-weight: 700;
|
|
color: var(--text-secondary);
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
.input-text {
|
|
width: 100%;
|
|
background: var(--bg-input);
|
|
border: 1px solid var(--border);
|
|
border-radius: 12px;
|
|
padding: 12px 16px;
|
|
font-size: 14px;
|
|
color: #FFFFFF;
|
|
outline: none;
|
|
transition: border-color 0.2s, box-shadow 0.2s;
|
|
}
|
|
|
|
.input-text:focus {
|
|
border-color: var(--accent-cyan);
|
|
box-shadow: 0 0 0 3px rgba(0, 245, 212, 0.2);
|
|
}
|
|
|
|
.input-text::placeholder {
|
|
color: #52607D;
|
|
}
|
|
|
|
.phone-input-group {
|
|
display: flex;
|
|
align-items: center;
|
|
direction: ltr;
|
|
position: relative;
|
|
}
|
|
|
|
.country-badge {
|
|
position: absolute;
|
|
left: 10px;
|
|
background: #121A33;
|
|
border: 1px solid var(--border);
|
|
border-radius: 8px;
|
|
padding: 6px 10px;
|
|
font-size: 12px;
|
|
font-weight: 700;
|
|
color: var(--accent-cyan);
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 4px;
|
|
user-select: none;
|
|
}
|
|
|
|
.input-phone {
|
|
padding-left: 96px !important;
|
|
font-family: monospace;
|
|
font-size: 15px;
|
|
letter-spacing: 1px;
|
|
}
|
|
|
|
.form-hint {
|
|
font-size: 11px;
|
|
color: var(--text-muted);
|
|
margin-top: 6px;
|
|
display: block;
|
|
}
|
|
|
|
/* High Contrast Buttons */
|
|
.btn-primary {
|
|
width: 100%;
|
|
padding: 14px;
|
|
background: linear-gradient(135deg, #00F5D4 0%, #00BAA1 100%);
|
|
color: #0B132B !important;
|
|
border: none;
|
|
border-radius: 12px;
|
|
font-size: 15px;
|
|
font-weight: 900 !important;
|
|
cursor: pointer;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 8px;
|
|
box-shadow: 0 8px 24px rgba(0, 245, 212, 0.35);
|
|
transition: transform 0.15s, opacity 0.15s;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.btn-primary:hover {
|
|
opacity: 0.95;
|
|
transform: translateY(-1px);
|
|
}
|
|
|
|
.btn-primary:active {
|
|
transform: translateY(0);
|
|
}
|
|
|
|
.btn-primary:disabled {
|
|
opacity: 0.6;
|
|
cursor: not-allowed;
|
|
transform: none;
|
|
}
|
|
|
|
.btn-secondary {
|
|
background: none;
|
|
border: none;
|
|
color: var(--text-muted);
|
|
font-size: 12px;
|
|
cursor: pointer;
|
|
padding: 6px 0;
|
|
transition: color 0.2s;
|
|
}
|
|
|
|
.btn-secondary:hover {
|
|
color: #FFFFFF;
|
|
}
|
|
|
|
.btn-link-cyan {
|
|
color: var(--accent-cyan);
|
|
font-weight: 700;
|
|
text-decoration: underline;
|
|
}
|
|
|
|
.otp-input {
|
|
text-align: center;
|
|
font-size: 26px;
|
|
font-family: monospace;
|
|
letter-spacing: 10px;
|
|
font-weight: 900;
|
|
color: var(--accent-cyan);
|
|
border-color: rgba(0, 245, 212, 0.5);
|
|
padding: 14px;
|
|
}
|
|
|
|
/* Alerts */
|
|
.alert {
|
|
padding: 12px 16px;
|
|
border-radius: 12px;
|
|
font-size: 12.5px;
|
|
margin-bottom: 20px;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
line-height: 1.5;
|
|
}
|
|
|
|
.alert-error {
|
|
background: rgba(239, 68, 68, 0.15);
|
|
border: 1px solid rgba(239, 68, 68, 0.4);
|
|
color: #FCA5A5;
|
|
}
|
|
|
|
.alert-success {
|
|
background: rgba(0, 245, 212, 0.15);
|
|
border: 1px solid rgba(0, 245, 212, 0.4);
|
|
color: var(--accent-cyan);
|
|
}
|
|
|
|
.auth-footer {
|
|
margin-top: 24px;
|
|
padding-top: 16px;
|
|
border-top: 1px solid rgba(255, 255, 255, 0.08);
|
|
text-align: center;
|
|
font-size: 11.5px;
|
|
color: var(--text-muted);
|
|
}
|
|
|
|
/* Student Dashboard */
|
|
.dashboard-hero {
|
|
background: linear-gradient(135deg, var(--bg-card), var(--bg-card-hover));
|
|
border: 1px solid var(--border);
|
|
border-radius: 24px;
|
|
padding: 32px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
gap: 24px;
|
|
flex-wrap: wrap;
|
|
margin-bottom: 28px;
|
|
}
|
|
|
|
.readiness-box {
|
|
background: rgba(11, 19, 43, 0.85);
|
|
border: 1px solid var(--border);
|
|
border-radius: 16px;
|
|
padding: 16px 20px;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 16px;
|
|
min-width: 240px;
|
|
}
|
|
|
|
.gauge-circle {
|
|
width: 56px;
|
|
height: 56px;
|
|
border-radius: 50%;
|
|
border: 4px solid var(--accent-cyan);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 18px;
|
|
font-weight: 900;
|
|
color: var(--accent-cyan);
|
|
box-shadow: 0 0 20px rgba(0, 245, 212, 0.3);
|
|
}
|
|
|
|
.cards-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
|
gap: 20px;
|
|
margin-bottom: 28px;
|
|
}
|
|
|
|
.feature-card {
|
|
background: var(--bg-card);
|
|
border: 1px solid var(--border);
|
|
border-radius: 20px;
|
|
padding: 24px;
|
|
transition: border-color 0.2s, transform 0.2s;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.feature-card:hover {
|
|
border-color: var(--accent-cyan);
|
|
transform: translateY(-2px);
|
|
}
|
|
|
|
.quiz-demo-box {
|
|
background: var(--bg-card);
|
|
border: 1px solid rgba(0, 245, 212, 0.4);
|
|
border-radius: 24px;
|
|
padding: 32px;
|
|
margin-bottom: 28px;
|
|
}
|
|
|
|
.interactive-quiz-container {
|
|
background: rgba(11, 19, 43, 0.9);
|
|
border: 1px solid var(--border);
|
|
border-radius: 16px;
|
|
padding: 24px;
|
|
margin-top: 16px;
|
|
}
|
|
|
|
.quiz-option {
|
|
width: 100%;
|
|
text-align: right;
|
|
padding: 12px 16px;
|
|
border-radius: 12px;
|
|
border: 1px solid var(--border);
|
|
background: var(--bg-card);
|
|
color: var(--text-secondary);
|
|
font-size: 13px;
|
|
font-weight: 700;
|
|
margin-bottom: 10px;
|
|
cursor: pointer;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
transition: border-color 0.2s;
|
|
}
|
|
|
|
.quiz-option:hover {
|
|
border-color: var(--accent-cyan);
|
|
}
|
|
|
|
.quiz-option.correct {
|
|
background: rgba(16, 185, 129, 0.15);
|
|
border-color: #10B981;
|
|
color: #6EE7B7;
|
|
}
|
|
|
|
.quiz-option.incorrect {
|
|
background: rgba(239, 68, 68, 0.15);
|
|
border-color: #EF4444;
|
|
color: #FCA5A5;
|
|
}
|
|
|
|
/* Watermark */
|
|
@keyframes bounce-watermark {
|
|
0%, 100% { transform: translate(10px, 10px); }
|
|
50% { transform: translate(120px, 60px); }
|
|
}
|
|
.watermark-anim {
|
|
position: fixed;
|
|
bottom: 20px;
|
|
left: 20px;
|
|
z-index: 99;
|
|
pointer-events: none;
|
|
opacity: 0.35;
|
|
animation: bounce-watermark 12s infinite ease-in-out;
|
|
background: rgba(0, 0, 0, 0.7);
|
|
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
padding: 4px 10px;
|
|
border-radius: 6px;
|
|
font-family: monospace;
|
|
font-size: 11px;
|
|
color: var(--accent-cyan);
|
|
}
|
|
|
|
/* Footer */
|
|
footer {
|
|
border-top: 1px solid rgba(255, 255, 255, 0.08);
|
|
padding: 24px 0;
|
|
background: var(--bg-dark);
|
|
color: var(--text-muted);
|
|
font-size: 12px;
|
|
}
|
|
|
|
.footer-content {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
flex-wrap: wrap;
|
|
gap: 12px;
|
|
}
|
|
|
|
.spinner {
|
|
width: 18px;
|
|
height: 18px;
|
|
border: 3px solid rgba(11, 19, 43, 0.3);
|
|
border-top-color: #0B132B;
|
|
border-radius: 50%;
|
|
animation: spin 0.8s linear infinite;
|
|
}
|
|
|
|
@keyframes spin {
|
|
to { transform: rotate(360deg); }
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<!-- Header -->
|
|
<header>
|
|
<div class="container">
|
|
<div class="header-content">
|
|
<a href="/student" class="logo-area">
|
|
<div class="logo-badge">صـ</div>
|
|
<div>
|
|
<span class="brand-title">صَقِل</span>
|
|
<span class="portal-pill">بوابة الطالب</span>
|
|
</div>
|
|
</a>
|
|
|
|
<div id="header_user_actions">
|
|
<a href="/teacher" class="nav-link" id="switch_to_teacher_link">
|
|
<span>أنت معلم؟</span>
|
|
<span class="nav-link-highlight">بوابة المعلمين ←</span>
|
|
</a>
|
|
<div id="auth_user_badge" style="display: none; align-items: center; gap: 12px;">
|
|
<span style="font-size: 13px; color: var(--text-secondary);" id="student_display_name"></span>
|
|
<button onclick="handleLogout()" style="background: none; border: 1px solid rgba(239,68,68,0.4); color: #F87171; border-radius: 8px; padding: 6px 12px; font-size: 12px; cursor: pointer;">
|
|
تسجيل الخروج
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<!-- Main Content -->
|
|
<main>
|
|
<div class="container">
|
|
|
|
<!-- ========================================== -->
|
|
<!-- 1. AUTHENTICATION BOX (LOGIN / OTP) -->
|
|
<!-- ========================================== -->
|
|
<div id="auth_container" class="auth-card-wrapper">
|
|
|
|
<div class="auth-header">
|
|
<div class="icon-box">
|
|
<svg width="28" height="28" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"></path>
|
|
</svg>
|
|
</div>
|
|
<h1 class="auth-title">ادخل لعالم التمكين والفهم</h1>
|
|
<p class="auth-subtitle">تسجيل دخول آمن وسريع عبر رمز الواتساب المعتمد</p>
|
|
</div>
|
|
|
|
<div class="auth-box">
|
|
|
|
<!-- Alert Messages -->
|
|
<div id="alert_box_error" class="alert alert-error" style="display: none;">
|
|
<span>⚠️</span>
|
|
<span id="alert_error_msg"></span>
|
|
</div>
|
|
|
|
<div id="alert_box_success" class="alert alert-success" style="display: none;">
|
|
<span>✓</span>
|
|
<span id="alert_success_msg"></span>
|
|
</div>
|
|
|
|
<!-- STEP 1: Phone Number (Always Visible First) -->
|
|
<div id="step_phone_container">
|
|
<div class="form-group">
|
|
<label class="form-label">الاسم الكامل للطالب (اختياري للشهادات)</label>
|
|
<input type="text" id="student_fullname" placeholder="مثال: أحمد محمد خالد" class="input-text">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="form-label">رقم الهاتف (الواتساب) <span style="color: #EF4444;">*</span></label>
|
|
<div class="phone-input-group">
|
|
<div class="country-badge">🇯🇴 +962</div>
|
|
<input type="tel" id="student_phone" required placeholder="790000000" class="input-text input-phone">
|
|
</div>
|
|
<span class="form-hint">يصلك رمز التحقق مباشرة على الواتساب المعتمد.</span>
|
|
</div>
|
|
|
|
<button type="button" id="btn_send_otp" onclick="handleSendOtp(event)" class="btn-primary">
|
|
<span id="btn_send_text">إرسال رمز التحقق (OTP) ←</span>
|
|
<div id="btn_send_spinner" class="spinner" style="display: none;"></div>
|
|
</button>
|
|
</div>
|
|
|
|
<!-- STEP 2: OTP Verification (Hidden Initially) -->
|
|
<div id="step_otp_container" style="display: none;">
|
|
<div style="text-align: center; margin-bottom: 20px;">
|
|
<span style="font-size: 12px; color: var(--text-muted);">تم إرسال رمز التحقق إلى:</span>
|
|
<div style="font-family: monospace; font-size: 15px; font-weight: 800; color: var(--accent-cyan); margin-top: 4px;" id="otp_target_display"></div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="form-label" style="text-align: center;">أدخل رمز التحقق (6 أرقام)</label>
|
|
<input type="text" id="student_otp_code" maxlength="6" autofocus placeholder="• • • • • •" class="input-text otp-input">
|
|
</div>
|
|
|
|
<button type="button" id="btn_verify_otp" onclick="handleVerifyOtp(event)" class="btn-primary">
|
|
<span id="btn_verify_text">تأكيد الدخول للمنصة ✨</span>
|
|
<div id="btn_verify_spinner" class="spinner" style="display: none;"></div>
|
|
</button>
|
|
|
|
<div style="display: flex; align-items: center; justify-content: space-between; margin-top: 18px;">
|
|
<button type="button" onclick="switchToPhoneStep()" class="btn-secondary">← تعديل الرقم</button>
|
|
<span id="resend_timer_label" style="font-size: 12px; color: var(--text-muted); display: none;"></span>
|
|
<button type="button" id="btn_resend" onclick="handleSendOtp(event)" class="btn-secondary btn-link-cyan" style="display: none;">إعادة إرسال الرمز ↺</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="auth-footer">
|
|
<span>اتصال مشفر بتكنولوجيا Zero-Trust وبصمة الجهاز الموحدة</span>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- ========================================== -->
|
|
<!-- 2. STUDENT DASHBOARD (AUTHENTICATED) -->
|
|
<!-- ========================================== -->
|
|
<div id="dashboard_container" style="width: 100%; display: none;">
|
|
|
|
<div class="dashboard-hero">
|
|
<div>
|
|
<span style="display: inline-block; font-size: 11px; font-weight: 800; color: var(--accent-cyan); background: rgba(0,245,212,0.12); border: 1px solid rgba(0,245,212,0.3); padding: 4px 12px; border-radius: 999px; margin-bottom: 12px;">دفعة التوجيهي 2007/2008</span>
|
|
<h2 style="font-size: 26px; font-weight: 900; color: #FFFFFF;" id="dashboard_welcome_title">أهلاً بك يا بطلنا 🚀</h2>
|
|
<p style="font-size: 13px; color: var(--text-secondary); margin-top: 4px;">رحلتك لصقل الفهم وتحقيق أعلى معدل وزاري تبدأ هنا.</p>
|
|
</div>
|
|
|
|
<div class="readiness-box">
|
|
<div class="gauge-circle">84%</div>
|
|
<div>
|
|
<span style="font-size: 11px; font-weight: 700; color: var(--text-muted); display: block;">مؤشر الجاهزية للوزاري</span>
|
|
<span style="font-size: 12px; font-weight: 700; color: #34D399;">ممتاز — مسارك مستقر</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="cards-grid">
|
|
<div class="feature-card">
|
|
<div style="display: flex; justify-content: space-between; margin-bottom: 12px;">
|
|
<span style="font-size: 11px; font-weight: 800; background: rgba(59,130,246,0.15); border: 1px solid rgba(59,130,246,0.3); color: #60A5FA; padding: 2px 8px; border-radius: 6px;">علمي</span>
|
|
<span style="font-size: 11px; color: var(--text-muted);">18 درس • كويزات</span>
|
|
</div>
|
|
<h3 style="font-size: 17px; font-weight: 900; margin-bottom: 6px;">الرياضيات العلمي — المستوى الثالث</h3>
|
|
<p style="font-size: 12px; color: var(--text-muted); line-height: 1.5;">شرح تفاعلي لمفاهيم الاشتقاق والنهايات مع أسئلة وزارية محاكية.</p>
|
|
</div>
|
|
|
|
<div class="feature-card">
|
|
<div style="display: flex; justify-content: space-between; margin-bottom: 12px;">
|
|
<span style="font-size: 11px; font-weight: 800; background: rgba(245,158,11,0.15); border: 1px solid rgba(245,158,11,0.3); color: #FBBF24; padding: 2px 8px; border-radius: 6px;">علمي</span>
|
|
<span style="font-size: 11px; color: var(--text-muted);">14 درس • تجارب</span>
|
|
</div>
|
|
<h3 style="font-size: 17px; font-weight: 900; margin-bottom: 6px;">الفيزياء — الميكانيكا والطاقة</h3>
|
|
<p style="font-size: 12px; color: var(--text-muted); line-height: 1.5;">صقل مفاهيم الزخم الخطي والتصادمات وتطبيقاتها في الامتحانات.</p>
|
|
</div>
|
|
|
|
<div class="feature-card">
|
|
<div style="display: flex; justify-content: space-between; margin-bottom: 12px;">
|
|
<span style="font-size: 11px; font-weight: 800; background: rgba(168,85,247,0.15); border: 1px solid rgba(168,85,247,0.3); color: #C084FC; padding: 2px 8px; border-radius: 6px;">ميزة ذكية</span>
|
|
<span style="font-size: 11px; color: var(--accent-cyan); font-weight: 800;">Whisper AI</span>
|
|
</div>
|
|
<h3 style="font-size: 17px; font-weight: 900; margin-bottom: 6px;">الملاحظات الصوتية والتفريغ</h3>
|
|
<p style="font-size: 12px; color: var(--text-muted); line-height: 1.5;">سجل أي ملاحظة بصوتك أثناء الحصة، والذكاء الاصطناعي يفرغها لنص فوري.</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="quiz-demo-box">
|
|
<div style="display: flex; align-items: center; gap: 8px; margin-bottom: 8px;">
|
|
<span style="font-size: 11px; font-weight: 800; background: rgba(0,245,212,0.1); border: 1px solid rgba(0,245,212,0.3); color: var(--accent-cyan); padding: 2px 8px; border-radius: 6px;">تجربة تفاعلية (Coursera Model)</span>
|
|
</div>
|
|
<h3 style="font-size: 20px; font-weight: 900;">كيف يعمل الكويز الصدمي داخل الفيديو؟</h3>
|
|
<p style="font-size: 12px; color: var(--text-muted); margin-top: 4px;">يتوقف الفيديو تلقائياً عند لحظة قياس الفهم. إذا أخطأت، يعيدك المشغل 45 ثانية لمشاهدة شرح المفهوم مجدداً.</p>
|
|
|
|
<div class="interactive-quiz-container">
|
|
<div style="font-size: 11px; font-weight: 800; color: var(--accent-gold); margin-bottom: 8px;">سؤال اللحظة (الدقيقة 08:30 من درس الاشتقاق):</div>
|
|
<p style="font-size: 14px; font-weight: 800; margin-bottom: 14px;">ما هو مشتق اقتران الجيب f(x) = sin(x) بالنسبة لـ x؟</p>
|
|
|
|
<div id="quiz_options_container">
|
|
<div class="quiz-option" onclick="handleQuizAnswer(this, true)">
|
|
<span>أ) cos(x)</span>
|
|
<span class="quiz-status" style="display: none; color: #34D399;">✓ إجابة صحيحة! استئناف الفيديو</span>
|
|
</div>
|
|
<div class="quiz-option" onclick="handleQuizAnswer(this, false)">
|
|
<span>ب) -cos(x)</span>
|
|
<span class="quiz-status" style="display: none; color: #F87171;">✗ خطأ — سيتم إرجاعك 45 ثانية للشرح</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="watermark-anim">
|
|
<span id="drm_watermark_text">SAQEL-DRM • 079XXXXXXX</span>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</main>
|
|
|
|
<!-- Footer -->
|
|
<footer>
|
|
<div class="container">
|
|
<div class="footer-content">
|
|
<span>منصة صَقِل التعليمية — الجيل الثاني للتعليم التفاعلي © 2026</span>
|
|
<div style="display: flex; gap: 16px;">
|
|
<a href="/teacher" class="nav-link">بوابة المعلم</a>
|
|
<span style="color: var(--accent-cyan);">الخادم متصل ومشفر 🔒</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
|
|
<!-- Pure Bulletproof Vanilla JavaScript Logic (100% Native Reliability) -->
|
|
<script>
|
|
let countdownTimer = null;
|
|
let timerSeconds = 0;
|
|
|
|
document.addEventListener('DOMContentLoaded', async () => {
|
|
const token = localStorage.getItem('saqel_student_jwt');
|
|
if (token) {
|
|
await checkActiveSession(token);
|
|
}
|
|
});
|
|
|
|
function showError(msg) {
|
|
const errBox = document.getElementById('alert_box_error');
|
|
const errSpan = document.getElementById('alert_error_msg');
|
|
const okBox = document.getElementById('alert_box_success');
|
|
okBox.style.display = 'none';
|
|
errSpan.textContent = msg;
|
|
errBox.style.display = 'flex';
|
|
}
|
|
|
|
function showSuccess(msg) {
|
|
const okBox = document.getElementById('alert_box_success');
|
|
const okSpan = document.getElementById('alert_success_msg');
|
|
const errBox = document.getElementById('alert_box_error');
|
|
errBox.style.display = 'none';
|
|
okSpan.textContent = msg;
|
|
okBox.style.display = 'flex';
|
|
}
|
|
|
|
function clearAlerts() {
|
|
document.getElementById('alert_box_error').style.display = 'none';
|
|
document.getElementById('alert_box_success').style.display = 'none';
|
|
}
|
|
|
|
function switchToPhoneStep() {
|
|
document.getElementById('step_otp_container').style.display = 'none';
|
|
document.getElementById('step_phone_container').style.display = 'block';
|
|
clearAlerts();
|
|
clearInterval(countdownTimer);
|
|
}
|
|
|
|
function switchToOtpStep(maskedPhone) {
|
|
document.getElementById('step_phone_container').style.display = 'none';
|
|
document.getElementById('step_otp_container').style.display = 'block';
|
|
document.getElementById('otp_target_display').textContent = maskedPhone;
|
|
const otpInput = document.getElementById('student_otp_code');
|
|
otpInput.value = '';
|
|
otpInput.focus();
|
|
startTimer(60);
|
|
}
|
|
|
|
function startTimer(seconds) {
|
|
timerSeconds = seconds;
|
|
clearInterval(countdownTimer);
|
|
const timerLabel = document.getElementById('resend_timer_label');
|
|
const resendBtn = document.getElementById('btn_resend');
|
|
|
|
resendBtn.style.display = 'none';
|
|
timerLabel.style.display = 'inline';
|
|
timerLabel.textContent = `إعادة الإرسال بعد (${timerSeconds}ث)`;
|
|
|
|
countdownTimer = setInterval(() => {
|
|
timerSeconds--;
|
|
if (timerSeconds > 0) {
|
|
timerLabel.textContent = `إعادة الإرسال بعد (${timerSeconds}ث)`;
|
|
} else {
|
|
clearInterval(countdownTimer);
|
|
timerLabel.style.display = 'none';
|
|
resendBtn.style.display = 'inline';
|
|
}
|
|
}, 1000);
|
|
}
|
|
|
|
async function getDeviceFingerprint() {
|
|
try {
|
|
const raw = [
|
|
navigator.userAgent,
|
|
navigator.language,
|
|
screen.width + 'x' + screen.height,
|
|
Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
].join('###');
|
|
const msgUint8 = new TextEncoder().encode(raw);
|
|
const hashBuffer = await crypto.subtle.digest('SHA-256', msgUint8);
|
|
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
|
|
} catch (e) {
|
|
return 'student_web_' + Math.random().toString(36).substring(2);
|
|
}
|
|
}
|
|
|
|
async function handleSendOtp(e) {
|
|
if (e) e.preventDefault();
|
|
clearAlerts();
|
|
|
|
const phoneInput = document.getElementById('student_phone');
|
|
const nameInput = document.getElementById('student_fullname');
|
|
const sendBtn = document.getElementById('btn_send_otp');
|
|
const sendText = document.getElementById('btn_send_text');
|
|
const sendSpinner = document.getElementById('btn_send_spinner');
|
|
|
|
const phone = phoneInput.value.trim();
|
|
const fullName = nameInput.value.trim();
|
|
|
|
if (!phone) {
|
|
showError('يرجى إدخال رقم الهاتف');
|
|
phoneInput.focus();
|
|
return;
|
|
}
|
|
|
|
sendBtn.disabled = true;
|
|
sendText.textContent = 'جارٍ إرسال البطاقة عبر الواتساب...';
|
|
sendSpinner.style.display = 'block';
|
|
|
|
try {
|
|
const res = await fetch('/api/auth/otp/request', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({
|
|
phone_number: phone,
|
|
role: 'student',
|
|
full_name: fullName
|
|
})
|
|
});
|
|
|
|
const data = await res.json();
|
|
console.log('Nabeh Student OTP Response:', data);
|
|
|
|
if (res.ok && data.status === 'success') {
|
|
showSuccess(data.message || 'تم إرسال بطاقة التحقق عبر الواتساب!');
|
|
switchToOtpStep(data.data?.phone_masked || phone, data.debug_otp);
|
|
} else {
|
|
showError(data.message || 'فشل إرسال رمز التحقق من منصة نبيه.');
|
|
}
|
|
} catch (err) {
|
|
console.error('Fetch error:', err);
|
|
showError('حدث خطأ في الاتصال بالسيرفر. تأكد من اتصال الإنترنت.');
|
|
} finally {
|
|
sendBtn.disabled = false;
|
|
sendText.textContent = 'إرسال رمز التحقق (OTP) ←';
|
|
sendSpinner.style.display = 'none';
|
|
}
|
|
}
|
|
|
|
async function handleVerifyOtp(e) {
|
|
if (e) e.preventDefault();
|
|
clearAlerts();
|
|
|
|
const phone = document.getElementById('student_phone').value.trim();
|
|
const fullName = document.getElementById('student_fullname').value.trim();
|
|
const otpInput = document.getElementById('student_otp_code');
|
|
const otpCode = otpInput.value.trim();
|
|
|
|
const verifyBtn = document.getElementById('btn_verify_otp');
|
|
const verifyText = document.getElementById('btn_verify_text');
|
|
const verifySpinner = document.getElementById('btn_verify_spinner');
|
|
|
|
if (!otpCode || otpCode.length < 6) {
|
|
showError('يرجى إدخال رمز التحقق المكون من 6 أرقام');
|
|
otpInput.focus();
|
|
return;
|
|
}
|
|
|
|
verifyBtn.disabled = true;
|
|
verifyText.textContent = 'جارٍ التحقق وتأكيد الجلسة...';
|
|
verifySpinner.style.display = 'block';
|
|
|
|
try {
|
|
const fingerprint = await getDeviceFingerprint();
|
|
const res = await fetch('/api/auth/otp/verify', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({
|
|
phone_number: phone,
|
|
otp: otpCode,
|
|
role: 'student',
|
|
full_name: fullName,
|
|
device_fingerprint: fingerprint
|
|
})
|
|
});
|
|
|
|
const data = await res.json();
|
|
console.log('Verify Student Response:', data);
|
|
|
|
if (res.ok && data.status === 'success' && data.data?.token) {
|
|
localStorage.setItem('saqel_student_jwt', data.data.token);
|
|
renderDashboard(data.data.user);
|
|
} else {
|
|
showError(data.message || 'رمز التحقق غير صحيح أو منتهي الصلاحية');
|
|
}
|
|
} catch (err) {
|
|
console.error('Verify error:', err);
|
|
showError('حدث خطأ في التحقق من الرمز.');
|
|
} finally {
|
|
verifyBtn.disabled = false;
|
|
verifyText.textContent = 'تأكيد الدخول للمنصة ✨';
|
|
verifySpinner.style.display = 'none';
|
|
}
|
|
}
|
|
|
|
async function checkActiveSession(token) {
|
|
try {
|
|
const res = await fetch('/api/auth/me', {
|
|
headers: { 'Authorization': 'Bearer ' + token }
|
|
});
|
|
const data = await res.json();
|
|
if (res.ok && data.data) {
|
|
renderDashboard({
|
|
name: data.data.full_name,
|
|
phone: data.data.phone_number
|
|
});
|
|
} else {
|
|
localStorage.removeItem('saqel_student_jwt');
|
|
}
|
|
} catch (e) {
|
|
console.error('Session check error:', e);
|
|
}
|
|
}
|
|
|
|
function renderDashboard(user) {
|
|
document.getElementById('auth_container').style.display = 'none';
|
|
document.getElementById('dashboard_container').style.display = 'block';
|
|
document.getElementById('switch_to_teacher_link').style.display = 'none';
|
|
document.getElementById('auth_user_badge').style.display = 'flex';
|
|
|
|
const displayName = user?.name || 'طالبنا المتميز';
|
|
document.getElementById('student_display_name').textContent = `مرحباً، ${displayName}`;
|
|
document.getElementById('dashboard_welcome_title').textContent = `أهلاً بك، ${displayName} 🚀`;
|
|
document.getElementById('drm_watermark_text').textContent = `SAQEL-DRM • ${user?.phone || '079XXXXXXX'}`;
|
|
}
|
|
|
|
function handleLogout() {
|
|
const token = localStorage.getItem('saqel_student_jwt');
|
|
if (token) {
|
|
fetch('/api/auth/logout', {
|
|
method: 'POST',
|
|
headers: { 'Authorization': 'Bearer ' + token }
|
|
}).catch(() => {});
|
|
}
|
|
localStorage.removeItem('saqel_student_jwt');
|
|
location.reload();
|
|
}
|
|
|
|
function handleQuizAnswer(el, isCorrect) {
|
|
const options = document.querySelectorAll('.quiz-option');
|
|
options.forEach(opt => {
|
|
opt.classList.remove('correct', 'incorrect');
|
|
opt.querySelector('.quiz-status').style.display = 'none';
|
|
});
|
|
|
|
if (isCorrect) {
|
|
el.classList.add('correct');
|
|
} else {
|
|
el.classList.add('incorrect');
|
|
}
|
|
el.querySelector('.quiz-status').style.display = 'inline';
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|
|
HTML;
|
|
}
|
|
}
|