-
Biblioteca de Recursos de Marketing
-
Aquí podrás subir y organizar logos, intros de video, música y otros materiales que la editora deba utilizar de forma recurrente.
-
-
Esta sección está en desarrollo. Pronto podrás gestionar tus archivos aquí.
+
+
+
+
+
Biblioteca de Assets
+
+
+ Home
+ Marketing
+ Assets
+
+
+
+
+ Subir Nuevo Recurso
+
+
+
+
+
+ $items): ?>
+
+
+
+
+
+
No hay archivos en esta categoría.
+
+
+
+
+
+ Nombre
+ Fecha
+ Acciones
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
\ No newline at end of file
diff --git a/marketing_produccion.php b/marketing_produccion.php
index 90096b80..65f51732 100644
--- a/marketing_produccion.php
+++ b/marketing_produccion.php
@@ -13,73 +13,186 @@ $productos = $stmt_products->fetchAll(PDO::FETCH_ASSOC);
$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");
+ ORDER BY mv.orden ASC, mv.fecha_creacion DESC");
$videos = $stmt_videos->fetchAll(PDO::FETCH_ASSOC);
?>
+
+
-
Gestión de Producción
-
- Nuevo Pedido de Video
-
+
+
Producción de Video
+
Vista de control estilo Excel
+
+
- ¡Pedido creado con éxito!
+ ¡Operación realizada con éxito!
-
-
-
-
-
No hay pedidos de video registrados aún.
+
+
+
+
+
+
+ Orden
+ Fecha Entrega
+ Producto
+ Imagen
+ Material
+ Ángulo
+ Insp. Landing
+ Insp. Video
+ Link Video
+ Link Landing
+ Link Flyer
+ Estado
+ Acción
+
+
+
+
+
+ No hay pedidos registrados.
+
+
+
+
+
+
+ -'; ?>
+
+
+
+
+
+
+ Sin foto
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -93,8 +206,16 @@ $videos = $stmt_videos->fetchAll(PDO::FETCH_ASSOC);
@@ -121,11 +262,176 @@ $videos = $stmt_videos->fetchAll(PDO::FETCH_ASSOC);
+
+
+
\ No newline at end of file
diff --git a/save_marketing_asset.php b/save_marketing_asset.php
new file mode 100644
index 00000000..e77643c5
--- /dev/null
+++ b/save_marketing_asset.php
@@ -0,0 +1,29 @@
+prepare("INSERT INTO marketing_assets (nombre, categoria, archivo_path) VALUES (?, ?, ?)");
+ $stmt->execute([$nombre, $categoria, $targetPath]);
+
+ header("Location: marketing_assets.php?success=1");
+ exit;
+ }
+ }
+}
+
+header("Location: marketing_assets.php?error=1");
+exit;
\ No newline at end of file
diff --git a/save_marketing_video.php b/save_marketing_video.php
index 920003af..e6c59141 100644
--- a/save_marketing_video.php
+++ b/save_marketing_video.php
@@ -9,29 +9,110 @@ if (!isset($_SESSION['user_id'])) {
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$db = db();
- $producto_id = !empty($_POST['producto_id']) ? $_POST['producto_id'] : null;
- $instrucciones = $_POST['instrucciones'] ?? '';
- $foto_path = null;
+ $action = $_POST['action'] ?? 'create';
- // Manejo de la subida de foto
- if (isset($_FILES['foto_producto']) && $_FILES['foto_producto']['error'] == 0) {
- $target_dir = "assets/uploads/marketing_images/";
- $file_extension = pathinfo($_FILES["foto_producto"]["name"], PATHINFO_EXTENSION);
- $file_name = uniqid() . '.' . $file_extension;
- $target_file = $target_dir . $file_name;
+ if ($action == 'update') {
+ // Lógica para actualizar (Editora o Tú)
+ $id = $_POST['id'];
+ $estado = $_POST['estado'];
+ $link_video = $_POST['link_video'] ?? '';
+ $link_landing = $_POST['link_landing'] ?? '';
+ $link_flyer = $_POST['link_flyer'] ?? '';
+ $material = $_POST['material'] ?? '';
+ $fecha_entrega = !empty($_POST['fecha_entrega']) ? $_POST['fecha_entrega'] : null;
+ $orden = !empty($_POST['orden']) ? $_POST['orden'] : 0;
+ $angulo_video = $_POST['angulo_video'] ?? '';
+ $link_inspiracion_landing = $_POST['link_inspiracion_landing'] ?? '';
+ $link_inspiracion_video = $_POST['link_inspiracion_video'] ?? '';
- if (move_uploaded_file($_FILES["foto_producto"]["tmp_name"], $target_file)) {
- $foto_path = $target_file;
+ try {
+ $stmt = $db->prepare("UPDATE marketing_videos SET
+ estado = ?,
+ link_video = ?,
+ link_landing = ?,
+ link_flyer = ?,
+ material = ?,
+ fecha_entrega = ?,
+ orden = ?,
+ angulo_video = ?,
+ link_inspiracion_landing = ?,
+ link_inspiracion_video = ?
+ WHERE id = ?");
+ $stmt->execute([
+ $estado,
+ $link_video,
+ $link_landing,
+ $link_flyer,
+ $material,
+ $fecha_entrega,
+ $orden,
+ $angulo_video,
+ $link_inspiracion_landing,
+ $link_inspiracion_video,
+ $id
+ ]);
+ header('Location: marketing_produccion.php?success=updated');
+ } catch (PDOException $e) {
+ echo "Error: " . $e->getMessage();
}
- }
-
- try {
- $stmt = $db->prepare("INSERT INTO marketing_videos (producto_id, foto_producto, instrucciones, estado) VALUES (?, ?, ?, 'Pendiente')");
- $stmt->execute([$producto_id, $foto_path, $instrucciones]);
+ } else {
+ // Lógica para crear (Tú)
+ $producto_id = !empty($_POST['producto_id']) ? $_POST['producto_id'] : null;
+ $instrucciones = $_POST['instrucciones'] ?? '';
+ $fecha_entrega = !empty($_POST['fecha_entrega']) ? $_POST['fecha_entrega'] : null;
+ $orden = !empty($_POST['orden']) ? $_POST['orden'] : 0;
+ $angulo_video = $_POST['angulo_video'] ?? '';
+ $link_inspiracion_landing = $_POST['link_inspiracion_landing'] ?? '';
+ $link_inspiracion_video = $_POST['link_inspiracion_video'] ?? '';
+ $link_flyer = $_POST['link_flyer'] ?? '';
+ $material = $_POST['material'] ?? '';
- header('Location: marketing_produccion.php?success=1');
- } catch (PDOException $e) {
- echo "Error: " . $e->getMessage();
+ $foto_path = null;
+
+ if (isset($_FILES['foto_producto']) && $_FILES['foto_producto']['error'] == 0) {
+ $target_dir = "assets/uploads/marketing_images/";
+ if (!is_dir($target_dir)) {
+ mkdir($target_dir, 0777, true);
+ }
+ $file_extension = pathinfo($_FILES["foto_producto"]["name"], PATHINFO_EXTENSION);
+ $file_name = uniqid() . '.' . $file_extension;
+ $target_file = $target_dir . $file_name;
+
+ if (move_uploaded_file($_FILES["foto_producto"]["tmp_name"], $target_file)) {
+ $foto_path = $target_file;
+ }
+ }
+
+ try {
+ $stmt = $db->prepare("INSERT INTO marketing_videos (
+ producto_id,
+ foto_producto,
+ material,
+ instrucciones,
+ estado,
+ fecha_entrega,
+ orden,
+ angulo_video,
+ link_inspiracion_landing,
+ link_inspiracion_video,
+ link_flyer
+ ) VALUES (?, ?, ?, ?, 'Pendiente', ?, ?, ?, ?, ?, ?)");
+ $stmt->execute([
+ $producto_id,
+ $foto_path,
+ $material,
+ $instrucciones,
+ $fecha_entrega,
+ $orden,
+ $angulo_video,
+ $link_inspiracion_landing,
+ $link_inspiracion_video,
+ $link_flyer
+ ]);
+ header('Location: marketing_produccion.php?success=created');
+ } catch (PDOException $e) {
+ echo "Error: " . $e->getMessage();
+ }
}
}
?>
\ No newline at end of file
diff --git a/update_marketing_video_field.php b/update_marketing_video_field.php
new file mode 100644
index 00000000..a54e7cbc
--- /dev/null
+++ b/update_marketing_video_field.php
@@ -0,0 +1,46 @@
+ 'Acceso no autorizado.']);
+ exit;
+}
+
+$data = json_decode(file_get_contents('php://input'), true);
+
+if (!$data || !isset($data['id']) || !isset($data['field']) || !isset($data['value'])) {
+ http_response_code(400);
+ echo json_encode(['error' => 'Datos incompletos.']);
+ exit;
+}
+
+$video_id = $data['id'];
+$field = $data['field'];
+$value = $data['value'];
+
+// Whitelist allowed fields for security
+$allowed_fields = ['material', 'estado', 'angulo_video'];
+if (!in_array($field, $allowed_fields)) {
+ http_response_code(400);
+ echo json_encode(['error' => 'Campo no permitido.']);
+ exit;
+}
+
+try {
+ $pdo = db();
+
+ $sql = "UPDATE marketing_videos SET $field = ? WHERE id = ?";
+ $stmt = $pdo->prepare($sql);
+ $stmt->execute([$value, $video_id]);
+
+ echo json_encode([
+ 'success' => true,
+ 'message' => 'Campo actualizado correctamente.'
+ ]);
+} catch (PDOException $e) {
+ http_response_code(500);
+ echo json_encode(['error' => 'Error al actualizar la base de datos: ' . $e->getMessage()]);
+}
+?>
\ No newline at end of file