Update: 2026-07-12 18:53:59

This commit is contained in:
Hamza-Ayed
2026-07-12 18:53:59 +03:00
parent 8cd4a4b57e
commit 653d73422f
54 changed files with 2078 additions and 436 deletions
+6 -5
View File
@@ -3,15 +3,16 @@
require_once __DIR__ . '/../../transit/connect_app.php';
$driverTransitId = filterRequest('driver_transit_id', 'int');
if (!$driverTransitId) jsonError('driver_transit_id is required', 400);
if ($transit_user_role !== 'driver') jsonError('Only drivers can access this endpoint', 403);
// استخرج سجل السائق من JWT — لا نثق بـ driver_transit_id من العميل
$chk = $transit_con->prepare(
"SELECT id, org_id FROM transit_drivers WHERE id=? AND status='active' LIMIT 1"
"SELECT id, org_id FROM transit_drivers WHERE main_driver_id=? AND status='active' LIMIT 1"
);
$chk->execute([$driverTransitId]);
$chk->execute([(string)$transit_user_id]);
$driver = $chk->fetch();
if (!$driver) jsonError('Driver not found or not active', 403);
if (!$driver) jsonError('Driver not found or not active — activate your account first', 403);
$driverTransitId = (int)$driver['id'];
$today = date('Y-m-d');