schema([ Select::make('package_id') ->label('Paket') ->relationship('package', 'name') ->searchable() ->preload() ->required(), Select::make('type') ->label('Typ') ->options([ 'endcustomer_event' => 'Endkunden-Event', 'reseller_subscription' => 'Reseller-Abo', ]) ->required(), TextInput::make('purchased_price') ->label('Gekaufter Preis') ->numeric() ->step(0.01) ->prefix('€') ->required(), Select::make('provider_id') ->label('Anbieter') ->options([ 'stripe' => 'Stripe', 'paypal' => 'PayPal', 'manual' => 'Manuell', 'free' => 'Kostenlos', ]) ->required(), TextInput::make('transaction_id') ->label('Transaktions-ID') ->maxLength(255), Toggle::make('refunded') ->label('Rückerstattet'), Textarea::make('metadata') ->label('Metadaten') ->json() ->columnSpanFull(), ]) ->columns(2); } public function table(Table $table): Table { return $table ->recordTitleAttribute('package.name') ->columns([ TextColumn::make('package.name') ->label('Paket') ->badge() ->color('success'), TextColumn::make('type') ->badge() ->color(fn (string $state): string => match($state) { 'endcustomer_event' => 'info', 'reseller_subscription' => 'success', default => 'gray', }), TextColumn::make('price') ->money('EUR') ->sortable(), TextColumn::make('provider_id') ->badge() ->color(fn (string $state): string => match($state) { 'stripe' => 'info', 'paypal' => 'warning', 'manual' => 'gray', 'free' => 'success', }), TextColumn::make('transaction_id') ->copyable() ->toggleable(), TextColumn::make('metadata') ->label('Metadaten') ->toggleable(), IconColumn::make('refunded') ->boolean() ->color(fn (bool $state): string => $state ? 'danger' : 'success'), TextColumn::make('created_at') ->dateTime() ->sortable(), ]) ->filters([ SelectFilter::make('type') ->options([ 'endcustomer_event' => 'Endkunden-Event', 'reseller_subscription' => 'Reseller-Abo', ]), SelectFilter::make('provider_id') ->options([ 'stripe' => 'Stripe', 'paypal' => 'PayPal', 'manual' => 'Manuell', 'free' => 'Kostenlos', ]), SelectFilter::make('refunded') ->options([ '1' => 'Rückerstattet', '0' => 'Nicht rückerstattet', ]), ]) ->headerActions([]) ->actions([ ViewAction::make(), ]) ->bulkActions([ BulkActionGroup::make([ DeleteBulkAction::make(), ]), ]); } }