> ## Documentation Index
> Fetch the complete documentation index at: https://docs.younegotiate.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Manage Users

> EcoMail Hub users manage other EcoMail Hub user accounts.

## Real-World Example

A new mail response operator joins the team. Maya opens Manage Users, creates the user with name, email, password, and phone, and the new user can log into EcoMail Hub / EcoPortal. Later, Maya edits the user's phone number or deletes the user when access should be removed.

## Visual Flow

```mermaid placement="top-right" actions={true} theme={"system"}
flowchart TD
    A["User opens Manage Users"] --> B["Portal lists EcoMail Hub users"]
    B --> C{"Action selected"}
    C -->|Create| D["Create user with verified email"]
    C -->|Edit| E["Update name, email, or phone"]
    C -->|Delete| F["Remove user access"]
    classDef default fill:#F8FAFC,stroke:#64748B,stroke-width:1.5px,color:#0F172A;
    classDef actor fill:#E0F2FE,stroke:#0284C7,stroke-width:2px,color:#0C4A6E;
    classDef system fill:#F8FAFC,stroke:#64748B,stroke-width:1.5px,color:#0F172A;
    classDef decision fill:#FEF3C7,stroke:#D97706,stroke-width:2px,color:#78350F;
    classDef risk fill:#FEE2E2,stroke:#DC2626,stroke-width:2px,color:#7F1D1D;
    classDef outcome fill:#DCFCE7,stroke:#16A34A,stroke-width:2px,color:#14532D;
    class A actor;
    class B,D,E,F system;
    class C decision;
    linkStyle default stroke:#94A3B8,stroke-width:2px;
```

## How It Should Work

* It should let authorized EcoMail Hub users create, edit, search, and delete EcoMail Hub users.
* It should keep email addresses unique across active EcoMail Hub users.
* It should mark newly created EcoMail Hub users as email verified.
* It should show the currently logged-in user clearly in the list.

## How It Should Not Work

* It should not create creditor, consumer, or Super Admin users from this page.
* It should not allow duplicate active email addresses.
* It should not leave removed users with active portal access.

## API Mapping

| UI Area                              | Endpoint                                                       |
| ------------------------------------ | -------------------------------------------------------------- |
| Table list, search, sort, pagination | `GET /consumer-response-managers`                              |
| Create user form submit              | `POST /consumer-response-managers`                             |
| Edit user form hydration             | `GET /consumer-response-managers/{consumerResponseManager}`    |
| Edit user form submit                | `PUT /consumer-response-managers/{consumerResponseManager}`    |
| Delete user action                   | `DELETE /consumer-response-managers/{consumerResponseManager}` |

The list and detail responses include `is_current_user`, `actions.can_edit`, and `actions.can_delete` so the frontend can render the current-user badge and hide self-edit/self-delete actions.

## Developer Notes

* The list sorts the current user first when no explicit sort column is selected.
* The create form requires password rules; edit does not require a password.

## Related App Areas

* `app/Livewire/ConsumerResponseManager/ManageUsers/ListPage.php`
* `app/Livewire/ConsumerResponseManager/ManageUsers/Create.php`
* `app/Livewire/ConsumerResponseManager/ManageUsers/Edit.php`
* `app/Livewire/ConsumerResponseManager/Forms/UserForm.php`
* `app/Services/ConsumerResponseManagerService.php`
