diff --git a/api.php b/api.php new file mode 100644 index 0000000..1f627bb --- /dev/null +++ b/api.php @@ -0,0 +1,17 @@ +query("SELECT t.matricula, t.modelo, lt.latitud, lt.longitud, lt.ultima_actualizacion + FROM localizacion_taxis lt + JOIN taxis t ON lt.id_taxi = t.id + ORDER BY lt.ultima_actualizacion DESC"); + $localizaciones = $stmt->fetchAll(PDO::FETCH_ASSOC); + echo json_encode($localizaciones); +} catch (PDOException $e) { + http_response_code(500); + echo json_encode(['error' => 'Error de base de datos: ' . $e->getMessage()]); +} +?> \ No newline at end of file diff --git a/localizacion.php b/localizacion.php index 435909c..2c0df26 100644 --- a/localizacion.php +++ b/localizacion.php @@ -64,25 +64,30 @@ try { $taxis_stmt = $pdo->query("SELECT id, matricula, modelo FROM taxis ORDER BY matricula"); $taxis = $taxis_stmt->fetchAll(PDO::FETCH_ASSOC); - // Fetch all locations - $stmt = $pdo->query("SELECT lt.id, t.matricula, t.modelo, lt.latitud, lt.longitud, lt.ultima_actualizacion - FROM localizacion_taxis lt - JOIN taxis t ON lt.id_taxi = t.id - ORDER BY lt.ultima_actualizacion DESC"); - $localizaciones = $stmt->fetchAll(PDO::FETCH_ASSOC); - } catch (PDOException $e) { die("Error de base de datos: " . $e->getMessage()); } ?> + +
-

Localización de Taxis

+

Localización de Taxis en Tiempo Real

+
+
+ + Mapa de Taxis +
+
+
+
+
+
@@ -150,48 +155,62 @@ try {
- -
-
- - Últimas Localizaciones Registradas -
-
- - - - - - - - - - - - - - - - - - - - - - - - - -
IDTaxiLatitudLongitudÚltima Actualización
No hay localizaciones registradas.
-
-
+ + + +?> \ No newline at end of file