This document describes the user interface requirements for the User Management screen. The screen allows administrators to view, create, and edit user accounts.
The screen is divided into two main sections:
- Left Panel (50%): User list table with filter and action buttons
- Right Panel (50%): User form for creating/editing users
- Type: Button
- Label: "+ New User"
- Style: Blue background, white text
- Position: Top-left
- Function: Clears the form and prepares it for creating a new user
- Type: Checkbox
- Label: "Hide Disabled User"
- Default State: Unchecked
- Position: Next to New User button
- Function: Filters the user list to show only enabled users when checked
- Type: Button
- Label: "Save User"
- Style: Blue background, white text
- Position: Top-right
- Function: Saves the current form data (create new or update existing user)
Table Columns:
- ID: Numeric identifier (auto-generated)
- User Name: Text
- Email: Text
- Enabled: Boolean (true/false)
Table Features:
- Each column header has sorting capability (ascending/descending)
- Rows alternate between white and light blue backgrounds
- Clicking a row selects it (highlights with blue background) and loads data into the form
- Selected row remains highlighted
Initial Data Display: The table shows at least these users on load:
- ID: 1, User Name: AdminUser, Email: admin@piworks.net, Enabled: true
- ID: 2, User Name: Test User, Email: testuser@piworks.net, Enabled: true
- Text: "New User" (when creating) or "Edit User" (when editing)
- Style: Large gray text
Username
- Label: "Username :"
- Type: Text input
- Required: Yes
- Validation: Must contain only letters, numbers, underscores, and hyphens (no spaces)
Display Name
- Label: "Display Name :"
- Type: Text input
- Required: No
Phone
- Label: "Phone :"
- Type: Text input
- Required: No
- Label: "Email :"
- Type: Text input
- Required: Yes
- Validation: Must be valid email format
User Roles
- Label: "User Roles :"
- Type: Dropdown (single select)
- Options:
- Guest
- Admin
- SuperAdmin
- Default: Shows placeholder "Select user roles..."
- Required: Yes
Enabled
- Label: "Enabled :"
- Type: Checkbox
- Default State: Unchecked for new users
When the page first loads:
-
User Table:
- Displays all users from the database
- Sorted by ID in ascending order
- No row is selected
-
Filter Checkbox:
- "Hide Disabled User" is unchecked
-
User Form:
- Header shows "New User"
- All input fields are empty
- User Roles dropdown shows placeholder text
- Enabled checkbox is unchecked
User Action: Click "+ New User" button
System Behavior:
- Clear all form fields
- Set form header to "New User"
- Reset User Roles dropdown to placeholder
- Uncheck Enabled checkbox
- Deselect any selected table row
User Action: Fill in form fields and click "Save User"
System Behavior:
- Validate required fields (Username, Email, User Roles)
- If validation fails:
- Show error message for each invalid field
- Prevent saving
- If validation passes:
- Send data to backend API
- On success:
- Add new user to the table with new ID
- Show success message
- Clear the form
- Return to "New User" state
- On error:
- Show error message
- Keep form data
User Action: Click on a user row in the table
System Behavior:
- Highlight the selected row (blue background)
- Change form header to "Edit User"
- Fill form fields with selected user's data:
- Username → user's username
- Display Name → user's display name
- Phone → user's phone
- Email → user's email
- User Roles → user's role (dropdown shows selected value)
- Enabled → user's enabled status (checkbox checked/unchecked)
User Action: Modify form fields and click "Save User"
System Behavior:
- Validate required fields
- If validation passes:
- Send updated data to backend API
- On success:
- Update the user's row in the table
- Show success message
- Clear the form
- Return to "New User" state
- On error:
- Show error message
- Keep form data
User Action: Check "Hide Disabled User" checkbox
System Behavior:
- Filter table to show only users where Enabled = true
- Hide all rows where Enabled = false
- If currently selected user is disabled, clear the form
User Action: Uncheck "Hide Disabled User" checkbox
System Behavior:
- Show all users in the table regardless of enabled status
User Action: Click on a column header
System Behavior:
- First click: Sort by that column in ascending order
- Second click: Sort by that column in descending order
- Update table rows based on sort order
- Show sort indicator (arrow) on the active column
- The system must display all users in a sortable table
- The system must allow creating new users with all required fields
- The system must allow editing existing users
- The system must validate Username (no spaces, alphanumeric + underscore/hyphen)
- The system must validate Email (valid email format)
- The system must require Username, Email, and User Roles fields
- The system must filter users based on enabled status when checkbox is checked
- The system must assign unique IDs to new users
- The system must prevent saving with invalid data
- The system must show appropriate success/error messages
Username:
- Required field
- Cannot be empty
- Cannot contain spaces
- Can only contain: letters (a-z, A-Z), numbers (0-9), underscores (_), hyphens (-)
Email:
- Required field
- Must be valid email format (contains @ and domain)
User Roles:
- Required field
- Must select one option from dropdown
Display Name and Phone:
- Optional fields
- No validation required
Display these error messages when validation fails:
- Username empty: "Username is required"
- Username invalid characters: "Username can only contain letters, numbers, underscores, and hyphens"
- Email empty: "Email is required"
- Email invalid format: "Please enter a valid email address"
- User Role not selected: "Please select a user role"
- After creating new user: "User created successfully"
- After updating user: "User updated successfully"
- Primary Button: Blue (#0088CC)
- Button Text: White
- Table Header: Blue background, white text
- Table Row Alternate: Light blue (#E3F2FD)
- Selected Row: Blue highlight
- Form Labels: Dark gray
- Error Text: Red
- Padding between form fields: 15-20px
- Table cell padding: 10px
- Button padding: 8px 16px
- Form header: 24px
- Labels: 14px
- Input text: 14px
- Button text: 14px
- Enabled by default
- Shows loading indicator while saving
- Disabled during save operation to prevent double-click
- Hover effect: Slight background color change
- Click anywhere on row to select
- Only one row can be selected at a time
- Show red border when validation fails
- Clear error state when user starts typing
- All inputs have consistent height (40px)
- Opens on click
- Shows all three options
- Selected option is highlighted
- Closes after selection
The frontend should make these API calls:
- GET /users - Fetch all users on page load
- POST /users - Create new user
- PUT /users/{id} - Update existing user
User Data Model:
{
"id": 1,
"username": "string",
"displayName": "string",
"phone": "string",
"email": "string",
"userRole": "Guest|Admin|SuperAdmin",
"enabled": true
}- Load and display all users from the database in the table
- Show empty form with "New User" header
- Set Hide Disabled User checkbox to unchecked
- No user row should be selected
- Form clears when clicking New User button
- Form populates when clicking table row
- Table filters when Hide Disabled checkbox changes
- Validation happens before save
- Form clears after successful save
- Success/error messages appear after save attempt
- Create new user with valid data
- Create new user with invalid data (should show errors)
- Edit existing user
- Filter disabled users
- Sort by each column
- Validate username format
- Validate email format
- Check required field validation
- Verify ID auto-increment for new users
- Test form clear on New User button
- Test form populate on row click
- Version: 1.0
- Date: February 2, 2026