up
This commit is contained in:
@@ -29,7 +29,16 @@ try {
|
||||
$lugares = $pdo->query(
|
||||
'SELECT * FROM turnero_lugares ORDER BY sort_order ASC, id ASC'
|
||||
)->fetchAll(PDO::FETCH_ASSOC);
|
||||
} catch (\Throwable $e) { $_loadErrors[] = 'turnero_lugares: ' . $e->getMessage(); }
|
||||
// Cargar formularios de consentimiento vinculados a cada lugar
|
||||
$lugarFormIds = [];
|
||||
foreach ($lugares as $lu) {
|
||||
$stmtLcf = $pdo->prepare(
|
||||
"SELECT formulario_id FROM turnero_lugar_consentimientos WHERE lugar_id = ?"
|
||||
);
|
||||
$stmtLcf->execute([$lu['id']]);
|
||||
$lugarFormIds[(int)$lu['id']] = $stmtLcf->fetchAll(PDO::FETCH_COLUMN);
|
||||
}
|
||||
} catch (\Throwable $e) { $_loadErrors[] = 'turnero_lugares: ' . $e->getMessage(); $lugarFormIds = []; }
|
||||
|
||||
try {
|
||||
$prioridades = $pdo->query(
|
||||
@@ -321,6 +330,28 @@ $tab = $_GET['tab'] ?? 'lugares';
|
||||
<input class="form-check-input" type="checkbox" id="edit-lu-activo">
|
||||
<label class="form-check-label small" for="edit-lu-activo">Activo</label>
|
||||
</div>
|
||||
<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
|
||||
</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): ?>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input edit-lu-consent-chk"
|
||||
type="checkbox"
|
||||
value="<?= (int)$fc['id'] ?>"
|
||||
id="edit-lu-fc-<?= (int)$fc['id'] ?>">
|
||||
<label class="form-check-label small" for="edit-lu-fc-<?= (int)$fc['id'] ?>">
|
||||
<?= htmlspecialchars($fc['nombre']) ?>
|
||||
</label>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php if (empty($formulariosCons)): ?>
|
||||
<small class="text-muted">No hay formularios activos configurados.</small>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer py-2 px-3">
|
||||
<button class="btn btn-secondary btn-sm" data-bs-dismiss="modal">Cancelar</button>
|
||||
@@ -772,6 +803,9 @@ $tab = $_GET['tab'] ?? 'lugares';
|
||||
═══════════════════════════════════════════════════════════ */
|
||||
const API = '<?= BASE_URL ?>modules/turnero/api/';
|
||||
|
||||
// Mapa de formularios de consentimiento por lugar (cargado desde PHP)
|
||||
const LUGAR_FORM_IDS = <?= json_encode($lugarFormIds ?? []) ?>;
|
||||
|
||||
// ── Toast helper ────────────────────────────────────────────
|
||||
function toast(msg, type = 'success') {
|
||||
const stack = document.getElementById('toastStack');
|
||||
@@ -811,7 +845,15 @@ async function guardarLugar(tipoOrId = 'muestras', id = null) {
|
||||
|
||||
if (!nombre) { toast('El nombre es requerido', 'error'); return; }
|
||||
|
||||
const body = { nombre, tipo, descripcion: desc, sort_order: orden, activo };
|
||||
// Consentimientos: solo aplica al editar (el modal tiene los checkboxes)
|
||||
const formularioIds = [];
|
||||
if (esEdicion) {
|
||||
document.querySelectorAll('.edit-lu-consent-chk:checked').forEach(chk => {
|
||||
formularioIds.push(parseInt(chk.value));
|
||||
});
|
||||
}
|
||||
|
||||
const body = { nombre, tipo, descripcion: desc, sort_order: orden, activo, formulario_ids: formularioIds };
|
||||
if (id) body.id = id;
|
||||
|
||||
try {
|
||||
@@ -835,6 +877,13 @@ function editarLugar(id, nombre, desc, activo, orden, tipo = 'muestras') {
|
||||
document.getElementById('edit-lu-activo').checked = !!activo;
|
||||
const titulo = tipo === 'recepcion' ? 'Editar escritorio de recepción' : 'Editar estación de muestras';
|
||||
document.getElementById('modal-lugar-titulo').textContent = titulo;
|
||||
|
||||
// Marcar checkboxes de consentimientos del lugar
|
||||
const formIds = (LUGAR_FORM_IDS[id] || []).map(Number);
|
||||
document.querySelectorAll('.edit-lu-consent-chk').forEach(chk => {
|
||||
chk.checked = formIds.includes(parseInt(chk.value));
|
||||
});
|
||||
|
||||
new bootstrap.Modal(document.getElementById('modalEditarLugar')).show();
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,9 @@ unset($p);
|
||||
height: 48px;
|
||||
max-width: 140px;
|
||||
object-fit: contain;
|
||||
filter: brightness(0) invert(1);
|
||||
background: #fff;
|
||||
border-radius: 8px;
|
||||
padding: 4px 6px;
|
||||
}
|
||||
.kiosko-topbar .logo-fallback {
|
||||
width: 46px; height: 46px;
|
||||
@@ -137,6 +139,19 @@ unset($p);
|
||||
font-size: .8rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
.btn-fullscreen {
|
||||
background: rgba(255,255,255,.15);
|
||||
border: 1.5px solid rgba(255,255,255,.3);
|
||||
color: #fff;
|
||||
border-radius: 8px;
|
||||
padding: 6px 10px;
|
||||
font-size: 1rem;
|
||||
cursor: pointer;
|
||||
transition: background .15s;
|
||||
flex-shrink: 0;
|
||||
line-height: 1;
|
||||
}
|
||||
.btn-fullscreen:hover { background: rgba(255,255,255,.28); }
|
||||
|
||||
/* ── Pantalla / paso ── */
|
||||
.screen {
|
||||
@@ -351,6 +366,9 @@ unset($p);
|
||||
<?php endif; ?>
|
||||
<div class="lab-nombre"><?= $_kNombre ?></div>
|
||||
<div class="turno-badge"><i class="fas fa-ticket-alt me-1"></i>Turnero</div>
|
||||
<button class="btn-fullscreen" id="btn-fs" onclick="toggleFullscreen()" title="Pantalla completa">
|
||||
<i class="fas fa-expand" id="fs-icon"></i>
|
||||
</button>
|
||||
</header>
|
||||
|
||||
|
||||
@@ -518,6 +536,22 @@ unset($p);
|
||||
|
||||
function setSpinner(on) { document.getElementById('spinner').classList.toggle('active', on); }
|
||||
|
||||
function toggleFullscreen() {
|
||||
if (!document.fullscreenElement) {
|
||||
document.documentElement.requestFullscreen().catch(() => {});
|
||||
} else {
|
||||
document.exitFullscreen().catch(() => {});
|
||||
}
|
||||
}
|
||||
document.addEventListener('fullscreenchange', () => {
|
||||
const icon = document.getElementById('fs-icon');
|
||||
if (document.fullscreenElement) {
|
||||
icon.classList.replace('fa-expand', 'fa-compress');
|
||||
} else {
|
||||
icon.classList.replace('fa-compress', 'fa-expand');
|
||||
}
|
||||
});
|
||||
|
||||
function mostrarError(msg) {
|
||||
const el = document.getElementById('toast-error');
|
||||
el.textContent = msg;
|
||||
|
||||
Reference in New Issue
Block a user