885 lines
34 KiB
PHP
885 lines
34 KiB
PHP
<?php
|
|
|
|
namespace App\Views;
|
|
|
|
class TeacherPortal
|
|
{
|
|
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">
|
|
|
|
<!-- 1. Pure Self-Contained Luxury CSS (Zero External CDN Failure Risk) -->
|
|
<style>
|
|
:root {
|
|
--bg-dark: #0B132B;
|
|
--bg-card: #16203D;
|
|
--bg-card-hover: #1E2C52;
|
|
--bg-input: #090E20;
|
|
--border: #2A3B66;
|
|
--border-focus: #FFD166;
|
|
--text-primary: #FFFFFF;
|
|
--text-secondary: #CBD5E1;
|
|
--text-muted: #8E9FB8;
|
|
--accent-gold: #FFD166;
|
|
--accent-gold-dark: #F59E0B;
|
|
--accent-cyan: #00F5D4;
|
|
--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(255, 209, 102, 0.07) 0%, transparent 40%),
|
|
radial-gradient(circle at 85% 85%, rgba(0, 245, 212, 0.05) 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-gold), var(--accent-gold-dark));
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
color: #0B132B;
|
|
font-size: 20px;
|
|
font-weight: 900;
|
|
box-shadow: 0 0 20px rgba(255, 209, 102, 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(255, 209, 102, 0.12);
|
|
color: var(--accent-gold);
|
|
border: 1px solid rgba(255, 209, 102, 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-cyan);
|
|
}
|
|
|
|
.nav-link-highlight {
|
|
color: var(--accent-cyan);
|
|
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(255, 209, 102, 0.4);
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
color: var(--accent-gold);
|
|
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-gold);
|
|
box-shadow: 0 0 0 3px rgba(255, 209, 102, 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-gold);
|
|
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, #FFD166 0%, #F59E0B 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(255, 209, 102, 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-gold {
|
|
color: var(--accent-gold);
|
|
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-gold);
|
|
border-color: rgba(255, 209, 102, 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(255, 209, 102, 0.15);
|
|
border: 1px solid rgba(255, 209, 102, 0.4);
|
|
color: var(--accent-gold);
|
|
}
|
|
|
|
.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);
|
|
}
|
|
|
|
/* Dashboard Styles */
|
|
.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;
|
|
}
|
|
|
|
.stats-grid {
|
|
display: flex;
|
|
gap: 16px;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
.stat-card {
|
|
background: rgba(11, 19, 43, 0.85);
|
|
border: 1px solid var(--border);
|
|
border-radius: 16px;
|
|
padding: 16px 24px;
|
|
text-align: center;
|
|
min-width: 140px;
|
|
}
|
|
|
|
.stat-card.gold-glow {
|
|
border-color: rgba(255, 209, 102, 0.5);
|
|
box-shadow: 0 0 20px rgba(255, 209, 102, 0.15);
|
|
}
|
|
|
|
.stat-label {
|
|
font-size: 11px;
|
|
font-weight: 700;
|
|
color: var(--text-muted);
|
|
display: block;
|
|
margin-bottom: 4px;
|
|
}
|
|
|
|
.stat-val {
|
|
font-size: 24px;
|
|
font-weight: 900;
|
|
}
|
|
|
|
.val-cyan { color: var(--accent-cyan); }
|
|
.val-gold { color: var(--accent-gold); }
|
|
|
|
.studio-card {
|
|
background: var(--bg-card);
|
|
border: 1px solid var(--border);
|
|
border-radius: 24px;
|
|
padding: 32px;
|
|
}
|
|
|
|
.grid-2 {
|
|
display: grid;
|
|
grid-template-columns: 1fr 1fr;
|
|
gap: 20px;
|
|
background: rgba(11, 19, 43, 0.8);
|
|
border: 1px solid var(--border);
|
|
border-radius: 16px;
|
|
padding: 24px;
|
|
margin-top: 20px;
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.grid-2 { grid-template-columns: 1fr; }
|
|
.dashboard-hero { padding: 24px; }
|
|
}
|
|
|
|
/* 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>
|
|
|
|
<!-- 2. Alpine Component Setup -->
|
|
<script>
|
|
function teacherAuth() {
|
|
return {
|
|
isLoggedIn: false,
|
|
authStep: 'phone', // 'phone' | 'otp'
|
|
phone: '',
|
|
fullName: '',
|
|
otpCode: '',
|
|
phoneDisplay: '',
|
|
loading: false,
|
|
errorMessage: '',
|
|
successMessage: '',
|
|
timer: 0,
|
|
timerInterval: null,
|
|
deviceFingerprint: '',
|
|
teacherData: {},
|
|
|
|
async initApp() {
|
|
try {
|
|
this.deviceFingerprint = await this.generateDeviceFingerprint();
|
|
const token = localStorage.getItem('saqel_teacher_jwt');
|
|
if (token) {
|
|
await this.fetchProfile(token);
|
|
}
|
|
} catch (e) {
|
|
console.error('Teacher App init error:', e);
|
|
}
|
|
},
|
|
|
|
async generateDeviceFingerprint() {
|
|
try {
|
|
const raw = [
|
|
navigator.userAgent,
|
|
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 'teacher_web_' + Math.random().toString(36).substring(2);
|
|
}
|
|
},
|
|
|
|
async sendOtp() {
|
|
if (!this.phone) {
|
|
this.errorMessage = 'يرجى إدخال رقم الهاتف المسجل';
|
|
return;
|
|
}
|
|
this.loading = true;
|
|
this.errorMessage = '';
|
|
this.successMessage = '';
|
|
|
|
try {
|
|
const res = await fetch('/api/auth/otp/request', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({
|
|
phone_number: this.phone,
|
|
role: 'teacher',
|
|
full_name: this.fullName
|
|
})
|
|
});
|
|
|
|
const data = await res.json();
|
|
if (res.ok) {
|
|
this.authStep = 'otp';
|
|
this.phoneDisplay = data.data?.phone_masked || this.phone;
|
|
this.successMessage = data.message;
|
|
if (data.debug_otp) {
|
|
this.otpCode = data.debug_otp;
|
|
}
|
|
this.startTimer(60);
|
|
} else {
|
|
this.errorMessage = data.message || 'فشل إرسال رمز التحقق. يرجى مراجعة إعدادات NABEH في السيرفر.';
|
|
}
|
|
} catch (e) {
|
|
this.errorMessage = 'حدث خطأ في الاتصال بالخادم. يرجى فحص /api/test/nabeh';
|
|
} finally {
|
|
this.loading = false;
|
|
}
|
|
},
|
|
|
|
async verifyOtp() {
|
|
if (!this.otpCode || this.otpCode.length < 6) {
|
|
this.errorMessage = 'يرجى إدخال رمز التحقق المكون من 6 أرقام';
|
|
return;
|
|
}
|
|
this.loading = true;
|
|
this.errorMessage = '';
|
|
|
|
try {
|
|
const res = await fetch('/api/auth/otp/verify', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({
|
|
phone_number: this.phone,
|
|
otp: this.otpCode,
|
|
role: 'teacher',
|
|
full_name: this.fullName,
|
|
device_fingerprint: this.deviceFingerprint
|
|
})
|
|
});
|
|
|
|
const data = await res.json();
|
|
if (res.ok && data.data?.token) {
|
|
localStorage.setItem('saqel_teacher_jwt', data.data.token);
|
|
this.teacherData = data.data.user;
|
|
this.isLoggedIn = true;
|
|
this.successMessage = 'تم تسجيل الدخول بنجاح!';
|
|
} else {
|
|
this.errorMessage = data.message || 'رمز التحقق غير صحيح أو غير مصرح للمعلم';
|
|
}
|
|
} catch (e) {
|
|
this.errorMessage = 'حدث خطأ أثناء التحقق من الرمز';
|
|
} finally {
|
|
this.loading = false;
|
|
}
|
|
},
|
|
|
|
async fetchProfile(token) {
|
|
try {
|
|
const res = await fetch('/api/auth/me', {
|
|
headers: { 'Authorization': 'Bearer ' + token }
|
|
});
|
|
const data = await res.json();
|
|
if (res.ok && data.data && (data.data.role === 'teacher' || data.data.role === 'super_admin')) {
|
|
this.teacherData = {
|
|
name: data.data.full_name,
|
|
phone: data.data.phone_number,
|
|
role: data.data.role
|
|
};
|
|
this.isLoggedIn = true;
|
|
} else {
|
|
localStorage.removeItem('saqel_teacher_jwt');
|
|
this.isLoggedIn = false;
|
|
}
|
|
} catch (e) {
|
|
this.isLoggedIn = false;
|
|
}
|
|
},
|
|
|
|
logout() {
|
|
const token = localStorage.getItem('saqel_teacher_jwt');
|
|
if (token) {
|
|
fetch('/api/auth/logout', {
|
|
method: 'POST',
|
|
headers: { 'Authorization': 'Bearer ' + token }
|
|
}).catch(() => {});
|
|
}
|
|
localStorage.removeItem('saqel_teacher_jwt');
|
|
this.isLoggedIn = false;
|
|
this.authStep = 'phone';
|
|
this.otpCode = '';
|
|
this.errorMessage = '';
|
|
this.successMessage = '';
|
|
},
|
|
|
|
startTimer(seconds) {
|
|
this.timer = seconds;
|
|
clearInterval(this.timerInterval);
|
|
this.timerInterval = setInterval(() => {
|
|
if (this.timer > 0) {
|
|
this.timer--;
|
|
} else {
|
|
clearInterval(this.timerInterval);
|
|
}
|
|
}, 1000);
|
|
}
|
|
};
|
|
}
|
|
</script>
|
|
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
|
|
</head>
|
|
<body x-data="teacherAuth()" x-init="initApp()">
|
|
|
|
<!-- Header -->
|
|
<header>
|
|
<div class="container">
|
|
<div class="header-content">
|
|
<a href="/teacher" class="logo-area">
|
|
<div class="logo-badge">صـ</div>
|
|
<div>
|
|
<span class="brand-title">صَقِل</span>
|
|
<span class="portal-pill">استوديو المعلمين</span>
|
|
</div>
|
|
</a>
|
|
|
|
<div>
|
|
<template x-if="isLoggedIn">
|
|
<div style="display: flex; align-items: center; gap: 12px;">
|
|
<span style="font-size: 13px; color: var(--text-secondary);" x-text="'أهلاً، ' + (teacherData.name || 'أستاذنا')"></span>
|
|
<button @click="logout()" 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>
|
|
</template>
|
|
<template x-if="!isLoggedIn">
|
|
<a href="/student" class="nav-link">
|
|
<span>أنت طالب؟</span>
|
|
<span class="nav-link-highlight">بوابة الطلاب ←</span>
|
|
</a>
|
|
</template>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<!-- Main Content -->
|
|
<main>
|
|
<div class="container">
|
|
|
|
<!-- ========================================== -->
|
|
<!-- 1. AUTHENTICATION BOX (LOGIN / OTP) -->
|
|
<!-- ========================================== -->
|
|
<div x-show="!isLoggedIn" 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="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"></path>
|
|
</svg>
|
|
</div>
|
|
<h1 class="auth-title">استوديو صَقِل للمعلمين</h1>
|
|
<p class="auth-subtitle">حماية محتواك بـ DRM وأرباح متنامية بنظام الشراكة التفاعلية</p>
|
|
</div>
|
|
|
|
<div class="auth-box">
|
|
|
|
<!-- Alerts -->
|
|
<template x-if="errorMessage">
|
|
<div class="alert alert-error">
|
|
<span>⚠️</span>
|
|
<span x-text="errorMessage"></span>
|
|
</div>
|
|
</template>
|
|
|
|
<template x-if="successMessage">
|
|
<div class="alert alert-success">
|
|
<span>✓</span>
|
|
<span x-text="successMessage"></span>
|
|
</div>
|
|
</template>
|
|
|
|
<!-- STEP 1: Phone Number (Shown by default) -->
|
|
<div x-show="authStep === 'phone'">
|
|
<form @submit.prevent="sendOtp()">
|
|
<div class="form-group">
|
|
<label class="form-label">اسم الأستاذ / المعلم</label>
|
|
<input type="text" x-model="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" x-model="phone" required placeholder="790000000" class="input-text input-phone">
|
|
</div>
|
|
<span class="form-hint">يصلك رمز التحقق مباشرة على الواتساب المعتمد.</span>
|
|
</div>
|
|
|
|
<button type="submit" :disabled="loading" class="btn-primary">
|
|
<template x-if="loading">
|
|
<div class="spinner"></div>
|
|
</template>
|
|
<span x-text="loading ? 'جارٍ التحقق...' : 'دخول استوديو المعلم (OTP) ←'">دخول استوديو المعلم (OTP) ←</span>
|
|
</button>
|
|
</form>
|
|
</div>
|
|
|
|
<!-- STEP 2: OTP Verification (Hidden initially via CSS until authStep === 'otp') -->
|
|
<div x-show="authStep === 'otp'" 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-gold); margin-top: 4px;" x-text="phoneDisplay"></div>
|
|
</div>
|
|
|
|
<form @submit.prevent="verifyOtp()">
|
|
<div class="form-group">
|
|
<label class="form-label" style="text-align: center;">أدخل رمز التحقق (6 أرقام)</label>
|
|
<input type="text" x-model="otpCode" maxlength="6" autofocus placeholder="• • • • • •" class="input-text otp-input">
|
|
</div>
|
|
|
|
<button type="submit" :disabled="loading || otpCode.length < 6" class="btn-primary">
|
|
<template x-if="loading">
|
|
<div class="spinner"></div>
|
|
</template>
|
|
<span x-text="loading ? 'جارٍ التحقق...' : 'تأكيد الدخول للاستوديو 🎓'">تأكيد الدخول للاستوديو 🎓</span>
|
|
</button>
|
|
|
|
<div style="display: flex; align-items: center; justify-content: space-between; margin-top: 18px;">
|
|
<button type="button" @click="authStep = 'phone'" class="btn-secondary">← تعديل الرقم</button>
|
|
<template x-if="timer > 0">
|
|
<span style="font-size: 12px; color: var(--text-muted);" x-text="'إعادة الإرسال بعد (' + timer + 'ث)'"></span>
|
|
</template>
|
|
<template x-if="timer === 0">
|
|
<button type="button" @click="sendOtp()" class="btn-secondary btn-link-gold">إعادة إرسال الرمز ↺</button>
|
|
</template>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<div class="auth-footer">
|
|
<span>حماية محتوى DRM كاملة + تقاسم أرباح 45%–50% شفاف ومؤتمت</span>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- ========================================== -->
|
|
<!-- 2. TEACHER DASHBOARD (AUTHENTICATED) -->
|
|
<!-- ========================================== -->
|
|
<div x-show="isLoggedIn" style="width: 100%; display: none;">
|
|
|
|
<div class="dashboard-hero">
|
|
<div>
|
|
<span style="display: inline-block; font-size: 11px; font-weight: 800; color: var(--accent-gold); background: rgba(255,209,102,0.12); border: 1px solid rgba(255,209,102,0.3); padding: 4px 12px; border-radius: 999px; margin-bottom: 12px;">استوديو المعلم المعتمد</span>
|
|
<h2 style="font-size: 26px; font-weight: 900; color: #FFFFFF;" x-text="'أهلاً بك، ' + (teacherData.name || 'أستاذنا الفاضل') + ' 👨🏫'"></h2>
|
|
<p style="font-size: 13px; color: var(--text-secondary); margin-top: 4px;">إدارة دوراتك، إدراج كويزات الفيديو التفاعلية، ومتابعة نمو طلابك.</p>
|
|
</div>
|
|
|
|
<div class="stats-grid">
|
|
<div class="stat-card">
|
|
<span class="stat-label">إجمالي الطلاب</span>
|
|
<span class="stat-val val-cyan">1,240</span>
|
|
</div>
|
|
<div class="stat-card gold-glow">
|
|
<span class="stat-label">أرباحك المتراكمة</span>
|
|
<span class="stat-val val-gold">19,530 د.أ</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="studio-card">
|
|
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px;">
|
|
<div>
|
|
<h3 style="font-size: 18px; font-weight: 900;">إضافة كويز تفاعلي داخل الفيديو 🎬</h3>
|
|
<p style="font-size: 12px; color: var(--text-muted); margin-top: 4px;">حدد الثانية الزمنية في الفيديو التي سيتوقف عندها الشرح لفحص فهم الطالب.</p>
|
|
</div>
|
|
<span style="font-size: 11px; font-weight: 700; background: rgba(0,245,212,0.1); border: 1px solid rgba(0,245,212,0.3); color: var(--accent-cyan); padding: 4px 12px; border-radius: 8px;">Bunny Stream Synced</span>
|
|
</div>
|
|
|
|
<div class="grid-2">
|
|
<div>
|
|
<div class="form-group">
|
|
<label class="form-label">اختر الدورة والدرس</label>
|
|
<select class="input-text">
|
|
<option>الرياضيات العلمي — الدرس 4: قواعد الاشتقاق الأساسية</option>
|
|
<option>الرياضيات العلمي — الدرس 5: الاشتقاق الضمني</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="form-label">توقيت ظهور الكويز (بالدقيقة والثانية)</label>
|
|
<input type="text" value="08:30" class="input-text" style="color: var(--accent-cyan); font-family: monospace;">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="form-label">عقوبة الخطأ (الإرجاع العلاجي)</label>
|
|
<select class="input-text">
|
|
<option>إرجاع الطالب 45 ثانية للخلف (مستحسن)</option>
|
|
<option>إرجاع الطالب 60 ثانية للخلف</option>
|
|
<option>إعادة مشاهدة المقطع بالكامل</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div>
|
|
<div class="form-group">
|
|
<label class="form-label">نص السؤال التفاعلي</label>
|
|
<textarea rows="3" placeholder="اكتب السؤال الذي سيظهر أمام الطالب..." class="input-text" style="resize: none; height: 80px;"></textarea>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<input type="text" placeholder="الخيار الأول (الصحيح)" class="input-text" style="margin-bottom: 8px; border-color: rgba(16,185,129,0.4); color: #6EE7B7;">
|
|
<input type="text" placeholder="الخيار الثاني (الخاطئ)" class="input-text">
|
|
</div>
|
|
|
|
<button class="btn-primary" style="padding: 10px;">حفظ الكويز داخل الفيديو ✓</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</main>
|
|
|
|
<!-- Footer -->
|
|
<footer>
|
|
<div class="container">
|
|
<div class="footer-content">
|
|
<span>منصة صَقِل التعليمية — نظام استوديو المعلمين © 2026</span>
|
|
<div style="display: flex; gap: 16px;">
|
|
<a href="/student" class="nav-link">بوابة الطلاب</a>
|
|
<span style="color: var(--accent-cyan);">الخادم متصل ومشفر 🔒</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
|
|
</body>
|
|
</html>
|
|
HTML;
|
|
}
|
|
}
|