![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/lavocat.ca/public_html/docs/ |
# Lawyer Dropdown Troubleshooting Guide
## Issue Description
User reported being unable to select a lawyer in the admin case edit page dropdown.
## Test Results
✅ **All tests passed successfully:**
- 24 lawyers found in database
- API endpoint working correctly
- Data structure is valid
- Current case has a lead lawyer assigned
- Dropdown should render 25 options (24 lawyers + "Select a lawyer")
## Potential Issues & Solutions
### 1. Browser Console Errors
**Check for JavaScript errors:**
1. Open browser DevTools (F12)
2. Go to Console tab
3. Look for red error messages
4. Check for any React/JavaScript errors
**Common errors:**
- Network request failures
- Authentication errors
- React rendering errors
### 2. Network Request Issues
**Check API requests:**
1. Open browser DevTools (F12)
2. Go to Network tab
3. Refresh the page
4. Look for failed requests to `/api/admin/users?role=LAWYER,ADMIN`
5. Check response status codes
**Expected:**
- Status: 200 OK
- Response: JSON with `users` array containing 24 lawyers
### 3. Authentication Issues
**Verify admin access:**
1. Check if you're logged in as ADMIN or SUPERADMIN
2. Verify session is valid
3. Try logging out and back in
### 4. CSS/UI Issues
**Check for visual problems:**
1. Is the dropdown visible?
2. Is it disabled (grayed out)?
3. Are the options showing when clicked?
4. Check for CSS conflicts
### 5. React State Issues
**Check component state:**
1. Open browser DevTools (F12)
2. Go to React DevTools (if installed)
3. Inspect the EditCasePage component
4. Check `lawyers` state array
5. Check `formData.leadLawyerId` value
## Debug Information Added
The following debug information has been added to the frontend:
### Console Logging
- API response data
- Lawyers array processing
- Dropdown option rendering
- Selection change events
### Visual Debug Info
- Lawyers count display: `({lawyers.length} lawyers available)`
- Current selection display: `Current selection: {formData.leadLawyerId || 'None'}`
- Debug info: `Debug: Lawyers loaded: {lawyers.length}, Current value: "{formData.leadLawyerId}"`
## Manual Testing Steps
### Step 1: Verify Data Loading
1. Open the admin case edit page
2. Check the lawyer dropdown label shows: `Lead Lawyer * (24 lawyers available)`
3. Check the debug info shows: `Debug: Lawyers loaded: 24, Current value: "cmcpzyawf0006vjz02w4s3ila"`
### Step 2: Test Dropdown Interaction
1. Click on the lawyer dropdown
2. Verify options appear
3. Try selecting a different lawyer
4. Check if the selection changes
### Step 3: Check Console Output
1. Open browser console
2. Look for these log messages:
- `Lawyers data: [object]`
- `Lawyers array: [array]`
- `Lawyers count: 24`
- `Rendering lawyer option: [object]`
- `Lawyer selection changed: [value]`
## Expected Behavior
### Normal Operation
- Dropdown shows "Select a lawyer" as first option
- 24 lawyer options are listed below
- Current selection is highlighted
- Clicking an option updates the selection
- Form submission includes the selected lawyer ID
### Current Case Data
- **Case ID:** cmcpzyax8000avjz0ao7zkw1g
- **Title:** Bordeaux Prison Case - Updated
- **Current Lead Lawyer:** Justin Wee (cmcpzyawf0006vjz02w4s3ila)
- **Lawyer Role:** LAWYER
## If Issues Persist
### 1. Clear Browser Cache
1. Hard refresh (Ctrl+F5 or Cmd+Shift+R)
2. Clear browser cache and cookies
3. Try in incognito/private mode
### 2. Check Different Browser
1. Try a different browser (Chrome, Firefox, Safari, Edge)
2. Check if the issue is browser-specific
### 3. Check Network Connectivity
1. Verify internet connection
2. Check if other API calls work
3. Try accessing other admin pages
### 4. Database Verification
Run the test script to verify data:
```bash
node scripts/test-lawyer-dropdown.js
```
## Contact Information
If the issue persists after trying all troubleshooting steps, please provide:
1. Browser type and version
2. Console error messages
3. Network request details
4. Screenshots of the issue
5. Steps to reproduce the problem
## Status
✅ **Data and API are working correctly**
🔍 **Issue likely frontend/browser-specific**
📋 **Troubleshooting guide provided**