version 1.0
This commit is contained in:
parent
96b8749284
commit
056a4b8214
10
bd/bd.sql
10
bd/bd.sql
|
@ -1,5 +1,5 @@
|
|||
create database DeliveryFast;
|
||||
CREATE USER 'proyectoSistemas'@'localhost' IDENTIFIED BY 'password';
|
||||
GRANT CREATE,ALTER,DROP,INSERT,UPDATE,DELETE,SELECT,CREATE VIEW,REFERENCES on DeliveryFast.* to 'proyectoSistemas'@'localhost';
|
||||
GRANT LOCK TABLES, PROCESS ON *.* TO 'proyectoSistemas'@'localhost';
|
||||
FLUSH PRIVILEGES;
|
||||
create database TicketFei;
|
||||
CREATE USER 'desarrolloTicketFei'@'localhost' IDENTIFIED BY 'password';
|
||||
GRANT CREATE,ALTER,DROP,INSERT,UPDATE,DELETE,SELECT,CREATE VIEW,REFERENCES on TicketFei.* to 'desarrolloTicketFei'@'localhost';
|
||||
GRANT LOCK TABLES, PROCESS ON *.* TO 'desarrolloTicketFei'@'localhost';
|
||||
FLUSH PRIVILEGES;
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
USE TicketFei;
|
||||
|
||||
CREATE TABLE usuarios (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
nombre VARCHAR(255) NOT NULL,
|
||||
apellidoPaterno VARCHAR(255) NOT NULL,
|
||||
apellidoMaterno VARCHAR(255) NOT NULL,
|
||||
usuario VARCHAR(255) NOT NULL,
|
||||
contraseña VARCHAR(255) NOT NULL
|
||||
);
|
||||
INSERT INTO usuarios (nombre, apellidoPaterno, apellidoMaterno, usuario, contraseña) VALUES
|
||||
('Aaron', 'Bonilla', 'Gonzalez', 's22', '123'),
|
||||
('Carlos', 'Palestina', 'Alducin', 's23', '123'),
|
||||
('Miguel', 'Diaz', 'Villa', 's24', '123');
|
||||
|
||||
SELECT * FROM usuarios;
|
||||
DROP TABLE usuarios;
|
||||
|
||||
-- concierto
|
||||
CREATE TABLE conciertos (
|
||||
id_concierto INT AUTO_INCREMENT PRIMARY KEY,
|
||||
nombre_concierto VARCHAR(255) NOT NULL,
|
||||
artista VARCHAR(255) NOT NULL,
|
||||
fecha DATE NOT NULL,
|
||||
calle VARCHAR(255) NOT NULL,
|
||||
colonia VARCHAR(255) NOT NULL,
|
||||
numero_direccion VARCHAR(255) NOT NULL,
|
||||
codigo_postal VARCHAR(10) NOT NULL,
|
||||
estado VARCHAR(255) NOT NULL,
|
||||
capacidad_total INT NOT NULL
|
||||
);
|
||||
INSERT INTO conciertos (nombre_concierto, artista, fecha, calle, colonia, numero_direccion, codigo_postal, estado, capacidad_total)
|
||||
VALUES ('Linux Fest', 'Junior H', '2025-06-15', 'Av. Xalapa', 'Obrero Campesina', 's/n', '91020', 'Veracruz', 5000);
|
||||
SELECT * FROM conciertos;
|
||||
DROP TABLE conciertos;
|
||||
-- Zona
|
||||
CREATE TABLE zonas (
|
||||
id_zona INT AUTO_INCREMENT PRIMARY KEY,
|
||||
id_concierto INT NOT NULL,
|
||||
nombre_zona ENUM('General', 'Plata', 'Oro', 'VIP') NOT NULL,
|
||||
capacidad INT NOT NULL,
|
||||
precio DECIMAL(10,2) NOT NULL,
|
||||
FOREIGN KEY (id_concierto) REFERENCES conciertos(id_concierto) ON DELETE CASCADE
|
||||
);
|
||||
INSERT INTO zonas (id_concierto, nombre_zona, capacidad, precio) VALUES
|
||||
(1, 'General', 20000, 800.00),
|
||||
(1, 'Plata', 15000, 1500.00),
|
||||
(1, 'Oro', 10000, 2500.00),
|
||||
(1, 'VIP', 5000, 5000.00);
|
||||
DROP TABLE zonas;
|
||||
-- Obtener todos los conciertos con sus zonas y precios
|
||||
SELECT c.id_concierto, c.nombre_concierto, c.artista, c.fecha,
|
||||
z.nombre_zona, z.capacidad, z.precio
|
||||
FROM conciertos c
|
||||
JOIN zonas z ON c.id_concierto = z.id_concierto;
|
||||
|
||||
-- Consultar un concierto específico con sus zonas
|
||||
SELECT c.nombre_concierto, c.artista, c.fecha,
|
||||
z.nombre_zona, z.capacidad, z.precio
|
||||
FROM conciertos c
|
||||
JOIN zonas z ON c.id_concierto = z.id_concierto
|
||||
WHERE c.id_concierto = 1;
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
include 'conexion.php';
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
session_start();
|
||||
|
||||
session_unset();
|
||||
session_destroy();
|
||||
|
||||
echo json_encode(['success' => true]);
|
||||
} else {
|
||||
http_response_code(405);
|
||||
echo json_encode(['success' => false, 'message' => 'Método no permitido']);
|
||||
}
|
||||
|
||||
if (isset($conexionBD)) {
|
||||
$conexionBD->close();
|
||||
}
|
||||
|
||||
?>
|
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
include 'conexion.php';
|
||||
|
||||
$consulta = "SELECT c.id_concierto, c.nombre_concierto, c.artista, c.fecha, c.calle, c.colonia, c.numero_direccion, c.codigo_postal, c.estado, c.capacidad_total,
|
||||
z.nombre_zona, z.capacidad AS capacidad_zona, z.precio
|
||||
FROM conciertos c
|
||||
LEFT JOIN zonas z ON c.id_concierto = z.id_concierto
|
||||
ORDER BY c.id_concierto,
|
||||
FIELD(z.nombre_zona, 'General', 'Plata', 'Oro', 'VIP')";
|
||||
|
||||
$resultado = $conexionBD->query($consulta);
|
||||
|
||||
if ($resultado->num_rows > 0) {
|
||||
$conciertos = [];
|
||||
|
||||
while ($fila = $resultado->fetch_assoc()) {
|
||||
$id_concierto = $fila['id_concierto'];
|
||||
if (!isset($conciertos[$id_concierto])) {
|
||||
$conciertos[$id_concierto] = [
|
||||
'nombre_concierto' => $fila['nombre_concierto'],
|
||||
'artista' => $fila['artista'],
|
||||
'fecha' => $fila['fecha'],
|
||||
'direccion' => $fila['calle'] . ', ' . $fila['colonia'] . ', ' . $fila['numero_direccion'] . ', CP: ' . $fila['codigo_postal'] . ', ' . $fila['estado'],
|
||||
'capacidad_total' => $fila['capacidad_total'],
|
||||
'zonas' => []
|
||||
];
|
||||
}
|
||||
|
||||
if (!empty($fila['nombre_zona'])) {
|
||||
$conciertos[$id_concierto]['zonas'][] = [
|
||||
'nombre_zona' => $fila['nombre_zona'],
|
||||
'capacidad' => $fila['capacidad_zona'],
|
||||
'precio' => $fila['precio']
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
echo "<div class='contenedor-conciertos'>";
|
||||
foreach ($conciertos as $id => $concierto) {
|
||||
echo "<div class='tarjeta-concierto'>";
|
||||
echo "<h2>" . htmlspecialchars($concierto['nombre_concierto']) . "</h2>";
|
||||
echo "<p><strong>Artista:</strong> " . htmlspecialchars($concierto['artista']) . "</p>";
|
||||
echo "<p><strong>Fecha:</strong> " . htmlspecialchars($concierto['fecha']) . "</p>";
|
||||
echo "<p><strong>Dirección:</strong> " . htmlspecialchars($concierto['direccion']) . "</p>";
|
||||
echo "<p><strong>Capacidad Total:</strong> " . htmlspecialchars($concierto['capacidad_total']) . "</p>";
|
||||
|
||||
echo "<h3>Zonas Disponibles</h3>";
|
||||
if (!empty($concierto['zonas'])) {
|
||||
echo "<ul>";
|
||||
foreach ($concierto['zonas'] as $zona) {
|
||||
echo "<li><strong>" . htmlspecialchars($zona['nombre_zona']) . "</strong>: ";
|
||||
echo "Capacidad: " . htmlspecialchars($zona['capacidad']) . " | ";
|
||||
echo "Precio: $" . htmlspecialchars(number_format($zona['precio'], 2)) . "</li>";
|
||||
}
|
||||
echo "</ul>";
|
||||
} else {
|
||||
echo "<p>No hay zonas registradas.</p>";
|
||||
}
|
||||
|
||||
echo "<button class='comprar-boleto' onclick=\"window.location.href='ventaBoletos.html?id=" . htmlspecialchars($id) . "'\">Comprar Boletos</button>";
|
||||
echo "</div>";
|
||||
|
||||
}
|
||||
echo "</div>";
|
||||
} else {
|
||||
echo "<div class='mensajeError'>No hay conciertos disponibles</div>";
|
||||
}
|
||||
|
||||
$conexionBD->close();
|
||||
?>
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
include 'conexion.php';
|
||||
|
||||
header('Content-Type: application/json');
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
|
||||
// Leer el JSON enviado
|
||||
$datos = json_decode(file_get_contents("php://input"), true);
|
||||
|
||||
if ($datos === null) {
|
||||
echo json_encode(['insercionCorrecta' => false, 'error' => 'Error al decodificar JSON']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Verificar que los datos requeridos estén presentes
|
||||
if (!isset($datos['nombre_concierto'], $datos['zonas'])) {
|
||||
echo json_encode(['insercionCorrecta' => false, 'error' => 'Faltan datos requeridos']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Extraer valores
|
||||
$nombre_concierto = $datos['nombre_concierto'];
|
||||
$artista = $datos['artista'];
|
||||
$fecha = $datos['fecha'];
|
||||
$calle = $datos['calle'];
|
||||
$colonia = $datos['colonia'];
|
||||
$numero_direccion = $datos['numero_direccion'];
|
||||
$codigo_postal = $datos['codigo_postal'];
|
||||
$estado = $datos['estado'];
|
||||
$capacidad_total = $datos['capacidad_total'];
|
||||
$zonas = $datos['zonas'];
|
||||
|
||||
$conexionBD->begin_transaction();
|
||||
|
||||
try {
|
||||
// Insertar el concierto
|
||||
$consulta = "INSERT INTO conciertos (nombre_concierto, artista, fecha, calle, colonia, numero_direccion, codigo_postal, estado, capacidad_total)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
$stmt = $conexionBD->prepare($consulta);
|
||||
$stmt->bind_param("ssssssssi", $nombre_concierto, $artista, $fecha, $calle, $colonia, $numero_direccion, $codigo_postal, $estado, $capacidad_total);
|
||||
$stmt->execute();
|
||||
|
||||
$id_concierto = $conexionBD->insert_id;
|
||||
$stmt->close();
|
||||
|
||||
// Insertar zonas
|
||||
$consulta_zonas = "INSERT INTO zonas (id_concierto, nombre_zona, capacidad, precio) VALUES (?, ?, ?, ?)";
|
||||
$stmt_zonas = $conexionBD->prepare($consulta_zonas);
|
||||
|
||||
foreach ($zonas as $zona) {
|
||||
$stmt_zonas->bind_param("isid", $id_concierto, $zona['nombre_zona'], $zona['capacidad'], $zona['precio']);
|
||||
$stmt_zonas->execute();
|
||||
}
|
||||
|
||||
$stmt_zonas->close();
|
||||
$conexionBD->commit();
|
||||
|
||||
echo json_encode(['insercionCorrecta' => true, 'id_concierto' => $id_concierto]);
|
||||
|
||||
} catch (Exception $e) {
|
||||
$conexionBD->rollback();
|
||||
echo json_encode(['insercionCorrecta' => false, 'error' => $e->getMessage()]);
|
||||
}
|
||||
|
||||
$conexionBD->close();
|
Binary file not shown.
|
@ -0,0 +1,188 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta http-equiv="refresh" content="5;url=http://fontsgeek.com/fonts/frutiger-bold-italic?ref=readme">
|
||||
<title>Frutiger Bold ItalicFontsgeek</title>
|
||||
<style>
|
||||
/* -------------------------------------
|
||||
GLOBAL
|
||||
------------------------------------- */
|
||||
* {
|
||||
margin:0;
|
||||
padding:0;
|
||||
font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
|
||||
font-size: 100%;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
-webkit-font-smoothing:antialiased;
|
||||
-webkit-text-size-adjust:none;
|
||||
width: 100%!important;
|
||||
height: 100%;
|
||||
background:#DDD;
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------
|
||||
ELEMENTS
|
||||
------------------------------------- */
|
||||
a {
|
||||
color: #348eda;
|
||||
}
|
||||
|
||||
.btn-primary, .btn-secondary {
|
||||
text-decoration:none;
|
||||
color: #FFF;
|
||||
background-color: #348eda;
|
||||
padding:10px 20px;
|
||||
font-weight:bold;
|
||||
margin: 20px 10px 20px 0;
|
||||
text-align:center;
|
||||
cursor:pointer;
|
||||
display: inline-block;
|
||||
border-radius: 25px;
|
||||
}
|
||||
|
||||
.btn-secondary{
|
||||
background: #aaa;
|
||||
}
|
||||
|
||||
.last {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.first{
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------
|
||||
BODY
|
||||
------------------------------------- */
|
||||
table.body-wrap {
|
||||
width: 100%;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
table.body-wrap .container{
|
||||
border: 1px solid #f0f0f0;
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------
|
||||
FOOTER
|
||||
------------------------------------- */
|
||||
table.footer-wrap {
|
||||
width: 100%;
|
||||
clear:both!important;
|
||||
}
|
||||
|
||||
.footer-wrap .container p {
|
||||
font-size:12px;
|
||||
color:#666;
|
||||
|
||||
}
|
||||
|
||||
table.footer-wrap a{
|
||||
color: #999;
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------
|
||||
TYPOGRAPHY
|
||||
------------------------------------- */
|
||||
h1,h2,h3{
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; line-height: 1.1; margin-bottom:15px; color:#000;
|
||||
margin: 40px 0 10px;
|
||||
line-height: 1.2;
|
||||
font-weight:200;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 36px;
|
||||
}
|
||||
h2 {
|
||||
font-size: 28px;
|
||||
}
|
||||
h3 {
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
p, ul {
|
||||
margin-bottom: 10px;
|
||||
font-weight: normal;
|
||||
font-size:14px;
|
||||
}
|
||||
|
||||
ul li {
|
||||
margin-left:5px;
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------
|
||||
RESPONSIVENESS
|
||||
Nuke it from orbit. It's the only way to be sure.
|
||||
------------------------------------------------------ */
|
||||
|
||||
/* Set a max-width, and make it display as block so it will automatically stretch to that width, but will also shrink down on a phone or something */
|
||||
.container {
|
||||
display:block!important;
|
||||
max-width:600px!important;
|
||||
margin:0 auto!important; /* makes it centered */
|
||||
clear:both!important;
|
||||
}
|
||||
|
||||
/* This should also be a block element, so that it will fill 100% of the .container */
|
||||
.content {
|
||||
padding:20px;
|
||||
max-width:600px;
|
||||
margin:0 auto;
|
||||
display:block;
|
||||
}
|
||||
|
||||
/* Let's make sure tables in the content area are 100% wide */
|
||||
.content table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body bgcolor="#f6f6f6">
|
||||
|
||||
<!-- body -->
|
||||
<table class="body-wrap">
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="container" bgcolor="#FFFFFF">
|
||||
|
||||
<!-- content -->
|
||||
<div class="content">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<h1>Frutiger Bold Italic</h1>
|
||||
<p>This font was downloaded from <a href="http://fontsgeek.com?ref=readme">fontsgeek.com</a> . You can visit <a href="http://fontsgeek.com?ref=readme">fontsgeek.com</a> for thousands of free fonts.</p>
|
||||
<p><a href="http://fontsgeek.com/fonts/frutiger-bold-italic?ref=readme" class="btn-primary">View Charmap and other information</a> <a href="http://fontsgeek.com?ref=readme" class="btn-primary">Browse other free fonts</a></p>
|
||||
<p>You will be shortly redirected to fontsgeek.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!-- /content -->
|
||||
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- /body -->
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -11,12 +11,34 @@ body {
|
|||
text-align: center;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Frutiger';
|
||||
src: url('fonts/Frutiger Bold Italic/Frutiger Bold Italic.ttf') format('truetype');
|
||||
font-weight: bold;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-family: 'Frutiger', sans-serif;
|
||||
color: #ffffff;
|
||||
font-size: 100px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-family: 'Frutiger', sans-serif;
|
||||
color: #ffffff;
|
||||
font-size: 24px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #ffffff;
|
||||
font-size: 24px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
|
||||
.card {
|
||||
background-color: #2d3238;
|
||||
padding: 30px;
|
|
@ -0,0 +1,65 @@
|
|||
body {
|
||||
background-color: #aab2b2;
|
||||
}
|
||||
|
||||
/* Estilos para la barra de búsqueda */
|
||||
.form-control {
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.btn-outline-light {
|
||||
border-color: white;
|
||||
}
|
||||
|
||||
.btn-outline-light:hover {
|
||||
background-color: white;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.card {
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #343a40;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background-color: #007bff;
|
||||
border-color: #0056b3;
|
||||
}
|
||||
|
||||
.btn-primary:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
|
||||
.btn-danger {
|
||||
background-color: #dc3545;
|
||||
border-color: #a71d2a;
|
||||
}
|
||||
|
||||
.btn-danger:hover {
|
||||
background-color: #a71d2a;
|
||||
}
|
||||
.contenedor-conciertos {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.tarjeta-concierto {
|
||||
background-color: #343a40;
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.1);
|
||||
width: 90%;
|
||||
max-width: 600px;
|
||||
margin: auto;
|
||||
}
|
||||
.tarjeta-concierto p, h2, h3, li {
|
||||
color:#ffff
|
||||
}
|
||||
#tituloListaConciertos{
|
||||
color:#343a40
|
||||
}
|
|
@ -4,11 +4,12 @@
|
|||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Login</title>
|
||||
<link rel="stylesheet" href="css/estilo.css">
|
||||
<link rel="stylesheet" href="css/login.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Inicio de sesión</h1>
|
||||
<h1>TicketFei</h1>
|
||||
<h2>Inicio de sesión</h2>
|
||||
<div class="card">
|
||||
<form id="formularioLogin">
|
||||
<div class="datos">
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
const listaConciertos = document.querySelector('.listaConciertos');
|
||||
const formulario = document.getElementById('formulario');
|
||||
const mensajeDiv = document.getElementById('mensaje');
|
||||
const cerrarsesion = document.getElementById('cerrarSesion');
|
||||
// Función para cargar conciertos
|
||||
async function cargarConciertos() {
|
||||
try {
|
||||
const respuesta = await fetch('controladores/conciertos.php');
|
||||
if (!respuesta.ok) {
|
||||
throw new Error('Error al cargar conciertos');
|
||||
}
|
||||
const datos = await respuesta.text();
|
||||
listaConciertos.innerHTML = datos;
|
||||
//obtenerInfo();
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error:', error);
|
||||
mensajeDiv.textContent = 'No se pudieron cargar los conciertos';
|
||||
mensajeDiv.style.color = 'red';
|
||||
}
|
||||
}
|
||||
|
||||
// Cargar conciertos al iniciar
|
||||
cargarConciertos();
|
||||
// Evento de búsqueda
|
||||
buscadorBoton.addEventListener('click', (event) => {
|
||||
event.preventDefault();
|
||||
const termino = buscadorInput.value.trim();
|
||||
if (termino) {
|
||||
buscarConciertos(termino);
|
||||
} else {
|
||||
cargarConciertos();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Insertar
|
||||
formulario.addEventListener('submit', async (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
const nombre = document.getElementById("nombre_concierto").value;
|
||||
const artista = document.getElementById("artista").value;
|
||||
const fecha = document.getElementById("fecha").value;
|
||||
const calle = document.getElementById("calle").value;
|
||||
const colonia = document.getElementById("colonia").value;
|
||||
const numero_direccion = document.getElementById("numero_direccion").value;
|
||||
const codigo_postal = document.getElementById("codigo_postal").value;
|
||||
const estado = document.getElementById("estado").value;
|
||||
const capacidad_total = parseInt(document.getElementById("capacidad_total").value, 10);
|
||||
|
||||
// Obtener y validar capacidades de zonas
|
||||
const zonas = [
|
||||
{ nombre_zona: "General", capacidad: parseInt(document.getElementById("capacidad_general").value, 10) || 0, precio: parseFloat(document.getElementById("precio_general").value) || 0 },
|
||||
{ nombre_zona: "Plata", capacidad: parseInt(document.getElementById("capacidad_plata").value, 10) || 0, precio: parseFloat(document.getElementById("precio_plata").value) || 0 },
|
||||
{ nombre_zona: "Oro", capacidad: parseInt(document.getElementById("capacidad_oro").value, 10) || 0, precio: parseFloat(document.getElementById("precio_oro").value) || 0 },
|
||||
{ nombre_zona: "VIP", capacidad: parseInt(document.getElementById("capacidad_vip").value, 10) || 0, precio: parseFloat(document.getElementById("precio_vip").value) || 0 }
|
||||
];
|
||||
|
||||
const sumaCapacidades = zonas.reduce((total, zona) => total + zona.capacidad, 0);
|
||||
|
||||
// Validar que la suma de las capacidades de zonas no supere la capacidad total
|
||||
if (sumaCapacidades > capacidad_total) {
|
||||
mensajeDiv.innerHTML = `<div class="alert alert-danger">Error: La suma de las capacidades de las zonas (${sumaCapacidades}) no puede superar la capacidad total (${capacidad_total}).</div>`;
|
||||
return;
|
||||
}
|
||||
|
||||
const datosConcierto = {
|
||||
nombre_concierto: nombre,
|
||||
artista: artista,
|
||||
fecha: fecha,
|
||||
calle: calle,
|
||||
colonia: colonia,
|
||||
numero_direccion: numero_direccion,
|
||||
codigo_postal: codigo_postal,
|
||||
estado: estado,
|
||||
capacidad_total: capacidad_total,
|
||||
zonas: zonas
|
||||
};
|
||||
|
||||
fetch("controladores/insertar_concierto.php", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(datosConcierto)
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.insercionCorrecta) {
|
||||
mensajeDiv.innerHTML = `<div class="alert alert-success">Concierto registrado correctamente.</div>`;
|
||||
formulario.reset();
|
||||
cargarConciertos();
|
||||
} else {
|
||||
mensajeDiv.innerHTML = `<div class="alert alert-danger">Error: ${data.error}</div>`;
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
mensajeDiv.innerHTML = `<div class="alert alert-danger">Error en la solicitud.</div>`;
|
||||
console.error("Error:", error);
|
||||
});
|
||||
});
|
|
@ -19,7 +19,7 @@ formulario.addEventListener('submit', async (event) => {
|
|||
});
|
||||
const verificarCredenciales = await respuestaPeticion.json();
|
||||
if (verificarCredenciales.loginExitoso) {
|
||||
window.location.href = 'ventanaPrincipal.html';
|
||||
window.location.href = 'ventanaInsertarConcierto.html';
|
||||
} else {
|
||||
notificacion.textContent ="Usuario o contraseña incorrecta";
|
||||
notificacion.style.color='#ffffff';
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="es">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Registro de Conciertos</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="css/ventanaPrincipal.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- Navbar -->
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="ventanaPrincipal.html">TicketFei</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav me-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="ventanaPrincipal.html">Conciertos</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Reporte Ventas</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<form class="d-flex">
|
||||
<input class="form-control me-2" type="search" id="buscadorColaborador" placeholder="Buscar concierto" aria-label="Buscar">
|
||||
<button class="btn btn-outline-light" type="submit" id="buscadorBoton">
|
||||
<i class="bi bi-search"></i>
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
<button class="btn btn-danger" id="cerrarSesion">Cerrar Sesión</button>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!-- Contenedor Principal -->
|
||||
<div class="container mt-5">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="js/conciertos.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -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>Registro de Conciertos</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="css/ventanaPrincipal.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- Navbar -->
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="ventanaInsertarConcierto.html">TicketFei</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav me-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="ventanaInsertarConcierto.html">Conciertos</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="ventanaConciertos.html">Conciertos</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Reporte Ventas</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<form class="d-flex">
|
||||
<input class="form-control me-2" type="search" id="buscadorColaborador" placeholder="Buscar concierto" aria-label="Buscar">
|
||||
<button class="btn btn-outline-light" type="submit" id="buscadorBoton">
|
||||
<i class="bi bi-search"></i>
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
<button class="btn btn-danger" id="cerrarSesion">Cerrar Sesión</button>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!-- Contenedor Principal -->
|
||||
<div class="container mt-5">
|
||||
<!-- Tarjetas de Conciertos -->
|
||||
<div class="col-md-7">
|
||||
<div class="card shadow-sm p-4">
|
||||
<h2 class="text-center" id="tituloListaConciertos">Lista de Conciertos</h2>
|
||||
<div class="listaConciertos"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="js/conciertos.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,133 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="es">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Registro de Conciertos</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="css/ventanaPrincipal.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- Navbar -->
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="ventanaInsertarConcierto.html">TicketFei</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav me-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="ventanaInsertarConcierto.html">Crear conciertos</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="ventanaConciertos.html">Ver conciertos</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Reporte Ventas</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<form class="d-flex">
|
||||
<input class="form-control me-2" type="search" id="buscadorColaborador" placeholder="Buscar concierto" aria-label="Buscar">
|
||||
<button class="btn btn-outline-light" type="submit" id="buscadorBoton">
|
||||
<i class="bi bi-search"></i>
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
<button class="btn btn-danger" id="cerrarSesion">Cerrar Sesión</button>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!-- Contenedor Principal -->
|
||||
<div class="container mt-5">
|
||||
<div class="row">
|
||||
<!-- Formulario de Registro de Conciertos -->
|
||||
<div class="col-md-5">
|
||||
<div class="card shadow-sm p-4">
|
||||
<h2 class="text-center">Registrar Concierto</h2>
|
||||
<form id="formulario" method="POST" action="controladores/insertar_concierto.php">
|
||||
<div class="mb-3">
|
||||
<label for="nombre_concierto" class="form-label">Nombre del Concierto:</label>
|
||||
<input type="text" class="form-control" id="nombre_concierto" name="nombre_concierto" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="artista" class="form-label">Artista:</label>
|
||||
<input type="text" class="form-control" id="artista" name="artista" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="fecha" class="form-label">Fecha del Concierto:</label>
|
||||
<input type="date" class="form-control" id="fecha" name="fecha" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="calle" class="form-label">Calle:</label>
|
||||
<input type="text" class="form-control" id="calle" name="calle" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="colonia" class="form-label">Colonia:</label>
|
||||
<input type="text" class="form-control" id="colonia" name="colonia" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="numero_direccion" class="form-label">Número exterior:</label>
|
||||
<input type="text" class="form-control" id="numero_direccion" name="numero_direccion" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="codigo_postal" class="form-label">Código Postal:</label>
|
||||
<input type="text" class="form-control" id="codigo_postal" name="codigo_postal" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="estado" class="form-label">Estado:</label>
|
||||
<input type="text" class="form-control" id="estado" name="estado" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="capacidad_total" class="form-label">Capacidad Total:</label>
|
||||
<input type="number" class="form-control" id="capacidad_total" name="capacidad_total" required>
|
||||
</div>
|
||||
|
||||
<!-- Sección de Zonas -->
|
||||
<fieldset class="border p-3 mb-3">
|
||||
<legend class="w-auto">Zonas</legend>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Zona General - Capacidad:</label>
|
||||
<input type="number" class="form-control" id="capacidad_general" name="capacidad_general" required>
|
||||
<label class="form-label">Precio:</label>
|
||||
<input type="number" step="0.01" class="form-control" id="precio_general" name="precio_general" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Zona Plata - Capacidad:</label>
|
||||
<input type="number" class="form-control" id="capacidad_plata" name="capacidad_plata" required>
|
||||
<label class="form-label">Precio:</label>
|
||||
<input type="number" step="0.01" class="form-control" id="precio_plata" name="precio_plata" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Zona Oro - Capacidad:</label>
|
||||
<input type="number" class="form-control" id="capacidad_oro" name="capacidad_oro" required>
|
||||
<label class="form-label">Precio:</label>
|
||||
<input type="number" step="0.01" class="form-control" id="precio_oro" name="precio_oro" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Zona VIP - Capacidad:</label>
|
||||
<input type="number" class="form-control" id="capacidad_vip" name="capacidad_vip" required>
|
||||
<label class="form-label">Precio:</label>
|
||||
<input type="number" step="0.01" class="form-control" id="precio_vip" name="precio_vip" required>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<div class="d-grid gap-2">
|
||||
<input type="submit" value="Registrar concierto">
|
||||
</div>
|
||||
</form>
|
||||
<div id="mensaje" class="mt-3 text-center"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="js/conciertos.js"></script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue