# ⚡ NETGESCON - QUICK REFERENCE CARD
## Comandi Salvavita e Riferimenti Rapidi

> **🆘 EMERGENZA:** Hai un problema? Inizia da qui!  
> **🔗 Master:** [`../00-INDICE-MASTER-NETGESCON.md`](../00-INDICE-MASTER-NETGESCON.md)  
> **📅 Aggiornato:** 15/07/2025

---

## 🚨 **EMERGENZE COMUNI**

### 🔥 **Dashboard si sposta/salta dopo refresh**
```bash
# FIX IMMEDIATO: Commenta riga loading-screen
cd laravel/resources/views/components/layout
sed -i 's/@include/{{-- @include/' universal.blade.php
# La riga diventa: {{-- @include('components.layout.loading-screen') --}}
```
👉 **Dettagli:** [`manuals/INTERFACCIA-UNICA-TROUBLESHOOTING.md`](manuals/INTERFACCIA-UNICA-TROUBLESHOOTING.md)

### 🏠 **Errore "View [dashboard.guest] not found"**
```bash
# Crea la view mancante
mkdir -p laravel/resources/views/dashboard
echo "@extends('layouts.app') @section('content') <h1>Dashboard Guest</h1> @endsection" > laravel/resources/views/dashboard/guest.blade.php
```

### 🔑 **Non riesco a loggarmi come admin**
```bash
# Rigenera admin Miki
cd laravel
php artisan db:seed --class=MikiAdminSeeder
# Login: admin@example.com / password
```

### 🗄️ **Errore ruolo 'condomino' non trovato**
```bash
# Rigenera ruoli
cd laravel
php artisan db:seed --class=RoleSeeder
```

---

## 🚀 **AVVIO SISTEMA**

### 🌐 **Start Laravel Server**
```bash
cd laravel
php artisan serve --host=0.0.0.0 --port=8000
# URL: http://localhost:8000
```

### 🔑 **Credenziali Default**
- **Email:** admin@example.com
- **Password:** password
- **Ruoli:** admin, super-admin

### 🗄️ **Database Reset**
```bash
cd laravel
php artisan migrate:fresh --seed
```

---

## 📁 **FILE CRITICI**

### 🎨 **Layout e UI**
| File | Scopo | Errore Comune |
|------|-------|---------------|
| `laravel/resources/views/components/layout/universal.blade.php` | Layout master | Loading screen sposta layout |
| `laravel/resources/views/components/menu/sections/footer.blade.php` | Footer sidebar | Progress bar |
| `laravel/resources/views/dashboard/guest.blade.php` | Dashboard guest | View not found |

### 🏢 **Gestione Stabili**
| File | Scopo | Note |
|------|-------|------|
| `laravel/resources/views/admin/stabili/_form.blade.php` | Form stabili avanzata | Layout tab, multi-palazzine |
| `laravel/app/Http/Controllers/Admin/StabileController.php` | Controller stabili | Gestione nuovi campi |
| `laravel/app/Models/Stabile.php` | Model stabili | Nuovi campi JSON |

### 🔧 **Database e Seeder**
| File | Scopo | Comando |
|------|-------|---------|
| `laravel/database/seeders/MikiAdminSeeder.php` | Admin Miki | `php artisan db:seed --class=MikiAdminSeeder` |
| `laravel/database/seeders/RoleSeeder.php` | Ruoli sistema | `php artisan db:seed --class=RoleSeeder` |
| `laravel/database/migrations/*_add_banking_and_palazzine_*.php` | Nuovi campi | `php artisan migrate` |

---

## 🔧 **COMANDI LARAVEL UTILI**

### 🗄️ **Database**
```bash
# Migrate + Seed completo
php artisan migrate:fresh --seed

# Solo nuove migrazioni
php artisan migrate

# Seeder specifico
php artisan db:seed --class=NomeSeeder

# Rollback ultima migrazione
php artisan migrate:rollback
```

### 🧹 **Cache e Ottimizzazione**
```bash
# Clear tutto
php artisan optimize:clear

# Clear specifici
php artisan cache:clear
php artisan config:clear
php artisan view:clear
php artisan route:clear
```

### 🔧 **Debug**
```bash
# Modalità debug
php artisan serve --host=0.0.0.0 --port=8000

# Log in tempo reale
tail -f storage/logs/laravel.log

# Tinker (console interattiva)
php artisan tinker
```

---

## 📂 **DIRECTORY CHIAVE**

### 🎨 **Frontend**
```
laravel/resources/views/
├── components/layout/           ← Layout universale
├── admin/stabili/              ← Gestione stabili
├── dashboard/                  ← Dashboard varie
└── layouts/                    ← Layout base
```

### 🔧 **Backend**
```
laravel/app/
├── Http/Controllers/Admin/     ← Controller admin
├── Models/                     ← Model Eloquent
└── Providers/                  ← Service provider
```

### 🗄️ **Database**
```
laravel/database/
├── migrations/                 ← Migrazioni DB
├── seeders/                    ← Seeder dati
└── factories/                  ← Factory test
```

---

## 🐛 **TROUBLESHOOTING RAPIDO**

### ❌ **Errori Comuni**
| Errore | Soluzione Rapida |
|--------|------------------|
| View not found | Controlla path in `resources/views/` |
| Route not found | `php artisan route:list` |
| Class not found | `composer dump-autoload` |
| Permission denied | `chmod -R 755 storage bootstrap/cache` |
| Database error | Controlla `.env` e connessione DB |

### 🔄 **Reset Completo**
```bash
# ATTENZIONE: Cancella tutti i dati!
cd laravel
php artisan migrate:fresh --seed
php artisan optimize:clear
```

---

## 📞 **SUPPORTO E RISORSE**

### 📚 **Documentazione Completa**
- 🏠 **Master Index:** [`../00-INDICE-MASTER-NETGESCON.md`](../00-INDICE-MASTER-NETGESCON.md)
- 🔧 **Troubleshooting:** [`manuals/INTERFACCIA-UNICA-TROUBLESHOOTING.md`](manuals/INTERFACCIA-UNICA-TROUBLESHOOTING.md)
- 📚 **Bibbia Archivi:** [`manuals/ARCHIVI-DATABASE-BIBBIA.md`](manuals/ARCHIVI-DATABASE-BIBBIA.md)
- 📋 **Checklist:** [`checklists/CHECKLIST-IMPLEMENTAZIONE.md`](checklists/CHECKLIST-IMPLEMENTAZIONE.md)

### 📝 **Log e Tracking**
- 📊 **Log Principale:** [`LOG-SVILUPPO.md`](LOG-SVILUPPO.md)
- 🔥 **Ultimo Fix:** [`logs/LOG-TEST-DASHBOARD-2025-07-15.md`](logs/LOG-TEST-DASHBOARD-2025-07-15.md)
- 📂 **Tutti i Log:** [`logs/`](logs/)

### 🌐 **URL e Contatti**
- **Sviluppo:** http://localhost:8000
- **Admin:** admin@example.com
- **Team:** Michele (Lead Dev), Miki (Domain Expert)

---

## 💡 **TIPS & BEST PRACTICES**

### ✅ **Do's**
- ✅ Sempre backup prima di modifiche importanti
- ✅ Usa `php artisan optimize:clear` dopo modifiche config
- ✅ Testa su ambiente locale prima di deploy
- ✅ Documenta ogni fix nel log appropriato
- ✅ Usa seeder per dati di test consistenti

### ❌ **Don'ts**  
- ❌ Non modificare direttamente file vendor/
- ❌ Non committare file .env
- ❌ Non dimenticare di migrare dopo pull
- ❌ Non cancellare backup senza conferma
- ❌ Non ignorare errori in laravel.log

---

> **🎯 REMEMBER:** Questo è il tuo **primo punto di riferimento** per problemi rapidi!  
> **📖 Per dettagli:** Consulta sempre la documentazione completa linkata sopra.

---

**⚡ NetGescon Quick Reference** - Aggiornato 15/07/2025  
**🔗 Master:** [`../00-INDICE-MASTER-NETGESCON.md`](../00-INDICE-MASTER-NETGESCON.md)
