nutzwert in tabelle rauemall und orientierung
This commit is contained in:
1 parent
fe03a71735
commit
5583bed563
24 files changed
+726
-526
No files matched your search
@@ -115,7 +115,7 @@ class RaeumeallesRelationManager extends RelationManager
|
||||
]),
|
||||
TextColumn::make('nutzwert')
|
||||
->alignCenter()
|
||||
->default(fn ($record): ?int => round($record->faktor * $record->flaeche))
|
||||
->summarize(Sum::make()->label('Gesammt'))
|
||||
->weight(FontWeight::ExtraBold),
|
||||
])
|
||||
->filters([
|
||||
@@ -154,9 +154,14 @@ class RaeumeallesRelationManager extends RelationManager
|
||||
]),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton()->after(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshRaeumealle');
|
||||
}),
|
||||
EditAction::make()->iconButton()
|
||||
->mutateDataUsing(function (array $data): array {
|
||||
$data['nutzwert'] = round($data['faktor'] * $data['flaeche']);
|
||||
|
||||
return $data;
|
||||
})->after(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshRaeumealle');
|
||||
}),
|
||||
DeleteAction::make()->iconButton()->after(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshRaeumealle');
|
||||
}),
|
||||
@@ -175,9 +180,13 @@ class RaeumeallesRelationManager extends RelationManager
|
||||
->icon('phosphor-calculator')
|
||||
->action(function (Collection $records, array $data): void {
|
||||
foreach ($records as $record) {
|
||||
$nutzwert = round($data['faktor'] * $record->flaeche);
|
||||
Raeumealle::where('id', '=', $record->id)
|
||||
->update(
|
||||
['faktor' => $data['faktor']]
|
||||
[
|
||||
'faktor' => $data['faktor'],
|
||||
'nutzwert' => $nutzwert,
|
||||
]
|
||||
);
|
||||
}
|
||||
})->after(function (Component $livewire) {
|
||||
|
||||
Reference in new issue
Block a user