feat: Complete Collection Translations API and Web Interface (#412)
Commit: d35be0fdb1a286f142c4c8dcc39252f2935947c2
Date: 2025-10-20 18:56:02 +0200
Author: PascalHavelange
Commit Message
feat: Complete Collection Translations API and Web Interface (#412)
* feat: Add CollectionImage visibility and password reset functionality
## Features Added
### CollectionImage Visibility
- Created CollectionImageManager.vue component for managing collection images in SPA
- Integrated CollectionImageManager into CollectionDetail.vue view (visible in view mode)
- Added _images.blade.php partial for collections in web UI
- Updated collections/show.blade.php to include CollectionImages section
- Collections already present in AppHeader navigation (desktop/mobile) and Home dashboard
### Store Cache Management
- Updated clearCacheAndReload() in storeUtils.ts to clear all recent stores:
- collectionImage, itemImage, itemTranslation (with reset methods)
- collection, item, partner (cleared manually)
- availableImage, imageUpload (cleared manually)
- Ensures comprehensive cache clearing for all image and resource stores
### Password Reset
- Password reset already implemented in Laravel backend (using built-in functionality)
- Added "Forgot your password?" link to Login.vue (SPA)
- Web login (login.blade.php) already has password reset link
## Testing
- ✅ All frontend tests pass
- ✅ All backend tests pass (1757 passed)
- ✅ ESLint checks pass
- ✅ TypeScript type-check pass
- ✅ Build succeeds
- ✅ Pint checks pass (849 files)
## Files Changed
- resources/js/components/CollectionImageManager.vue (new)
- resources/js/views/CollectionDetail.vue (modified)
- resources/js/views/Login.vue (modified)
- resources/js/utils/storeUtils.ts (modified)
- resources/views/collections/_images.blade.php (new)
- resources/views/collections/show.blade.php (modified)
* 5.8.1
* chore: Update CHANGELOG and bump version to 5.8.1
* feat: add permissions:sync command for production-safe role and permission management
* fix: add missing PhotoIcon, ChevronUpIcon, and ChevronDownIcon mocks to CollectionDetail tests
* fix: improve cookie clearing to prevent 419 errors with saved credentials
- Remove speculative cookie name variations from cookies.ts (only target actual cookies)
- Use exact cookie names based on Laravel configuration:
- XSRF-TOKEN (Laravel default CSRF cookie)
- inventory_app_session (based on APP_NAME='Inventory-App')
- Import clearAuthCookies at module level in auth store (no dynamic import)
- Call clearAuthCookies synchronously before login attempt
- Set form autocomplete='off' and email autocomplete='username' to prevent browser from saving XSRF token
- Add detailed comments explaining cookie naming based on Laravel config
* feat: enhance item translations and images UI, add available images edit/delete
ItemTranslations improvements:
- Fix search to include parent item's internal_name and ID
- Add language filter dropdown to index page
- Pre-populate item when creating translation from item show page
- Fix Language ordering to use 'internal_name' (not 'language_name')
- Add Item Translations to navigation menu (desktop and mobile)
UI/UX improvements:
- Remove dark mode classes from item images and translations sections
- Standardize section headers with icons and consistent styling
- Fix ItemController sortBy error (use sortBy instead of sortKeys)
AvailableImages enhancements:
- Add edit functionality to update comment field
- Add delete functionality for permanent image removal
- Create UpdateAvailableImageRequest form request
- Add edit view and update routes
Cookie management:
- Clean up cookies.ts to only target actual cookies used
- Remove speculative cookie name variations
- Add detailed comments based on Laravel configuration
* refactor: use system-properties component consistently across all show views
- Move ID, backward_compatibility, created_at, and updated_at to bottom of pages
- Use x-system-properties component (similar to /cli SystemProperties.vue)
- Remove timestamps from main content area on all show views
- Apply to: items, collections, countries, languages, contexts, partners, projects, item-translations
- Apply to admin views: users, roles
- Ensure consistent format.uuid and format.date component usage
- Improve visual consistency between /web and /cli interfaces
* feat: complete Collection Translations web interface and improve Collection Images
Collection Images improvements:
- Remove dark mode classes from collections/_images.blade.php
- Add icon to Images section header (matches Item Images)
- Remove permanent Delete button, keep only Detach (matches Item Images)
- Change card backgrounds from dark to white with borders
Collection Translations implementation:
- Fix CollectionTranslationController search to use 'title' field
- Add Collection Translations to navigation menu (desktop and mobile)
- Create collections/_translations.blade.php partial (mirrors items)
- Update CollectionController to group translations by context
- Add translations section to collections/show.blade.php
- Fix collection-translations/show.blade.php to use correct fields (title, url)
- Remove item-specific fields that don't exist in CollectionTranslation model
Consistency improvements:
- Both Collection Images and Translations now match Item equivalents
- Consistent styling across all image and translation sections
- Proper use of system-properties component everywhere
* fix: critical Collection Translations fixes
- Add Collection Translations tile to home page (was missing)
- Fix table column header: 'Title' instead of 'Name'
- Fix table to display 'title' field instead of empty 'name'
- Show description preview in table instead of alternate_name
- Fix Livewire component search to use 'title' field
- Fix Livewire component sorting to use 'title' in validSortFields
- Create missing _form.blade.php for collection translations
- Form includes only relevant fields: title, description, url (not item-specific fields)
- Fix delete action to use correct title field for record name
All critical errors resolved:
✓ Home page now shows Collection Translations
✓ Table displays data correctly
✓ Edit page now works (form exists)
✓ All fields match CollectionTranslation model structure
* fix: correct Collection Translation tests validation assertions
- Remove 'description' from validation error assertions (field is nullable)
- Tests now match actual form request validation rules
- All 22 Collection Translation tests pass with 61 assertions
* feat: implement complete Collection Translations API
API Implementation:
- Create CollectionTranslationController with full CRUD operations (index, store, show, update, destroy)
- Add API request validation classes (Index, Show, Store, Update)
- Add collection-translation routes to api.php (GET, POST, PATCH, PUT, DELETE)
- Support filtering by collection_id, language_id, context_id, default_context
- Include proper uniqueness validation on (collection_id, language_id, context_id)
- Use CollectionTranslationResource for API responses
OpenAPI Documentation:
- Generate new OpenAPI spec with collection-translation endpoints
- Update API client with TypeScript definitions
- Add documentation for all new endpoints and request/response schemas
Compliance:
- CollectionTranslation now matches same API patterns as all other models
- Consistent with ItemTranslation, Collection, and other translation APIs
- Full CRUD operations available via REST API
* feat: create comprehensive API tests for Collection Translations
API Test Suite:
- Create tests/Feature/Api/CollectionTranslation/ directory with full test coverage
- IndexTest: List, filter by collection_id, language_id, context_id
- StoreTest: Create validation, unique constraints, nullable fields, URL validation
- ShowTest: Display with/without relations, not found handling
- UpdateTest: Full/partial updates, unique constraint validation, field validation
- DestroyTest: Delete operations, not found handling, isolation testing
- AnonymousTest: Unauthorized access protection
Test Structure:
- Follow same patterns as ItemTranslation tests for consistency
- Isolated tests that create their own test data
- Precise assertions on exact records created
- Proper authentication and permission testing
- Comprehensive validation testing
Note: Some tests currently fail due to schema differences (description NOT NULL)
and factory method naming differences - will be addressed in follow-up commit
* Adding API tests for CollectionTranslation
---------
Signed-off-by: PascalHavelange <havelangep@gmail.com>
Co-authored-by: Pascal HAVELANGE <havelangep@hotmail.com>
Files Changed
- 📝 Modified:
.github/workflows/continuous-deployment.yml
- 📝 Modified:
api-client/.openapi-generator/FILES
- 📝 Modified:
api-client/api.ts
- ✅ Added:
api-client/docs/CollectionTranslationApi.md
- ✅ Added:
api-client/docs/CollectionTranslationIndex200Response.md
- ✅ Added:
api-client/docs/CollectionTranslationShow200Response.md
- ✅ Added:
api-client/docs/CollectionTranslationsApi.md
- ✅ Added:
api-client/docs/StoreCollectionTranslationRequest.md
- ✅ Added:
api-client/docs/UpdateCollectionTranslationRequest.md
- 📝 Modified:
api-client/package.json
- ✅ Added:
app/Console/Commands/SyncPermissions.php
- ✅ Added:
app/Http/Controllers/CollectionTranslationController.php
- 📝 Modified:
app/Http/Controllers/Web/AvailableImageController.php
- 📝 Modified:
app/Http/Controllers/Web/CollectionController.php
- ✅ Added:
app/Http/Controllers/Web/CollectionTranslationController.php
- 📝 Modified:
app/Http/Controllers/Web/ItemController.php
- 📝 Modified:
app/Http/Controllers/Web/ItemTranslationController.php
- ✅ Added:
app/Http/Middleware/VerifyCsrfToken.php
- ✅ Added:
app/Http/Requests/Api/IndexCollectionTranslationRequest.php
- ✅ Added:
app/Http/Requests/Api/ShowCollectionTranslationRequest.php
- ✅ Added:
app/Http/Requests/Api/StoreCollectionTranslationRequest.php
- ✅ Added:
app/Http/Requests/Api/UpdateCollectionTranslationRequest.php
- ✅ Added:
app/Http/Requests/Web/StoreCollectionTranslationRequest.php
- ✅ Added:
app/Http/Requests/Web/UpdateAvailableImageRequest.php
- ✅ Added:
app/Http/Requests/Web/UpdateCollectionTranslationRequest.php
- ✅ Added:
app/Livewire/Tables/CollectionTranslationsTable.php
- 📝 Modified:
app/Livewire/Tables/ItemTranslationsTable.php
- 📝 Modified:
bootstrap/app.php
- 📝 Modified:
database/seeders/RolePermissionSeeder.php
- 📝 Modified:
docs/_openapi/api.json
- 📝 Modified:
docs/deployment/command-line-user-management.md
- 📝 Modified:
package-lock.json
- 📝 Modified:
package.json
- 📝 Modified:
resources/js/stores/auth.ts
- ✅ Added:
resources/js/utils/cookies.ts
- 📝 Modified:
resources/js/views/Login.vue
- 📝 Modified:
resources/js/views/__tests__/feature/CollectionDetail.test.ts
- 📝 Modified:
resources/js/views/__tests__/integration/CollectionDetail.test.ts
- 📝 Modified:
resources/views/admin/roles/show.blade.php
- 📝 Modified:
resources/views/admin/users/show.blade.php
- ✅ Added:
resources/views/available-images/edit.blade.php
- 📝 Modified:
resources/views/available-images/show.blade.php
- ✅ Added:
resources/views/collection-translations/_form.blade.php
- ✅ Added:
resources/views/collection-translations/create.blade.php
- ✅ Added:
resources/views/collection-translations/edit.blade.php
- ✅ Added:
resources/views/collection-translations/index.blade.php
- ✅ Added:
resources/views/collection-translations/show.blade.php
- 📝 Modified:
resources/views/collections/_images.blade.php
- ✅ Added:
resources/views/collections/_translations.blade.php
- 📝 Modified:
resources/views/collections/show.blade.php
- 📝 Modified:
resources/views/components/app-nav.blade.php
- ✅ Added:
resources/views/components/format/date.blade.php
- ✅ Added:
resources/views/components/format/uuid.blade.php
- ✅ Added:
resources/views/components/system-properties.blade.php
- 📝 Modified:
resources/views/contexts/show.blade.php
- 📝 Modified:
resources/views/countries/show.blade.php
- 📝 Modified:
resources/views/home.blade.php
- 📝 Modified:
resources/views/item-translations/_form.blade.php
- 📝 Modified:
resources/views/item-translations/show.blade.php
- 📝 Modified:
resources/views/items/_images.blade.php
- 📝 Modified:
resources/views/items/_translations.blade.php
- 📝 Modified:
resources/views/items/show.blade.php
- 📝 Modified:
resources/views/languages/show.blade.php
- ✅ Added:
resources/views/livewire/tables/collection-translations-table.blade.php
- 📝 Modified:
resources/views/livewire/tables/item-translations-table.blade.php
- 📝 Modified:
resources/views/partners/show.blade.php
- 📝 Modified:
resources/views/projects/show.blade.php
- 📝 Modified:
routes/api.php
- 📝 Modified:
routes/web.php
- ✅ Added:
tests/Feature/Api/CollectionTranslation/AnonymousTest.php
- ✅ Added:
tests/Feature/Api/CollectionTranslation/DestroyTest.php
- ✅ Added:
tests/Feature/Api/CollectionTranslation/IndexTest.php
- ✅ Added:
tests/Feature/Api/CollectionTranslation/ShowTest.php
- ✅ Added:
tests/Feature/Api/CollectionTranslation/StoreTest.php
- ✅ Added:
tests/Feature/Api/CollectionTranslation/UpdateTest.php
- ✅ Added:
tests/Feature/Console/SyncPermissionsCommandTest.php
- ✅ Added:
tests/Feature/Web/CollectionTranslation/CreateTest.php
- ✅ Added:
tests/Feature/Web/CollectionTranslation/DestroyTest.php
- ✅ Added:
tests/Feature/Web/CollectionTranslation/EditTest.php
- ✅ Added:
tests/Feature/Web/CollectionTranslation/IndexTest.php
- ✅ Added:
tests/Feature/Web/CollectionTranslation/ShowTest.php
- ✅ Added:
tests/Feature/Web/CollectionTranslation/StoreTest.php
- ✅ Added:
tests/Feature/Web/CollectionTranslation/UpdateTest.php
Links
This documentation was automatically generated from Git commit data.