wip controll and repair
This commit is contained in:
1 parent
4a509c6a16
commit
3dd1dad42f
19 files changed
+182
-91
No files matched your search
@@ -28,25 +28,26 @@ class CloneProjekt
|
|||||||
* projekt_objekte_im_details
|
* projekt_objekte_im_details
|
||||||
* projekt_objektes
|
* projekt_objektes
|
||||||
*/
|
*/
|
||||||
$news_project = $record->replicate();
|
$NEW = $record->replicate();
|
||||||
$news_project->cloned_from_id = $record->id;
|
$NEW->cloned_from_id = $record->id;
|
||||||
$news_project->save();
|
$NEW->save();
|
||||||
|
|
||||||
ProjektUser::create(['user_id' => Auth::user()->id, 'projekte_id' => $news_project->id, 'evaluation_gutachten' => 0]);
|
ProjektUser::create(['user_id' => Auth::user()->id, 'projekte_id' => $NEW->id, 'evaluation_gutachten' => 0]);
|
||||||
|
|
||||||
$res = ProjektObjekte::where('projekte_id', $record->id)->get();
|
$res = ProjektObjekte::where('projekte_id', $record->id)->get();
|
||||||
|
|
||||||
foreach ($res as $row) {
|
foreach ($res as $row) {
|
||||||
$new = $row->replicate();
|
$new = $row->replicate();
|
||||||
$new->projekte_id = $news_project->id;
|
$new->projekte_id = $NEW->id;
|
||||||
$new->projekte_cloned_from_id = $row->id;
|
$new->cloned_from_id = $row->id;
|
||||||
$new->save();
|
$new->save();
|
||||||
|
|
||||||
$res2 = ProjektObjekteImDetail::where('projekte_id', $record->id)->where('projekt_objekte_id', $row->id)->get();
|
$res2 = ProjektObjekteImDetail::where('projekte_id', $record->id)->where('projekt_objekte_id', $row->id)->get();
|
||||||
foreach ($res2 as $row2) {
|
foreach ($res2 as $row2) {
|
||||||
$new2 = $row2->replicate();
|
$new2 = $row2->replicate();
|
||||||
$new2->projekte_id = $news_project->id;
|
$new2->projekte_id = $NEW->id;
|
||||||
$new2->projekt_objekte_id = $new->id;
|
$new2->projekt_objekte_id = $new->id;
|
||||||
$new2->projekte_objekte_cloned_from_id = $row2->id;
|
$new2->cloned_from_id = $row2->id;
|
||||||
$new2->save();
|
$new2->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,37 +55,40 @@ class CloneProjekt
|
|||||||
$res = ProjektAllgemeinflaechen::where('projekte_id', $record->id)->get();
|
$res = ProjektAllgemeinflaechen::where('projekte_id', $record->id)->get();
|
||||||
foreach ($res as $row) {
|
foreach ($res as $row) {
|
||||||
$new = $row->replicate();
|
$new = $row->replicate();
|
||||||
$new->projekte_id = $news_project->id;
|
$new->projekte_id = $NEW->id;
|
||||||
|
$new->cloned_from_id = $row->id;
|
||||||
$new->save();
|
$new->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = ProjektInhaltsverzeichnis::where('projekte_id', $record->id)->get();
|
$res = ProjektInhaltsverzeichnis::where('projekte_id', $record->id)->get();
|
||||||
foreach ($res as $row) {
|
foreach ($res as $row) {
|
||||||
$new = $row->replicate();
|
$new = $row->replicate();
|
||||||
$new->projekte_id = $news_project->id;
|
$new->projekte_id = $NEW->id;
|
||||||
$new->save();
|
$new->cloned_from_id = $row->id;
|
||||||
}
|
|
||||||
$res = ProjektPlatzhalter::where('projekte_id', $record->id)->get();
|
|
||||||
foreach ($res as $row) {
|
|
||||||
$new = $row->replicate();
|
|
||||||
$new->projekte_id = $news_project->id;
|
|
||||||
$new->save();
|
$new->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = ProjektMerkmale::where('projekte_id', $record->id)->get();
|
$res = ProjektMerkmale::where('projekte_id', $record->id)->get();
|
||||||
foreach ($res as $row) {
|
foreach ($res as $row) {
|
||||||
$new = $row->replicate();
|
$new = $row->replicate();
|
||||||
$new->projekte_id = $news_project->id;
|
$new->projekte_id = $NEW->id;
|
||||||
|
$new->cloned_from_id = $row->id;
|
||||||
$new->save();
|
$new->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = ProjektMethode::where('projekte_id', $record->id)->get();
|
$res = ProjektMethode::where('projekte_id', $record->id)->get();
|
||||||
foreach ($res as $row) {
|
foreach ($res as $row) {
|
||||||
$new = $row->replicate();
|
$new = $row->replicate();
|
||||||
$new->projekte_id = $news_project->id;
|
$new->projekte_id = $NEW->id;
|
||||||
|
$new->cloned_from_id = $row->id;
|
||||||
$new->save();
|
$new->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = ProjektPlatzhalter::where('projekte_id', $record->id)->get();
|
$res = ProjektPlatzhalter::where('projekte_id', $record->id)->get();
|
||||||
foreach ($res as $row) {
|
foreach ($res as $row) {
|
||||||
$new = $row->replicate();
|
$new = $row->replicate();
|
||||||
$new->projekte_id = $news_project->id;
|
$new->projekte_id = $NEW->id;
|
||||||
|
$new->cloned_from_id = $row->id;
|
||||||
$new->save();
|
$new->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ use App\Models\ProjektMethode;
|
|||||||
use App\Models\ProjektObjekte;
|
use App\Models\ProjektObjekte;
|
||||||
use App\Models\ProjektObjekteImDetail;
|
use App\Models\ProjektObjekteImDetail;
|
||||||
use App\Models\ProjektPlatzhalter;
|
use App\Models\ProjektPlatzhalter;
|
||||||
|
use Filament\Notifications\Notification;
|
||||||
|
|
||||||
class Reparieren
|
class Reparieren
|
||||||
{
|
{
|
||||||
@@ -26,79 +27,130 @@ class Reparieren
|
|||||||
* projekt_objekte_im_details
|
* projekt_objekte_im_details
|
||||||
* projekt_objektes
|
* projekt_objektes
|
||||||
*/
|
*/
|
||||||
$ORIGINAL = $record->cloned_from_id;
|
$CLONED_FROM_ID = $record->cloned_from_id;
|
||||||
$GEKLONT = $record->id;
|
$ACTIVE_ID = $record->id;
|
||||||
|
|
||||||
if($ORIGINAL){
|
/**
|
||||||
// überprüfe geklontes Projekt!
|
* Ist geklonet
|
||||||
$originals = ProjektObjekte::where('projekte_id', $ORIGINAL)->get();
|
*/
|
||||||
|
if($CLONED_FROM_ID){
|
||||||
|
|
||||||
|
// Lösche alle geklonten "Objekte" ohne Verbindung zu Original
|
||||||
|
ProjektObjekte::where('projekte_id', $ACTIVE_ID)->where('cloned_from_id', 0)->where('added_manuel', 0)->delete();
|
||||||
|
|
||||||
|
// Überprüfe geklontes Projekt
|
||||||
|
$originals = ProjektObjekte::where('projekte_id', $CLONED_FROM_ID)->get();
|
||||||
foreach ($originals as $original) {
|
foreach ($originals as $original) {
|
||||||
$check = ProjektObjekte::where('projekte_id', $GEKLONT)->where('top_nummer', $original->top_nummer)->get();
|
$check = ProjektObjekte::where('projekte_id', $ACTIVE_ID)->where('cloned_from_id', $original->id)->get();
|
||||||
dd($check);
|
|
||||||
if (! $check) {
|
if (! $check) {
|
||||||
/**
|
/**
|
||||||
* Im original dazugekommen
|
* Im Original dazugekommen oder gelöscht
|
||||||
*/
|
*/
|
||||||
$new = $original->replicate();
|
$new = $original->replicate();
|
||||||
$new->projekte_id = $GEKLONT;
|
$new->projekte_id = $ACTIVE_ID;
|
||||||
|
$new->cloned_from_id = $CLONED_FROM_ID;
|
||||||
$new->save();
|
$new->save();
|
||||||
|
|
||||||
$res2 = ProjektObjekteImDetail::where('projekte_id', $ORIGINAL)->where('projekt_objekte_id', $original->id)->get();
|
// Lösche alle geklonten "Objekte im Detail" ohne Verbindung zu Original
|
||||||
|
ProjektObjekteImDetail::where('projekte_id', $ACTIVE_ID)->where('cloned_from_id', 0)->where('added_manuel', 0)->delete();
|
||||||
|
|
||||||
|
$res2 = ProjektObjekteImDetail::where('projekte_id', $CLONED_FROM_ID)->where('projekt_objekte_id', $original->id)->get();
|
||||||
foreach ($res2 as $row2) {
|
foreach ($res2 as $row2) {
|
||||||
$check = ProjektObjekteImDetail::where('projekte_id', $GEKLONT)->where('raumart', $row2->raumart)->first();
|
$check = ProjektObjekteImDetail::where('projekte_id', $ACTIVE_ID)->where('raumart', $row2->raumart)->first();
|
||||||
if (! $check) {
|
if (! $check) {
|
||||||
$new2 = $row2->replicate();
|
$new2 = $row2->replicate();
|
||||||
$new2->projekte_id = $GEKLONT;
|
$new2->projekte_id = $ACTIVE_ID;
|
||||||
$new2->projekt_objekte_id = $new->id;
|
$new2->projekt_objekte_id = $new->id;
|
||||||
|
$new2->cloned_from_id = $row2->id;
|
||||||
$new2->save();
|
$new2->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProjektAllgemeinflaechen::where('projekte_id', $ACTIVE_ID)->where('cloned_from_id', 0)->where('added_manuel', 0)->delete();
|
||||||
|
$res = ProjektAllgemeinflaechen::where('projekte_id', $CLONED_FROM_ID)->get();
|
||||||
|
foreach ($res as $row) {
|
||||||
|
$check = ProjektAllgemeinflaechen::where('projekte_id', $ACTIVE_ID)->where('raumart', $original->raumart)->first();
|
||||||
|
if (! $check) {
|
||||||
|
$new = $row->replicate();
|
||||||
|
$new->projekte_id = $ACTIVE_ID;
|
||||||
|
$new->cloned_from_id = $row->id;
|
||||||
|
$new->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ProjektInhaltsverzeichnis::where('projekte_id', $ACTIVE_ID)->where('cloned_from_id', 0)->where('added_manuel', 0)->delete();
|
||||||
|
$res = ProjektInhaltsverzeichnis::where('projekte_id', $CLONED_FROM_ID)->get();
|
||||||
|
foreach ($res as $row) {
|
||||||
|
$check = ProjektInhaltsverzeichnis::where('projekte_id', $ACTIVE_ID)->where('inhaltsverzeichnis_id', $original->inhaltsverzeichnis_id)->first();
|
||||||
|
if (! $check) {
|
||||||
|
$new = $row->replicate();
|
||||||
|
$new->projekte_id = $ACTIVE_ID;
|
||||||
|
$new->cloned_from_id = $row->id;
|
||||||
|
$new->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ProjektMerkmale::where('projekte_id', $ACTIVE_ID)->where('cloned_from_id', 0)->where('added_manuel', 0)->delete();
|
||||||
|
$res = ProjektMerkmale::where('projekte_id', $record->id)->get();
|
||||||
|
foreach ($res as $row) {
|
||||||
|
$check = ProjektInhaltsverzeichnis::where('projekte_id', $ACTIVE_ID)->where('name', $original->name)->first();
|
||||||
|
if (! $check) {
|
||||||
|
$new = $row->replicate();
|
||||||
|
$new->projekte_id = $ACTIVE_ID;
|
||||||
|
$new->cloned_from_id = $row->id;
|
||||||
|
$new->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$res = ProjektMethode::where('projekte_id', $record->id)->get();
|
||||||
|
foreach ($res as $row) {
|
||||||
|
$new = $row->replicate();
|
||||||
|
$new->projekte_id = $record->id;
|
||||||
|
$new->cloned_from_id = $row->id;
|
||||||
|
$new->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
$res = ProjektPlatzhalter::where('projekte_id', $record->id)->get();
|
||||||
|
foreach ($res as $row) {
|
||||||
|
$new = $row->replicate();
|
||||||
|
$new->projekte_id = $record->id;
|
||||||
|
$new->cloned_from_id = $row->id;
|
||||||
|
$new->save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// $res = ProjektAllgemeinflaechen::where('projekte_id', $original_id)->get();
|
// OBJEKTE IM DETAIL ZU OBJEKTE
|
||||||
// foreach ($res as $row) {
|
// Kontrolliere Verbindungen geklonter und nicht geklonter
|
||||||
// $check = ProjektInhaltsverzeichnis::where('projekte_id', $original_id)->where('raumart', $original->raumart)->first();
|
// Select all childreen from project
|
||||||
// if (! $check) {
|
$res = ProjektObjekteImDetail::select('projekt_objekte_id')->where('projekte_id', $ACTIVE_ID)->groupBy('projekt_objekte_id')->get();
|
||||||
// $new = $row->replicate();
|
foreach ($res as $row) {
|
||||||
// $new->projekte_id = $record->id;
|
// See if parent exists
|
||||||
// $new->save();
|
$res2 = ProjektObjekte::where('projekte_id', $ACTIVE_ID)->where('id', $row->projekt_objekte_id)->first();
|
||||||
// }
|
if(!$res){
|
||||||
// }
|
// If parent NOT exists delete all childreen
|
||||||
|
ProjektObjekteImDetail::where('projekte_id', $ACTIVE_ID)->where('projekt_objekte_id', $row->projekt_objekte_id)->delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// OBJEKTE ZU OBJEKTE IM DETAIL
|
||||||
|
$res = ProjektObjekte::where('projekte_id', $ACTIVE_ID)->get();
|
||||||
|
foreach ($res as $row) {
|
||||||
|
// See if cildreen exists
|
||||||
|
$res2 = ProjektObjekteImDetail::where('projekte_id', $ACTIVE_ID)->where('projekt_objekte_id', $row->id)->first();
|
||||||
|
if(!$res){
|
||||||
|
// If childree NOT exists delete parent
|
||||||
|
ProjektObjekte::where('id', $row->id)->delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Notification::make()
|
||||||
|
->title('Projekt reparieren')
|
||||||
|
->body('Die Reparatur des Projektes war erfolgreich.')
|
||||||
|
->icon('heroicon-o-exclamation-triangle')
|
||||||
|
->duration(10000)
|
||||||
|
->success()
|
||||||
|
->send();
|
||||||
|
|
||||||
// $res = ProjektInhaltsverzeichnis::where('projekte_id', $original_id)->get();
|
|
||||||
// foreach ($res as $row) {
|
|
||||||
// $check = ProjektInhaltsverzeichnis::where('projekte_id', $original_id)->where('top_nummer', $original->top_nummer)->first();
|
|
||||||
// if (! $check) {
|
|
||||||
// $new = $row->replicate();
|
|
||||||
// $new->projekte_id = $record->id;
|
|
||||||
// $new->save();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// $res = ProjektPlatzhalter::where('projekte_id', $record->id)->get();
|
|
||||||
// foreach ($res as $row) {
|
|
||||||
// $new = $row->replicate();
|
|
||||||
// $new->projekte_id = $record->id;
|
|
||||||
// $new->save();
|
|
||||||
// }
|
|
||||||
// $res = ProjektMerkmale::where('projekte_id', $record->id)->get();
|
|
||||||
// foreach ($res as $row) {
|
|
||||||
// $new = $row->replicate();
|
|
||||||
// $new->projekte_id = $record->id;
|
|
||||||
// $new->save();
|
|
||||||
// }
|
|
||||||
// $res = ProjektMethode::where('projekte_id', $record->id)->get();
|
|
||||||
// foreach ($res as $row) {
|
|
||||||
// $new = $row->replicate();
|
|
||||||
// $new->projekte_id = $record->id;
|
|
||||||
// $new->save();
|
|
||||||
// }
|
|
||||||
// $res = ProjektPlatzhalter::where('projekte_id', $record->id)->get();
|
|
||||||
// foreach ($res as $row) {
|
|
||||||
// $new = $row->replicate();
|
|
||||||
// $new->projekte_id = $record->id;
|
|
||||||
// $new->save();
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,8 +9,8 @@ use App\Models\ProjektInhaltsverzeichnis;
|
|||||||
use App\Models\ProjektMethode;
|
use App\Models\ProjektMethode;
|
||||||
use App\Models\ProjektObjekte;
|
use App\Models\ProjektObjekte;
|
||||||
use App\Models\ProjektObjekteImDetail;
|
use App\Models\ProjektObjekteImDetail;
|
||||||
// use App\Models\ProjektPlatzhalter;
|
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
class GutachtenValidation
|
class GutachtenValidation
|
||||||
{
|
{
|
||||||
@@ -24,7 +24,7 @@ class GutachtenValidation
|
|||||||
/**
|
/**
|
||||||
* Gutachter
|
* Gutachter
|
||||||
*/
|
*/
|
||||||
$res = Gutachter::where('konto_id', auth()->user()->konto_id)->where('id', $pro->gutachter_id)->first();
|
$res = Gutachter::where('konto_id', Auth::user()->konto_id)->where('id', $pro->gutachter_id)->first();
|
||||||
if (! $res->digitale_signatur_stempel) {
|
if (! $res->digitale_signatur_stempel) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Gutacher')
|
->title('Gutacher')
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ class EditProjekte extends EditRecord
|
|||||||
->color('success')
|
->color('success')
|
||||||
->label('Daten reparieren')
|
->label('Daten reparieren')
|
||||||
->modalIcon('phosphor-arrow-fat-line-right-fill')
|
->modalIcon('phosphor-arrow-fat-line-right-fill')
|
||||||
->modalDescription( new HtmlString('<ol class="list-decimal"><li>Bei geklonten Projekten werden Änderungen vom originalen <u>Objekt</u> und <u>Objekt im Detail</u> übernommen.</li><li>Bei geklonten Projekten werden gelöschte <u>Objekt</u> und <u>Objekt im Detail</u> ergänzt.</li><li><u>Objekt im Detail</u> ohne Verbindung zum <u>Objekt</u> werden gelöscht.</li><li>Doppelte <u>Objekt</u> oder <u>Objekt im Detail</u> werden gelöscht.</li></ol>'))
|
->modalDescription( self::reparierenText())
|
||||||
// ->hidden(fn ($record): bool => ! $record->cloned_from_id)
|
// ->hidden(fn ($record): bool => ! $record->cloned_from_id)
|
||||||
->action(fn ($record) => Reparieren::run($record))
|
->action(fn ($record) => Reparieren::run($record))
|
||||||
->icon('phosphor-arrow-fat-line-right-fill'),
|
->icon('phosphor-arrow-fat-line-right-fill'),
|
||||||
@@ -173,4 +173,23 @@ class EditProjekte extends EditRecord
|
|||||||
{
|
{
|
||||||
return 'Projekt Änderungen gespeichert';
|
return 'Projekt Änderungen gespeichert';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function reparierenText(): ?HtmlString
|
||||||
|
{
|
||||||
|
$txt = '<div class="font-bold">Geklonte Projekte</div>';
|
||||||
|
$txt .= '<ol class="list-decimal">';
|
||||||
|
$txt .= '<li>Es werden Änderungen vom originalen <u>Objekt</u> und <u>Objekt im Detail</u> übernommen.</li>';
|
||||||
|
$txt .= '<li>Es werden gelöschte <u>Objekt</u> und <u>Objekt im Detail</u> ergänzt.</li>';
|
||||||
|
$txt .= '<li>Elemente ohne Verbindung zum Originale werden gelöscht.</li>';
|
||||||
|
$txt .= '</ol>';
|
||||||
|
$txt .= '<div class="font-bold">Alle Projekte</div>';
|
||||||
|
$txt .= '<ol class="list-decimal">';
|
||||||
|
$txt .= '<li><u>Objekt</u> ohne verbundene <u>Objekt im Detail</u> werden gelöscht.</li>';
|
||||||
|
$txt .= '<li><u>Objekt im Detail</u> ohne Verbindung zu einem <u>Objekt</u> werden gelöscht.</li>';
|
||||||
|
$txt .= '<li>Manuell hinzugefügte Elemente werden nicht gelöscht.</li>';
|
||||||
|
// $txt .= '<li>Doppelte <u>Objekt</u> oder <u>Objekt im Detail</u> werden gelöscht.</li>';
|
||||||
|
$txt .= '</ol>';
|
||||||
|
|
||||||
|
return new HtmlString($txt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+2
@@ -10,6 +10,7 @@ use Filament\Actions\CreateAction;
|
|||||||
use Filament\Actions\DeleteAction;
|
use Filament\Actions\DeleteAction;
|
||||||
use Filament\Actions\DeleteBulkAction;
|
use Filament\Actions\DeleteBulkAction;
|
||||||
use Filament\Actions\EditAction;
|
use Filament\Actions\EditAction;
|
||||||
|
use Filament\Forms\Components\Hidden;
|
||||||
use Filament\Forms\Components\Textarea;
|
use Filament\Forms\Components\Textarea;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
@@ -37,6 +38,7 @@ class ProjektAllgemeinflaechensRelationManager extends RelationManager
|
|||||||
{
|
{
|
||||||
return $schema
|
return $schema
|
||||||
->components([
|
->components([
|
||||||
|
Hidden::make('added_manuel')->default(1),
|
||||||
TextInput::make('geschoss')
|
TextInput::make('geschoss')
|
||||||
->required()
|
->required()
|
||||||
->maxLength(255),
|
->maxLength(255),
|
||||||
|
|||||||
+7
-4
@@ -14,6 +14,7 @@ use Filament\Actions\DeleteAction;
|
|||||||
use Filament\Actions\DeleteBulkAction;
|
use Filament\Actions\DeleteBulkAction;
|
||||||
use Filament\Actions\EditAction;
|
use Filament\Actions\EditAction;
|
||||||
use Filament\Forms\Components\Checkbox;
|
use Filament\Forms\Components\Checkbox;
|
||||||
|
use Filament\Forms\Components\Hidden;
|
||||||
use Filament\Forms\Components\RichEditor;
|
use Filament\Forms\Components\RichEditor;
|
||||||
use Filament\Forms\Components\RichEditor\RichContentRenderer;
|
use Filament\Forms\Components\RichEditor\RichContentRenderer;
|
||||||
use Filament\Forms\Components\Select;
|
use Filament\Forms\Components\Select;
|
||||||
@@ -32,6 +33,7 @@ use Filament\Tables\Enums\FiltersLayout;
|
|||||||
use Filament\Tables\Filters\Filter;
|
use Filament\Tables\Filters\Filter;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
use ToneGabes\BetterOptions\Forms\Components\RadioCards;
|
use ToneGabes\BetterOptions\Forms\Components\RadioCards;
|
||||||
use ToneGabes\Filament\Icons\Enums\Phosphor;
|
use ToneGabes\Filament\Icons\Enums\Phosphor;
|
||||||
|
|
||||||
@@ -53,6 +55,7 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
|
|||||||
->components([
|
->components([
|
||||||
Tabs::make('Tabs')
|
Tabs::make('Tabs')
|
||||||
->tabs([
|
->tabs([
|
||||||
|
Hidden::make('added_manuel')->default(1),
|
||||||
Tab::make('Überschrift')
|
Tab::make('Überschrift')
|
||||||
->schema([
|
->schema([
|
||||||
Checkbox::make('neue_seite')
|
Checkbox::make('neue_seite')
|
||||||
@@ -157,7 +160,7 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
|
|||||||
// $record = $mountedActions[0]->getRawData();
|
// $record = $mountedActions[0]->getRawData();
|
||||||
|
|
||||||
// $block = new KontoTextblock;
|
// $block = new KontoTextblock;
|
||||||
// $block->konto_id = auth()->user()->konto_id;
|
// $block->konto_id = Auth::user()->konto_id;
|
||||||
// $block->name = $data['name'];
|
// $block->name = $data['name'];
|
||||||
// $block->textblock = RichContentRenderer::make($record['textblock'])->toHtml();
|
// $block->textblock = RichContentRenderer::make($record['textblock'])->toHtml();
|
||||||
// $block->save();
|
// $block->save();
|
||||||
@@ -171,7 +174,7 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
|
|||||||
// Select::make('konto_textblock_id')
|
// Select::make('konto_textblock_id')
|
||||||
// ->hiddenLabel()
|
// ->hiddenLabel()
|
||||||
// ->searchable()
|
// ->searchable()
|
||||||
// ->options(KontoTextblock::where('konto_id', auth()->user()->konto_id)->pluck('name', 'id'))
|
// ->options(KontoTextblock::where('konto_id', Auth::user()->konto_id)->pluck('name', 'id'))
|
||||||
// ->belowLabel([
|
// ->belowLabel([
|
||||||
// 'Bitte eine Vorlage auswählen',
|
// 'Bitte eine Vorlage auswählen',
|
||||||
// ]),
|
// ]),
|
||||||
@@ -270,7 +273,7 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
|
|||||||
$record = $mountedActions[0]->getRawData();
|
$record = $mountedActions[0]->getRawData();
|
||||||
|
|
||||||
$block = new KontoTextblock;
|
$block = new KontoTextblock;
|
||||||
$block->konto_id = auth()->user()->konto_id;
|
$block->konto_id = Auth::user()->konto_id;
|
||||||
$block->name = $data['name'];
|
$block->name = $data['name'];
|
||||||
$block->textblock = RichContentRenderer::make($record['textblock'])->toHtml();
|
$block->textblock = RichContentRenderer::make($record['textblock'])->toHtml();
|
||||||
$block->save();
|
$block->save();
|
||||||
@@ -284,7 +287,7 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
|
|||||||
Select::make('konto_textblock_id')
|
Select::make('konto_textblock_id')
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->searchable()
|
->searchable()
|
||||||
->options(KontoTextblock::where('konto_id', auth()->user()->konto_id)->pluck('name', 'id'))
|
->options(KontoTextblock::where('konto_id', Auth::user()->konto_id)->pluck('name', 'id'))
|
||||||
->belowLabel([
|
->belowLabel([
|
||||||
'Bitte eine Vorlage auswählen',
|
'Bitte eine Vorlage auswählen',
|
||||||
]),
|
]),
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ use Filament\Actions\BulkAction;
|
|||||||
use Filament\Actions\BulkActionGroup;
|
use Filament\Actions\BulkActionGroup;
|
||||||
use Filament\Actions\DeleteAction;
|
use Filament\Actions\DeleteAction;
|
||||||
use Filament\Actions\EditAction;
|
use Filament\Actions\EditAction;
|
||||||
|
use Filament\Forms\Components\Hidden;
|
||||||
use Filament\Forms\Components\Select;
|
use Filament\Forms\Components\Select;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
|
|||||||
+2
@@ -4,6 +4,7 @@ namespace App\Filament\Resources\Projektes\RelationManagers;
|
|||||||
|
|
||||||
use App\Actions\Create\CreatePlatzhalter;
|
use App\Actions\Create\CreatePlatzhalter;
|
||||||
use Filament\Actions\Action;
|
use Filament\Actions\Action;
|
||||||
|
use Filament\Forms\Components\Hidden;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Resources\RelationManagers\RelationManager;
|
use Filament\Resources\RelationManagers\RelationManager;
|
||||||
use Filament\Schemas\Schema;
|
use Filament\Schemas\Schema;
|
||||||
@@ -27,6 +28,7 @@ class ProjektPlatzhalterRelationManager extends RelationManager
|
|||||||
{
|
{
|
||||||
return $schema
|
return $schema
|
||||||
->components([
|
->components([
|
||||||
|
Hidden::make('added_manuel')->default(1),
|
||||||
TextInput::make('platzhalter')
|
TextInput::make('platzhalter')
|
||||||
->required()
|
->required()
|
||||||
->maxLength(255),
|
->maxLength(255),
|
||||||
|
|||||||
@@ -29,12 +29,12 @@ class ProjektesTable
|
|||||||
->columns([
|
->columns([
|
||||||
TextColumn::make('id')->sortable(),
|
TextColumn::make('id')->sortable(),
|
||||||
ToggleColumn::make('meine')
|
ToggleColumn::make('meine')
|
||||||
->state(fn ($record) => ProjektUser::where('user_id', auth()->user()->id)->where('projekte_id', $record->id)->count())
|
->state(fn ($record) => ProjektUser::where('user_id', Auth::user()->id)->where('projekte_id', $record->id)->count())
|
||||||
->beforeStateUpdated(function ($record, $state) {
|
->beforeStateUpdated(function ($record, $state) {
|
||||||
if ($state) {
|
if ($state) {
|
||||||
ProjektUser::create(['user_id' => auth()->user()->id, 'projekte_id' => $record->id]);
|
ProjektUser::create(['user_id' => Auth::user()->id, 'projekte_id' => $record->id]);
|
||||||
} else {
|
} else {
|
||||||
ProjektUser::where('user_id', auth()->user()->id)->where('projekte_id', $record->id)->delete();
|
ProjektUser::where('user_id', Auth::user()->id)->where('projekte_id', $record->id)->delete();
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
TextColumn::make('interner_name')
|
TextColumn::make('interner_name')
|
||||||
@@ -71,7 +71,7 @@ class ProjektesTable
|
|||||||
$data['meine'],
|
$data['meine'],
|
||||||
function (Builder $query, $meine) {
|
function (Builder $query, $meine) {
|
||||||
$query->whereHas('projekt_users', function ($query) {
|
$query->whereHas('projekt_users', function ($query) {
|
||||||
$query->where('projekt_users.user_id', auth()->user()->id);
|
$query->where('projekt_users.user_id', Auth::user()->id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class ProjektObjekte extends Model
|
|||||||
{
|
{
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'projekte_id',
|
'projekte_id',
|
||||||
'projekte_cloned_from_id',
|
'cloned_from_id',
|
||||||
'orientierung_id',
|
'orientierung_id',
|
||||||
'nicht_in_orientierung',
|
'nicht_in_orientierung',
|
||||||
'top_nummer',
|
'top_nummer',
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class ProjektObjekteImDetail extends Model
|
|||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'projekte_id',
|
'projekte_id',
|
||||||
'projekt_objekte_id',
|
'projekt_objekte_id',
|
||||||
'projekte_objekte_cloned_from_id',
|
'cloned_from_id',
|
||||||
'methode_id',
|
'methode_id',
|
||||||
'top_nummer',
|
'top_nummer',
|
||||||
'geschoss',
|
'geschoss',
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
Schema::create('projektes', function (Blueprint $table) {
|
Schema::create('projektes', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
|
$table->integer('cloned_from_id')->default(0)->nullable();
|
||||||
$table->foreignId('konto_id')->constrained();
|
$table->foreignId('konto_id')->constrained();
|
||||||
$table->foreignId('auftraggeber_id')->constrained();
|
$table->foreignId('auftraggeber_id')->constrained();
|
||||||
$table->foreignId('gutachter_id')->constrained();
|
$table->foreignId('gutachter_id')->constrained();
|
||||||
$table->integer('cloned_from_id')->default(0);
|
|
||||||
$table->string('interner_name');
|
$table->string('interner_name');
|
||||||
$table->string('offizieller_name')->nullable();
|
$table->string('offizieller_name')->nullable();
|
||||||
$table->string('ort')->nullable();
|
$table->string('ort')->nullable();
|
||||||
|
|||||||
+2
@@ -14,6 +14,8 @@ return new class extends Migration
|
|||||||
Schema::create('projekt_allgemeinflaechens', function (Blueprint $table) {
|
Schema::create('projekt_allgemeinflaechens', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->foreignId('projekte_id')->constrained()->cascadeOnDelete();
|
$table->foreignId('projekte_id')->constrained()->cascadeOnDelete();
|
||||||
|
$table->integer('cloned_from_id')->default(0)->nullable();
|
||||||
|
$table->boolean('added_manuel')->default(0)->nullable();
|
||||||
$table->string('geschoss')->nullable();
|
$table->string('geschoss')->nullable();
|
||||||
$table->string('raumart')->nullable();
|
$table->string('raumart')->nullable();
|
||||||
$table->decimal('flaeche', 7, 2)->default(0);
|
$table->decimal('flaeche', 7, 2)->default(0);
|
||||||
@@ -14,13 +14,13 @@ return new class extends Migration
|
|||||||
Schema::create('projekt_objektes', function (Blueprint $table) {
|
Schema::create('projekt_objektes', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->foreignId('projekte_id')->constrained()->cascadeOnDelete();
|
$table->foreignId('projekte_id')->constrained()->cascadeOnDelete();
|
||||||
$table->integer('projekte_cloned_from_id')->default(0);
|
$table->integer('cloned_from_id')->default(0)->nullable();
|
||||||
|
$table->boolean('added_manuel')->default(0)->nullable();
|
||||||
$table->integer('orientierung_id')->nullable()->default(0);
|
$table->integer('orientierung_id')->nullable()->default(0);
|
||||||
$table->boolean('nicht_in_orientierung')->default(0);
|
$table->boolean('nicht_in_orientierung')->default(0);
|
||||||
$table->string('top_nummer')->nullable();
|
$table->string('top_nummer')->nullable();
|
||||||
$table->string('type')->nullable();
|
$table->string('type')->nullable();
|
||||||
$table->decimal('nutzwert', 5, 2)->default(0)->nullable();
|
$table->decimal('nutzwert', 5, 2)->default(0)->nullable();
|
||||||
$table->boolean('added_manuel')->default(0)->nullable();
|
|
||||||
// 10 Zusatzfelder
|
// 10 Zusatzfelder
|
||||||
$table->decimal('a', 5, 2)->default(0);
|
$table->decimal('a', 5, 2)->default(0);
|
||||||
$table->decimal('b', 5, 2)->default(0);
|
$table->decimal('b', 5, 2)->default(0);
|
||||||
|
|||||||
@@ -14,14 +14,14 @@ return new class extends Migration
|
|||||||
Schema::create('projekt_objekte_im_details', function (Blueprint $table) {
|
Schema::create('projekt_objekte_im_details', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->foreignId('projekte_id')->constrained()->cascadeOnDelete();
|
$table->foreignId('projekte_id')->constrained()->cascadeOnDelete();
|
||||||
$table->integer('projekte_objekte_cloned_from_id')->default(0);
|
$table->integer('cloned_from_id')->default(0)->nullable();
|
||||||
|
$table->boolean('added_manuel')->default(0)->nullable();
|
||||||
$table->foreignId('projekt_objekte_id')->constrained()->cascadeOnDelete();
|
$table->foreignId('projekt_objekte_id')->constrained()->cascadeOnDelete();
|
||||||
$table->foreignId('projekt_methode_id');
|
$table->foreignId('projekt_methode_id');
|
||||||
$table->string('geschoss')->nullable();
|
$table->string('geschoss')->nullable();
|
||||||
$table->string('raumart')->nullable();
|
$table->string('raumart')->nullable();
|
||||||
$table->decimal('flaeche', 7, 2)->default(0);
|
$table->decimal('flaeche', 7, 2)->default(0);
|
||||||
$table->integer('nutzwert')->default(0)->nullable();
|
$table->integer('nutzwert')->default(0)->nullable();
|
||||||
$table->boolean('added_manuel')->default(0)->nullable();
|
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ return new class extends Migration
|
|||||||
Schema::create('projekt_methodes', function (Blueprint $table) {
|
Schema::create('projekt_methodes', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->foreignId('projekte_id')->constrained()->cascadeOnDelete();
|
$table->foreignId('projekte_id')->constrained()->cascadeOnDelete();
|
||||||
|
$table->integer('cloned_from_id')->default(0)->nullable();
|
||||||
$table->integer('methode_id')->nullable()->default(0);
|
$table->integer('methode_id')->nullable()->default(0);
|
||||||
$table->integer('aufstellung_id')->nullable()->default(0);
|
$table->integer('aufstellung_id')->nullable()->default(0);
|
||||||
$table->string('raumart')->nullable();
|
$table->string('raumart')->nullable();
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ return new class extends Migration
|
|||||||
Schema::create('projekt_merkmales', function (Blueprint $table) {
|
Schema::create('projekt_merkmales', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->foreignId('projekte_id')->constrained()->cascadeOnDelete();
|
$table->foreignId('projekte_id')->constrained()->cascadeOnDelete();
|
||||||
|
$table->integer('cloned_from_id')->default(0)->nullable();
|
||||||
|
$table->boolean('added_manuel')->default(0)->nullable();
|
||||||
$table->string('code');
|
$table->string('code');
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ return new class extends Migration
|
|||||||
Schema::create('projekt_inhaltsverzeichnis', function (Blueprint $table) {
|
Schema::create('projekt_inhaltsverzeichnis', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->foreignId('projekte_id')->constrained()->cascadeOnDelete();
|
$table->foreignId('projekte_id')->constrained()->cascadeOnDelete();
|
||||||
|
$table->integer('cloned_from_id')->default(0)->nullable();
|
||||||
|
$table->boolean('added_manuel')->default(0)->nullable();
|
||||||
$table->integer('inhaltselement_id')->default(0)->nullable();
|
$table->integer('inhaltselement_id')->default(0)->nullable();
|
||||||
$table->integer('inhaltsverzeichnis_id')->default(0)->nullable();
|
$table->integer('inhaltsverzeichnis_id')->default(0)->nullable();
|
||||||
$table->integer('textblock_id')->default(0)->nullable();
|
$table->integer('textblock_id')->default(0)->nullable();
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ return new class extends Migration
|
|||||||
Schema::create('projekt_platzhalters', function (Blueprint $table) {
|
Schema::create('projekt_platzhalters', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->foreignId('projekte_id')->constrained()->cascadeOnDelete();
|
$table->foreignId('projekte_id')->constrained()->cascadeOnDelete();
|
||||||
|
$table->integer('cloned_from_id')->default(0)->nullable();
|
||||||
$table->text('platzhalter')->nullable();
|
$table->text('platzhalter')->nullable();
|
||||||
$table->text('platzhaltertext')->nullable();
|
$table->text('platzhaltertext')->nullable();
|
||||||
$table->boolean('controll')->default(0);
|
$table->boolean('controll')->default(0);
|
||||||
|
|||||||
Reference in new issue
Block a user