Auto commit: 2025-11-24T22:11:31.012Z
This commit is contained in:
parent
68d65e1650
commit
164954c0a2
152
drivers.php
Normal file
152
drivers.php
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
<?php
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
require_once 'db/config.php';
|
||||||
|
require_once 'header.php';
|
||||||
|
|
||||||
|
$message = '';
|
||||||
|
$message_type = '';
|
||||||
|
|
||||||
|
// DDL to create table
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$pdo->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';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||||
|
<h1 class="h2">Gestión de Conductores</h1>
|
||||||
|
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#addDriverModal">
|
||||||
|
<i class="bi bi-plus-circle"></i> Añadir Conductor
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if ($message): ?>
|
||||||
|
<div class="alert alert-<?php echo $message_type; ?> alert-dismissible fade show" role="alert">
|
||||||
|
<?php echo htmlspecialchars($message); ?>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-hover">
|
||||||
|
<thead class="table-light">
|
||||||
|
<tr>
|
||||||
|
<th scope="col">ID</th>
|
||||||
|
<th scope="col">Nombre</th>
|
||||||
|
<th scope="col">Nº Licencia</th>
|
||||||
|
<th scope="col">Teléfono</th>
|
||||||
|
<th scope="col">Fecha de Registro</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php if (empty($drivers)): ?>
|
||||||
|
<tr>
|
||||||
|
<td colspan="5" class="text-center">No hay conductores registrados.</td>
|
||||||
|
</tr>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php foreach ($drivers as $driver): ?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo htmlspecialchars($driver['id']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($driver['name']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($driver['license_number']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($driver['phone']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars(date("d/m/Y H:i", strtotime($driver['created_at']))); ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Modal -->
|
||||||
|
<div class="modal fade" id="addDriverModal" tabindex="-1" aria-labelledby="addDriverModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<form action="drivers.php" method="POST">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title" id="addDriverModalLabel">Añadir Nuevo Conductor</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<input type="hidden" name="add_driver" value="1">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="name" class="form-label">Nombre Completo</label>
|
||||||
|
<input type="text" class="form-control" id="name" name="name" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="license_number" class="form-label">Número de Licencia</label>
|
||||||
|
<input type="text" class="form-control" id="license_number" name="license_number" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="phone" class="form-label">Teléfono</label>
|
||||||
|
<input type="tel" class="form-control" id="phone" name="phone" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cerrar</button>
|
||||||
|
<button type="submit" class="btn btn-primary">Guardar Conductor</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once 'footer.php';
|
||||||
|
?>
|
||||||
12
footer.php
Normal file
12
footer.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
</main>
|
||||||
|
|
||||||
|
<footer class="bg-white text-center text-lg-start mt-5 py-3">
|
||||||
|
<div class="text-center text-muted">
|
||||||
|
© <?php echo date("Y"); ?> <?php echo htmlspecialchars(getenv('PROJECT_NAME') ?: 'Taxi HRM'); ?>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<!-- Bootstrap JS -->
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
60
header.php
Normal file
60
header.php
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="es">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title><?php echo htmlspecialchars(getenv('PROJECT_NAME') ?: 'Taxi HRM'); ?></title>
|
||||||
|
<meta name="description" content="<?php echo htmlspecialchars(getenv('PROJECT_DESCRIPTION') ?: 'HRM for Taxi Business'); ?>">
|
||||||
|
|
||||||
|
<!-- Bootstrap CSS -->
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||||
|
|
||||||
|
<!-- Custom Fonts -->
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: 'Inter', sans-serif;
|
||||||
|
background-color: #f8f9fa;
|
||||||
|
}
|
||||||
|
.navbar {
|
||||||
|
box-shadow: 0 2px 4px rgba(0,0,0,.1);
|
||||||
|
}
|
||||||
|
.card {
|
||||||
|
border: none;
|
||||||
|
box-shadow: 0 4px 8px rgba(0,0,0,.05);
|
||||||
|
}
|
||||||
|
.btn-primary {
|
||||||
|
background-color: #0D6EFD;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-light bg-white sticky-top">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<a class="navbar-brand" href="index.php">
|
||||||
|
<i class="bi bi-taxi-front-fill"></i>
|
||||||
|
<?php echo htmlspecialchars(getenv('PROJECT_NAME') ?: 'Taxi HRM'); ?>
|
||||||
|
</a>
|
||||||
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navbarNav">
|
||||||
|
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="index.php"><i class="bi bi-speedometer2"></i> Dashboard</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="drivers.php"><i class="bi bi-person-badge"></i> Conductores</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<main class="container mt-4">
|
||||||
183
index.php
183
index.php
@ -1,150 +1,39 @@
|
|||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
require_once 'header.php';
|
||||||
@ini_set('display_errors', '1');
|
?>
|
||||||
@error_reporting(E_ALL);
|
|
||||||
@date_default_timezone_set('UTC');
|
|
||||||
|
|
||||||
$phpVersion = PHP_VERSION;
|
<div class="px-4 py-5 my-5 text-center">
|
||||||
$now = date('Y-m-d H:i:s');
|
<h1 class="display-5 fw-bold">Bienvenido a <?php echo htmlspecialchars(getenv('PROJECT_NAME') ?: 'Taxi HRM'); ?></h1>
|
||||||
?>
|
<div class="col-lg-6 mx-auto">
|
||||||
<!doctype html>
|
<p class="lead mb-4"><?php echo htmlspecialchars(getenv('PROJECT_DESCRIPTION') ?: 'Una solución completa para la gestión de su negocio de taxis.'); ?></p>
|
||||||
<html lang="en">
|
<div class="d-grid gap-2 d-sm-flex justify-content-sm-center">
|
||||||
<head>
|
<a href="drivers.php" class="btn btn-primary btn-lg px-4 gap-3">Gestionar Conductores</a>
|
||||||
<meta charset="utf-8" />
|
<button type="button" class="btn btn-outline-secondary btn-lg px-4">Ver Reportes</button>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
</div>
|
||||||
<title>New Style</title>
|
|
||||||
<?php
|
|
||||||
// Read project preview data from environment
|
|
||||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
|
||||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
|
||||||
?>
|
|
||||||
<?php if ($projectDescription): ?>
|
|
||||||
<!-- Meta description -->
|
|
||||||
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
|
|
||||||
<!-- Open Graph meta tags -->
|
|
||||||
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
||||||
<!-- Twitter meta tags -->
|
|
||||||
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if ($projectImageUrl): ?>
|
|
||||||
<!-- Open Graph image -->
|
|
||||||
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
||||||
<!-- Twitter image -->
|
|
||||||
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
||||||
<?php endif; ?>
|
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
|
||||||
<style>
|
|
||||||
:root {
|
|
||||||
--bg-color-start: #6a11cb;
|
|
||||||
--bg-color-end: #2575fc;
|
|
||||||
--text-color: #ffffff;
|
|
||||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
|
||||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
|
||||||
}
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
font-family: 'Inter', sans-serif;
|
|
||||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
|
||||||
color: var(--text-color);
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 100vh;
|
|
||||||
text-align: center;
|
|
||||||
overflow: hidden;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
body::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
|
|
||||||
animation: bg-pan 20s linear infinite;
|
|
||||||
z-index: -1;
|
|
||||||
}
|
|
||||||
@keyframes bg-pan {
|
|
||||||
0% { background-position: 0% 0%; }
|
|
||||||
100% { background-position: 100% 100%; }
|
|
||||||
}
|
|
||||||
main {
|
|
||||||
padding: 2rem;
|
|
||||||
}
|
|
||||||
.card {
|
|
||||||
background: var(--card-bg-color);
|
|
||||||
border: 1px solid var(--card-border-color);
|
|
||||||
border-radius: 16px;
|
|
||||||
padding: 2rem;
|
|
||||||
backdrop-filter: blur(20px);
|
|
||||||
-webkit-backdrop-filter: blur(20px);
|
|
||||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
.loader {
|
|
||||||
margin: 1.25rem auto 1.25rem;
|
|
||||||
width: 48px;
|
|
||||||
height: 48px;
|
|
||||||
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
||||||
border-top-color: #fff;
|
|
||||||
border-radius: 50%;
|
|
||||||
animation: spin 1s linear infinite;
|
|
||||||
}
|
|
||||||
@keyframes spin {
|
|
||||||
from { transform: rotate(0deg); }
|
|
||||||
to { transform: rotate(360deg); }
|
|
||||||
}
|
|
||||||
.hint {
|
|
||||||
opacity: 0.9;
|
|
||||||
}
|
|
||||||
.sr-only {
|
|
||||||
position: absolute;
|
|
||||||
width: 1px; height: 1px;
|
|
||||||
padding: 0; margin: -1px;
|
|
||||||
overflow: hidden;
|
|
||||||
clip: rect(0, 0, 0, 0);
|
|
||||||
white-space: nowrap; border: 0;
|
|
||||||
}
|
|
||||||
h1 {
|
|
||||||
font-size: 3rem;
|
|
||||||
font-weight: 700;
|
|
||||||
margin: 0 0 1rem;
|
|
||||||
letter-spacing: -1px;
|
|
||||||
}
|
|
||||||
p {
|
|
||||||
margin: 0.5rem 0;
|
|
||||||
font-size: 1.1rem;
|
|
||||||
}
|
|
||||||
code {
|
|
||||||
background: rgba(0,0,0,0.2);
|
|
||||||
padding: 2px 6px;
|
|
||||||
border-radius: 4px;
|
|
||||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
||||||
}
|
|
||||||
footer {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 1rem;
|
|
||||||
font-size: 0.8rem;
|
|
||||||
opacity: 0.7;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<main>
|
|
||||||
<div class="card">
|
|
||||||
<h1>Analyzing your requirements and generating your website…</h1>
|
|
||||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
|
||||||
<span class="sr-only">Loading…</span>
|
|
||||||
</div>
|
|
||||||
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
|
|
||||||
<p class="hint">This page will update automatically as the plan is implemented.</p>
|
|
||||||
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</div>
|
||||||
<footer>
|
|
||||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
<div class="row">
|
||||||
</footer>
|
<div class="col-md-6">
|
||||||
</body>
|
<div class="card">
|
||||||
</html>
|
<div class="card-body">
|
||||||
|
<h5 class="card-title"><i class="bi bi-person-badge"></i> Conductores</h5>
|
||||||
|
<p class="card-text">Administre el personal de conducción, incluyendo sus perfiles, licencias y documentación.</p>
|
||||||
|
<a href="drivers.php" class="btn btn-primary">Ir a Conductores</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title"><i class="bi bi-geo-alt-fill"></i> Mapa en Tiempo Real</h5>
|
||||||
|
<p class="card-text">Visualice la ubicación de toda su flota en tiempo real para una gestión eficiente. (Próximamente)</p>
|
||||||
|
<a href="#" class="btn btn-secondary disabled">Ir al Mapa</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once 'footer.php';
|
||||||
|
?>
|
||||||
Loading…
x
Reference in New Issue
Block a user