8.3 KiB
Club Modal Setup Guide
Quick Start
Follow these steps to get the multi-stage tabbed club modal up and running.
Step 1: Run Database Migration
Add the new fields to your database:
php artisan migrate
This will add:
established_datetotenantstablestatustotenantstablepublic_profile_enabledtotenantstablebenefitpay_accounttoclub_bank_accountstable
Step 2: Update the Clubs View
Replace the current clubs view with the new one that includes the modal:
# Backup the current file (optional)
cp resources/views/admin/platform/clubs.blade.php resources/views/admin/platform/clubs-backup.blade.php
# Replace with the new version
cp resources/views/admin/platform/clubs-with-modal.blade.php resources/views/admin/platform/clubs.blade.php
Or manually update resources/views/admin/platform/clubs.blade.php to include:
- Modal trigger button instead of navigation link
- Include the modal components at the bottom
- Add the JavaScript for opening the modal
Step 3: Clear Caches
php artisan config:clear
php artisan cache:clear
php artisan view:clear
php artisan route:clear
Step 4: Test the Implementation
Test Create Mode
- Navigate to:
http://localhost:8000/admin/clubs - Click "Add New Club" button
- Modal should open with 5 tabs
- Fill in the form:
- Tab 1 (Basic Info): Enter club name, select owner
- Tab 2 (Identity): Upload logo/cover, add social links
- Tab 3 (Location): Select country, drag map marker
- Tab 4 (Contact): Choose email/phone options
- Tab 5 (Finance): Add bank accounts, set status
- Click "Create Club"
- Verify club appears in the list
Test Edit Mode
- Click the edit button (pencil icon) on any club card
- Modal should open with pre-filled data
- Make changes to any fields
- Click "Update Club"
- Verify changes are saved
Test Validation
- Try to proceed to next tab without filling required fields
- Should show validation errors
- Fill required fields and proceed
- All tabs should validate before final submission
Test Responsive Design
- Open browser DevTools
- Toggle device toolbar (mobile view)
- Test modal on different screen sizes
- Verify all elements are accessible
Step 5: Verify Components
Check that all existing components are working:
Image Cropper
- Upload logo → Should open cropper modal
- Crop and save → Should show preview
- Same for cover image
Country Dropdown
- Select country → Should show flag and name
- Search functionality should work
Timezone Dropdown
- Should filter based on selected country
- Search functionality should work
Currency Dropdown
- Should default to country's currency
- Search functionality should work
Map
- Should initialize with marker
- Marker should be draggable
- Lat/Lng inputs should update when marker moves
- Map should update when lat/lng inputs change
QR Code
- Should generate automatically
- Should update when slug changes
- Download button should work
- Print button should work
Troubleshooting
Modal doesn't open
Issue: Clicking "Add New Club" does nothing
Solution:
- Check browser console for JavaScript errors
- Verify Bootstrap 5 is loaded
- Check that modal ID matches:
#clubModal - Ensure
openClubModal()function is defined
Images don't upload
Issue: Cropper doesn't save images
Solution:
- Check storage is linked:
php artisan storage:link - Verify storage permissions:
chmod -R 775 storage - Check
storage/app/publicdirectory exists - Verify cropper component is properly included
Map doesn't load
Issue: Map shows blank or doesn't initialize
Solution:
- Check Leaflet.js CDN is accessible
- Verify internet connection (CDN required)
- Check browser console for errors
- Ensure map container has height:
#clubMap { height: 400px; }
User picker is empty
Issue: No users show in user picker modal
Solution:
- Check API endpoint:
/admin/api/users - Verify route is registered in
routes/web.php - Check
ClubApiController::getUsers()method - Ensure users exist in database
Validation errors
Issue: Form shows validation errors incorrectly
Solution:
- Check
ClubApiControllervalidation rules - Verify all required fields have
requiredattribute - Check error message display in blade templates
- Ensure validation feedback classes are applied
Draft not saving
Issue: Form data lost on accidental close
Solution:
- Check browser localStorage is enabled
- Verify
saveDraft()function is called - Check browser console for errors
- Test in incognito mode (localStorage might be disabled)
Social links not saving
Issue: Social media links don't persist
Solution:
- Check form field names:
social_links[0][platform], etc. - Verify
ClubApiController::store()handles social links - Check
ClubSocialLinkmodel and table exist - Verify relationship in
Tenantmodel
Bank accounts not saving
Issue: Bank account data doesn't persist
Solution:
- Check form field names:
bank_accounts[0][bank_name], etc. - Verify
ClubApiController::store()handles bank accounts - Check
ClubBankAccountmodel and table exist - Verify encryption is working for sensitive fields
Performance Optimization
Reduce Modal Load Time
- Lazy load external libraries:
// Load Leaflet only when Location tab is shown
document.getElementById('location-tab').addEventListener('shown.bs.tab', function() {
if (!window.L) {
// Load Leaflet.js
}
});
- Optimize images:
- Use WebP format for logos/covers
- Implement lazy loading for club cards
- Compress images before upload
- Cache API responses:
// Cache users list in sessionStorage
const cachedUsers = sessionStorage.getItem('users');
if (cachedUsers) {
displayUsers(JSON.parse(cachedUsers));
} else {
fetchUsers();
}
Security Considerations
- CSRF Protection: Already implemented via
@csrfdirective - Authorization: Ensure only super-admins can access
- Input Sanitization: Laravel handles this automatically
- File Upload Validation: Verify file types and sizes
- SQL Injection: Use Eloquent ORM (already implemented)
- XSS Protection: Blade escapes output by default
Browser Compatibility
Tested and working on:
- ✅ Chrome 90+
- ✅ Firefox 88+
- ✅ Safari 14+
- ✅ Edge 90+
- ✅ Mobile browsers (iOS Safari, Chrome Mobile)
Additional Configuration
Customize Modal Size
Edit resources/views/components/club-modal.blade.php:
<!-- Change modal-xl to modal-lg or custom width -->
<div class="modal-dialog modal-dialog-centered modal-xl">
Customize Tab Order
Reorder tabs in resources/views/components/club-modal.blade.php:
<!-- Change the order of tab buttons and tab panes -->
Add Custom Validation
Edit app/Http/Controllers/Admin/ClubApiController.php:
$validator = Validator::make($request->all(), [
// Add your custom rules here
'custom_field' => 'required|string|max:255',
]);
Customize Colors
The modal uses your existing design system. To customize:
/* In your app.css or custom stylesheet */
#clubModal .nav-tabs .nav-link.active {
color: your-custom-color;
border-bottom-color: your-custom-color;
}
Next Steps
After successful setup:
- ✅ Test thoroughly in development
- ✅ Deploy to staging environment
- ✅ Perform user acceptance testing
- ✅ Train admin users on new interface
- ✅ Deploy to production
- ✅ Monitor for issues
- ✅ Gather user feedback
- ✅ Iterate and improve
Support
If you encounter issues not covered in this guide:
- Check the browser console for JavaScript errors
- Check Laravel logs:
storage/logs/laravel.log - Review the implementation documentation:
CLUB_MODAL_IMPLEMENTATION.md - Test with different browsers
- Verify all dependencies are installed
Rollback Plan
If you need to rollback:
# Restore original clubs view
cp resources/views/admin/platform/clubs-backup.blade.php resources/views/admin/platform/clubs.blade.php
# Rollback migration
php artisan migrate:rollback --step=1
# Clear caches
php artisan config:clear
php artisan cache:clear
php artisan view:clear
Setup Time: ~10 minutes
Difficulty: Easy
Prerequisites: Laravel 11, PHP 8.2+, MySQL/PostgreSQL