13 KiB
13 KiB
Live E2E Demonstration & Role Showcase Guide
Variable Remuneration, Compensation, and Commissions System - Hoteles Estelar
This guide outlines a comprehensive step-by-step E2E script for presenters. It showcases the application's role-based permissions, database Row-Level Security (RLS) isolation, multilingual language switcher, and n8n background workflow triggers.
1. System Role Permissions Matrix
The platform is designed with a strict Role-Based Access Control (RBAC) layer mapped to the following permissions:
| User Role | Navigation Access | Can Manage Plans? | Can Assign Goals? | Can Ingest Sales? | Can Run Settlement? | Can Approve/Reject? | Can View Audit Logs? |
|---|---|---|---|---|---|---|---|
admin |
All tabs | Yes | Yes | Yes | Yes | Yes (Override) | Yes (diff panel) |
director |
Plans, Goals, Dashboard | Yes | Yes | No | No | No | No (403 Blocked) |
analyst |
Plans, Ingest, Calc, Dash | No | No | Yes | Yes | No | No (403 Blocked) |
commercial_leader |
Plans, Ingest, Approvals | No | No | Yes | No | Yes (Regional) | No (403 Blocked) |
hotel_manager |
Plans, Goals, Approvals | No | No | No | No | Yes (Regional) | No (403 Blocked) |
auditor |
Plans, Goals (Read-only) | No | No | No | No | No | No (403 Blocked) |
collaborator |
History (Personal only) | No | No | No | No | No | No (403 Blocked) |
2. Seeded Accounts & Credentials
Use these pre-configured accounts (all passwords are set to password123) to showcase different user views:
- System Admin (
admin):- Username:
admin - Email:
admin@estelar.com - Hotel Scope:
Estelar Parque de la 93(Global View) - Role:
admin
- Username:
- Planner / Executive View (
director):- Username:
director - Email:
director@estelar.com - Hotel Scope:
Estelar Parque de la 93(Global view for planning) - Role:
director
- Username:
- Finance Operations View (
analista):- Username:
analista - Email:
analista@estelar.com - Hotel Scope:
Estelar Parque de la 93 - Role:
analyst
- Username:
- Hotel Managers (Regional Isolation):
- Medellin Manager:
- Username:
gerente_mde - Email:
gerente.mde@estelar.com - Hotel:
Estelar Medellin(EST-MDE) - Role:
hotel_manager
- Username:
- Cartagena Manager:
- Username:
gerente_ctg - Email:
gerente.ctg@estelar.com - Hotel:
Estelar Cartagena(EST-CTG) - Role:
hotel_manager
- Username:
- Medellin Manager:
- Commercial Leaders (Regional Isolation):
- Medellin Leader:
- Username:
lider_mde - Email:
lider.mde@estelar.com - Hotel:
Estelar Medellin(EST-MDE) - Role:
commercial_leader
- Username:
- Cartagena Leader:
- Username:
lider_ctg - Email:
lider.ctg@estelar.com - Hotel:
Estelar Cartagena(EST-CTG) - Role:
commercial_leader
- Username:
- Medellin Leader:
- Collaborators / Sellers (Personal Isolation):
- Medellin Collaborator:
- Username:
colaborador_mde - Email:
colaborador.mde@estelar.com - Hotel:
Estelar Medellin(EST-MDE) - Role:
collaborator
- Username:
- Cartagena Collaborator:
- Username:
colaborador_ctg - Email:
colaborador.ctg@estelar.com - Hotel:
Estelar Cartagena(EST-CTG) - Role:
collaborator
- Username:
- Medellin Collaborator:
- Auditor / Guest (
consulta):- Username:
consulta - Email:
consulta@estelar.com - Hotel Scope:
Estelar Parque de la 93(Global View) - Role:
auditor
- Username:
3. Step-by-Step E2E Demo Walkthrough Script
Step 1: Manage Compensation Plans & Rules (Planner View)
- Objective: Show how plans are created, configured, and automatically version-controlled when active.
- User:
director(Planner / Executive View) - Action Details:
- Open the browser and navigate to the application URL.
- Login with username
directorand passwordpassword123. - In the top navigation header, click on the Planes (Plans) tab.
- Click the Nuevo Plan button to launch the creation modal.
- Fill in the modal form fields:
- Name:
Plan Especial Q3 2026 - Code:
EST-Q3-26 - Type: Select
COMMISSIONfrom the dropdown. - Start/End Dates: Select a validity range covering
2026-06-01to2026-08-31.
- Name:
- Click Guardar Plan to submit.
- Locate the new plan in the table. Click the Reglas icon next to its name.
- In the rules drawer/view, add two brackets:
- Tier 1:
0% - 90%achievement range =0%commission rate. Click Agregar Tramo. - Tier 2:
90.01% - 110%achievement range =2.5%commission rate. Click Agregar Tramo.
- Tier 1:
- Click Guardar Reglas to persist rules.
- Return to the plans list and click the status switch toggle to activate the plan. Observe that the status immediately changes to
ACTIVE. - Now, click the edit toggle button again on the active plan.
- Expected System Behavior: The system blocks direct inline changes to active rules. Instead, it clones the entire plan, incrementing its version to
v2in draft state, while settingv1to inactive. This prevents retroactive calculations from being manipulated.
Step 2: Assign Quotas and Goals (Planner View)
- Objective: Define sales targets for sellers.
- User:
director(Planner / Executive View) - Action Details:
- Still logged in as
director, click the Metas (Goals) link in the navigation header. - Click Asignar Meta (Assign Goal) to open the goal configuration modal.
- Fill in the form:
- Target Type: Select
INDIVIDUAL. - Collaborator: Select
colaborador_mdefrom the user dropdown. - Period: Enter
2026-06. - Target Sales Amount: Enter
100000.
- Target Type: Select
- Click Guardar Meta.
- Expected System Behavior: A success toast appears. The goal is stored, automatically bounded to the collaborator's hotel scope (
EST-MDE), laying the groundwork for regional RLS segregation.
- Still logged in as
Step 3: Excel Sales File Ingestion (Finance Operations View)
- Objective: Ingest monthly sales results with header validations, idempotency check, and transactional rollbacks.
- User:
analista(Finance Operations View) - Action Details:
- Click the Cerrar Sesión button in the top right.
- Login with username
analistaand passwordpassword123. - Click the Cargar Ventas (Upload Sales) tab in the header.
- Drag and drop the template spreadsheet: demo_sales_data.xlsx into the file drop target zone, or click the zone to upload it via file selector.
- Expected System Behavior: The system parses the spreadsheet, performing atomic validations (user existence check, positive numeric checks, regional validations). Once successful, a green success banner appears:
Carga exitosa. - Idempotency Test: Select and drop the same file again immediately.
- Expected System Behavior: The UI highlights a red error block:
Error: Código de lote duplicado (Llave de idempotencia ya registrada). The system has blocked the ingestion and rolled back the transaction to prevent double payout calculation.
Step 4: Regional Leader Ingestion Validation (Regional Isolation)
- Objective: Show that regional boundaries block leaders from loading sales for other hotels.
- User:
lider_mde(Medellin Commercial Leader) - Action Details:
- Logout, then login as the Medellin Commercial Leader
lider_mdeand passwordpassword123. - Navigate to Cargar Ventas (Upload Sales).
- Attempt to upload a custom Excel file containing rows with the Cartagena hotel code (
EST-CTG). - Expected System Behavior: The upload fails with a red warning stating:
Error de Validación: El código de hotel EST-CTG no coincide con su jurisdicción permitida (EST-MDE). The transaction is rolled back, demonstrating multi-tenant regional ingestion security. - Logout, then login as
lider_ctg(password123). Go to Cargar Ventas and upload a valid file containing CartagenaEST-CTGrows. The upload completes successfully.
- Logout, then login as the Medellin Commercial Leader
Step 5: Run Settlement Calculation & AI Anomaly Detection (Finance Operations View)
- Objective: Trigger n8n webhook calculation runs and review the generated AI audit observations.
- User:
analista(Finance Operations View) - Action Details:
- Logout, and login again as
analista(password123). - Click on Liquidación (Settlement) in the top navigation.
- Select period
2026-06. - Crucial: Ensure the Modo Simulación (Simulation Mode) checkbox is UNCHECKED to persist the calculation.
- Click Calcular Liquidaciones (Calculate Settlements).
- Expected System Behavior: A loading indicator appears while the application calls the n8n webhook backend. Wait 5-10 seconds. The webhook triggers the settlement computation workflows. The UI refreshes:
colaborador_mde: Payout is calculated.colaborador_ctg: Payout calculated. If any sale amount exceeds normal parameters, a warning icon appears under the AI Audit column. Click the icon to view the audit observations:Warning: Anomalous high sale detected.
- Logout, and login again as
Step 6: Collaborator Personal Segregation (Row-Level Security)
- Objective: Verify that sellers have access only to their personal goals and history.
- Users:
colaborador_mde(Medellin Collaborator) vscolaborador_ctg(Cartagena Collaborator) - Action Details:
- Logout, then login as
colaborador_mde(password123). - Navigate to Historial (History) and Metas (Goals). Verify you can see only your personal Medellin records.
- Logout, then login as
colaborador_ctg(password123). - Navigate to Historial and Metas.
- Expected System Behavior: The tables display only Cartagena records. Even if a user attempts to fetch Medellin records via direct API requests, the PostgreSQL RLS policy filters the query dynamically based on the session ID, returning zero results.
- Logout, then login as
Step 7: Regional Manager Approvals (Regional Segregation)
- Objective: Perform commercial leader/manager sign-off with regional isolation.
- Users:
gerente_mde(Medellin Manager) vsgerente_ctg(Cartagena Manager) - Action Details:
- Logout, then login as
gerente_mde(password123). - Navigate to Aprobaciones (Approvals). Notice that only the pending Medellin settlement is visible.
- Click Rechazar (Reject) on the Medellin settlement. In the rejection modal, enter:
"Falta validar soporte físico"and click submit. The status transitions toREJECTED. - Logout, then login as
gerente_ctg(password123). - Navigate to Aprobaciones. Notice that only the Cartagena settlement is visible.
- Click Aprobar (Approve) on the Cartagena settlement. The status changes to
APPROVEDand generates an audit log.
- Logout, then login as
Step 8: Read-Only Auditor Compliance (Read-only Compliance View)
- Objective: Verify that auditors can view all data globally but cannot edit or approve anything.
- User:
consulta(Auditor / Guest) - Action Details:
- Logout, then login as
consulta(password123). - Navigate through Planes, Metas, and the Tablero (Dashboard).
- Expected System Behavior: The auditor can see plans and goals for all three regions (Bogota, Medellin, Cartagena) on the tables. However, all "Nuevo Plan", "Asignar Meta", "Aprobar", or "Cargar Ventas" buttons are completely hidden or disabled, ensuring read-only compliance.
- Logout, then login as
Step 9: Executive Dashboard (Executive View)
- Objective: Showcase executive visual trends.
- User:
directororanalista - Action Details:
- Logout, then login as
director(password123). - Navigate to Dashboard (Tablero).
- Expected System Behavior: The dashboard renders KPI cards showing total payouts, average achievement percentage, and budget cap bars. Recharts interactive SVG charts display monthly sales trends and comparative performance between the Medellin, Bogota, and Cartagena hotels.
- Logout, then login as
Step 10: System Audit Logs & JSON Diff (System Admin View)
- Objective: Inspect security mutations and redaction details.
- User:
admin(System Admin View) - Action Details:
- Logout, then login as
admin(password123). - Navigate to Audit Logs (Auditoría).
- Select any log row. The side-by-side JSON panel displays the exact snapshot of the database fields before and after the action.
- Expected System Behavior: Sensitive fields like
password_hashor base salaries are redacted as[REDACTED]. - Immutability Check: Try to edit or delete any log entry. The database trigger blocks the mutation immediately, throwing an error.
- Logout, then login as
4. Financial Reports Exporting (US-COM-013)
To test consolidations, run these API endpoints directly in your browser:
- Consolidated Excel Sheet:
/api/reports/export/excel?period=2026-06(Downloads a multi-sheet spreadsheet). - Consolidated PDF HTML print view:
/api/reports/export/pdf?period=2026-06(Generates printable tabular views with signature sign-off lines).