re-check final

This commit is contained in:
2026-06-01 22:55:50 +02:00
parent 7bdbf4e077
commit 04ba48e87b
136 changed files with 1362 additions and 21579 deletions
+57
View File
@@ -0,0 +1,57 @@
<?php
declare(strict_types=1);
namespace App\Http\Controllers;
use App\Models\AppSetting;
use Illuminate\View\View;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
class HelpController extends Controller
{
public function index(): View
{
return view('help.index', [
'appName' => AppSetting::getAppName() ?? 'Glastree',
]);
}
public function pdf(): View
{
return view('help.pdf', [
'appName' => AppSetting::getAppName() ?? 'Glastree',
]);
}
public function downloadPdf(): BinaryFileResponse
{
$pdfPath = storage_path('app/help-guida.pdf');
if (!file_exists($pdfPath)) {
$appName = AppSetting::getAppName() ?? 'Glastree';
$html = view('help.pdf', ['appName' => $appName])->render();
$tmpHtml = tempnam(sys_get_temp_dir(), 'help_') . '.html';
file_put_contents($tmpHtml, $html);
$cmd = sprintf(
'/usr/bin/chromium --headless --no-sandbox --disable-gpu --print-to-pdf=%s %s 2>&1',
escapeshellarg($pdfPath),
escapeshellarg('file://' . $tmpHtml)
);
exec($cmd, $execOutput, $exitCode);
unlink($tmpHtml);
if ($exitCode !== 0 || !file_exists($pdfPath)) {
abort(500, 'Errore generazione PDF. Assicurati che Chromium sia installato.');
}
}
return response()->download($pdfPath, 'guida-glastree.pdf', [
'Content-Type' => 'application/pdf',
]);
}
}
+7
View File
@@ -11,6 +11,7 @@ use App\Models\Individuo;
use App\Models\EmailMessage;
use App\Models\MailingList;
use App\Models\Notifica;
use App\Services\BackupService;
use Illuminate\Support\Facades\Auth;
class HomeController extends Controller
@@ -19,9 +20,15 @@ class HomeController extends Controller
{
$user = Auth::user();
$backupsCount = 0;
if ($user->canManage('settings')) {
$backupsCount = count(app(BackupService::class)->list());
}
$stats = [
'individui' => Individuo::count(),
'gruppi' => Gruppo::count(),
'backups' => $backupsCount,
'notifiche' => $user->unreadNotificheCount(),
'documenti' => Documento::count(),
'eventi' => Evento::count(),