# Phase 59 — Integrated Help Centre & User Guide

## Purpose

Phase 59 integrates a professional, searchable Help Centre directly into the microfinance system. Staff can learn the correct operating workflow, review maker-checker and security controls, troubleshoot common problems, and open an authorized live workspace without leaving the application.

## New Help Centre

- Route: `/help-centre`
- Convenience route: `/help` redirects to `/help-centre`
- Navigation: **Help & Support → Help Centre & User Guide**
- Contextual **Help** action in the authenticated top bar
- Floating contextual-help button on desktop and mobile
- Keyboard shortcut: **Alt + H**
- Print-friendly detailed guide pages

## Knowledge Library

The Help Centre contains:

- 44 permission-aware module and process guides
- 10 professional guide categories
- 7 end-to-end operating workflows
- 10 frequently asked questions
- Role-focused learning paths for administrators, managers, accountants, tellers, cashiers, loan officers, credit staff, risk, compliance, HR, auditors and other staff
- Context mappings for every module shown in the authenticated sidebar

Each detailed guide includes:

- Purpose and intended users
- Step-by-step operating procedure
- Key risk, approval and accounting controls
- Practical operating tips
- Common problems and corrective guidance
- Related guides
- Direct links to system workspaces the current user is authorized to access

## Guide Categories

1. Getting Started
2. Customers & Service
3. Savings & Deposits
4. Lending
5. Cash & Field Operations
6. Finance & Control
7. Risk & Compliance
8. Organisation
9. System Administration
10. Resilience & Security

## Full Module Coverage

The guide library covers the complete sidebar, including the modules added or expanded in recent phases:

- Loan Products
- Loan Pricing & Customer Disclosure
- Insurance & Credit-Life
- Payroll Loans and Deduction Batches
- Savings Interest and Term-Deposit Maturities
- Budgeting, Forecasting and Staff Targets
- Tax and Statutory Compliance
- Early Warning Alerts and ECL
- Financial Statements and Management Reporting
- AI and Automation Governance
- Backup, Recovery and Business Continuity
- My Security and Go-Live Readiness

Combined guides use permission-aware deep links. For example, an inventory-only user can open the Inventory workspace from the Procurement, Assets & Inventory guide without being shown unauthorized procurement links.

## End-to-End Workflows

- New customer to loan disbursement
- Savings interest and term-deposit maturity
- Teller day and branch close
- Month-end finance close, including tax and statutory control
- Insurance and credit-life claim
- Complaint and service recovery
- Production go-live assurance

Workflow steps are filtered using the existing permission model. A staff member sees only the steps and related articles available to their role.

## Contextual Help

When Help is opened from a system page, the Help Centre identifies the page and selects the most relevant guide. The contextual URL retains only the current internal route; it does not preserve unsafe external URLs or expose form data.

Examples:

- `/loan-products` → Loan Product Management
- `/loan-pricing` → Loan Pricing & Customer Disclosure
- `/payroll/batches` → Payroll Loans & Deductions
- `/savings/interest` → Savings Interest & Maturities
- `/tax-compliance` → Tax & Statutory Compliance
- `/budgeting` and `/targets` → Budgeting, Forecasting & Targets
- `/insurance` → Insurance & Credit-Life
- `/alerts` → Portfolio Risk, ECL & Early Warning
- `/backup-recovery` → Backup, Recovery & Continuity
- `/account/security` → My Security
- `/ai-automation` → AI & Automation Governance
- `/go-live-readiness` → Go-Live Readiness

## Search and Navigation

- Server-side search across titles, summaries, keywords, procedures, controls and tips
- Natural multi-word token matching
- Category filtering
- Instant browser-side filtering of the displayed guide cards
- Live result-count updates and a clear no-results state
- Direct category cards and related-guide navigation
- Search input and route-context length limits

## Role Learning Paths

Role-focused learning paths highlight the most important starting guides for each staff function. The configured path is filtered before rendering, so a role is never directed to an article it cannot access.

Examples include:

- Administrator: security, users and roles, integrations, backup, AI governance and go-live assurance
- Accountant/Finance: general ledger, reconciliations, financial close, reporting, tax and treasury
- Loan/Credit Officer: customers, products, pricing disclosure, loan origination, security and repayment
- Teller/Cashier: cash control, savings, repayments and branch close
- Risk/Compliance: portfolio monitoring, ECL, AML/CFT, regulatory compliance, complaints and audit
- HR: HR records, payroll and statutory processes

## Permission and Security Model

- The Help Centre is available only after staff authentication.
- Articles are filtered through the existing `AccessControl` permission model.
- Combined guides may accept more than one relevant permission, but each direct module link is checked separately.
- Administration tab links are checked against their specific permissions: users, roles, security or audit.
- The guide does not create, approve, post or alter financial records.
- Copied support diagnostics contain only the application name, guide version, staff role, page and timestamp.
- Staff are reminded never to send passwords, API keys, card data or authenticator secrets.
- The configured support URL is displayed only when it uses an `http` or `https` scheme.

## Support Configuration

The implementation-support identity and website can be configured through environment variables:

```env
SUPPORT_NAME="E. Y Technologies"
SUPPORT_URL=https://eytec.online
```

Defaults are included in `config/config.php`, `config/config.example.php` and `.env.example`.

## Files Added

- `src/HelpGuideService.php`
- `views/help_centre.php`
- `PHASE59_NOTES.md`
- `PHASE59_VALIDATION.txt`
- `PHASE59_PHP_LINT.txt`
- `PHASE59_JAVASCRIPT_VALIDATION.txt`
- `PHASE59_ZIP_TEST.txt`

## Files Updated

- `public/index.php`
- `views/layout_top.php`
- `views/layout_bottom.php`
- `public/assets/app.css`
- `public/assets/app.js`
- `config/config.php`
- `config/config.example.php`
- `.env.example`
- `README.md`

## Database Upgrade

No database migration is required. Phase 59 adds read-only, version-controlled application guidance and uses the existing authentication and permission framework.

## Upgrade from Phase 58

1. Back up the Phase 58 application and database.
2. Replace the application files with the Phase 59 package.
3. Preserve the production `.env` values and add `SUPPORT_NAME` and `SUPPORT_URL` when custom support details are required.
4. Sign in and open **Help & Support → Help Centre & User Guide**.
5. Test the top-bar Help action, floating help button and **Alt + H** from several modules.
6. Test at least one restricted role to confirm that unauthorized guides and module links remain hidden.
7. Review institution-specific wording and procedures before formal staff training.

## Validation Boundary

Static application validation, PHP template rendering, search tests, article-reference checks, route-reference checks, full sidebar context mapping, permission filtering, PHP linting, JavaScript syntax checking, CSS structure checking and ZIP integrity testing were performed. A live authenticated browser and MySQL deployment test was not run in the build environment; the phase does not add database objects or post transactions.
