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 ->striped() ->recordTitleAttribute('geschoss') ->columns([ TextColumn::make('geschoss')->searchable(), TextColumn::make('raumart')->searchable(), TextInputColumn::make('flaeche') ->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('refreshAllgemeinflaechen'); }), ]) ->filters([ // ]) ->headerActions([ CreateAction::make() ->icon('phosphor-file-plus') ->createAnother(false), ImportAction::make() ->importer(AllgemeinflaechenImporter::class) ->modalHeading('Allgemeinflächen Import') // ->modalSubmitActionLabel('Yes, delete it') ->label('Hochladen') ->icon('phosphor-upload') ->color('info') ->options([ 'projekte_id' => $this->getOwnerRecord()->id, ]) ->fileRules([ File::types(['csv', 'txt'])->max(1024), ]), ]) ->recordActions([ EditAction::make()->iconButton() ->after(function (Component $livewire) { $livewire->dispatch('refreshAllgemeinflaechen'); }), DeleteAction::make()->iconButton()->after(function (Component $livewire) { $livewire->dispatch('refreshAllgemeinflaechen'); }), ]) ->toolbarActions([ BulkActionGroup::make([ DeleteBulkAction::make() ->after(function (Component $livewire) { $livewire->dispatch('refreshAllgemeinflaechen'); }), ]), ]); } }