p
This commit is contained in:
@@ -879,6 +879,17 @@ if (!isUserLoggedIn()) {
|
||||
v1.4.0-<?php echo substr(time(), -4); ?>
|
||||
</span>
|
||||
</h5>
|
||||
<!-- Toggle disponibilidad de asesor -->
|
||||
<div style="margin-top:6px; display:flex; align-items:center; gap:8px;">
|
||||
<span style="font-size:11px; color:rgba(255,255,255,0.8);">Asesor:</span>
|
||||
<button id="advisor-mode-btn"
|
||||
onclick="toggleAdvisorMode()"
|
||||
style="font-size:11px; padding:2px 10px; border-radius:20px; border:none; cursor:pointer; font-weight:600; transition:all 0.2s;"
|
||||
title="Activar/desactivar menú de asesor ausente">
|
||||
…
|
||||
</button>
|
||||
<span id="advisor-mode-label" style="font-size:10px; color:rgba(255,255,255,0.7);"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<a href="index.php" class="text-white text-decoration-none">
|
||||
@@ -8032,5 +8043,56 @@ const citasModal = (() => {
|
||||
<!-- Barra de sesiones minimizadas (agendamientos en paralelo) -->
|
||||
<div id="labdom-pills-bar"></div>
|
||||
|
||||
<script>
|
||||
// ── Disponibilidad del asesor (menú secundario no_advisor) ────────────────
|
||||
(function() {
|
||||
var btn = document.getElementById('advisor-mode-btn');
|
||||
var label = document.getElementById('advisor-mode-label');
|
||||
|
||||
function applyState(available) {
|
||||
if (available) {
|
||||
btn.textContent = '🟢 Disponible';
|
||||
btn.style.background = '#25d366';
|
||||
btn.style.color = '#fff';
|
||||
if (label) label.textContent = 'El bot usa el menú principal';
|
||||
} else {
|
||||
btn.textContent = '🔴 Ausente';
|
||||
btn.style.background = '#dc3545';
|
||||
btn.style.color = '#fff';
|
||||
if (label) label.textContent = 'El bot usa el menú de asesor ausente';
|
||||
}
|
||||
}
|
||||
|
||||
// Cargar estado inicial
|
||||
fetch('api/set_advisor_mode.php', { credentials: 'same-origin' })
|
||||
.then(function(r){ return r.json(); })
|
||||
.then(function(d){ if (d && d.success !== undefined) applyState(d.available); })
|
||||
.catch(function(){});
|
||||
|
||||
window.toggleAdvisorMode = function() {
|
||||
var current = btn.textContent.indexOf('Disponible') !== -1;
|
||||
var next = !current;
|
||||
fetch('api/set_advisor_mode.php', {
|
||||
method: 'POST',
|
||||
credentials: 'same-origin',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ available: next })
|
||||
})
|
||||
.then(function(r){ return r.json(); })
|
||||
.then(function(d){
|
||||
if (d && d.success) {
|
||||
applyState(d.available);
|
||||
var msg = d.available
|
||||
? '✅ Modo asesor disponible activado. El bot usará el menú principal.'
|
||||
: '⚠️ Asesor marcado como ausente. El bot usará el menú secundario.';
|
||||
if (window.showToast) showToast(msg);
|
||||
else alert(msg);
|
||||
}
|
||||
})
|
||||
.catch(function(){ alert('Error al cambiar el modo de asesor.'); });
|
||||
};
|
||||
})();
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user