Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Nieto2020/portalhub/llms.txt

Use this file to discover all available pages before exploring further.

The Administrator role has unrestricted access to every module in PortalHub. Admins are the only users who can create accounts, assign clients to advisors, issue password resets, broadcast system-wide messages, and review executive-level reports. This guide walks through each capability in detail so that administrators can manage the portal confidently from day one.

Capabilities Overview

User Management

Create, activate, deactivate, and permanently delete user accounts across all roles.

Client–Advisor Assignments

Pair clients with the right advisor, record a reason for the change, and review the full assignment history.

Reports & Dashboard

Monitor executive KPIs — active clients, pending payments, scheduled appointments, and service progress — all in real time.

Announcements

Publish announcements that surface immediately in every user’s portal feed.

Password Resets

Generate a secure 10-character temporary password for any account. Every reset is recorded in the audit log.

Bulk Messaging

Send a direct inbox message or a bell notification to every user simultaneously, with optional role-based filtering.

User Management

Only administrators can create user accounts. New users are created directly via the Gestión de Usuarios page and are provisioned with a temporary password that must be changed on first login.

Creating a User

1

Open User Management

Navigate to Panel Administrativo → Control de Accesos (/admin/gestion_usuarios.html).
2

Fill in the registration form

Provide the following fields:
FieldRequiredNotes
correoMust be a valid, unique email address
passwordTemporary password; the user must change it on first login
id_rolSee role table below
numero_clienteOptional client number, e.g. CLI-002
3

Submit

Click Registrar Usuario. The form posts to POST /backend/modules/usuarios/crear.php. On success you receive HTTP 201 and the user list refreshes automatically.

Role Codes

Roleid_rolConstant
Administrator1ROL_ADMIN
Advisor (Asesor)2ROL_ASESOR
Client (Cliente)3ROL_CLIENTE
// Example request body — POST /backend/modules/usuarios/crear.php
{
  "correo": "nuevo.cliente@empresa.com",
  "password": "Temp@2024!",
  "id_rol": 3,
  "numero_cliente": "CLI-010"
}
Every account created through crear.php is inserted with require_password_change = 1. The user will be redirected to the password-change screen immediately after their first successful login.

Activating and Deactivating Users

Select a user in the table to copy their ID into the Gestión de Estado panel, then choose the appropriate action.
// POST /backend/modules/usuarios/gestionar_estado.php
{
  "id_usuario": 12,
  "accion": "desactivar"   // or "activar"
}
A deactivated user (estado = inactivo) cannot log in but all their data is preserved. Reactivate them at any time by sending "accion": "activar".

Deleting a User

Deleting a user is permanent and irreversible. Child tables (perfiles, cliente_asesor, reset_logs, and others) declare ON DELETE CASCADE foreign keys referencing usuarios, so the delete operation automatically removes the user’s profile record, all entries in cliente_asesor (active and historical), and every reset_logs row linked to that account. Only proceed when you are certain the account and all associated data should be purged.
To delete, enter the user ID into the management panel and click ELIMINAR DEFINITIVAMENTE. The frontend presents a confirmation dialog before dispatching:
DELETE /backend/modules/usuarios/eliminar.php?id=12

Password Reset

Admins can generate a new temporary password for any user without knowing the existing one.
1

Locate the user

Find the user in the table by ID, email, or client number, then note their id_usuario.
2

Trigger the reset

Navigate to Panel Administrativo → Reset Password and submit:
// POST /backend/modules/usuarios/reset_password_admin.php
{
  "id_usuario": 12
}
3

Share the temporary password

The response body includes "temporary_password". Share it with the user through a secure channel. The account is simultaneously flagged with require_password_change = 1 so the user must set a new password before accessing the portal.
Every reset call invokes reset_log.php internally, which writes a row to the reset_logs table recording the id_admin (the acting administrator’s id_usuario), the id_usuario_afectado (the target user), and a fecha_reseteo timestamp. Use Control de Accesos → Ver Log de Resets to audit all past resets.

Client–Advisor Assignments

Assignments connect a client account to the advisor who will handle their accounting work. The system keeps a full history of all past assignments.

Creating an Assignment

// POST /backend/modules/asignaciones/asignar.php
{
  "id_cliente": 15,
  "id_asesor": 7,
  "motivo_cambio": "Asignación inicial"
}
The backend validates that id_cliente has role ROL_CLIENTE (3) and id_asesor has role ROL_ASESOR (2). If the client already has an active assignment, that record is automatically closed (estado = 'inactivo', fecha_fin stamped) before the new one is inserted. The affected client receives an in-portal notification confirming the change.
FieldTypeDescription
id_asignacionintAuto-incremented primary key
id_clienteintFK → usuarios.id_usuario
id_asesorintFK → usuarios.id_usuario
id_asignadorintAdmin who created the record
motivo_cambiotextReason for the assignment or change
estadoenumactivo / inactivo
fecha_asignaciontimestampSet automatically on insert
fecha_fintimestampPopulated when the assignment is closed

Viewing Assignment History

GET /backend/modules/asignaciones/historial.php?id_cliente=15
Returns every assignment record — past and present — for the specified client, ordered by fecha_asignacion descending. Use this to audit advisor changes and verify continuity of service.

Listing All Current Assignments

GET /backend/modules/asignaciones/listar.php
Returns all activo assignments. Only accessible to ROL_ADMIN.

Dashboard & Reports

Executive KPIs

The admin dashboard fetches live data from two endpoints simultaneously and displays six key performance indicators:
// From admin/dashboard.html — simultaneous API calls
const [usersRes, reportRes] = await Promise.all([
  fetch('/backend/modules/usuarios/listar.php'),
  fetch('/backend/modules/reportes/dashboard.php')
]);
KPI CardSource fieldDescription
Active Clientsusuarios → filtered by role + estadoClients with estado = activo
Advisorsusuarios → filtered by roleTotal advisor accounts
Procedures In Progressservicios.en_procesoservicios_contables with estado = 'En proceso'
Completed Proceduresservicios.completadosservicios_contables with estado = 'Completado'
Pending Paymentspagos.pendientes + pagos.monto_totalCount and sum from pagos_facturacion
Scheduled Appointmentscitas.programadascitas with estado = 'Programada'
The donut chart in the bottom-left card visualises the ratio of active to inactive users across all roles. The Últimos Registros table lists the five most recently registered accounts for a quick audit trail.

Viewing All Reports

Navigate to Panel Administrativo → Ver Reportes (/admin/reportes.html). The page loads all advisor-authored reports from GET /backend/modules/reportes/listar.php and supports filtering by:
  • Tipo: Mensual · Trimestral · Anual · Especial
  • Estado: Borrador · Publicado · Archivado
  • Search: matches report title or advisor name
Click Ver on any row to open a detail modal that displays the full contenido, descripcion, advisor name, and creation date. The top strip also shows aggregate stats: total reports, published count, and number of active advisors who have filed at least one report. The Calificaciones de Asesores section below the reports table pulls from GET /backend/modules/calificaciones/estadisticas.php and ranks advisors by average star rating.

Announcements

Administrators can publish announcements that appear in the notification feed of all portal users.
1

Navigate to the announcements module

Go to Panel Administrativo → Inbox or use the dedicated announcements shortcut. The creation endpoint is:
POST /backend/modules/anuncios/crear.php
2

Compose the announcement

Supply a titulo and contenido. The record is stored in the anuncios table and becomes immediately visible to all authenticated users who visit the portal.
3

Review existing announcements

GET /backend/modules/anuncios/listar.php
Returns all announcements sorted by creation date, newest first.

Bulk Messaging

Use the Comunicación Masiva widget on the admin dashboard to push a direct inbox message or bell notification to every user at once.
// POST /backend/modules/mensajes/enviar_masivo.php
{
  "titulo": "Aviso importante",
  "contenido": "El portal estará en mantenimiento el sábado de 22:00 a 24:00 h.",
  "roles": [1, 2, 3]
}
  • roles controls who receives the message: 1 = Admins, 2 = Asesores, 3 = Clientes.
  • Omitting roles (or sending an empty array) defaults to all three groups.
  • The sending admin is always excluded from the recipient list.
  • For bell notifications instead of inbox messages, use POST /backend/modules/notificaciones/crear_masivo.php with the same payload.

Build docs developers (and LLMs) love