where('status', 'neu')->count(); return $new > 0 ? (string) $new : null; } public static function getNavigationBadgeTooltip(): ?string { return 'Neue Anfragen'; } public static function infolist(Schema $schema): Schema { return $schema->components([ Section::make('Ansprechpartner')->columns(2)->schema([ TextEntry::make('contact_name')->label('Name')->placeholder('Nicht angegeben'), TextEntry::make('organisation')->label('Organisation')->placeholder('Nicht angegeben'), TextEntry::make('contact_email')->label('E-Mail-Adresse')->placeholder('Nicht angegeben')->copyable(), TextEntry::make('contact_phone')->label('Telefon')->placeholder('Nicht angegeben'), ]), Section::make('Anliegen')->columns(2)->schema([ TextEntry::make('issue')->label('Anliegen')->state(fn (Inquiry $record): string => $record->issueTitle() ?: 'Nicht erfragt'), TextEntry::make('status')->label('Bearbeitungsstatus')->badge() ->formatStateUsing(fn ($state): string => $state->label()) ->color(fn ($state): string => $state->color()), TextEntry::make('channel')->label('Eingegangen über')->state(fn (Inquiry $record): string => $record->channelTitle()), TextEntry::make('source_path')->label('Quellseite')->placeholder('Unbekannt'), TextEntry::make('created_at')->label('Eingegangen')->dateTime('d.m.Y H:i'), TextEntry::make('reference')->label('Kennzeichen')->copyable(), TextEntry::make('version')->label('Formularfassung') ->state(fn (Inquiry $record): string => 'Vorlage „'.($record->templateVersion->template->name ?? '').'“, Fassung '.($record->templateVersion->version ?? '')), TextEntry::make('notification')->label('Benachrichtigung') ->state(fn (Inquiry $record): string => $record->notified_at !== null ? 'Gesendet am '.$record->notified_at->format('d.m.Y H:i') : ($record->notification_error ?: 'Noch nicht gesendet')) ->color(fn (Inquiry $record): ?string => $record->notified_at === null && $record->notification_error !== null ? 'danger' : null), ]), Section::make('Antworten')->schema([ ViewEntry::make('answers')->hiddenLabel()->view('filament.communication.answers'), ]), Section::make('Nachricht')->visible(fn (Inquiry $record): bool => filled($record->message))->schema([ TextEntry::make('message')->hiddenLabel()->extraAttributes(['style' => 'white-space: pre-line']), ]), Section::make('Interne Notizen')->schema([ RepeatableEntry::make('notes')->hiddenLabel()->placeholder('Noch keine Notizen.')->schema([ TextEntry::make('body')->hiddenLabel()->extraAttributes(['style' => 'white-space: pre-line']), TextEntry::make('meta')->hiddenLabel()->color('gray') ->state(fn ($record): string => ($record->author->name ?? 'Unbekannt').' · '.$record->created_at->format('d.m.Y H:i')), ]), ]), ]); } public static function form(Schema $schema): Schema { return $schema; } public static function table(Table $table): Table { return $table->columns([TextColumn::make('reference')->label('Kennzeichen')]); } public static function getPages(): array { return [ 'index' => ListInquiries::route('/'), 'view' => ViewInquiry::route('/{record}'), ]; } }