Auto commit: 2026-01-31T14:51:39.807Z
This commit is contained in:
parent
0927396783
commit
a3376fcee0
292
index.php
292
index.php
@ -29,13 +29,13 @@ $logoImage = "assets/pasted-20260131-002028-7985dfae.png";
|
||||
// Fetch latest requests and songs
|
||||
$requests = [];
|
||||
$songs = [];
|
||||
$activeSong = null;
|
||||
try {
|
||||
$stmt = db()->query("SELECT name, phone, message, created_at FROM listener_requests ORDER BY created_at DESC LIMIT 20");
|
||||
$requests = $stmt->fetchAll();
|
||||
|
||||
$stmtSongs = db()->query("SELECT * FROM songs ORDER BY created_at DESC");
|
||||
$stmtSongs = db()->query("SELECT * FROM songs ORDER BY created_at ASC");
|
||||
$songs = $stmtSongs->fetchAll();
|
||||
$activeSong = null;
|
||||
foreach ($songs as $s) {
|
||||
if ($s["is_active"]) {
|
||||
$activeSong = $s;
|
||||
@ -418,20 +418,8 @@ try {
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
/* New styles for Song Management */
|
||||
.nav-pills-glass .nav-link {
|
||||
color: rgba(255,255,255,0.6);
|
||||
border-radius: 15px;
|
||||
padding: 0.5rem 1.5rem;
|
||||
font-weight: 600;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
.nav-pills-glass .nav-link.active {
|
||||
background: var(--primary-color);
|
||||
color: #fff;
|
||||
box-shadow: 0 5px 15px rgba(255, 45, 85, 0.4);
|
||||
}
|
||||
.song-item {
|
||||
/* Song Management Styles in Modal */
|
||||
.song-item-modal {
|
||||
background: rgba(255,255,255,0.05);
|
||||
border: 1px solid rgba(255,255,255,0.08);
|
||||
border-radius: 20px;
|
||||
@ -442,20 +430,22 @@ try {
|
||||
align-items: center;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
.song-item:hover {
|
||||
.song-item-modal:hover {
|
||||
background: rgba(255,255,255,0.1);
|
||||
}
|
||||
.song-active {
|
||||
.song-active-modal {
|
||||
border-color: var(--primary-color);
|
||||
background: rgba(255, 45, 85, 0.1);
|
||||
}
|
||||
.song-title-text {
|
||||
font-weight: 700;
|
||||
display: block;
|
||||
color: #fff;
|
||||
}
|
||||
.song-artist-text {
|
||||
font-size: 0.8rem;
|
||||
opacity: 0.6;
|
||||
color: #fff;
|
||||
}
|
||||
.btn-toggle-song {
|
||||
background: rgba(255,255,255,0.1);
|
||||
@ -518,12 +508,16 @@ try {
|
||||
|
||||
<canvas id="visualizer"></canvas>
|
||||
|
||||
<?php if ($isAdmin): ?>
|
||||
<div class="mt-4 pt-4 border-top border-white border-opacity-10 position-relative" style="z-index: 2;">
|
||||
<div class="mb-2 small text-primary fw-bold"><i class="fas fa-user-shield me-1"></i> PANEL ADMINISTRADOR</div>
|
||||
<a href="?logout=1" class="btn btn-sm btn-outline-danger px-4 rounded-pill mt-2">Cerrar Sesión</a>
|
||||
<div class="mt-4 pt-3 border-top border-white border-opacity-10 position-relative" style="z-index: 2;">
|
||||
<button class="btn btn-sm btn-outline-light rounded-pill px-4 mb-2 w-100" data-bs-toggle="modal" data-bs-target="#playlistModal">
|
||||
<i class="fas fa-list-ul me-2"></i> Ver Playlist
|
||||
</button>
|
||||
|
||||
<?php if ($isAdmin): ?>
|
||||
<div class="mt-2 small text-primary fw-bold"><i class="fas fa-user-shield me-1"></i> PANEL ADMINISTRADOR</div>
|
||||
<a href="?logout=1" class="btn btn-sm btn-outline-danger px-4 rounded-pill mt-2 w-100">Cerrar Sesión</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</aside>
|
||||
|
||||
<?php if ($isAdmin): ?>
|
||||
@ -547,156 +541,40 @@ try {
|
||||
<img src="<?= $promoImage ?>" alt="Lili Records Promo" class="promo-image">
|
||||
|
||||
<div class="comments-window">
|
||||
<?php if ($isAdmin): ?>
|
||||
<ul class="nav nav-pills nav-pills-glass mb-4 justify-content-center gap-2" id="adminTabs" role="tablist">
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link active" id="requests-tab" data-bs-toggle="pill" data-bs-target="#requests-pane" type="button" role="tab">
|
||||
<i class="fas fa-comments me-2"></i>Mensajes
|
||||
</button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="songs-tab" data-bs-toggle="pill" data-bs-target="#songs-pane" type="button" role="tab">
|
||||
<i class="fas fa-music me-2"></i>Canciones
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="comments-header border-0 mb-3">
|
||||
<div>
|
||||
<h5 class="mb-1"><i class="fas fa-paper-plane me-2 text-primary"></i><?= $isAdmin ? 'Mensajes de Oyentes' : '¡Envía tu mensaje!' ?></h5>
|
||||
<p class="small opacity-60 mb-0"><?= $isAdmin ? 'Peticiones en tiempo real' : 'Pide una canción o envía un saludo al aire.' ?></p>
|
||||
</div>
|
||||
<div class="text-center qr-container" style="width: 90px;" data-bs-toggle="modal" data-bs-target="#qrModal">
|
||||
<img src="<?= $qrImage ?>" alt="QR Pago" class="w-100 rounded-3 mb-1">
|
||||
<p class="small fw-bold mb-0"><?= $isAdmin ? 'QR' : 'APOYAR' ?></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-content flex-1 overflow-hidden d-flex flex-column">
|
||||
<!-- Tab: Requests -->
|
||||
<div class="tab-pane fade show active flex-1 overflow-hidden d-flex flex-column" id="requests-pane" role="tabpanel" tabindex="0">
|
||||
<div class="comments-header border-0 mb-3">
|
||||
<div>
|
||||
<h5 class="mb-1">Mensajes de Oyentes</h5>
|
||||
<p class="small opacity-50 mb-0">Peticiones en tiempo real</p>
|
||||
</div>
|
||||
<div class="text-center qr-container" style="width: 80px;" data-bs-toggle="modal" data-bs-target="#qrModal">
|
||||
<img src="<?= $qrImage ?>" alt="QR Pago" class="w-100 rounded-3 mb-1">
|
||||
<p class="small fw-bold mb-0">QR</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="comments-list" id="commentsList">
|
||||
<?php if (empty($requests)): ?>
|
||||
<div class="text-center py-5 opacity-30">
|
||||
<i class="fas fa-comment-slash fa-4x mb-3"></i>
|
||||
<p>No hay mensajes todavía.</p>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php foreach ($requests as $req): ?>
|
||||
<div class="comment-item">
|
||||
<span class="comment-user"><?= htmlspecialchars($req['name']) ?></span>
|
||||
<p class="mb-2"><?= htmlspecialchars($req['message']) ?></p>
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<span class="small opacity-40"><?= date('d M, H:i', strtotime($req['created_at'])) ?></span>
|
||||
<?php if (!empty($req['phone'])): ?>
|
||||
<a href="https://wa.me/<?= preg_replace('/[^0-9]/', '', $req['phone']) ?>" class="btn-wa-reply" target="_blank">
|
||||
<i class="fab fa-whatsapp"></i>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Tab: Songs -->
|
||||
<div class="tab-pane fade flex-1 overflow-hidden d-flex flex-column" id="songs-pane" role="tabpanel" tabindex="0">
|
||||
<div class="mb-4">
|
||||
<form action="manage_songs.php" method="POST" class="row g-2">
|
||||
<input type="hidden" name="action" value="add">
|
||||
<div class="col-sm-5">
|
||||
<input type="text" name="title" class="form-control form-control-glass" placeholder="Título canción" required>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<input type="text" name="artist" class="form-control form-control-glass" placeholder="Artista" required>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<button type="submit" class="btn btn-send-request text-white w-100 h-100">
|
||||
<i class="fas fa-plus"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="comments-list">
|
||||
<?php if (empty($songs)): ?>
|
||||
<div class="text-center py-5 opacity-30">
|
||||
<i class="fas fa-music fa-4x mb-3"></i>
|
||||
<p>No hay canciones en la lista.</p>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php foreach ($songs as $song): ?>
|
||||
<div class="song-item <?= $song['is_active'] ? 'song-active' : '' ?>">
|
||||
<div>
|
||||
<span class="song-title-text"><?= htmlspecialchars($song['title']) ?></span>
|
||||
<span class="song-artist-text"><?= htmlspecialchars($song['artist']) ?></span>
|
||||
</div>
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<form action="manage_songs.php" method="POST" class="m-0">
|
||||
<input type="hidden" name="action" value="toggle_active">
|
||||
<input type="hidden" name="id" value="<?= $song['id'] ?>">
|
||||
<button type="submit" class="btn-toggle-song <?= $song['is_active'] ? 'active' : '' ?>">
|
||||
<?= $song['is_active'] ? 'ACTIVA' : 'ACTIVAR' ?>
|
||||
</button>
|
||||
</form>
|
||||
<form action="manage_songs.php" method="POST" class="m-0" onsubmit="return confirm('¿Eliminar canción?')">
|
||||
<input type="hidden" name="action" value="delete">
|
||||
<input type="hidden" name="id" value="<?= $song['id'] ?>">
|
||||
<button type="submit" class="btn-delete-song">
|
||||
<i class="fas fa-trash-alt"></i>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<div class="comments-list" id="commentsList">
|
||||
<?php if (empty($requests)): ?>
|
||||
<div class="text-center py-5 opacity-30">
|
||||
<i class="fas fa-comment-slash fa-4x mb-3"></i>
|
||||
<p>No hay mensajes todavía.</p>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php foreach ($requests as $req): ?>
|
||||
<div class="comment-item">
|
||||
<span class="comment-user"><?= htmlspecialchars($req['name']) ?></span>
|
||||
<p class="mb-2"><?= htmlspecialchars($req['message']) ?></p>
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<span class="small opacity-40"><?= date('d M, H:i', strtotime($req['created_at'])) ?></span>
|
||||
<?php if ($isAdmin && !empty($req['phone'])): ?>
|
||||
<a href="https://wa.me/<?= preg_replace('/[^0-9]/', '', $req['phone']) ?>" class="btn-wa-reply" target="_blank">
|
||||
<i class="fab fa-whatsapp"></i>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php else: ?>
|
||||
<div class="comments-header border-0 mb-3">
|
||||
<div>
|
||||
<h5 class="mb-1"><i class="fas fa-paper-plane me-2 text-primary"></i>¡Envía tu mensaje!</h5>
|
||||
<p class="small opacity-60 mb-0">Pide una canción o envía un saludo al aire.</p>
|
||||
</div>
|
||||
<div class="text-center qr-container" style="width: 90px;" data-bs-toggle="modal" data-bs-target="#qrModal">
|
||||
<img src="<?= $qrImage ?>" alt="QR Pago" class="w-100 rounded-3 mb-1">
|
||||
<p class="small fw-bold mb-0">APOYAR</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="comments-list" style="max-height: 250px;">
|
||||
<!-- User Song List Section (Optional view) -->
|
||||
<?php if (!empty($songs)): ?>
|
||||
<div class="mb-4">
|
||||
<h6 class="small fw-bold text-uppercase opacity-50 mb-3">Lista de Canciones</h6>
|
||||
<?php foreach (array_slice($songs, 0, 5) as $song): ?>
|
||||
<div class="d-flex justify-content-between align-items-center py-2 px-3 mb-2 bg-white bg-opacity-5 rounded-4">
|
||||
<div>
|
||||
<span class="d-block small fw-bold"><?= htmlspecialchars($song['title']) ?></span>
|
||||
<span class="d-block tiny opacity-50" style="font-size: 0.7rem;"><?= htmlspecialchars($song['artist']) ?></span>
|
||||
</div>
|
||||
<?php if ($song['is_active']): ?>
|
||||
<span class="badge rounded-pill bg-primary" style="font-size: 0.6rem;">SONANDO</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<h6 class="small fw-bold text-uppercase opacity-50 mb-3">Últimos Mensajes</h6>
|
||||
<?php if (empty($requests)): ?>
|
||||
<p class="text-center py-4 opacity-40 italic">Sé el primero en escribir...</p>
|
||||
<?php else: ?>
|
||||
<?php foreach (array_slice($requests, 0, 5) as $req): ?>
|
||||
<div class="comment-item py-2 px-3 mb-2 border-0 bg-white bg-opacity-5 rounded-4">
|
||||
<span class="comment-user small"><?= htmlspecialchars($req['name']) ?></span>
|
||||
<p class="mb-0 small"><?= htmlspecialchars($req['message']) ?></p>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<form action="submit_request.php" method="POST" class="request-form mt-auto pt-4">
|
||||
<div class="row g-2 mb-2">
|
||||
@ -725,6 +603,80 @@ try {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal Playlist (Visualization & Management) -->
|
||||
<div class="modal fade" id="playlistModal" tabindex="-1" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered modal-lg">
|
||||
<div class="modal-content border-0" style="background: rgba(15,15,15,0.95); border-radius: 35px; backdrop-filter: blur(30px);">
|
||||
<div class="modal-header border-white border-opacity-10 px-5 py-4">
|
||||
<h5 class="modal-title fw-bold"><i class="fas fa-list-ul me-2 text-primary"></i> LISTA DE REPRODUCCIÓN</h5>
|
||||
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body px-5 py-4">
|
||||
<?php if ($isAdmin): ?>
|
||||
<div class="mb-4">
|
||||
<h6 class="small fw-bold text-uppercase opacity-50 mb-3">Añadir Canción a la Lista</h6>
|
||||
<form action="manage_songs.php" method="POST" class="row g-2">
|
||||
<input type="hidden" name="action" value="add">
|
||||
<div class="col-sm-5">
|
||||
<input type="text" name="title" class="form-control form-control-glass" placeholder="Título canción" required>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<input type="text" name="artist" class="form-control form-control-glass" placeholder="Artista" required>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<button type="submit" class="btn btn-send-request text-white w-100 h-100">
|
||||
<i class="fas fa-plus"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="songs-list-container" style="max-height: 400px; overflow-y: auto;">
|
||||
<?php if (empty($songs)): ?>
|
||||
<div class="text-center py-5 opacity-30">
|
||||
<i class="fas fa-music fa-4x mb-3"></i>
|
||||
<p>No hay canciones en la lista.</p>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php foreach ($songs as $song): ?>
|
||||
<div class="song-item-modal <?= $song['is_active'] ? 'song-active-modal' : '' ?>">
|
||||
<div>
|
||||
<span class="song-title-text"><?= htmlspecialchars($song['title']) ?></span>
|
||||
<span class="song-artist-text"><?= htmlspecialchars($song['artist']) ?></span>
|
||||
</div>
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<?php if ($isAdmin): ?>
|
||||
<form action="manage_songs.php" method="POST" class="m-0">
|
||||
<input type="hidden" name="action" value="toggle_active">
|
||||
<input type="hidden" name="id" value="<?= $song['id'] ?>">
|
||||
<button type="submit" class="btn-toggle-song <?= $song['is_active'] ? 'active' : '' ?>">
|
||||
<?= $song['is_active'] ? 'AL AIRE' : 'PONER AL AIRE' ?>
|
||||
</button>
|
||||
</form>
|
||||
<form action="manage_songs.php" method="POST" class="m-0" onsubmit="return confirm('¿Eliminar canción?')">
|
||||
<input type="hidden" name="action" value="delete">
|
||||
<input type="hidden" name="id" value="<?= $song['id'] ?>">
|
||||
<button type="submit" class="btn-delete-song">
|
||||
<i class="fas fa-trash-alt"></i>
|
||||
</button>
|
||||
</form>
|
||||
<?php elseif ($song['is_active']): ?>
|
||||
<span class="badge rounded-pill bg-primary px-3 py-2" style="font-size: 0.7rem;">SONANDO</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer border-0 px-5 pb-5">
|
||||
<button type="button" class="btn btn-light px-5 py-2 rounded-pill fw-bold" data-bs-dismiss="modal">CERRAR</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal Política de Privacidad -->
|
||||
<div class="modal fade" id="policyModal" tabindex="-1" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered modal-lg">
|
||||
@ -877,7 +829,7 @@ try {
|
||||
});
|
||||
|
||||
async function fetchMetadata() {
|
||||
if (hasActiveSong) return; {
|
||||
if (hasActiveSong) return;
|
||||
try {
|
||||
const response = await fetch('https://api.radioking.io/widget/radio/lili-record-s-radio/track/current');
|
||||
const data = await response.json();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user