From cb49fbfe703d33602e8b8dac7acc428dfac62931 Mon Sep 17 00:00:00 2001 From: Pikappa2 Date: Sat, 5 Jul 2025 19:22:51 +0200 Subject: [PATCH] Implementato dark mode completo e salvataggio impostazioni utente MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Aggiunto dark mode completo alla sidebar con classi Tailwind - Implementato sistema di salvataggio permanente delle impostazioni utente - Creata tabella user_settings per gestire preferenze personalizzate - Aggiunto model UserSetting con metodi helper get/set - Esteso controller impostazioni per supportare salvataggio e temi predefiniti - Applicato stesso tema anche al pannello amministratore - Aggiornate route per gestione temi in admin e superadmin - Integrato sistema impostazioni nel layout principale con variabili CSS - Aggiornato AppServiceProvider con helper userSetting() - Dark mode applicato a: sidebar, modali, footer, bottoni, hover states - Temi predefiniti: Default, Dark, Ocean con preview tempo reale - Compatibilità completa tra pannello admin e superadmin --- app/Helpers/impostazioni.php | 12 + .../Admin/ImpostazioniController.php | 74 ++- .../SuperAdmin/ImpostazioniController.php | 63 ++- app/Models/Amministratore.php | 14 + app/Models/Role.php | 16 + app/Models/Soggetto.php | 14 + app/Models/User.php | 12 + app/Models/UserSetting.php | 40 ++ app/Providers/AppServiceProvider.php | 7 + app/Providers/SidebarComposer.php | 42 ++ composer.json | 9 +- composer.json.backup | 86 ++++ ..._06_21_185813_create_permission_tables.php | 12 + ...07_02_000010_create_anagrafiche_tables.php | 2 + .../2025_07_04_000100_create_roles_table.php | 9 + ...25_07_05_120000_create_documenti_table.php | 37 ++ ...7_05_165959_create_user_settings_table.php | 33 ++ ...07_05_200000_create_impostazioni_table.php | 22 + database/seeders/ImpostazioniSeeder.php | 56 +++ database/seeders/NewTestSeeder.php | 17 + database/seeders/TestSeeder.php | 17 + database/seeders/TestSeeder2.php | 17 + lang/en/menu.php | 17 + lang/it/menu.php | 17 + .../views/admin/impostazioni/index.blade.php | 421 ++++++++++++------ .../admin/impostazioni/index.blade.php.backup | 144 ++++++ .../views/components/menu/sidebar.blade.php | 30 +- resources/views/dashboard.blade.php | 16 +- resources/views/layouts/app.blade.php | 63 ++- .../superadmin/impostazioni/index.blade.php | 291 ++++++++++++ routes/web.php | 2 + tailwind.config.js.backup | 21 + 32 files changed, 1445 insertions(+), 188 deletions(-) create mode 100644 app/Helpers/impostazioni.php create mode 100644 app/Models/Role.php create mode 100644 app/Models/UserSetting.php create mode 100644 app/Providers/SidebarComposer.php create mode 100644 composer.json.backup create mode 100644 database/migrations/2025_07_04_000100_create_roles_table.php create mode 100644 database/migrations/2025_07_05_120000_create_documenti_table.php create mode 100644 database/migrations/2025_07_05_165959_create_user_settings_table.php create mode 100644 database/migrations/2025_07_05_200000_create_impostazioni_table.php create mode 100644 database/seeders/ImpostazioniSeeder.php create mode 100644 database/seeders/NewTestSeeder.php create mode 100644 database/seeders/TestSeeder.php create mode 100644 database/seeders/TestSeeder2.php create mode 100644 lang/en/menu.php create mode 100644 lang/it/menu.php create mode 100644 resources/views/admin/impostazioni/index.blade.php.backup create mode 100644 resources/views/superadmin/impostazioni/index.blade.php create mode 100644 tailwind.config.js.backup diff --git a/app/Helpers/impostazioni.php b/app/Helpers/impostazioni.php new file mode 100644 index 00000000..af0b0ded --- /dev/null +++ b/app/Helpers/impostazioni.php @@ -0,0 +1,12 @@ +where('chiave', $chiave)->value('valore'); + return $val ?? $default; + }); + } +} diff --git a/app/Http/Controllers/Admin/ImpostazioniController.php b/app/Http/Controllers/Admin/ImpostazioniController.php index 1cfb9e57..894561a2 100644 --- a/app/Http/Controllers/Admin/ImpostazioniController.php +++ b/app/Http/Controllers/Admin/ImpostazioniController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers\Admin; use App\Http\Controllers\Controller; +use App\Models\UserSetting; use Illuminate\Http\Request; class ImpostazioniController extends Controller @@ -14,6 +15,77 @@ class ImpostazioniController extends Controller public function index() { - return view('admin.impostazioni.index'); + // Carica le impostazioni attuali dell'utente + $settings = [ + 'dark_mode' => UserSetting::get('dark_mode', 'false'), + 'bg_color' => UserSetting::get('bg_color', '#ffffff'), + 'text_color' => UserSetting::get('text_color', '#1e293b'), + 'accent_color' => UserSetting::get('accent_color', '#6366f1'), + 'sidebar_bg_color' => UserSetting::get('sidebar_bg_color', '#fde047'), + 'sidebar_text_color' => UserSetting::get('sidebar_text_color', '#1e293b'), + 'sidebar_accent_color' => UserSetting::get('sidebar_accent_color', '#6366f1'), + ]; + + return view('admin.impostazioni.index', compact('settings')); + } + + public function store(Request $request) + { + $validated = $request->validate([ + 'dark_mode' => 'string|in:true,false', + 'bg_color' => 'string|max:7', + 'text_color' => 'string|max:7', + 'accent_color' => 'string|max:7', + 'sidebar_bg_color' => 'string|max:7', + 'sidebar_text_color' => 'string|max:7', + 'sidebar_accent_color' => 'string|max:7', + ]); + + // Salva le impostazioni per l'utente corrente + foreach ($validated as $key => $value) { + UserSetting::set($key, $value); + } + + return response()->json(['success' => true, 'message' => 'Impostazioni salvate con successo!']); + } + + public function theme(Request $request) + { + $theme = $request->input('theme', 'default'); + + $themes = [ + 'default' => [ + 'bg_color' => '#ffffff', + 'text_color' => '#1e293b', + 'accent_color' => '#6366f1', + 'sidebar_bg_color' => '#fde047', + 'sidebar_text_color' => '#1e293b', + 'sidebar_accent_color' => '#6366f1', + ], + 'dark' => [ + 'bg_color' => '#1e293b', + 'text_color' => '#f1f5f9', + 'accent_color' => '#fbbf24', + 'sidebar_bg_color' => '#374151', + 'sidebar_text_color' => '#f1f5f9', + 'sidebar_accent_color' => '#fbbf24', + ], + 'ocean' => [ + 'bg_color' => '#f0f9ff', + 'text_color' => '#0c4a6e', + 'accent_color' => '#0ea5e9', + 'sidebar_bg_color' => '#0ea5e9', + 'sidebar_text_color' => '#ffffff', + 'sidebar_accent_color' => '#f0f9ff', + ], + ]; + + if (isset($themes[$theme])) { + foreach ($themes[$theme] as $key => $value) { + UserSetting::set($key, $value); + } + } + + return response()->json(['success' => true, 'settings' => $themes[$theme] ?? []]); } } \ No newline at end of file diff --git a/app/Http/Controllers/SuperAdmin/ImpostazioniController.php b/app/Http/Controllers/SuperAdmin/ImpostazioniController.php index 48d909c4..c20d2c6a 100644 --- a/app/Http/Controllers/SuperAdmin/ImpostazioniController.php +++ b/app/Http/Controllers/SuperAdmin/ImpostazioniController.php @@ -3,19 +3,31 @@ namespace App\Http\Controllers\SuperAdmin; use App\Http\Controllers\Controller; +use App\Models\UserSetting; use Illuminate\Http\Request; class ImpostazioniController extends Controller { public function index() { - return view('superadmin.impostazioni.index'); + // Carica le impostazioni attuali dell'utente + $settings = [ + 'dark_mode' => UserSetting::get('dark_mode', 'false'), + 'bg_color' => UserSetting::get('bg_color', '#ffffff'), + 'text_color' => UserSetting::get('text_color', '#1e293b'), + 'accent_color' => UserSetting::get('accent_color', '#6366f1'), + 'sidebar_bg_color' => UserSetting::get('sidebar_bg_color', '#fde047'), + 'sidebar_text_color' => UserSetting::get('sidebar_text_color', '#1e293b'), + 'sidebar_accent_color' => UserSetting::get('sidebar_accent_color', '#6366f1'), + ]; + + return view('superadmin.impostazioni.index', compact('settings')); } public function store(Request $request) { - // Logica per salvare le impostazioni di colore $validated = $request->validate([ + 'dark_mode' => 'string|in:true,false', 'bg_color' => 'string|max:7', 'text_color' => 'string|max:7', 'accent_color' => 'string|max:7', @@ -24,8 +36,51 @@ class ImpostazioniController extends Controller 'sidebar_accent_color' => 'string|max:7', ]); - // Salva nelle impostazioni di sistema (da implementare) - // Per ora restituiamo una risposta di successo + // Salva le impostazioni per l'utente corrente + foreach ($validated as $key => $value) { + UserSetting::set($key, $value); + } + return response()->json(['success' => true, 'message' => 'Impostazioni salvate con successo!']); } + + public function theme(Request $request) + { + $theme = $request->input('theme', 'default'); + + $themes = [ + 'default' => [ + 'bg_color' => '#ffffff', + 'text_color' => '#1e293b', + 'accent_color' => '#6366f1', + 'sidebar_bg_color' => '#fde047', + 'sidebar_text_color' => '#1e293b', + 'sidebar_accent_color' => '#6366f1', + ], + 'dark' => [ + 'bg_color' => '#1e293b', + 'text_color' => '#f1f5f9', + 'accent_color' => '#fbbf24', + 'sidebar_bg_color' => '#374151', + 'sidebar_text_color' => '#f1f5f9', + 'sidebar_accent_color' => '#fbbf24', + ], + 'ocean' => [ + 'bg_color' => '#f0f9ff', + 'text_color' => '#0c4a6e', + 'accent_color' => '#0ea5e9', + 'sidebar_bg_color' => '#0ea5e9', + 'sidebar_text_color' => '#ffffff', + 'sidebar_accent_color' => '#f0f9ff', + ], + ]; + + if (isset($themes[$theme])) { + foreach ($themes[$theme] as $key => $value) { + UserSetting::set($key, $value); + } + } + + return response()->json(['success' => true, 'settings' => $themes[$theme] ?? []]); + } } diff --git a/app/Models/Amministratore.php b/app/Models/Amministratore.php index b8c3be83..98c1b08a 100644 --- a/app/Models/Amministratore.php +++ b/app/Models/Amministratore.php @@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; // Aggiunto per condomini() use Illuminate\Database\Eloquent\SoftDeletes; // Aggiunto per soft deletes +use Illuminate\Support\Str; class Amministratore extends Model { @@ -39,6 +40,7 @@ class Amministratore extends Model 'telefono_studio', 'email_studio', 'pec_studio', + 'codice_univoco', ]; /** @@ -63,4 +65,16 @@ class Amministratore extends Model { return $this->hasMany(Fornitore::class, 'amministratore_id', 'id_amministratore'); } + + protected static function booted() + { + static::creating(function ($amministratore) { + if (empty($amministratore->codice_univoco)) { + do { + $code = Str::upper(Str::random(8)); + } while (self::where('codice_univoco', $code)->exists()); + $amministratore->codice_univoco = $code; + } + }); + } } \ No newline at end of file diff --git a/app/Models/Role.php b/app/Models/Role.php new file mode 100644 index 00000000..13b02f69 --- /dev/null +++ b/app/Models/Role.php @@ -0,0 +1,16 @@ +belongsToMany(User::class, 'role_user')->withTimestamps(); + // Relazione legacy rimossa: ora i ruoli sono gestiti solo tramite Spatie/Permission + } +} diff --git a/app/Models/Soggetto.php b/app/Models/Soggetto.php index f4258a89..05b34f69 100644 --- a/app/Models/Soggetto.php +++ b/app/Models/Soggetto.php @@ -6,6 +6,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Support\Str; class Soggetto extends Model { @@ -32,6 +33,7 @@ class Soggetto extends Model 'citta', 'provincia', 'tipo', + 'codice_univoco', ]; /** @@ -51,4 +53,16 @@ class Soggetto extends Model public function proprieta() { return $this->hasMany(Proprieta::class); } + + protected static function booted() + { + static::creating(function ($soggetto) { + if (empty($soggetto->codice_univoco)) { + do { + $code = Str::upper(Str::random(8)); + } while (self::where('codice_univoco', $code)->exists()); + $soggetto->codice_univoco = $code; + } + }); + } } \ No newline at end of file diff --git a/app/Models/User.php b/app/Models/User.php index fdd418cd..8a180d10 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -56,4 +56,16 @@ class User extends Authenticatable // Solo gli utenti con ruolo 'admin' possono essere impersonati. return $this->hasRole('admin'); } + + // public function roles() + // { + // return $this->belongsToMany(\App\Models\Role::class, 'role_user')->withTimestamps(); + // // Relazione legacy rimossa: ora i ruoli sono gestiti solo tramite Spatie/Permission + // } + // public function hasRole($role, $stabileId = null) + // { + // return $this->roles()->where('name', $role) + // ->when($stabileId, fn($q) => $q->wherePivot('stabile_id', $stabileId)) + // ->exists(); + // } } \ No newline at end of file diff --git a/app/Models/UserSetting.php b/app/Models/UserSetting.php new file mode 100644 index 00000000..2f7fc889 --- /dev/null +++ b/app/Models/UserSetting.php @@ -0,0 +1,40 @@ +belongsTo(User::class); + } + + public static function get($key, $default = null) + { + if (!auth()->check()) { + return $default; + } + + $setting = static::where('user_id', auth()->id()) + ->where('key', $key) + ->first(); + + return $setting ? $setting->value : $default; + } + + public static function set($key, $value) + { + if (!auth()->check()) { + return false; + } + + return static::updateOrCreate( + ['user_id' => auth()->id(), 'key' => $key], + ['value' => $value] + ); + } +} diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 187d978c..0b1898a0 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -22,5 +22,12 @@ class AppServiceProvider extends ServiceProvider { // View Composer per la sidebar View::composer(['components.menu.sidebar', 'superadmin.dashboard', 'admin.dashboard'], \App\Http\View\Composers\SidebarComposer::class); + + // Helper per le impostazioni utente + if (!function_exists('userSetting')) { + function userSetting($key, $default = null) { + return \App\Models\UserSetting::get($key, $default); + } + } } } diff --git a/app/Providers/SidebarComposer.php b/app/Providers/SidebarComposer.php new file mode 100644 index 00000000..d9f6a856 --- /dev/null +++ b/app/Providers/SidebarComposer.php @@ -0,0 +1,42 @@ +hasRole('super-admin')) { + $stabili = Stabile::orderBy('denominazione')->get(); + } elseif ($user->amministratore) { + $stabili = Stabile::where('amministratore_id', $user->amministratore->id_amministratore)->orderBy('denominazione')->get(); + } + } + $stabileAttivo = session('stabile_corrente') ?? ($stabili->first() ? $stabili->first()->denominazione : null); + $stabileObj = $stabili->firstWhere('denominazione', $stabileAttivo); + $gestioni = $stabileObj ? Gestione::where('stabile_id', $stabileObj->id)->orderByDesc('anno_gestione')->get() : collect(); + $annoAttivo = session('anno_corrente') ?? ($gestioni->first() ? $gestioni->first()->anno_gestione : date('Y')); + $gestioneAttiva = session('gestione_corrente') ?? ($gestioni->first() ? $gestioni->first()->tipo_gestione : 'Ord.'); + $view->with([ + 'stabili' => $stabili, + 'stabileAttivo' => $stabileAttivo, + 'anni' => $gestioni->pluck('anno_gestione')->unique(), + 'annoAttivo' => $annoAttivo, + 'gestione' => $gestioneAttiva, + ]); + }); + } + + public function register() {} +} diff --git a/composer.json b/composer.json index 05376174..a976a374 100644 --- a/composer.json +++ b/composer.json @@ -31,10 +31,11 @@ }, "autoload": { "psr-4": { - "App\\": "app/", - "Database\\Factories\\": "database/factories/", - "Database\\Seeders\\": "database/seeders/" - } + "App\\": "app/" + }, + "files": [ + "app/Helpers/impostazioni.php" + ] }, "autoload-dev": { "psr-4": { diff --git a/composer.json.backup b/composer.json.backup new file mode 100644 index 00000000..a976a374 --- /dev/null +++ b/composer.json.backup @@ -0,0 +1,86 @@ +{ + "$schema": "https://getcomposer.org/schema.json", + "name": "laravel/laravel", + "type": "project", + "description": "The skeleton application for the Laravel framework.", + "keywords": [ + "laravel", + "framework" + ], + "license": "MIT", + "require": { + "php": "^8.2", + "lab404/laravel-impersonate": "^1.7", + "laravel/fortify": "^1.26", + "laravel/framework": "^12.0", + "laravel/sanctum": "^4.1", + "laravel/tinker": "^2.10.1", + "livewire/livewire": "^3.6", + "spatie/laravel-permission": "^6.20" + }, + "require-dev": { + "fakerphp/faker": "^1.23", + "laravel/breeze": "^2.3", + "laravel/pail": "^1.2.2", + "laravel/pint": "^1.13", + "laravel/sail": "^1.41", + "mockery/mockery": "^1.6", + "nunomaduro/collision": "^8.6", + "pestphp/pest": "^3.8", + "pestphp/pest-plugin-laravel": "^3.2" + }, + "autoload": { + "psr-4": { + "App\\": "app/" + }, + "files": [ + "app/Helpers/impostazioni.php" + ] + }, + "autoload-dev": { + "psr-4": { + "Tests\\": "tests/" + } + }, + "scripts": { + "post-autoload-dump": [ + "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", + "@php artisan package:discover --ansi" + ], + "post-update-cmd": [ + "@php artisan vendor:publish --tag=laravel-assets --ansi --force" + ], + "post-root-package-install": [ + "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" + ], + "post-create-project-cmd": [ + "@php artisan key:generate --ansi", + "@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"", + "@php artisan migrate --graceful --ansi" + ], + "dev": [ + "Composer\\Config::disableProcessTimeout", + "npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1\" \"php artisan pail --timeout=0\" \"npm run dev\" --names=server,queue,logs,vite" + ], + "test": [ + "@php artisan config:clear --ansi", + "@php artisan test" + ] + }, + "extra": { + "laravel": { + "dont-discover": [] + } + }, + "config": { + "optimize-autoloader": true, + "preferred-install": "dist", + "sort-packages": true, + "allow-plugins": { + "pestphp/pest-plugin": true, + "php-http/discovery": true + } + }, + "minimum-stability": "stable", + "prefer-stable": true +} diff --git a/database/migrations/2025_06_21_185813_create_permission_tables.php b/database/migrations/2025_06_21_185813_create_permission_tables.php index ce4d9d2d..b2beb728 100644 --- a/database/migrations/2025_06_21_185813_create_permission_tables.php +++ b/database/migrations/2025_06_21_185813_create_permission_tables.php @@ -111,6 +111,18 @@ return new class extends Migration $table->primary([$pivotPermission, $pivotRole], 'role_has_permissions_permission_id_role_id_primary'); }); + // Popola ruoli di base + DB::table('roles')->insertOrIgnore([ + ['name' => 'super-admin', 'guard_name' => 'web', 'created_at' => now(), 'updated_at' => now()], + ['name' => 'admin', 'guard_name' => 'web', 'created_at' => now(), 'updated_at' => now()], + ['name' => 'collaboratore', 'guard_name' => 'web', 'created_at' => now(), 'updated_at' => now()], + ['name' => 'condomino', 'guard_name' => 'web', 'created_at' => now(), 'updated_at' => now()], + ['name' => 'fornitore', 'guard_name' => 'web', 'created_at' => now(), 'updated_at' => now()], + ['name' => 'inquilino', 'guard_name' => 'web', 'created_at' => now(), 'updated_at' => now()], + ['name' => 'ospite', 'guard_name' => 'web', 'created_at' => now(), 'updated_at' => now()], + ['name' => 'servizi', 'guard_name' => 'web', 'created_at' => now(), 'updated_at' => now()], + ]); + app('cache') ->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null) ->forget(config('permission.cache.key')); diff --git a/database/migrations/2025_07_02_000010_create_anagrafiche_tables.php b/database/migrations/2025_07_02_000010_create_anagrafiche_tables.php index eb98490b..950f511e 100644 --- a/database/migrations/2025_07_02_000010_create_anagrafiche_tables.php +++ b/database/migrations/2025_07_02_000010_create_anagrafiche_tables.php @@ -28,6 +28,7 @@ return new class extends Migration $table->string('telefono_studio')->nullable(); $table->string('email_studio')->nullable(); $table->string('pec_studio')->nullable(); + $table->string('codice_univoco', 8)->unique(); $table->timestamps(); $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); }); @@ -67,6 +68,7 @@ return new class extends Migration $table->string('citta', 60)->nullable(); $table->string('provincia', 2)->nullable(); $table->enum('tipo', ['proprietario', 'inquilino', 'usufruttuario', 'altro']); + $table->string('codice_univoco', 8)->unique(); $table->timestamps(); }); diff --git a/database/migrations/2025_07_04_000100_create_roles_table.php b/database/migrations/2025_07_04_000100_create_roles_table.php new file mode 100644 index 00000000..4553cf3f --- /dev/null +++ b/database/migrations/2025_07_04_000100_create_roles_table.php @@ -0,0 +1,9 @@ +id(); + $table->string('protocollo')->nullable()->unique(); // es. 2025-0001 + $table->date('data_protocollo')->nullable(); + $table->string('tipo_documento')->nullable(); // Fattura, Contratto, Verbale, ecc. + $table->unsignedBigInteger('stabile_id')->nullable(); + $table->unsignedBigInteger('fornitore_id')->nullable(); + $table->unsignedBigInteger('esercizio_contabile_id')->nullable(); + $table->text('descrizione')->nullable(); + $table->decimal('importo', 12, 2)->nullable(); + $table->date('data_documento')->nullable(); + $table->string('nome_file'); + $table->string('path_file'); + $table->text('testo_estratto_ocr')->nullable(); + // Polimorfismo + $table->unsignedBigInteger('documentable_id')->nullable()->index(); + $table->string('documentable_type')->nullable()->index(); + $table->timestamps(); + // FK opzionali + $table->foreign('stabile_id')->references('id')->on('stabili')->onDelete('set null'); + $table->foreign('fornitore_id')->references('id')->on('fornitori')->onDelete('set null'); + // $table->foreign('esercizio_contabile_id')->references('id')->on('esercizi_contabili')->onDelete('set null'); // FK disabilitata: tabella non ancora presente + }); + } + public function down(): void + { + Schema::dropIfExists('documenti'); + } +}; diff --git a/database/migrations/2025_07_05_165959_create_user_settings_table.php b/database/migrations/2025_07_05_165959_create_user_settings_table.php new file mode 100644 index 00000000..77b4325a --- /dev/null +++ b/database/migrations/2025_07_05_165959_create_user_settings_table.php @@ -0,0 +1,33 @@ +id(); + $table->unsignedBigInteger('user_id'); + $table->string('key'); + $table->text('value')->nullable(); + $table->timestamps(); + + $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + $table->unique(['user_id', 'key']); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('user_settings'); + } +}; diff --git a/database/migrations/2025_07_05_200000_create_impostazioni_table.php b/database/migrations/2025_07_05_200000_create_impostazioni_table.php new file mode 100644 index 00000000..27d36ebb --- /dev/null +++ b/database/migrations/2025_07_05_200000_create_impostazioni_table.php @@ -0,0 +1,22 @@ +id(); + $table->string('chiave')->unique(); + $table->string('valore')->nullable(); + $table->string('descrizione')->nullable(); + $table->timestamps(); + }); + } + public function down(): void + { + Schema::dropIfExists('impostazioni'); + } +}; diff --git a/database/seeders/ImpostazioniSeeder.php b/database/seeders/ImpostazioniSeeder.php new file mode 100644 index 00000000..92d1750f --- /dev/null +++ b/database/seeders/ImpostazioniSeeder.php @@ -0,0 +1,56 @@ +insertOrIgnore([ + [ + 'chiave' => 'sidebar_bg', + 'valore' => '#fde047', + 'descrizione' => 'Colore di sfondo sidebar (giallo)', + 'created_at' => now(), + 'updated_at' => now(), + ], + [ + 'chiave' => 'sidebar_text', + 'valore' => '#1e293b', + 'descrizione' => 'Colore testo sidebar', + 'created_at' => now(), + 'updated_at' => now(), + ], + [ + 'chiave' => 'sidebar_accent', + 'valore' => '#6366f1', + 'descrizione' => 'Colore accento sidebar (indigo)', + 'created_at' => now(), + 'updated_at' => now(), + ], + [ + 'chiave' => 'sidebar_bg_dark', + 'valore' => '#23272e', + 'descrizione' => 'Colore sidebar dark mode', + 'created_at' => now(), + 'updated_at' => now(), + ], + [ + 'chiave' => 'sidebar_text_dark', + 'valore' => '#f1f5f9', + 'descrizione' => 'Colore testo sidebar dark mode', + 'created_at' => now(), + 'updated_at' => now(), + ], + [ + 'chiave' => 'sidebar_accent_dark', + 'valore' => '#fbbf24', + 'descrizione' => 'Colore accento sidebar dark mode', + 'created_at' => now(), + 'updated_at' => now(), + ], + ]); + } +} diff --git a/database/seeders/NewTestSeeder.php b/database/seeders/NewTestSeeder.php new file mode 100644 index 00000000..86c72310 --- /dev/null +++ b/database/seeders/NewTestSeeder.php @@ -0,0 +1,17 @@ + 'Dashboard', + 'dashboard_overview' => 'Overview', + 'stabili' => 'Buildings', + 'lista_stabili' => 'List buildings', + 'nuovo_stabile' => 'New building', + 'soggetti' => 'People', + 'lista_soggetti' => 'List people', + 'nuovo_soggetto' => 'New person', + 'contabilita' => 'Accounting', + 'piano_conti' => 'Chart of accounts', + 'movimenti' => 'Transactions', + 'impostazioni' => 'Settings', + 'utenti' => 'Users', + 'ruoli' => 'Roles', +]; diff --git a/lang/it/menu.php b/lang/it/menu.php new file mode 100644 index 00000000..dd1fe305 --- /dev/null +++ b/lang/it/menu.php @@ -0,0 +1,17 @@ + 'Dashboard', + 'dashboard_overview' => 'Panoramica', + 'stabili' => 'Stabili', + 'lista_stabili' => 'Elenco stabili', + 'nuovo_stabile' => 'Nuovo stabile', + 'soggetti' => 'Soggetti', + 'lista_soggetti' => 'Elenco soggetti', + 'nuovo_soggetto' => 'Nuovo soggetto', + 'contabilita' => 'Contabilità', + 'piano_conti' => 'Piano dei conti', + 'movimenti' => 'Movimenti', + 'impostazioni' => 'Impostazioni', + 'utenti' => 'Utenti', + 'ruoli' => 'Ruoli', +]; diff --git a/resources/views/admin/impostazioni/index.blade.php b/resources/views/admin/impostazioni/index.blade.php index efaacca2..d2f731bf 100644 --- a/resources/views/admin/impostazioni/index.blade.php +++ b/resources/views/admin/impostazioni/index.blade.php @@ -1,144 +1,291 @@ - - -

- {{ __('Impostazioni') }} -

-
+@extends('layouts.app') -
-
-
-
- -
-

Configurazione Sistema

-

Gestisci le impostazioni generali dell'applicazione

-
+@section('content') +
+
+

Impostazioni Personalizzazione

+

Personalizza i colori e il tema dell'interfaccia

+
-
- @csrf - - -
-

Impostazioni Applicazione

-
- -
- - - -
- - -
- - - -
-
-
- - -
-

Branding

-
- -
- - - -

Formati supportati: JPG, PNG, SVG (max 2MB)

-
- - -
- - - -
- - -
- - - -

Formato ICO o PNG 32x32px

-
-
-
- - -
-

Configurazione Email

-
- -
- - - -
- - -
- - - -
-
-
- - -
-

Configurazione Pagamenti

-
- -
- - - -
- - -
- - - -
-
-
- - -
- - {{ __('Ripristina') }} - - - {{ __('Salva Impostazioni') }} - -
-
- - @if ($errors->any()) -
-
    - @foreach ($errors->all() as $error) -
  • {{ $error }}
  • - @endforeach -
-
- @endif + + +
+ +
+

Personalizzazione Colori

+ +
+ @csrf + +
+ +
+ + +

Tema Principale

+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + +

Sidebar

+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + +

Temi Predefiniti

+
+ + + +
+ + +
+ + +
+
+
+ + +
+

Anteprima

+ +
+
+

Dashboard Amministratore

+

Benvenuto nel pannello di amministrazione

+
+ + +
+ + + +
+
+
+
+
+
+
+
+
+
+ + +
- \ No newline at end of file +
+ + +@endsection diff --git a/resources/views/admin/impostazioni/index.blade.php.backup b/resources/views/admin/impostazioni/index.blade.php.backup new file mode 100644 index 00000000..efaacca2 --- /dev/null +++ b/resources/views/admin/impostazioni/index.blade.php.backup @@ -0,0 +1,144 @@ + + +

+ {{ __('Impostazioni') }} +

+
+ +
+
+
+
+ +
+

Configurazione Sistema

+

Gestisci le impostazioni generali dell'applicazione

+
+ +
+ @csrf + + +
+

Impostazioni Applicazione

+
+ +
+ + + +
+ + +
+ + + +
+
+
+ + +
+

Branding

+
+ +
+ + + +

Formati supportati: JPG, PNG, SVG (max 2MB)

+
+ + +
+ + + +
+ + +
+ + + +

Formato ICO o PNG 32x32px

+
+
+
+ + +
+

Configurazione Email

+
+ +
+ + + +
+ + +
+ + + +
+
+
+ + +
+

Configurazione Pagamenti

+
+ +
+ + + +
+ + +
+ + + +
+
+
+ + +
+ + {{ __('Ripristina') }} + + + {{ __('Salva Impostazioni') }} + +
+
+ + @if ($errors->any()) +
+
    + @foreach ($errors->all() as $error) +
  • {{ $error }}
  • + @endforeach +
+
+ @endif + +
+
+
+
+
\ No newline at end of file diff --git a/resources/views/components/menu/sidebar.blade.php b/resources/views/components/menu/sidebar.blade.php index be9e69a3..a888e2bb 100644 --- a/resources/views/components/menu/sidebar.blade.php +++ b/resources/views/components/menu/sidebar.blade.php @@ -1,4 +1,4 @@ -