diff --git a/assets/css/custom.css b/assets/css/custom.css index b8c1d2f..a367dce 100644 --- a/assets/css/custom.css +++ b/assets/css/custom.css @@ -1,34 +1,42 @@ - body { - font-family: 'Inter', sans-serif; - background-color: #F8F9FA; - color: #212529; + font-family: 'Roboto', 'Inter', sans-serif; + background-color: #f4f7f6; } -.gradient-text { - background: linear-gradient(45deg, #0D6EFD, #549BFF); - -webkit-background-clip: text; - -webkit-text-fill-color: transparent; - background-clip: text; - text-fill-color: transparent; +.app-header { + background: #fff; + padding: 1rem 0; + border-bottom: 1px solid #e9ecef; +} + +.user-initials { + width: 40px; + height: 40px; + border-radius: 50%; + background: linear-gradient(45deg, #0EA5E9, #06B6D4); + color: #fff; + display: flex; + align-items: center; + justify-content: center; + font-weight: 600; } .kpi-card { - background-color: #FFFFFF; border: none; - border-radius: 0.75rem; - box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05); - transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out; + border-radius: 1rem; /* rounded-2xl */ + box-shadow: 0 4px 12px rgba(0,0,0,0.05); + background-color: #fff; + transition: all 0.3s ease; } .kpi-card:hover { - transform: translateY(-5px); - box-shadow: 0 8px 12px rgba(0, 0, 0, 0.08); + transform: translateY(-4px); + box-shadow: 0 8px 20px rgba(0,0,0,0.08); } .kpi-icon { - width: 48px; - height: 48px; + width: 36px; + height: 36px; stroke-width: 1.5; } @@ -37,32 +45,59 @@ body { bottom: 0; left: 0; right: 0; - background-color: #FFFFFF; - box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08); - border-top-left-radius: 1.25rem; - border-top-right-radius: 1.25rem; - padding-top: 0.5rem; - padding-bottom: 0.5rem; - padding-left: 1rem; - padding-right: 1rem; + background: rgba(255, 255, 255, 0.8); + backdrop-filter: blur(10px); + -webkit-backdrop-filter: blur(10px); + display: flex; + justify-content: space-around; + padding: 0.75rem 0.5rem; + border-top: 1px solid rgba(0,0,0,0.05); + box-shadow: 0 -2px 10px rgba(0,0,0,0.05); } -.nav-link { - color: #6C757D; - transition: color 0.2s; +.nav-item { + display: flex; + flex-direction: column; + align-items: center; + color: #6c757d; + text-decoration: none; + transition: all 0.2s ease; } -.nav-link.active { - color: #0D6EFD; +.nav-item.active { + color: #0EA5E9; + font-weight: 600; } -.nav-link .icon { - width: 28px; - height: 28px; - stroke-width: 2; - margin-bottom: 0.125rem; +.nav-item i { + width: 24px; + height: 24px; + margin-bottom: 4px; } -.nav-link .label { +.nav-item span { font-size: 0.75rem; } + +.task-card { + border: none; + border-radius: 1rem; + box-shadow: 0 4px 12px rgba(0,0,0,0.05); + background-color: #fff; +} + +.task-icon { + width: 48px; + height: 48px; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + background-color: #eef8ff; + color: #0EA5E9; +} + +.task-icon i { + width: 24px; + height: 24px; +} \ No newline at end of file diff --git a/db/migrations/001_create_tasks_table.sql b/db/migrations/001_create_tasks_table.sql new file mode 100644 index 0000000..3659cec --- /dev/null +++ b/db/migrations/001_create_tasks_table.sql @@ -0,0 +1,9 @@ +CREATE TABLE IF NOT EXISTS tasks ( + id INT AUTO_INCREMENT PRIMARY KEY, + title VARCHAR(255) NOT NULL, + description TEXT, + reward DECIMAL(10, 2) NOT NULL, + status ENUM('open', 'in_progress', 'completed', 'approved', 'rejected') NOT NULL DEFAULT 'open', + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +); \ No newline at end of file diff --git a/db/migrations/002_seed_tasks_table.sql b/db/migrations/002_seed_tasks_table.sql new file mode 100644 index 0000000..f147068 --- /dev/null +++ b/db/migrations/002_seed_tasks_table.sql @@ -0,0 +1,6 @@ +INSERT INTO tasks (title, description, reward, status) VALUES +('Complete your profile', 'Fill out all the details in your user profile to get a reward.', 5.00, 'open'), +('Watch a video ad', 'Watch a 30-second video ad to earn a reward.', 0.50, 'open'), +('Refer a friend', 'Invite a friend to join the platform and get a bonus when they complete their first task.', 10.00, 'open'), +('Daily check-in', 'Visit the app every day to claim your daily reward.', 0.25, 'open'), +('Write a review', 'Write a review for our app on the app store.', 2.00, 'open'); \ No newline at end of file diff --git a/db/migrations/003_add_submission_fields_to_tasks.sql b/db/migrations/003_add_submission_fields_to_tasks.sql new file mode 100644 index 0000000..86a607a --- /dev/null +++ b/db/migrations/003_add_submission_fields_to_tasks.sql @@ -0,0 +1,3 @@ +ALTER TABLE tasks +ADD COLUMN completion_notes TEXT, +ADD COLUMN proof_file_path VARCHAR(255); diff --git a/includes/nav.php b/includes/nav.php new file mode 100644 index 0000000..99525de --- /dev/null +++ b/includes/nav.php @@ -0,0 +1,31 @@ + 'home', 'file' => 'index.php', 'icon' => 'home', 'label' => 'Home'], + ['id' => 'ads', 'file' => '#', 'icon' => 'gem', 'label' => 'Ads'], + ['id' => 'tasks', 'file' => 'tasks.php', 'icon' => 'check-square', 'label' => 'Tasks'], + ['id' => 'withdrawal', 'file' => '#', 'icon' => 'landmark', 'label' => 'Withdrawal'], + ['id' => 'profile', 'file' => '#', 'icon' => 'user', 'label' => 'Profile'], +]; +?> + diff --git a/index.php b/index.php index 3f8fa1e..071d50f 100644 --- a/index.php +++ b/index.php @@ -137,28 +137,10 @@ - + diff --git a/task-view.php b/task-view.php new file mode 100644 index 0000000..9e09d23 --- /dev/null +++ b/task-view.php @@ -0,0 +1,157 @@ + 'danger', 'message' => 'Error: Could not upload the file.']; + } + } + + // If file upload was successful (or no file was uploaded), update the database + if ($notification === null) { + try { + $pdo = db(); + $stmt = $pdo->prepare( + "UPDATE tasks SET status = 'in review', completion_notes = ?, proof_file_path = ? WHERE id = ?" + ); + $stmt->execute([$completion_notes, $proof_file_path, $submitted_task_id]); + + $_SESSION['notification'] = ['type' => 'success', 'message' => 'Task submitted successfully for review!']; + header("Location: tasks.php"); + exit; + } catch (PDOException $e) { + // For development: error_log($e->getMessage()); + $notification = ['type' => 'danger', 'message' => 'Error: Could not update the task.']; + } + } +} + +// Fetch task details for display +$task = null; +if ($task_id > 0) { + try { + $pdo = db(); + $stmt = $pdo->prepare("SELECT * FROM tasks WHERE id = ?"); + $stmt->execute([$task_id]); + $task = $stmt->fetch(PDO::FETCH_ASSOC); + } catch (PDOException $e) { + die("Error: Could not connect to the database or fetch task."); + } +} + +// If task not found, redirect +if (!$task) { + header("Location: tasks.php"); + exit; +} + +// Check for notifications from previous page (e.g., after redirect) +if (isset($_SESSION['notification'])) { + $notification = $_SESSION['notification']; + unset($_SESSION['notification']); +} + +$pageTitle = htmlspecialchars($task['title']); +$page = 'tasks'; +?> + + + + + + <?php echo $pageTitle; ?> - Task App + + + + + + + +
+
+

+ + Back to Tasks + +
+ +
+ + + + +
+
+
+

+
+ + Reward: BDT + + + Status: + +
+
+
+ +
+
+
Submit for Review
+
+ + +
+ + +
+ +
+ + +
+ +
+ +
+
+
+
+
+
+ + + + + + + diff --git a/tasks.php b/tasks.php new file mode 100644 index 0000000..f39a997 --- /dev/null +++ b/tasks.php @@ -0,0 +1,103 @@ + + + + + + + Tasks - EarnMobile + + + + + + + + + +
+
+
+
+

Tasks

+

Complete tasks to earn rewards

+
+
+ U +
+
+
+
+ +
+ + + + +
+ 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)]; + ?> + +
+
+
+ +
+
+
+

+ BDT

+ +
+
+ +
+
+
+
+ +
+
+ + + + + + + +