# 10 – HRM (users, roles, commission, attendance, logs)

Tested in the QA company (company admin) · Pages: User List, Add User, Role List, Add Role / Edit Role, User Commission, Commission Paid, Attendance, Income, Logs

## Works fine

- User List, Add User, Role List, Add Role, User Commission, Commission Paid, Attendance, Income and Logs all open.
- **Add Role:** "The role name field is required. The permissions field is required." when empty; with name + permissions it saves ("Role created successfully!") and shows in the Role List. Edit Role reopens with the name, the ticked permissions and the **My Data** choice for all seven modules (CRM, Quotation, Load Board, Order, Invoice, Commission, Reports) exactly as saved.
- Once a role exists it appears in the *Role* dropdown of Add User.

## Issues

| # | Sev | What the user experiences | Steps | Evidence |
|---|-----|---------------------------|-------|----------|
| H1 | **High** | **A staff user cannot be added on the live site.** The email box shows "Error checking email" and the form will not save. The page asks for `/check-user-email`, which the live server does not have (the same address works on my local copy; `routes/web.php` on live is older). Uploading `routes/web.php` should fix it. | Add User → type an email → Create User | `screens/hrm_user_list.png` |
| H2 | ~~Medium~~ **Not an issue** (confirmed by you) | **A new company has no staff role, so Add User has an empty, required Role dropdown with no hint** (only the system roles Admin / Customer / Carrier exist). The user must first discover Role → Add Role (same gap as CRM C1 / Carriers K1). | New company → Add User | `screens/hrm_add_user.png` (empty required Role box) + `screens/hrm_role_list.png` (only Admin / Customer / Carrier) |
| H3 | Medium – *fixed locally, awaiting upload* | **The "Commission_loadOrder" page crashes** ("Server Error – Undefined variable $customers"). It is not in the menu, but the address is live. | Open `/Commission_loadOrder` | – |
| H4 | Low | **The role name is changed on save** – "QA Sales My" is stored and shown as "Qa sales my". | Add Role → save | `screens/hrm_role_saved.png` |
| H5 | Low | Script errors on Add User, Role List, Add Role, Commission Paid and Logs pages (`classList` / `addEventListener` of null). | Open the pages, look at the console | – |

> **Update 10 Oct (later):** re-opened Add User on live – typing an email no longer shows "Error checking email" (`screens/hrm_add_user_email_ok_now.png`), so the missing route seems to be on the server now. The original error was seen earlier the same day; the first screenshot of it was not saved.

## Not tested (and why)

- **Creating, editing, viewing and deleting a staff user, staff login, and My Data / All Data for staff** – blocked by H1. After `routes/web.php` is uploaded this needs a short re-test (also covers the new My/All options for Users, Carriers and Expenses, which are not on the live Role page yet because those files are not uploaded).
- Commission set-up and payments (needs a staff user with commission and a delivered order), Attendance and Income with data, Logs contents, Role edit/delete.

## Test data left in the QA company

- Role **Qa sales my** (CRM / Quotation / Order view + add, **My Data** for all seven modules).
