This commit is contained in:
salam committed 2025-11-14 12:33:19 +01:00
1 parent a20893d527
commit 4b79874100
31 files changed
+549 -1535

No files matched your search

@@ -5,6 +5,7 @@ namespace App\Filament\Resources\Projektes\RelationManagers;
use App\Actions\Create\CreateProjektMethoden;
use App\Models\Methode;
use App\Models\ProjektMethode;
use App\Models\ProjektObjekteImDetail;
use Filament\Actions\Action;
use Filament\Actions\BulkAction;
use Filament\Actions\BulkActionGroup;
@@ -59,8 +60,12 @@ class ProjektMethodesRelationManager extends RelationManager
->width('1rem')
->rules(['required', 'faktor' => 'decimal:0,2'])
->searchable()
->afterStateUpdated(function (Component $livewire) {
$livewire->dispatch('refreshMethods');
->afterStateUpdated(function ($record) {
$objects = ProjektObjekteImDetail::where('projekte_id', $record['projekte_id'])->where('raumart', $record['raumart'])->get();
foreach ($objects as $value) {
$nutzwert = round($record['faktor'] * $value->flaeche, 2);
ProjektObjekteImDetail::where('id', $value->id)->update(['nutzwert' => $nutzwert]);
}
})->validationMessages([
'required' => 'Die Eingabe eines Faktors ist erforderlich.',
'decimal' => 'Für den Faktors sind zwei Dezimalstellen erforderlich.',
@@ -130,6 +135,7 @@ class ProjektMethodesRelationManager extends RelationManager
->icon('phosphor-function')
->action(function (Collection $records, array $data): void {
foreach ($records as $record) {
/** @var object $record */
ProjektMethode::where('id', '=', $record->id)
->update(
['faktor' => $data['faktor']]
@@ -151,6 +157,7 @@ class ProjektMethodesRelationManager extends RelationManager
->icon('phosphor-calculator')
->action(function (Collection $records, array $data): void {
foreach ($records as $record) {
/** @var object $record */
ProjektMethode::where('id', '=', $record->id)
->update(
['methode_id' => $data['methode_id']]