38993-vm/kyc_status.php
2026-03-05 07:57:07 +00:00

96 lines
3.9 KiB
PHP

<?php
declare(strict_types=1);
require_once __DIR__ . '/app.php';
ensure_kyc_table();
$id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
$record = null;
if ($id > 0) {
$stmt = db()->prepare('SELECT * FROM kyc_applications WHERE id = :id LIMIT 1');
$stmt->execute([':id' => $id]);
$record = $stmt->fetch();
}
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
?>
<!doctype html>
<html lang="<?= h($lang) ?>">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title><?= h(t('status_title')) ?> · <?= h(t('site_name')) ?></title>
<?php if ($projectDescription): ?>
<meta name="description" content="<?= h($projectDescription) ?>" />
<meta property="og:description" content="<?= h($projectDescription) ?>" />
<meta property="twitter:description" content="<?= h($projectDescription) ?>" />
<?php endif; ?>
<?php if ($projectImageUrl): ?>
<meta property="og:image" content="<?= h($projectImageUrl) ?>" />
<meta property="twitter:image" content="<?= h($projectImageUrl) ?>" />
<?php endif; ?>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="assets/css/custom.css?v=<?= h((string) time()) ?>">
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light">
<div class="container">
<a class="navbar-brand" href="<?= h(url_with_lang('index.php')) ?>"><?= h(t('site_name')) ?></a>
<div class="ms-auto lang-toggle btn-group" role="group">
<a class="btn btn-sm <?= $lang === 'zh' ? 'active' : '' ?>" href="<?= h(url_with_lang('kyc_status.php', ['lang' => 'zh', 'id' => $id ?: null])) ?>">中文</a>
<a class="btn btn-sm <?= $lang === 'en' ? 'active' : '' ?>" href="<?= h(url_with_lang('kyc_status.php', ['lang' => 'en', 'id' => $id ?: null])) ?>">EN</a>
</div>
</div>
</nav>
<main class="container my-5">
<div class="section-card">
<h1 class="section-title mb-1"><?= h(t('status_title')) ?></h1>
<p class="text-muted mb-4"><?= h(t('status_subtitle')) ?></p>
<form class="row g-3 mb-4" method="get">
<input type="hidden" name="lang" value="<?= h($lang) ?>">
<div class="col-md-6">
<label class="form-label"><?= h(t('status_label')) ?></label>
<input type="number" name="id" class="form-control" required value="<?= h($id ? (string) $id : '') ?>">
</div>
<div class="col-md-3 align-self-end">
<button type="submit" class="cta-btn"><?= h(t('status_btn')) ?></button>
</div>
</form>
<?php if ($id > 0 && !$record): ?>
<div class="alert alert-warning"><?= h(t('status_empty')) ?></div>
<?php elseif ($record): ?>
<?php
$status = $record['status'] ?? 'pending';
$statusLabel = match ($status) {
'approved' => t('status_approved'),
'rejected' => t('status_rejected'),
default => t('status_pending'),
};
$statusClass = match ($status) {
'approved' => 'status-approved',
'rejected' => 'status-rejected',
default => 'status-pending',
};
?>
<div class="d-flex flex-column flex-lg-row justify-content-between gap-3">
<div>
<div class="text-muted"><?= h(t('status_label')) ?>: <?= h((string) $record['id']) ?></div>
<div class="mt-2">Name: <?= h($record['full_name']) ?></div>
<div class="text-muted mt-1">Submitted: <?= h($record['created_at']) ?></div>
</div>
<div class="status-pill <?= h($statusClass) ?> align-self-start"><?= h($statusLabel) ?></div>
</div>
<?php endif; ?>
</div>
</main>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<script src="assets/js/main.js?v=<?= h((string) time()) ?>"></script>
</body>
</html>