#!/bin/bash # NetGescon Testing Script # Quick commands for testing the dashboard echo "๐Ÿš€ NetGescon Dashboard Testing Helper" echo "=====================================" echo "" echo "๐Ÿ“‹ Available Commands:" echo "1. Check server status" echo "2. Create test user (if not exists)" echo "3. Create test stabile data" echo "4. Open dashboard in browser" echo "5. Check database status" echo "6. Run migrations" echo "7. Clear Laravel cache" echo "" read -p "Enter command number (1-7): " choice case $choice in 1) echo "๐Ÿ” Checking server status..." curl -I http://localhost:8000/ 2>/dev/null | head -1 || echo "โŒ Server not running" ;; 2) echo "๐Ÿ‘ค Creating test user..." cd netgescon-laravel php artisan db:seed --class=TestUserSeeder echo "โœ… User: admin@netgescon.test / password" ;; 3) echo "๐Ÿข Creating test stabile..." cd netgescon-laravel php -r " require_once 'vendor/autoload.php'; \$app = require_once 'bootstrap/app.php'; \$app->make('Illuminate\Contracts\Console\Kernel')->bootstrap(); try { \$stabile = \App\Models\Stabile::create([ 'denominazione' => 'Condominio Villa Serena - Test', 'indirizzo' => 'Via Roma, 123', 'citta' => 'Roma', 'cap' => '00100', 'provincia' => 'RM', 'codice_fiscale' => '80012345678', 'note' => 'Condominio di test per validazione dashboard' ]); echo 'โœ… Stabile created with ID: ' . \$stabile->id . PHP_EOL; } catch (Exception \$e) { echo 'โŒ Error: ' . \$e->getMessage() . PHP_EOL; } " ;; 4) echo "๐ŸŒ Opening dashboard..." if command -v xdg-open > /dev/null; then xdg-open http://localhost:8000/admin/stabili elif command -v open > /dev/null; then open http://localhost:8000/admin/stabili else echo "๐Ÿ“ฑ Open browser manually: http://localhost:8000/admin/stabili" fi ;; 5) echo "๐Ÿ’พ Checking database..." cd netgescon-laravel php artisan migrate:status | tail -10 echo "" php -r " require_once 'vendor/autoload.php'; \$app = require_once 'bootstrap/app.php'; \$app->make('Illuminate\Contracts\Console\Kernel')->bootstrap(); echo 'Users: ' . \App\Models\User::count() . PHP_EOL; echo 'Stabili: ' . \App\Models\Stabile::count() . PHP_EOL; " ;; 6) echo "๐Ÿ”„ Running migrations..." cd netgescon-laravel php artisan migrate ;; 7) echo "๐Ÿงน Clearing cache..." cd netgescon-laravel php artisan route:clear php artisan config:clear php artisan view:clear php artisan cache:clear echo "โœ… Cache cleared" ;; *) echo "โŒ Invalid choice" ;; esac echo "" echo "๐Ÿ Done!"