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