102 lines
5.0 KiB
PHP
102 lines
5.0 KiB
PHP
<?php
|
|
include __DIR__ . '/includes/header.php';
|
|
|
|
if (!$user) {
|
|
header('Location: /auth/login.php');
|
|
exit;
|
|
}
|
|
|
|
$tab = $_GET['tab'] ?? 'all';
|
|
$db = db();
|
|
|
|
if ($tab === 'all') {
|
|
$stmt = $db->prepare("SELECT * FROM transactions WHERE user_id = ? ORDER BY created_at DESC LIMIT 100");
|
|
$stmt->execute([$user['id']]);
|
|
$records = $stmt->fetchAll();
|
|
} else {
|
|
// If specific tabs for trading are needed, they can be implemented here
|
|
$stmt = $db->prepare("SELECT * FROM transactions WHERE user_id = ? AND type LIKE ? ORDER BY created_at DESC LIMIT 100");
|
|
$stmt->execute([$user['id'], $tab . '%']);
|
|
$records = $stmt->fetchAll();
|
|
}
|
|
|
|
$types_map = [
|
|
'recharge' => ['name' => __('recharge'), 'color' => 'success'],
|
|
'withdrawal' => ['name' => __('withdrawal'), 'color' => 'danger'],
|
|
'binary_win' => ['name' => __('binary_win'), 'color' => 'success'],
|
|
'binary_loss' => ['name' => __('binary_loss'), 'color' => 'danger'],
|
|
'spot_trade' => ['name' => __('spot_trade'), 'color' => 'primary'],
|
|
'contract_margin' => ['name' => __('contract_margin'), 'color' => 'warning'],
|
|
'contract_settle' => ['name' => __('contract_settle'), 'color' => 'info'],
|
|
];
|
|
|
|
?>
|
|
|
|
<div class="container py-5">
|
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
|
<h2 class="fw-bold text-white mb-0"><?= __('orders') ?></h2>
|
|
<div class="btn-group">
|
|
<a href="?tab=all" class="btn btn-sm <?= $tab === 'all' ? 'btn-primary' : 'btn-outline-secondary' ?>"><?= __('all') ?? 'All' ?></a>
|
|
<a href="?tab=binary" class="btn btn-sm <?= $tab === 'binary' ? 'btn-primary' : 'btn-outline-secondary' ?>"><?= __('second_contract') ?></a>
|
|
<a href="?tab=spot" class="btn btn-sm <?= $tab === 'spot' ? 'btn-primary' : 'btn-outline-secondary' ?>"><?= __('spot') ?></a>
|
|
<a href="?tab=contract" class="btn btn-sm <?= $tab === 'contract' ? 'btn-primary' : 'btn-outline-secondary' ?>"><?= __('contract') ?></a>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card bg-surface border-secondary rounded-4 overflow-hidden shadow-lg">
|
|
<div class="table-responsive">
|
|
<table class="table table-dark table-hover mb-0 align-middle">
|
|
<thead class="bg-black bg-opacity-50 text-white-50 small">
|
|
<tr>
|
|
<th class="ps-4 py-3 border-secondary"><?= __('type') ?></th>
|
|
<th class="py-3 border-secondary"><?= __('amount') ?></th>
|
|
<th class="py-3 border-secondary"><?= __('symbol') ?? 'Symbol' ?></th>
|
|
<th class="py-3 border-secondary"><?= __('status') ?></th>
|
|
<th class="text-end pe-4 py-3 border-secondary"><?= __('time') ?></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="border-0">
|
|
<?php if (empty($records)): ?>
|
|
<tr>
|
|
<td colspan="5" class="text-center py-5 text-muted">
|
|
<i class="bi bi-inbox fs-1 d-block mb-2"></i>
|
|
<?= __('no_records_found') ?>
|
|
</td>
|
|
</tr>
|
|
<?php else: ?>
|
|
<?php foreach ($records as $r):
|
|
$type = $types_map[$r['type']] ?? ['name' => __($r['type']), 'color' => 'secondary'];
|
|
?>
|
|
<tr class="border-secondary">
|
|
<td class="ps-4 py-3">
|
|
<span class="badge bg-<?= $type['color'] ?> bg-opacity-10 text-<?= $type['color'] ?> border border-<?= $type['color'] ?> border-opacity-25 px-2 py-1">
|
|
<?= $type['name'] ?>
|
|
</span>
|
|
</td>
|
|
<td class="py-3 fw-bold text-white">
|
|
<?= number_format($r['amount'], 4) ?>
|
|
</td>
|
|
<td class="py-3 text-white-50">
|
|
<?= $r['symbol'] ?>
|
|
</td>
|
|
<td class="py-3">
|
|
<?php if ($r['status'] === 'completed'): ?>
|
|
<span class="text-success small"><i class="bi bi-check-circle-fill me-1"></i><?= __('completed') ?></span>
|
|
<?php else: ?>
|
|
<span class="text-warning small"><i class="bi bi-clock-fill me-1"></i><?= __('pending') ?></span>
|
|
<?php endif; ?>
|
|
</td>
|
|
<td class="text-end pe-4 py-3 text-white-50 small">
|
|
<?= date('Y-m-d H:i:s', strtotime($r['created_at'])) ?>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php include __DIR__ . '/includes/footer.php'; ?>
|