Tomar turno

Presiona el botón y conserva tu ticket. Tu folio aparecerá en pantalla cuando sea tu turno.

Folio numérico del 01 al 99 · reinicio diario automático
✅ Turno generado
Tu turno
--
Esta pantalla se limpiará en 5 segundos.
© 2026 BeHost México. Derechos reservados.
`; const iframe = document.createElement('iframe'); iframe.style.position = 'fixed'; iframe.style.right = '0'; iframe.style.bottom = '0'; iframe.style.width = '0'; iframe.style.height = '0'; iframe.style.border = '0'; document.body.appendChild(iframe); const doc = iframe.contentWindow.document; doc.open(); doc.write(html); doc.close(); setTimeout(() => { try { iframe.contentWindow.focus(); iframe.contentWindow.print(); } catch (e) {} setTimeout(() => iframe.remove(), 2000); }, 350); } async function tomarTurno() { btn.disabled = true; btn.textContent = 'Generando…'; const form = new FormData(); form.append('accion', 'tomar'); try { const res = await fetch(location.href, { method: 'POST', body: form, cache: 'no-store' }); const json = await res.json(); if (!json.ok) throw new Error(json.message || 'No se pudo generar el turno.'); const data = json.data; folio.textContent = data.ticket_text; meta.textContent = `${data.fecha} · ${data.hora}`; box.classList.add('show'); btn.textContent = '✅ Turno tomado'; if (autoPrint) imprimirTicket(data); limpiarDespues(); } catch (err) { alert('Error: ' + err.message); btn.disabled = false; btn.textContent = '🎟️ Tomar turno'; } } btn.addEventListener('click', tomarTurno); })();