Fix code quality violations for publish

Remove unused blade settings pages not linked from UI
Convert remaining frontend pages to SPA actions
Convert settings user_settings and general to SPA actions
Convert settings profile pages to SPA actions
Convert contacts and projects add/edit pages to SPA actions
Convert clients add/edit page to SPA action with loading pattern
Refactor component scoped IDs from $id to $sid
Fix jqhtml comment syntax and implement universal error component system
Update all application code to use new unified error system
Remove all backwards compatibility - unified error system complete
Phase 5: Remove old response classes
Phase 3-4: Ajax response handler sends new format, old helpers deprecated
Phase 2: Add client-side unified error foundation
Phase 1: Add server-side unified error foundation
Add unified Ajax error response system with constants

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-11-21 04:35:01 +00:00
parent 081fc0b88e
commit 78553d4edf
899 changed files with 8887 additions and 7868 deletions

View File

@@ -90,6 +90,63 @@ class Frontend_Clients_Edit {
---
## 2025-11-20: Unified Ajax Error Response System
**Component**: Ajax error handling
**Impact**: Medium - Existing error handling code continues to work, but new pattern recommended
### Change
Replaced fragmented error response helpers (`response_form_error()`, `response_auth_required()`, etc.) with unified `response_error()` function using constants for error codes. Same constant names on server and client for zero mental translation.
### Previous Pattern
```php
// Server - different functions for each error type
return response_form_error('Validation failed', ['email' => 'Invalid']);
return response_not_found('Project not found');
return response_unauthorized('Permission denied');
```
```javascript
// Client - string matching with different names
if (error.type === 'form_error') { ... }
if (error.type === 'not_found') { ... }
```
### New Pattern
```php
// Server - single function with constants
return response_error(Ajax::ERROR_VALIDATION, ['email' => 'Invalid']);
return response_error(Ajax::ERROR_NOT_FOUND, 'Project not found');
return response_error(Ajax::ERROR_UNAUTHORIZED); // Auto-message
```
```javascript
// Client - same constant names
if (e.code === Ajax.ERROR_VALIDATION) { ... }
if (e.code === Ajax.ERROR_NOT_FOUND) { ... }
```
### Migration Steps
1. **Update server-side error responses** to use `response_error()` with constants
2. **Update client-side error checks** to use `e.code === Ajax.ERROR_*` instead of `e.type === 'string'`
3. **Read updated documentation**: `php artisan rsx:man ajax_error_handling`
Old helpers still work but are deprecated. Framework code being updated to new pattern.
### Benefits
- Same constant names server and client (`Ajax::ERROR_NOT_FOUND` = `Ajax.ERROR_NOT_FOUND`)
- IDE autocomplete for error codes
- Refactor-safe (rename constant updates both sides)
- Auto-generated messages for common errors
- Simpler API (one function instead of many)
---
## Template for Future Entries
```