feat: Add Web CRUD interface for Authors, Contacts, and Addresses (#415)

Commit: 321fc54cf4e1c28a948c36accef37df30f51a942
Date: 2025-10-21 15:31:43 +0000
Author: PascalHavelange

Commit Message

feat: Add Web CRUD interface for Authors, Contacts, and Addresses (#415)

* # Fix translation issues and settings validation

## Issues Fixed

### 1. Settings: Self-Registration Toggle Error
**Issue:** Disabling user self-registration triggered a validation error: "The self registration enabled field is required."

**Root Cause:** The `UpdateSettingsRequest` had `required|boolean` validation, but when an HTML checkbox is unchecked, it doesn't send any value.

**Solution:**
- Changed validation to `nullable|boolean`
- Added `prepareForValidation()` method to treat missing checkbox as `false`
- File: `app/Http/Requests/Web/UpdateSettingsRequest.php`

### 2. Item Translation: Description Field Harmonization
**Issue:** Item Translation had `description` marked as required, differing from Collection Translation where it's optional. This caused confusion and inconsistency.

**Root Cause:**
- Database migration had `description` as non-nullable in `item_translations` table
- Form requests had `required` validation for `description`
- Blade form had `required` attribute on textarea

**Solution:**
- Created migration `2025_10_21_132924_make_item_translations_description_nullable.php` to alter the table
- Updated `StoreItemTranslationRequest` and `UpdateItemTranslationRequest` to make `description` nullable
- Removed `required` attribute from the Blade form
- Updated tests to reflect the change
- Files affected:
  - `database/migrations/2025_10_21_132924_make_item_translations_description_nullable.php` (new)
  - `app/Http/Requests/Web/StoreItemTranslationRequest.php`
  - `app/Http/Requests/Web/UpdateItemTranslationRequest.php`
  - `resources/views/item-translations/_form.blade.php`
  - `tests/Feature/Web/ItemTranslation/StoreTest.php`
  - `tests/Feature/Web/ItemTranslation/UpdateTest.php`

### 3. Collection Translation: Tile Color Consistency
**Issue:** Collection Translation's tile on the home page had a different color shade (purple) than Collections (yellow).

**Solution:**
- Changed Collection Translations tile to use yellow color scheme matching Collections
- File: `resources/views/home.blade.php`

### 4. Documentation Update
**Issue:** Missing critical requirements in copilot instructions

**Solution:**
- Added explicit requirements to implement entire requests
- Added requirement to fix all warnings and errors
- File: `.github/copilot-instructions.md`

## Testing
- All 1820 tests passing
- Pint (Laravel PHP linting): ✅ 876 files
- ESLint: ✅ No issues
- TypeScript: ✅ No errors
- Build: ✅ Successful
- Security audits: ✅ No vulnerabilities

## Note
The "data doesn't appear to be saved" issue mentioned in the original request could not be reproduced. The controllers correctly redirect to the show page after successful creation. If this issue persists, it may be related to:
- Browser validation preventing form submission
- JavaScript errors in the browser console
- Session issues
- Database transaction issues

Users should check browser console for errors and ensure all required fields are filled correctly.

* # feat: Add Web CRUD interface for Authors, Contacts, and Addresses

## Summary
Implemented complete Web (Blade) CRUD interfaces for Author, Contact, and Address models with searchable dropdowns, validation, and comprehensive test coverage.

## Changes

### Controllers
- Created `Web\AuthorController` with full CRUD operations
- Created `Web\ContactController` with full CRUD operations
- Created `Web\AddressController` with full CRUD operations and translation support
- All controllers use `SearchAndPaginate` trait for consistent search/filter functionality

### Form Requests
- Created `Web\StoreAuthorRequest` and `Web\UpdateAuthorRequest`
- Created `Web\StoreContactRequest` and `Web\UpdateContactRequest`
- Created `Web\StoreAddressRequest` and `Web\UpdateAddressRequest`
- Fixed Address validation: Country uses 3-character string IDs, not UUIDs

### Views
- Created complete Blade view sets for authors, contacts, and addresses:
  - `index.blade.php` with search bar and pagination (matching Project pattern)
  - `show.blade.php` for viewing details
  - `create.blade.php` and `edit.blade.php` for forms
  - `_form.blade.php` partial for form fields
- All index views include search functionality and pagination links

### Components
- Created `x-searchable-select` component for generic searchable dropdowns
- Created `x-author-select` component for author selection in forms
- Created `x-contact-select` component for contact selection in forms
- Created `x-address-select` component for address selection in forms

### Routes & Navigation
- Added Web routes for authors, contacts, and addresses in `routes/web.php`
- Added navigation menu items for Authors, Contacts, and Addresses
- Added home dashboard tiles for quick access to each entity

### Tests
- Created comprehensive Web tests for all three models:
  - IndexTest: List views with search and pagination
  - ShowTest: Detail views
  - StoreTest: Create operations with validation
  - UpdateTest: Edit operations with validation
  - DestroyTest: Delete operations
- All 31 tests passing

### Database
- Updated `AuthorSeeder`, `ContactSeeder`, and `AddressSeeder` to populate sample data

## Testing
- ✅ All 1853 tests pass (including 31 new Web CRUD tests)
- ✅ Pint (PHP linting): No issues
- ✅ ESLint (JS/Vue linting): No issues
- ✅ TypeScript: No type errors
- ✅ npm build: Successful
- ✅ composer audit: No security vulnerabilities
- ✅ npm audit: No security vulnerabilities

## Notes
- The implementation follows existing patterns from Project and User management
- Search bars use the same styling and functionality as admin user index
- Dropdown components use HTML5 datalist for native searchable selects
- Country ID validation correctly uses `string|max:3` instead of `uuid`

* 5.9.0

---------

Co-authored-by: Pascal HAVELANGE <havelangep@hotmail.com>

Files Changed


This documentation was automatically generated from Git commit data.