Files
LarsandClaude Opus 5.5 799869c6a4 v0.11 U1: Kanalmanager mit eigener Webseite und neuen Prozessparametern
- Eigene Webseite als Kanal eigener Art (channels.kind = website), nur zur
  Konfiguration: Webseiten-Anfragen bleiben direkt (A1) ohne Kanalbezug;
  der Eintrag nimmt an Sync, Export, Überwachung und Sperraufgaben nicht teil
  (active()/Property::channels() nur Portale, Feed nur für Portale).
- Neue Einstellungen im bestehenden ProcessSetting: Klärungsreservierung
  automatisch/Freigabe (15/180 min, 0 = keine), Rückfragemodus,
  Erinnerungen, Folgefragen, Erinnerungsabstand, Linkgültigkeit,
  Anschrift im Webformular verlangen (Standard: nein).
- „Kanäle“ in der einfachen Ansicht: Webseite und Portale an einer Stelle,
  Verweis auf „Ihre Standards“; „Wirksame Einstellungen“ mit Spalte
  „Eigene Webseite“ und Herkunft „Webseite“.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 12:52:50 +01:00

84 lines
4.4 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Filament\Resources\IntakeObservations;
use App\Enums\CaseIntakeMode;
use App\Enums\IntakeOutcome;
use App\Filament\Concerns\FollowsAdminMode;
use App\Filament\Resources\Bookings\BookingResource;
use App\Filament\Resources\IntakeObservations\Pages\ListIntakeObservations;
use App\Models\Channel;
use App\Models\IntakeObservation;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Filters\SelectFilter;
use Filament\Tables\Table;
use UnitEnum;
/**
* The intake record (expert view): what came in over each portal, what the intake recognised, whether it acted or only
* observed, and why. Read only – the work itself happens under "Zu erledigen" and on the case page.
*/
class IntakeObservationResource extends Resource
{
use FollowsAdminMode;
protected static ?string $model = IntakeObservation::class;
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedInboxArrowDown;
protected static string|UnitEnum|null $navigationGroup = 'System';
protected static ?string $navigationLabel = 'Eingangsprotokoll';
protected static ?string $modelLabel = 'Eingang';
protected static ?string $pluralModelLabel = 'Eingangsprotokoll';
protected static ?int $navigationSort = 20;
public static function canCreate(): bool
{
return false;
}
public static function table(Table $table): Table
{
return $table
->description('Was über die Portale hereinkam und was daraus wurde. „Nur protokolliert“ heißt: Das Portal steht auf „Beobachten“ (oder es war nichts zu tun) – es ist nichts entstanden.')
->defaultSort('occurred_at', 'desc')
->modifyQueryUsing(fn ($query) => $query->with(['channel', 'booking']))
->columns([
TextColumn::make('occurred_at')->label('Wann')->dateTime('d.m.Y H:i')->sortable(),
TextColumn::make('channel.name')->label('Portal')->description(fn (IntakeObservation $record): string => $record->sourceLabel()),
TextColumn::make('period')->label('Zeitraum')->state(fn (IntakeObservation $record): ?string => $record->starts_on ? $record->starts_on->format('d.m.').'–'.$record->ends_on?->format('d.m.Y') : null)->placeholder('–'),
TextColumn::make('outcome')->label('Ergebnis')->badge()->description(fn (IntakeObservation $record): string => implode(' ', (array) $record->reasons))->wrap(),
TextColumn::make('case_type')->label('Art')->formatStateUsing(fn (?string $state): string => strtoupper((string) $state))->placeholder('–'),
IconColumn::make('applied')->label('Ausgeführt')->boolean()->tooltip('Ja: Vorgang angelegt, zugeordnet, Aufgabe erstellt oder zur Klärung vorgelegt. Nein: nur protokolliert.'),
TextColumn::make('mode')->label('Einstellung')->formatStateUsing(fn (CaseIntakeMode $state): string => match ($state) {
CaseIntakeMode::Observe => 'Beobachten',
CaseIntakeMode::Create => 'Anlegen',
CaseIntakeMode::Continue => 'Anlegen + weiter',
CaseIntakeMode::Off => 'Aus',
})->toggleable(),
TextColumn::make('reference')->label('Buchungsnr.')->placeholder('–')->toggleable(),
TextColumn::make('booking.reference')->label('Vorgang')->placeholder('–')
->url(fn (IntakeObservation $record): ?string => $record->booking ? BookingResource::getUrl('view', ['record' => $record->booking]) : null),
TextColumn::make('missing')->label('Fehlt noch')->state(fn (IntakeObservation $record): string => implode(', ', (array) $record->missing))->placeholder('–')->wrap()->toggleable(isToggledHiddenByDefault: true),
])
->filters([
SelectFilter::make('channel_id')->label('Portal')->options(fn (): array => Channel::query()->portals()->orderBy('name')->pluck('name', 'id')->all()),
SelectFilter::make('outcome')->label('Ergebnis')->options(IntakeOutcome::class),
SelectFilter::make('applied')->label('Ausgeführt')->options(['1' => 'ja', '0' => 'nur protokolliert']),
]);
}
public static function getPages(): array
{
return ['index' => ListIntakeObservations::route('/')];
}
}