fix 1.2.4

This commit is contained in:
2026-06-07 23:05:48 +02:00
parent cd10d100ec
commit 4dd4da7f4b
5 changed files with 69 additions and 3 deletions
+13 -1
View File
@@ -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;
}
+2 -2
View File
@@ -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 = [
+3
View File
@@ -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`),
@@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
if (!Schema::hasColumn('eventi', 'descrizione_evento')) {
Schema::table('eventi', function (Blueprint $table) {
$table->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
{
}
};
+24
View File
@@ -177,6 +177,30 @@ $visibleColumnsJson = json_encode($visibleColumns);
</tbody>
</table>
</div>
<div class="card-footer d-flex justify-content-between align-items-center">
<div>
<form method="GET" class="form-inline" id="perPageForm">
<label class="mr-2 small">Righe per pagina:</label>
<select name="perPage" class="form-control form-control-sm" onchange="this.form.submit()" style="width: auto;">
@foreach([10, 20, 25, 50, 100] as $p)
<option value="{{ $p }}" {{ (int) request('perPage', 20) === $p ? 'selected' : '' }}>{{ $p }}</option>
@endforeach
</select>
@foreach(request()->except(['perPage', 'page']) as $key => $value)
@if(is_array($value))
@foreach($value as $v)
<input type="hidden" name="{{ $key }}[]" value="{{ $v }}">
@endforeach
@else
<input type="hidden" name="{{ $key }}" value="{{ $value }}">
@endif
@endforeach
</form>
</div>
<div>
{{ $gruppi->links() }}
</div>
</div>
@else
<div class="card-body p-0">
<div class="tree-view" style="padding: 15px;">