ux: lugar destino al final, refresh en consentimientos, fix pasarALugar
- sel-lugar movido a última sección (antes de acciones) para que el usuario lo seleccione justo antes de guardar/pasar - resetCheckboxes() ahora también limpia sel-lugar entre turnos - pasarALugar() lee sel-lugar directamente como primera opción, evitando que un solicitudActiva.lugar_id desactualizado cause errores - Botón refresh (fa-sync-alt) en cabecera de consentimientos llama refrescarConsentimientosLugar() para ver estado sin recargar Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
3ae57a78e4
commit
53bc184894
@@ -686,17 +686,6 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ── Sección 2: Lugar destino ── -->
|
||||
<div class="ficha-section">
|
||||
<h6><i class="fas fa-map-marker-alt me-1"></i>Lugar destino</h6>
|
||||
<select id="sel-lugar" class="form-select form-select-sm">
|
||||
<option value="">— Seleccione destino —</option>
|
||||
<?php foreach ($lugaresDestino as $ld): ?>
|
||||
<option value="<?= (int)$ld['id'] ?>"><?= htmlspecialchars($ld['nombre']) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Banner RIPS: exámenes detectados automáticamente -->
|
||||
<div id="banner-rips" class="d-none mt-1 mb-1 p-2 rounded d-flex align-items-center justify-content-between gap-2"
|
||||
style="background:#f0fdf4;border:1px solid #86efac;font-size:.82rem">
|
||||
@@ -887,15 +876,33 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
<div class="ficha-section" id="sec-consentimientos" style="display:none">
|
||||
<div class="d-flex align-items-center justify-content-between mb-2">
|
||||
<h6 class="mb-0"><i class="fas fa-file-signature me-1"></i>Consentimientos informados</h6>
|
||||
<button class="btn btn-sm btn-outline-primary py-0 px-2"
|
||||
id="btn-reenviar-consent" onclick="enviarConsentimientosTodos()"
|
||||
title="Enviar todos por WhatsApp">
|
||||
<i class="fas fa-paper-plane me-1"></i>Enviar todos
|
||||
</button>
|
||||
<div class="d-flex gap-1">
|
||||
<button class="btn btn-sm btn-outline-secondary py-0 px-2"
|
||||
onclick="refrescarConsentimientosLugar()"
|
||||
title="Actualizar estado">
|
||||
<i class="fas fa-sync-alt"></i>
|
||||
</button>
|
||||
<button class="btn btn-sm btn-outline-primary py-0 px-2"
|
||||
id="btn-reenviar-consent" onclick="enviarConsentimientosTodos()"
|
||||
title="Enviar todos por WhatsApp">
|
||||
<i class="fas fa-paper-plane me-1"></i>Enviar todos
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="lista-consentimientos"></div>
|
||||
</div>
|
||||
|
||||
<!-- ── Lugar destino (al final, justo antes de acciones) ── -->
|
||||
<div class="ficha-section">
|
||||
<h6><i class="fas fa-map-marker-alt me-1"></i>Lugar destino</h6>
|
||||
<select id="sel-lugar" class="form-select form-select-sm">
|
||||
<option value="">— Seleccione destino —</option>
|
||||
<?php foreach ($lugaresDestino as $ld): ?>
|
||||
<option value="<?= (int)$ld['id'] ?>"><?= htmlspecialchars($ld['nombre']) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- ── Acciones ── -->
|
||||
<div class="ficha-acciones">
|
||||
<div class="accion-primary-row">
|
||||
@@ -2170,6 +2177,9 @@ async function pasarALugar() {
|
||||
const btn = document.getElementById('btn-pasar-lugar');
|
||||
if (btn) btn.disabled = true;
|
||||
|
||||
// Leer lugar del select (tiene prioridad sobre lo guardado en BD)
|
||||
const lugarSeleccionado = parseInt(document.getElementById('sel-lugar').value) || solicitudActiva.lugar_id;
|
||||
|
||||
try {
|
||||
const res = await fetch(API + 'cambiar_estado.php', {
|
||||
method: 'POST',
|
||||
@@ -2177,7 +2187,7 @@ async function pasarALugar() {
|
||||
body: JSON.stringify({
|
||||
turno_id: turnoActivo.id,
|
||||
nuevo_estado: 'en_espera_lugar',
|
||||
lugar_id: solicitudActiva.lugar_id,
|
||||
lugar_id: lugarSeleccionado,
|
||||
}),
|
||||
});
|
||||
const json = await res.json();
|
||||
@@ -2308,7 +2318,8 @@ function resetCheckboxes() {
|
||||
document.getElementById('wrap-examenes').classList.remove('disabled');
|
||||
document.getElementById('bloque-medico').style.display = '';
|
||||
descartarRips();
|
||||
document.getElementById('sel-pago').value = '';
|
||||
document.getElementById('sel-lugar').value = '';
|
||||
document.getElementById('sel-pago').value = '';
|
||||
document.getElementById('inp-total').value = '';
|
||||
document.getElementById('inp-recibo').value = '';
|
||||
document.getElementById('panel-recibo').classList.add('d-none');
|
||||
|
||||
Reference in New Issue
Block a user