This commit is contained in:
salam committed 2026-05-18 16:24:30 +02:00
1 parent 04e8abb55f
commit d95452bc9d
5 files changed
+123 -78

No files matched your search

@@ -15,10 +15,12 @@ class Nutzwertberechnung
$objekte = LadeProjekt::project($projekte_id, false);
$html = '';
foreach ($objekte as $methoden) {
// dd($objekte);
$html .= '<table autosize="1" style="page-break-inside:avoid;">';
$html = '';
foreach ($objekte as $topnr => $methoden) {
$html .= '<table autosize="1">';
$html .= '<thead><tr>';
$html .= '<th class="bl bt bg-user-set">Top Nr.</th>';
$html .= '<th class="bt bb bg-user-set">Geschoß</th>';
@@ -38,7 +40,8 @@ class Nutzwertberechnung
$flaeche = 0;
foreach ($methoden[1] as $komponente) {
$html .= '<tr>';
$html .= Html::td($komponente['top_nummer'], 'bl bg-user-set');
// $html .= Html::td($komponente['top_nummer'], 'bl bg-user-set');
$html .= Html::td($topnr, 'bl bg-user-set');
$html .= Html::td($komponente['geschoss'], 'bl');
$html .= Html::td($komponente['orientierung'], 'bl');
$html .= Html::td($komponente['type'], 'bl');
@@ -47,6 +50,7 @@ class Nutzwertberechnung
$html .= Html::td('', 'bl br', 7);
$flaeche += $komponente['flaeche'];
$html .= '</tr>';
$topnr = '';
}
$faktor = (100 + $komponente['objekt_nutzwert']) / 100;
@@ -88,6 +88,43 @@ class GutachtenValidation
}
}
/**
* 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);
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';
Notification::make()
->title($titel)
->icon('heroicon-o-exclamation-triangle')
->duration(10000)
->danger()
->body(implode('<br>', $extra_oid))
->send();
return false;
}
if ($extra_meth) {
$titel = \count($extra_meth) == 1 ? 'Für diese "Raumart" aus "Raum Methode" existiert kein "Objekte im Detail"' : 'Für diese "Raumarten" aus "Raum Methode" existieren kein "Objekte im Detail"';
Notification::make()
->title($titel)
->icon('heroicon-o-exclamation-triangle')
->duration(10000)
->danger()
->body(implode('<br>', $extra_oid))
->send();
return false;
}
/**
* ProjektObjekte + nicht_in_orientierung
*/
@@ -188,7 +188,10 @@ class ProjektObjekteImDetailRelationManager extends RelationManager
->recordActions([
EditAction::make()->iconButton()
->mutateDataUsing(function ($data, $record): array {
$data['nutzwert'] = round($record->methode->faktor * $data['flaeche']);
if (isset($record->methode->faktor)) {
$data['nutzwert'] = round($record->methode->faktor * $data['flaeche']);
}
return $data;
})->after(function (Component $livewire) {
@@ -23,8 +23,8 @@ class ProjekteForm
{
return $schema
->components([
Section::make('Projekt Daten')
->label(fn (?Projekte $record): ?string => ($record?->created_at) ? 'Erstellt: '.$record?->created_at->diffForHumans().', Geändert: '.$record?->updated_at->diffForHumans() : '')
Section::make('Projekt Details')
->label(fn (?Projekte $record): ?string => ($record?->created_at) ? 'Erstellt: '.$record?->created_at->diffForHumans().' | Geändert: '.$record?->updated_at->diffForHumans() : '')
->collapsed(fn ($operation) => $operation == 'create' ? false : true)
->icon('heroicon-o-rectangle-stack')
->schema([
@@ -66,6 +66,7 @@ class ProjekteForm
->selectablePlaceholder(false)
->options(ProjektStatus::class)
->required(),
TextInput::make('id')->disabled()->label('Interne ID'),
])->columns(2),
Tab::make('Ort & Datum')