wip
This commit is contained in:
1 parent
16c0aa24fe
commit
4a509c6a16
16 files changed
+168
-82
No files matched your search
@@ -32,7 +32,7 @@ class CloneProjekt
|
||||
$news_project->cloned_from_id = $record->id;
|
||||
$news_project->save();
|
||||
|
||||
ProjektUser::create(['user_id' => Auth::user()->id, 'projekte_id' => $news_project->id]);
|
||||
ProjektUser::create(['user_id' => Auth::user()->id, 'projekte_id' => $news_project->id, 'evaluation_gutachten' => 0]);
|
||||
|
||||
$res = ProjektObjekte::where('projekte_id', $record->id)->get();
|
||||
foreach ($res as $row) {
|
||||
|
||||
@@ -11,9 +11,9 @@ use App\Models\ProjektObjekte;
|
||||
use App\Models\ProjektObjekteImDetail;
|
||||
use App\Models\ProjektPlatzhalter;
|
||||
|
||||
class CloneValidation
|
||||
class Reparieren
|
||||
{
|
||||
public static function validate(Projekte $record)
|
||||
public static function run(Projekte $record)
|
||||
{
|
||||
/**
|
||||
* projektes
|
||||
@@ -29,29 +29,33 @@ class CloneValidation
|
||||
$ORIGINAL = $record->cloned_from_id;
|
||||
$GEKLONT = $record->id;
|
||||
|
||||
// $originals = ProjektObjekte::where('projekte_id', $ORIGINAL)->get();
|
||||
// foreach ($originals as $original) {
|
||||
// $check = ProjektObjekte::where('projekte_id', $GEKLONT)->where('top_nummer', $original->top_nummer)->first();
|
||||
// if (! $check) {
|
||||
// /**
|
||||
// * Im original dazugekommen
|
||||
// */
|
||||
// $new = $original->replicate();
|
||||
// $new->projekte_id = $GEKLONT;
|
||||
// $new->save();
|
||||
if($ORIGINAL){
|
||||
// überprüfe geklontes Projekt!
|
||||
$originals = ProjektObjekte::where('projekte_id', $ORIGINAL)->get();
|
||||
foreach ($originals as $original) {
|
||||
$check = ProjektObjekte::where('projekte_id', $GEKLONT)->where('top_nummer', $original->top_nummer)->get();
|
||||
dd($check);
|
||||
if (! $check) {
|
||||
/**
|
||||
* Im original dazugekommen
|
||||
*/
|
||||
$new = $original->replicate();
|
||||
$new->projekte_id = $GEKLONT;
|
||||
$new->save();
|
||||
|
||||
// $res2 = ProjektObjekteImDetail::where('projekte_id', $ORIGINAL)->where('projekt_objekte_id', $original->id)->get();
|
||||
// foreach ($res2 as $row2) {
|
||||
// $check = ProjektObjekteImDetail::where('projekte_id', $GEKLONT)->where('raumart', $row2->raumart)->first();
|
||||
// if (! $check) {
|
||||
// $new2 = $row2->replicate();
|
||||
// $new2->projekte_id = $GEKLONT;
|
||||
// $new2->projekt_objekte_id = $new->id;
|
||||
// $new2->save();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
$res2 = ProjektObjekteImDetail::where('projekte_id', $ORIGINAL)->where('projekt_objekte_id', $original->id)->get();
|
||||
foreach ($res2 as $row2) {
|
||||
$check = ProjektObjekteImDetail::where('projekte_id', $GEKLONT)->where('raumart', $row2->raumart)->first();
|
||||
if (! $check) {
|
||||
$new2 = $row2->replicate();
|
||||
$new2->projekte_id = $GEKLONT;
|
||||
$new2->projekt_objekte_id = $new->id;
|
||||
$new2->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// $res = ProjektAllgemeinflaechen::where('projekte_id', $original_id)->get();
|
||||
// foreach ($res as $row) {
|
||||
@@ -19,7 +19,7 @@ use PhpOffice\PhpSpreadsheet\Style\Fill;
|
||||
|
||||
class ExcelAufstellung
|
||||
{
|
||||
public static function make($projekte_id)
|
||||
public static function make(int $projekte_id)
|
||||
{
|
||||
$black = 'ff62748e';
|
||||
$blue = 'ff2b7fff';
|
||||
|
||||
@@ -26,15 +26,15 @@ use Mpdf\Mpdf;
|
||||
|
||||
class PdfGenerator
|
||||
{
|
||||
public static $projekt;
|
||||
public static Projekte $projekt;
|
||||
|
||||
public static $gutachter;
|
||||
public static Gutachter $gutachter;
|
||||
|
||||
public static $auftraggeber;
|
||||
public static Auftraggeber $auftraggeber;
|
||||
|
||||
public static $zusammenstellung = [];
|
||||
public static array $zusammenstellung = [];
|
||||
|
||||
public static function make($projekte_id, $part)
|
||||
public static function make(int $projekte_id,string $part)
|
||||
{
|
||||
self::$projekt = Projekte::where('id', $projekte_id)->first();
|
||||
|
||||
@@ -114,6 +114,7 @@ class PdfGenerator
|
||||
$html = '';
|
||||
$html = Ueberschrift::load($inhalt);
|
||||
$textblock = '';
|
||||
$textblock2 = '';
|
||||
|
||||
if ($inhalt->textblock) {
|
||||
$textblock = Platzhalter::replace($platzhalter, $inhalt->textblock);
|
||||
|
||||
@@ -9,12 +9,12 @@ use App\Models\ProjektInhaltsverzeichnis;
|
||||
use App\Models\ProjektMethode;
|
||||
use App\Models\ProjektObjekte;
|
||||
use App\Models\ProjektObjekteImDetail;
|
||||
use App\Models\ProjektPlatzhalter;
|
||||
// use App\Models\ProjektPlatzhalter;
|
||||
use Filament\Notifications\Notification;
|
||||
|
||||
class GutachtenValidation
|
||||
{
|
||||
public static function controll($record)
|
||||
public static function run(Projekte $record)
|
||||
{
|
||||
/**
|
||||
* Projekt
|
||||
@@ -49,7 +49,7 @@ class GutachtenValidation
|
||||
->duration(10000)
|
||||
->body('Die Tabelle der <b>Allgemeinflächen</b> ist leer.')
|
||||
->send();
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
foreach ($res as $value) {
|
||||
@@ -61,7 +61,7 @@ class GutachtenValidation
|
||||
->duration(10000)
|
||||
->body('Für die Allgemeinfläche <b>'.$value->raumart.'</b> fehlt die Angabe des <u>Geschoßes</u>.')
|
||||
->send();
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
if (! $value->raumart) {
|
||||
@@ -83,21 +83,73 @@ class GutachtenValidation
|
||||
->duration(10000)
|
||||
->body('Für die Allgemeinfläche <b>'.$value->raumart.'</b> fehlt die Angabe der <u>Fläche</u>.')
|
||||
->send();
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* jedes objekt hat mindestens ein objekt im detail
|
||||
*/
|
||||
$res = ProjektObjekte::where('projekte_id', $record->id)->get();
|
||||
$collect = [];
|
||||
foreach ($res as $value) {
|
||||
$res2 = ProjektObjekteImDetail::where('projekte_id', $record->id)->where('projekt_objekte_id', $value->id)->first();
|
||||
if(!$res2){
|
||||
$collect[] = $value->top_nummer;
|
||||
}
|
||||
}
|
||||
if($collect){
|
||||
Notification::make()
|
||||
->title('Fehler bei Verbindungen von Objekt zu Objekt im Detail')
|
||||
->body('Für die <u>Objekte</u>:<div class="py-2 text-gray-500">'.implode(', ', $collect).'</div>fehlen die <u>Objekte im Detail</u>. Daten können nochmals hochladen werden.')
|
||||
->icon('heroicon-o-exclamation-triangle')
|
||||
->duration(10000)
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* jedes objekt im detail hat eine Verbindung zu einem objekt
|
||||
*/
|
||||
$res = ProjektObjekteImDetail::where('projekte_id', $record->id)->get();
|
||||
$collect=[];
|
||||
foreach ($res as $value) {
|
||||
$res2 = ProjektObjekte::where('projekte_id', $record->id)->where('id', $value->projekt_objekte_id)->first();
|
||||
if(!$res2){
|
||||
$collect[] = $value->geschoss .' '.$value->raumart;
|
||||
}
|
||||
}
|
||||
if($collect){
|
||||
Notification::make()
|
||||
->title('Fehler bei Verbindungen von Objekt im Detail zu Objekt')
|
||||
->body('Für die <u>Objekte im Detail</u>: <div class="py-2 text-gray-500">'.implode(', ', $collect).'</div>fehlt das<u>Objekte</u>. Daten können nochmals hochladen werden.')
|
||||
->icon('heroicon-o-exclamation-triangle')
|
||||
->duration(10000)
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ProjektObjekteImDetail + raumart
|
||||
* -> cosistent
|
||||
* ProjektMethode + raumart
|
||||
*/
|
||||
|
||||
|
||||
$raumarts_oid = ProjektObjekteImDetail::where('projekte_id', $record->id)->groupBy('raumart')->pluck('raumart')->toArray();
|
||||
$raumarts_meth = ProjektMethode::where('projekte_id', $record->id)->pluck('raumart')->toArray();
|
||||
|
||||
|
||||
$extra_oid = array_diff($raumarts_oid, $raumarts_meth);
|
||||
$extra_meth = array_diff($raumarts_meth, $raumarts_oid);
|
||||
|
||||
// dd($extra_oid, $raumarts_meth);
|
||||
|
||||
if ($extra_oid) {
|
||||
$titel = \count($extra_oid) == 1 ? 'Für diese "Raumart" aus "Objekte im Detail" ist keine "Raum Methode" definiert' : 'Für diese "Raumarten" aus "Objekte im Detail" sind keine "Raum Methoden" definiert';
|
||||
@@ -202,7 +254,7 @@ class GutachtenValidation
|
||||
->duration(10000)
|
||||
->body('Für den Raum mit der ID <b>'.$value->id.'</b> fehlt die Angabe der <u>Top Nummer</u>.')
|
||||
->send();
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
if (! $value->projektobjekteimdetail->first()->raumart) {
|
||||
@@ -281,7 +333,7 @@ class GutachtenValidation
|
||||
->body('Inhaltsverzeichnis fehlt!')
|
||||
->duration(10000)
|
||||
->send();
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -309,5 +361,7 @@ class GutachtenValidation
|
||||
->send();
|
||||
|
||||
Projekte::where('id', $record->id)->update(['evaluation_gutachten' => 1]);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user