REVERT: restaura calendario.html al estado anterior a los cambios de hoy
This commit is contained in:
@@ -268,14 +268,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="desc-box text-left">
|
<div class="desc-box text-left">
|
||||||
<div class="flex items-center justify-between mb-3">
|
<p class="text-[10px] font-black text-primary-dynamic uppercase tracking-widest mb-3 flex items-center gap-2"><i data-lucide="file-text" class="w-4 h-4"></i> Descripción del Servicio</p>
|
||||||
<p class="text-[10px] font-black text-primary-dynamic uppercase tracking-widest flex items-center gap-2"><i data-lucide="file-text" class="w-4 h-4"></i> Descripción del Servicio</p>
|
|
||||||
<button type="button" id="btnImproveDesc" onclick="improveServiceDescription()" class="text-[9px] font-black text-indigo-600 uppercase tracking-widest flex items-center gap-1 active:scale-95 shrink-0">
|
|
||||||
<i data-lucide="sparkles" class="w-3.5 h-3.5"></i> Mejorar con IA
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div id="detDesc" class="text-sm font-bold text-slate-600 leading-relaxed max-h-60 overflow-y-auto no-scrollbar">--</div>
|
<div id="detDesc" class="text-sm font-bold text-slate-600 leading-relaxed max-h-60 overflow-y-auto no-scrollbar">--</div>
|
||||||
<button type="button" id="btnRevertDesc" onclick="revertServiceDescription()" class="hidden mt-2 text-[9px] font-bold text-slate-400 uppercase tracking-widest active:scale-95">Ver texto original</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="bg-white border border-slate-200 rounded-3xl overflow-hidden shadow-sm text-left">
|
<div class="bg-white border border-slate-200 rounded-3xl overflow-hidden shadow-sm text-left">
|
||||||
@@ -1010,8 +1004,6 @@
|
|||||||
else banner.classList.add('hidden');
|
else banner.classList.add('hidden');
|
||||||
|
|
||||||
document.getElementById('detDesc').innerHTML = (raw["Descripción"] || raw["DESCRIPCION"] || "Sin notas.").replace(/\n/g, '<br>');
|
document.getElementById('detDesc').innerHTML = (raw["Descripción"] || raw["DESCRIPCION"] || "Sin notas.").replace(/\n/g, '<br>');
|
||||||
originalDescHtml = "";
|
|
||||||
document.getElementById('btnRevertDesc').classList.add('hidden');
|
|
||||||
|
|
||||||
const extraContainer = document.getElementById('extraDataBox');
|
const extraContainer = document.getElementById('extraDataBox');
|
||||||
extraContainer.innerHTML = '';
|
extraContainer.innerHTML = '';
|
||||||
@@ -1061,50 +1053,6 @@
|
|||||||
setTimeout(() => modal.style.display = 'none', 300);
|
setTimeout(() => modal.style.display = 'none', 300);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==========================================
|
|
||||||
// ✨ MEJORAR DESCRIPCIÓN DEL SERVICIO CON IA (solo vista, no modifica el dato original)
|
|
||||||
// ==========================================
|
|
||||||
let originalDescHtml = "";
|
|
||||||
|
|
||||||
async function improveServiceDescription() {
|
|
||||||
const descBox = document.getElementById('detDesc');
|
|
||||||
const rawText = descBox.innerText.trim();
|
|
||||||
if (!rawText || rawText === '--' || rawText === 'Sin notas.') { showToast("No hay descripción que mejorar", true); return; }
|
|
||||||
|
|
||||||
originalDescHtml = descBox.innerHTML;
|
|
||||||
const btn = document.getElementById('btnImproveDesc');
|
|
||||||
const original = btn.innerHTML;
|
|
||||||
btn.disabled = true;
|
|
||||||
btn.innerHTML = '<i data-lucide="loader-2" class="w-3.5 h-3.5 animate-spin"></i> Mejorando...';
|
|
||||||
safeLoadIcons();
|
|
||||||
|
|
||||||
try {
|
|
||||||
const res = await fetch(`${API_URL}/services/description/improve`, {
|
|
||||||
method: 'POST',
|
|
||||||
headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${localStorage.getItem('token')}` },
|
|
||||||
body: JSON.stringify({ text: rawText })
|
|
||||||
});
|
|
||||||
const data = await res.json();
|
|
||||||
if (data.ok) {
|
|
||||||
descBox.innerHTML = data.text.replace(/\n/g, '<br>');
|
|
||||||
document.getElementById('btnRevertDesc').classList.remove('hidden');
|
|
||||||
showToast("Descripción reordenada (solo vista, el dato original no cambia)");
|
|
||||||
} else {
|
|
||||||
showToast(data.error || "No se pudo mejorar la descripción", true);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
showToast("Error de conexión con la IA", true);
|
|
||||||
} finally {
|
|
||||||
btn.disabled = false; btn.innerHTML = original; safeLoadIcons();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function revertServiceDescription() {
|
|
||||||
const descBox = document.getElementById('detDesc');
|
|
||||||
if (originalDescHtml) descBox.innerHTML = originalDescHtml;
|
|
||||||
document.getElementById('btnRevertDesc').classList.add('hidden');
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==========================================
|
// ==========================================
|
||||||
// 🧾 PARTE DE TRABAJO (texto con IA + firma táctil + PDF + envío WhatsApp)
|
// 🧾 PARTE DE TRABAJO (texto con IA + firma táctil + PDF + envío WhatsApp)
|
||||||
// ==========================================
|
// ==========================================
|
||||||
|
|||||||
Reference in New Issue
Block a user