Autosave: 20260731-101259

This commit is contained in:
Flatlogic Bot 2026-07-31 10:11:24 +00:00
parent 2d3ef7a210
commit 3cff110ba0
2 changed files with 97 additions and 66 deletions

View File

@ -422,7 +422,7 @@ $_SESSION[cc_test_callcenter_view_session_key()] = cc_test_normalize_context_key
$viewStatesNote = $isTuaniRecuperablesStore
? 'Estados disponibles: <strong>Carritos recuperables</strong>, <strong>Seguimiento</strong>, <strong>Observados</strong>, <strong>Confirmados</strong>, <strong>Recuperados</strong> y <strong>Todos</strong>. Esta bandeja compartida está disponible para cualquier asesora y, cuando una asesora gestiona un carrito recuperable, el sistema lo asigna automáticamente a quien lo trabaja. Si el teléfono ya existe en <strong>TUANI principal</strong>, se marca en gris como <strong>Pedido repetido en tienda</strong> solo en esta bandeja.'
: 'Estados disponibles: Por llamar, Devolver llamada, Observado, Se envió número de cuenta, Confirmado contraentrega, Confirmado envío, Cancelado y Repetido. <strong>Promo Final</strong> se habilita desde el Día 3 para pedidos nuevos desde el 29/07/2026 y desde el Día 4 para pedidos anteriores; cuando haya sustento pendiente en ese nuevo flujo, la tarjeta de Asignados hoy sigue visible y el celular aparece con candado hasta completarlo. Además, esta bandeja principal incluye reparto intercalado diario: en modo automático reparte pedidos sin asignar entre asesoras activas; en modo manual el supervisor los mueve pedido por pedido. También puedes usar la vista <strong>Últimos 3 días hábiles</strong> para concentrar el seguimiento reciente. En las vistas <strong>Todos</strong> y <strong>Últimos 3 días hábiles</strong>, los pedidos del nuevo flujo con sustento pendiente se muestran con candado en el celular hasta completar ese paso; la llamada sigue disponible desde el panel.';
: 'Estados disponibles: Por llamar, Devolver llamada, Observado, Se envió número de cuenta, Confirmado contraentrega, Confirmado envío, Cancelado y Repetido. <strong>Promo Final</strong> se habilita desde el Día 3 para pedidos nuevos desde el 29/07/2026 y desde el Día 4 para pedidos anteriores; cuando haya sustento pendiente en ese nuevo flujo, la tarjeta de Asignados hoy sigue visible y el celular aparece con candado hasta completarlo. Además, esta bandeja principal incluye reparto intercalado diario: en modo automático reparte pedidos sin asignar entre asesoras activas; en modo manual el supervisor los mueve pedido por pedido. También puedes usar la vista <strong>Últimos 3 días hábiles</strong> para concentrar el seguimiento reciente. Cuando un pedido del nuevo flujo tiene sustento pendiente, su celular se muestra con candado en cualquier vista donde aparezca hasta completar ese paso; la llamada queda bloqueada hasta completarlo.';
$errorMessage = null;
$noticeMessage = null;
@ -703,8 +703,8 @@ try {
$order['es_promo_final'] = $order['promo_final_habilitado'] && $order['promo_final_evidencia_cargada'];
$order['promo_final_pendiente'] = $order['promo_final_habilitado'] && !$order['promo_final_evidencia_cargada'];
$order['llamada_bloqueada_dia3'] = $followupDayInfo !== null
&& !empty($order['promo_final_pendiente'])
&& (int) ($followupDayInfo['promo_final_threshold_day'] ?? 4) === 3;
&& (int) ($followupDayInfo['day_number'] ?? 0) >= 3
&& !$order['promo_final_evidencia_cargada'];
$order['llamada_bloqueada_dia3_mensaje'] = $order['llamada_bloqueada_dia3']
? 'Celular oculto hasta completar el sustento de Día 3.'
: '';
@ -988,15 +988,14 @@ try {
$assessorInboxLockedOrders = [];
if (!$isAdmin && !$isTuaniRecuperablesStore) {
$assessorInboxLockedOrders = array_values(array_filter($orders, static function (array $order): bool {
return !empty($order['promo_final_pendiente'])
&& (int) ($order['seguimiento_dia_info']['promo_final_threshold_day'] ?? 4) === 3;
return !empty($order['llamada_bloqueada_dia3']);
}));
}
$assessorInboxLockedCount = count($assessorInboxLockedOrders);
$assessorInboxLocked = $assessorInboxLockedCount > 0;
$assessorInboxLockedView = $assessorInboxLocked && $view === 'nuevos_hoy';
$assessorInboxLockNotice = $assessorInboxLocked
? 'Tienes ' . $assessorInboxLockedCount . ' pedido' . ($assessorInboxLockedCount === 1 ? '' : 's') . ' del nuevo flujo con sustento pendiente para Promo Final. En esos casos, el celular aparece con candado hasta completar ese paso.'
? 'Tienes ' . $assessorInboxLockedCount . ' pedido' . ($assessorInboxLockedCount === 1 ? '' : 's') . ' con sustento pendiente para Promo Final. En esos casos, el celular aparece con candado y la llamada queda bloqueada hasta completar ese paso.'
: '';
$visibleOrdersTotalCount = count($visibleOrders);
@ -1515,6 +1514,15 @@ require_once 'layout_header.php';
if ($isTuaniRecuperablesStore && !empty($order['pedido_repetido_en_tienda'])) {
$rowBackgroundStyle .= '--cc-row-bg:#CCCCCC;';
}
$phoneLocked = !empty($order['llamada_bloqueada_dia3']);
$phoneLockMessage = (string) ($order['llamada_bloqueada_dia3_mensaje'] ?? '');
if ($phoneLocked && $phoneLockMessage === '') {
$phoneLockMessage = 'Celular oculto mientras completas los pendientes del Día 3.';
}
$phoneHiddenByDay1 = $followupDayInfo !== null
&& (int) ($followupDayInfo['day_number'] ?? 0) === 1;
$phoneRowHiddenLabel = 'Número oculto';
$phoneRowHiddenTitle = 'Número oculto';
ob_start();
?>
<tr class="cc-callcenter-row" data-source-key="<?php echo htmlspecialchars($order['source_key']); ?>" style="<?php echo htmlspecialchars($rowBackgroundStyle); ?>">
@ -1525,19 +1533,14 @@ require_once 'layout_header.php';
<span class="cc-followup-day-badge-number"><?php echo htmlspecialchars($followupDayInfo['compact_label']); ?></span>
</div>
<?php endif; ?>
<div class="fw-bold fs-6"><?php echo htmlspecialchars(cc_test_order_label($order)); ?></div>
<div class="small text-muted">ID Drive: <?php echo htmlspecialchars(cc_test_display_value($order['import_id'] ?? null, 'Sin ID')); ?></div>
</td>
<td>
<div class="fw-semibold"><?php echo htmlspecialchars(cc_test_display_value($order['nombre'], 'Sin nombre')); ?></div>
<div class="small text-muted mb-1">
Celular:
<?php if (!empty($order['llamada_bloqueada_dia3'])): ?>
<span class="badge bg-warning-subtle text-warning-emphasis border ms-1" title="<?php echo htmlspecialchars((string) ($order['llamada_bloqueada_dia3_mensaje'] ?? 'Celular oculto hasta completar el sustento de Día 3.'), ENT_QUOTES); ?>" aria-label="<?php echo htmlspecialchars((string) ($order['llamada_bloqueada_dia3_mensaje'] ?? 'Celular oculto hasta completar el sustento de Día 3.'), ENT_QUOTES); ?>">
<i class="bi bi-lock-fill me-1"></i>Celular oculto
<?php if ($phoneHiddenByDay1): ?>
<span class="badge bg-warning-subtle text-warning-emphasis border ms-1" title="<?php echo htmlspecialchars($phoneRowHiddenTitle, ENT_QUOTES); ?>" aria-label="<?php echo htmlspecialchars($phoneRowHiddenTitle, ENT_QUOTES); ?>">
<i class="bi bi-lock-fill me-1"></i><?php echo htmlspecialchars($phoneRowHiddenLabel, ENT_QUOTES); ?>
</span>
<?php else: ?>
<?php echo htmlspecialchars(cc_test_display_value($order['celular'], 'Sin número')); ?>
<?php echo htmlspecialchars(cc_test_display_value($order['celular'], 'Sin celular')); ?>
<?php endif; ?>
</div>
<div class="small text-muted">DNI: <?php echo htmlspecialchars(cc_test_display_value($order['dni'], 'Sin DNI')); ?></div>
@ -1661,13 +1664,13 @@ require_once 'layout_header.php';
type="button"
class="btn btn-sm btn-primary cc-callcenter-action-btn"
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-phone-locked="<?php echo !empty($order['llamada_bloqueada_dia3']) ? '1' : '0'; ?>"
data-phone-locked="<?php echo $phoneLocked ? '1' : '0'; ?>"
data-phone-hidden-day1="<?php echo $phoneHiddenByDay1 ? '1' : '0'; ?>"
data-phone="<?php echo $phoneLocked ? '' : 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 / Gestionar
onclick="return registrarLlamada(event, this)"<?php echo $phoneLocked ? ' disabled aria-disabled="true" title="Llamada bloqueada hasta completar el sustento de Día 3"' : ''; ?>>
<i class="bi bi-telephone-outbound"></i> <?php echo $phoneLocked ? 'Llamada bloqueada' : 'Llamar / Gestionar'; ?>
</button>
<?php else: ?>
<button type="button" class="btn btn-sm btn-primary cc-callcenter-action-btn" disabled>Sin teléfono</button>
@ -1705,9 +1708,9 @@ require_once 'layout_header.php';
</div>
<div class="small text-muted mt-1">
<?php echo htmlspecialchars(cc_test_display_value($order['producto'], 'Sin producto')); ?> ·
<?php if (!empty($order['llamada_bloqueada_dia3'])): ?>
<span class="badge bg-warning-subtle text-warning-emphasis border ms-1" title="<?php echo htmlspecialchars((string) ($order['llamada_bloqueada_dia3_mensaje'] ?? 'Celular oculto hasta completar el sustento de Día 3.'), ENT_QUOTES); ?>" aria-label="<?php echo htmlspecialchars((string) ($order['llamada_bloqueada_dia3_mensaje'] ?? 'Celular oculto hasta completar el sustento de Día 3.'), ENT_QUOTES); ?>">
<i class="bi bi-lock-fill me-1"></i>Celular oculto
<?php if ($phoneHiddenByDay1): ?>
<span class="badge bg-warning-subtle text-warning-emphasis border" title="Número oculto" aria-label="Número oculto">
<i class="bi bi-lock-fill me-1"></i>Número oculto
</span>
<?php else: ?>
<?php echo htmlspecialchars(cc_test_display_value($order['celular'], 'Sin celular')); ?>
@ -1754,11 +1757,11 @@ require_once 'layout_header.php';
<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"><?php echo !empty($order['llamada_bloqueada_dia3']) ? 'Celular oculto' : 'Número listo para copiar'; ?></h4>
<h4 class="h6 fw-bold mb-2"><?php echo $phoneHiddenByDay1 ? 'Número oculto' : '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 if (!empty($order['llamada_bloqueada_dia3'])): ?>
<span class="badge bg-warning-subtle text-warning-emphasis border" title="<?php echo htmlspecialchars((string) ($order['llamada_bloqueada_dia3_mensaje'] ?? 'Celular oculto hasta completar el sustento de Día 3.'), ENT_QUOTES); ?>" aria-label="<?php echo htmlspecialchars((string) ($order['llamada_bloqueada_dia3_mensaje'] ?? 'Celular oculto hasta completar el sustento de Día 3.'), ENT_QUOTES); ?>">
<i class="bi bi-lock-fill me-1"></i>Celular oculto
<?php if ($phoneHiddenByDay1): ?>
<span class="badge bg-warning-subtle text-warning-emphasis border" title="Número oculto" aria-label="Número oculto">
<i class="bi bi-lock-fill me-1"></i>Número oculto
</span>
<?php else: ?>
<?php echo htmlspecialchars(cc_test_display_value($order['celular'], 'Sin celular')); ?>
@ -1766,13 +1769,11 @@ require_once 'layout_header.php';
</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 !empty($order['llamada_bloqueada_dia3']) ? '' : htmlspecialchars((string) ($order['celular'] ?? '')); ?>" onclick="copyPhoneToClipboard(this.dataset.phone); return false;"<?php echo !empty($order['llamada_bloqueada_dia3']) ? ' disabled' : ''; ?>><?php echo !empty($order['llamada_bloqueada_dia3']) ? 'Número oculto' : 'Copiar número'; ?></button>
<button type="button" class="btn btn-outline-primary btn-sm" id="airDroidCopyButton-<?php echo htmlspecialchars($order['source_key']); ?>" data-phone="<?php echo $phoneHiddenByDay1 ? '' : htmlspecialchars((string) ($order['celular'] ?? '')); ?>" onclick="copyPhoneToClipboard(this.dataset.phone); return false;"<?php echo $phoneHiddenByDay1 ? ' disabled' : ''; ?>><?php echo $phoneHiddenByDay1 ? 'Número oculto' : '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 cc-readonly-block" aria-disabled="true" style="user-select:none; -webkit-user-select:none; -moz-user-select:none; -ms-user-select:none;">
<div class="d-flex flex-wrap justify-content-between align-items-center gap-2 mb-3">
<div>
@ -2770,7 +2771,7 @@ function showAirDroidHelper(details) {
const copied = !!details.copied;
const modalId = details.modalId || '';
const phoneLocked = !!details.phoneLocked;
const phoneHiddenByDay1 = !!details.phoneHiddenByDay1;
if (modalId) {
const modalElement = document.getElementById(modalId);
if (modalElement && window.bootstrap && window.bootstrap.Modal) {
@ -2787,19 +2788,19 @@ function showAirDroidHelper(details) {
if (orderNode) orderNode.textContent = orderLabel;
if (clientNode) clientNode.textContent = clientName;
if (phoneNode) {
if (phoneLocked) {
phoneNode.innerHTML = '<span class="badge bg-warning-subtle text-warning-emphasis border"><i class="bi bi-lock-fill me-1"></i>Celular oculto</span>';
if (phoneHiddenByDay1) {
phoneNode.innerHTML = '<span class="badge bg-warning-subtle text-warning-emphasis border"><i class="bi bi-lock-fill me-1"></i>Número oculto</span>';
} else {
phoneNode.textContent = phone;
phoneNode.textContent = phone !== '-' ? phone : 'Sin celular';
}
}
if (copyButton) {
if (phoneLocked) {
if (copyButton) {
if (phoneHiddenByDay1) {
copyButton.dataset.phone = '';
copyButton.disabled = true;
copyButton.textContent = 'Número oculto';
copyButton.setAttribute('title', 'Disponible cuando se complete el sustento de Día 3');
copyButton.setAttribute('title', 'Número oculto en Día 1');
} else {
copyButton.dataset.phone = phone !== '-' ? phone : '';
copyButton.disabled = false;
@ -2807,8 +2808,6 @@ function showAirDroidHelper(details) {
copyButton.removeAttribute('title');
}
}
if (openButton) {
openButton.onclick = function () {
openAirDroidWeb();
};
@ -2826,6 +2825,11 @@ function registrarLlamada(event, trigger) {
const orderLabel = trigger?.dataset?.orderLabel || '';
const clientName = trigger?.dataset?.clientName || '';
const phoneLocked = trigger?.dataset?.phoneLocked === '1';
const phoneHiddenByDay1 = trigger?.dataset?.phoneHiddenDay1 === '1';
if (phoneLocked) {
alert('Este pedido tiene el celular bloqueado hasta completar el sustento de Día 3.');
return false;
}
if (!sourceKey) {
alert('No se encontró el pedido para registrar la llamada.');
@ -2888,6 +2892,7 @@ function registrarLlamada(event, trigger) {
modalId,
phone,
phoneLocked,
phoneHiddenByDay1,
orderLabel,
clientName,
registered,

View File

@ -76,6 +76,16 @@ function cc_test_display_value(?string $value, string $fallback = 'No registrado
return $value !== '' ? $value : $fallback;
}
function cc_test_phone_hidden_html(?string $value, string $fallback = 'Sin celular'): string
{
$value = trim((string) $value);
if ($value === '') {
return htmlspecialchars($fallback);
}
return '<span class="badge bg-warning-subtle text-warning-emphasis border"><i class="bi bi-lock-fill me-1"></i>Celular oculto</span>';
}
function cc_test_build_url(string $path, array $params = []): string
{
foreach ($params as $key => $value) {
@ -888,8 +898,8 @@ try {
$order['es_promo_final'] = $order['promo_final_habilitado'] && $order['promo_final_evidencia_cargada'];
$order['promo_final_pendiente'] = $order['promo_final_habilitado'] && !$order['promo_final_evidencia_cargada'];
$order['llamada_bloqueada_dia3'] = $followupDayInfo !== null
&& !empty($order['promo_final_pendiente'])
&& (int) ($followupDayInfo['promo_final_threshold_day'] ?? 4) === 3;
&& (int) ($followupDayInfo['day_number'] ?? 0) >= 3
&& !$order['promo_final_evidencia_cargada'];
$order['llamada_bloqueada_dia3_mensaje'] = $order['llamada_bloqueada_dia3']
? 'Celular oculto hasta completar el sustento de Día 3.'
: '';
@ -1921,6 +1931,8 @@ require_once 'layout_header.php';
$modalId = 'modalDriveTest' . $order['source_key'];
$badgeClass = cc_test_badge_class($order['estado']);
$followupDayInfo = $order['seguimiento_dia_info'] ?? null;
$phoneHiddenByDay1 = $followupDayInfo !== null
&& (int) ($followupDayInfo['day_number'] ?? 0) === 1;
$semaforoCuenta = cc_test_followup_semaforo($order);
$historial = cc_test_fetch_historial(db(), $order['source_key']);
$logisticaPendienteLabel = !empty($order['pendiente_logistica']) ? cc_test_pending_logistica_label($order) : null;
@ -2048,18 +2060,28 @@ require_once 'layout_header.php';
</div>
</form>
<?php endif; ?>
<?php
$phoneLocked = !empty($order['llamada_bloqueada_dia3']);
$phoneLockMessage = (string) ($order['llamada_bloqueada_dia3_mensaje'] ?? '');
if ($phoneLocked && $phoneLockMessage === '') {
$phoneLockMessage = 'Celular oculto mientras completas los pendientes del Día 3.';
}
$phoneRowHiddenLabel = 'Número oculto';
$phoneRowHiddenTitle = 'Número oculto';
?>
<div class="d-flex flex-column gap-1 align-items-stretch cc-callcenter-actions<?php echo in_array($_SESSION['user_role'] ?? '', ['Administrador', 'admin'], true) ? ' mt-1' : ''; ?>"> <?php if (!empty($order['telefono_url'])): ?>
<button
type="button"
class="btn btn-sm btn-primary cc-callcenter-action-btn"
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-phone-locked="<?php echo !empty($order['llamada_bloqueada_dia3']) ? '1' : '0'; ?>"
data-phone="<?php echo $phoneLocked ? '' : htmlspecialchars((string) ($order['celular'] ?? '')); ?>"
data-phone-locked="<?php echo $phoneLocked ? '1' : '0'; ?>"
data-phone-hidden-day1="<?php echo $phoneHiddenByDay1 ? '1' : '0'; ?>"
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 / Gestionar
onclick="return registrarLlamada(event, this)"<?php echo $phoneLocked ? ' disabled aria-disabled="true" title="Llamada bloqueada hasta completar el sustento de Día 3"' : ''; ?>>
<i class="bi bi-telephone-outbound"></i> <?php echo $phoneLocked ? 'Llamada bloqueada' : 'Llamar / Gestionar'; ?>
</button>
<?php else: ?>
<button type="button" class="btn btn-sm btn-primary cc-callcenter-action-btn text-nowrap" disabled>Sin teléfono</button>
@ -2088,12 +2110,12 @@ require_once 'layout_header.php';
<div class="fw-semibold"><?php echo htmlspecialchars(cc_test_display_value($order['nombre'], 'Sin nombre')); ?></div>
<div class="small text-muted mb-1">
Celular:
<?php if (!empty($order['llamada_bloqueada_dia3'])): ?>
<span class="badge bg-warning-subtle text-warning-emphasis border ms-1" title="<?php echo htmlspecialchars((string) ($order['llamada_bloqueada_dia3_mensaje'] ?? 'Celular oculto hasta completar el sustento de Día 3.'), ENT_QUOTES); ?>" aria-label="<?php echo htmlspecialchars((string) ($order['llamada_bloqueada_dia3_mensaje'] ?? 'Celular oculto hasta completar el sustento de Día 3.'), ENT_QUOTES); ?>">
<i class="bi bi-lock-fill me-1"></i>Celular oculto
<?php if ($phoneHiddenByDay1): ?>
<span class="badge bg-warning-subtle text-warning-emphasis border" title="<?php echo htmlspecialchars($phoneRowHiddenTitle, ENT_QUOTES); ?>" aria-label="<?php echo htmlspecialchars($phoneRowHiddenTitle, ENT_QUOTES); ?>">
<i class="bi bi-lock-fill me-1"></i><?php echo htmlspecialchars($phoneRowHiddenLabel, ENT_QUOTES); ?>
</span>
<?php else: ?>
<?php echo htmlspecialchars(cc_test_display_value($order['celular'], 'Sin número')); ?>
<?php echo htmlspecialchars(cc_test_display_value($order['celular'], 'Sin celular')); ?>
<?php endif; ?>
</div>
<div class="small text-muted">DNI: <?php echo htmlspecialchars(cc_test_display_value($order['dni'], 'Sin DNI')); ?></div>
@ -2177,9 +2199,9 @@ require_once 'layout_header.php';
</div>
<div class="small text-muted mt-1">
<?php echo htmlspecialchars(cc_test_display_value($order['producto'], 'Sin producto')); ?> ·
<?php if (!empty($order['llamada_bloqueada_dia3'])): ?>
<span class="badge bg-warning-subtle text-warning-emphasis border ms-1" title="<?php echo htmlspecialchars((string) ($order['llamada_bloqueada_dia3_mensaje'] ?? 'Celular oculto hasta completar el sustento de Día 3.'), ENT_QUOTES); ?>" aria-label="<?php echo htmlspecialchars((string) ($order['llamada_bloqueada_dia3_mensaje'] ?? 'Celular oculto hasta completar el sustento de Día 3.'), ENT_QUOTES); ?>">
<i class="bi bi-lock-fill me-1"></i>Celular oculto
<?php if ($phoneHiddenByDay1): ?>
<span class="badge bg-warning-subtle text-warning-emphasis border" title="Número oculto" aria-label="Número oculto">
<i class="bi bi-lock-fill me-1"></i>Número oculto
</span>
<?php else: ?>
<?php echo htmlspecialchars(cc_test_display_value($order['celular'], 'Sin celular')); ?>
@ -2226,11 +2248,11 @@ require_once 'layout_header.php';
<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"><?php echo !empty($order['llamada_bloqueada_dia3']) ? 'Celular oculto' : 'Número listo para copiar'; ?></h4>
<h4 class="h6 fw-bold mb-2"><?php echo $phoneHiddenByDay1 ? 'Número oculto' : '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 if (!empty($order['llamada_bloqueada_dia3'])): ?>
<span class="badge bg-warning-subtle text-warning-emphasis border" title="<?php echo htmlspecialchars((string) ($order['llamada_bloqueada_dia3_mensaje'] ?? 'Celular oculto hasta completar el sustento de Día 3.'), ENT_QUOTES); ?>" aria-label="<?php echo htmlspecialchars((string) ($order['llamada_bloqueada_dia3_mensaje'] ?? 'Celular oculto hasta completar el sustento de Día 3.'), ENT_QUOTES); ?>">
<i class="bi bi-lock-fill me-1"></i>Celular oculto
<?php if ($phoneHiddenByDay1): ?>
<span class="badge bg-warning-subtle text-warning-emphasis border" title="Número oculto" aria-label="Número oculto">
<i class="bi bi-lock-fill me-1"></i>Número oculto
</span>
<?php else: ?>
<?php echo htmlspecialchars(cc_test_display_value($order['celular'], 'Sin celular')); ?>
@ -2238,7 +2260,7 @@ require_once 'layout_header.php';
</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 !empty($order['llamada_bloqueada_dia3']) ? '' : htmlspecialchars((string) ($order['celular'] ?? '')); ?>" onclick="copyPhoneToClipboard(this.dataset.phone); return false;"<?php echo !empty($order['llamada_bloqueada_dia3']) ? ' disabled' : ''; ?>><?php echo !empty($order['llamada_bloqueada_dia3']) ? 'Número oculto' : 'Copiar número'; ?></button>
<button type="button" class="btn btn-outline-primary btn-sm" id="airDroidCopyButton-<?php echo htmlspecialchars($order['source_key']); ?>" data-phone="<?php echo $phoneHiddenByDay1 ? '' : htmlspecialchars((string) ($order['celular'] ?? '')); ?>" onclick="copyPhoneToClipboard(this.dataset.phone); return false;"<?php echo $phoneHiddenByDay1 ? ' disabled' : ''; ?>><?php echo $phoneHiddenByDay1 ? 'Número oculto' : 'Copiar número'; ?></button>
<button type="button" class="btn btn-outline-secondary btn-sm" onclick="openAirDroidWeb()">Abrir AirDroid Web</button>
</div>
</div>
@ -3286,7 +3308,7 @@ function showAirDroidHelper(details) {
const copied = !!details.copied;
const modalId = details.modalId || '';
const phoneLocked = !!details.phoneLocked;
const phoneHiddenByDay1 = !!details.phoneHiddenByDay1;
if (modalId) {
const modalElement = document.getElementById(modalId);
if (modalElement && window.bootstrap && window.bootstrap.Modal) {
@ -3303,19 +3325,19 @@ function showAirDroidHelper(details) {
if (orderNode) orderNode.textContent = orderLabel;
if (clientNode) clientNode.textContent = clientName;
if (phoneNode) {
if (phoneLocked) {
phoneNode.innerHTML = '<span class="badge bg-warning-subtle text-warning-emphasis border"><i class="bi bi-lock-fill me-1"></i>Celular oculto</span>';
if (phoneHiddenByDay1) {
phoneNode.innerHTML = '<span class="badge bg-warning-subtle text-warning-emphasis border"><i class="bi bi-lock-fill me-1"></i>Número oculto</span>';
} else {
phoneNode.textContent = phone;
phoneNode.textContent = phone !== '-' ? phone : 'Sin celular';
}
}
if (copyButton) {
if (phoneLocked) {
if (copyButton) {
if (phoneHiddenByDay1) {
copyButton.dataset.phone = '';
copyButton.disabled = true;
copyButton.textContent = 'Número oculto';
copyButton.setAttribute('title', 'Disponible cuando se complete el sustento de Día 3');
copyButton.setAttribute('title', 'Número oculto en Día 1');
} else {
copyButton.dataset.phone = phone !== '-' ? phone : '';
copyButton.disabled = false;
@ -3323,8 +3345,6 @@ function showAirDroidHelper(details) {
copyButton.removeAttribute('title');
}
}
if (openButton) {
openButton.onclick = function () {
openAirDroidWeb();
};
@ -3342,6 +3362,11 @@ function registrarLlamada(event, trigger) {
const orderLabel = trigger?.dataset?.orderLabel || '';
const clientName = trigger?.dataset?.clientName || '';
const phoneLocked = trigger?.dataset?.phoneLocked === '1';
const phoneHiddenByDay1 = trigger?.dataset?.phoneHiddenDay1 === '1';
if (phoneLocked) {
alert('Este pedido tiene el celular bloqueado hasta completar el sustento de Día 3.');
return false;
}
if (!sourceKey) {
alert('No se encontró el pedido para registrar la llamada.');
@ -3404,6 +3429,7 @@ function registrarLlamada(event, trigger) {
modalId,
phone,
phoneLocked,
phoneHiddenByDay1,
orderLabel,
clientName,
registered,