86 lines
5.6 KiB
PHP
86 lines
5.6 KiB
PHP
<?php
|
|
require_once __DIR__ . '/includes/app.php';
|
|
$id = (int) ($_GET['id'] ?? 0);
|
|
$subscription = $id > 0 ? fetch_subscription($id) : current_subscription();
|
|
if (!$subscription) {
|
|
render_head(t('Subscription not found', 'الاشتراك غير موجود'));
|
|
render_nav('dashboard.php');
|
|
?>
|
|
<main class="py-5"><div class="container"><div class="alert alert-warning"><?= h(t('The subscription detail could not be found.', 'تعذر العثور على تفاصيل الاشتراك.')) ?></div></div></main>
|
|
<?php
|
|
render_footer();
|
|
exit;
|
|
}
|
|
$_SESSION['subscription_id'] = (int) $subscription['id'];
|
|
$_SESSION['student_email'] = $subscription['email'];
|
|
$plan = get_plan($subscription['plan_key']) ?? get_plan('plus');
|
|
$created = isset($_GET['created']);
|
|
$subjects = array_slice(subjects_catalog(), 0, $plan['subjects_limit'] >= 999 ? 4 : $plan['subjects_limit']);
|
|
render_head(
|
|
t('Subscription confirmation', 'تأكيد الاشتراك'),
|
|
t('Review the new subscription, payment reference, and the first live classrooms unlocked for the student.', 'راجع الاشتراك الجديد ومرجع الدفع وأول الفصول المباشرة التي تم فتحها للطالب.')
|
|
);
|
|
render_nav('dashboard.php');
|
|
?>
|
|
<main class="py-5">
|
|
<div class="container">
|
|
<?php if ($created): ?>
|
|
<div class="toast-container position-fixed top-0 end-0 p-3">
|
|
<div class="toast align-items-center text-bg-dark border-0" role="status" aria-live="polite" aria-atomic="true" data-auto-toast>
|
|
<div class="d-flex">
|
|
<div class="toast-body"><?= h(t('Subscription created. The dashboard and live access are now ready.', 'تم إنشاء الاشتراك. أصبحت لوحة التحكم والوصول المباشر جاهزين الآن.')) ?></div>
|
|
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
<div class="row g-4">
|
|
<div class="col-lg-7">
|
|
<div class="panel-card h-100">
|
|
<span class="eyebrow"><?= h(t('Confirmation', 'التأكيد')) ?></span>
|
|
<h1 class="section-title mb-3"><?= h(t('Your subscription is active', 'اشتراكك نشط')) ?></h1>
|
|
<div class="alert alert-success border mb-4">
|
|
<strong><?= h(t('Plan activated successfully.', 'تم تفعيل الخطة بنجاح.')) ?></strong>
|
|
<div class="small mt-1"><?= h(t('This record was saved in the database and linked to your student dashboard.', 'تم حفظ هذا السجل في قاعدة البيانات وربطه بلوحة الطالب الخاصة بك.')) ?></div>
|
|
</div>
|
|
<div class="detail-meta-grid mb-4">
|
|
<div><strong><?= h(t('Student', 'الطالب')) ?></strong><span><?= h($subscription['full_name']) ?></span></div>
|
|
<div><strong><?= h(t('Email', 'البريد الإلكتروني')) ?></strong><span><?= h($subscription['email']) ?></span></div>
|
|
<div><strong><?= h(t('Plan', 'الخطة')) ?></strong><span><?= h(plan_name($plan)) ?></span></div>
|
|
<div><strong><?= h(t('Status', 'الحالة')) ?></strong><span class="<?= h(status_badge((string) $subscription['payment_status'])) ?>"><?= h(ucfirst((string) $subscription['payment_status'])) ?></span></div>
|
|
<div><strong><?= h(t('Thawani ref', 'مرجع ثواني')) ?></strong><span><button type="button" class="copy-chip" data-copy-text="<?= h($subscription['thawani_reference']) ?>"><?= h($subscription['thawani_reference']) ?></button></span></div>
|
|
<div><strong><?= h(t('WhatsApp', 'واتساب')) ?></strong><span><?= h($subscription['whatsapp']) ?></span></div>
|
|
</div>
|
|
<div class="d-flex flex-wrap gap-2">
|
|
<a class="btn btn-dark" href="<?= h(app_url('dashboard.php', ['subscription_id' => (int) $subscription['id']])) ?>"><?= h(t('Go to dashboard', 'انتقل إلى لوحة التحكم')) ?></a>
|
|
<a class="btn btn-outline-dark" href="<?= h(app_url('catalog.php')) ?>"><?= h(t('Browse more subjects', 'تصفح المزيد من المواد')) ?></a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-5">
|
|
<aside class="panel-card sticky-card">
|
|
<h2 class="h5 mb-3"><?= h(t('First unlocked classrooms', 'أول الفصول المفتوحة')) ?></h2>
|
|
<div class="stack-list">
|
|
<?php foreach ($subjects as $subject): ?>
|
|
<div class="stack-item">
|
|
<div>
|
|
<strong><?= h(subject_title($subject)) ?></strong>
|
|
<p><?= h(subject_next_live($subject)) ?></p>
|
|
</div>
|
|
<a class="btn btn-sm btn-outline-dark" href="<?= h(app_url('subject.php', ['slug' => $subject['slug']])) ?>"><?= h(t('Open', 'فتح')) ?></a>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<hr>
|
|
<div class="small text-secondary d-flex flex-column gap-2">
|
|
<div><strong class="text-dark"><?= h(t('Payment channel', 'قناة الدفع')) ?>:</strong> <?= h($subscription['payment_gateway']) ?></div>
|
|
<div><strong class="text-dark"><?= h(t('Reminder channel', 'قناة التذكير')) ?>:</strong> <?= h((int) $subscription['wablas_opt_in'] === 1 ? t('Enabled via Wablas', 'مفعلة عبر وابلاس') : t('Not enabled', 'غير مفعلة')) ?></div>
|
|
<div><strong class="text-dark"><?= h(t('Live classroom', 'الفصل المباشر')) ?>:</strong> Google Meet</div>
|
|
</div>
|
|
</aside>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
<?php render_footer(); ?>
|