wip Nutzwerte pdf

This commit is contained in:
salam committed 2025-10-23 12:07:56 +02:00
1 parent 4ad27d8c19
commit 2296b708eb
31 files changed
+528 -1656

No files matched your search

+8 -8
View File
@@ -10,10 +10,10 @@ use Illuminate\Support\Facades\Storage;
class Gutachten
{
public function download($projekts_id, $mode)
public function download($projekte_id, $mode)
{
if ($mode == 'new') {
Projekte::where('id', $projekts_id)->update(['pdf_gutachten_name' => '', 'pdf_gutachten_status' => '0']);
Projekte::where('id', $projekte_id)->update(['pdf_gutachten_name' => '', 'pdf_gutachten_status' => '0']);
}
$headers = [
@@ -23,9 +23,9 @@ class Gutachten
'Cache-Control: cache, must-revalidate',
];
$projekt = Projekte::where('id', $projekts_id)->first()->toArray();
$projekt = Projekte::where('id', $projekte_id)->first()->toArray();
$filepath = Storage::disk('public')->path("/download/$projekts_id/");
$filepath = Storage::disk('public')->path("/download/$projekte_id/");
$filename = 'Gutachten '.preg_replace("'[^0-9a-zA-Z]'", '', $projekt['interner_name']).'.pdf';
@@ -34,9 +34,9 @@ class Gutachten
}
$file = $filepath.$filename;
MakeGutachten::generate($file, $projekts_id);
MakeGutachten::generate($file, $projekte_id);
return Response::download($file, $projekt['offizieller_name'], $headers);
return Response::download($file, 'Gutachten '.$projekt['offizieller_name'], $headers);
// if ($projekt['pdf_standardtexte_ok'] == 0) {
@@ -47,9 +47,9 @@ class Gutachten
// }
// $file = $filepath.$filename;
// MakeGutachten::generate($file, $projekts_id);
// MakeGutachten::generate($file, $projekte_id);
// Projekt::where('id', $projekts_id)->update(['pdf_standardtexte' => $filename, 'pdf_standardtexte_ok' => 1]);
// Projekt::where('id', $projekte_id)->update(['pdf_standardtexte' => $filename, 'pdf_standardtexte_ok' => 1]);
// return Response::download($file, $projekt['name'], $headers);
// } else {
+38 -27
View File
@@ -2,19 +2,19 @@
namespace App\Actions\Download;
use App\Actions\Generate\GenerateNutzwerte;
use App\Models\Projekt;
use App\Actions\Generate\MakeNutzwerte;
use App\Models\Projekte;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\Storage;
class Nutzwerte
{
public function download($projekts_id, $mode)
public function download($projekte_id, $mode)
{
if ($mode == 'new') {
Projekt::where('id', $projekts_id)->update(['pdf_nutzwerte_name' => '', 'pdf_nutzwerte_status' => '0']);
Projekte::where('id', $projekte_id)->update(['pdf_nutzwerte_name' => '', 'pdf_nutzwerte_status' => '0']);
}
$headers = [
@@ -24,32 +24,43 @@ class Nutzwerte
'Cache-Control: cache, must-revalidate',
];
$projekt = Projekte::where('id', $projekts_id)->first()->toArray();
$projekt = Projekte::where('id', $projekte_id)->first()->toArray();
$filepath = Storage::disk('public')->path("/download/$projekts_id/nutzwerte/");
$filepath = Storage::disk('public')->path("/download/$projekte_id/");
if ($projekt['pdf_nutzwerte_status'] == 0) {
$filename = 'Gutachten '.preg_replace("'[^0-9a-zA-Z]'", '', $projekt['interner_name']).'.pdf';
$filename = preg_replace("'[^0-9a-zA-Z]'", '', $projekt['intname']).'.pdf';
if (! File::isDirectory($filepath)) {
File::makeDirectory($filepath, 0777, true, true);
}
$file = $filepath.$filename;
GenerateNutzwerte::generate($file, $projekts_id);
Projekt::where('id', $projekts_id)->update(['pdf_nutzwerte' => $filename, 'pdf_nutzwerte_ok' => '1']);
return Response::download($file, $projekt['name'], $headers);
} else {
$filename = $projekt['pdf_nutzwerte_name'];
$file = $filepath.$filename;
return Response::download($file, $projekt['name'], $headers);
if (! File::isDirectory($filepath)) {
File::makeDirectory($filepath, 0777, true, true);
}
$file = $filepath.$filename;
MakeNutzwerte::generate($file, $projekte_id);
return Response::download($file, 'Nutzwert '.$projekt['offizieller_name'], $headers);
// if ($projekt['pdf_nutzwerte_status'] == 0) {
// $filename = preg_replace("'[^0-9a-zA-Z]'", '', $projekt['intname']).'.pdf';
// if (! File::isDirectory($filepath)) {
// File::makeDirectory($filepath, 0777, true, true);
// }
// $file = $filepath.$filename;
// GenerateNutzwerte::generate($file, $projekte_id);
// Projekte::where('id', $projekte_id)->update(['pdf_nutzwerte' => $filename, 'pdf_nutzwerte_ok' => '1']);
// return Response::download($file, $projekt['name'], $headers);
// } else {
// $filename = $projekt['pdf_nutzwerte_name'];
// $file = $filepath.$filename;
// return Response::download($file, $projekt['name'], $headers);
// }
}
}