Autosave: 20260206-040234

This commit is contained in:
Flatlogic Bot 2026-02-06 04:02:34 +00:00
parent 149d498ccf
commit 7ccbc77b67
43 changed files with 101 additions and 35 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

View File

@ -168,42 +168,40 @@ if (isset($_SESSION['error_message'])) {
</div>
<!-- Sección para Configuración de Banners y Textos -->
<div class="card mb-5">
<div class="card-header">
<h3>Imágenes de Cobertura</h3>
</div>
<div class="card">
<div class="card-body">
<!-- Formulario para Banner de Cobertura -->
<div class="mb-4">
<h5>Banner de Cobertura</h5>
<form action="save_cobertura_banner.php" method="post" enctype="multipart/form-data">
<div class="form-group">
<label for="cobertura_banner">Actualizar imagen del banner (JPG, PNG, GIF)</label>
<input type="file" name="cobertura_banner" id="cobertura_banner" class="form-control-file" required>
</div>
<button type="submit" class="btn btn-primary mt-2">Guardar Banner</button>
</form>
<div class="mt-3">
<p>Imagen actual:</p>
<img src="assets/uploads/cobertura_banner.jpg?t=<?php echo time(); ?>" alt="Banner de Cobertura" style="width: 100%; max-width: 800px; height: auto; border-radius: 8px; object-fit: cover;">
<h5 class="card-title">Texto del Banner Principal</h5>
<p class="card-text">Edita el texto que aparece en el banner de la página principal.</p>
<form action="save_banner_text.php" method="post">
<div class="form-group">
<textarea class="form-control" id="banner_text" name="banner_text" rows="3"><?php echo htmlspecialchars($banner_text); ?></textarea>
</div>
</div>
<hr>
<!-- Formulario para Banner de Cobertura Xpress -->
<div class="mt-4">
<h5>Banner de Cobertura Xpress</h5>
<form action="save_cobertura_xpress_banner.php" method="post" enctype="multipart/form-data">
<div class="form-group">
<label for="cobertura_xpress_banner">Actualizar imagen del banner (JPG, PNG, GIF)</label>
<input type="file" name="cobertura_xpress_banner" id="cobertura_xpress_banner" class="form-control-file" required>
</div>
<button type="submit" class="btn btn-primary mt-2">Guardar Banner Xpress</button>
</form>
<div class="mt-3">
<p>Imagen actual:</p>
<img src="assets/uploads/cobertura_xpress_banner.jpg?t=<?php echo time(); ?>" alt="Banner de Cobertura Xpress" style="width: 100%; max-width: 800px; height: auto; border-radius: 8px; object-fit: cover;">
<button type="submit" class="btn btn-primary mt-2">Guardar Texto</button>
</form>
</div>
</div>
<!-- Mensaje de WhatsApp para Ruta Contraentrega -->
<div class="card mt-4">
<div class="card-body">
<h5 class="card-title">Mensaje para Ruta Contraentrega</h5>
<p class="card-text">
Edita la plantilla para el mensaje de WhatsApp que se envía desde la sección de "Ruta Contraentrega".
<br>
Puedes usar las siguientes variables:
<ul>
<li><code>{cliente}</code>: Nombre del cliente.</li>
<li><code>{monto}</code>: Monto a pagar (incluye el símbolo "S/").</li>
<li><code>{direccion}</code>: Dirección de entrega.</li>
</ul>
</p>
<form action="save_whatsapp_template.php" method="post">
<input type="hidden" name="template_name" value="whatsapp_template_contraentrega">
<div class="form-group">
<textarea class="form-control" id="whatsapp_template_contraentrega" name="template_content" rows="4"><?php echo htmlspecialchars($whatsapp_template_contraentrega); ?></textarea>
</div>
</div>
<button type="submit" class="btn btn-primary mt-2">Guardar Plantilla</button>
</form>
</div>
</div>

View File

@ -59,7 +59,7 @@ if ($user_role === 'Asesor') {
}
// Define los estados de los pedidos
$estados = ['ROTULADO 📦', 'EN TRANSITO 🚛', 'EN DESTINO 🏬', 'COMPLETADO ✅'];
$estados = ['ROTULADO 📦', 'EN TRANSITO 🚛', 'EN DESTINO 🏬', 'COMPLETADO ✅', 'Ruta Contraentrega'];
$asesor_data = [];
$chart_data = [];

View File

@ -99,6 +99,15 @@ $stmt = $pdo->prepare($sql);
$stmt->execute($params);
$pedidos = $stmt->fetchAll();
// Obtener el template de WhatsApp para contraentrega
$stmt_template = db()->prepare('SELECT valor FROM configuracion WHERE clave = ?');
$stmt_template->execute(['whatsapp_template_contraentrega']);
$whatsapp_template = $stmt_template->fetchColumn();
if ($whatsapp_template === false) {
// Fallback to a default message if not set in DB
$whatsapp_template = 'Hola, te escribo para confirmar que tu pedido ya llegó a destino. El monto que debes es {monto} y la dirección de entrega será {direccion}.';
}
$months = [
1 => 'Enero', 2 => 'Febrero', 3 => 'Marzo', 4 => 'Abril', 5 => 'Mayo', 6 => 'Junio',
7 => 'Julio', 8 => 'Agosto', 9 => 'Septiembre', 10 => 'Octubre', 11 => 'Noviembre', 12 => 'Diciembre'
@ -197,9 +206,24 @@ include 'layout_header.php';
if (strlen($celular) == 9 && substr($celular, 0, 1) == '9') {
$whatsapp_number = '51' . $celular;
}
$monto_debe = htmlspecialchars($pedido['monto_debe']);
$monto_formateado = 'S/' . $monto_debe;
$direccion = htmlspecialchars($pedido['direccion_exacta'] ?? 'N/A');
$cliente = htmlspecialchars($pedido['nombre_completo']);
// Reemplazar placeholders en la plantilla
$mensaje = str_replace(
['{cliente}', '{monto}', '{direccion}'],
[$cliente, $monto_formateado, $direccion],
$whatsapp_template
);
$mensaje_encoded = urlencode($mensaje);
$whatsapp_url = 'https://wa.me/' . $whatsapp_number . '?text=' . $mensaje_encoded;
echo $celular;
echo ' <a href="https://wa.me/' . $whatsapp_number . '" target="_blank" rel="noopener noreferrer" style="text-decoration: none;">';
echo ' <a href="' . $whatsapp_url . '" target="_blank" rel="noopener noreferrer" style="text-decoration: none;">';
echo '<i class="fab fa-whatsapp" style="color: green; font-size: 1.5em; vertical-align: middle;"></i>';
echo '</a>';
} else {

View File

@ -0,0 +1,44 @@
<?php
require_once 'db/config.php';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$template_name = $_POST['template_name'] ?? '';
$template_content = $_POST['template_content'] ?? '';
if (!empty($template_name)) { // Allow empty content to reset
try {
// Check if the config exists
$stmt = db()->prepare("SELECT id FROM configuracion WHERE nombre_config = ?");
$stmt->execute([$template_name]);
$exists = $stmt->fetchColumn();
if ($exists) {
// Update
$update_stmt = db()->prepare("UPDATE configuracion SET valor_config = ? WHERE nombre_config = ?");
$update_stmt->execute([$template_content, $template_name]);
} else {
// Insert
$insert_stmt = db()->prepare("INSERT INTO configuracion (nombre_config, valor_config) VALUES (?, ?)");
$insert_stmt->execute([$template_name, $template_content]);
}
// Redirect back to configuration page with a success message
header('Location: configuracion.php?success=1');
exit;
} catch (PDOException $e) {
// Handle DB error
header('Location: configuracion.php?error=db');
exit;
}
} else {
// Handle empty fields
header('Location: configuracion.php?error=empty');
exit;
}
} else {
// Redirect if not a POST request
header('Location: configuracion.php');
exit;
}
?>