104 lines
4.2 KiB
PHP
104 lines
4.2 KiB
PHP
<?php
|
|
session_start();
|
|
|
|
// Check for notifications
|
|
$notification = null;
|
|
if (isset($_SESSION['notification'])) {
|
|
$notification = $_SESSION['notification'];
|
|
unset($_SESSION['notification']);
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Tasks - EarnMobile</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<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=Inter:wght@400;500;600;700&family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
|
<script src="https://unpkg.com/lucide@latest"></script>
|
|
</head>
|
|
<body>
|
|
|
|
<header class="app-header">
|
|
<div class="container">
|
|
<div class="d-flex justify-content-between align-items-center">
|
|
<div>
|
|
<h1 class="h4 mb-0">Tasks</h1>
|
|
<p class="text-muted mb-0">Complete tasks to earn rewards</p>
|
|
</div>
|
|
<div class="user-initials">
|
|
<span>U</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<main class="container mt-4 pb-5 mb-5">
|
|
<?php if ($notification): ?>
|
|
<div class="alert alert-<?php echo $notification['type']; ?> alert-dismissible fade show" role="alert">
|
|
<?php echo htmlspecialchars($notification['message']); ?>
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="task-list">
|
|
<?php
|
|
require_once 'db/config.php';
|
|
$pdo = db();
|
|
$stmt = $pdo->query('SELECT * FROM tasks ORDER BY created_at DESC');
|
|
$tasks = $stmt->fetchAll();
|
|
|
|
$icons = ['video', 'smartphone', 'file-text', 'mail', 'user-plus'];
|
|
|
|
foreach ($tasks as $key => $task) {
|
|
$status_class = 'bg-primary';
|
|
if ($task['status'] == 'in_progress') {
|
|
$status_class = 'bg-warning text-dark';
|
|
} elseif ($task['status'] == 'completed' || $task['status'] == 'approved') {
|
|
$status_class = 'bg-success';
|
|
} elseif ($task['status'] == 'rejected') {
|
|
$status_class = 'bg-danger';
|
|
} elseif ($task['status'] == 'in review') {
|
|
$status_class = 'bg-info';
|
|
}
|
|
|
|
$icon = $icons[$key % count($icons)];
|
|
?>
|
|
<a href="task-view.php?id=<?php echo $task['id']; ?>" class="card task-card mb-3 text-decoration-none text-dark">
|
|
<div class="card-body">
|
|
<div class="d-flex align-items-center">
|
|
<div class="task-icon me-3">
|
|
<i data-lucide="<?php echo htmlspecialchars($icon); ?>"></i>
|
|
</div>
|
|
<div class="flex-grow-1">
|
|
<h5 class="card-title mb-1"><?php echo htmlspecialchars($task['title']); ?></h5>
|
|
<p class="card-text text-success mb-1 fw-bold">+ <?php echo htmlspecialchars($task['reward']); ?> BDT</p>
|
|
<span class="badge <?php echo $status_class; ?>"><?php echo htmlspecialchars(ucfirst(str_replace('_', ' ', $task['status']))); ?></span>
|
|
</div>
|
|
<div>
|
|
<i data-lucide="chevron-right"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</a>
|
|
<?php } ?>
|
|
</div>
|
|
</main>
|
|
|
|
<?php
|
|
$page = 'tasks';
|
|
include 'includes/nav.php';
|
|
?>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
|
<script>
|
|
lucide.createIcons();
|
|
</script>
|
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
|
</body>
|
|
</html>
|