Arreglé el diseño de la interfaz y corregí la carga de conciertos
This commit is contained in:
commit
186e564fb9
|
@ -1,54 +1,50 @@
|
|||
<?php
|
||||
include 'conexion.php';
|
||||
|
||||
// Configurar respuesta como JSON
|
||||
header('Content-Type: application/json');
|
||||
header('Content-Type: application/json'); // Asegurar que el contenido es JSON
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
|
||||
$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,
|
||||
$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')";
|
||||
ORDER BY c.id_concierto,
|
||||
FIELD(z.nombre_zona, 'General', 'Plata', 'Oro', 'VIP')";
|
||||
|
||||
$resultado = $conexionBD->query($consulta);
|
||||
|
||||
if (!$resultado) {
|
||||
echo json_encode(["error" => "Error en la consulta SQL: " . $conexionBD->error]);
|
||||
exit;
|
||||
}
|
||||
|
||||
$conciertos = [];
|
||||
|
||||
if ($resultado->num_rows > 0) {
|
||||
while ($fila = $resultado->fetch_assoc()) {
|
||||
$id_concierto = $fila['id_concierto'];
|
||||
while ($fila = $resultado->fetch_assoc()) {
|
||||
$id_concierto = $fila['id_concierto'];
|
||||
if (!isset($conciertos[$id_concierto])) {
|
||||
$conciertos[$id_concierto] = [
|
||||
'id' => $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 (!isset($conciertos[$id_concierto])) {
|
||||
$direccion = trim("{$fila['calle']}, {$fila['colonia']}, #{$fila['numero_direccion']}, CP: {$fila['codigo_postal']}, {$fila['estado']}");
|
||||
if ($direccion === ", , #, CP: , ") {
|
||||
$direccion = "Dirección no definida";
|
||||
}
|
||||
|
||||
$conciertos[$id_concierto] = [
|
||||
'id' => $id_concierto,
|
||||
'nombre_concierto' => $fila['nombre_concierto'],
|
||||
'artista' => $fila['artista'],
|
||||
'fecha' => $fila['fecha'],
|
||||
'direccion' => $direccion,
|
||||
'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']
|
||||
];
|
||||
}
|
||||
if (!empty($fila['nombre_zona'])) {
|
||||
$conciertos[$id_concierto]['zonas'][] = [
|
||||
'nombre_zona' => $fila['nombre_zona'],
|
||||
'capacidad' => $fila['capacidad_zona'],
|
||||
'precio' => $fila['precio']
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// Enviar JSON
|
||||
// Convertir el array a JSON y enviarlo
|
||||
echo json_encode(array_values($conciertos), JSON_PRETTY_PRINT);
|
||||
|
||||
$conexionBD->close();
|
||||
|
|
|
@ -138,4 +138,3 @@ nav {
|
|||
.btn-comprar:hover {
|
||||
background: #848478;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -3,25 +3,35 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||
});
|
||||
|
||||
const listaConciertos = document.getElementById("listaConciertos");
|
||||
const buscadorBoton = document.getElementById("buscadorBoton");
|
||||
const buscadorInput = document.getElementById("buscadorColaborador");
|
||||
|
||||
// Función para cargar conciertos
|
||||
async function cargarConciertos() {
|
||||
async function cargarConciertos(filtro = "") {
|
||||
try {
|
||||
const respuesta = await fetch('controladores/conciertos.php');
|
||||
if (!respuesta.ok) throw new Error("Error al cargar conciertos");
|
||||
|
||||
const conciertos = await respuesta.json();
|
||||
listaConciertos.innerHTML = ""; // Limpiar la lista antes de agregar nuevos
|
||||
listaConciertos.innerHTML = "";
|
||||
|
||||
const conciertosFiltrados = filtro
|
||||
? conciertos.filter(c => c.nombre_concierto.toLowerCase().includes(filtro.toLowerCase()))
|
||||
: conciertos;
|
||||
|
||||
if (conciertosFiltrados.length === 0) {
|
||||
listaConciertos.innerHTML = `<p class="text-red-500 text-center">No se encontraron conciertos.</p>`;
|
||||
return;
|
||||
}
|
||||
|
||||
let tarjetas = [];
|
||||
|
||||
conciertos.forEach(concierto => {
|
||||
conciertosFiltrados.forEach((concierto) => {
|
||||
const tarjeta = document.createElement("div");
|
||||
tarjeta.classList.add("concierto-card");
|
||||
|
||||
let zonasHTML = "";
|
||||
if (concierto.zonas.length > 0) {
|
||||
zonasHTML = `<ul class="text-sm card-text">`;
|
||||
zonasHTML = `<ul class="text-sm text-gray-300 mt-2">`;
|
||||
concierto.zonas.forEach(zona => {
|
||||
zonasHTML += `<li>🔹 ${zona.nombre_zona}: <b>${zona.capacidad} asientos</b> - $${zona.precio}</li>`;
|
||||
});
|
||||
|
@ -45,7 +55,6 @@ async function cargarConciertos() {
|
|||
tarjetas.push(tarjeta);
|
||||
});
|
||||
|
||||
// Aplicar animación GSAP
|
||||
gsap.fromTo(
|
||||
tarjetas,
|
||||
{ opacity: 0, scale: 0.9 },
|
||||
|
@ -57,3 +66,9 @@ async function cargarConciertos() {
|
|||
listaConciertos.innerHTML = `<p class="text-red-500">No se pudieron cargar los conciertos.</p>`;
|
||||
}
|
||||
}
|
||||
|
||||
buscadorBoton.addEventListener('click', (event) => {
|
||||
event.preventDefault();
|
||||
const termino = buscadorInput.value.trim();
|
||||
cargarConciertos(termino);
|
||||
});
|
||||
|
|
|
@ -12,11 +12,11 @@ function siguientePaso (paso) {
|
|||
// Ocultar todos los pasos
|
||||
pasos.forEach(p => p.classList.add("d-none"));
|
||||
|
||||
// Mostrar el paso seleccionado
|
||||
|
||||
document.getElementById(`paso${paso}`).classList.remove("d-none");
|
||||
}
|
||||
|
||||
// Enviar formulario
|
||||
|
||||
formulario.addEventListener("submit", async (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ formulario.addEventListener('submit', async (event) => {
|
|||
data.append('password', password);
|
||||
|
||||
try {
|
||||
// Petición al servidor
|
||||
|
||||
const respuestaPeticion = await fetch('controladores/login.php', {
|
||||
method: 'POST',
|
||||
body: data
|
||||
|
|
|
@ -35,7 +35,10 @@
|
|||
|
||||
</ul>
|
||||
<button class="btn btn-danger" id="cerrarSesion">Cerrar Sesión</button>
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
>>>>>>> 056a4b8214543ea4e6d30d1f1d2f465db727ceae
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
|
Loading…
Reference in New Issue