++ fix: add pdf download visibility setting

This commit is contained in:
2026-04-16 10:37:05 +00:00
parent c85f2aaea0
commit 1534c84d45
6 changed files with 273 additions and 64 deletions

View File

@@ -25,8 +25,9 @@ class AssignmentPdfController extends Controller
]);
return view('assignments.pdf-viewer', [
'assignment' => $assignment,
'pdfUrl' => $pdfUrl,
'assignment' => $assignment,
'pdfUrl' => $pdfUrl,
'showDownload' => (bool) \App\Models\Setting::getValue('pdf_viewer_show_download', true),
]);
}

View File

@@ -13,6 +13,7 @@ class SettingsEdit extends Component
public int $giorni_per_smarrito = 120;
public int $home_limit_list = 10;
public int $assignment_link_ttl_months = 1;
public bool $pdf_viewer_show_download = true;
public int $audit_retention_days = 365;
public function mount()
@@ -24,6 +25,7 @@ class SettingsEdit extends Component
$this->giorni_per_smarrito = $settings->giorni_per_smarrito ?? 120;
$this->home_limit_list = $settings->home_limit_list ?? 10;
$this->assignment_link_ttl_months = $settings->assignment_link_ttl_hours ?? 1;
$this->pdf_viewer_show_download = $settings->pdf_viewer_show_download ?? true;
$this->audit_retention_days = $settings->audit_retention_days ?? 365;
}
@@ -36,6 +38,7 @@ class SettingsEdit extends Component
'giorni_per_smarrito' => 'required|integer|min:30|max:365',
'home_limit_list' => 'required|integer|min:1|max:100',
'assignment_link_ttl_months' => 'required|integer|min:1|max:24',
'pdf_viewer_show_download' => 'required|boolean',
'audit_retention_days' => 'required|integer|min:30|max:3650',
];
}
@@ -52,6 +55,7 @@ class SettingsEdit extends Component
'giorni_per_smarrito' => $this->giorni_per_smarrito,
'home_limit_list' => $this->home_limit_list,
'assignment_link_ttl_hours' => $this->assignment_link_ttl_months,
'pdf_viewer_show_download' => $this->pdf_viewer_show_download,
'audit_retention_days' => $this->audit_retention_days,
]);

View File

@@ -17,6 +17,7 @@ class Setting extends Model
'giorni_per_smarrito',
'home_limit_list',
'assignment_link_ttl_hours',
'pdf_viewer_show_download',
'audit_retention_days',
'setup_completed',
];
@@ -25,6 +26,7 @@ class Setting extends Model
{
return [
'setup_completed' => 'boolean',
'pdf_viewer_show_download' => 'boolean',
'giorni_giacenza_da_assegnare' => 'integer',
'giorni_giacenza_prioritari' => 'integer',
'giorni_per_smarrito' => 'integer',