diff --git a/drivers.php b/drivers.php new file mode 100644 index 0000000..7126ad6 --- /dev/null +++ b/drivers.php @@ -0,0 +1,152 @@ +exec("CREATE TABLE IF NOT EXISTS drivers ( + id INT AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(100) NOT NULL, + license_number VARCHAR(50) NOT NULL, + phone VARCHAR(20) NOT NULL, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP + );"); +} catch (PDOException $e) { + // die("DB error: " . $e->getMessage()); // Avoid dying on production + $message = 'Error de conexión con la base de datos.'; + $message_type = 'danger'; +} + +// Handle POST request to add a new driver +if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_driver'])) { + $name = trim($_POST['name']); + $license_number = trim($_POST['license_number']); + $phone = trim($_POST['phone']); + + if (!empty($name) && !empty($license_number) && !empty($phone)) { + try { + $sql = "INSERT INTO drivers (name, license_number, phone) VALUES (:name, :license_number, :phone)"; + $stmt = $pdo->prepare($sql); + $stmt->execute([ + ':name' => $name, + ':license_number' => $license_number, + ':phone' => $phone + ]); + $message = 'Conductor añadido exitosamente.'; + $message_type = 'success'; + } catch (PDOException $e) { + $message = 'Error al añadir conductor: ' . $e->getMessage(); + $message_type = 'danger'; + } + } else { + $message = 'Por favor, complete todos los campos.'; + $message_type = 'warning'; + } +} + +// Fetch all drivers +$drivers = []; +if(isset($pdo)) { + try { + $stmt = $pdo->query("SELECT id, name, license_number, phone, created_at FROM drivers ORDER BY id DESC"); + $drivers = $stmt->fetchAll(PDO::FETCH_ASSOC); + } catch (PDOException $e) { + $message = 'Error al obtener los conductores: ' . $e->getMessage(); + $message_type = 'danger'; + } +} + +?> + +
+

Gestión de Conductores

+ +
+ + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
IDNombreNº LicenciaTeléfonoFecha de Registro
No hay conductores registrados.
+
+
+
+ + + + + diff --git a/footer.php b/footer.php new file mode 100644 index 0000000..fe2412c --- /dev/null +++ b/footer.php @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/header.php b/header.php new file mode 100644 index 0000000..a2e2354 --- /dev/null +++ b/header.php @@ -0,0 +1,60 @@ + + + + + + <?php echo htmlspecialchars(getenv('PROJECT_NAME') ?: 'Taxi HRM'); ?> + + + + + + + + + + + + + + + + + +
diff --git a/index.php b/index.php index 7205f3d..d205711 100644 --- a/index.php +++ b/index.php @@ -1,150 +1,39 @@ -$phpVersion = PHP_VERSION; -$now = date('Y-m-d H:i:s'); -?> - - - - - - New Style - - - - - - - - - - - - - - - - - - - - - -
-
-

Analyzing your requirements and generating your website…

-
- Loading… -
-

AI is collecting your requirements and applying the first changes.

-

This page will update automatically as the plan is implemented.

-

Runtime: PHP — UTC

+
+

Bienvenido a

+
+

+
+ Gestionar Conductores + +
-
- - - + + +
+
+
+
+
Conductores
+

Administre el personal de conducción, incluyendo sus perfiles, licencias y documentación.

+ Ir a Conductores +
+
+
+
+
+
+
Mapa en Tiempo Real
+

Visualice la ubicación de toda su flota en tiempo real para una gestión eficiente. (Próximamente)

+ Ir al Mapa +
+
+
+
+ + \ No newline at end of file