diff --git a/index.php b/index.php index 094062f..c65f38f 100644 --- a/index.php +++ b/index.php @@ -19,9 +19,16 @@ if (isEnfermero()) { } $_indexRole = $_SESSION['admin_user']['role'] ?? ''; $_indexModules = $_SESSION['admin_user']['modules'] ?? []; -if ($_indexRole === 'recepcionista' || (in_array('turnero', $_indexModules, true) && !in_array('whatsapp', $_indexModules, true))) { +if ($_indexRole === 'recepcionista') { header('Location: erp.php?m=turnero&v=recepcion'); exit; } +if (in_array('turnero', $_indexModules, true) && !in_array('whatsapp', $_indexModules, true)) { + $_indexAdminRoles = ['superadmin', 'admin', 'supervisor']; + $url = in_array($_indexRole, $_indexAdminRoles, true) + ? 'erp.php?m=turnero&v=dashboard' + : 'erp.php?m=turnero&v=recepcion'; + header('Location: ' . $url); exit; +} if (in_array('lab_dashboard', $_indexModules, true) && !in_array('whatsapp', $_indexModules, true)) { header('Location: lab_dashboard.php'); exit; } diff --git a/login.php b/login.php index d735a7b..f989691 100644 --- a/login.php +++ b/login.php @@ -106,6 +106,8 @@ if ($_POST && !$loginBlocked) { } elseif (in_array('turnero', $modules, true)) { if ($roleSlug === 'bacteriologo') { header('Location: erp.php?m=turnero&v=lugar&lugar_id=1'); + } elseif (in_array($roleSlug, ['superadmin', 'admin', 'supervisor'], true)) { + header('Location: erp.php?m=turnero&v=dashboard'); } else { header('Location: erp.php?m=turnero&v=recepcion'); }