Update: 2026-07-13 22:23:21

This commit is contained in:
Hamza-Ayed
2026-07-13 22:23:22 +03:00
parent fd3f4a365a
commit c6f48a1f91
45 changed files with 3533 additions and 36 deletions
+18
View File
@@ -0,0 +1,18 @@
<?php
// transit/vehicle/toggle.php — تفعيل/تعطيل مركبة
// POST: vehicle_id, is_active (1|0)
require_once __DIR__ . '/../../transit/connect_admin.php';
$vehicleId = filterRequest('vehicle_id', 'int');
$isActive = filterRequest('is_active', 'int');
if (!$vehicleId || $isActive === null) jsonError('vehicle_id and is_active are required', 400);
$chk = $transit_con->prepare("SELECT id FROM transit_vehicles WHERE id=? AND org_id=? LIMIT 1");
$chk->execute([$vehicleId, $transit_org_id]);
if (!$chk->fetch()) jsonError('Vehicle not found or access denied', 404);
$transit_con->prepare("UPDATE transit_vehicles SET is_active=? WHERE id=?")
->execute([$isActive ? 1 : 0, $vehicleId]);
jsonSuccess(['vehicle_id' => $vehicleId, 'is_active' => (bool)$isActive]);