action evaluation
This commit is contained in:
1 parent
d473bdc2b3
commit
9eb19cf8fd
13 files changed
+297
-132
No files matched your search
@@ -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');
|
||||
}),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user