prepare( "SELECT id, passenger_id, status FROM transit_enrollments WHERE id=? AND org_id=? LIMIT 1" ); $st->execute([$enrollId, $transit_org_id]); $enroll = $st->fetch(); if (!$enroll) jsonError('Enrollment not found', 404); if ($enroll['status'] !== 'pending') jsonError('Enrollment is not pending', 409); $newStatus = ($action === 'approve') ? 'active' : 'suspended'; $transit_con->prepare( "UPDATE transit_enrollments SET status=?, verified_at=NOW(), verify_method='manual_admin', expires_at=? WHERE id=?" )->execute([$newStatus, $expiresAt, $enrollId]); if ($action === 'approve' && $enroll['passenger_id']) { transitSendTopicNotification( 'passenger_' . $enroll['passenger_id'], 'تم تفعيل عضويتك', 'يمكنك الآن متابعة باصات جامعتك عبر مواصلاتي', ['type' => 'transit_enrollment_approved'] ); } jsonSuccess(['enrollment_id' => $enrollId, 'status' => $newStatus]);