# 🔧 TROUBLESHOOTING - NetGescon ## Risoluzione Problemi e Debug ### 📋 CONTENUTI CATEGORIA: #### 🚨 **PROBLEMI INTERFACCIA E LAYOUT** - Tabs non funzionanti - Sub-tabs non visibili - Layout CSS rotto - JavaScript errors #### 🗄️ **ERRORI DATABASE E MIGRAZIONI** - **RECOVERY-GUIDE.md** - ⭐ GUIDA RECOVERY - Migrazioni fallite - Relazioni non caricate - Performance query lente #### 💻 **PROBLEMI FRONTEND** - Tailwind CSS non compilato - Vite build errors - Assets non caricati - JavaScript runtime errors #### 🐘 **ERRORI LARAVEL E PHP** - Controller errors - Model relationships - Routing issues - Permission denied --- ## 🚨 PROBLEMI COMUNI E SOLUZIONI ### 1. **Tabs Tabelle Millesimali Vuoti** ```php // PROBLEMA: Dati non visibili // SOLUZIONE: Eager loading nel controller $stabile->load([ 'tabelleMillesimali' => function($query) { $query->orderBy('ordinamento')->orderBy('nome_tabella'); }, 'vociSpesa' => function($query) { $query->orderBy('ordinamento')->orderBy('descrizione'); } ]); ``` ### 2. **Errore SQL Column ordinamento** ```bash # PROBLEMA: Column 'ordinamento' doesn't exist # SOLUZIONE: Creare migrazione php artisan make:migration add_ordinamento_to_tables ``` ### 3. **Layout CSS non applicato** ```bash # PROBLEMA: Styles non caricati # SOLUZIONE: Build assets npm run build php artisan view:clear ``` ### 4. **Permessi di accesso** ```bash # PROBLEMA: Permission denied # SOLUZIONE: Fix ownership sudo chown -R www-data:www-data /var/www/netgescon sudo chmod -R 755 /var/www/netgescon ``` --- ## 🔍 DEBUGGING WORKFLOW ### 1. **Check Logs**: ```bash # Laravel Logs tail -f /var/www/netgescon/storage/logs/laravel.log # Apache Logs tail -f /var/log/apache2/error.log ``` ### 2. **Database Debug**: ```sql -- Check data exists SELECT COUNT(*) FROM tabelle_millesimali WHERE stabile_id = 1; SELECT COUNT(*) FROM voci_spesa WHERE stabile_id = 1; ``` ### 3. **Clear All Caches**: ```bash cd /var/www/netgescon php artisan view:clear php artisan route:clear php artisan config:clear php artisan cache:clear ``` --- ## 🛠️ STRUMENTI DEBUG ### Laravel Debug: - **dd()** - Dump and die - **Log::info()** - Debug logging - **DB::enableQueryLog()** - SQL queries - **php artisan tinker** - Interactive shell ### Browser Debug: - F12 Developer Tools - Console JavaScript errors - Network tab for API calls - Elements tab for CSS issues --- ## 📊 CHECKLIST RISOLUZIONE ### ✅ **PRE-DEBUG**: - [ ] Check Laravel .env configuration - [ ] Verify database connection - [ ] Confirm file permissions - [ ] Check Apache/PHP errors ### 🔍 **DEBUGGING**: - [ ] Enable Laravel debug mode - [ ] Check controller loading - [ ] Verify model relationships - [ ] Test database queries ### ✅ **POST-FIX**: - [ ] Clear all caches - [ ] Test functionality - [ ] Verify performance - [ ] Update documentation --- **📅 ULTIMO AGGIORNAMENTO: 28 Luglio 2025** **🎯 STATUS: TROUBLESHOOTING ATTIVO**