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

# UJ-C-002: Create New Member

> Client staff creates a new member account in the system

## Journey Overview

| Attribute      | Value                                  |
| -------------- | -------------------------------------- |
| **Journey ID** | UJ-C-002                               |
| **Actor**      | Client Admin / Staff                   |
| **Goal**       | Create a new member account            |
| **Trigger**    | New member needs to be added to system |
| **Outcome**    | Member account created and accessible  |

## Preconditions

* Staff has ROLE\_CLIENT\_ADMIN permission
* Member email is not already registered
* Membership plan exists (if assigning)

## Journey Flow

```mermaid theme={null}
flowchart TD
    A[Navigate to Members] --> B[Click Add Member]
    B --> C[Enter personal details]
    C --> D[Enter contact details]
    D --> E[Assign membership plan]
    E --> F{Send invite?}
    F -->|Yes| G[Member receives invite email]
    F -->|No| H[Account created silently]
    G --> I[Member sets password]
    H --> J[Staff shares credentials]
    I --> K[Member can access portal]
    J --> K
```

## Detailed Steps

<Steps>
  <Step title="Access Member Management">
    Navigate to Members section:

    * Client Portal → Members
    * Click "Add Member" or "+" button
  </Step>

  <Step title="Enter Personal Information">
    Required fields:

    | Field         | Type   | Required     | Validation           |
    | ------------- | ------ | ------------ | -------------------- |
    | First Name    | Text   | Yes          | Min 2 chars          |
    | Last Name     | Text   | Yes          | Min 2 chars          |
    | Email         | Email  | Yes          | Unique, valid format |
    | Date of Birth | Date   | Configurable | Past date            |
    | Gender        | Select | Configurable | Options list         |

    **Form:**

    ```
    ┌─────────────────────────────────────────────────────────────┐
    │ Add New Member                                              │
    ├─────────────────────────────────────────────────────────────┤
    │                                                             │
    │ Personal Information                                        │
    │ ────────────────────                                        │
    │                                                             │
    │ First Name *          Last Name *                           │
    │ [________________]    [________________]                    │
    │                                                             │
    │ Email *                                                     │
    │ [________________________________]                          │
    │                                                             │
    │ Date of Birth         Gender                                │
    │ [__/__/____]         [Select ▼]                            │
    │                                                             │
    └─────────────────────────────────────────────────────────────┘
    ```
  </Step>

  <Step title="Enter Contact Details">
    Contact information:

    | Field    | Type   | Required     |
    | -------- | ------ | ------------ |
    | Phone    | Phone  | Configurable |
    | Mobile   | Phone  | Configurable |
    | Address  | Text   | Configurable |
    | City     | Text   | Configurable |
    | State    | Select | Configurable |
    | Postcode | Text   | Configurable |
    | Country  | Select | Configurable |
  </Step>

  <Step title="Professional Details">
    Work information:

    | Field        | Type | Required |
    | ------------ | ---- | -------- |
    | Company      | Text | No       |
    | Position     | Text | No       |
    | LinkedIn URL | URL  | No       |
    | Website      | URL  | No       |
  </Step>

  <Step title="Assign Membership">
    Membership configuration:

    ```
    ┌─────────────────────────────────────────────────────────────┐
    │ Membership                                                  │
    ├─────────────────────────────────────────────────────────────┤
    │                                                             │
    │ Membership Plan                                             │
    │ [Select Plan ▼]                                             │
    │ • Professional (Annual - $485)                              │
    │ • Basic (Monthly - $19)                                     │
    │ • Corporate (Assigned via group)                            │
    │                                                             │
    │ Start Date              Expiry Date                         │
    │ [__/__/____]           [__/__/____]                        │
    │                                                             │
    │ Payment Status                                              │
    │ ○ Paid (already collected)                                  │
    │ ○ Invoice (send invoice to member)                          │
    │ ○ Complimentary (no payment required)                       │
    │                                                             │
    │ Group/Corporate Membership                                  │
    │ [Select Group ▼] (optional)                                 │
    │                                                             │
    └─────────────────────────────────────────────────────────────┘
    ```
  </Step>

  <Step title="Invitation Settings">
    Choose how member gets access:

    | Option            | Behavior                                   |
    | ----------------- | ------------------------------------------ |
    | Send Invite Email | Member receives email to set password      |
    | Generate Password | System creates password for staff to share |
    | SSO Only          | Member uses SSO (no password needed)       |

    **Invite Email Contents:**

    * Welcome message
    * Link to set password
    * Getting started guide
    * Login instructions
  </Step>

  <Step title="Review and Create">
    Review all details:

    ```
    ┌─────────────────────────────────────────────────────────────┐
    │ Review Member Details                                       │
    ├─────────────────────────────────────────────────────────────┤
    │                                                             │
    │ Name: John Smith                                            │
    │ Email: john@company.com                                     │
    │ Phone: 0412 345 678                                         │
    │                                                             │
    │ Membership: Professional (Annual)                           │
    │ Start: March 15, 2025                                       │
    │ Expiry: March 15, 2026                                      │
    │ Payment: Invoice                                            │
    │                                                             │
    │ ☑ Send invitation email to member                           │
    │                                                             │
    │ [Back]  [Create Member]                                     │
    │                                                             │
    └─────────────────────────────────────────────────────────────┘
    ```
  </Step>

  <Step title="Member Created">
    Confirmation:

    * Member record created
    * Membership assigned
    * Invite email sent (if selected)
    * CRM sync triggered (if enabled)
    * Audit log entry created
  </Step>
</Steps>

## Validation Rules

| Field      | Rule                     |
| ---------- | ------------------------ |
| Email      | Must be unique in tenant |
| Email      | Valid email format       |
| Phone      | Valid phone format       |
| Start Date | Cannot be in past        |
| Expiry     | Must be after start      |

## CRM Integration

If CRM enabled, member is synced:

* Contact created in Salesforce/HubSpot
* Tags applied based on membership
* Custom fields mapped
* Lead source recorded

## Related Entities

* [`User/Member`](/entities/core/user-member)
* [`User Membership`](/entities/core/user-membership)
* [`Membership Plan`](/entities/core/membership-plan)

## Related Journeys

* [UJ-C-003](/client/journeys/edit-member)
* [UJ-C-004](/client/journeys/import-members)
* [UJ-C-006](/client/journeys/export-members)

## Acceptance Criteria

### Frontend

* [ ] Add Member form with all fields
* [ ] Membership plan dropdown
* [ ] Date pickers for membership dates
* [ ] Payment status selection
* [ ] Invitation options
* [ ] Form validation
* [ ] Success confirmation
* [ ] Error handling

### Backend

* [ ] `POST /api/members` - Create member
* [ ] Email uniqueness validation
* [ ] Membership assignment
* [ ] Invite email sending
* [ ] CRM sync trigger
* [ ] Audit logging

### Permissions

* [ ] Only ROLE\_CLIENT\_ADMIN can create members
* [ ] Tenant scoping enforced

### Business Rules

* [ ] Email unique per tenant
* [ ] Membership dates validated
* [ ] Invite email sent if selected
* [ ] CRM sync on creation

### Error Handling

* [ ] Duplicate email message
* [ ] Validation error display
* [ ] Email send failure handling
