feat: modo embebido de formulario por lugar (link vs iframe)
- Nueva columna turnero_lugares.formulario_modo (link|embebido) - Config: radio en modal de edición para elegir el modo - lugar.php: muestra iframe con ver_formulario_enviado al activar turno - API get_consent_token.php: crea/obtiene token para turno+lugar Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
daa9827d93
commit
f8245b4d6f
@@ -207,7 +207,7 @@ $tab = $_GET['tab'] ?? 'lugares';
|
||||
<span class="badge <?= $lu['activo'] ? 'bg-success-subtle text-success' : 'bg-secondary-subtle text-secondary' ?> ms-1">
|
||||
<?= $lu['activo'] ? 'Activo' : 'Inactivo' ?>
|
||||
</span>
|
||||
<button class="btn-icon text-primary" onclick="editarLugar(<?= $lu['id'] ?>,'<?= addslashes($lu['nombre']) ?>','<?= addslashes($lu['descripcion'] ?? '') ?>',<?= $lu['activo'] ?>,<?= $lu['sort_order'] ?>,'recepcion')" title="Editar">
|
||||
<button class="btn-icon text-primary" onclick="editarLugar(<?= $lu['id'] ?>,'<?= addslashes($lu['nombre']) ?>','<?= addslashes($lu['descripcion'] ?? '') ?>',<?= $lu['activo'] ?>,<?= $lu['sort_order'] ?>,'recepcion','<?= $lu['formulario_modo'] ?? 'link' ?>')" title="Editar">
|
||||
<i class="fas fa-pencil-alt"></i>
|
||||
</button>
|
||||
<button class="btn-icon text-danger" onclick="eliminarLugar(<?= $lu['id'] ?>, '<?= addslashes($lu['nombre']) ?>')" title="Eliminar">
|
||||
@@ -268,7 +268,7 @@ $tab = $_GET['tab'] ?? 'lugares';
|
||||
<button class="btn-icon" onclick="copiarUrlDisplay(<?= $lu['id'] ?>)" title="Copiar URL pantalla TV de este lugar">
|
||||
<i class="fas fa-tv"></i>
|
||||
</button>
|
||||
<button class="btn-icon text-primary" onclick="editarLugar(<?= $lu['id'] ?>,'<?= addslashes($lu['nombre']) ?>','<?= addslashes($lu['descripcion'] ?? '') ?>',<?= $lu['activo'] ?>,<?= $lu['sort_order'] ?>,'muestras')" title="Editar">
|
||||
<button class="btn-icon text-primary" onclick="editarLugar(<?= $lu['id'] ?>,'<?= addslashes($lu['nombre']) ?>','<?= addslashes($lu['descripcion'] ?? '') ?>',<?= $lu['activo'] ?>,<?= $lu['sort_order'] ?>,'muestras','<?= $lu['formulario_modo'] ?? 'link' ?>')" title="Editar">
|
||||
<i class="fas fa-pencil-alt"></i>
|
||||
</button>
|
||||
<button class="btn-icon text-danger" onclick="eliminarLugar(<?= $lu['id'] ?>, '<?= addslashes($lu['nombre']) ?>')" title="Eliminar">
|
||||
@@ -334,7 +334,7 @@ $tab = $_GET['tab'] ?? 'lugares';
|
||||
<div class="mb-2 mt-3">
|
||||
<label class="form-label small fw-semibold">
|
||||
<i class="fas fa-file-signature me-1 text-warning"></i>
|
||||
Consentimientos requeridos para este lugar
|
||||
Formularios de consentimiento
|
||||
</label>
|
||||
<div id="edit-lu-consents" class="border rounded p-2" style="max-height:160px;overflow-y:auto;background:#fffbeb">
|
||||
<?php foreach ($formulariosCons as $fc): ?>
|
||||
@@ -352,6 +352,23 @@ $tab = $_GET['tab'] ?? 'lugares';
|
||||
<small class="text-muted">No hay formularios activos configurados.</small>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
<label class="form-label small fw-semibold mb-1">Modo de presentación del formulario</label>
|
||||
<div class="d-flex gap-3">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="edit-lu-form-modo" id="edit-lu-modo-link" value="link" checked>
|
||||
<label class="form-check-label small" for="edit-lu-modo-link">
|
||||
<i class="fas fa-link me-1 text-primary"></i>Enviar por link / WA
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="edit-lu-form-modo" id="edit-lu-modo-embebido" value="embebido">
|
||||
<label class="form-check-label small" for="edit-lu-modo-embebido">
|
||||
<i class="fas fa-window-maximize me-1 text-success"></i>Embebido en pantalla
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer py-2 px-3">
|
||||
@@ -986,7 +1003,10 @@ async function guardarLugar(tipoOrId = 'muestras', id = null) {
|
||||
});
|
||||
}
|
||||
|
||||
const body = { nombre, tipo, descripcion: desc, sort_order: orden, activo, formulario_ids: formularioIds };
|
||||
const formModo = esEdicion
|
||||
? (document.querySelector('input[name="edit-lu-form-modo"]:checked')?.value || 'link')
|
||||
: 'link';
|
||||
const body = { nombre, tipo, descripcion: desc, sort_order: orden, activo, formulario_ids: formularioIds, formulario_modo: formModo };
|
||||
if (id) body.id = id;
|
||||
|
||||
try {
|
||||
@@ -1001,7 +1021,7 @@ async function guardarLugar(tipoOrId = 'muestras', id = null) {
|
||||
} catch (e) { toast('Error de conexión', 'error'); }
|
||||
}
|
||||
|
||||
function editarLugar(id, nombre, desc, activo, orden, tipo = 'muestras') {
|
||||
function editarLugar(id, nombre, desc, activo, orden, tipo = 'muestras', formModo = 'link') {
|
||||
document.getElementById('edit-lu-id').value = id;
|
||||
document.getElementById('edit-lu-tipo').value = tipo;
|
||||
document.getElementById('edit-lu-nombre').value = nombre;
|
||||
@@ -1017,6 +1037,10 @@ function editarLugar(id, nombre, desc, activo, orden, tipo = 'muestras') {
|
||||
chk.checked = formIds.includes(parseInt(chk.value));
|
||||
});
|
||||
|
||||
// Modo de presentación
|
||||
const modoEl = document.querySelector(`input[name="edit-lu-form-modo"][value="${formModo}"]`);
|
||||
if (modoEl) modoEl.checked = true;
|
||||
|
||||
new bootstrap.Modal(document.getElementById('modalEditarLugar')).show();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user