feat(branding): estandarizar a Pacific Trans GO, remover boton header apk, filtrar notificaciones por usuario y actualizar boton descarga

This commit is contained in:
AI Bot 2026-10-14 10:05:50 -05:00
parent c14c49c229
commit 94653861a0
14 changed files with 263 additions and 146 deletions

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="app_name">Pacifictrans Go</string>
<string name="title_activity_main">Pacifictrans Go</string>
<string name="app_name">Pacific Trans GO</string>
<string name="title_activity_main">Pacific Trans GO</string>
<string name="package_name">co.pacifictrans.go</string>
<string name="custom_url_scheme">co.pacifictrans.go</string>
</resources>

View File

@ -2,7 +2,7 @@ import type { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = {
appId: 'co.pacifictrans.go',
appName: 'Pacifictrans Go',
appName: 'Pacific Trans GO',
webDir: 'public',
server: {
url: 'https://pacifictrans.almeira.com.co',

View File

@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
<title>Pacifictrans Go</title>
<title>Pacific Trans GO</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
@ -45,7 +45,7 @@
</head>
<body>
<div class="logo">🚗</div>
<h1>Pacifictrans Go</h1>
<h1>Pacific Trans GO</h1>
<p>Conectando con la Central de Despacho Cali - Buenaventura...</p>
<div class="spinner"></div>

View File

@ -68,20 +68,19 @@ def main():
except Exception as e:
print(f" [Aviso]: Verificación HEAD: {e}", flush=True)
print("[4/4] Enviando notificación de Pacifictrans Go a WhatsApp (+57 316 745 5877)...", flush=True)
print("[4/4] Enviando notificación de Pacific Trans GO a WhatsApp (+57 316 745 5877)...", flush=True)
text_msg = (
"👑 *Pacifictrans Go: Superadministrador Permanente, Seguridad 2FA OTP & Gestión de Administradores*\n\n"
"¡Hola Carlos! Se ha actualizado la plataforma con el nuevo esquema de seguridad y control de acceso:\n\n"
"📱 *App Oficial:* `Pacifictrans Go`\n"
"📦 *Archivo APK:* `PacifictransGo.apk` (3.57 MB - APK Nativo e Independiente)\n"
"🆔 *Package ID:* `co.pacifictrans.go` (100% independiente de DripZone)\n\n"
"⚡ *Novedades de la Versión:*\n"
"• 📱 *App Totalmente Independiente:* Se recompiló el APK nativo con su propio Package ID (`co.pacifictrans.go`). Ya no sobreescribe ni interfiere con DripZone; ambas aplicaciones conviven por separado con sus propios íconos y datos.\n"
"• 👑 *Superadministrador Exclusivo (+57 316 745 5877):* Tu número personal es el único reconocido con rol de Superadministrador inmutable en MongoDB. Es permanente y no puede ser borrado, inactivado ni degradado bajo ninguna circunstancia.\n"
"• 🔐 *Acceso Obligatorio con Token / OTP WhatsApp:* El acceso administrativo siempre exige validación del código OTP 2FA de 6 dígitos enviado a tu WhatsApp personal. Se bloquearon accesos rápidos sin código para garantizar total seguridad.\n"
"• 👥 *Sub-panel de Gestión de Administradores:* En la Sub-pestaña 5 del Panel Administrativo, puedes registrar nuevos administradores u operadores, editar sus datos y roles, activarlos o inactivarlos en tiempo real, o removerlos del sistema.\n"
"• 👤 *Actualización de Información Personal:* Los usuarios pueden actualizar Nombre, C.C., Correo, Dirección y Ciudad. El número celular de registro permanece bloqueado e inmutable para preservar su identidad 2FA OTP.\n\n"
"👑 *Pacific Trans GO: Actualización de Branding, Notificaciones por Usuario & Descarga de App*\n\n"
"¡Hola Carlos! Se ha completado y desplegado la actualización solicitada para la plataforma:\n\n"
"📱 *App Oficial:* `Pacific Trans GO`\n"
"📦 *Archivo APK:* `PacifictransGo.apk` (7.07 MB - APK Nativo e Independiente)\n"
"🆔 *Package ID:* `co.pacifictrans.go` (Etiqueta oficial: Pacific Trans GO)\n\n"
"⚡ *Ajustes Implementados:*\n"
"• 🚫 *Botón Superior Removido:* Se eliminó el botón 'APK Android' de la barra superior de navegación para un diseño más limpio y despejado.\n"
"• 🔔 *Notificaciones y Mensajes por Usuario:* El centro de notificaciones y badge de mensajes pendientes ahora filtra y muestra únicamente los eventos correspondientes al usuario en sesión (+57...). Si no hay sesión activa, muestra 0 y solicita inicio de sesión seguro.\n"
"• 🏷️ *Branding Unificado:* Todos los textos de la plataforma, web, notificaciones de WhatsApp Evolution, recibos Bre-B y la app nativa ahora se presentan con el nombre oficial: *Pacific Trans GO*.\n"
"• 📥 *Botón Inferior 'Descargar App':* El botón principal de descarga al final de la página ahora muestra el texto exacto: *Descargar App*.\n\n"
f"🔗 *Enlace de Descarga Directa:*\n👉 {APK_URL}"
)
@ -104,7 +103,7 @@ def main():
"mediatype": "document",
"mimetype": "application/vnd.android.package-archive",
"fileName": "PacifictransGo.apk",
"caption": "📦 *PacifictransGo.apk* - App Oficial Pacifictrans Go",
"caption": "📦 *PacifictransGo.apk* - App Oficial Pacific Trans GO",
"media": APK_URL
}).encode("utf-8"),
headers={"apikey": EVOLUTION_API_KEY, "Content-Type": "application/json"}

View File

@ -3,9 +3,9 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Pacifictrans Go | Transporte Especial & Mensajería Cali - Buenaventura</title>
<title>Pacific Trans GO | Transporte Especial & Mensajería Cali - Buenaventura</title>
<meta name="description" content="Plataforma tecnológica de transporte especial intermunicipal y mensajería en el corredor Cali - Buenaventura. Agrupación inteligente de 4 pasajeros, Waze TSP y pagos 100% seguros con Bold.">
<meta property="og:title" content="Pacifictrans Go - Corredor Cali ↔ Buenaventura">
<meta property="og:title" content="Pacific Trans GO - Corredor Cali ↔ Buenaventura">
<meta property="og:description" content="Servicio puerta a puerta de 4 cupos y paquetería express. Monitoreo satelital y conductores asignados por cercanía de residencia.">
<meta property="og:type" content="website">
<meta name="theme-color" content="#080c14">
@ -14,7 +14,7 @@
<link rel="manifest" href="/manifest.json">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="apple-mobile-web-app-title" content="Pacifictrans Go">
<meta name="apple-mobile-web-app-title" content="Pacific Trans GO">
<link rel="apple-touch-icon" href="/icons/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="180x180" href="/icons/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="192x192" href="/icons/icon-192.png">
@ -33,7 +33,7 @@
<a href="#" class="brand">
<div class="brand-badge">P</div>
<div class="brand-text">
<h1 class="brand-title">Pacifictrans <span>Go</span></h1>
<h1 class="brand-title">Pacific Trans <span>GO</span></h1>
<span>Cali ↔ Buenaventura</span>
</div>
</a>
@ -77,7 +77,7 @@
<path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"></path>
<path d="M13.73 21a2 2 0 0 1-3.46 0"></path>
</svg>
<span class="notif-badge" id="notif-unread-count">3</span>
<span class="notif-badge" id="notif-unread-count" style="display: none;">0</span>
</button>
<!-- Dropdown de Notificaciones -->
@ -85,7 +85,7 @@
<div class="notif-header">
<div style="display: flex; align-items: center; gap: 0.5rem;">
<strong>🔔 Notificaciones</strong>
<span class="notif-header-badge" id="notif-header-unread">3 nuevas</span>
<span class="notif-header-badge" id="notif-header-unread" style="display: none;">0 nuevas</span>
</div>
<button type="button" class="btn-mark-all-read" id="btn-mark-all-read">Marcar leídas</button>
</div>
@ -102,12 +102,6 @@
</div>
</div>
<a href="/PacifictransGo.apk" class="btn-apk-header" id="btn-download-header">
<svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor">
<path d="M17.523 15.3414c-.5511 0-.9993-.4486-.9993-1.0001s.4482-1.0001.9993-1.0001c.552 0 1.0001.4486 1.0001 1.0001s-.4481 1.0001-1.0001 1.0001m-11.046 0c-.5511 0-.9993-.4486-.9993-1.0001s.4482-1.0001.9993-1.0001c.552 0 1.0001.4486 1.0001 1.0001s-.4481 1.0001-1.0001 1.0001m11.4045-6.02l1.997-3.4589c.1408-.2439.0573-.5552-.1866-.696-.2438-.1408-.5551-.0573-.696.1866l-2.0238 3.5054c-1.5037-.6873-3.1979-1.0772-4.9691-1.0772s-3.4654.3899-4.9691 1.0772l-2.0238-3.5054c-.1409-.2439-.4522-.3274-.696-.1866-.2439.1408-.3274.4521-.1866.696l1.997 3.4589c-3.7997 2.0623-6.375 5.9863-6.446 10.5369h24.646c-.071-4.5506-2.6463-8.4746-6.446-10.5369"/>
</svg>
APK Android
</a>
</nav>
</header>
@ -166,7 +160,7 @@
<div class="hero-visual">
<div class="visual-container">
<img src="/images/hero-banner.jpg" alt="Pacifictrans Go Cali Buenaventura" class="hero-image">
<img src="/images/hero-banner.jpg" alt="Pacific Trans GO Cali Buenaventura" class="hero-image">
<div class="floating-pool-card">
<div class="pool-status-row">
@ -387,7 +381,7 @@
<div style="flex: 1;">
<h4 style="color: #38bdf8; font-size: 1.15rem; margin-bottom: 0.4rem;" id="alert-title">¡Reserva de Cupos Confirmada!</h4>
<p style="color: #cbd5e1; font-size: 0.92rem; margin-bottom: 0.75rem;" id="alert-message">
Tu reserva ha sido procesada exitosamente en el sistema de pooling inteligente de Pacifictrans Go.
Tu reserva ha sido procesada exitosamente en el sistema de pooling inteligente de Pacific Trans GO.
</p>
<div id="alert-passengers-breakdown" style="margin-bottom: 0.75rem; font-size: 0.88rem; color: #e2e8f0;"></div>
<div id="alert-bold-payment-area" style="display: none; margin-top: 1rem;"></div>
@ -633,7 +627,7 @@
<section class="download-card" id="descarga-apk">
<div>
<span style="color: #22c55e; font-weight: 700; text-transform: uppercase; font-size: 0.8rem; letter-spacing: 0.08em;">App Oficial Android</span>
<h3 style="font-size: 2.2rem; color: #fff; margin-top: 0.25rem; margin-bottom: 0.75rem;">Pacifictrans Go Móvil</h3>
<h3 style="font-size: 2.2rem; color: #fff; margin-top: 0.25rem; margin-bottom: 0.75rem;">Pacific Trans GO Móvil</h3>
<p style="color: var(--text-muted); max-width: 500px; font-size: 1rem;">
Instala la aplicación nativa en tu dispositivo Android. Accede a navegación por Waze en un toque, pagos instantáneos con Bold y seguimiento en vivo de tu viaje.
</p>
@ -643,7 +637,7 @@
<svg width="28" height="28" viewBox="0 0 24 24" fill="currentColor">
<path d="M17.523 15.3414c-.5511 0-.9993-.4486-.9993-1.0001s.4482-1.0001.9993-1.0001c.552 0 1.0001.4486 1.0001 1.0001s-.4481 1.0001-1.0001 1.0001m-11.046 0c-.5511 0-.9993-.4486-.9993-1.0001s.4482-1.0001.9993-1.0001c.552 0 1.0001.4486 1.0001 1.0001s-.4481 1.0001-1.0001 1.0001m11.4045-6.02l1.997-3.4589c.1408-.2439.0573-.5552-.1866-.696-.2438-.1408-.5551-.0573-.696.1866l-2.0238 3.5054c-1.5037-.6873-3.1979-1.0772-4.9691-1.0772s-3.4654.3899-4.9691 1.0772l-2.0238-3.5054c-.1409-.2439-.4522-.3274-.696-.1866-.2439.1408-.3274.4521-.1866.696l1.997 3.4589c-3.7997 2.0623-6.375 5.9863-6.446 10.5369h24.646c-.071-4.5506-2.6463-8.4746-6.446-10.5369"/>
</svg>
Descargar PacifictransGo.apk (37.1 MB)
Descargar App
</a>
</section>
</div>
@ -799,7 +793,7 @@
</button>
</div>
<p style="color: var(--text-muted); font-size: 0.88rem; margin-bottom: 1.25rem;">
Las notificaciones operativas se separan por grupos en WhatsApp: las de Pacifictrans Go se dirigen automáticamente al grupo <strong>Pacific Trans Notificaciones</strong> y las de Dripzone al grupo <strong>Dripzone Notificaciones</strong>.
Las notificaciones operativas se separan por grupos en WhatsApp: las de Pacific Trans GO se dirigen automáticamente al grupo <strong>Pacific Trans Notificaciones</strong> y las de Dripzone al grupo <strong>Dripzone Notificaciones</strong>.
</p>
<div class="grid-2col" style="gap: 1.25rem; margin-bottom: 1rem;">
@ -823,7 +817,7 @@
</div>
<div class="form-group" style="margin-bottom: 0;">
<label class="form-label" for="cfg-admin-name">Nombre del Canal de Atención</label>
<input type="text" class="form-input" id="cfg-admin-name" value="Atención Pacifictrans Go" placeholder="Atención Pacifictrans Go" required>
<input type="text" class="form-input" id="cfg-admin-name" value="Atención Pacific Trans GO" placeholder="Atención Pacific Trans GO" required>
<span style="font-size: 0.75rem; color: var(--text-dim); margin-top: 4px; display: block;">Identificador en enlaces y botones de soporte.</span>
</div>
</div>
@ -856,7 +850,7 @@
<div class="form-group">
<label class="form-label" for="cfg-comision">Comisión de la Plataforma (%)</label>
<input type="number" class="form-input" id="cfg-comision" value="15" min="0" max="50" step="1" required>
<span style="font-size: 0.75rem; color: var(--text-dim); margin-top: 4px; display: block;">Porcentaje retenido por Pacifictrans Go sobre cada servicio completado.</span>
<span style="font-size: 0.75rem; color: var(--text-dim); margin-top: 4px; display: block;">Porcentaje retenido por Pacific Trans GO sobre cada servicio completado.</span>
</div>
</div>
@ -945,7 +939,7 @@
<span style="font-size: 0.72rem; color: #94a3b8;">Cobrado en Mano por Chofer</span>
</div>
<div class="fin-metric-card" style="border-top: 3px solid #10b981;">
<div class="fin-metric-label">Comisión Pacifictrans (15%)</div>
<div class="fin-metric-label">Comisión Pacific Trans GO (15%)</div>
<div class="fin-metric-val" id="metric-comision-total" style="color: #34d399;">$0</div>
<span style="font-size: 0.72rem; color: #94a3b8;">Ingresos Operativos</span>
</div>
@ -1329,7 +1323,7 @@
<div class="security-shield-icon">🚗</div>
<h2 style="color: #fff; font-size: 1.5rem; margin-bottom: 0.5rem;">Portal Exclusivo para Conductores Vinculados</h2>
<p style="color: #cbd5e1; font-size: 0.95rem; margin-bottom: 1.5rem;">
Esta consola está reservada para choferes registrados en la flota de Pacifictrans Go. Inicia sesión con tu número de conductor para acceder a tu billetera y transferencias Bre-B.
Esta consola está reservada para choferes registrados en la flota de Pacific Trans GO. Inicia sesión con tu número de conductor para acceder a tu billetera y transferencias Bre-B.
</p>
<div style="display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap;">
<button type="button" class="btn-primary" id="btn-gate-driver-login" style="width: auto; padding: 0.75rem 1.75rem;">
@ -1612,7 +1606,7 @@
<footer class="footer">
<div style="max-width: 1280px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem;">
<div>
<strong style="color: #fff;">Pacifictrans Go</strong> — Transporte Especial Cali - Buenaventura
<strong style="color: #fff;">Pacific Trans GO</strong> — Transporte Especial Cali - Buenaventura
</div>
<div>
Atención y Soporte WhatsApp: <a id="footer-support-link" href="https://wa.me/573167455877" target="_blank" style="color: var(--accent-cyan); text-decoration: none;"><span id="footer-support-phone">+57 316 745 5877</span></a>
@ -1739,7 +1733,7 @@
Calificar Experiencia de Viaje
</h3>
<p style="color: var(--text-muted); font-size: 0.88rem;">
Tu reseña ayuda a mantener los más altos estándares de calidad y seguridad en Pacifictrans Go.
Tu reseña ayuda a mantener los más altos estándares de calidad y seguridad en Pacific Trans GO.
</p>
</div>
@ -1795,7 +1789,7 @@
<div style="text-align: center; margin-bottom: 1.5rem;">
<span style="font-size: 2.2rem;">📲</span>
<h3 style="font-size: 1.4rem; color: #fff; margin-top: 0.35rem; margin-bottom: 0.25rem;">
Instalar Pacifictrans Go en tu Móvil
Instalar Pacific Trans GO en tu Móvil
</h3>
<p style="color: var(--text-muted); font-size: 0.88rem;">
Accede instantáneamente sin barras de navegación y con soporte offline.
@ -1843,7 +1837,7 @@
🤖 Instalar en Android
</button>
<a href="/PacifictransGo.apk" class="btn-primary" style="width: auto; padding: 0.65rem 1.25rem; background: rgba(255,255,255,0.08); color: #fff; border: 1px solid var(--border-glass);">
Descargar APK (37.1 MB)
Descargar App
</a>
</div>
</div>
@ -1887,7 +1881,7 @@
</div>
<div class="receipt-row">
<span class="receipt-label">Entidad Emisora:</span>
<span class="receipt-val">Pacifictrans Go (Bre-B BanRep)</span>
<span class="receipt-val">Pacific Trans GO (Bre-B BanRep)</span>
</div>
<div class="receipt-row">
<span class="receipt-label">Entidad Receptora:</span>

View File

@ -1,4 +1,4 @@
22// Pacifictrans Go - Interactive Web Platform Logic
// Pacific Trans GO - Interactive Web Platform Logic
let currentTariffs = {
tarifaPasajeroFija: 35000,
precioBasePaquete: 25000,
@ -9,7 +9,7 @@ let currentTariffs = {
costoPenalidadCancelacion: 15000,
radioMaxPoolingMetros: 4000,
numeroAtencionWhatsApp: '573167455877',
nombreSoporte: 'Atención Pacifictrans Go'
nombreSoporte: 'Atención Pacific Trans GO'
};
let currentUser = null;
@ -624,7 +624,7 @@ function initAuthSystem() {
currentUser = data.user;
updateUserUI(currentUser);
modal.classList.remove('active');
alert(`¡Bienvenido a Pacifictrans Go, ${currentUser.nombre}! Tu identidad ha sido verificada con éxito.`);
alert(`¡Bienvenido a Pacific Trans GO, ${currentUser.nombre}! Tu identidad ha sido verificada con éxito.`);
} else {
showError(verError, data.error || 'Código incorrecto. Verifica los 6 dígitos.');
}
@ -808,6 +808,11 @@ function updateUserUI(user) {
window.showView(hash === '#admin' ? 'admin' : 'driver');
}
}
// Actualizar notificaciones para el usuario actual (o limpiar si cerró sesión)
if (typeof window.renderUserNotifications === 'function') {
window.renderUserNotifications();
}
}
function showError(el, msg) {
@ -836,7 +841,7 @@ function initLeafletRadarMap() {
// Capa de Mapa Estándar OpenStreetMap
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 18,
attribution: '© OpenStreetMap contributors • Pacifictrans Go GPS'
attribution: '© OpenStreetMap contributors • Pacific Trans GO GPS'
}).addTo(leafletMap);
// Línea poligonal oficial de la Carretera Vía al Mar (Ruta 40)
@ -1178,7 +1183,7 @@ function syncTariffsToUI() {
const footerPhoneEl = document.getElementById('footer-support-phone');
const footerLinkEl = document.getElementById('footer-support-link');
if (footerPhoneEl) footerPhoneEl.textContent = phoneFormatted;
if (footerLinkEl) footerLinkEl.href = `https://wa.me/${cleanPhone}?text=Hola%20Pacifictrans%20Go,%20deseo%20informaci%C3%B3n%20sobre%20un%20servicio`;
if (footerLinkEl) footerLinkEl.href = `https://wa.me/${cleanPhone}?text=Hola%20Pacific%20Trans%20GO,%20deseo%20informaci%C3%B3n%20sobre%20un%20servicio`;
// 3. Precios en módulo de reservas de pasajeros
if (window.updatePassengerBookingSummary) {
@ -1246,7 +1251,7 @@ function initTariffsManager() {
badgeDrip.style.color = '#34d399';
}
alert(`✅ Detección exitosa en WhatsApp Evolution:\n\n• Pacifictrans Go ➔ ${data.pacificTrans?.groupName} (${data.pacificTrans?.resolvedJid})\n• Dripzone ➔ ${data.dripzone?.groupName} (${data.dripzone?.resolvedJid})`);
alert(`✅ Detección exitosa en WhatsApp Evolution:\n\n• Pacific Trans GO ➔ ${data.pacificTrans?.groupName} (${data.pacificTrans?.resolvedJid})\n• Dripzone ➔ ${data.dripzone?.groupName} (${data.dripzone?.resolvedJid})`);
} else {
alert('No se pudieron consultar los grupos: ' + (data.error || 'Verifica la sesión'));
}
@ -1284,7 +1289,7 @@ function initTariffsManager() {
costoPenalidadCancelacion: parseFloat(document.getElementById('cfg-penalidad')?.value || '15000'),
radioMaxPoolingMetros: parseFloat(document.getElementById('cfg-radio-pooling')?.value || '4000'),
numeroAtencionWhatsApp: document.getElementById('cfg-admin-phone')?.value.trim() || '573167455877',
nombreSoporte: document.getElementById('cfg-admin-name')?.value.trim() || 'Atención Pacifictrans Go',
nombreSoporte: document.getElementById('cfg-admin-name')?.value.trim() || 'Atención Pacific Trans GO',
grupoWhatsAppPacificTrans: document.getElementById('cfg-group-pacifictrans')?.value.trim() || 'Pacific Trans Notificaciones',
grupoWhatsAppDripzone: document.getElementById('cfg-group-dripzone')?.value.trim() || 'Dripzone Notificaciones'
};
@ -1801,6 +1806,17 @@ function initPassengerCalculator() {
alertBox.scrollIntoView({ behavior: 'smooth' });
}
if (typeof window.addUserNotification === 'function' && currentUser) {
window.addUserNotification({
id: `trip-${data.tripId || Date.now()}`,
icon: '🚗',
title: `¡Reserva Confirmada! (${selectedSeats} Cupo${selectedSeats > 1 ? 's' : ''})`,
desc: `Viaje #${data.tripId?.slice(-6) || ''} en ruta ${payload.sentido === 'CALI_A_BUENAVENTURA' ? 'Cali ➔ Buenaventura' : 'Buenaventura ➔ Cali'}. Conductor y ruta asignados.`,
time: 'Hace un momento',
unread: true
}, currentUser);
}
const formattedTotal = `$${(selectedSeats * (currentTariffs.tarifaPasajeroFija || 35000)).toLocaleString('es-CO')} COP`;
bookBtn.innerHTML = `✅ ${selectedSeats} Cupo(s) Confirmado(s) (${formattedTotal})`;
} else {
@ -2027,6 +2043,17 @@ function initFreightCalculator() {
} else {
alert(`✅ Guía generada correctamente: #${data.guiaSeguimiento}`);
}
if (typeof window.addUserNotification === 'function' && currentUser) {
window.addUserNotification({
id: `encomienda-${data.guiaSeguimiento || Date.now()}`,
icon: '📦',
title: `Guía Encomienda #${data.guiaSeguimiento || 'PT'} Generada`,
desc: `Envío ${payload.sentido === 'CALI_A_BUENAVENTURA' ? 'Cali ➔ Buenaventura' : 'Buenaventura ➔ Cali'} registrado con tarifa $${(data.tarifaFinal || data.tarifaCalculada || 0).toLocaleString('es-CO')} COP. Seguimiento satelital activo.`,
time: 'Hace un momento',
unread: true
}, currentUser);
}
} else {
alert('Error al generar envío: ' + (data.error || 'Verifica los datos'));
}
@ -2042,89 +2069,185 @@ function initFreightCalculator() {
}
/* ==========================================================================
9. CENTRO DE NOTIFICACIONES & CONTADOR DE MENSAJES PENDIENTES
9. CENTRO DE NOTIFICACIONES & CONTADOR DE MENSAJES PENDIENTES (FILTRADO POR USUARIO)
========================================================================== */
function initNotificationsSystem() {
const btnBell = document.getElementById('btn-toggle-notifs');
const dropdown = document.getElementById('notif-dropdown-panel');
const badge = document.getElementById('notif-unread-count');
const headerUnread = document.getElementById('notif-header-unread');
const listEl = document.getElementById('notif-items-list');
const btnMarkAll = document.getElementById('btn-mark-all-read');
const waLink = document.getElementById('notif-wa-link');
function getUserNotificationsStorageKey(user) {
if (!user) return null;
const phone = (user.telefono || user.id || user._id || '').toString().replace(/\D/g, '');
return phone ? `pt_notifications_${phone}` : `pt_notifications_user_${user._id || user.id}`;
}
const defaultNotifs = [
function getInitialUserNotifications(user) {
const firstName = (user.nombre || 'Usuario').split(' ')[0];
const notifs = [
{
id: '1',
id: `welcome-${Date.now()}-1`,
icon: '🚗',
title: '¡Cupo 4/4 Completado!',
desc: 'Tu viaje Cali ➔ Buenaventura tiene conductor asignado (Mario Fernando G.). Recogida escalonada y ruta Waze TSP activa.',
time: 'Hace 5 min',
title: `¡Bienvenido a Pacific Trans GO, ${firstName}!`,
desc: `Tu cuenta está activa para reservar viajes puerta a puerta y enviar encomiendas entre Cali y Buenaventura.`,
time: 'Hace un momento',
unread: true
},
{
id: '2',
icon: '📦',
title: 'Encomienda en Ruta 40',
desc: 'Guía #PT-8921 despachada desde Cali con destino a Buenaventura. Seguimiento satelital en vivo.',
time: 'Hace 25 min',
unread: true
},
{
id: '3',
id: `sec-${Date.now()}-2`,
icon: '🛡️',
title: 'Identidad Verificada 2FA',
desc: 'Tu cuenta ha sido validada con WhatsApp OTP. Viajes y envíos 100% seguros y respaldados.',
time: 'Hace 1 hora',
desc: `Tu número (+${user.telefono || ''}) está validado con OTP. Tus viajes y pagos están 100% protegidos.`,
time: 'Hace un momento',
unread: true
}
];
let stored = localStorage.getItem('pt_notifications');
let notifications = stored ? JSON.parse(stored) : defaultNotifs;
if (user.esSuperAdmin || user.rol === 'ADMIN') {
notifs.unshift({
id: `admin-${Date.now()}-0`,
icon: '👑',
title: 'Acceso Administrativo Habilitado',
desc: 'Tienes permisos autorizados para configurar tarifas, bonos de descuento y gestionar administradores.',
time: 'Hace un momento',
unread: true
});
} else if (user.rol === 'CONDUCTOR') {
notifs.unshift({
id: `driver-${Date.now()}-0`,
icon: '💳',
title: 'Billetera Conductor Bre-B Activa',
desc: 'Tu cuenta de chofer está habilitada para recibir transferencias de compensación inmediata 24/7.',
time: 'Hace un momento',
unread: true
});
}
function saveAndRender() {
localStorage.setItem('pt_notifications', JSON.stringify(notifications));
const unreadCount = notifications.filter(n => n.unread).length;
return notifs;
}
function renderUserNotifications() {
const badge = document.getElementById('notif-unread-count');
const headerUnread = document.getElementById('notif-header-unread');
const listEl = document.getElementById('notif-items-list');
const waLink = document.getElementById('notif-wa-link');
if (waLink && currentTariffs.numeroAtencionWhatsApp) {
const clean = currentTariffs.numeroAtencionWhatsApp.replace(/\D/g, '');
waLink.href = `https://wa.me/${clean}?text=Hola%20Central%20de%20Despacho%20Pacific%20Trans%20GO`;
}
// Si no hay usuario autenticado, no mostrar notificaciones de otros usuarios
if (!currentUser) {
if (badge) {
badge.textContent = unreadCount;
badge.style.display = unreadCount > 0 ? 'flex' : 'none';
badge.textContent = '0';
badge.style.display = 'none';
}
if (headerUnread) {
headerUnread.textContent = `${unreadCount} nuevas`;
headerUnread.style.display = unreadCount > 0 ? 'inline-block' : 'none';
headerUnread.textContent = '0 nuevas';
headerUnread.style.display = 'none';
}
if (listEl) {
if (notifications.length === 0) {
listEl.innerHTML = '<div style="padding: 1.5rem; text-align: center; color: #64748b; font-size: 0.88rem;">No tienes notificaciones pendientes.</div>';
} else {
listEl.innerHTML = notifications.map(n => `
<div class="notif-item ${n.unread ? 'unread' : ''}" data-id="${n.id}">
<div class="notif-item-icon">${n.icon}</div>
<div class="notif-item-content">
<div class="notif-item-title">${n.title}</div>
<div class="notif-item-desc">${n.desc}</div>
<div class="notif-item-time">${n.time}</div>
</div>
</div>
`).join('');
listEl.innerHTML = `
<div style="padding: 1.75rem 1rem; text-align: center; color: #94a3b8; font-size: 0.88rem;">
<div style="font-size: 1.8rem; margin-bottom: 0.5rem;">🔒</div>
<p style="margin: 0 0 0.75rem 0; color: #cbd5e1; font-weight: 500;">
Inicia sesión con tu celular para ver tus notificaciones y mensajes pendientes.
</p>
<button type="button" class="btn-primary" style="display: inline-block; padding: 0.45rem 1.1rem; font-size: 0.82rem; margin: 0 auto;" onclick="document.getElementById('btn-open-auth-modal')?.click()">
Iniciar Sesión
</button>
</div>
`;
}
return;
}
listEl.querySelectorAll('.notif-item').forEach(item => {
item.addEventListener('click', () => {
const id = item.getAttribute('data-id');
const target = notifications.find(n => n.id === id);
if (target) {
target.unread = false;
saveAndRender();
}
});
// Usuario autenticado: cargar únicamente sus notificaciones
const key = getUserNotificationsStorageKey(currentUser);
let notifs = [];
try {
const raw = localStorage.getItem(key);
if (raw) {
notifs = JSON.parse(raw);
} else {
notifs = getInitialUserNotifications(currentUser);
localStorage.setItem(key, JSON.stringify(notifs));
}
} catch (e) {
notifs = getInitialUserNotifications(currentUser);
}
const unreadCount = notifs.filter(n => n.unread).length;
if (badge) {
badge.textContent = unreadCount;
badge.style.display = unreadCount > 0 ? 'flex' : 'none';
}
if (headerUnread) {
headerUnread.textContent = `${unreadCount} nuevas`;
headerUnread.style.display = unreadCount > 0 ? 'inline-block' : 'none';
}
if (listEl) {
if (notifs.length === 0) {
listEl.innerHTML = '<div style="padding: 1.5rem; text-align: center; color: #64748b; font-size: 0.88rem;">No tienes notificaciones pendientes.</div>';
} else {
listEl.innerHTML = notifs.map(n => `
<div class="notif-item ${n.unread ? 'unread' : ''}" data-id="${n.id}">
<div class="notif-item-icon">${n.icon || '🔔'}</div>
<div class="notif-item-content">
<div class="notif-item-title">${n.title}</div>
<div class="notif-item-desc">${n.desc}</div>
<div class="notif-item-time">${n.time}</div>
</div>
</div>
`).join('');
listEl.querySelectorAll('.notif-item').forEach(item => {
item.addEventListener('click', () => {
const id = item.getAttribute('data-id');
const target = notifs.find(n => n.id === id);
if (target && target.unread) {
target.unread = false;
localStorage.setItem(key, JSON.stringify(notifs));
renderUserNotifications();
}
});
}
});
}
}
}
window.renderUserNotifications = renderUserNotifications;
window.addUserNotification = function (notification, targetUser) {
const u = targetUser || currentUser;
if (!u) return;
const key = getUserNotificationsStorageKey(u);
if (!key) return;
let list = [];
try {
const raw = localStorage.getItem(key);
list = raw ? JSON.parse(raw) : getInitialUserNotifications(u);
} catch (e) {
list = [];
}
list.unshift({
id: notification.id || `notif-${Date.now()}`,
icon: notification.icon || '🚗',
title: notification.title,
desc: notification.desc,
time: notification.time || 'Hace un momento',
unread: true
});
if (list.length > 20) list = list.slice(0, 20);
localStorage.setItem(key, JSON.stringify(list));
if (currentUser && (currentUser.telefono === u.telefono || currentUser._id === u._id)) {
renderUserNotifications();
}
};
function initNotificationsSystem() {
const btnBell = document.getElementById('btn-toggle-notifs');
const dropdown = document.getElementById('notif-dropdown-panel');
const btnMarkAll = document.getElementById('btn-mark-all-read');
if (btnBell && dropdown) {
btnBell.addEventListener('click', (e) => {
@ -2141,18 +2264,19 @@ function initNotificationsSystem() {
if (btnMarkAll) {
btnMarkAll.addEventListener('click', () => {
notifications.forEach(n => { n.unread = false; });
saveAndRender();
if (!currentUser) return;
const key = getUserNotificationsStorageKey(currentUser);
if (!key) return;
try {
let notifs = JSON.parse(localStorage.getItem(key) || '[]');
notifs.forEach(n => { n.unread = false; });
localStorage.setItem(key, JSON.stringify(notifs));
renderUserNotifications();
} catch (e) {}
});
}
// Sincronizar enlace de WhatsApp con el número configurado dinámicamente
if (waLink && currentTariffs.numeroAtencionWhatsApp) {
const clean = currentTariffs.numeroAtencionWhatsApp.replace(/\D/g, '');
waLink.href = `https://wa.me/${clean}?text=Hola%20Central%20de%20Despacho%20Pacifictrans%20Go`;
}
saveAndRender();
renderUserNotifications();
}
/* ==========================================================================
@ -2211,7 +2335,7 @@ function initSettlementsAndBreBSystem() {
`🏦 *Entidad Destino:* ${receipt.entidadDestino}\n` +
`🔑 *Llave:* ${receipt.llaveDestino}\n` +
`💸 *Comisión:* $0 COP (Bre-B Gratuito)\n\n` +
`_Pacifictrans Go • Pagos Seguros en Tiempo Real_`;
`_Pacific Trans GO • Pagos Seguros en Tiempo Real_`;
window.open(`https://wa.me/?text=${encodeURIComponent(text)}`, '_blank');
};
}
@ -2530,7 +2654,7 @@ function initSettlementsAndBreBSystem() {
</div>
<div class="fin-metric-card">
<div class="fin-metric-label">Comisión Pacifictrans (${s.porcentajeComision}%)</div>
<div class="fin-metric-label">Comisión Pacific Trans GO (${s.porcentajeComision}%)</div>
<div class="fin-metric-val" style="color: #ec4899;">$${s.comisionAdmin.toLocaleString('es-CO')}</div>
<span style="font-size: 0.72rem; color: #94a3b8;">Retención Plataforma</span>
</div>

View File

@ -1,6 +1,6 @@
{
"name": "Pacifictrans Go - Cali Buenaventura",
"short_name": "Pacifictrans Go",
"name": "Pacific Trans GO - Cali Buenaventura",
"short_name": "Pacific Trans GO",
"description": "Transporte Especial de Pasajeros y Mensajería Express Cali ↔ Buenaventura",
"start_url": "/",
"id": "/",

View File

@ -1,4 +1,4 @@
// Pacifictrans Go - Service Worker PWA
// Pacific Trans GO - Service Worker PWA
const CACHE_NAME = 'pacifictrans-go-v1';
const STATIC_ASSETS = [
'/',

View File

@ -74,7 +74,7 @@ const server = http.createServer(async (req, res) => {
try {
// 1. Healthcheck
if (pathname === '/api/health' && req.method === 'GET') {
return sendJson(200, { status: 'ONLINE', service: 'Pacifictrans Go API - Transporte & Mensajería Cali - Buenaventura' });
return sendJson(200, { status: 'ONLINE', service: 'Pacific Trans GO API - Transporte & Mensajería Cali - Buenaventura' });
}
// 1.1. Autenticación: Enviar OTP de seguridad por WhatsApp & Email
@ -617,7 +617,7 @@ const server = http.createServer(async (req, res) => {
async function bootstrap() {
// 1. Iniciar servidor HTTP de inmediato para responder 200 OK a Traefik y visitantes
server.listen(PORT, () => {
console.log(`🚀 [Pacifictrans Go] Plataforma Web y API escuchando en puerto ${PORT}`);
console.log(`🚀 [Pacific Trans GO] Plataforma Web y API escuchando en puerto ${PORT}`);
});
// 2. Conectar a MongoDB de forma no bloqueante con reintento automático

View File

@ -80,7 +80,7 @@ const TarifasConfigSchema = new Schema<ITarifasConfig>(
},
nombreSoporte: {
type: String,
default: 'Atención Pacifictrans Go',
default: 'Atención Pacific Trans GO',
trim: true,
},
grupoWhatsAppPacificTrans: {

View File

@ -68,7 +68,7 @@ export class AuthService {
// Disparar mensaje oficial por WhatsApp vía Evolution API
const waText =
`🔐 *PACIFICTRANS GO: CÓDIGO DE SEGURIDAD*\n\n` +
`🔐 *PACIFIC TRANS GO: CÓDIGO DE SEGURIDAD*\n\n` +
`Tu código de verificación de identidad es:\n` +
`👉 *${code}*\n\n` +
`⏱️ _Válido por 5 minutos._\n` +

View File

@ -319,7 +319,7 @@ export class SettlementService {
`• *Total Pasajes del Viaje:* $${resumen.tarifaTotal.toLocaleString('es-CO')} COP\n` +
`• *Recaudado Online por Plataforma:* $${resumen.totalRecaudadoPlataforma.toLocaleString('es-CO')} COP\n` +
`• *Recaudado en Efectivo por Ti:* $${resumen.totalRecaudadoEfectivo.toLocaleString('es-CO')} COP\n` +
`• *Comisión Pacifictrans Go (${resumen.porcentajeComision}%):* $${resumen.comisionAdmin.toLocaleString('es-CO')} COP\n` +
`• *Comisión Pacific Trans GO (${resumen.porcentajeComision}%):* $${resumen.comisionAdmin.toLocaleString('es-CO')} COP\n` +
`• *Tu Ganancia Neta (85%):* $${resumen.pagoNetoConductor.toLocaleString('es-CO')} COP\n\n` +
(saldoNetoParaConductor > 0
? `💰 *Acreditado a tu Billetera:* +$${saldoNetoParaConductor.toLocaleString('es-CO')} COP\n` +
@ -457,7 +457,7 @@ export class SettlementService {
`👤 *Titular:* ${titularDestino}\n` +
`💸 *Costo de la Transacción:* $0 COP (Bre-B Interoperable)\n\n` +
`💼 *Nuevo Saldo en Billetera:* $${driverProfile.billeteraSaldo.toLocaleString('es-CO')} COP\n\n` +
`_Pacifictrans Go • Pagos Inmediatos en Tiempo Real_`;
`_Pacific Trans GO • Pagos Inmediatos en Tiempo Real_`;
await whatsAppNotificationService.sendTextMessage(conductorUser.telefono, msgWhatsApp);
@ -472,7 +472,7 @@ export class SettlementService {
monto,
moneda: 'COP',
costoTransaccion: 0,
entidadOrigen: 'Pacifictrans Go - Banco de la República Bre-B Direct',
entidadOrigen: 'Pacific Trans GO - Banco de la República Bre-B Direct',
entidadDestino: bancoDestino,
tipoLlave,
llaveDestino,
@ -646,7 +646,7 @@ export class SettlementService {
const adminTarget = await whatsAppNotificationService.getPacificTransNotificationTarget();
const msgAdmin =
`🔔 *NUEVA SOLICITUD DE TRANSFERENCIA BRE-B*\n` +
`_Central de Pagos & Despacho Pacifictrans Go_\n\n` +
`_Central de Pagos & Despacho Pacific Trans GO_\n\n` +
`👤 *Conductor:* ${conductorUser.nombre} (${driverProfile.placaVehiculo || 'WLZ-890'})\n` +
`💵 *Monto Solicitado:* *$${monto.toLocaleString('es-CO')} COP*\n` +
`🏦 *Entidad Destino:* ${bancoDestino}\n` +

View File

@ -54,7 +54,7 @@ export class TariffsService {
costoPenalidadCancelacion: 15000,
radioMaxPoolingMetros: 4000,
numeroAtencionWhatsApp: '573167455877',
nombreSoporte: 'Atención Pacifictrans Go',
nombreSoporte: 'Atención Pacific Trans GO',
estaActiva: true,
});
}

View File

@ -79,7 +79,7 @@ export class WhatsAppNotificationService {
}
/**
* Destino oficial para notificaciones de Pacifictrans Go:
* Destino oficial para notificaciones de Pacific Trans GO:
* 1. Grupo "Pacific Trans Notificaciones" (creado por Carlos)
* 2. Grupo "Pacific Trans"
* 3. Fallback al grupo "Notificaciones Almeira"
@ -173,8 +173,8 @@ export class WhatsAppNotificationService {
linkTracking?: string;
}): Promise<boolean> {
const msg =
`🚗 *PACIFICTRANS GO: ¡TU VIAJE CALI - BUENAVENTURA HA SIDO CONFIRMADO!*\n\n` +
`Hola *${params.nombrePasajero}*, tu servicio ha sido aprobado por la central de despacho de Pacifictrans Go.\n\n` +
`🚗 *PACIFIC TRANS GO: ¡TU VIAJE CALI - BUENAVENTURA HA SIDO CONFIRMADO!*\n\n` +
`Hola *${params.nombrePasajero}*, tu servicio ha sido aprobado por la central de despacho de Pacific Trans GO.\n\n` +
`📋 *Detalles del Conductor y Vehículo:*\n` +
`• *Conductor:* ${params.nombreConductor}\n` +
`• *Vehículo:* ${params.modeloVehiculo} (${params.colorVehiculo || 'Blanco'})\n` +
@ -184,7 +184,7 @@ export class WhatsAppNotificationService {
`• *Dirección:* ${params.direccionRecogida}\n\n` +
`💳 *Estado de Pago:* ${params.estadoPago} ($${params.valor.toLocaleString('es-CO')} COP)\n\n` +
(params.linkTracking ? `📍 *Seguimiento en Vivo:* ${params.linkTracking}\n\n` : '') +
`_Por favor permanece atento en tu punto de recogida. ¡Buen viaje con Pacifictrans Go!_`;
`_Por favor permanece atento en tu punto de recogida. ¡Buen viaje con Pacific Trans GO!_`;
return this.sendTextMessage(params.telefono, msg);
}
@ -219,14 +219,14 @@ export class WhatsAppNotificationService {
});
const msg =
`🚐 *PACIFICTRANS GO: NUEVO VIAJE ASIGNADO (CALI ➔ BUENAVENTURA)*\n\n` +
`¡Hola *${params.nombreConductor}*! Tienes un nuevo viaje asignado en Pacifictrans Go (#${params.tripId.slice(-6)}).\n\n` +
`🚐 *PACIFIC TRANS GO: NUEVO VIAJE ASIGNADO (CALI ➔ BUENAVENTURA)*\n\n` +
`¡Hola *${params.nombreConductor}*! Tienes un nuevo viaje asignado en Pacific Trans GO (#${params.tripId.slice(-6)}).\n\n` +
`👥 *Pasajeros Agrupados (${params.pasajeros.length}/4 puestos):*` +
listaPasajeros +
`\n💰 *Tu Pago Neto (Descontada comisión):* $${params.pagoConductorTotal.toLocaleString('es-CO')} COP\n\n` +
`🗺️ *Iniciar Navegación Waze (1ª Parada):*\n` +
`👉 ${params.primeraParadaWaze}\n\n` +
`_Recuerda confirmar cada recogida en la aplicación móvil Pacifictrans Go._`;
`_Recuerda confirmar cada recogida en la aplicación móvil Pacific Trans GO._`;
return this.sendTextMessage(params.telefonoConductor, msg);
}
@ -250,7 +250,7 @@ export class WhatsAppNotificationService {
wazeRecogidaUrl: string;
}): Promise<boolean> {
const msg =
`📦 *PACIFICTRANS GO: NUEVA ENCOMIENDA ASIGNADA (100% PREPAGADA)*\n\n` +
`📦 *PACIFIC TRANS GO: NUEVA ENCOMIENDA ASIGNADA (100% PREPAGADA)*\n\n` +
`Hola *${params.nombreConductor}*, tienes una entrega de mensajería programada (#${params.tripId.slice(-6)}).\n\n` +
`📤 *Punto de Recogida:*\n` +
`• Remitente: ${params.remitenteNombre} (+${params.remitenteTelefono.replace(/\D/g, '')})\n` +
@ -279,8 +279,8 @@ export class WhatsAppNotificationService {
pasajerosCount: number;
}): Promise<boolean> {
const msg =
`🔔 *PACIFICTRANS GO: NUEVA SOLICITUD EN ESPERA DE APROBACIÓN*\n\n` +
`Central de Despacho Pacifictrans Go (Cali - Buenaventura):\n` +
`🔔 *PACIFIC TRANS GO: NUEVA SOLICITUD EN ESPERA DE APROBACIÓN*\n\n` +
`Central de Despacho Pacific Trans GO (Cali - Buenaventura):\n` +
`• *Tipo:* ${params.tipo}\n` +
`• *Ref:* #${params.tripId.slice(-6)}\n` +
`• *Cliente:* ${params.solicitante} (+${params.telefono.replace(/\D/g, '')})\n` +
@ -303,7 +303,7 @@ export class WhatsAppNotificationService {
conductorSugerido?: string;
}): Promise<boolean> {
const msg =
`🔥 *PACIFICTRANS GO: ¡POOL DE 4 PASAJEROS COMPLETO Y LISTO PARA DESPACHO!*\n\n` +
`🔥 *PACIFIC TRANS GO: ¡POOL DE 4 PASAJEROS COMPLETO Y LISTO PARA DESPACHO!*\n\n` +
`El viaje #${params.tripId.slice(-6)} (${params.ruta}) ha alcanzado su capacidad máxima (4/4 cupos).\n` +
`• *Recaudo viaje:* $${params.totalRecaudo.toLocaleString('es-CO')} COP\n` +
(params.conductorSugerido ? `${params.conductorSugerido}\n` : '') +
@ -324,9 +324,9 @@ export class WhatsAppNotificationService {
linkBoldLiquidacion: string;
}): Promise<boolean> {
const msg =
`⚠️ *PACIFICTRANS GO: AVISO DE PENALIDAD POR CANCELACIÓN TARDÍA*\n\n` +
`⚠️ *PACIFIC TRANS GO: AVISO DE PENALIDAD POR CANCELACIÓN TARDÍA*\n\n` +
`Hola *${params.nombreUsuario}*, tu reserva #${params.tripId.slice(-6)} ya había sido confirmada y un conductor estaba en camino.\n\n` +
`De acuerdo a las políticas de servicio de Pacifictrans Go, se ha generado un cargo de penalidad de *$${params.montoPenalidad.toLocaleString(
`De acuerdo a las políticas de servicio de Pacific Trans GO, se ha generado un cargo de penalidad de *$${params.montoPenalidad.toLocaleString(
'es-CO'
)} COP*.\n\n` +
`Tu cuenta se encuentra inhabilitada temporalmente para nuevas reservas hasta liquidar este saldo.\n\n` +