131 lines
6.4 KiB
PHP
131 lines
6.4 KiB
PHP
<?php
|
|
$pageTitle = "Producción de Video";
|
|
include 'db/config.php';
|
|
include 'layout_header.php';
|
|
|
|
$db = db();
|
|
|
|
// Obtener productos para el select
|
|
$stmt_products = $db->query("SELECT id, nombre FROM products ORDER BY nombre ASC");
|
|
$productos = $stmt_products->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
// Obtener videos existentes
|
|
$stmt_videos = $db->query("SELECT mv.*, p.nombre as nombre_producto
|
|
FROM marketing_videos mv
|
|
LEFT JOIN products p ON mv.producto_id = p.id
|
|
ORDER BY mv.fecha_creacion DESC");
|
|
$videos = $stmt_videos->fetchAll(PDO::FETCH_ASSOC);
|
|
?>
|
|
|
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
|
<h2>Gestión de Producción</h2>
|
|
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#nuevoVideoModal">
|
|
<i class="fas fa-plus"></i> Nuevo Pedido de Video
|
|
</button>
|
|
</div>
|
|
|
|
<?php if (isset($_GET['success'])): ?>
|
|
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
|
¡Pedido creado con éxito!
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="row">
|
|
<?php if (empty($videos)): ?>
|
|
<div class="col-12 text-center py-5">
|
|
<i class="fas fa-video fa-4x text-muted mb-3"></i>
|
|
<p class="text-muted">No hay pedidos de video registrados aún.</p>
|
|
</div>
|
|
<?php else: ?>
|
|
<?php foreach ($videos as $v): ?>
|
|
<div class="col-md-4 mb-4">
|
|
<div class="card h-100 shadow-sm">
|
|
<div class="position-relative">
|
|
<?php if ($v['foto_producto']): ?>
|
|
<img src="<?php echo $v['foto_producto']; ?>" class="card-img-top" alt="Producto" style="height: 200px; object-fit: cover;">
|
|
<?php else: ?>
|
|
<div class="bg-light d-flex align-items-center justify-content-center" style="height: 200px;">
|
|
<i class="fas fa-image fa-3x text-muted"></i>
|
|
</div>
|
|
<?php endif; ?>
|
|
<span class="position-absolute top-0 end-0 m-2 badge <?php
|
|
echo $v['estado'] == 'Pendiente' ? 'bg-warning' :
|
|
($v['estado'] == 'En Proceso' ? 'bg-info' :
|
|
($v['estado'] == 'Terminado' ? 'bg-primary' : 'bg-success'));
|
|
?>">
|
|
<?php echo $v['estado']; ?>
|
|
</span>
|
|
</div>
|
|
<div class="card-body">
|
|
<h5 class="card-title"><?php echo htmlspecialchars($v['nombre_producto'] ?: 'Producto General'); ?></h5>
|
|
<p class="card-text text-muted small">
|
|
<?php echo nl2br(htmlspecialchars(substr($v['instrucciones'], 0, 100))); ?>...
|
|
</p>
|
|
<div class="d-flex justify-content-between align-items-center mt-3">
|
|
<small class="text-muted"><i class="far fa-calendar-alt"></i> <?php echo date('d/m/Y', strtotime($v['fecha_creacion'])); ?></small>
|
|
<?php if ($v['link_video']): ?>
|
|
<a href="<?php echo $v['link_video']; ?>" target="_blank" class="btn btn-sm btn-success">
|
|
<i class="fas fa-play"></i> Ver Video
|
|
</a>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
<div class="card-footer bg-white border-top-0">
|
|
<button class="btn btn-outline-primary btn-sm w-100" onclick="verDetalles(<?php echo $v['id']; ?>)">
|
|
<i class="fas fa-edit"></i> Gestionar
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<!-- Modal Nuevo Video -->
|
|
<div class="modal fade" id="nuevoVideoModal" tabindex="-1" aria-hidden="true">
|
|
<div class="modal-dialog modal-lg">
|
|
<div class="modal-content">
|
|
<form action="save_marketing_video.php" method="POST" enctype="multipart/form-data">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">Nuevo Pedido de Video</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="row g-3">
|
|
<div class="col-md-6">
|
|
<label class="form-label">Producto Relacionado</label>
|
|
<select name="producto_id" class="form-select">
|
|
<option value="">Seleccionar producto...</option>
|
|
<?php foreach ($productos as $p): ?>
|
|
<option value="<?php echo $p['id']; ?>"><?php echo htmlspecialchars($p['nombre']); ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label class="form-label">Foto de Referencia / Ángulo</label>
|
|
<input type="file" name="foto_producto" class="form-control" accept="image/*">
|
|
</div>
|
|
<div class="col-12">
|
|
<label class="form-label">Instrucciones Detalladas</label>
|
|
<textarea name="instrucciones" class="form-control" rows="4" placeholder="Describe el ángulo, la música, el estilo del video, etc."></textarea>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancelar</button>
|
|
<button type="submit" class="btn btn-primary">Crear Pedido</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
function verDetalles(id) {
|
|
// Por ahora solo mostramos un mensaje, luego implementaremos la edición
|
|
alert("Funcionalidad de edición para el ID " + id + " en desarrollo.");
|
|
}
|
|
</script>
|
|
|
|
<?php include 'layout_footer.php'; ?>
|