action evaluation
This commit is contained in:
1 parent
d473bdc2b3
commit
9eb19cf8fd
13 files changed
+297
-132
No files matched your search
@@ -140,7 +140,7 @@ class GutachtenValidation
|
||||
}
|
||||
|
||||
/**
|
||||
* Raeumealle
|
||||
* Projekt Methode
|
||||
*/
|
||||
$res = ProjektMethode::where('projekte_id', $record->id)->get();
|
||||
if (! $res->count()) {
|
||||
@@ -232,6 +232,6 @@ class GutachtenValidation
|
||||
->body('Die Evaluierung des Projektes war erfolgreich.')
|
||||
->send();
|
||||
|
||||
Projekte::where('id', $record->id)->update(['evaluation' => 1]);
|
||||
Projekte::where('id', $record->id)->update(['evaluation_gutachten' => 1]);
|
||||
}
|
||||
}
|
||||
@@ -17,9 +17,12 @@ class EditProjekte extends EditRecord
|
||||
{
|
||||
protected static string $resource = ProjekteResource::class;
|
||||
|
||||
#[On('refreshAllgemeinflaechen')]
|
||||
#[On('refreshAllgemeinflaechen'), On('refreshRaeumealle'), On('refreshMethods'), On('refreshOrientierung')]
|
||||
public function refresh(): void {}
|
||||
|
||||
// #[On('refreshRaeumealle')]
|
||||
// public function refresh(): void {}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
@@ -63,6 +66,15 @@ class EditProjekte extends EditRecord
|
||||
/**
|
||||
* GUTACHTEN
|
||||
*/
|
||||
Action::make('evaluate_gutachten')
|
||||
->hidden(fn ($record): bool => $record->bezahlt_am && ! $record->evaluation_gutachten ? false : true)
|
||||
->color('success')
|
||||
->label('Evaluieren')
|
||||
->icon('phosphor-eye')
|
||||
->action(function ($record): void {
|
||||
GutachtenValidation::controll($record);
|
||||
$this->record->refresh();
|
||||
}),
|
||||
ActionGroup::make([
|
||||
Action::make('gutachten')
|
||||
->disabled(fn ($record): bool => ! $record->pdf_gutachten_status)
|
||||
@@ -71,36 +83,21 @@ class EditProjekte extends EditRecord
|
||||
1 => 'info',
|
||||
default => 'gray',
|
||||
})
|
||||
->label('3) Herunterladen')
|
||||
->icon('phosphor-file-pdf')
|
||||
->label('Öffnen')
|
||||
->icon('icon-pdf')
|
||||
->url(fn ($record) => route('standard.download', ['record' => $record, 'mode' => 'file']))
|
||||
->openUrlInNewTab(),
|
||||
Action::make('make_gutachten')
|
||||
->hidden(fn ($record): bool => $record->bezahlt_am ? false : true)
|
||||
->color(fn ($record): string => match ($record->evaluation) {
|
||||
->color(fn ($record): string => match ($record->evaluation_gutachten) {
|
||||
1 => 'info',
|
||||
default => 'gray',
|
||||
})
|
||||
->disabled(fn ($record): bool => $record->evaluation ? false : true)
|
||||
->label('2) Generieren')
|
||||
->icon('phosphor-math-operations')
|
||||
->disabled(fn ($record): bool => $record->evaluation_gutachten ? false : true)
|
||||
->label('Berechnen')
|
||||
->icon('phosphor-calculator')
|
||||
->url(fn ($record) => route('standard.download', ['record' => $record, 'mode' => 'new']))
|
||||
->openUrlInNewTab(),
|
||||
Action::make('evaluate_gutachten')
|
||||
->hidden(fn ($record): bool => $record->bezahlt_am ? false : true)
|
||||
->color(fn ($record): string => match ($record->evaluation) {
|
||||
1 => 'success',
|
||||
default => 'primary',
|
||||
})
|
||||
->label('1) Evaluieren')
|
||||
->icon(fn ($record): string => match ($record->evaluation) {
|
||||
1 => 'phosphor-check',
|
||||
default => 'phosphor-eye',
|
||||
})
|
||||
->action(function ($record): void {
|
||||
GutachtenValidation::controll($record);
|
||||
$this->record->refresh();
|
||||
}),
|
||||
])->label('Gutachten')
|
||||
->icon('heroicon-m-ellipsis-vertical')
|
||||
->button()
|
||||
@@ -116,13 +113,14 @@ class EditProjekte extends EditRecord
|
||||
1 => 'info',
|
||||
default => 'gray',
|
||||
})
|
||||
->label('Herunterladen')
|
||||
->icon('phosphor-file-pdf')
|
||||
->label('Öffnen')
|
||||
->icon('icon-pdf')
|
||||
->url(fn ($record) => route('nutzwerte.download', ['record' => $record, 'mode' => 'file']))
|
||||
->openUrlInNewTab(),
|
||||
Action::make('make_nutzwerte')
|
||||
->hidden(fn ($record): bool => $record->bezahlt_am ? false : true)
|
||||
->label('Neu Berechnen')
|
||||
->disabled(fn ($record): bool => $record->evaluation_gutachten ? false : true)
|
||||
->label('Berechnen')
|
||||
->icon('phosphor-calculator')
|
||||
->url(fn ($record) => route('nutzwerte.download', ['record' => $record, 'mode' => 'new']))
|
||||
->openUrlInNewTab(),
|
||||
@@ -136,12 +134,14 @@ class EditProjekte extends EditRecord
|
||||
ActionGroup::make([
|
||||
Action::make('excel-nutzflaeche-nutzwerte')
|
||||
->hidden(fn ($record): bool => $record->bezahlt_am ? false : true)
|
||||
->disabled(fn ($record): bool => $record->evaluation_gutachten ? false : true)
|
||||
->label('Nutzfläche & Nutzwerte')
|
||||
->icon('icon-excel')
|
||||
->url(fn ($record) => route('excel.download', ['record' => $record, 'mode' => 'file']))
|
||||
->openUrlInNewTab(),
|
||||
Action::make('excel-nutzflaechen-aufstellung')
|
||||
->hidden(fn ($record): bool => $record->bezahlt_am ? false : true)
|
||||
->disabled(fn ($record): bool => $record->evaluation_gutachten ? false : true)
|
||||
->label('Nutzflächen Aufstellung')
|
||||
->icon('icon-excel')
|
||||
->url(fn ($record) => route('excel.download', ['record' => $record, 'mode' => 'file']))
|
||||
|
||||
+76
-14
@@ -22,6 +22,7 @@ use Filament\Tables\Columns\TextInputColumn;
|
||||
use Filament\Tables\Filters\TernaryFilter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Livewire\Component;
|
||||
|
||||
class OrientierungZuAbschlaegesRelationManager extends RelationManager
|
||||
{
|
||||
@@ -58,7 +59,10 @@ class OrientierungZuAbschlaegesRelationManager extends RelationManager
|
||||
]),
|
||||
CheckboxColumn::make('nicht_in_orientierung')
|
||||
->label('Nicht in Orientierung')
|
||||
->toggleable(),
|
||||
->toggleable()
|
||||
->afterStateUpdated(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshOrientierung');
|
||||
}),
|
||||
TextColumn::make('raumart')
|
||||
->toggleable()
|
||||
->width('2rem')
|
||||
@@ -71,17 +75,40 @@ class OrientierungZuAbschlaegesRelationManager extends RelationManager
|
||||
->selectablePlaceholder(true)
|
||||
->options(Orientierung::pluck('name', 'id'))
|
||||
->disableOptionWhen(fn (string $value): bool => in_array($value, [2, 11, 24, 33, 36]))
|
||||
->preloadOptions(),
|
||||
TextInputColumn::make('a')->label($spalten['a'] ?? '')->hidden(isset($spalten['a']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter(),
|
||||
TextInputColumn::make('b')->label($spalten['b'] ?? '')->hidden(isset($spalten['b']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter(),
|
||||
TextInputColumn::make('c')->label($spalten['c'] ?? '')->hidden(isset($spalten['c']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter(),
|
||||
TextInputColumn::make('d')->label($spalten['d'] ?? '')->hidden(isset($spalten['d']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter(),
|
||||
TextInputColumn::make('e')->label($spalten['e'] ?? '')->hidden(isset($spalten['e']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter(),
|
||||
TextInputColumn::make('f')->label($spalten['f'] ?? '')->hidden(isset($spalten['f']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter(),
|
||||
TextInputColumn::make('g')->label($spalten['g'] ?? '')->hidden(isset($spalten['g']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter(),
|
||||
TextInputColumn::make('h')->label($spalten['h'] ?? '')->hidden(isset($spalten['h']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter(),
|
||||
TextInputColumn::make('i')->label($spalten['i'] ?? '')->hidden(isset($spalten['i']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter(),
|
||||
TextInputColumn::make('j')->label($spalten['j'] ?? '')->hidden(isset($spalten['j']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter(),
|
||||
->preloadOptions()->afterStateUpdated(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshOrientierung');
|
||||
}),
|
||||
TextInputColumn::make('a')->label($spalten['a'] ?? '')->hidden(isset($spalten['a']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter()
|
||||
->afterStateUpdated(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshOrientierung');
|
||||
}),
|
||||
TextInputColumn::make('b')->label($spalten['b'] ?? '')->hidden(isset($spalten['b']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter()->afterStateUpdated(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshOrientierung');
|
||||
}),
|
||||
TextInputColumn::make('c')->label($spalten['c'] ?? '')->hidden(isset($spalten['c']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter()->afterStateUpdated(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshOrientierung');
|
||||
}),
|
||||
TextInputColumn::make('d')->label($spalten['d'] ?? '')->hidden(isset($spalten['d']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter()->afterStateUpdated(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshOrientierung');
|
||||
}),
|
||||
TextInputColumn::make('e')->label($spalten['e'] ?? '')->hidden(isset($spalten['e']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter()->afterStateUpdated(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshOrientierung');
|
||||
}),
|
||||
TextInputColumn::make('f')->label($spalten['f'] ?? '')->hidden(isset($spalten['f']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter()->afterStateUpdated(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshOrientierung');
|
||||
}),
|
||||
TextInputColumn::make('g')->label($spalten['g'] ?? '')->hidden(isset($spalten['g']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter()->afterStateUpdated(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshOrientierung');
|
||||
}),
|
||||
TextInputColumn::make('h')->label($spalten['h'] ?? '')->hidden(isset($spalten['h']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter()->afterStateUpdated(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshOrientierung');
|
||||
}),
|
||||
TextInputColumn::make('i')->label($spalten['i'] ?? '')->hidden(isset($spalten['i']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter()->afterStateUpdated(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshOrientierung');
|
||||
}),
|
||||
TextInputColumn::make('j')->label($spalten['j'] ?? '')->hidden(isset($spalten['j']) ? false : true)->toggleable()->rules(['numeric'])->alignCenter()->afterStateUpdated(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshOrientierung');
|
||||
}),
|
||||
TextColumn::make('nutzwert')
|
||||
->extraHeaderAttributes([
|
||||
'style' => 'position: sticky; right: 0; z-index: 1;',
|
||||
@@ -108,7 +135,10 @@ class OrientierungZuAbschlaegesRelationManager extends RelationManager
|
||||
->modalHeading('Merkmale')
|
||||
->slideOver()
|
||||
// ->modalWidth(Width::Medium)
|
||||
->modalContent(view('filament.pages.actions.merkmale')),
|
||||
->modalContent(view('filament.pages.actions.merkmale'))
|
||||
->after(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshOrientierung');
|
||||
}),
|
||||
Action::make('erstellen')
|
||||
->action(fn (CreateOrientierungZuAbschlaege $createOrientierungZuAbschlaege) => $createOrientierungZuAbschlaege->create($this->ownerRecord))
|
||||
->requiresConfirmation()
|
||||
@@ -117,7 +147,10 @@ class OrientierungZuAbschlaegesRelationManager extends RelationManager
|
||||
->modalSubmitActionLabel('Erstellen')
|
||||
->label('Erstellen')
|
||||
->tooltip('Daten werden aus "Orientierung Zu/Abschläge" Tabelle gefiltert.')
|
||||
->icon('heroicon-o-cog-8-tooth'),
|
||||
->icon('heroicon-o-cog-8-tooth')
|
||||
->after(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshOrientierung');
|
||||
}),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
@@ -136,6 +169,9 @@ class OrientierungZuAbschlaegesRelationManager extends RelationManager
|
||||
['raumart' => $data['raumart']]
|
||||
);
|
||||
}
|
||||
})
|
||||
->after(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshOrientierung');
|
||||
}),
|
||||
BulkAction::make('methode')
|
||||
->color('primary')
|
||||
@@ -156,6 +192,9 @@ class OrientierungZuAbschlaegesRelationManager extends RelationManager
|
||||
['orientierung_id' => $data['methode_id']]
|
||||
);
|
||||
}
|
||||
})
|
||||
->after(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshOrientierung');
|
||||
}),
|
||||
BulkAction::make('nicht_in_orientierung')
|
||||
->color('primary')
|
||||
@@ -177,6 +216,9 @@ class OrientierungZuAbschlaegesRelationManager extends RelationManager
|
||||
['nicht_in_orientierung' => 1]
|
||||
);
|
||||
}
|
||||
})
|
||||
->after(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshOrientierung');
|
||||
}),
|
||||
BulkAction::make('a')
|
||||
->label($spalten['a'] ?? '')
|
||||
@@ -194,6 +236,8 @@ class OrientierungZuAbschlaegesRelationManager extends RelationManager
|
||||
['a' => $data['a']]
|
||||
);
|
||||
}
|
||||
})->after(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshOrientierung');
|
||||
}),
|
||||
BulkAction::make('b')
|
||||
->label($spalten['b'] ?? '')
|
||||
@@ -211,6 +255,8 @@ class OrientierungZuAbschlaegesRelationManager extends RelationManager
|
||||
['b' => $data['b']]
|
||||
);
|
||||
}
|
||||
})->after(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshOrientierung');
|
||||
}),
|
||||
BulkAction::make('c')
|
||||
->label($spalten['c'] ?? '')
|
||||
@@ -228,6 +274,8 @@ class OrientierungZuAbschlaegesRelationManager extends RelationManager
|
||||
['c' => $data['c']]
|
||||
);
|
||||
}
|
||||
})->after(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshOrientierung');
|
||||
}),
|
||||
BulkAction::make('d')
|
||||
->label($spalten['d'] ?? '')
|
||||
@@ -245,6 +293,8 @@ class OrientierungZuAbschlaegesRelationManager extends RelationManager
|
||||
['d' => $data['d']]
|
||||
);
|
||||
}
|
||||
})->after(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshOrientierung');
|
||||
}),
|
||||
BulkAction::make('e')
|
||||
->label($spalten['e'] ?? '')
|
||||
@@ -262,6 +312,8 @@ class OrientierungZuAbschlaegesRelationManager extends RelationManager
|
||||
['e' => $data['e']]
|
||||
);
|
||||
}
|
||||
})->after(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshOrientierung');
|
||||
}),
|
||||
BulkAction::make('f')
|
||||
->label($spalten['f'] ?? '')
|
||||
@@ -279,6 +331,8 @@ class OrientierungZuAbschlaegesRelationManager extends RelationManager
|
||||
['f' => $data['f']]
|
||||
);
|
||||
}
|
||||
})->after(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshOrientierung');
|
||||
}),
|
||||
BulkAction::make('g')
|
||||
->label($spalten['g'] ?? '')
|
||||
@@ -296,6 +350,8 @@ class OrientierungZuAbschlaegesRelationManager extends RelationManager
|
||||
['g' => $data['g']]
|
||||
);
|
||||
}
|
||||
})->after(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshOrientierung');
|
||||
}),
|
||||
BulkAction::make('h')
|
||||
->label($spalten['h'] ?? '')
|
||||
@@ -313,6 +369,8 @@ class OrientierungZuAbschlaegesRelationManager extends RelationManager
|
||||
['h' => $data['h']]
|
||||
);
|
||||
}
|
||||
})->after(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshOrientierung');
|
||||
}),
|
||||
BulkAction::make('i')
|
||||
->label($spalten['i'] ?? '')
|
||||
@@ -330,6 +388,8 @@ class OrientierungZuAbschlaegesRelationManager extends RelationManager
|
||||
['i' => $data['i']]
|
||||
);
|
||||
}
|
||||
})->after(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshOrientierung');
|
||||
}),
|
||||
BulkAction::make('j')
|
||||
->label($spalten['j'] ?? '')
|
||||
@@ -347,6 +407,8 @@ class OrientierungZuAbschlaegesRelationManager extends RelationManager
|
||||
['j' => $data['j']]
|
||||
);
|
||||
}
|
||||
})->after(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshOrientierung');
|
||||
}),
|
||||
]),
|
||||
]);
|
||||
|
||||
+58
-38
@@ -17,6 +17,7 @@ use Filament\Tables\Columns\TextInputColumn;
|
||||
use Filament\Tables\Filters\TernaryFilter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Livewire\Component;
|
||||
|
||||
class ProjektMethodesRelationManager extends RelationManager
|
||||
{
|
||||
@@ -39,14 +40,26 @@ class ProjektMethodesRelationManager extends RelationManager
|
||||
SelectColumn::make('methode_id')
|
||||
->selectablePlaceholder(true)
|
||||
->optionsRelationship('methode', 'name')
|
||||
->preloadOptions(),
|
||||
->preloadOptions()
|
||||
->rules(['required'])
|
||||
->afterStateUpdated(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshMethods');
|
||||
})->validationMessages([
|
||||
'required' => 'Die Eingabe eines Faktors ist erforderlich.',
|
||||
]),
|
||||
TextColumn::make('raumart')
|
||||
->searchable(),
|
||||
TextInputColumn::make('faktor')
|
||||
->suffixIcon('phosphor-function')
|
||||
->width('1rem')
|
||||
->rules(['required', 'faktor' => 'decimal:0,2'])
|
||||
->searchable(),
|
||||
->searchable()
|
||||
->afterStateUpdated(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshMethods');
|
||||
})->validationMessages([
|
||||
'required' => 'Die Eingabe eines Faktors ist erforderlich.',
|
||||
'decimal' => 'Für den Faktors sind zwei Dezimalstellen erforderlich.',
|
||||
]),
|
||||
])
|
||||
->filters([
|
||||
TernaryFilter::make('methode_id')
|
||||
@@ -61,47 +74,54 @@ class ProjektMethodesRelationManager extends RelationManager
|
||||
->modalSubmitActionLabel('Erstellen')
|
||||
->label('Erstellen')
|
||||
->tooltip('Daten werden aus "Räume Alle" Tabelle gefiltert.')
|
||||
->icon('heroicon-o-cog-8-tooth'),
|
||||
->icon('heroicon-o-cog-8-tooth')
|
||||
->after(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshMethods');
|
||||
}),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
BulkAction::make('faktor')
|
||||
->color('primary')
|
||||
->label('Faktor zuweisen')
|
||||
->schema([
|
||||
TextInput::make('faktor')
|
||||
->prefixIcon('phosphor-function')
|
||||
->numeric()
|
||||
->required(),
|
||||
])
|
||||
->icon('phosphor-function')
|
||||
->action(function (Collection $records, array $data): void {
|
||||
foreach ($records as $record) {
|
||||
ProjektMethode::where('id', '=', $record->id)
|
||||
->update(
|
||||
['faktor' => $data['faktor']]
|
||||
);
|
||||
}
|
||||
}),
|
||||
->color('primary')
|
||||
->label('Faktor zuweisen')
|
||||
->schema([
|
||||
TextInput::make('faktor')
|
||||
->prefixIcon('phosphor-function')
|
||||
->numeric()
|
||||
->required(),
|
||||
])
|
||||
->icon('phosphor-function')
|
||||
->action(function (Collection $records, array $data): void {
|
||||
foreach ($records as $record) {
|
||||
ProjektMethode::where('id', '=', $record->id)
|
||||
->update(
|
||||
['faktor' => $data['faktor']]
|
||||
);
|
||||
}
|
||||
})->after(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshMethods');
|
||||
}),
|
||||
BulkAction::make('methode')
|
||||
->color('primary')
|
||||
->label('Methode zuweisen')
|
||||
->schema([
|
||||
Select::make('methode_id')
|
||||
->label('Methode')
|
||||
->prefixIcon('phosphor-calculator')
|
||||
->options(Methode::pluck('name', 'id'))
|
||||
->required(),
|
||||
])
|
||||
->icon('phosphor-calculator')
|
||||
->action(function (Collection $records, array $data): void {
|
||||
foreach ($records as $record) {
|
||||
ProjektMethode::where('id', '=', $record->id)
|
||||
->update(
|
||||
['methode_id' => $data['methode_id']]
|
||||
);
|
||||
}
|
||||
}),
|
||||
->color('primary')
|
||||
->label('Methode zuweisen')
|
||||
->schema([
|
||||
Select::make('methode_id')
|
||||
->label('Methode')
|
||||
->prefixIcon('phosphor-calculator')
|
||||
->options(Methode::pluck('name', 'id'))
|
||||
->required(),
|
||||
])
|
||||
->icon('phosphor-calculator')
|
||||
->action(function (Collection $records, array $data): void {
|
||||
foreach ($records as $record) {
|
||||
ProjektMethode::where('id', '=', $record->id)
|
||||
->update(
|
||||
['methode_id' => $data['methode_id']]
|
||||
);
|
||||
}
|
||||
})->after(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshMethods');
|
||||
}),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Support\HtmlString;
|
||||
use Illuminate\Validation\Rules\File;
|
||||
use Livewire\Component;
|
||||
|
||||
class RaeumeallesRelationManager extends RelationManager
|
||||
{
|
||||
@@ -41,9 +42,35 @@ class RaeumeallesRelationManager extends RelationManager
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('top_nummer')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
TextInput::make('geschoss')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
TextInput::make('raumart')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
TextInput::make('flaeche')
|
||||
->suffix(new HtmlString(' m²'))
|
||||
->rules(['required', 'flaeche' => 'decimal:2'])
|
||||
->label('Fläche')
|
||||
->validationMessages([
|
||||
'required' => 'Die Eingabe einer Fläche ist erforderlich.',
|
||||
'decimal' => 'Für die Fläche sind zwei Dezimalstellen erforderlich.',
|
||||
])
|
||||
->afterStateUpdated(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshAllgemeinflaechen');
|
||||
}),
|
||||
TextInput::make('faktor')
|
||||
->suffixIcon('phosphor-function')
|
||||
->rules(['required', 'faktor' => 'decimal:0,2'])
|
||||
->afterStateUpdated(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshRaeumealle');
|
||||
})->validationMessages([
|
||||
'required' => 'Die Eingabe eines Faktors ist erforderlich.',
|
||||
'decimal' => 'Für den Faktors sind zwei Dezimalstellen erforderlich.',
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -63,7 +90,13 @@ class RaeumeallesRelationManager extends RelationManager
|
||||
->suffixIcon('phosphor-function')
|
||||
->width('1rem')
|
||||
->rules(['required', 'faktor' => 'decimal:0,2'])
|
||||
->searchable(),
|
||||
->searchable()
|
||||
->afterStateUpdated(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshRaeumealle');
|
||||
})->validationMessages([
|
||||
'required' => 'Die Eingabe eines Faktors ist erforderlich.',
|
||||
'decimal' => 'Für den Faktors sind zwei Dezimalstellen erforderlich.',
|
||||
]),
|
||||
TextInputColumn::make('flaeche')
|
||||
->summarize(Sum::make()->label('Gesammt')->numeric(
|
||||
decimalPlaces: 2,
|
||||
@@ -73,7 +106,13 @@ class RaeumeallesRelationManager extends RelationManager
|
||||
->alignment('right')
|
||||
->rules(['required', 'flaeche' => 'decimal:2'])
|
||||
->label('Fläche')
|
||||
->searchable(),
|
||||
->searchable()
|
||||
->afterStateUpdated(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshRaeumealle');
|
||||
})->validationMessages([
|
||||
'required' => 'Die Eingabe einer Fläche ist erforderlich.',
|
||||
'decimal' => 'Für die Fläche sind zwei Dezimalstellen erforderlich.',
|
||||
]),
|
||||
TextColumn::make('nutzwert')
|
||||
->alignCenter()
|
||||
->default(fn ($record): ?int => round($record->faktor * $record->flaeche))
|
||||
@@ -115,8 +154,12 @@ class RaeumeallesRelationManager extends RelationManager
|
||||
]),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton(),
|
||||
DeleteAction::make()->iconButton(),
|
||||
EditAction::make()->iconButton()->after(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshRaeumealle');
|
||||
}),
|
||||
DeleteAction::make()->iconButton()->after(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshRaeumealle');
|
||||
}),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
@@ -137,8 +180,12 @@ class RaeumeallesRelationManager extends RelationManager
|
||||
['faktor' => $data['faktor']]
|
||||
);
|
||||
}
|
||||
})->after(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshRaeumealle');
|
||||
}),
|
||||
DeleteBulkAction::make(),
|
||||
DeleteBulkAction::make()->after(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshRaeumealle');
|
||||
}),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ class Allgemeinflaechen extends Model
|
||||
parent::boot();
|
||||
|
||||
self::updated(function ($model) {
|
||||
Projekte::where('id', $model['projekte_id'])->update(['evaluation' => false]);
|
||||
Projekte::where('id', $model['projekte_id'])->update(['evaluation_gutachten' => false]);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,15 @@ class OrientierungZuAbschlaege extends Model
|
||||
'j',
|
||||
];
|
||||
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
self::updated(function ($model) {
|
||||
Projekte::where('id', $model['projekte_id'])->update(['evaluation_gutachten' => false]);
|
||||
});
|
||||
}
|
||||
|
||||
public function orientierung()
|
||||
{
|
||||
return $this->hasOne(Orientierung::class, 'id', 'orientierung_id');
|
||||
|
||||
@@ -14,6 +14,15 @@ class ProjektMethode extends Model
|
||||
'flaeche',
|
||||
];
|
||||
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
self::updated(function ($model) {
|
||||
Projekte::where('id', $model['projekte_id'])->update(['evaluation_gutachten' => false]);
|
||||
});
|
||||
}
|
||||
|
||||
public function methode()
|
||||
{
|
||||
return $this->hasOne(Methode::class, 'id', 'methode_id');
|
||||
|
||||
@@ -15,4 +15,13 @@ class Raeumealle extends Model
|
||||
'faktor',
|
||||
'flaeche',
|
||||
];
|
||||
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
self::updated(function ($model) {
|
||||
Projekte::where('id', $model['projekte_id'])->update(['evaluation_gutachten' => false]);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user