Autosave: 20260525-095403
This commit is contained in:
parent
bd9aa664a9
commit
2c651b72fb
@ -111,6 +111,7 @@ $allowedViews = [
|
||||
'pendientes_hoy' => 'Pendientes de hoy',
|
||||
'nuevos_hoy' => 'Nuevos de hoy',
|
||||
'confirmados' => 'Confirmados',
|
||||
'seguimiento' => 'Seguimiento',
|
||||
'observados' => 'Observados',
|
||||
'cerrados' => 'Cerrados / descartados',
|
||||
'todos' => 'Todos los pedidos cargados',
|
||||
@ -130,6 +131,7 @@ $stats = [
|
||||
'pendientes_hoy' => 0,
|
||||
'nuevos_hoy' => 0,
|
||||
'confirmados' => 0,
|
||||
'seguimiento' => 0,
|
||||
'observados' => 0,
|
||||
'cerrados' => 0,
|
||||
];
|
||||
@ -181,6 +183,9 @@ try {
|
||||
if (in_array($order['estado'], cc_test_confirmed_states(), true)) {
|
||||
$stats['confirmados']++;
|
||||
}
|
||||
if ($order['estado'] === 'SE ENVIO NUMERO DE CUENTA') {
|
||||
$stats['seguimiento']++;
|
||||
}
|
||||
if ($order['estado'] === 'OBSERVADO') {
|
||||
$stats['observados']++;
|
||||
}
|
||||
@ -195,6 +200,7 @@ try {
|
||||
'pendientes_hoy' => (bool) ($order['es_pendiente_hoy'] ?? false),
|
||||
'nuevos_hoy' => (bool) ($order['es_nuevo_hoy'] ?? false),
|
||||
'confirmados' => in_array(($order['estado'] ?? ''), cc_test_confirmed_states(), true),
|
||||
'seguimiento' => ($order['estado'] ?? '') === 'SE ENVIO NUMERO DE CUENTA',
|
||||
'observados' => ($order['estado'] ?? '') === 'OBSERVADO',
|
||||
'cerrados' => (bool) ($order['es_cerrado'] ?? false),
|
||||
default => true,
|
||||
@ -230,7 +236,7 @@ require_once 'layout_header.php';
|
||||
<div class="d-flex flex-column flex-xl-row justify-content-between align-items-xl-center gap-3">
|
||||
<div>
|
||||
<h1 class="h2 fw-bold mb-1"><i class="bi bi-headset text-primary"></i> Call Center de prueba</h1>
|
||||
<p class="text-muted mb-0">Ahora el panel trabaja por <strong>bandejas</strong>: <strong>Nuevos de hoy</strong>, <strong>Pendientes de hoy</strong>, <strong>Confirmados</strong>, <strong>Observados</strong> y <strong>Cerrados</strong>. Así no se mezcla todo cuando entran pedidos diarios.</p>
|
||||
<p class="text-muted mb-0">Ahora el panel trabaja por <strong>bandejas</strong>: <strong>Nuevos de hoy</strong>, <strong>Pendientes de hoy</strong>, <strong>Seguimiento</strong>, <strong>Confirmados</strong>, <strong>Observados</strong> y <strong>Cerrados</strong>. Así no se mezcla todo cuando entran pedidos diarios.</p>
|
||||
</div>
|
||||
<div class="d-flex flex-wrap gap-2">
|
||||
<span class="badge rounded-pill text-bg-light border px-3 py-2">Drive detectado: <?php echo (int) $totalRows; ?> filas</span>
|
||||
@ -250,7 +256,7 @@ require_once 'layout_header.php';
|
||||
<div class="row g-3 align-items-center">
|
||||
<div class="col-lg-8">
|
||||
<h2 class="h5 fw-bold mb-2">Flujo recomendado ya listo para prueba</h2>
|
||||
<p class="mb-0">Los pedidos nuevos entran desde Drive. Luego tú gestionas cada cliente con estado, próxima llamada y observaciones internas. Los casos abiertos siguen apareciendo en <strong>Pendientes de hoy</strong> o <strong>Observados</strong> hasta que los cierres o confirmes.</p>
|
||||
<p class="mb-0">Los pedidos nuevos entran desde Drive. Luego tú gestionas cada cliente con estado, próxima llamada y observaciones internas. Los casos abiertos siguen apareciendo en <strong>Pendientes de hoy</strong>, <strong>Seguimiento</strong> o <strong>Observados</strong> hasta que los cierres o confirmes.</p>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<div class="small text-muted">Campos editables del módulo</div>
|
||||
@ -290,6 +296,16 @@ require_once 'layout_header.php';
|
||||
</article>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-md-6 col-xl-2">
|
||||
<a href="?view=seguimiento" class="text-decoration-none">
|
||||
<article class="card border-0 shadow-sm h-100 <?php echo $view === 'seguimiento' ? 'bg-primary-subtle border border-primary' : 'bg-white'; ?>">
|
||||
<div class="card-body">
|
||||
<div class="small text-uppercase text-muted mb-2">Seguimiento</div>
|
||||
<div class="display-6 fw-bold mb-0"><?php echo (int) $stats['seguimiento']; ?></div>
|
||||
</div>
|
||||
</article>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-md-6 col-xl-2">
|
||||
<a href="?view=observados" class="text-decoration-none">
|
||||
<article class="card border-0 shadow-sm h-100 <?php echo $view === 'observados' ? 'bg-warning-subtle border border-warning' : 'bg-white'; ?>">
|
||||
@ -417,11 +433,12 @@ require_once 'layout_header.php';
|
||||
type="button"
|
||||
class="btn btn-sm btn-primary"
|
||||
data-source-key="<?php echo htmlspecialchars($order['source_key']); ?>"
|
||||
data-modal-id="<?php echo htmlspecialchars($modalId); ?>"
|
||||
data-phone="<?php echo htmlspecialchars((string) ($order['celular'] ?? '')); ?>"
|
||||
data-order-label="<?php echo htmlspecialchars(cc_test_order_label($order)); ?>"
|
||||
data-client-name="<?php echo htmlspecialchars(cc_test_display_value($order['nombre'], 'Cliente sin nombre')); ?>"
|
||||
onclick="return registrarLlamada(event, this)">
|
||||
<i class="bi bi-telephone-outbound"></i> Llamar / AirDroid
|
||||
<i class="bi bi-telephone-outbound"></i> Llamar / Gestionar
|
||||
</button>
|
||||
<?php else: ?>
|
||||
<button type="button" class="btn btn-sm btn-primary" disabled>Sin teléfono</button>
|
||||
@ -452,6 +469,44 @@ require_once 'layout_header.php';
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Cerrar"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="border border-primary-subtle rounded-4 bg-primary-subtle p-2 mb-3" id="airDroidModalCard-<?php echo htmlspecialchars($order['source_key']); ?>">
|
||||
<div class="d-flex flex-wrap justify-content-between align-items-center gap-2">
|
||||
<div>
|
||||
<div class="small text-muted mb-1">Llamar / Gestionar</div>
|
||||
<h4 class="h6 fw-bold mb-2">Número listo para copiar</h4>
|
||||
<div class="fs-4 fw-semibold lh-sm text-primary" id="airDroidPhoneNumber-<?php echo htmlspecialchars($order['source_key']); ?>"><?php echo htmlspecialchars(cc_test_display_value($order['celular'], 'Sin celular')); ?></div>
|
||||
</div>
|
||||
<div class="d-flex flex-column gap-2">
|
||||
<button type="button" class="btn btn-outline-primary btn-sm" id="airDroidCopyButton-<?php echo htmlspecialchars($order['source_key']); ?>" data-phone="<?php echo htmlspecialchars((string) ($order['celular'] ?? '')); ?>" onclick="copyPhoneToClipboard(this.dataset.phone); return false;">Copiar número</button>
|
||||
<button type="button" class="btn btn-outline-secondary btn-sm" onclick="openAirDroidWeb()">Abrir AirDroid Web</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="border border-success-subtle rounded-4 bg-white p-3 mb-4 shadow-sm">
|
||||
<div class="d-flex flex-wrap justify-content-between align-items-center gap-2 mb-3">
|
||||
<div>
|
||||
<div class="small text-muted mb-1">Se abre primero</div>
|
||||
<h4 class="h6 fw-bold mb-0">Pedido</h4>
|
||||
</div>
|
||||
<span class="badge bg-success-subtle text-success-emphasis">Producto, cantidad y precio</span>
|
||||
</div>
|
||||
<div class="row g-3">
|
||||
<div class="col-lg-6">
|
||||
<label for="producto-<?php echo htmlspecialchars($order['source_key']); ?>" class="form-label">Producto</label>
|
||||
<input type="text" class="form-control" id="producto-<?php echo htmlspecialchars($order['source_key']); ?>" value="<?php echo htmlspecialchars((string) ($order['producto'] ?? '')); ?>" placeholder="Escriba el producto">
|
||||
</div>
|
||||
<div class="col-sm-6 col-lg-3">
|
||||
<label for="cantidad-<?php echo htmlspecialchars($order['source_key']); ?>" class="form-label">Cantidad</label>
|
||||
<input type="text" class="form-control" id="cantidad-<?php echo htmlspecialchars($order['source_key']); ?>" value="<?php echo htmlspecialchars((string) ($order['cantidad'] ?? '')); ?>" placeholder="Cantidad">
|
||||
</div>
|
||||
<div class="col-sm-6 col-lg-3">
|
||||
<label for="precio-<?php echo htmlspecialchars($order['source_key']); ?>" class="form-label">Precio</label>
|
||||
<input type="text" class="form-control" id="precio-<?php echo htmlspecialchars($order['source_key']); ?>" value="<?php echo htmlspecialchars((string) ($order['precio'] ?? '')); ?>" placeholder="S/ 0.00" inputmode="decimal">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row g-3 mb-4">
|
||||
<div class="col-lg-3 col-md-6">
|
||||
<div class="border rounded p-3 h-100 bg-light-subtle">
|
||||
@ -510,10 +565,6 @@ require_once 'layout_header.php';
|
||||
<input type="date" class="form-control" id="fecha-entrega-<?php echo htmlspecialchars($order['source_key']); ?>" value="<?php echo htmlspecialchars(cc_test_format_date_input($order['fecha_entrega_programada'] ?? null)); ?>">
|
||||
<div class="form-text">Úsalo cuando el cliente quede en Confirmado fecha.</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">Resumen</label>
|
||||
<div class="border rounded px-3 py-2 bg-light-subtle small h-100 d-flex align-items-center">Los estados abiertos vuelven a <strong class="ms-1">Pendientes de hoy</strong>; Confirmado contraentrega te permite programar la entrega.</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<label for="nota-<?php echo htmlspecialchars($order['source_key']); ?>" class="form-label">Nota interna</label>
|
||||
<textarea class="form-control" id="nota-<?php echo htmlspecialchars($order['source_key']); ?>" rows="3" placeholder="Ejemplo: cliente pidió volver a llamar después de las 5 pm."><?php echo htmlspecialchars($order['nota_seguimiento']); ?></textarea>
|
||||
@ -595,6 +646,15 @@ require_once 'layout_header.php';
|
||||
</div>
|
||||
|
||||
<div class="col-lg-5">
|
||||
<div class="mb-4 border rounded p-4 bg-light-subtle">
|
||||
<div class="fw-semibold mb-3 fs-5">Origen vs edición</div>
|
||||
<div class="mb-1"><strong>Dirección Drive:</strong> <?php echo htmlspecialchars(cc_test_display_value($order['direccion_drive'] ?? null)); ?></div>
|
||||
<div class="mb-1"><strong>Referencia Drive:</strong> <?php echo htmlspecialchars(cc_test_display_value($order['referencia_drive'] ?? null)); ?></div>
|
||||
<div class="mb-1"><strong>Distrito 1:</strong> <?php echo htmlspecialchars(cc_test_display_value($order['distrito_drive'] ?? null)); ?></div>
|
||||
<div class="mb-1"><strong>Distrito:</strong> <?php echo htmlspecialchars(cc_test_display_value($order['distrito'] ?? null)); ?></div>
|
||||
<div><strong>Observación Drive:</strong> <?php echo htmlspecialchars(cc_test_display_value($order['observaciones_drive'] ?? null)); ?></div>
|
||||
</div>
|
||||
|
||||
<h4 class="h6 fw-bold mb-3">Historial de llamadas</h4>
|
||||
<?php if (empty($historial)): ?>
|
||||
<div class="border rounded p-3 text-muted small">Aún no hay llamadas registradas para este cliente.</div>
|
||||
@ -614,15 +674,6 @@ require_once 'layout_header.php';
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="mt-4 border rounded p-3 bg-light-subtle small">
|
||||
<div class="fw-semibold mb-2">Origen vs edición</div>
|
||||
<div><strong>Dirección Drive:</strong> <?php echo htmlspecialchars(cc_test_display_value($order['direccion_drive'] ?? null)); ?></div>
|
||||
<div><strong>Referencia Drive:</strong> <?php echo htmlspecialchars(cc_test_display_value($order['referencia_drive'] ?? null)); ?></div>
|
||||
<div><strong>Distrito 1:</strong> <?php echo htmlspecialchars(cc_test_display_value($order['distrito_drive'] ?? null)); ?></div>
|
||||
<div><strong>Distrito:</strong> <?php echo htmlspecialchars(cc_test_display_value($order['distrito'] ?? null)); ?></div>
|
||||
<div><strong>Observación Drive:</strong> <?php echo htmlspecialchars(cc_test_display_value($order['observaciones_drive'] ?? null)); ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -650,40 +701,29 @@ require_once 'layout_header.php';
|
||||
", $modalsHtml); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="modal fade" id="airDroidAssistModal" tabindex="-1" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<div>
|
||||
<div class="small text-primary fw-semibold">Llamada preparada para AirDroid</div>
|
||||
<h3 class="modal-title h5 mb-0">Número listo para pegar</h3>
|
||||
</div>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Cerrar"></button>
|
||||
<div class="position-fixed bottom-0 end-0 p-3" id="airDroidAssistPanel" style="z-index: 1080; max-width: 26rem; width: min(26rem, calc(100vw - 1.5rem));">
|
||||
<div class="card border-primary shadow-lg d-none" id="airDroidAssistCard">
|
||||
<div class="card-header bg-primary text-white d-flex align-items-start justify-content-between gap-3">
|
||||
<div>
|
||||
<div class="small opacity-75">Llamada preparada para AirDroid</div>
|
||||
<h3 class="h5 mb-0">Número listo para copiar</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="rounded-4 border bg-light-subtle p-3 mb-3">
|
||||
<div class="small text-muted">Pedido</div>
|
||||
<div class="fw-semibold" id="airDroidOrderLabel">-</div>
|
||||
<div class="small text-muted mt-2">Cliente</div>
|
||||
<div class="fw-semibold" id="airDroidClientName">-</div>
|
||||
<div class="small text-muted mt-2">Número</div>
|
||||
<div class="display-6 fw-bold lh-1" id="airDroidPhoneNumber">-</div>
|
||||
</div>
|
||||
<div class="alert alert-primary py-2 small mb-3" id="airDroidStatusBox">Intento registrado. Pega el número en tu aplicación de AirDroid para iniciar la llamada.</div>
|
||||
<ol class="small ps-3 mb-0">
|
||||
<li>Abre tu aplicación de AirDroid en la PC.</li>
|
||||
<li>Pega el número copiado en el marcador.</li>
|
||||
<li>Realiza la llamada y luego vuelve aquí para guardar el resultado.</li>
|
||||
</ol>
|
||||
</div>
|
||||
<div class="modal-footer d-flex flex-wrap justify-content-between gap-2">
|
||||
<div class="small text-muted" id="airDroidExtraStatus">Número copiado al portapapeles.</div>
|
||||
<div class="d-flex flex-wrap gap-2">
|
||||
<button type="button" class="btn btn-outline-secondary" id="airDroidCopyButton">Copiar número</button>
|
||||
<button type="button" class="btn btn-outline-primary" id="airDroidOpenButton">Abrir AirDroid Web</button>
|
||||
</div>
|
||||
<button type="button" class="btn-close btn-close-white" id="airDroidHideButton" aria-label="Ocultar"></button>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="rounded-4 border bg-light-subtle p-2">
|
||||
<div class="small text-muted">Pedido</div>
|
||||
<div class="fw-semibold" id="airDroidOrderLabel">-</div>
|
||||
<div class="small text-muted mt-2">Cliente</div>
|
||||
<div class="fw-semibold" id="airDroidClientName">-</div>
|
||||
<div class="small text-muted mt-2">Número</div>
|
||||
<div class="fs-5 fw-semibold lh-sm text-primary" id="airDroidPhoneNumber">-</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer d-flex flex-wrap justify-content-end gap-2">
|
||||
<button type="button" class="btn btn-outline-secondary btn-sm" id="airDroidCopyButton">Copiar número</button>
|
||||
<button type="button" class="btn btn-outline-primary btn-sm" id="airDroidOpenButton">Abrir AirDroid Web</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
@ -882,7 +922,10 @@ function guardarGestion(sourceKey, trigger) {
|
||||
ciudad: document.getElementById('ciudad-' + sourceKey)?.value || '',
|
||||
distrito: document.getElementById('distrito-' + sourceKey)?.value || '',
|
||||
dni: document.getElementById('dni-' + sourceKey)?.value || '',
|
||||
observaciones: document.getElementById('observaciones-' + sourceKey)?.value || ''
|
||||
observaciones: document.getElementById('observaciones-' + sourceKey)?.value || '',
|
||||
producto: document.getElementById('producto-' + sourceKey)?.value || '',
|
||||
cantidad: document.getElementById('cantidad-' + sourceKey)?.value || '',
|
||||
precio: document.getElementById('precio-' + sourceKey)?.value || ''
|
||||
});
|
||||
|
||||
if (trigger) {
|
||||
@ -962,40 +1005,31 @@ function openAirDroidWeb() {
|
||||
}
|
||||
|
||||
function showAirDroidHelper(details) {
|
||||
const sourceKey = details.sourceKey || '';
|
||||
const phone = details.phone || '-';
|
||||
const orderLabel = details.orderLabel || 'Sin número';
|
||||
const clientName = details.clientName || 'Cliente sin nombre';
|
||||
const registered = !!details.registered;
|
||||
const copied = !!details.copied;
|
||||
const modalId = details.modalId || '';
|
||||
|
||||
const orderNode = document.getElementById('airDroidOrderLabel');
|
||||
const clientNode = document.getElementById('airDroidClientName');
|
||||
const phoneNode = document.getElementById('airDroidPhoneNumber');
|
||||
const statusNode = document.getElementById('airDroidStatusBox');
|
||||
const extraNode = document.getElementById('airDroidExtraStatus');
|
||||
const copyButton = document.getElementById('airDroidCopyButton');
|
||||
const openButton = document.getElementById('airDroidOpenButton');
|
||||
const modalElement = document.getElementById('airDroidAssistModal');
|
||||
|
||||
if (!modalElement) {
|
||||
return;
|
||||
if (modalId) {
|
||||
const modalElement = document.getElementById(modalId);
|
||||
if (modalElement && window.bootstrap && window.bootstrap.Modal) {
|
||||
window.bootstrap.Modal.getOrCreateInstance(modalElement).show();
|
||||
}
|
||||
}
|
||||
|
||||
const orderNode = document.getElementById('airDroidOrderLabel-' + sourceKey);
|
||||
const clientNode = document.getElementById('airDroidClientName-' + sourceKey);
|
||||
const phoneNode = document.getElementById('airDroidPhoneNumber-' + sourceKey);
|
||||
const copyButton = document.getElementById('airDroidCopyButton-' + sourceKey);
|
||||
const openButton = document.getElementById('airDroidOpenButton-' + sourceKey);
|
||||
|
||||
if (orderNode) orderNode.textContent = orderLabel;
|
||||
if (clientNode) clientNode.textContent = clientName;
|
||||
if (phoneNode) phoneNode.textContent = phone;
|
||||
|
||||
if (statusNode) {
|
||||
statusNode.className = 'alert ' + (registered ? 'alert-primary' : 'alert-warning') + ' py-2 small mb-3';
|
||||
statusNode.textContent = registered
|
||||
? 'Intento de llamada registrado. Ahora pega el número en tu app de AirDroid.'
|
||||
: 'Se abrió la ayuda, pero el intento no se pudo registrar en el CRM.';
|
||||
}
|
||||
|
||||
if (extraNode) {
|
||||
extraNode.textContent = copied ? 'Número copiado correctamente.' : 'No se pudo copiar automáticamente; usa el botón Copiar número.';
|
||||
}
|
||||
|
||||
if (copyButton) {
|
||||
copyButton.dataset.phone = phone !== '-' ? phone : '';
|
||||
}
|
||||
@ -1005,10 +1039,6 @@ function showAirDroidHelper(details) {
|
||||
openAirDroidWeb();
|
||||
};
|
||||
}
|
||||
|
||||
if (window.bootstrap && window.bootstrap.Modal) {
|
||||
window.bootstrap.Modal.getOrCreateInstance(modalElement).show();
|
||||
}
|
||||
}
|
||||
|
||||
function registrarLlamada(event, trigger) {
|
||||
@ -1017,6 +1047,7 @@ function registrarLlamada(event, trigger) {
|
||||
}
|
||||
|
||||
const sourceKey = trigger?.dataset?.sourceKey || '';
|
||||
const modalId = trigger?.dataset?.modalId || '';
|
||||
const phone = normalizarNumeroTelefono(trigger?.dataset?.phone || '');
|
||||
const orderLabel = trigger?.dataset?.orderLabel || '';
|
||||
const clientName = trigger?.dataset?.clientName || '';
|
||||
@ -1026,6 +1057,13 @@ function registrarLlamada(event, trigger) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (modalId) {
|
||||
const modalElement = document.getElementById(modalId);
|
||||
if (modalElement && window.bootstrap && window.bootstrap.Modal) {
|
||||
window.bootstrap.Modal.getOrCreateInstance(modalElement).show();
|
||||
}
|
||||
}
|
||||
|
||||
if (trigger) {
|
||||
trigger.classList.add('disabled');
|
||||
trigger.setAttribute('aria-disabled', 'true');
|
||||
@ -1071,6 +1109,8 @@ function registrarLlamada(event, trigger) {
|
||||
}
|
||||
|
||||
showAirDroidHelper({
|
||||
sourceKey,
|
||||
modalId,
|
||||
phone,
|
||||
orderLabel,
|
||||
clientName,
|
||||
@ -1094,12 +1134,6 @@ if (airDroidCopyButton) {
|
||||
copyPhoneToClipboard(phone).then(copied => {
|
||||
if (!copied) {
|
||||
alert('No se pudo copiar el número automáticamente.');
|
||||
return;
|
||||
}
|
||||
|
||||
const extraNode = document.getElementById('airDroidExtraStatus');
|
||||
if (extraNode) {
|
||||
extraNode.textContent = 'Número copiado correctamente. Si la pestaña no se abrió antes, usa Abrir AirDroid.';
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@ -37,6 +37,9 @@ function cc_test_ensure_tracking_table(PDO $pdo): void
|
||||
`distrito` VARCHAR(120) NULL,
|
||||
`dni` VARCHAR(40) NULL,
|
||||
`observaciones` TEXT NULL,
|
||||
`producto` VARCHAR(255) NULL,
|
||||
`cantidad` VARCHAR(50) NULL,
|
||||
`precio` VARCHAR(80) NULL,
|
||||
`proxima_llamada_at` DATETIME NULL,
|
||||
`fecha_entrega_programada` DATE NULL,
|
||||
`numero_cuenta_enviado_at` DATETIME NULL,
|
||||
@ -56,7 +59,10 @@ function cc_test_ensure_tracking_table(PDO $pdo): void
|
||||
cc_test_ensure_column($pdo, 'callcenter_test_tracking', 'distrito', 'VARCHAR(120) NULL AFTER `ciudad`');
|
||||
cc_test_ensure_column($pdo, 'callcenter_test_tracking', 'dni', 'VARCHAR(40) NULL AFTER `distrito`');
|
||||
cc_test_ensure_column($pdo, 'callcenter_test_tracking', 'observaciones', 'TEXT NULL AFTER `dni`');
|
||||
cc_test_ensure_column($pdo, 'callcenter_test_tracking', 'proxima_llamada_at', 'DATETIME NULL AFTER `observaciones`');
|
||||
cc_test_ensure_column($pdo, 'callcenter_test_tracking', 'producto', 'VARCHAR(255) NULL AFTER `observaciones`');
|
||||
cc_test_ensure_column($pdo, 'callcenter_test_tracking', 'cantidad', 'VARCHAR(50) NULL AFTER `producto`');
|
||||
cc_test_ensure_column($pdo, 'callcenter_test_tracking', 'precio', 'VARCHAR(80) NULL AFTER `cantidad`');
|
||||
cc_test_ensure_column($pdo, 'callcenter_test_tracking', 'proxima_llamada_at', 'DATETIME NULL AFTER `precio`');
|
||||
cc_test_ensure_column($pdo, 'callcenter_test_tracking', 'fecha_entrega_programada', 'DATE NULL AFTER `proxima_llamada_at`');
|
||||
cc_test_ensure_column($pdo, 'callcenter_test_tracking', 'numero_cuenta_enviado_at', 'DATETIME NULL AFTER `fecha_entrega_programada`');
|
||||
cc_test_ensure_column($pdo, 'callcenter_test_tracking', 'ultima_gestion_at', 'DATETIME NULL AFTER `numero_cuenta_enviado_at`');
|
||||
@ -113,7 +119,7 @@ function cc_test_valid_states(): array
|
||||
|
||||
function cc_test_open_states(): array
|
||||
{
|
||||
return ['POR LLAMAR', 'DEVOLVER LLAMADA', 'OBSERVADO', 'SE ENVIO NUMERO DE CUENTA'];
|
||||
return ['POR LLAMAR', 'DEVOLVER LLAMADA', 'OBSERVADO'];
|
||||
}
|
||||
|
||||
function cc_test_confirmed_states(): array
|
||||
|
||||
@ -120,7 +120,7 @@ function drive_test_fetch_tracking(PDO $pdo, array $sourceKeys): array
|
||||
cc_test_ensure_tracking_table($pdo);
|
||||
|
||||
$placeholders = implode(',', array_fill(0, count($sourceKeys), '?'));
|
||||
$stmt = $pdo->prepare("SELECT source_key, estado, nota_seguimiento, direccion, referencia, sede, ciudad, distrito, dni, observaciones, proxima_llamada_at, fecha_entrega_programada, numero_cuenta_enviado_at, ultima_gestion_at, updated_at FROM callcenter_test_tracking WHERE source_key IN ($placeholders)");
|
||||
$stmt = $pdo->prepare("SELECT source_key, estado, nota_seguimiento, direccion, referencia, sede, ciudad, distrito, dni, observaciones, producto, cantidad, precio, proxima_llamada_at, fecha_entrega_programada, numero_cuenta_enviado_at, ultima_gestion_at, updated_at FROM callcenter_test_tracking WHERE source_key IN ($placeholders)");
|
||||
$stmt->execute($sourceKeys);
|
||||
|
||||
$tracking = [];
|
||||
@ -133,7 +133,7 @@ function drive_test_fetch_tracking(PDO $pdo, array $sourceKeys): array
|
||||
|
||||
function drive_test_merge_tracking(array $orders, array $tracking): array
|
||||
{
|
||||
$editableFields = ['direccion', 'referencia', 'sede', 'ciudad', 'distrito', 'dni', 'observaciones'];
|
||||
$editableFields = ['direccion', 'referencia', 'sede', 'ciudad', 'distrito', 'dni', 'observaciones', 'producto', 'cantidad', 'precio'];
|
||||
|
||||
foreach ($orders as &$order) {
|
||||
$current = $tracking[$order['source_key']] ?? null;
|
||||
|
||||
@ -56,6 +56,9 @@ try {
|
||||
$distrito = cc_test_normalize_nullable_text('distrito', 120);
|
||||
$dni = cc_test_normalize_nullable_text('dni', 40);
|
||||
$observaciones = cc_test_normalize_nullable_text('observaciones', 3000);
|
||||
$producto = cc_test_normalize_nullable_text('producto', 255);
|
||||
$cantidad = cc_test_normalize_nullable_text('cantidad', 50);
|
||||
$precio = cc_test_normalize_nullable_text('precio', 80);
|
||||
|
||||
$pdo = db();
|
||||
cc_test_ensure_tracking_table($pdo);
|
||||
@ -117,6 +120,9 @@ try {
|
||||
distrito,
|
||||
dni,
|
||||
observaciones,
|
||||
producto,
|
||||
cantidad,
|
||||
precio,
|
||||
proxima_llamada_at,
|
||||
fecha_entrega_programada,
|
||||
numero_cuenta_enviado_at,
|
||||
@ -133,6 +139,9 @@ try {
|
||||
:distrito,
|
||||
:dni,
|
||||
:observaciones,
|
||||
:producto,
|
||||
:cantidad,
|
||||
:precio,
|
||||
:proxima_llamada_at,
|
||||
:fecha_entrega_programada,
|
||||
:numero_cuenta_enviado_at,
|
||||
@ -149,6 +158,9 @@ try {
|
||||
distrito = VALUES(distrito),
|
||||
dni = VALUES(dni),
|
||||
observaciones = VALUES(observaciones),
|
||||
producto = VALUES(producto),
|
||||
cantidad = VALUES(cantidad),
|
||||
precio = VALUES(precio),
|
||||
proxima_llamada_at = VALUES(proxima_llamada_at),
|
||||
fecha_entrega_programada = VALUES(fecha_entrega_programada),
|
||||
numero_cuenta_enviado_at = VALUES(numero_cuenta_enviado_at),
|
||||
@ -168,6 +180,9 @@ try {
|
||||
':distrito' => $distrito,
|
||||
':dni' => $dni,
|
||||
':observaciones' => $observaciones,
|
||||
':producto' => $producto,
|
||||
':cantidad' => $cantidad,
|
||||
':precio' => $precio,
|
||||
':proxima_llamada_at' => $proximaLlamada,
|
||||
':fecha_entrega_programada' => $fechaEntrega,
|
||||
':numero_cuenta_enviado_at' => $numeroCuentaEnviadoAt,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user