Update: 2026-08-07 05:56:50

This commit is contained in:
Hamza-Ayed
2026-08-07 05:56:50 +03:00
parent 7a932580a3
commit 67465df000
14 changed files with 1257 additions and 9 deletions
+31
View File
@@ -0,0 +1,31 @@
<?php
// ride/scheduled/list.php — حجوزات الراكب
//
// ‏القادمة أولاً ثم الأحدث تاريخاً: الراكب يفتح الشاشة ليرى ما ينتظره،
// ‏لا ليتصفّح أرشيفه.
require_once __DIR__ . '/../../connect.php';
$passengerId = $user_id ?? '';
if (empty($passengerId)) {
jsonError('Unauthorized', 401);
}
$scope = filterRequest('scope') === 'all' ? 'all' : 'upcoming';
try {
$sql = "SELECT * FROM scheduled_rides WHERE passenger_id = ?";
if ($scope === 'upcoming') {
$sql .= " AND status = 'scheduled' AND scheduled_at >= NOW()";
}
$sql .= " ORDER BY scheduled_at ASC LIMIT 50";
$stmt = $con->prepare($sql);
$stmt->execute([$passengerId]);
jsonSuccess(['bookings' => $stmt->fetchAll(PDO::FETCH_ASSOC)], 'ok');
} catch (PDOException $e) {
error_log('[scheduled/list] ' . $e->getMessage());
jsonError('DB Error', 500);
}