Ein Eingang fuer alle Kanaele (Paket 4, Prozessarchitektur v0.10)
Portalbuchungen und -anfragen aus Kalender und Mail werden ueber PortalIntake zum Vorgang (nur bei sicherer Erkennung), Dubletten ueber Buchungsnummer, gleiches Portal mit gleichen Naechten und Spiegelung; Unsicheres wird geklaert. Portalstorno und -aenderung als Aufgabe am Vorgang ohne stille Stornierung. Schalter je Kanal (Aus als Standard, Beobachten, Anlegen, Anlegen + weiter), Eingangsprotokoll, Bestandsuebernahme mit Vorschau/Bericht/Ruecknahme, Sperrnachweis in drei Stufen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cf11c8a474
commit
ac9d20b812
29 files changed
+1952
-16
No files matched your search
@@ -0,0 +1,83 @@
|
||||
<?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()->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('/')];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user