feat: 6 nuevas funcionalidades - notas obligatorias turno, reporte enfermero, plantilla WhatsApp, adjuntar orden modal, roles solo lectura, fix valores copago
This commit is contained in:
+10
-8
@@ -10,8 +10,9 @@ if (isEnfermero() && !enfermeraId()) { header('Location: enfermero_portal.php');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Pragma: no-cache');
|
||||
|
||||
$adminNombre = $_SESSION['admin_user']['full_name'] ?? 'Usuario';
|
||||
$esAdmin = !isEnfermero();
|
||||
$adminNombre = $_SESSION['admin_user']['full_name'] ?? 'Usuario';
|
||||
$esAdmin = !isEnfermero();
|
||||
$puedeEscribir = $esAdmin && hasModuleWrite('lab_formularios');
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="es">
|
||||
@@ -66,7 +67,7 @@ $esAdmin = !isEnfermero();
|
||||
<h1><i class="fas fa-wpforms text-primary"></i> Formularios</h1>
|
||||
<small class="text-muted"><?= htmlspecialchars($adminNombre) ?></small>
|
||||
</div>
|
||||
<?php if ($esAdmin): ?>
|
||||
<?php if ($puedeEscribir): ?>
|
||||
<button class="btn btn-primary btn-sm" onclick="builder.nuevo()">
|
||||
<i class="fas fa-plus me-1"></i> Nuevo Formulario
|
||||
</button>
|
||||
@@ -259,7 +260,8 @@ $esAdmin = !isEnfermero();
|
||||
// ══════════════════════════════════════════════════════════════════════
|
||||
// CONFIGURACIÓN
|
||||
// ══════════════════════════════════════════════════════════════════════
|
||||
const ES_ADMIN = <?= $esAdmin ? 'true' : 'false' ?>;
|
||||
const ES_ADMIN = <?= $esAdmin ? 'true' : 'false' ?>;
|
||||
const PUEDE_ESCRIBIR = <?= $puedeEscribir ? 'true' : 'false' ?>;
|
||||
|
||||
// Tipos de campo disponibles
|
||||
const TIPOS_CAMPO = [
|
||||
@@ -336,7 +338,7 @@ function renderFormularios() {
|
||||
grid.innerHTML = `<div class="col-12 text-center py-5 text-muted">
|
||||
<i class="fas fa-wpforms fa-3x mb-3 opacity-25"></i>
|
||||
<p>No hay formularios creados aún.</p>
|
||||
${ES_ADMIN ? '<button class="btn btn-primary" onclick="builder.nuevo()"><i class="fas fa-plus me-1"></i>Crear primer formulario</button>' : ''}
|
||||
${PUEDE_ESCRIBIR ? '<button class="btn btn-primary" onclick="builder.nuevo()"><i class="fas fa-plus me-1"></i>Crear primer formulario</button>' : ''}
|
||||
</div>`;
|
||||
return;
|
||||
}
|
||||
@@ -360,7 +362,7 @@ function renderFormularios() {
|
||||
onclick="envio.abrir(${f.id})">
|
||||
<i class="fas fa-paper-plane me-1"></i>Enviar
|
||||
</button>
|
||||
${ES_ADMIN ? `
|
||||
${PUEDE_ESCRIBIR ? `
|
||||
<button class="btn btn-sm btn-outline-primary" onclick="builder.editar(${f.id})"
|
||||
title="Editar diseño"><i class="fas fa-edit"></i></button>
|
||||
<button class="btn btn-sm btn-outline-danger" onclick="confirmarBorrar(${f.id},'${esc(f.nombre)}')"
|
||||
@@ -404,12 +406,12 @@ const builder = {
|
||||
},
|
||||
|
||||
nuevo() {
|
||||
if (!ES_ADMIN) return;
|
||||
if (!PUEDE_ESCRIBIR) return;
|
||||
this._abrirVentana('lab_formulario_builder.php');
|
||||
},
|
||||
|
||||
editar(id) {
|
||||
if (!ES_ADMIN) return;
|
||||
if (!PUEDE_ESCRIBIR) return;
|
||||
this._abrirVentana(`lab_formulario_builder.php?id=${id}`);
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user