recordTitleAttribute('amount') ->description(fn (): string => 'Bezahlt: '.Money::format($this->ownerRecord->paidAmount()).' ยท offen: '.Money::format($this->ownerRecord->openAmount())) ->columns([ TextColumn::make('paid_on')->label('Eingang')->date('d.m.Y'), TextColumn::make('amount')->label('Betrag')->money('EUR', divideBy: 100, locale: 'de'), TextColumn::make('method')->label('Art'), TextColumn::make('note')->label('Notiz')->placeholder('โ€“'), TextColumn::make('recorded_by')->label('Erfasst von')->placeholder('โ€“'), ]) ->headerActions([ Action::make('record') ->label('Zahlung erfassen') ->icon(Heroicon::OutlinedBanknotes) ->fillForm(fn (): array => [ 'amount' => number_format(($this->ownerRecord->openDeposit() ?: $this->ownerRecord->openAmount()) / 100, 2, '.', ''), 'paid_on' => today(), 'method' => PaymentMethod::Transfer, ]) ->schema([ EuroInput::make('amount')->label('Betrag')->helperText('Erstattungen mit Minus erfassen.')->minValue(null)->required(), DatePicker::make('paid_on')->label('Zahlungseingang')->required(), Select::make('method')->label('Art')->options(PaymentMethod::class)->required(), TextInput::make('note')->label('Notiz')->maxLength(255), ]) ->action(function (array $data, RecordPayment $recordPayment): void { $recordPayment->handle( $this->ownerRecord, (int) $data['amount'], CarbonImmutable::parse($data['paid_on']), $data['method'] instanceof PaymentMethod ? $data['method'] : PaymentMethod::from($data['method']), $data['note'] ?: null, auth()->user()?->name, ); Notification::make()->title('Zahlung erfasst โ€“ Status: '.$this->ownerRecord->fresh()->status->getLabel())->success()->send(); }), ]) ->recordActions([ DeleteAction::make()->after(fn (Payment $record) => app(RecordPayment::class)->updateStatus($this->ownerRecord->fresh())), ]); } }