From 4dd4da7f4bef9674c66026996a0526bcabad5ca5 Mon Sep 17 00:00:00 2001 From: Inext68 Date: Sun, 7 Jun 2026 23:05:48 +0200 Subject: [PATCH] fix 1.2.4 --- app/Http/Controllers/GruppoController.php | 14 +++++++++- app/Models/VistaReport.php | 4 +-- database/install.sql | 3 +++ ...crizione_evento_and_incontro_to_eventi.php | 27 +++++++++++++++++++ resources/views/gruppi/index.blade.php | 24 +++++++++++++++++ 5 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 database/migrations/2026_06_07_000001_add_descrizione_evento_and_incontro_to_eventi.php diff --git a/app/Http/Controllers/GruppoController.php b/app/Http/Controllers/GruppoController.php index 3c969448..c6af63ec 100644 --- a/app/Http/Controllers/GruppoController.php +++ b/app/Http/Controllers/GruppoController.php @@ -8,6 +8,8 @@ use App\Models\Gruppo; use App\Models\Individuo; use App\Models\Diocesi; use Illuminate\Http\Request; +use Illuminate\Pagination\LengthAwarePaginator; +use Illuminate\Pagination\Paginator; use Illuminate\Support\Facades\Log; class GruppoController extends Controller @@ -17,6 +19,7 @@ class GruppoController extends Controller $this->authorizeRead('gruppi'); $viewMode = request('view', 'table'); + $perPage = in_array((int) request('perPage'), [10, 20, 25, 50, 100]) ? (int) request('perPage') : 20; $user = auth()->user(); $vista = \App\Models\VistaReport::where('user_id', $user->id) @@ -48,7 +51,16 @@ class GruppoController extends Controller }); if ($viewMode === 'table') { - $gruppi = $this->sortGruppiHierarchically($allGruppi); + $sorted = $this->sortGruppiHierarchically($allGruppi); + $page = Paginator::resolveCurrentPage(); + $gruppi = new LengthAwarePaginator( + $sorted->forPage($page, $perPage)->values(), + $sorted->count(), + $perPage, + $page, + ['path' => Paginator::resolveCurrentPath()] + ); + $gruppi->appends(request()->except('page')); } else { $gruppi = $allGruppi; } diff --git a/app/Models/VistaReport.php b/app/Models/VistaReport.php index 1a17df67..5b15fd7e 100644 --- a/app/Models/VistaReport.php +++ b/app/Models/VistaReport.php @@ -9,8 +9,8 @@ class VistaReport extends Model { protected $table = 'viste_report'; protected $fillable = [ - 'user_id', 'nome', 'tipo', 'colonne_visibili', - 'colonne_ordinamento', 'filtri', 'ricerca' + 'user_id', 'nome', 'tipo', 'colonne_visibili', + 'colonne_ordinamento', 'filtri', 'ricerca', 'is_default' ]; protected $casts = [ diff --git a/database/install.sql b/database/install.sql index f576a60f..6966f43f 100644 --- a/database/install.sql +++ b/database/install.sql @@ -197,6 +197,7 @@ CREATE TABLE `gruppo_individuo` ( `gruppo_id` bigint unsigned NOT NULL, `individuo_id` bigint unsigned NOT NULL, `ruolo_ids` json DEFAULT NULL, + `ruolo_nel_gruppo` varchar(255) DEFAULT NULL, `data_adesione` date DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, @@ -511,6 +512,7 @@ CREATE TABLE `eventi` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT, `tenant_id` bigint unsigned DEFAULT NULL, `nome_evento` varchar(255) NOT NULL, + `descrizione_evento` text, `tipo_evento` varchar(255) DEFAULT NULL, `tipo_recorrenza` enum('singolo','settimanale','mensile','annuale','altro') DEFAULT 'singolo', `giorno_settimana` tinyint unsigned DEFAULT NULL, @@ -526,6 +528,7 @@ CREATE TABLE `eventi` ( `luogo_indirizzo` varchar(500) DEFAULT NULL, `luogo_url_maps` text, `uid_esterno` varchar(500) DEFAULT NULL, + `is_incontro_gruppo` tinyint(1) NOT NULL DEFAULT '0', `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), diff --git a/database/migrations/2026_06_07_000001_add_descrizione_evento_and_incontro_to_eventi.php b/database/migrations/2026_06_07_000001_add_descrizione_evento_and_incontro_to_eventi.php new file mode 100644 index 00000000..0d5ebe57 --- /dev/null +++ b/database/migrations/2026_06_07_000001_add_descrizione_evento_and_incontro_to_eventi.php @@ -0,0 +1,27 @@ +text('descrizione_evento')->nullable()->after('nome_evento'); + }); + } + + if (!Schema::hasColumn('eventi', 'is_incontro_gruppo')) { + Schema::table('eventi', function (Blueprint $table) { + $table->boolean('is_incontro_gruppo')->default(false)->after('uid_esterno'); + }); + } + } + + public function down(): void + { + } +}; diff --git a/resources/views/gruppi/index.blade.php b/resources/views/gruppi/index.blade.php index 291f50af..e4954569 100644 --- a/resources/views/gruppi/index.blade.php +++ b/resources/views/gruppi/index.blade.php @@ -177,6 +177,30 @@ $visibleColumnsJson = json_encode($visibleColumns); + @else