This commit is contained in:
salam committed 2025-10-31 15:25:16 +01:00
1 parent c64634b3a1
commit 523e395064
36 files changed
+431 -635

No files matched your search

+10 -8
View File
@@ -2,6 +2,7 @@
namespace App\Actions\Create;
use App\Models\Projekte;
use App\Models\ProjektInhaltsverzeichnis;
use App\Models\ProjektPlatzhalter;
@@ -22,15 +23,16 @@ class CreatePlatzhalter
ProjektPlatzhalter::where('projekte_id', $record->id)->update(['controll' => true]);
foreach ($_platzhalter as $platzhalter) {
$result = ProjektPlatzhalter::where('projekte_id', $record->id)->where('platzhalter', $platzhalter)->get();
if ($result->count() == 0) {
$tmp = new ProjektPlatzhalter;
$tmp->projekte_id = $record->id;
$tmp->platzhalter = $platzhalter;
$tmp->controll = false;
$tmp->save();
}
ProjektPlatzhalter::updateOrCreate(
['projekte_id' => $record->id, 'platzhalter' => $platzhalter],
['controll' => false]
);
}
ProjektPlatzhalter::where('projekte_id', $record->id)->where('controll', true)->delete();
Projekte::where('id', $record->id)->update([
'evaluation_gutachten' => false,
'pdf_nutzwerte_status' => false,
]);
}
}
@@ -12,39 +12,34 @@ class CreateProjektInhaltsverzeichnis
{
ProjektInhaltsverzeichnis::where('projekte_id', $record->id)->delete();
$inhaltsverzeichnis = Inhaltsverzeichnis::get();
$part = 1;
foreach ($inhaltsverzeichnis as $inhalt) {
$inhaltsverzeichnis = Inhaltsverzeichnis::orderBy('sort')->get();
foreach ($inhaltsverzeichnis as $key => $value) {
$key++;
$textblock = '';
if ($inhalt->textblock_id > 0) {
$textblock = Textblock::where('id', $inhalt->textblock_id)->pluck('textblock')->first();
if ($value->textblock_id > 0) {
$textblock = Textblock::where('id', $value->textblock_id)->pluck('textblock')->first();
}
if ($inhalt->tabellen_id == 5) {
$part = 2;
}
$inhalt = new ProjektInhaltsverzeichnis;
$inhalt->projekte_id = $record->id;
$inhalt->sort = $key;
$inhalt->ordnungszahl = $value->ordnungszahl;
$inhalt->name = $value->name;
$inhalt->name2 = $value->name2;
$inhalt->ueberschrift_anzeigen = $value->ueberschrift_anzeigen;
$inhalt->tabellen_id = $value->tabellen_id;
$inhalt->textblock_id = $value->textblock_id;
$inhalt->part = $value->part;
$inhalt->seite = $value->seite;
$inhalt->neue_seite = $value->neue_seite;
$inhalt->seitenzahl_anzeige = $value->seitenzahl_anzeige;
$inhalt->no_edit = $value->no_edit;
$inhalt->textblock = $textblock;
$inhalt->save();
ProjektInhaltsverzeichnis::updateOrCreate(
[
'projekte_id' => $record->id,
'name' => $inhalt->name,
],
[
'sort' => $inhalt->sort,
'ordnungszahl' => $inhalt->ordnungszahl,
'name' => $inhalt->name,
'name2' => $inhalt->name2,
'ueberschrift_anzeigen' => $inhalt->ueberschrift_anzeigen,
'tabellen_id' => $inhalt->tabellen_id,
'textblock_id' => $inhalt->textblock_id,
'part' => $part,
'seite' => $inhalt->seite,
'neue_seite' => $inhalt->neue_seite,
'seitenzahl_anzeige' => $inhalt->seitenzahl_anzeige,
'no_edit' => $inhalt->no_edit,
'textblock' => $textblock,
]);
}
}
}