components([ TextInput::make('geschoss') ->required() ->maxLength(255), TextInput::make('raumart') ->required() ->maxLength(255), TextInput::make('flaeche') ->suffix(new HtmlString(' m²')) ->numeric() ->label('Fläche') ->rules(['required', 'flaeche' => 'decimal:2']) ->validationMessages([ 'required' => 'Die Eingabe einer Fläche ist erforderlich.', 'decimal' => 'Für die Fläche sind zwei Dezimalstellen erforderlich.', ]), ])->columns(3); } public function table(Table $table): Table { return $table ->emptyStateDescription('Schalten Sie das Projekt frei und importieren Sie die Daten der Allgemeinflächen.') ->striped() ->recordTitleAttribute('geschoss') ->columns([ TextColumn::make('geschoss')->searchable(), TextColumn::make('raumart')->searchable(), TextInputColumn::make('flaeche') ->extraInputAttributes(['onClick' => 'this.select()']) ->summarize(Sum::make()->label('Gesammt')->numeric( decimalPlaces: 2, )->suffix(new HtmlString(' m²'))) ->suffix(new HtmlString(' m²')) ->width('2rem') ->rules(['required', 'flaeche' => 'decimal:2']) ->alignment('right') ->label('Fläche') ->searchable() ->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('refreshProjektAllgemeinflaechen'); }), ]) ->headerActions([ CreateAction::make() ->icon('phosphor-file-plus') ->createAnother(false), ]) ->recordActions([ EditAction::make()->iconButton() ->after(function (Component $livewire) { $livewire->dispatch('refreshProjektAllgemeinflaechen'); }), DeleteAction::make()->iconButton()->after(function (Component $livewire) { $livewire->dispatch('refreshProjektAllgemeinflaechen'); }), ]) ->toolbarActions([ BulkActionGroup::make([ DeleteBulkAction::make() ->after(function (Component $livewire) { $livewire->dispatch('refreshProjektAllgemeinflaechen'); }), ]), ]); } }